Prompt:
/// Return length of given string
/// >>> strlen(string: "")
/// 0
/// >>> strlen(string: "abc")
/// 3
func strlen(string: String) -> Int {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(strlen(string: "") == 0)
assert(strlen(string: "x") == 1)
assert(strlen(string: "asdasnakj") == 9)


Prompt:
/// 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(s: "hi")
/// "lm"
/// >>> encrypt(s: "asdfghjkl")
/// "ewhjklnop"
/// >>> encrypt(s: "gf")
/// "kj"
/// >>> encrypt(s: "et")
/// "ix"
func encrypt(s: String) -> String {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(encrypt(s: "hi") == "lm")
assert(encrypt(s: "asdfghjkl") == "ewhjklnop")
assert(encrypt(s: "gf") == "kj")
assert(encrypt(s: "et") == "ix")
assert(encrypt(s: "faewfawefaewg") == "jeiajeaijeiak")
assert(encrypt(s: "hellomyfriend") == "lippsqcjvmirh")
assert(encrypt(s: "dxzdlmnilfuhmilufhlihufnmlimnufhlimnufhfucufh") == "hbdhpqrmpjylqmpyjlpmlyjrqpmqryjlpmqryjljygyjl")
assert(encrypt(s: "a") == "e")


Prompt:
/// Given a non-empty array of integers lst. add the even elements that are at odd indices..
/// Examples:
/// >>> add(lst: [4, 2, 6, 7])
/// 2
func add(lst: [Int]) -> Int {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(add(lst: [4, 88]) == 88)
assert(add(lst: [4, 5, 6, 7, 2, 122]) == 122)
assert(add(lst: [4, 0, 6, 7]) == 0)
assert(add(lst: [4, 4, 6, 8]) == 12)


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(text: " Example")
/// "Example"
/// >>> fix_spaces(text: " Example 1")
/// "Example_1"
/// >>> fix_spaces(text: " Example 2")
/// "_Example_2"
/// >>> fix_spaces(text: " Example 3")
/// "_Example-3"
func fix_spaces(text: String) -> String {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(fix_spaces(text: "Example") == "Example")
assert(fix_spaces(text: "Mudasir Hanif ") == "Mudasir_Hanif_")
assert(fix_spaces(text: "Yellow Yellow  Dirty  Fellow") == "Yellow_Yellow__Dirty__Fellow")
assert(fix_spaces(text: "Exa   mple") == "Exa-mple")
assert(fix_spaces(text: "   Exa 1 2 2 mple") == "-Exa_1_2_2_mple")


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(n: 1)
/// 0
/// >>> fibfib(n: 5)
/// 4
/// >>> fibfib(n: 8)
/// 24
func fibfib(n: Int) -> Int {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(fibfib(n: 2) == 1)
assert(fibfib(n: 1) == 0)
assert(fibfib(n: 5) == 4)
assert(fibfib(n: 8) == 24)
assert(fibfib(n: 10) == 81)
assert(fibfib(n: 12) == 274)
assert(fibfib(n: 14) == 927)


Prompt:
/// Given an array of numbers, return the sum of squares of the numbers
/// in the array that are odd. Ignore numbers that are negative or not integers.
/// >>> double_the_difference(lst: [1, 3, 2, 0])
/// 10
/// >>> double_the_difference(lst: [-1, -2, 0])
/// 0
/// >>> double_the_difference(lst: [9, -2])
/// 81
/// >>> double_the_difference(lst: [0])
/// 0
/// If the input array is empty, return 0.
func double_the_difference(lst: [Double]) -> Int {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(double_the_difference(lst: [] as [Double]) == 0)
assert(double_the_difference(lst: [5.0, 4.0]) == 25)
assert(double_the_difference(lst: [0.1, 0.2, 0.3]) == 0)
assert(double_the_difference(lst: [-10.0, -20.0, -30.0]) == 0)
assert(double_the_difference(lst: [-1.0, -2.0, 8.0]) == 0)
assert(double_the_difference(lst: [0.2, 3.0, 5.0]) == 34)
assert(double_the_difference(lst: [-9.0, -7.0, -5.0, -3.0, -1.0, 1.0, 3.0, 5.0, 7.0, 9.0]) == 165)


Prompt:
/// Filter given array of any swiftthon values only for integers
/// >>> filter_integers(values: ["a", 3.14, 5])
/// [5]
/// >>> filter_integers(values: [1, 2, 3, "abc", [:] as [AnyHashable : AnyHashable], [] as [AnyHashable]])
/// [1, 2, 3]
func filter_integers(values: [AnyHashable]) -> [Int] {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(filter_integers(values: [] as [AnyHashable]) == [] as [Int])
assert(filter_integers(values: [4, [:] as [AnyHashable : AnyHashable], [] as [AnyHashable], 23.2, 9, "adasd"]) == [4, 9])
assert(filter_integers(values: [3, "c", 3, 3, "a", "b"]) == [3, 3, 3])


Prompt:
/// Imagine a road that's a perfectly straight infinitely long line.
/// n cars are driving left to right;  simultaneously, a different set of n cars
/// are driving right to left.   The two sets of cars start out being very far from
/// each other.  All cars move in the same speed.  Two cars are said to collide
/// when a car that's moving left to right hits a car that's moving right to left.
/// However, the cars are infinitely sturdy and strong; as a result, they continue moving
/// in their trajectory as if they did not collide.
/// This function outputs the number of such collisions.
func car_race_collision(n: Int) -> Int {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(car_race_collision(n: 2) == 4)
assert(car_race_collision(n: 3) == 9)
assert(car_race_collision(n: 4) == 16)
assert(car_race_collision(n: 8) == 64)
assert(car_race_collision(n: 10) == 100)


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 array 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(music_string: "o o| .| o| o| .| .| .| .| o o")
/// [4, 2, 1, 2, 2, 1, 1, 1, 1, 4, 4]
func parse_music(music_string: String) -> [Int] {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(parse_music(music_string: "") == [] as [Int])
assert(parse_music(music_string: "o o o o") == [4, 4, 4, 4])
assert(parse_music(music_string: ".| .| .| .|") == [1, 1, 1, 1])
assert(parse_music(music_string: "o| o| .| .| o o o o") == [2, 2, 1, 1, 4, 4, 4, 4])
assert(parse_music(music_string: "o| .| o| .| o o| o o|") == [2, 1, 2, 1, 4, 2, 4, 2])


Prompt:
/// 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 end of the string.
/// The extra characters are there to help with the format.
/// Examples:
/// >>> decimal_to_binary(decimal: 15)
/// "db1111db"
/// >>> decimal_to_binary(decimal: 32)
/// "db100000db"
func decimal_to_binary(decimal: Int) -> String {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(decimal_to_binary(decimal: 0) == "db0db")
assert(decimal_to_binary(decimal: 32) == "db100000db")
assert(decimal_to_binary(decimal: 103) == "db1100111db")
assert(decimal_to_binary(decimal: 15) == "db1111db")


Prompt:
/// Return array of all prefixes from shortest to longest of the input string
/// >>> all_prefixes(string: "abc")
/// ["a", "ab", "abc"]
func all_prefixes(string: String) -> [String] {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(all_prefixes(string: "") == [] as [String])
assert(all_prefixes(string: "asdfgh") == ["a", "as", "asd", "asdf", "asdfg", "asdfgh"])
assert(all_prefixes(string: "WWW") == ["W", "WW", "WWW"])


Prompt:
/// Add two numbers x and y
/// >>> add(x: 2, y: 3)
/// 5
/// >>> add(x: 5, y: 7)
/// 12
func add(x: Int, y: Int) -> Int {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(add(x: 0, y: 1) == 1)
assert(add(x: 1, y: 0) == 1)
assert(add(x: 2, y: 3) == 5)
assert(add(x: 5, y: 7) == 12)
assert(add(x: 7, y: 5) == 12)


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 an array 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(number: 5, need: 6, remaining: 10)
/// [11, 4]
/// >>> eat(number: 4, need: 8, remaining: 9)
/// [12, 1]
/// >>> eat(number: 1, need: 10, remaining: 10)
/// [11, 0]
/// >>> eat(number: 2, need: 11, remaining: 5)
/// [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 :)
func eat(number: Int, need: Int, remaining: Int) -> [Int] {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(eat(number: 5, need: 6, remaining: 10) == [11, 4])
assert(eat(number: 4, need: 8, remaining: 9) == [12, 1])
assert(eat(number: 1, need: 10, remaining: 10) == [11, 0])
assert(eat(number: 2, need: 11, remaining: 5) == [7, 0])
assert(eat(number: 4, need: 5, remaining: 7) == [9, 2])
assert(eat(number: 4, need: 5, remaining: 1) == [5, 0])


Prompt:
/// 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 wells.
/// Output the number of times you need to lower the buckets.
/// Example 1:
/// >>> max_fill(grid: [[0, 0, 1, 0], [0, 1, 0, 0], [1, 1, 1, 1]], capacity: 1)
/// 6
/// Example 2:
/// >>> max_fill(grid: [[0, 0, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1], [0, 1, 1, 1]], capacity: 2)
/// 5
/// Example 3:
/// >>> max_fill(grid: [[0, 0, 0], [0, 0, 0]], capacity: 5)
/// 0
/// Constraints:
/// * all wells have the same length
/// * 1 <= grid.length <= 10^2
/// * 1 <= grid[:,1].length <= 10^2
/// * grid[i][j] -> 0 | 1
/// * 1 <= capacity <= 10
func max_fill(grid: [[Int]], capacity: Int) -> Int {


Prompt:
/// Given two arrays operator, and operand. The first array has basic algebra operations, and
/// the second array is an array of integers. Use the two given arrays to build the algebric
/// expression and return the evaluation of this expression.
/// The basic algebra operations:
/// Addition ( + )
/// Subtraction ( - )
/// Multiplication ( * )
/// Floor division ( // )
/// Exponentiation ( ** )
/// Example:
/// operator['+', '*', '-']
/// array = [2, 3, 4, 5]
/// result = 2 + 3 * 4 - 5
/// => result = 9
/// Note:
/// The length of operator array is equal to the length of operand array minus one.
/// Operand is an array of of non-negative integers.
/// Operator array has at least one operator, and operand array has at least two operands.
func do_algebra(operator: [String], operand: [Int]) -> Int {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(do_algebra(operator: ["**", "*", "+"], operand: [2, 3, 4, 5]) == 37)
assert(do_algebra(operator: ["+", "*", "-"], operand: [2, 3, 4, 5]) == 9)
assert(do_algebra(operator: ["//", "*"], operand: [7, 3, 4]) == 8)


Prompt:
/// For a given string, flip lowercase characters to uppercase and uppercase to lowercase.
/// >>> flip_case(string: "Hello")
/// "hELLO"
func flip_case(string: String) -> String {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(flip_case(string: "") == "")
assert(flip_case(string: "Hello!") == "hELLO!")
assert(flip_case(string: "These violent delights have violent ends") == "tHESE VIOLENT DELIGHTS HAVE VIOLENT ENDS")


Prompt:
/// 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(arr: [2, 1, 1, 4, 5, 8, 2, 3])
/// ["Eight", "Five", "Four", "Three", "Two", "Two", "One", "One"]
/// If the array is empty, return an empty array:
/// >>> by_length(arr: [] as [Int])
/// [] as [String]
/// If the array has any strange number ignore it:
/// >>> by_length(arr: [1, -1, 55])
/// ["One"]
func by_length(arr: [Int]) -> [String] {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(by_length(arr: [2, 1, 1, 4, 5, 8, 2, 3]) == ["Eight", "Five", "Four", "Three", "Two", "Two", "One", "One"])
assert(by_length(arr: [] as [Int]) == [] as [String])
assert(by_length(arr: [1, -1, 55]) == ["One"])
assert(by_length(arr: [1, -1, 3, 2]) == ["Three", "Two", "One"])
assert(by_length(arr: [9, 4, 8]) == ["Nine", "Eight", "Four"])


Prompt:
/// Return array of prime factors of given integer in the order from smallest to largest.
/// Each of the factors should be arrayed number of times corresponding to how many times it appeares in factorization.
/// Input number should be equal to the product of all factors
/// >>> factorize(n: 8)
/// [2, 2, 2]
/// >>> factorize(n: 25)
/// [5, 5]
/// >>> factorize(n: 70)
/// [2, 5, 7]
func factorize(n: Int) -> [Int] {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(factorize(n: 2) == [2])
assert(factorize(n: 4) == [2, 2])
assert(factorize(n: 8) == [2, 2, 2])
assert(factorize(n: 57) == [3, 19])
assert(factorize(n: 3249) == [3, 3, 19, 19])
assert(factorize(n: 185193) == [3, 3, 3, 19, 19, 19])
assert(factorize(n: 20577) == [3, 19, 19, 19])
assert(factorize(n: 18) == [2, 3, 3])


Prompt:
/// Implement a function that takes an non-negative integer and returns an array of the first n
/// integers that are prime numbers and less than n.
/// for example:
/// >>> count_up_to(n: 5)
/// [2, 3]
/// >>> count_up_to(n: 11)
/// [2, 3, 5, 7]
/// >>> count_up_to(n: 0)
/// [] as [Int]
/// >>> count_up_to(n: 20)
/// [2, 3, 5, 7, 11, 13, 17, 19]
/// >>> count_up_to(n: 1)
/// [] as [Int]
/// >>> count_up_to(n: 18)
/// [2, 3, 5, 7, 11, 13, 17]
func count_up_to(n: Int) -> [Int] {


Prompt:
/// Return sorted unique elements in an array
/// >>> unique(l: [5, 3, 5, 2, 3, 3, 9, 0, 123])
/// [0, 2, 3, 5, 9, 123]
func unique(l: [Int]) -> [Int] {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(unique(l: [5, 3, 5, 2, 3, 3, 9, 0, 123]) == [0, 2, 3, 5, 9, 123])


Prompt:
/// Write a function that accepts two arrays of strings and returns the array that has
/// total number of chars in the all strings of the array less than the other array.
/// if the two arrays have the same number of chars, return the first array.
/// Examples
/// >>> total_match(lst1: [] as [String], lst2: [] as [String])
/// [] as [String]
/// >>> total_match(lst1: ["hi", "admin"], lst2: ["hI", "Hi"])
/// ["hI", "Hi"]
/// >>> total_match(lst1: ["hi", "admin"], lst2: ["hi", "hi", "admin", "project"])
/// ["hi", "admin"]
/// >>> total_match(lst1: ["hi", "admin"], lst2: ["hI", "hi", "hi"])
/// ["hI", "hi", "hi"]
/// >>> total_match(lst1: ["4"], lst2: ["1", "2", "3", "4", "5"])
/// ["4"]
func total_match(lst1: [String], lst2: [String]) -> [String] {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(total_match(lst1: [] as [String], lst2: [] as [String]) == [] as [String])
assert(total_match(lst1: ["hi", "admin"], lst2: ["hi", "hi"]) == ["hi", "hi"])
assert(total_match(lst1: ["hi", "admin"], lst2: ["hi", "hi", "admin", "project"]) == ["hi", "admin"])
assert(total_match(lst1: ["4"], lst2: ["1", "2", "3", "4", "5"]) == ["4"])
assert(total_match(lst1: ["hi", "admin"], lst2: ["hI", "Hi"]) == ["hI", "Hi"])
assert(total_match(lst1: ["hi", "admin"], lst2: ["hI", "hi", "hi"]) == ["hI", "hi", "hi"])
assert(total_match(lst1: ["hi", "admin"], lst2: ["hI", "hi", "hii"]) == ["hi", "admin"])
assert(total_match(lst1: [] as [String], lst2: ["this"]) == [] as [String])
assert(total_match(lst1: ["this"], lst2: [] as [String]) == [] as [String])


Prompt:
/// Return maximum element in the array.
/// >>> max_element(l: [1, 2, 3])
/// 3
/// >>> max_element(l: [5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])
/// 123
func max_element(l: [Int]) -> Int {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(max_element(l: [1, 2, 3]) == 3)
assert(max_element(l: [5, 3, -5, 2, -3, 3, 9, 0, 124, 1, -10]) == 124)


Prompt:
/// 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: "[[]]")
/// true
/// >>> is_nested(string: "[]]]]]]][[[[[]")
/// false
/// >>> is_nested(string: "[][]")
/// false
/// >>> is_nested(string: "[]")
/// false
/// >>> is_nested(string: "[[][]]")
/// true
/// >>> is_nested(string: "[[]][[")
/// true
func is_nested(string: String) -> Bool {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(is_nested(string: "[[]]") == true)
assert(is_nested(string: "[]]]]]]][[[[[]") == false)
assert(is_nested(string: "[][]") == false)
assert(is_nested(string: "[]") == false)
assert(is_nested(string: "[[[[]]]]") == true)
assert(is_nested(string: "[]]]]]]]]]]") == false)
assert(is_nested(string: "[][][[]]") == true)
assert(is_nested(string: "[[]") == false)
assert(is_nested(string: "[]]") == false)
assert(is_nested(string: "[[]][[") == true)
assert(is_nested(string: "[[][]]") == true)
assert(is_nested(string: "") == false)
assert(is_nested(string: "[[[[[[[[") == false)
assert(is_nested(string: "]]]]]]]]") == false)


Prompt:
extension Int: Error {}

/// You are given two positive integers n and m, and your task is to compute the
/// average of the integers from n through m (including n and m).
/// Round the answer to the nearest integer and convert that to binary.
/// If n is greater than m, return -1.
/// Example:
/// >>> rounded_avg(n: 1, m: 5)
/// .success("0b11")
/// >>> rounded_avg(n: 7, m: 5)
/// .failure(-1)
/// >>> rounded_avg(n: 10, m: 20)
/// .success("0b1111")
/// >>> rounded_avg(n: 20, m: 33)
/// .success("0b11010")
func rounded_avg(n: Int, m: Int) -> Result<String, Int> {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(rounded_avg(n: 1, m: 5) == .success("0b11"))
assert(rounded_avg(n: 7, m: 13) == .success("0b1010"))
assert(rounded_avg(n: 964, m: 977) == .success("0b1111001010"))
assert(rounded_avg(n: 996, m: 997) == .success("0b1111100100"))
assert(rounded_avg(n: 560, m: 851) == .success("0b1011000010"))
assert(rounded_avg(n: 185, m: 546) == .success("0b101101110"))
assert(rounded_avg(n: 362, m: 496) == .success("0b110101101"))
assert(rounded_avg(n: 350, m: 902) == .success("0b1001110010"))
assert(rounded_avg(n: 197, m: 233) == .success("0b11010111"))
assert(rounded_avg(n: 7, m: 5) == .failure(-1))
assert(rounded_avg(n: 5, m: 1) == .failure(-1))
assert(rounded_avg(n: 5, m: 5) == .success("0b101"))


Prompt:
/// Given an array of strings, where each string consists of only digits, return an array.
/// 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(lst: ["1234567"])
/// ["the number of odd elements 4n the str4ng 4 of the 4nput."]
/// >>> odd_count(lst: ["3", "11111111"])
/// ["the number of odd elements 1n the str1ng 1 of the 1nput.", "the number of odd elements 8n the str8ng 8 of the 8nput."]
func odd_count(lst: [String]) -> [String] {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(odd_count(lst: ["1234567"]) == ["the number of odd elements 4n the str4ng 4 of the 4nput."])
assert(odd_count(lst: ["3", "11111111"]) == ["the number of odd elements 1n the str1ng 1 of the 1nput.", "the number of odd elements 8n the str8ng 8 of the 8nput."])
assert(odd_count(lst: ["271", "137", "314"]) == ["the number of odd elements 2n the str2ng 2 of the 2nput.", "the number of odd elements 3n the str3ng 3 of the 3nput.", "the number of odd elements 2n the str2ng 2 of the 2nput."])


Prompt:
/// 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 shift operation any number of times.
/// One right shift operation means shifting all elements of the array by one
/// position in the right direction. The last element of the array will be moved to
/// the starting position in the array i.e. 0th index.
/// If it is possible to obtain the sorted array by performing the above operation
/// then return true else return false.
/// If the given array is empty then return true.
/// Note: The given array is guaranteed to have unique elements.
/// For Example:
/// >>> move_one_ball(arr: [3, 4, 5, 1, 2])
/// true
/// Explanation: By performin 2 right shift operations, non-decreasing order can
/// be achieved for the given array.
/// >>> move_one_ball(arr: [3, 5, 4, 1, 2])
/// false
/// Explanation:It is not possible to get non-decreasing order for the given
/// array by performing any number of right shift operations.
func move_one_ball(arr: [Int]) -> Bool {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(move_one_ball(arr: [3, 4, 5, 1, 2]) == true)
assert(move_one_ball(arr: [3, 5, 10, 1, 2]) == true)
assert(move_one_ball(arr: [4, 3, 1, 2]) == false)
assert(move_one_ball(arr: [3, 5, 4, 1, 2]) == false)
assert(move_one_ball(arr: [] as [Int]) == true)


Prompt:
/// 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(n: 3)
/// (1, 2)
/// Explanation:
/// Integer palindrome are 1, 2, 3. one of them is even, and two of them are odd.
/// Example 2:
/// >>> even_odd_palindrome(n: 12)
/// (4, 6)
/// Explanation:
/// Integer palindrome are 1, 2, 3, 4, 5, 6, 7, 8, 9, 11. four of them are even, and 6 of them are odd.
/// Note:
/// 1. 1 <= n <= 10^3
/// 2. returned tuple has the number of even and odd integer palindromes respectively.
func even_odd_palindrome(n: Int) -> (Int, Int) {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(even_odd_palindrome(n: 123) == (8, 13))
assert(even_odd_palindrome(n: 12) == (4, 6))
assert(even_odd_palindrome(n: 3) == (1, 2))
assert(even_odd_palindrome(n: 63) == (6, 8))
assert(even_odd_palindrome(n: 25) == (5, 6))
assert(even_odd_palindrome(n: 19) == (4, 6))
assert(even_odd_palindrome(n: 9) == (4, 5))
assert(even_odd_palindrome(n: 1) == (0, 1))


Prompt:
/// Evaluate whether the given number n can be written as the sum of exactly 4 positive even numbers
/// Example
/// >>> is_equal_to_sum_even(n: 4)
/// false
/// >>> is_equal_to_sum_even(n: 6)
/// false
/// >>> is_equal_to_sum_even(n: 8)
/// true
func is_equal_to_sum_even(n: Int) -> Bool {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(is_equal_to_sum_even(n: 4) == false)
assert(is_equal_to_sum_even(n: 6) == false)
assert(is_equal_to_sum_even(n: 8) == true)
assert(is_equal_to_sum_even(n: 10) == true)
assert(is_equal_to_sum_even(n: 11) == false)
assert(is_equal_to_sum_even(n: 12) == true)
assert(is_equal_to_sum_even(n: 13) == false)
assert(is_equal_to_sum_even(n: 16) == true)


Prompt:
/// xs represent coefficients of a polynomial.
/// xs[0] + xs[1] * x + xs[2] * x^2 + ....
/// Return derivative of this polynomial in the same form.
/// >>> derivative(xs: [3, 1, 2, 4, 5])
/// [1, 4, 12, 20]
/// >>> derivative(xs: [1, 2, 3])
/// [2, 6]
func derivative(xs: [Int]) -> [Int] {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(derivative(xs: [3, 1, 2, 4, 5]) == [1, 4, 12, 20])
assert(derivative(xs: [1, 2, 3]) == [2, 6])
assert(derivative(xs: [3, 2, 1]) == [2, 2])
assert(derivative(xs: [3, 2, 1, 0, 4]) == [2, 2, 0, 16])
assert(derivative(xs: [1]) == [] as [Int])


Prompt:
/// Given an array of numbers, return whether or not they are sorted
/// in ascending order. If array has more than 1 duplicate of the same
/// number, return false. Assume no negative numbers and only integers.
/// Examples
/// >>> is_sorted(lst: [5])
/// true
/// >>> is_sorted(lst: [1, 2, 3, 4, 5])
/// true
/// >>> is_sorted(lst: [1, 3, 2, 4, 5])
/// false
/// >>> is_sorted(lst: [1, 2, 3, 4, 5, 6])
/// true
/// >>> is_sorted(lst: [1, 2, 3, 4, 5, 6, 7])
/// true
/// >>> is_sorted(lst: [1, 3, 2, 4, 5, 6, 7])
/// false
/// >>> is_sorted(lst: [1, 2, 2, 3, 3, 4])
/// true
/// >>> is_sorted(lst: [1, 2, 2, 2, 3, 4])
/// false
func is_sorted(lst: [Int]) -> Bool {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(is_sorted(lst: [5]) == true)
assert(is_sorted(lst: [1, 2, 3, 4, 5]) == true)
assert(is_sorted(lst: [1, 3, 2, 4, 5]) == false)
assert(is_sorted(lst: [1, 2, 3, 4, 5, 6]) == true)
assert(is_sorted(lst: [1, 2, 3, 4, 5, 6, 7]) == true)
assert(is_sorted(lst: [1, 3, 2, 4, 5, 6, 7]) == false)
assert(is_sorted(lst: [] as [Int]) == true)
assert(is_sorted(lst: [1]) == true)
assert(is_sorted(lst: [3, 2, 1]) == false)
assert(is_sorted(lst: [1, 2, 2, 2, 3, 4]) == false)
assert(is_sorted(lst: [1, 2, 3, 3, 3, 4]) == false)
assert(is_sorted(lst: [1, 2, 2, 3, 3, 4]) == true)
assert(is_sorted(lst: [1, 2, 3, 4]) == true)


Prompt:
/// You are given a string s.
/// if s[i] is a letter, reverse its case from lower to upper or vise versa,
/// otherwise keep it as it is.
/// If the string contains no letters, reverse the string.
/// The function should return the resulted string.
/// Examples
/// >>> solve(s: "1234")
/// "4321"
/// >>> solve(s: "ab")
/// "AB"
/// >>> solve(s: "#a@C")
/// "#A@c"
func solve(s: String) -> String {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(solve(s: "AsDf") == "aSdF")
assert(solve(s: "1234") == "4321")
assert(solve(s: "ab") == "AB")
assert(solve(s: "#a@C") == "#A@c")
assert(solve(s: "#AsdfW^45") == "#aSDFw^45")
assert(solve(s: "#6@2") == "2@6#")
assert(solve(s: "#$a^D") == "#$A^d")
assert(solve(s: "#ccc") == "#CCC")


Prompt:
/// 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(n + 1), if n is odd.
/// For example:
/// tri(2) = 1 + (2 / 2) = 2
/// tri(4) = 3
/// tri(3) = tri(2) + tri(1) + tri(4)
/// = 2 + 3 + 3 = 8
/// You are given a non-negative integer number n, you have to a return an array of the
/// first n + 1 numbers of the Tribonacci sequence.
/// Examples:
/// >>> tri(n: 3)
/// [1, 3, 2, 8]
func tri(n: Int) -> [Int] {


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

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(fizz_buzz(n: 50) == 0)
assert(fizz_buzz(n: 78) == 2)
assert(fizz_buzz(n: 79) == 3)
assert(fizz_buzz(n: 100) == 3)
assert(fizz_buzz(n: 200) == 6)
assert(fizz_buzz(n: 4000) == 192)
assert(fizz_buzz(n: 10000) == 639)
assert(fizz_buzz(n: 100000) == 8026)


Prompt:
/// Filter an input array of strings only for ones that start with a given prefix.
/// >>> filter_by_prefix(strings: [] as [String], prefix: "a")
/// [] as [String]
/// >>> filter_by_prefix(strings: ["abc", "bcd", "cde", "array"], prefix: "a")
/// ["abc", "array"]
func filter_by_prefix(strings: [String], prefix: String) -> [String] {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(filter_by_prefix(strings: [] as [String], prefix: "john") == [] as [String])
assert(filter_by_prefix(strings: ["xxx", "asd", "xxy", "john doe", "xxxAAA", "xxx"], prefix: "xxx") == ["xxx", "xxxAAA", "xxx"])


Prompt:
/// Given a positive integer N, return the total sum of its digits in binary.
/// Example
/// >>> solve(N: 1000)
/// "1"
/// >>> solve(N: 150)
/// "110"
/// >>> solve(N: 147)
/// "1100"
/// Variables:
/// @N integer
/// Constraints: 0 ≤ N ≤ 10000.
/// Output:
/// a string of binary number
func solve(N: Int) -> String {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(solve(N: 1000) == "1")
assert(solve(N: 150) == "110")
assert(solve(N: 147) == "1100")
assert(solve(N: 333) == "1001")
assert(solve(N: 963) == "10010")


Prompt:
/// 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, and in each step you can move to any of the neighbor cells,
/// in other words, you can go to cells which share an edge with you current
/// cell.
/// Please note that a path of length k means visiting exactly k cells (not
/// necessarily distinct).
/// You CANNOT go off the grid.
/// A path A (of length k) is considered less than a path B (of length k) if
/// after making the ordered arrays of the values on the cells that A and B go
/// through (let's call them lst_A and lst_B), lst_A is lexicographically less
/// than lst_B, in other words, there exist an integer index i (1 <= i <= k)
/// such that lst_A[i] < lst_B[i] and for any j (1 <= j < i) we have
/// lst_A[j] = lst_B[j].
/// It is guaranteed that the answer is unique.
/// Return an ordered array of the values on the cells that the minimum path go through.
/// Examples:
/// >>> minPath(grid: [[1, 2, 3], [4, 5, 6], [7, 8, 9]], k: 3)
/// [1, 2, 1]
/// >>> minPath(grid: [[5, 9, 3], [4, 1, 6], [7, 8, 2]], k: 1)
/// [1]
func minPath(grid: [[Int]], k: Int) -> [Int] {


Prompt:
/// Given a string s, count the number of uppercase vowels in even indices.
/// For example:
/// >>> count_upper(s: "aBCdEf")
/// 1
/// >>> count_upper(s: "abcdefg")
/// 0
/// >>> count_upper(s: "dBBE")
/// 0
func count_upper(s: String) -> Int {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(count_upper(s: "aBCdEf") == 1)
assert(count_upper(s: "abcdefg") == 0)
assert(count_upper(s: "dBBE") == 0)
assert(count_upper(s: "B") == 0)
assert(count_upper(s: "U") == 1)
assert(count_upper(s: "") == 0)
assert(count_upper(s: "EEEE") == 2)


Prompt:
/// Given an array arr of integers and a positive integer k, return a sorted array
/// of length k with the maximum k numbers in arr.
/// Example 1:
/// >>> maximum(arr: [-3, -4, 5], k: 3)
/// [-4, -3, 5]
/// Example 2:
/// >>> maximum(arr: [4, -4, 4], k: 2)
/// [4, 4]
/// Example 3:
/// >>> maximum(arr: [-3, 2, 1, 2, -1, -2, 1], k: 1)
/// [2]
/// Note:
/// 1. The length of the array will be in the range of [1, 1000].
/// 2. The elements in the array will be in the range of [-1000, 1000].
/// 3. 0 <= k <= len(arr)
func maximum(arr: [Int], k: Int) -> [Int] {


Prompt:
/// For a given number n, find the largest number that divides n evenly, smaller than n
/// >>> largest_divisor(n: 15)
/// 5
func largest_divisor(n: Int) -> Int {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(largest_divisor(n: 3) == 1)
assert(largest_divisor(n: 7) == 1)
assert(largest_divisor(n: 10) == 5)
assert(largest_divisor(n: 100) == 50)
assert(largest_divisor(n: 49) == 7)


Prompt:
/// Given an array of non-negative integers, return a coswift of the given array after sorting,
/// you will sort the given array in ascending order if the sum( first index value, last index value) is odd,
/// or sort it in descending order if the sum( first index value, last index value) is even.
/// Note:
/// * don't change the given array.
/// Examples:
/// >>> sort_array(array: [] as [Int])
/// [] as [Int]
/// >>> sort_array(array: [5])
/// [5]
/// >>> sort_array(array: [2, 4, 3, 0, 1, 5])
/// [0, 1, 2, 3, 4, 5]
/// >>> sort_array(array: [2, 4, 3, 0, 1, 5, 6])
/// [6, 5, 4, 3, 2, 1, 0]
func sort_array(array: [Int]) -> [Int] {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(sort_array(array: [] as [Int]) == [] as [Int])
assert(sort_array(array: [5]) == [5])
assert(sort_array(array: [2, 4, 3, 0, 1, 5]) == [0, 1, 2, 3, 4, 5])
assert(sort_array(array: [2, 4, 3, 0, 1, 5, 6]) == [6, 5, 4, 3, 2, 1, 0])
assert(sort_array(array: [2, 1]) == [1, 2])
assert(sort_array(array: [15, 42, 87, 32, 11, 0]) == [0, 11, 15, 32, 42, 87])
assert(sort_array(array: [21, 14, 23, 11]) == [23, 21, 14, 11])


Prompt:
/// Implement the function f that takes n as a parameter,
/// and returns an array 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(n: 5)
/// [1, 2, 6, 24, 15]
func f(n: Int) -> [Int] {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(f(n: 5) == [1, 2, 6, 24, 15])
assert(f(n: 7) == [1, 2, 6, 24, 15, 720, 28])
assert(f(n: 1) == [1])
assert(f(n: 3) == [1, 2, 6])


Prompt:
/// 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(a: 1)
/// true
/// >>> iscube(a: 2)
/// false
/// >>> iscube(a: -1)
/// true
/// >>> iscube(a: 64)
/// true
/// >>> iscube(a: 0)
/// true
/// >>> iscube(a: 180)
/// false
func iscube(a: Int) -> Bool {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(iscube(a: 1) == true)
assert(iscube(a: 2) == false)
assert(iscube(a: -1) == true)
assert(iscube(a: 64) == true)
assert(iscube(a: 180) == false)
assert(iscube(a: 1000) == true)
assert(iscube(a: 0) == true)
assert(iscube(a: 1729) == false)


Prompt:
/// 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(message: "test")
/// "TGST"
/// >>> encode(message: "This is a message")
/// "tHKS KS C MGSSCGG"
func encode(message: String) -> String {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(encode(message: "TEST") == "tgst")
assert(encode(message: "Mudasir") == "mWDCSKR")
assert(encode(message: "YES") == "ygs")
assert(encode(message: "This is a message") == "tHKS KS C MGSSCGG")
assert(encode(message: "I DoNt KnOw WhAt tO WrItE") == "k dQnT kNqW wHcT Tq wRkTg")


Prompt:
/// 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(S: "Hello world")
/// 0
/// >>> is_bored(S: "The sky is blue. The sun is shining. I love this weather")
/// 1
func is_bored(S: String) -> Int {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(is_bored(S: "Hello world") == 0)
assert(is_bored(S: "Is the sky blue?") == 0)
assert(is_bored(S: "I love It !") == 1)
assert(is_bored(S: "bIt") == 0)
assert(is_bored(S: "I feel good today. I will be productive. will kill It") == 2)
assert(is_bored(S: "You and I are going for a walk") == 0)


Prompt:
/// pairs_sum_to_zero takes an array of integers as an input.
/// it returns true if there are two distinct elements in the array that
/// sum to zero, and false otherwise.
/// >>> pairs_sum_to_zero(l: [1, 3, 5, 0])
/// false
/// >>> pairs_sum_to_zero(l: [1, 3, -2, 1])
/// false
/// >>> pairs_sum_to_zero(l: [1, 2, 3, 7])
/// false
/// >>> pairs_sum_to_zero(l: [2, 4, -5, 3, 5, 7])
/// true
/// >>> pairs_sum_to_zero(l: [1])
/// false
func pairs_sum_to_zero(l: [Int]) -> Bool {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(pairs_sum_to_zero(l: [1, 3, 5, 0]) == false)
assert(pairs_sum_to_zero(l: [1, 3, -2, 1]) == false)
assert(pairs_sum_to_zero(l: [1, 2, 3, 7]) == false)
assert(pairs_sum_to_zero(l: [2, 4, -5, 3, 5, 7]) == true)
assert(pairs_sum_to_zero(l: [1]) == false)
assert(pairs_sum_to_zero(l: [-3, 9, -1, 3, 2, 30]) == true)
assert(pairs_sum_to_zero(l: [-3, 9, -1, 3, 2, 31]) == true)
assert(pairs_sum_to_zero(l: [-3, 9, -1, 4, 2, 30]) == false)
assert(pairs_sum_to_zero(l: [-3, 9, -1, 4, 2, 31]) == false)


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(a: 3, b: 4, c: 5)
/// 6.0
/// >>> triangle_area(a: 1, b: 2, c: 10)
/// -1
func triangle_area(a: Int, b: Int, c: Int) -> Double {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(triangle_area(a: 3, b: 4, c: 5) == 6.0)
assert(triangle_area(a: 1, b: 2, c: 10) == -1)
assert(triangle_area(a: 4, b: 8, c: 5) == 8.18)
assert(triangle_area(a: 2, b: 2, c: 2) == 1.73)
assert(triangle_area(a: 1, b: 2, c: 3) == -1)
assert(triangle_area(a: 10, b: 5, c: 7) == 16.25)
assert(triangle_area(a: 2, b: 6, c: 3) == -1)
assert(triangle_area(a: 1, b: 1, c: 1) == 0.43)
assert(triangle_area(a: 2, b: 2, c: 10) == -1)


Prompt:
/// Given a positive integer n, return the product of the odd digits.
/// Return 0 if all digits are even.
/// For example:
/// >>> digits(n: 1)
/// 1
/// >>> digits(n: 4)
/// 0
/// >>> digits(n: 235)
/// 15
func digits(n: Int) -> Int {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(digits(n: 5) == 5)
assert(digits(n: 54) == 5)
assert(digits(n: 120) == 1)
assert(digits(n: 5014) == 5)
assert(digits(n: 98765) == 315)
assert(digits(n: 5576543) == 2625)
assert(digits(n: 2468) == 0)


Prompt:
/// 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(s: "Hi, my name is John")
/// ["Hi", "my", "name", "is", "John"]
/// >>> words_string(s: "One, two, three, four, five, six")
/// ["One", "two", "three", "four", "five", "six"]
func words_string(s: String) -> [String] {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(words_string(s: "Hi, my name is John") == ["Hi", "my", "name", "is", "John"])
assert(words_string(s: "One, two, three, four, five, six") == ["One", "two", "three", "four", "five", "six"])
assert(words_string(s: "Hi, my name") == ["Hi", "my", "name"])
assert(words_string(s: "One,, two, three, four, five, six,") == ["One", "two", "three", "four", "five", "six"])
assert(words_string(s: "") == [] as [String])
assert(words_string(s: "ahmed     , gamal") == ["ahmed", "gamal"])


Prompt:
/// Find how many times a given substring can be found in the original string. Count overlaping cases.
/// >>> how_many_times(string: "", substring: "a")
/// 0
/// >>> how_many_times(string: "aaa", substring: "a")
/// 3
/// >>> how_many_times(string: "aaaa", substring: "aa")
/// 3
func how_many_times(string: String, substring: String) -> Int {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(how_many_times(string: "", substring: "x") == 0)
assert(how_many_times(string: "xyxyxyx", substring: "x") == 4)
assert(how_many_times(string: "cacacacac", substring: "cac") == 4)
assert(how_many_times(string: "john doe", substring: "john") == 1)


Prompt:
enum Value: Equatable, Hashable {
    case intValue(Int)
    case doubleValue(Double)
    case stringValue(String)
}

/// Create a function that takes integers, floats, or strings representing
/// real numbers, and returns the larger variable in its given variable type.
/// Return nil if the values are equal.
/// Note: If a real number is represented as a string, the floating point might be . or ,
/// >>> compare_one(a: .intValue(1), b: .doubleValue(2.5))
/// .doubleValue(2.5)
/// >>> compare_one(a: .intValue(1), b: .stringValue("2,3"))
/// .stringValue("2,3")
/// >>> compare_one(a: .stringValue("5,1"), b: .stringValue("6"))
/// .stringValue("6")
/// >>> compare_one(a: .stringValue("1"), b: .intValue(1))
/// nil
func compare_one(a: Value, b: Value) -> Value? {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(compare_one(a: .intValue(1), b: .intValue(2)) == .intValue(2))
assert(compare_one(a: .intValue(1), b: .doubleValue(2.5)) == .doubleValue(2.5))
assert(compare_one(a: .intValue(2), b: .intValue(3)) == .intValue(3))
assert(compare_one(a: .intValue(5), b: .intValue(6)) == .intValue(6))
assert(compare_one(a: .intValue(1), b: .stringValue("2,3")) == .stringValue("2,3"))
assert(compare_one(a: .stringValue("5,1"), b: .stringValue("6")) == .stringValue("6"))
assert(compare_one(a: .stringValue("1"), b: .stringValue("2")) == .stringValue("2"))
assert(compare_one(a: .stringValue("1"), b: .intValue(1)) == nil)


Prompt:
/// remove_vowels is a function that takes string and returns string without vowels.
/// >>> remove_vowels(text: "")
/// ""
/// >>> remove_vowels(text: "abcdef")
/// "bcdf"
/// >>> remove_vowels(text: "aaaaa")
/// ""
/// >>> remove_vowels(text: "aaBAA")
/// "B"
/// >>> remove_vowels(text: "zbcd")
/// "zbcd"
func remove_vowels(text: String) -> String {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(remove_vowels(text: "") == "")
assert(remove_vowels(text: "abcdef\nghijklm") == "bcdf\nghjklm")
assert(remove_vowels(text: "fedcba") == "fdcb")
assert(remove_vowels(text: "eeeee") == "")
assert(remove_vowels(text: "acBAA") == "cB")
assert(remove_vowels(text: "EcBOO") == "cB")
assert(remove_vowels(text: "ybcd") == "ybcd")


Prompt:
/// Given array of integers, return array 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(lst: [1, 2, 3, 4])
/// [1, 4, 2, 3]
/// >>> strange_sort_list(lst: [5, 5, 5, 5])
/// [5, 5, 5, 5]
/// >>> strange_sort_list(lst: [] as [Int])
/// [] as [Int]
func strange_sort_list(lst: [Int]) -> [Int] {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(strange_sort_list(lst: [1, 2, 3, 4]) == [1, 4, 2, 3])
assert(strange_sort_list(lst: [5, 6, 7, 8, 9]) == [5, 9, 6, 8, 7])
assert(strange_sort_list(lst: [1, 2, 3, 4, 5]) == [1, 5, 2, 4, 3])
assert(strange_sort_list(lst: [5, 6, 7, 8, 9, 1]) == [1, 9, 5, 8, 6, 7])
assert(strange_sort_list(lst: [5, 5, 5, 5]) == [5, 5, 5, 5])
assert(strange_sort_list(lst: [] as [Int]) == [] as [Int])
assert(strange_sort_list(lst: [1, 2, 3, 4, 5, 6, 7, 8]) == [1, 8, 2, 7, 3, 6, 4, 5])
assert(strange_sort_list(lst: [0, 2, 2, 2, 5, 5, -5, -5]) == [-5, 5, -5, 5, 0, 2, 2, 2])
assert(strange_sort_list(lst: [111111]) == [111111])


Prompt:
/// From a supplied array of numbers (of length at least two) select and return two that are the closest to each
/// other and return them in order (smaller number, larger number).
/// >>> find_closest_elements(numbers: [1.0, 2.0, 3.0, 4.0, 5.0, 2.2])
/// (2.0, 2.2)
/// >>> find_closest_elements(numbers: [1.0, 2.0, 3.0, 4.0, 5.0, 2.0])
/// (2.0, 2.0)
func find_closest_elements(numbers: [Double]) -> (Double, Double) {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(find_closest_elements(numbers: [1.0, 2.0, 3.9, 4.0, 5.0, 2.2]) == (3.9, 4.0))
assert(find_closest_elements(numbers: [1.0, 2.0, 5.9, 4.0, 5.0]) == (5.0, 5.9))
assert(find_closest_elements(numbers: [1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) == (2.0, 2.2))
assert(find_closest_elements(numbers: [1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) == (2.0, 2.0))
assert(find_closest_elements(numbers: [1.1, 2.2, 3.1, 4.1, 5.1]) == (2.2, 3.1))


Prompt:
/// 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(x: 1, n: 4)
/// true
/// >>> is_simple_power(x: 2, n: 2)
/// true
/// >>> is_simple_power(x: 8, n: 2)
/// true
/// >>> is_simple_power(x: 3, n: 2)
/// false
/// >>> is_simple_power(x: 3, n: 1)
/// false
/// >>> is_simple_power(x: 5, n: 3)
/// false
func is_simple_power(x: Int, n: Int) -> Bool {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(is_simple_power(x: 16, n: 2) == true)
assert(is_simple_power(x: 143214, n: 16) == false)
assert(is_simple_power(x: 4, n: 2) == true)
assert(is_simple_power(x: 9, n: 3) == true)
assert(is_simple_power(x: 16, n: 4) == true)
assert(is_simple_power(x: 24, n: 2) == false)
assert(is_simple_power(x: 128, n: 4) == false)
assert(is_simple_power(x: 12, n: 6) == false)
assert(is_simple_power(x: 1, n: 1) == true)
assert(is_simple_power(x: 1, n: 12) == true)


Prompt:
/// prime_fib returns n-th number that is a Fibonacci number and it's also prime.
/// >>> prime_fib(n: 1)
/// 2
/// >>> prime_fib(n: 2)
/// 3
/// >>> prime_fib(n: 3)
/// 5
/// >>> prime_fib(n: 4)
/// 13
/// >>> prime_fib(n: 5)
/// 89
func prime_fib(n: Int) -> Int {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(prime_fib(n: 1) == 2)
assert(prime_fib(n: 2) == 3)
assert(prime_fib(n: 3) == 5)
assert(prime_fib(n: 4) == 13)
assert(prime_fib(n: 5) == 89)
assert(prime_fib(n: 6) == 233)
assert(prime_fib(n: 7) == 1597)
assert(prime_fib(n: 8) == 28657)
assert(prime_fib(n: 9) == 514229)
assert(prime_fib(n: 10) == 433494437)


Prompt:
/// Write a function which sorts the given array 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 array.
/// For example:
/// >>> order_by_points(nums: [1, 11, -1, -11, -12])
/// [-1, -11, 1, -12, 11]
/// >>> order_by_points(nums: [] as [Int])
/// [] as [Int]
func order_by_points(nums: [Int]) -> [Int] {


Prompt:
/// Check if in given array of numbers, are any two numbers closer to each other than
/// given threshold.
/// >>> has_close_elements(numbers: [1.0, 2.0, 3.0], threshold: 0.5)
/// false
/// >>> has_close_elements(numbers: [1.0, 2.8, 3.0, 4.0, 5.0, 2.0], threshold: 0.3)
/// true
func has_close_elements(numbers: [Double], threshold: Double) -> Bool {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(has_close_elements(numbers: [1.0, 2.0, 3.9, 4.0, 5.0, 2.2], threshold: 0.3) == true)
assert(has_close_elements(numbers: [1.0, 2.0, 3.9, 4.0, 5.0, 2.2], threshold: 0.05) == false)
assert(has_close_elements(numbers: [1.0, 2.0, 5.9, 4.0, 5.0], threshold: 0.95) == true)
assert(has_close_elements(numbers: [1.0, 2.0, 5.9, 4.0, 5.0], threshold: 0.8) == false)
assert(has_close_elements(numbers: [1.0, 2.0, 3.0, 4.0, 5.0, 2.0], threshold: 0.1) == true)
assert(has_close_elements(numbers: [1.1, 2.2, 3.1, 4.1, 5.1], threshold: 1.0) == true)
assert(has_close_elements(numbers: [1.1, 2.2, 3.1, 4.1, 5.1], threshold: 0.5) == false)


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

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(make_palindrome(string: "") == "")
assert(make_palindrome(string: "x") == "x")
assert(make_palindrome(string: "xyz") == "xyzyx")
assert(make_palindrome(string: "xyx") == "xyx")
assert(make_palindrome(string: "jerry") == "jerryrrej")


Prompt:
/// 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(a: "010", b: "110")
/// "100"
func string_xor(a: String, b: String) -> String {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(string_xor(a: "111000", b: "101010") == "010010")
assert(string_xor(a: "1", b: "1") == "0")
assert(string_xor(a: "0101", b: "0000") == "0101")


Prompt:
/// The Brazilian factorial is defined as:
/// brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1!
/// where n > 0
/// For example:
/// >>> special_factorial(n: 4)
/// 288
/// The function will receive an integer as input and should return the special
/// factorial of this integer.
func special_factorial(n: Int) -> Int {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(special_factorial(n: 4) == 288)
assert(special_factorial(n: 5) == 34560)
assert(special_factorial(n: 7) == 125411328000)
assert(special_factorial(n: 1) == 1)


Prompt:
/// 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(arr: [111, 21, 3, 4000, 5, 6, 7, 8, 9], k: 4)
/// 24
/// Constraints:
/// 1. 1 <= len(arr) <= 100
/// 2. 1 <= k <= len(arr)
func add_elements(arr: [Int], k: Int) -> Int {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(add_elements(arr: [1, -2, -3, 41, 57, 76, 87, 88, 99], k: 3) == -4)
assert(add_elements(arr: [111, 121, 3, 4000, 5, 6], k: 2) == 0)
assert(add_elements(arr: [11, 21, 3, 90, 5, 6, 7, 8, 9], k: 4) == 125)
assert(add_elements(arr: [111, 21, 3, 4000, 5, 6, 7, 8, 9], k: 4) == 24)
assert(add_elements(arr: [1], k: 1) == 1)


Prompt:
/// The Fib4 number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
/// fib4(0) -> 0
/// fib4(1) -> 0
/// fib4(2) -> 2
/// fib4(3) -> 0
/// fib4(n) -> fib4(n-1) + fib4(n-2) + fib4(n-3) + fib4(n-4).
/// Please write a function to efficiently compute the n-th element of the fib4 number sequence.  Do not use recursion.
/// >>> fib4(n: 5)
/// 4
/// >>> fib4(n: 6)
/// 8
/// >>> fib4(n: 7)
/// 14
func fib4(n: Int) -> Int {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(fib4(n: 5) == 4)
assert(fib4(n: 8) == 28)
assert(fib4(n: 10) == 104)
assert(fib4(n: 12) == 386)


Prompt:
/// Given an array of positive integers x. return a sorted array of all
/// elements that hasn't any even digit.
/// Note: Returned array should be sorted in increasing order.
/// For example:
/// >>> unique_digits(x: [15, 33, 1422, 1])
/// [1, 15, 33]
/// >>> unique_digits(x: [152, 323, 1422, 10])
/// [] as [Int]
func unique_digits(x: [Int]) -> [Int] {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(unique_digits(x: [15, 33, 1422, 1]) == [1, 15, 33])
assert(unique_digits(x: [152, 323, 1422, 10]) == [] as [Int])
assert(unique_digits(x: [12345, 2033, 111, 151]) == [111, 151])
assert(unique_digits(x: [135, 103, 31]) == [31, 135])


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

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(select_words(s: "Mary had a little lamb", n: 4) == ["little"])
assert(select_words(s: "Mary had a little lamb", n: 3) == ["Mary", "lamb"])
assert(select_words(s: "simple white space", n: 2) == [] as [String])
assert(select_words(s: "Hello world", n: 4) == ["world"])
assert(select_words(s: "Uncle sam", n: 3) == ["Uncle"])
assert(select_words(s: "", n: 4) == [] as [String])
assert(select_words(s: "a b c d e f", n: 1) == ["b", "c", "d", "f"])


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 array) and the sum of its elements is less than or equal the maximum possible weight w.
/// Example:
/// >>> will_it_fly(q: [1, 2], w: 5)
/// false
/// # 1+2 is less than the maximum possible weight, but it's unbalanced.
/// >>> will_it_fly(q: [3, 2, 3], w: 1)
/// false
/// # it's balanced, but 3+2+3 is more than the maximum possible weight.
/// >>> will_it_fly(q: [3, 2, 3], w: 9)
/// true
/// # 3+2+3 is less than the maximum possible weight, and it's balanced.
/// >>> will_it_fly(q: [3], w: 5)
/// true
/// # 3 is less than the maximum possible weight, and it's balanced.
func will_it_fly(q: [Int], w: Int) -> Bool {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(will_it_fly(q: [3, 2, 3], w: 9) == true)
assert(will_it_fly(q: [1, 2], w: 5) == false)
assert(will_it_fly(q: [3], w: 5) == true)
assert(will_it_fly(q: [3, 2, 3], w: 1) == false)
assert(will_it_fly(q: [1, 2, 3], w: 6) == false)
assert(will_it_fly(q: [5], w: 5) == true)


Prompt:
/// Return n-th Fibonacci number.
/// >>> fib(n: 10)
/// 55
/// >>> fib(n: 1)
/// 1
/// >>> fib(n: 8)
/// 21
func fib(n: Int) -> Int {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(fib(n: 10) == 55)
assert(fib(n: 1) == 1)
assert(fib(n: 8) == 21)
assert(fib(n: 11) == 89)
assert(fib(n: 12) == 144)


Prompt:
/// You will be given the name of a class (a string) and an array 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 letters
/// in the extension's name, the strength is given by the fraction CAP - SM.
/// You should find the strongest extension and return a string in this
/// format: ClassName.StrongestExtensionName.
/// If there are two or more extensions with the same strength, you should
/// choose the one that comes first in the array.
/// For example, if you are given "Slices" as the class and an array of the
/// extensions: ['SErviNGSliCes', 'Cheese', 'StuFfed'] then you should
/// return 'Slices.SErviNGSliCes' since 'SErviNGSliCes' is the strongest extension
/// (its strength is -1).
/// Example:
/// >>> Strongest_Extension(class_name: "my_class", extensions: ["AA", "Be", "CC"])
/// "my_class.AA"
func Strongest_Extension(class_name: String, extensions: [String]) -> String {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(Strongest_Extension(class_name: "Watashi", extensions: ["tEN", "niNE", "eIGHt8OKe"]) == "Watashi.eIGHt8OKe")
assert(Strongest_Extension(class_name: "Boku123", extensions: ["nani", "NazeDa", "YEs.WeCaNe", "32145tggg"]) == "Boku123.YEs.WeCaNe")
assert(Strongest_Extension(class_name: "__YESIMHERE", extensions: ["t", "eMptY", "nothing", "zeR00", "NuLl__", "123NoooneB321"]) == "__YESIMHERE.NuLl__")
assert(Strongest_Extension(class_name: "K", extensions: ["Ta", "TAR", "t234An", "cosSo"]) == "K.TAR")
assert(Strongest_Extension(class_name: "__HAHA", extensions: ["Tab", "123", "781345", "-_-"]) == "__HAHA.123")
assert(Strongest_Extension(class_name: "YameRore", extensions: ["HhAas", "okIWILL123", "WorkOut", "Fails", "-_-"]) == "YameRore.okIWILL123")
assert(Strongest_Extension(class_name: "finNNalLLly", extensions: ["Die", "NowW", "Wow", "WoW"]) == "finNNalLLly.WoW")
assert(Strongest_Extension(class_name: "_", extensions: ["Bb", "91245"]) == "_.Bb")
assert(Strongest_Extension(class_name: "Sp", extensions: ["671235", "Bb"]) == "Sp.671235")


Prompt:
/// You are given an array 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 parentheses in S
/// are balanced. For example: the string '(())()' is good, while the string
/// '())' is not.
/// Return 'Yes' if there's a way to make a good string, and return 'No' otherwise.
/// Examples:
/// >>> match_parens(lst: ["()(", ")"])
/// "Yes"
/// >>> match_parens(lst: [")", ")"])
/// "No"
func match_parens(lst: [String]) -> String {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(match_parens(lst: ["()(", ")"]) == "Yes")
assert(match_parens(lst: [")", ")"]) == "No")
assert(match_parens(lst: ["(()(())", "())())"]) == "No")
assert(match_parens(lst: [")())", "(()()("]) == "Yes")
assert(match_parens(lst: ["(())))", "(()())(("]) == "Yes")
assert(match_parens(lst: ["()", "())"]) == "No")
assert(match_parens(lst: ["(()(", "()))()"]) == "Yes")
assert(match_parens(lst: ["((((", "((())"]) == "No")
assert(match_parens(lst: [")(()", "(()("]) == "No")
assert(match_parens(lst: [")(", ")("]) == "No")
assert(match_parens(lst: ["(", ")"]) == "Yes")
assert(match_parens(lst: [")", "("]) == "Yes")


Prompt:
/// You are given an array of integers.
/// Write a function next_smallest() that returns the 2nd smallest element of the array.
/// Return nil if there is no such element.
/// >>> next_smallest(lst: [1, 2, 3, 4, 5])
/// 2
/// >>> next_smallest(lst: [5, 1, 4, 3, 2])
/// 2
/// >>> next_smallest(lst: [] as [Int])
/// nil
/// >>> next_smallest(lst: [1, 1])
/// nil
func next_smallest(lst: [Int]) -> Int? {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(next_smallest(lst: [1, 2, 3, 4, 5]) == 2)
assert(next_smallest(lst: [5, 1, 4, 3, 2]) == 2)
assert(next_smallest(lst: [] as [Int]) == nil)
assert(next_smallest(lst: [1, 1]) == nil)
assert(next_smallest(lst: [1, 1, 1, 1, 0]) == 1)
assert(next_smallest(lst: [1, 1]) == nil)
assert(next_smallest(lst: [-35, 34, 12, -45]) == -35)


Prompt:
/// 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(x: 5, y: 2, z: 7)
/// true
/// >>> any_int(x: 3, y: 2, z: 2)
/// false
/// >>> any_int(x: 3, y: -2, z: 1)
/// true
/// >>> any_int(x: 3.6, y: -2.2, z: 2)
/// false
func any_int(x: Double, y: Double, z: Double) -> Bool {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(any_int(x: 2, y: 3, z: 1) == true)
assert(any_int(x: 2.5, y: 2, z: 3) == false)
assert(any_int(x: 1.5, y: 5, z: 3.5) == false)
assert(any_int(x: 2, y: 6, z: 2) == false)
assert(any_int(x: 4, y: 2, z: 2) == true)
assert(any_int(x: 2.2, y: 2.2, z: 2.2) == false)
assert(any_int(x: -4, y: 6, z: 2) == true)
assert(any_int(x: 2, y: 1, z: 1) == true)
assert(any_int(x: 3, y: 4, z: 7) == true)
assert(any_int(x: 3.0, y: 4, z: 7) == false)


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(number: 3.5)
/// 0.5
func truncate_number(number: Double) -> Double {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(truncate_number(number: 3.5) == 0.5)
assert(truncate_number(number: 1.25) == 0.25)
assert(truncate_number(number: 123.0) == 0.0)


Prompt:
/// Return array with elements incremented by 1.
/// >>> incr_list(l: [1, 2, 3])
/// [2, 3, 4]
/// >>> incr_list(l: [5, 3, 5, 2, 3, 3, 9, 0, 123])
/// [6, 4, 6, 3, 4, 4, 10, 1, 124]
func incr_list(l: [Int]) -> [Int] {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(incr_list(l: [] as [Int]) == [] as [Int])
assert(incr_list(l: [3, 2, 1]) == [4, 3, 2])
assert(incr_list(l: [5, 2, 5, 2, 3, 3, 9, 0, 123]) == [6, 3, 6, 3, 4, 4, 10, 1, 124])


Prompt:
/// 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(n: 7, x: 34, y: 12)
/// 34
/// >>> x_or_y(n: 15, x: 8, y: 5)
/// 5
func x_or_y(n: Int, x: Int, y: Int) -> Int {


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

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(modp(n: 3, p: 5) == 3)
assert(modp(n: 1101, p: 101) == 2)
assert(modp(n: 0, p: 101) == 1)
assert(modp(n: 3, p: 11) == 8)
assert(modp(n: 100, p: 101) == 1)
assert(modp(n: 30, p: 5) == 4)
assert(modp(n: 31, p: 5) == 3)


Prompt:
/// Given an integer. return a tuple that has the number of even and odd digits respectively.
/// Example:
/// >>> even_odd_count(num: -12)
/// (1, 1)
/// >>> even_odd_count(num: 123)
/// (1, 2)
func even_odd_count(num: Int) -> (Int, Int) {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(even_odd_count(num: 7) == (0, 1))
assert(even_odd_count(num: -78) == (1, 1))
assert(even_odd_count(num: 3452) == (2, 2))
assert(even_odd_count(num: 346211) == (3, 3))
assert(even_odd_count(num: -345821) == (3, 3))
assert(even_odd_count(num: -2) == (1, 0))
assert(even_odd_count(num: -45347) == (2, 3))
assert(even_odd_count(num: 0) == (1, 0))


Prompt:
/// You are given a string s.
/// Your task is to check if the string is hapswift or not.
/// A string is hapswift if its length is at least 3 and every 3 consecutive letters are distinct
/// For example:
/// >>> is_happy(s: "a")
/// false
/// >>> is_happy(s: "aa")
/// false
/// >>> is_happy(s: "abcd")
/// true
/// >>> is_happy(s: "aabb")
/// false
/// >>> is_happy(s: "adb")
/// true
/// >>> is_happy(s: "xyy")
/// false
func is_happy(s: String) -> Bool {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(is_happy(s: "a") == false)
assert(is_happy(s: "aa") == false)
assert(is_happy(s: "abcd") == true)
assert(is_happy(s: "aabb") == false)
assert(is_happy(s: "adb") == true)
assert(is_happy(s: "xyy") == false)
assert(is_happy(s: "iopaxpoi") == true)
assert(is_happy(s: "iopaxioi") == false)


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

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(largest_prime_factor(n: 15) == 5)
assert(largest_prime_factor(n: 27) == 3)
assert(largest_prime_factor(n: 63) == 7)
assert(largest_prime_factor(n: 330) == 11)
assert(largest_prime_factor(n: 13195) == 29)


Prompt:
/// Task
/// Write a function that takes a string as input and returns the sum of the upper characters only'
/// ASCII codes.
/// Examples:
/// >>> digitSum(s: "")
/// 0
/// >>> digitSum(s: "abAB")
/// 131
/// >>> digitSum(s: "abcCd")
/// 67
/// >>> digitSum(s: "helloE")
/// 69
/// >>> digitSum(s: "woArBld")
/// 131
/// >>> digitSum(s: "aAaaaXa")
/// 153
func digitSum(s: String) -> Int {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(digitSum(s: "") == 0)
assert(digitSum(s: "abAB") == 131)
assert(digitSum(s: "abcCd") == 67)
assert(digitSum(s: "helloE") == 69)
assert(digitSum(s: "woArBld") == 131)
assert(digitSum(s: "aAaaaXa") == 153)
assert(digitSum(s: " How are yOu?") == 151)
assert(digitSum(s: "You arE Very Smart") == 327)


Prompt:
/// Given array of numbers (of at least two elements), apply a linear transform to that array,
/// such that the smallest number will become 0 and the largest will become 1
/// >>> rescale_to_unit(numbers: [1.0, 2.0, 3.0, 4.0, 5.0])
/// [0.0, 0.25, 0.5, 0.75, 1.0]
func rescale_to_unit(numbers: [Double]) -> [Double] {


Prompt:
/// Given a non-empty array of integers, return the sum of all of the odd elements that are in even positions.
/// Examples
/// >>> solution(lst: [5, 8, 7, 1])
/// 12
/// >>> solution(lst: [3, 3, 3, 3, 3])
/// 9
/// >>> solution(lst: [30, 13, 24, 321])
/// 0
func solution(lst: [Int]) -> Int {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(solution(lst: [5, 8, 7, 1]) == 12)
assert(solution(lst: [3, 3, 3, 3, 3]) == 9)
assert(solution(lst: [30, 13, 24, 321]) == 0)
assert(solution(lst: [5, 9]) == 5)
assert(solution(lst: [2, 4, 8]) == 0)
assert(solution(lst: [30, 13, 23, 32]) == 23)
assert(solution(lst: [3, 13, 2, 9]) == 3)


Prompt:
/// "Given an array representing a branch of a tree that has non-negative integer nodes
/// your task is to pluck one of the nodes and return it.
/// The plucked node should be the node with the smallest even value.
/// If multiple nodes with the same smallest even value are found return the node that has smallest index.
/// The plucked node should be returned in an array, [ smalest_value, its index ],
/// If there are no even values or the given array is empty, return [].
/// Example 1:
/// >>> pluck(arr: [4, 2, 3])
/// [2, 1]
/// Explanation: 2 has the smallest even value, and 2 has the smallest index.
/// Example 2:
/// >>> pluck(arr: [1, 2, 3])
/// [2, 1]
/// Explanation: 2 has the smallest even value, and 2 has the smallest index.
/// Example 3:
/// >>> pluck(arr: [] as [Int])
/// [] as [Int]
/// Example 4:
/// >>> pluck(arr: [5, 0, 3, 0, 4, 2])
/// [0, 1]
/// Explanation: 0 is the smallest value, but  there are two zeros,
/// so we will choose the first zero, which has the smallest index.
/// Constraints:
/// * 1 <= nodes.length <= 10000
/// * 0 <= node.value
func pluck(arr: [Int]) -> [Int] {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(pluck(arr: [4, 2, 3]) == [2, 1])
assert(pluck(arr: [1, 2, 3]) == [2, 1])
assert(pluck(arr: [] as [Int]) == [] as [Int])
assert(pluck(arr: [5, 0, 3, 0, 4, 2]) == [0, 1])
assert(pluck(arr: [1, 2, 3, 0, 5, 3]) == [0, 3])
assert(pluck(arr: [5, 4, 8, 4, 8]) == [4, 1])
assert(pluck(arr: [7, 6, 7, 1]) == [6, 1])
assert(pluck(arr: [7, 9, 7, 1]) == [] as [Int])


Prompt:
/// 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(n: 5)
/// 1
/// Explanation:
/// a = [1, 3, 7, 13, 21]
/// The only valid triple is (1, 7, 13).
func get_max_triples(n: Int) -> Int {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(get_max_triples(n: 5) == 1)
assert(get_max_triples(n: 6) == 4)
assert(get_max_triples(n: 10) == 36)
assert(get_max_triples(n: 100) == 53361)


Prompt:
/// In this problem, you will implement a function that takes two arrays of numbers,
/// and determines whether it is possible to perform an exchange of elements
/// between them to make lst1 an array of only even numbers.
/// There is no limit on the number of exchanged elements between lst1 and lst2.
/// If it is possible to exchange elements between the lst1 and lst2 to make
/// all the elements of lst1 to be even, return "YES".
/// Otherwise, return "NO".
/// For example:
/// >>> exchange(lst1: [1, 2, 3, 4], lst2: [1, 2, 3, 4])
/// "YES"
/// >>> exchange(lst1: [1, 2, 3, 4], lst2: [1, 5, 3, 4])
/// "NO"
/// It is assumed that the input arrays will be non-empty.
func exchange(lst1: [Int], lst2: [Int]) -> String {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(exchange(lst1: [1, 2, 3, 4], lst2: [1, 2, 3, 4]) == "YES")
assert(exchange(lst1: [1, 2, 3, 4], lst2: [1, 5, 3, 4]) == "NO")
assert(exchange(lst1: [1, 2, 3, 4], lst2: [2, 1, 4, 3]) == "YES")
assert(exchange(lst1: [5, 7, 3], lst2: [2, 6, 4]) == "YES")
assert(exchange(lst1: [5, 7, 3], lst2: [2, 6, 3]) == "NO")
assert(exchange(lst1: [3, 2, 6, 1, 8, 9], lst2: [3, 5, 5, 1, 1, 1]) == "NO")
assert(exchange(lst1: [100, 200], lst2: [200, 200]) == "YES")


Prompt:
/// Return median of elements in the array l.
/// >>> median(l: [3, 1, 2, 4, 5])
/// 3
/// >>> median(l: [-10, 4, 6, 1000, 10, 20])
/// 15.0
func median(l: [Int]) -> Double {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(median(l: [3, 1, 2, 4, 5]) == 3)
assert(median(l: [-10, 4, 6, 1000, 10, 20]) == 8.0)
assert(median(l: [5]) == 5)
assert(median(l: [6, 5]) == 5.5)
assert(median(l: [8, 1, 3, 9, 9, 2, 7]) == 7)


Prompt:
/// 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: "Hello")
/// true
/// >>> prime_length(string: "abcdcba")
/// true
/// >>> prime_length(string: "kittens")
/// true
/// >>> prime_length(string: "orange")
/// false
func prime_length(string: String) -> Bool {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(prime_length(string: "Hello") == true)
assert(prime_length(string: "abcdcba") == true)
assert(prime_length(string: "kittens") == true)
assert(prime_length(string: "orange") == false)
assert(prime_length(string: "wow") == true)
assert(prime_length(string: "world") == true)
assert(prime_length(string: "MadaM") == true)
assert(prime_length(string: "Wow") == true)
assert(prime_length(string: "") == false)
assert(prime_length(string: "HI") == true)
assert(prime_length(string: "go") == true)
assert(prime_length(string: "gogo") == false)
assert(prime_length(string: "aaaaaaaaaaaaaaa") == false)
assert(prime_length(string: "Madam") == true)
assert(prime_length(string: "M") == false)
assert(prime_length(string: "0") == false)


Prompt:
/// Given an array arr of integers, find the minimum number of elements that
/// need to be changed to make the array palindromic. A palindromic array is an array that
/// is read the same backwards and forwards. In one change, you can change one element to any other element.
/// For example:
/// >>> smallest_change(arr: [1, 2, 3, 5, 4, 7, 9, 6])
/// 4
/// >>> smallest_change(arr: [1, 2, 3, 4, 3, 2, 2])
/// 1
/// >>> smallest_change(arr: [1, 2, 3, 2, 1])
/// 0
func smallest_change(arr: [Int]) -> Int {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(smallest_change(arr: [1, 2, 3, 5, 4, 7, 9, 6]) == 4)
assert(smallest_change(arr: [1, 2, 3, 4, 3, 2, 2]) == 1)
assert(smallest_change(arr: [1, 4, 2]) == 1)
assert(smallest_change(arr: [1, 4, 4, 2]) == 1)
assert(smallest_change(arr: [1, 2, 3, 2, 1]) == 0)
assert(smallest_change(arr: [3, 1, 1, 3]) == 0)
assert(smallest_change(arr: [1]) == 0)
assert(smallest_change(arr: [0, 1]) == 1)


Prompt:
/// You are given an array of numbers.
/// You need to return the sum of squared numbers in the given array,
/// round each element in the array to the upper int(Ceiling) first.
/// Examples:
/// >>> sum_squares(lst: [1.0, 2.0, 3.0])
/// 14
/// >>> sum_squares(lst: [1.0, 4.0, 9.0])
/// 98
/// >>> sum_squares(lst: [1.0, 3.0, 5.0, 7.0])
/// 84
/// >>> sum_squares(lst: [1.4, 4.2, 0.0])
/// 29
/// >>> sum_squares(lst: [-2.4, 1.0, 1.0])
/// 6
func sum_squares(lst: [Double]) -> Int {


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(file_name: "example.txt")
/// "Yes"
/// >>> file_name_check(file_name: "1example.dll")
/// "No"
func file_name_check(file_name: String) -> String {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(file_name_check(file_name: "example.txt") == "Yes")
assert(file_name_check(file_name: "1example.dll") == "No")
assert(file_name_check(file_name: "s1sdf3.asd") == "No")
assert(file_name_check(file_name: "K.dll") == "Yes")
assert(file_name_check(file_name: "MY16FILE3.exe") == "Yes")
assert(file_name_check(file_name: "His12FILE94.exe") == "No")
assert(file_name_check(file_name: "_Y.txt") == "No")
assert(file_name_check(file_name: "?aREYA.exe") == "No")
assert(file_name_check(file_name: "/this_is_valid.dll") == "No")
assert(file_name_check(file_name: "this_is_valid.wow") == "No")
assert(file_name_check(file_name: "this_is_valid.txt") == "Yes")
assert(file_name_check(file_name: "this_is_valid.txtexe") == "No")
assert(file_name_check(file_name: "#this2_i4s_5valid.ten") == "No")
assert(file_name_check(file_name: "@this1_is6_valid.exe") == "No")
assert(file_name_check(file_name: "this_is_12valid.6exe4.txt") == "No")
assert(file_name_check(file_name: "all.exe.txt") == "No")
assert(file_name_check(file_name: "I563_No.exe") == "Yes")
assert(file_name_check(file_name: "Is3youfault.txt") == "Yes")
assert(file_name_check(file_name: "no_one#knows.dll") == "Yes")
assert(file_name_check(file_name: "1I563_Yes3.exe") == "No")
assert(file_name_check(file_name: "I563_Yes3.txtt") == "No")
assert(file_name_check(file_name: "final..txt") == "No")
assert(file_name_check(file_name: "final132") == "No")
assert(file_name_check(file_name: "_f4indsartal132.") == "No")
assert(file_name_check(file_name: ".txt") == "No")
assert(file_name_check(file_name: "s.") == "No")


Prompt:
/// triples_sum_to_zero takes an array of integers as an input.
/// it returns true if there are three distinct elements in the array that
/// sum to zero, and false otherwise.
/// >>> triples_sum_to_zero(l: [1, 3, 5, 0])
/// false
/// >>> triples_sum_to_zero(l: [1, 3, -2, 1])
/// true
/// >>> triples_sum_to_zero(l: [1, 2, 3, 7])
/// false
/// >>> triples_sum_to_zero(l: [2, 4, -5, 3, 9, 7])
/// true
/// >>> triples_sum_to_zero(l: [1])
/// false
func triples_sum_to_zero(l: [Int]) -> Bool {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(triples_sum_to_zero(l: [1, 3, 5, 0]) == false)
assert(triples_sum_to_zero(l: [1, 3, 5, -1]) == false)
assert(triples_sum_to_zero(l: [1, 3, -2, 1]) == true)
assert(triples_sum_to_zero(l: [1, 2, 3, 7]) == false)
assert(triples_sum_to_zero(l: [1, 2, 5, 7]) == false)
assert(triples_sum_to_zero(l: [2, 4, -5, 3, 9, 7]) == true)
assert(triples_sum_to_zero(l: [1]) == false)
assert(triples_sum_to_zero(l: [1, 3, 5, -100]) == false)
assert(triples_sum_to_zero(l: [100, 3, 5, -100]) == false)


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(interval1: (1, 2), interval2: (2, 3))
/// "NO"
/// >>> intersection(interval1: (-1, 1), interval2: (0, 4))
/// "NO"
/// >>> intersection(interval1: (-3, -1), interval2: (-5, 5))
/// "YES"
func intersection(interval1: (Int, Int), interval2: (Int, Int)) -> String {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(intersection(interval1: (1, 2), interval2: (2, 3)) == "NO")
assert(intersection(interval1: (-1, 1), interval2: (0, 4)) == "NO")
assert(intersection(interval1: (-3, -1), interval2: (-5, 5)) == "YES")
assert(intersection(interval1: (-2, 2), interval2: (-4, 0)) == "YES")
assert(intersection(interval1: (-11, 2), interval2: (-1, -1)) == "NO")
assert(intersection(interval1: (1, 2), interval2: (3, 5)) == "NO")
assert(intersection(interval1: (1, 2), interval2: (1, 2)) == "NO")
assert(intersection(interval1: (-2, -2), interval2: (-3, -2)) == "NO")


Prompt:
/// Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
/// separate those group into separate strings and return the array of those.
/// Separate groups are balanced (each open brace is properly closed) and not nested within each other
/// Ignore any spaces in the input string.
/// >>> separate_paren_groups(paren_string: "( ) (( )) (( )( ))")
/// ["()", "(())", "(()())"]
func separate_paren_groups(paren_string: String) -> [String] {


Prompt:
/// 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 given two arrays of scores and guesses of equal length, where each index shows a match.
/// Return an array of the same length denoting how far off each guess was. If they have guessed correctly,
/// the value is 0, and if not, the value is the absolute difference between the guess and the score.
/// example:
/// >>> compare(game: [1, 2, 3, 4, 5, 1], guess: [1, 2, 3, 4, 2, -2])
/// [0, 0, 0, 0, 3, 3]
/// >>> compare(game: [0, 5, 0, 0, 0, 4], guess: [4, 1, 1, 0, 0, -2])
/// [4, 4, 1, 0, 0, 6]
func compare(game: [Int], guess: [Int]) -> [Int] {


Prompt:
/// Given a positive integer n, return the count of the numbers of n-digit
/// positive integers that start or end with 1.
func starts_one_ends(n: Int) -> Int {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(starts_one_ends(n: 1) == 1)
assert(starts_one_ends(n: 2) == 18)
assert(starts_one_ends(n: 3) == 180)
assert(starts_one_ends(n: 4) == 1800)
assert(starts_one_ends(n: 5) == 18000)


Prompt:
/// 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(txt: "apple pie")
/// false
/// >>> check_if_last_char_is_a_letter(txt: "apple pi e")
/// true
/// >>> check_if_last_char_is_a_letter(txt: "apple pi e ")
/// false
/// >>> check_if_last_char_is_a_letter(txt: "")
/// false
func check_if_last_char_is_a_letter(txt: String) -> Bool {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(check_if_last_char_is_a_letter(txt: "apple") == false)
assert(check_if_last_char_is_a_letter(txt: "apple pi e") == true)
assert(check_if_last_char_is_a_letter(txt: "eeeee") == false)
assert(check_if_last_char_is_a_letter(txt: "A") == true)
assert(check_if_last_char_is_a_letter(txt: "Pumpkin pie ") == false)
assert(check_if_last_char_is_a_letter(txt: "Pumpkin pie 1") == false)
assert(check_if_last_char_is_a_letter(txt: "") == false)
assert(check_if_last_char_is_a_letter(txt: "eeeee e ") == false)
assert(check_if_last_char_is_a_letter(txt: "apple pie") == false)
assert(check_if_last_char_is_a_letter(txt: "apple pi e ") == false)


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(date: "03-11-2000")
/// true
/// >>> valid_date(date: "15-01-2012")
/// false
/// >>> valid_date(date: "04-0-2040")
/// false
/// >>> valid_date(date: "06-04-2020")
/// true
/// >>> valid_date(date: "06/04/2020")
/// false
func valid_date(date: String) -> Bool {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(valid_date(date: "03-11-2000") == true)
assert(valid_date(date: "15-01-2012") == false)
assert(valid_date(date: "04-0-2040") == false)
assert(valid_date(date: "06-04-2020") == true)
assert(valid_date(date: "01-01-2007") == true)
assert(valid_date(date: "03-32-2011") == false)
assert(valid_date(date: "") == false)
assert(valid_date(date: "04-31-3000") == false)
assert(valid_date(date: "06-06-2005") == true)
assert(valid_date(date: "21-31-2000") == false)
assert(valid_date(date: "04-12-2003") == true)
assert(valid_date(date: "04122003") == false)
assert(valid_date(date: "20030412") == false)
assert(valid_date(date: "2003-04") == false)
assert(valid_date(date: "2003-04-12") == false)
assert(valid_date(date: "04-2003") == false)


Prompt:
/// 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(arr: [] as [Int])
/// 0
/// >>> count_nums(arr: [-1, 11, -11])
/// 1
/// >>> count_nums(arr: [1, 1, 2])
/// 3
func count_nums(arr: [Int]) -> Int {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(count_nums(arr: [] as [Int]) == 0)
assert(count_nums(arr: [-1, -2, 0]) == 0)
assert(count_nums(arr: [1, 1, 2, -2, 3, 4, 5]) == 6)
assert(count_nums(arr: [1, 6, 9, -6, 0, 1, 5]) == 5)
assert(count_nums(arr: [1, 100, 98, -7, 1, -1]) == 4)
assert(count_nums(arr: [12, 23, 34, -45, -56, 0]) == 5)
assert(count_nums(arr: [0, 1]) == 1)
assert(count_nums(arr: [1]) == 1)


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(s: "Hi")
/// "Hi"
/// >>> anti_shuffle(s: "hello")
/// "ehllo"
/// >>> anti_shuffle(s: "Hello World!!!")
/// "Hello !!!Wdlor"
func anti_shuffle(s: String) -> String {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(anti_shuffle(s: "Hi") == "Hi")
assert(anti_shuffle(s: "hello") == "ehllo")
assert(anti_shuffle(s: "number") == "bemnru")
assert(anti_shuffle(s: "abcd") == "abcd")
assert(anti_shuffle(s: "Hello World!!!") == "Hello !!!Wdlor")
assert(anti_shuffle(s: "") == "")
assert(anti_shuffle(s: "Hi. My name is Mister Robot. How are you?") == ".Hi My aemn is Meirst .Rboot How aer ?ouy")


Prompt:
/// Checks if given string is a palindrome
/// >>> is_palindrome(text: "")
/// true
/// >>> is_palindrome(text: "aba")
/// true
/// >>> is_palindrome(text: "aaaaa")
/// true
/// >>> is_palindrome(text: "zbcd")
/// false
func is_palindrome(text: String) -> Bool {

}

func ==(left: [(Int, Int)], right: [(Int, Int)]) -> Bool {
    if left.count != right.count {
        return false
    }
    for (l, r) in zip(left, right) {
        if l != r {
            return false
        }
    }
    return true
}

assert(is_palindrome(text: "") == true)
assert(is_palindrome(text: "aba") == true)
assert(is_palindrome(text: "aaaaa") == true)
assert(is_palindrome(text: "zbcd") == false)
assert(is_palindrome(text: "xywyx") == true)
assert(is_palindrome(text: "xywyz") == false)
assert(is_palindrome(text: "xywzx") == false)