Prompt:
# You are given a string representing a sentence,
# the sentence contains some words separated by a space,
# and you have to return a string that contains the words from the original sentence,
# whose lengths are prime numbers,
# the order of the words in the new string should be the same as the original one.
# Example 1:
# >>> words_in_sentence.call("This is a test")
# "is"
# Example 2:
# >>> words_in_sentence.call("lets go for swimming")
# "go for"
# Constraints:
# * 1 <= len(sentence) <= 100
# * sentence contains only letters
def words_in_sentence(sentence)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_words_in_sentence
    candidate = method(:words_in_sentence)
    assert_equal("is", candidate.call("This is a test"))
    assert_equal("go for", candidate.call("lets go for swimming"))
    assert_equal("there is no place", candidate.call("there is no place available here"))
    assert_equal("Hi am Hussein", candidate.call("Hi I am Hussein"))
    assert_equal("go for it", candidate.call("go for it"))
    assert_equal("", candidate.call("here"))
    assert_equal("is", candidate.call("here is"))
  end
end


Prompt:
# Given a string representing a space separated lowercase letters, return a hash
# of the letter with the most repetition and containing the corresponding count.
# If several letters have the same occurrence, return all of them.
# Example:
# >>> histogram.call("a b c")
# {"a" => 1, "b" => 1, "c" => 1}
# >>> histogram.call("a b b a")
# {"a" => 2, "b" => 2}
# >>> histogram.call("a b c a b")
# {"a" => 2, "b" => 2}
# >>> histogram.call("b b b b a")
# {"b" => 4}
# >>> histogram.call("")
# {}
def histogram(test)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_histogram
    candidate = method(:histogram)
    assert_equal({"a" => 2, "b" => 2}, candidate.call("a b b a"))
    assert_equal({"a" => 2, "b" => 2}, candidate.call("a b c a b"))
    assert_equal({"a" => 1, "b" => 1, "c" => 1, "d" => 1, "g" => 1}, candidate.call("a b c d g"))
    assert_equal({"r" => 1, "t" => 1, "g" => 1}, candidate.call("r t g"))
    assert_equal({"b" => 4}, candidate.call("b b b b a"))
    assert_equal({"r" => 1, "t" => 1, "g" => 1}, candidate.call("r t g"))
    assert_equal({}, candidate.call(""))
    assert_equal({"a" => 1}, candidate.call("a"))
  end
end


Prompt:
# You are given a 2 dimensional data, as a nested arrays,
# which is similar to matrix, however, unlike matrices,
# each row may contain a different number of columns.
# Given lst, and integer x, find integers x in the array,
# and return array of arrays, [(x1, y1), (x2, y2) ...] such that
# each array is a coordinate - (row, columns), starting with 0.
# Sort coordinates initially by rows in ascending order.
# Also, sort coordinates of the row by columns in descending order.
# Examples:
# >>> get_row.call([[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 1, 6], [1, 2, 3, 4, 5, 1]], 1)
# [[0, 0], [1, 4], [1, 0], [2, 5], [2, 0]]
# >>> get_row.call([], 1)
# []
# >>> get_row.call([[], [1], [1, 2, 3]], 3)
# [[2, 2]]
def get_row(lst, x)


Prompt:
# Given a positive integer n, return a sorted array that has the odd numbers in collatz sequence.
# The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined
# as follows: start with any positive integer n. Then each term is obtained from the
# previous term as follows: if the previous term is even, the next term is one half of
# the previous term. If the previous term is odd, the next term is 3 times the previous
# term plus 1. The conjecture is that no matter what value of n, the sequence will always reach 1.
# Note:
# 1. Collatz(1) is [1].
# 2. returned array sorted in increasing order.
# For example:
# get_odd_collatz(5) returns [1, 5] # The collatz sequence for 5 is [5, 16, 8, 4, 2, 1], so the odd numbers are only 1, and 5.
# >>> get_odd_collatz.call(5)
# [1, 5]
def get_odd_collatz(n)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_get_odd_collatz
    candidate = method(:get_odd_collatz)
    assert_equal([1, 5, 7, 11, 13, 17], candidate.call(14))
    assert_equal([1, 5], candidate.call(5))
    assert_equal([1, 3, 5], candidate.call(12))
    assert_equal([1], candidate.call(1))
  end
end


Prompt:
# Create a function which returns the largest index of an element which
# is not greater than or equal to the element immediately preceding it. If
# no such element exists then return -1. The given array will not contain
# duplicate values.
# Examples:
# >>> can_arrange.call([1, 2, 4, 3, 5])
# 3
# >>> can_arrange.call([1, 2, 3])
# -1
def can_arrange(arr)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_can_arrange
    candidate = method(:can_arrange)
    assert_equal(3, candidate.call([1, 2, 4, 3, 5]))
    assert_equal(-1, candidate.call([1, 2, 4, 5]))
    assert_equal(2, candidate.call([1, 4, 2, 5, 6, 7, 8, 9, 10]))
    assert_equal(4, candidate.call([4, 8, 5, 7, 3]))
    assert_equal(-1, candidate.call([]))
  end
end


Prompt:
# Input is a space-delimited string of numberals from 'zero' to 'nine'.
# Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'.
# Return the string with numbers sorted from smallest to largest
# >>> sort_numbers.call("three one five")
# "one three five"
def sort_numbers(numbers)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_sort_numbers
    candidate = method(:sort_numbers)
    assert_equal("", candidate.call(""))
    assert_equal("three", candidate.call("three"))
    assert_equal("three five nine", candidate.call("three five nine"))
    assert_equal("zero four five seven eight nine", candidate.call("five zero four seven nine eight"))
    assert_equal("zero one two three four five six", candidate.call("six five four three two one zero"))
  end
end


Prompt:
# Circular shift the digits of the integer x, shift the digits right by shift
# and return the result as a string.
# If shift > number of digits, return digits reversed.
# >>> circular_shift.call(12, 1)
# "21"
# >>> circular_shift.call(12, 2)
# "12"
def circular_shift(x, shift)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_circular_shift
    candidate = method(:circular_shift)
    assert_equal("001", candidate.call(100, 2))
    assert_equal("12", candidate.call(12, 2))
    assert_equal("79", candidate.call(97, 8))
    assert_equal("21", candidate.call(12, 1))
    assert_equal("11", candidate.call(11, 101))
  end
end


Prompt:
# "
# This function will take an array of integers. For all entries in the array, the function shall square the integer entry if its index is a
# multiple of 3 and will cube the integer entry if its index is a multiple of 4 and not a multiple of 3. The function will not
# change the entries in the array whose indexes are not a multiple of 3 or 4. The function shall then return the sum of all entries.
# Examples:
# >>> lst
# [1, 2, 3]
# >>> lst
# []
# >>> lst
# [-1, -5, 2, -1, -5]
def sum_squares(lst)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_sum_squares
    candidate = method(:sum_squares)
    assert_equal(6, candidate.call([1, 2, 3]))
    assert_equal(14, candidate.call([1, 4, 9]))
    assert_equal(0, candidate.call([]))
    assert_equal(9, candidate.call([1, 1, 1, 1, 1, 1, 1, 1, 1]))
    assert_equal(-3, candidate.call([-1, -1, -1, -1, -1, -1, -1, -1, -1]))
    assert_equal(0, candidate.call([0]))
    assert_equal(-126, candidate.call([-1, -5, 2, -1, -5]))
    assert_equal(3030, candidate.call([-56, -99, 1, 0, -2]))
    assert_equal(0, candidate.call([-1, 0, 0, 0, 0, 0, 0, 0, -1]))
    assert_equal(-14196, candidate.call([-16, -9, -2, 36, 36, 26, -20, 25, -40, 20, -4, 12, -26, 35, 37]))
    assert_equal(-1448, candidate.call([-1, -3, 17, -1, -15, 13, -1, 14, -14, -12, -5, 14, -14, 6, 13, 11, 16, 16, 4, 10]))
  end
end


Prompt:
# You are given an array of integers.
# You need to find the largest prime value and return the sum of its digits.
# Examples:
# >>> skjkasdkd.call([0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3])
# 10
# >>> skjkasdkd.call([1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1])
# 25
# >>> skjkasdkd.call([1, 3, 1, 32, 5107, 34, 83278, 109, 163, 23, 2323, 32, 30, 1, 9, 3])
# 13
# >>> skjkasdkd.call([0, 724, 32, 71, 99, 32, 6, 0, 5, 91, 83, 0, 5, 6])
# 11
# >>> skjkasdkd.call([0, 81, 12, 3, 1, 21])
# 3
# >>> skjkasdkd.call([0, 8, 1, 2, 1, 7])
# 7
def skjkasdkd(lst)


Prompt:
# For a given array of integers, return an array consisting of a sum and a product of all the integers in an array.
# Empty sum should be equal to 0 and empty product should be equal to 1.
# >>> sum_product.call([])
# [0, 1]
# >>> sum_product.call([1, 2, 3, 4])
# [10, 24]
def sum_product(numbers)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_sum_product
    candidate = method(:sum_product)
    assert_equal([0, 1], candidate.call([]))
    assert_equal([3, 1], candidate.call([1, 1, 1]))
    assert_equal([100, 0], candidate.call([100, 0]))
    assert_equal([15, 105], candidate.call([3, 5, 7]))
    assert_equal([10, 10], candidate.call([10]))
  end
end


Prompt:
# This function takes two positive numbers x and y and returns the
# biggest even integer number that is in the range [x, y] inclusive. If
# there's no such number, then the function should return -1.
# For example:
# >>> choose_num.call(12, 15)
# 14
# >>> choose_num.call(13, 12)
# -1
def choose_num(x, y)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_choose_num
    candidate = method(:choose_num)
    assert_equal(14, candidate.call(12, 15))
    assert_equal(-1, candidate.call(13, 12))
    assert_equal(12354, candidate.call(33, 12354))
    assert_equal(-1, candidate.call(5234, 5233))
    assert_equal(28, candidate.call(6, 29))
    assert_equal(-1, candidate.call(27, 10))
    assert_equal(-1, candidate.call(7, 7))
    assert_equal(546, candidate.call(546, 546))
  end
end


Prompt:
# Create a function that returns an array (a, b), where 'a' is
# the largest of negative integers, and 'b' is the smallest
# of positive integers in an array.
# If there is no negative or positive integers, return them as nil.
# Examples:
# >>> largest_smallest_integers.call([2, 4, 1, 3, 5, 7])
# [nil, 1]
# >>> largest_smallest_integers.call([])
# [nil, nil]
# >>> largest_smallest_integers.call([0])
# [nil, nil]
def largest_smallest_integers(lst)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_largest_smallest_integers
    candidate = method(:largest_smallest_integers)
    assert_equal([nil, 1], candidate.call([2, 4, 1, 3, 5, 7]))
    assert_equal([nil, 1], candidate.call([2, 4, 1, 3, 5, 7, 0]))
    assert_equal([-2, 1], candidate.call([1, 3, 2, 4, 5, 6, -2]))
    assert_equal([-7, 2], candidate.call([4, 5, 3, 6, 2, 7, -7]))
    assert_equal([-9, 2], candidate.call([7, 3, 8, 4, 9, 2, 5, -9]))
    assert_equal([nil, nil], candidate.call([]))
    assert_equal([nil, nil], candidate.call([0]))
    assert_equal([-1, nil], candidate.call([-1, -3, -5, -6]))
    assert_equal([-1, nil], candidate.call([-1, -3, -5, -6, 0]))
    assert_equal([-3, 1], candidate.call([-6, -4, -4, -3, 1]))
    assert_equal([-3, 1], candidate.call([-6, -4, -4, -3, -100, 1]))
  end
end


Prompt:
# Given a string, find out how many distinct characters (regardless of case) does it consist of
# >>> count_distinct_characters.call("xyzXYZ")
# 3
# >>> count_distinct_characters.call("Jerry")
# 4
def count_distinct_characters(string)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_count_distinct_characters
    candidate = method(:count_distinct_characters)
    assert_equal(0, candidate.call(""))
    assert_equal(5, candidate.call("abcde"))
    assert_equal(5, candidate.call("abcdecadeCADE"))
    assert_equal(1, candidate.call("aaaaAAAAaaaa"))
    assert_equal(5, candidate.call("Jerry jERRY JeRRRY"))
  end
end


Prompt:
# Given a positive integer n, you have to make a pile of n levels of stones.
# The first level has n stones.
# The number of stones in the next level is:
# - the next odd number if n is odd.
# - the next even number if n is even.
# Return the number of stones in each level in an array, where element at index
# i represents the number of stones in the level (i+1).
# Examples:
# >>> make_a_pile.call(3)
# [3, 5, 7]
def make_a_pile(n)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_make_a_pile
    candidate = method(:make_a_pile)
    assert_equal([3, 5, 7], candidate.call(3))
    assert_equal([4, 6, 8, 10], candidate.call(4))
    assert_equal([5, 7, 9, 11, 13], candidate.call(5))
    assert_equal([6, 8, 10, 12, 14, 16], candidate.call(6))
    assert_equal([8, 10, 12, 14, 16, 18, 20, 22], candidate.call(8))
  end
end


Prompt:
# You are given an array arr of integers and you need to return
# sum of magnitudes of integers multiplied by product of all signs
# of each number in the array, represented by 1, -1 or 0.
# Note: return nil for empty arr.
# Example:
# >>> prod_signs.call([1, 2, 2, -4])
# 9
# >>> prod_signs.call([0, 1])
# 0
# >>> prod_signs.call([])
# nil
def prod_signs(arr)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_prod_signs
    candidate = method(:prod_signs)
    assert_equal(-9, candidate.call([1, 2, 2, -4]))
    assert_equal(0, candidate.call([0, 1]))
    assert_equal(-10, candidate.call([1, 1, 1, 2, 3, -1, 1]))
    assert_equal(nil, candidate.call([]))
    assert_equal(20, candidate.call([2, 4, 1, 2, -1, -1, 9]))
    assert_equal(4, candidate.call([-1, 1, -1, 1]))
    assert_equal(-4, candidate.call([-1, 1, 1, 1]))
    assert_equal(0, candidate.call([-1, 1, 1, 0]))
  end
end


Prompt:
# Given an array of integers nums, find the minimum sum of any non-empty sub-array
# of nums.
# Example
# >>> minSubArraySum.call([2, 3, 4, 1, 2, 4])
# 1
# >>> minSubArraySum.call([-1, -2, -3])
# -6
def minSubArraySum(nums)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_minSubArraySum
    candidate = method(:minSubArraySum)
    assert_equal(1, candidate.call([2, 3, 4, 1, 2, 4]))
    assert_equal(-6, candidate.call([-1, -2, -3]))
    assert_equal(-14, candidate.call([-1, -2, -3, 2, -10]))
    assert_equal(-9999999999999999, candidate.call([-9999999999999999]))
    assert_equal(0, candidate.call([0, 10, 20, 1000000]))
    assert_equal(-6, candidate.call([-1, -2, -3, 10, -5]))
    assert_equal(-6, candidate.call([100, -1, -2, -3, 10, -5]))
    assert_equal(3, candidate.call([10, 11, 13, 8, 3, 4]))
    assert_equal(-33, candidate.call([100, -33, 32, -1, 0, -2]))
    assert_equal(-10, candidate.call([-10]))
    assert_equal(7, candidate.call([7]))
    assert_equal(-1, candidate.call([1, -1]))
  end
end


Prompt:
# Return a string containing space-delimited numbers starting from 0 upto n inclusive.
# >>> string_sequence.call(0)
# "0"
# >>> string_sequence.call(5)
# "0 1 2 3 4 5"
def string_sequence(n)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_string_sequence
    candidate = method(:string_sequence)
    assert_equal("0", candidate.call(0))
    assert_equal("0 1 2 3", candidate.call(3))
    assert_equal("0 1 2 3 4 5 6 7 8 9 10", candidate.call(10))
  end
end


Prompt:
# You are given 2 words. You need to return true if the second word or any of its rotations is a substring in the first word
# >>> cycpattern_check.call("abcd", "abd")
# false
# >>> cycpattern_check.call("hello", "ell")
# true
# >>> cycpattern_check.call("whassup", "psus")
# false
# >>> cycpattern_check.call("abab", "baa")
# true
# >>> cycpattern_check.call("efef", "eeff")
# false
# >>> cycpattern_check.call("himenss", "simen")
# true
def cycpattern_check(a, b)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_cycpattern_check
    candidate = method(:cycpattern_check)
    assert_equal(false, candidate.call("xyzw", "xyw"))
    assert_equal(true, candidate.call("yello", "ell"))
    assert_equal(false, candidate.call("whattup", "ptut"))
    assert_equal(true, candidate.call("efef", "fee"))
    assert_equal(false, candidate.call("abab", "aabb"))
    assert_equal(true, candidate.call("winemtt", "tinem"))
  end
end


Prompt:
# Return true is array elements are monotonically increasing or decreasing.
# >>> monotonic.call([1, 2, 4, 20])
# true
# >>> monotonic.call([1, 20, 4, 10])
# false
# >>> monotonic.call([4, 1, 0, -10])
# true
def monotonic(l)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_monotonic
    candidate = method(:monotonic)
    assert_equal(true, candidate.call([1, 2, 4, 10]))
    assert_equal(true, candidate.call([1, 2, 4, 20]))
    assert_equal(false, candidate.call([1, 20, 4, 10]))
    assert_equal(true, candidate.call([4, 1, 0, -10]))
    assert_equal(true, candidate.call([4, 1, 1, 0]))
    assert_equal(false, candidate.call([1, 2, 3, 2, 5, 60]))
    assert_equal(true, candidate.call([1, 2, 3, 4, 5, 60]))
    assert_equal(true, candidate.call([9, 9, 9, 9]))
  end
end


Prompt:
# Out of array of strings, return the longest one. Return the first one in case of multiple
# strings of the same length. Return nil in case the input array is empty.
# >>> longest.call([])
# nil
# >>> longest.call(["a", "b", "c"])
# "a"
# >>> longest.call(["a", "bb", "ccc"])
# "ccc"
def longest(strings)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_longest
    candidate = method(:longest)
    assert_equal(nil, candidate.call([]))
    assert_equal("x", candidate.call(["x", "y", "z"]))
    assert_equal("zzzz", candidate.call(["x", "yyy", "zzzz", "www", "kkkk", "abc"]))
  end
end


Prompt:
# Return true if all numbers in the array l are below threshold t.
# >>> below_threshold.call([1, 2, 4, 10], 100)
# true
# >>> below_threshold.call([1, 20, 4, 10], 5)
# false
def below_threshold(l, t)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_below_threshold
    candidate = method(:below_threshold)
    assert_equal(true, candidate.call([1, 2, 4, 10], 100))
    assert_equal(false, candidate.call([1, 20, 4, 10], 5))
    assert_equal(true, candidate.call([1, 20, 4, 10], 21))
    assert_equal(true, candidate.call([1, 20, 4, 10], 22))
    assert_equal(true, candidate.call([1, 8, 4, 10], 11))
    assert_equal(false, candidate.call([1, 8, 4, 10], 10))
  end
end


Prompt:
# Write a function that returns true if the given number is the multiplication of 3 prime numbers
# and false otherwise.
# Knowing that (a) is less then 100.
# Example:
# >>> is_multiply_prime.call(30)
# true
# 30 = 2 * 3 * 5
def is_multiply_prime(a)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_is_multiply_prime
    candidate = method(:is_multiply_prime)
    assert_equal(false, candidate.call(5))
    assert_equal(true, candidate.call(30))
    assert_equal(true, candidate.call(8))
    assert_equal(false, candidate.call(10))
    assert_equal(true, candidate.call(125))
    assert_equal(true, candidate.call(105))
    assert_equal(false, candidate.call(126))
    assert_equal(false, candidate.call(729))
    assert_equal(false, candidate.call(891))
    assert_equal(true, candidate.call(1001))
  end
end


Prompt:
# Return only positive numbers in the array.
# >>> get_positive.call([-1, 2, -4, 5, 6])
# [2, 5, 6]
# >>> get_positive.call([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])
# [5, 3, 2, 3, 9, 123, 1]
def get_positive(l)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_get_positive
    candidate = method(:get_positive)
    assert_equal([4, 5, 6], candidate.call([-1, -2, 4, 5, 6]))
    assert_equal([5, 3, 2, 3, 3, 9, 123, 1], candidate.call([5, 3, -5, 2, 3, 3, 9, 0, 123, 1, -10]))
    assert_equal([], candidate.call([-1, -2]))
    assert_equal([], candidate.call([]))
  end
end


Prompt:
# This function takes an array l and returns an array l' such that
# l' is identical to l in the indicies that are not divisible by three, while its values at the indicies that are divisible by three are equal
# to the values of the corresponding indicies of l, but sorted.
# >>> sort_third.call([1, 2, 3])
# [1, 2, 3]
# >>> sort_third.call([5, 6, 3, 4, 8, 9, 2])
# [2, 6, 3, 4, 8, 9, 5]
def sort_third(l)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_sort_third
    candidate = method(:sort_third)
    assert_equal([2, 6, 3, 4, 8, 9, 5], candidate.call([5, 6, 3, 4, 8, 9, 2]))
    assert_equal([2, 8, 3, 4, 6, 9, 5], candidate.call([5, 8, 3, 4, 6, 9, 2]))
    assert_equal([2, 6, 9, 4, 8, 3, 5], candidate.call([5, 6, 9, 4, 8, 3, 2]))
    assert_equal([2, 6, 3, 4, 8, 9, 5, 1], candidate.call([5, 6, 3, 4, 8, 9, 2, 1]))
  end
end


Prompt:
# Input to this function is a string represented multiple groups for nested parentheses separated by spaces.
# For each of the group, output the deepest level of nesting of parentheses.
# E.g. (()()) has maximum two levels of nesting while ((())) has three.
# >>> parse_nested_parens.call("(()()) ((())) () ((())()())")
# [2, 3, 1, 3]
def parse_nested_parens(paren_string)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_parse_nested_parens
    candidate = method(:parse_nested_parens)
    assert_equal([2, 3, 1, 3], candidate.call("(()()) ((())) () ((())()())"))
    assert_equal([1, 2, 3, 4], candidate.call("() (()) ((())) (((())))"))
    assert_equal([4], candidate.call("(()(())((())))"))
  end
end


Prompt:
# Given length of a side and high return area for a triangle.
# >>> triangle_area.call(5, 3)
# 7.5
def triangle_area(a, h)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_triangle_area
    candidate = method(:triangle_area)
    assert_equal(7.5, candidate.call(5, 3))
    assert_equal(2.0, candidate.call(2, 2))
    assert_equal(40.0, candidate.call(10, 8))
  end
end


Prompt:
# Complete the function that takes two integers and returns
# the product of their unit digits.
# Assume the input is always valid.
# Examples:
# >>> multiply.call(148, 412)
# 16
# >>> multiply.call(19, 28)
# 72
# >>> multiply.call(2020, 1851)
# 0
# >>> multiply.call(14, -15)
# 20
def multiply(a, b)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_multiply
    candidate = method(:multiply)
    assert_equal(16, candidate.call(148, 412))
    assert_equal(72, candidate.call(19, 28))
    assert_equal(0, candidate.call(2020, 1851))
    assert_equal(20, candidate.call(14, -15))
    assert_equal(42, candidate.call(76, 67))
    assert_equal(49, candidate.call(17, 27))
    assert_equal(0, candidate.call(0, 1))
    assert_equal(0, candidate.call(0, 0))
  end
end


Prompt:
# For a given array of input numbers, calculate Mean Absolute Deviation
# around the mean of this dataset.
# Mean Absolute Deviation is the average absolute difference between each
# element and a centerpoint (mean in this case):
# MAD = average | x - x_mean |
# >>> mean_absolute_deviation.call([1.0, 2.0, 3.0, 4.0])
# 1.0
def mean_absolute_deviation(numbers)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_mean_absolute_deviation
    candidate = method(:mean_absolute_deviation)
    assert_equal(0.5, candidate.call([1.0, 2.0]))
    assert_equal(1.0, candidate.call([1.0, 2.0, 3.0, 4.0]))
    assert_equal(1.2, candidate.call([1.0, 2.0, 3.0, 4.0, 5.0]))
  end
end


Prompt:
# Return sorted unique common elements for two arrays.
# >>> common.call([1, 4, 3, 34, 653, 2, 5], [5, 7, 1, 5, 9, 653, 121])
# [1, 5, 653]
# >>> common.call([5, 3, 2, 8], [3, 2])
# [2, 3]
def common(l1, l2)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_common
    candidate = method(:common)
    assert_equal([1, 5, 653], candidate.call([1, 4, 3, 34, 653, 2, 5], [5, 7, 1, 5, 9, 653, 121]))
    assert_equal([2, 3], candidate.call([5, 3, 2, 8], [3, 2]))
    assert_equal([2, 3, 4], candidate.call([4, 3, 2, 8], [3, 2, 4]))
    assert_equal([], candidate.call([4, 3, 2, 8], []))
  end
end


Prompt:
# Given a positive integer, obtain its roman numeral equivalent as a string,
# and return it in lowercase.
# Restrictions: 1 <= num <= 1000
# Examples:
# >>> int_to_mini_roman.call(19)
# "xix"
# >>> int_to_mini_roman.call(152)
# "clii"
# >>> int_to_mini_roman.call(426)
# "cdxxvi"
def int_to_mini_roman(number)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_int_to_mini_roman
    candidate = method(:int_to_mini_roman)
    assert_equal("xix", candidate.call(19))
    assert_equal("clii", candidate.call(152))
    assert_equal("ccli", candidate.call(251))
    assert_equal("cdxxvi", candidate.call(426))
    assert_equal("d", candidate.call(500))
    assert_equal("i", candidate.call(1))
    assert_equal("iv", candidate.call(4))
    assert_equal("xliii", candidate.call(43))
    assert_equal("xc", candidate.call(90))
    assert_equal("xciv", candidate.call(94))
    assert_equal("dxxxii", candidate.call(532))
    assert_equal("cm", candidate.call(900))
    assert_equal("cmxciv", candidate.call(994))
    assert_equal("m", candidate.call(1000))
  end
end


Prompt:
# In this task, you will be given a string that represents a number of apples and oranges
# that are distributed in a basket of fruit this basket contains
# apples, oranges, and mango fruits. Given the string that represents the total number of
# the oranges and apples and an integer that represent the total number of the fruits
# in the basket return the number of the mango fruits in the basket.
# for examble:
# >>> fruit_distribution.call("5 apples and 6 oranges", 19)
# 8
# >>> fruit_distribution.call("0 apples and 1 oranges", 3)
# 2
# >>> fruit_distribution.call("2 apples and 3 oranges", 100)
# 95
# >>> fruit_distribution.call("100 apples and 1 oranges", 120)
# 19
def fruit_distribution(s, n)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_fruit_distribution
    candidate = method(:fruit_distribution)
    assert_equal(8, candidate.call("5 apples and 6 oranges", 19))
    assert_equal(10, candidate.call("5 apples and 6 oranges", 21))
    assert_equal(2, candidate.call("0 apples and 1 oranges", 3))
    assert_equal(2, candidate.call("1 apples and 0 oranges", 3))
    assert_equal(95, candidate.call("2 apples and 3 oranges", 100))
    assert_equal(0, candidate.call("2 apples and 3 oranges", 5))
    assert_equal(19, candidate.call("1 apples and 100 oranges", 120))
  end
end


Prompt:
# Task
# We are given two strings s and c, you have to deleted all the characters in s that are equal to any character in c
# then check if the result string is palindrome.
# A string is called palindrome if it reads the same backward as forward.
# You should return an array containing the result string and true/false for the check.
# Example
# >>> reverse_delete.call("abcde", "ae")
# ["bcd", false]
# >>> reverse_delete.call("abcdef", "b")
# ["acdef", false]
# >>> reverse_delete.call("abcdedcba", "ab")
# ["cdedc", true]
def reverse_delete(s, c)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_reverse_delete
    candidate = method(:reverse_delete)
    assert_equal(["bcd", false], candidate.call("abcde", "ae"))
    assert_equal(["acdef", false], candidate.call("abcdef", "b"))
    assert_equal(["cdedc", true], candidate.call("abcdedcba", "ab"))
    assert_equal(["dik", false], candidate.call("dwik", "w"))
    assert_equal(["", true], candidate.call("a", "a"))
    assert_equal(["abcdedcba", true], candidate.call("abcdedcba", ""))
    assert_equal(["abcdedcba", true], candidate.call("abcdedcba", "v"))
    assert_equal(["abba", true], candidate.call("vabba", "v"))
    assert_equal(["", true], candidate.call("mamma", "mia"))
  end
end


Prompt:
# Return a greatest common divisor of two integers a and b
# >>> greatest_common_divisor.call(3, 5)
# 1
# >>> greatest_common_divisor.call(25, 15)
# 5
def greatest_common_divisor(a, b)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_greatest_common_divisor
    candidate = method(:greatest_common_divisor)
    assert_equal(1, candidate.call(3, 7))
    assert_equal(5, candidate.call(10, 15))
    assert_equal(7, candidate.call(49, 14))
    assert_equal(12, candidate.call(144, 60))
  end
end


Prompt:
# Given a string of words, return an array of words split on whitespace, if no whitespaces exists in the text you
# should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
# alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
# Examples
# >>> split_words.call("Hello world!")
# ["Hello", "world!"]
# >>> split_words.call("Hello,world!")
# ["Hello", "world!"]
# >>> split_words.call("abcdef")
# 3
def split_words(txt)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_split_words
    candidate = method(:split_words)
    assert_equal(["Hello", "world!"], candidate.call("Hello world!"))
    assert_equal(["Hello", "world!"], candidate.call("Hello,world!"))
    assert_equal(["Hello", "world,!"], candidate.call("Hello world,!"))
    assert_equal(["Hello,Hello,world", "!"], candidate.call("Hello,Hello,world !"))
    assert_equal(3, candidate.call("abcdef"))
    assert_equal(2, candidate.call("aaabb"))
    assert_equal(1, candidate.call("aaaBb"))
    assert_equal(0, candidate.call(""))
  end
end


Prompt:
# In this Kata, you have to sort an array of non-negative integers according to
# number of ones in their binary representation in ascending order.
# For similar number of ones, sort based on decimal value.
# It must be implemented like this:
# >>> sort_array.call([1, 5, 2, 3, 4])
# [1, 2, 3, 4, 5]
# >>> sort_array.call([-2, -3, -4, -5, -6])
# [-6, -5, -4, -3, -2]
# >>> sort_array.call([1, 0, 2, 3, 4])
# [0, 1, 2, 3, 4]
def sort_array(arr)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_sort_array
    candidate = method(:sort_array)
    assert_equal([1, 2, 4, 3, 5], candidate.call([1, 5, 2, 3, 4]))
    assert_equal([-4, -2, -6, -5, -3], candidate.call([-2, -3, -4, -5, -6]))
    assert_equal([0, 1, 2, 4, 3], candidate.call([1, 0, 2, 3, 4]))
    assert_equal([], candidate.call([]))
    assert_equal([2, 2, 4, 4, 3, 3, 5, 5, 5, 7, 77], candidate.call([2, 5, 77, 4, 5, 3, 5, 7, 2, 3, 4]))
    assert_equal([32, 3, 5, 6, 12, 44], candidate.call([3, 6, 44, 12, 32, 5]))
    assert_equal([2, 4, 8, 16, 32], candidate.call([2, 4, 8, 16, 32]))
    assert_equal([2, 4, 8, 16, 32], candidate.call([2, 4, 8, 16, 32]))
  end
end


Prompt:
# Concatenate array of strings into a single string
# >>> concatenate.call([])
# ""
# >>> concatenate.call(["a", "b", "c"])
# "abc"
def concatenate(strings)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_concatenate
    candidate = method(:concatenate)
    assert_equal("", candidate.call([]))
    assert_equal("xyz", candidate.call(["x", "y", "z"]))
    assert_equal("xyzwk", candidate.call(["x", "y", "z", "w", "k"]))
  end
end


Prompt:
# Write a function that accepts an array of strings as a parameter,
# deletes the strings that have odd lengths from it,
# and returns the resulted array with a sorted order,
# The array is always an array of strings and never an array of numbers,
# and it may contain duplicates.
# The order of the array should be ascending by length of each word, and you
# should return the array sorted by that rule.
# If two words have the same length, sort the array alphabetically.
# The function should return an array of strings in sorted order.
# You may assume that all words will have the same length.
# For example:
# >>> list_sort.call(["aa", "a", "aaa"])
# ["aa"]
# >>> list_sort.call(["ab", "a", "aaa", "cd"])
# ["ab", "cd"]
def sorted_list_sum(lst)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_sorted_list_sum
    candidate = method(:sorted_list_sum)
    assert_equal(["aa"], candidate.call(["aa", "a", "aaa"]))
    assert_equal(["AI", "asdf", "school"], candidate.call(["school", "AI", "asdf", "b"]))
    assert_equal([], candidate.call(["d", "b", "c", "a"]))
    assert_equal(["abcd", "dcba"], candidate.call(["d", "dcba", "abcd", "a"]))
    assert_equal(["AI", "ai", "au"], candidate.call(["AI", "ai", "au"]))
    assert_equal([], candidate.call(["a", "b", "b", "c", "c", "a"]))
    assert_equal(["cc", "dd", "aaaa", "bbbb"], candidate.call(["aaaa", "bbbb", "dd", "cc"]))
  end
end


Prompt:
# Filter an input array of strings only for ones that contain given substring
# >>> filter_by_substring.call([], "a")
# []
# >>> filter_by_substring.call(["abc", "bacd", "cde", "array"], "a")
# ["abc", "bacd", "array"]
def filter_by_substring(strings, substring)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_filter_by_substring
    candidate = method(:filter_by_substring)
    assert_equal([], candidate.call([], "john"))
    assert_equal(["xxx", "xxxAAA", "xxx"], candidate.call(["xxx", "asd", "xxy", "john doe", "xxxAAA", "xxx"], "xxx"))
    assert_equal(["xxx", "aaaxxy", "xxxAAA", "xxx"], candidate.call(["xxx", "asd", "aaaxxy", "john doe", "xxxAAA", "xxx"], "xx"))
    assert_equal(["grunt", "prune"], candidate.call(["grunt", "trumpet", "prune", "gruesome"], "run"))
  end
end


Prompt:
# Create a function that takes a value (string) representing a number
# and returns the closest integer to it. If the number is equidistant
# from two integers, round it away from zero.
# Examples
# >>> closest_integer.call("10")
# 10
# >>> closest_integer.call("15.3")
# 15
# Note:
# Rounding away from zero means that if the given number is equidistant
# from two integers, the one you should return is the one that is the
# farthest from zero. For example closest_integer("14.5") should
# return 15 and closest_integer("-14.5") should return -15.
def closest_integer(value)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_closest_integer
    candidate = method(:closest_integer)
    assert_equal(10, candidate.call("10"))
    assert_equal(15, candidate.call("14.5"))
    assert_equal(-16, candidate.call("-15.5"))
    assert_equal(15, candidate.call("15.3"))
    assert_equal(0, candidate.call("0"))
  end
end


Prompt:
# Write a function vowels_count which takes a string representing
# a word as input and returns the number of vowels in the string.
# Vowels in this case are 'a', 'e', 'i', 'o', 'u'. Here, 'y' is also a
# vowel, but only when it is at the end of the given word.
# Example:
# >>> vowels_count.call("abcde")
# 2
# >>> vowels_count.call("ACEDY")
# 3
def vowels_count(s)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_vowels_count
    candidate = method(:vowels_count)
    assert_equal(2, candidate.call("abcde"))
    assert_equal(3, candidate.call("Alone"))
    assert_equal(2, candidate.call("key"))
    assert_equal(1, candidate.call("bye"))
    assert_equal(2, candidate.call("keY"))
    assert_equal(1, candidate.call("bYe"))
    assert_equal(3, candidate.call("ACEDY"))
  end
end


Prompt:
# Write a function that accepts an array of strings.
# The array contains different words. Return the word with maximum number
# of unique characters. If multiple strings have maximum number of unique
# characters, return the one which comes first in lexicographical order.
# >>> find_max.call(["name", "of", "string"])
# "string"
# >>> find_max.call(["name", "enam", "game"])
# "enam"
# >>> find_max.call(["aaaaaaa", "bb", "cc"])
# "aaaaaaa"
def find_max(words)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_find_max
    candidate = method(:find_max)
    assert_equal("string", candidate.call(["name", "of", "string"]))
    assert_equal("enam", candidate.call(["name", "enam", "game"]))
    assert_equal("aaaaaaa", candidate.call(["aaaaaaa", "bb", "cc"]))
    assert_equal("abc", candidate.call(["abc", "cba"]))
    assert_equal("footbott", candidate.call(["play", "this", "game", "of", "footbott"]))
    assert_equal("gonna", candidate.call(["we", "are", "gonna", "rock"]))
    assert_equal("nation", candidate.call(["we", "are", "a", "mad", "nation"]))
    assert_equal("this", candidate.call(["this", "is", "a", "prrk"]))
    assert_equal("b", candidate.call(["b"]))
    assert_equal("play", candidate.call(["play", "play", "play"]))
  end
end


Prompt:
# Given a string 'text', return its md5 hash equivalent string.
# If 'text' is an empty string, return nil.
# >>> string_to_md5.call("Hello world")
# "3e25960a79dbc69b674cd4ec67a72c62"
def string_to_md5(text)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_string_to_md5
    candidate = method(:string_to_md5)
    assert_equal("3e25960a79dbc69b674cd4ec67a72c62", candidate.call("Hello world"))
    assert_equal(nil, candidate.call(""))
    assert_equal("0ef78513b0cb8cef12743f5aeb35f888", candidate.call("A B C"))
    assert_equal("5f4dcc3b5aa765d61d8327deb882cf99", candidate.call("password"))
  end
end


Prompt:
# Change numerical base of input number x to base.
# return string representation after the conversion.
# base numbers are less than 10.
# >>> change_base.call(8, 3)
# "22"
# >>> change_base.call(8, 2)
# "1000"
# >>> change_base.call(7, 2)
# "111"
def change_base(x, base)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_change_base
    candidate = method(:change_base)
    assert_equal("22", candidate.call(8, 3))
    assert_equal("100", candidate.call(9, 3))
    assert_equal("11101010", candidate.call(234, 2))
    assert_equal("10000", candidate.call(16, 2))
    assert_equal("1000", candidate.call(8, 2))
    assert_equal("111", candidate.call(7, 2))
    assert_equal("2", candidate.call(2, 3))
    assert_equal("3", candidate.call(3, 4))
    assert_equal("4", candidate.call(4, 5))
    assert_equal("5", candidate.call(5, 6))
    assert_equal("6", candidate.call(6, 7))
    assert_equal("7", candidate.call(7, 8))
  end
end


Prompt:
# Given the lengths of the three sides of a triangle. Return true if the three
# sides form a right-angled triangle, false otherwise.
# A right-angled triangle is a triangle in which one angle is right angle or
# 90 degree.
# Example:
# >>> right_angle_triangle.call(3, 4, 5)
# true
# >>> right_angle_triangle.call(1, 2, 3)
# false
def right_angle_triangle(a, b, c)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_right_angle_triangle
    candidate = method(:right_angle_triangle)
    assert_equal(true, candidate.call(3, 4, 5))
    assert_equal(false, candidate.call(1, 2, 3))
    assert_equal(true, candidate.call(10, 6, 8))
    assert_equal(false, candidate.call(2, 2, 2))
    assert_equal(true, candidate.call(7, 24, 25))
    assert_equal(false, candidate.call(10, 5, 7))
    assert_equal(true, candidate.call(5, 12, 13))
    assert_equal(true, candidate.call(15, 8, 17))
    assert_equal(true, candidate.call(48, 55, 73))
    assert_equal(false, candidate.call(1, 1, 1))
    assert_equal(false, candidate.call(2, 2, 10))
  end
end


Prompt:
# It is the last week of the semester and the teacher has to give the grades
# to students. The teacher has been making her own algorithm for grading.
# The only problem is, she has lost the code she used for grading.
# She has given you an array of GPAs for some students and you have to write
# a function that can output an array of letter grades using the following table:
# GPA       |    Letter grade
# 4.0                A+
# > 3.7                A
# > 3.3                A-
# > 3.0                B+
# > 2.7                B
# > 2.3                B-
# > 2.0                C+
# > 1.7                C
# > 1.3                C-
# > 1.0                D+
# > 0.7                D
# > 0.0                D-
# 0.0                E
# Example:
# >>> grade_equation.call([4.0, 3, 1.7, 2, 3.5])
# ["A+", "B", "C-", "C", "A-"]
def numerical_letter_grade(grades)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_numerical_letter_grade
    candidate = method(:numerical_letter_grade)
    assert_equal(["A+", "B", "C-", "C", "A-"], candidate.call([4.0, 3, 1.7, 2, 3.5]))
    assert_equal(["D+"], candidate.call([1.2]))
    assert_equal(["D-"], candidate.call([0.5]))
    assert_equal(["E"], candidate.call([0.0]))
    assert_equal(["D", "D-", "C-", "B", "B+"], candidate.call([1.0, 0.3, 1.5, 2.8, 3.3]))
    assert_equal(["E", "D-"], candidate.call([0.0, 0.7]))
  end
end


Prompt:
# Insert a number 'delimeter' between every two consecutive elements of input array `numbers'
# >>> intersperse.call([], 4)
# []
# >>> intersperse.call([1, 2, 3], 4)
# [1, 4, 2, 4, 3]
def intersperse(numbers, delimeter)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_intersperse
    candidate = method(:intersperse)
    assert_equal([], candidate.call([], 7))
    assert_equal([5, 8, 6, 8, 3, 8, 2], candidate.call([5, 6, 3, 2], 8))
    assert_equal([2, 2, 2, 2, 2], candidate.call([2, 2, 2], 2))
  end
end


Prompt:
# Write a function that takes an array of numbers as input and returns
# the number of elements in the array that are greater than 10 and both
# first and last digits of a number are odd (1, 3, 5, 7, 9).
# For example:
# >>> specialFilter.call([15, -73, 14, -15])
# 1
# >>> specialFilter.call([33, -2, -3, 45, 21, 109])
# 2
def specialFilter(nums)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_specialFilter
    candidate = method(:specialFilter)
    assert_equal(0, candidate.call([5, -2, 1, -5]))
    assert_equal(1, candidate.call([15, -73, 14, -15]))
    assert_equal(2, candidate.call([33, -2, -3, 45, 21, 109]))
    assert_equal(4, candidate.call([43, -12, 93, 125, 121, 109]))
    assert_equal(3, candidate.call([71, -2, -33, 75, 21, 19]))
    assert_equal(0, candidate.call([1]))
    assert_equal(0, candidate.call([]))
  end
end


Prompt:
# sum_to_n is a function that sums numbers from 1 to n.
# >>> sum_to_n.call(30)
# 465
# >>> sum_to_n.call(100)
# 5050
# >>> sum_to_n.call(5)
# 15
# >>> sum_to_n.call(10)
# 55
# >>> sum_to_n.call(1)
# 1
def sum_to_n(n)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_sum_to_n
    candidate = method(:sum_to_n)
    assert_equal(1, candidate.call(1))
    assert_equal(21, candidate.call(6))
    assert_equal(66, candidate.call(11))
    assert_equal(465, candidate.call(30))
    assert_equal(5050, candidate.call(100))
  end
end


Prompt:
# From an array of integers, remove all elements that occur more than once.
# Keep order of elements left the same as in the input.
# >>> remove_duplicates.call([1, 2, 3, 2, 4])
# [1, 3, 4]
def remove_duplicates(numbers)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_remove_duplicates
    candidate = method(:remove_duplicates)
    assert_equal([], candidate.call([]))
    assert_equal([1, 2, 3, 4], candidate.call([1, 2, 3, 4]))
    assert_equal([1, 4, 5], candidate.call([1, 2, 3, 2, 4, 3, 5]))
  end
end


Prompt:
# Given two positive integers a and b, return the even digits between a
# and b, in ascending order.
# For example:
# >>> generate_integers.call(2, 8)
# [2, 4, 6, 8]
# >>> generate_integers.call(8, 2)
# [2, 4, 6, 8]
# >>> generate_integers.call(10, 14)
# []
def generate_integers(a, b)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_generate_integers
    candidate = method(:generate_integers)
    assert_equal([2, 4, 6, 8], candidate.call(2, 10))
    assert_equal([2, 4, 6, 8], candidate.call(10, 2))
    assert_equal([2, 4, 6, 8], candidate.call(132, 2))
    assert_equal([], candidate.call(17, 89))
  end
end


Prompt:
# From a given array of integers, generate an array of rolling maximum element found until given moment
# in the sequence.
# >>> rolling_max.call([1, 2, 3, 2, 3, 4, 2])
# [1, 2, 3, 3, 3, 4, 4]
def rolling_max(numbers)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_rolling_max
    candidate = method(:rolling_max)
    assert_equal([], candidate.call([]))
    assert_equal([1, 2, 3, 4], candidate.call([1, 2, 3, 4]))
    assert_equal([4, 4, 4, 4], candidate.call([4, 3, 2, 1]))
    assert_equal([3, 3, 3, 100, 100], candidate.call([3, 2, 3, 100, 3]))
  end
end


Prompt:
# You're given an array of deposit and withdrawal operations on a bank account that starts with
# zero balance. Your task is to detect if at any point the balance of account fallls below zero, and
# at that point function should return true. Otherwise it should return false.
# >>> below_zero.call([1, 2, 3])
# false
# >>> below_zero.call([1, 2, -4, 5])
# true
def below_zero(operations)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_below_zero
    candidate = method(:below_zero)
    assert_equal(false, candidate.call([]))
    assert_equal(false, candidate.call([1, 2, -3, 1, 2, -3]))
    assert_equal(true, candidate.call([1, 2, -4, 5, 6]))
    assert_equal(false, candidate.call([1, -1, 2, -2, 5, -5, 4, -4]))
    assert_equal(true, candidate.call([1, -1, 2, -2, 5, -5, 4, -5]))
    assert_equal(true, candidate.call([1, -2, 2, -2, 5, -5, 4, -4]))
  end
end


Prompt:
# You are given a non-empty array of positive integers. Return the greatest integer that is greater than
# zero, and has a frequency greater than or equal to the value of the integer itself.
# The frequency of an integer is the number of times it appears in the array.
# If no such a value exist, return -1.
# Examples:
# >>> search.call([4, 1, 2, 2, 3, 1])
# 2
# >>> search.call([1, 2, 2, 3, 3, 3, 4, 4, 4])
# 3
# >>> search.call([5, 5, 4, 4, 4])
# -1
def search(lst)


Prompt:
# brackets is a string of "(" and ")".
# return true if every opening bracket has a corresponding closing bracket.
# >>> correct_bracketing.call("(")
# false
# >>> correct_bracketing.call("()")
# true
# >>> correct_bracketing.call("(()())")
# true
# >>> correct_bracketing.call(")(()")
# false
def correct_bracketing(brackets)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_correct_bracketing
    candidate = method(:correct_bracketing)
    assert_equal(true, candidate.call("()"))
    assert_equal(true, candidate.call("(()())"))
    assert_equal(true, candidate.call("()()(()())()"))
    assert_equal(true, candidate.call("()()((()()())())(()()(()))"))
    assert_equal(false, candidate.call("((()())))"))
    assert_equal(false, candidate.call(")(()"))
    assert_equal(false, candidate.call("("))
    assert_equal(false, candidate.call("(((("))
    assert_equal(false, candidate.call(")"))
    assert_equal(false, candidate.call("(()"))
    assert_equal(false, candidate.call("()()(()())())(()"))
    assert_equal(false, candidate.call("()()(()())()))()"))
  end
end


Prompt:
# This function takes an array l and returns an array l' such that
# l' is identical to l in the odd indicies, while its values at the even indicies are equal
# to the values of the even indicies of l, but sorted.
# >>> sort_even.call([1, 2, 3])
# [1, 2, 3]
# >>> sort_even.call([5, 6, 3, 4])
# [3, 6, 5, 4]
def sort_even(l)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_sort_even
    candidate = method(:sort_even)
    assert_equal([1, 2, 3], candidate.call([1, 2, 3]))
    assert_equal([-10, 3, -5, 2, -3, 3, 5, 0, 9, 1, 123], candidate.call([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]))
    assert_equal([-12, 8, 3, 4, 5, 2, 12, 11, 23, -10], candidate.call([5, 8, -12, 4, 23, 2, 3, 11, 12, -10]))
  end
end


Prompt:
# Check if two words have the same characters.
# >>> same_chars.call("eabcdzzzz", "dddzzzzzzzddeddabc")
# true
# >>> same_chars.call("abcd", "dddddddabc")
# true
# >>> same_chars.call("dddddddabc", "abcd")
# true
# >>> same_chars.call("eabcd", "dddddddabc")
# false
# >>> same_chars.call("abcd", "dddddddabce")
# false
# >>> same_chars.call("eabcdzzzz", "dddzzzzzzzddddabc")
# false
def same_chars(s0, s1)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_same_chars
    candidate = method(:same_chars)
    assert_equal(true, candidate.call("eabcdzzzz", "dddzzzzzzzddeddabc"))
    assert_equal(true, candidate.call("abcd", "dddddddabc"))
    assert_equal(true, candidate.call("dddddddabc", "abcd"))
    assert_equal(false, candidate.call("eabcd", "dddddddabc"))
    assert_equal(false, candidate.call("abcd", "dddddddabcf"))
    assert_equal(false, candidate.call("eabcdzzzz", "dddzzzzzzzddddabc"))
    assert_equal(false, candidate.call("aabb", "aaccc"))
  end
end


Prompt:
# brackets is a string of "<" and ">".
# return true if every opening bracket has a corresponding closing bracket.
# >>> correct_bracketing.call("<")
# false
# >>> correct_bracketing.call("<>")
# true
# >>> correct_bracketing.call("<<><>>")
# true
# >>> correct_bracketing.call("><<>")
# false
def correct_bracketing(brackets)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_correct_bracketing
    candidate = method(:correct_bracketing)
    assert_equal(true, candidate.call("<>"))
    assert_equal(true, candidate.call("<<><>>"))
    assert_equal(true, candidate.call("<><><<><>><>"))
    assert_equal(true, candidate.call("<><><<<><><>><>><<><><<>>>"))
    assert_equal(false, candidate.call("<<<><>>>>"))
    assert_equal(false, candidate.call("><<>"))
    assert_equal(false, candidate.call("<"))
    assert_equal(false, candidate.call("<<<<"))
    assert_equal(false, candidate.call(">"))
    assert_equal(false, candidate.call("<<>"))
    assert_equal(false, candidate.call("<><><<><>><>><<>"))
    assert_equal(false, candidate.call("<><><<><>><>>><>"))
  end
end