Prompt:
# Return length of given string
# >>> strlen.call("")
# 0
# >>> strlen.call("abc")
# 3
def strlen(string)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_strlen
    candidate = method(:strlen)
    assert_equal(0, candidate.call(""))
    assert_equal(1, candidate.call("x"))
    assert_equal(9, candidate.call("asdasnakj"))
  end
end


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.call("hi")
# "lm"
# >>> encrypt.call("asdfghjkl")
# "ewhjklnop"
# >>> encrypt.call("gf")
# "kj"
# >>> encrypt.call("et")
# "ix"
def encrypt(s)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_encrypt
    candidate = method(:encrypt)
    assert_equal("lm", candidate.call("hi"))
    assert_equal("ewhjklnop", candidate.call("asdfghjkl"))
    assert_equal("kj", candidate.call("gf"))
    assert_equal("ix", candidate.call("et"))
    assert_equal("jeiajeaijeiak", candidate.call("faewfawefaewg"))
    assert_equal("lippsqcjvmirh", candidate.call("hellomyfriend"))
    assert_equal("hbdhpqrmpjylqmpyjlpmlyjrqpmqryjlpmqryjljygyjl", candidate.call("dxzdlmnilfuhmilufhlihufnmlimnufhlimnufhfucufh"))
    assert_equal("e", candidate.call("a"))
  end
end


Prompt:
# Given a hash, return true if all keys are strings in lower
# case or all keys are strings in upper case, else return false.
# The function should return false is the given hash is empty.
# Examples:
# >>> check_dict_case.call({"a" => "apple", "b" => "banana"})
# true
# >>> check_dict_case.call({"a" => "apple", "A" => "banana", "B" => "banana"})
# false
# >>> check_dict_case.call({"a" => "apple", 8 => "banana", "a" => "apple"})
# false
# >>> check_dict_case.call({"Name" => "John", "Age" => "36", "City" => "Houston"})
# false
# >>> check_dict_case.call({"STATE" => "NC", "ZIP" => "12345"})
# true
def check_dict_case(dict)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_check_dict_case
    candidate = method(:check_dict_case)
    assert_equal(true, candidate.call({"p" => "pineapple", "b" => "banana"}))
    assert_equal(false, candidate.call({"p" => "pineapple", "A" => "banana", "B" => "banana"}))
    assert_equal(false, candidate.call({"p" => "pineapple", "5" => "banana", "a" => "apple"}))
    assert_equal(false, candidate.call({"Name" => "John", "Age" => "36", "City" => "Houston"}))
    assert_equal(true, candidate.call({"STATE" => "NC", "ZIP" => "12345"}))
    assert_equal(true, candidate.call({"fruit" => "Orange", "taste" => "Sweet"}))
    assert_equal(false, candidate.call({}))
  end
end


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

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_add
    candidate = method(:add)
    assert_equal(88, candidate.call([4, 88]))
    assert_equal(122, candidate.call([4, 5, 6, 7, 2, 122]))
    assert_equal(0, candidate.call([4, 0, 6, 7]))
    assert_equal(12, candidate.call([4, 4, 6, 8]))
  end
end


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.call(" Example")
# "Example"
# >>> fix_spaces.call(" Example 1")
# "Example_1"
# >>> fix_spaces.call(" Example 2")
# "_Example_2"
# >>> fix_spaces.call(" Example 3")
# "_Example-3"
def fix_spaces(text)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_fix_spaces
    candidate = method(:fix_spaces)
    assert_equal("Example", candidate.call("Example"))
    assert_equal("Mudasir_Hanif_", candidate.call("Mudasir Hanif "))
    assert_equal("Yellow_Yellow__Dirty__Fellow", candidate.call("Yellow Yellow  Dirty  Fellow"))
    assert_equal("Exa-mple", candidate.call("Exa   mple"))
    assert_equal("-Exa_1_2_2_mple", candidate.call("   Exa 1 2 2 mple"))
  end
end


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.call(1)
# 0
# >>> fibfib.call(5)
# 4
# >>> fibfib.call(8)
# 24
def fibfib(n)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_fibfib
    candidate = method(:fibfib)
    assert_equal(1, candidate.call(2))
    assert_equal(0, candidate.call(1))
    assert_equal(4, candidate.call(5))
    assert_equal(24, candidate.call(8))
    assert_equal(81, candidate.call(10))
    assert_equal(274, candidate.call(12))
    assert_equal(927, candidate.call(14))
  end
end


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.call([1, 3, 2, 0])
# 10
# >>> double_the_difference.call([-1, -2, 0])
# 0
# >>> double_the_difference.call([9, -2])
# 81
# >>> double_the_difference.call([0])
# 0
# If the input array is empty, return 0.
def double_the_difference(lst)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_double_the_difference
    candidate = method(:double_the_difference)
    assert_equal(0, candidate.call([]))
    assert_equal(25, candidate.call([5.0, 4.0]))
    assert_equal(0, candidate.call([0.1, 0.2, 0.3]))
    assert_equal(0, candidate.call([-10.0, -20.0, -30.0]))
    assert_equal(0, candidate.call([-1.0, -2.0, 8.0]))
    assert_equal(34, candidate.call([0.2, 3.0, 5.0]))
    assert_equal(165, candidate.call([-9.0, -7.0, -5.0, -3.0, -1.0, 1.0, 3.0, 5.0, 7.0, 9.0]))
  end
end


Prompt:
# Filter given array of any rbthon values only for integers
# >>> filter_integers.call(["a", 3.14, 5])
# [5]
# >>> filter_integers.call([1, 2, 3, "abc", {}, []])
# [1, 2, 3]
def filter_integers(values)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_filter_integers
    candidate = method(:filter_integers)
    assert_equal([], candidate.call([]))
    assert_equal([4, 9], candidate.call([4, {}, [], 23.2, 9, "adasd"]))
    assert_equal([3, 3, 3], candidate.call([3, "c", 3, 3, "a", "b"]))
  end
end


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.
def car_race_collision(n)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_car_race_collision
    candidate = method(:car_race_collision)
    assert_equal(4, candidate.call(2))
    assert_equal(9, candidate.call(3))
    assert_equal(16, candidate.call(4))
    assert_equal(64, candidate.call(8))
    assert_equal(100, candidate.call(10))
  end
end


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.call("o o| .| o| o| .| .| .| .| o o")
# [4, 2, 1, 2, 2, 1, 1, 1, 1, 4, 4]
def parse_music(music_string)

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


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.call(15)
# "db1111db"
# >>> decimal_to_binary.call(32)
# "db100000db"
def decimal_to_binary(decimal)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_decimal_to_binary
    candidate = method(:decimal_to_binary)
    assert_equal("db0db", candidate.call(0))
    assert_equal("db100000db", candidate.call(32))
    assert_equal("db1100111db", candidate.call(103))
    assert_equal("db1111db", candidate.call(15))
  end
end


Prompt:
# Return array of all prefixes from shortest to longest of the input string
# >>> all_prefixes.call("abc")
# ["a", "ab", "abc"]
def all_prefixes(string)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_all_prefixes
    candidate = method(:all_prefixes)
    assert_equal([], candidate.call(""))
    assert_equal(["a", "as", "asd", "asdf", "asdfg", "asdfgh"], candidate.call("asdfgh"))
    assert_equal(["W", "WW", "WWW"], candidate.call("WWW"))
  end
end


Prompt:
# Add two numbers x and y
# >>> add.call(2, 3)
# 5
# >>> add.call(5, 7)
# 12
def add(x, y)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_add
    candidate = method(:add)
    assert_equal(1, candidate.call(0, 1))
    assert_equal(1, candidate.call(1, 0))
    assert_equal(5, candidate.call(2, 3))
    assert_equal(12, candidate.call(5, 7))
    assert_equal(12, candidate.call(7, 5))
  end
end


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.call(5, 6, 10)
# [11, 4]
# >>> eat.call(4, 8, 9)
# [12, 1]
# >>> eat.call(1, 10, 10)
# [11, 0]
# >>> eat.call(2, 11, 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 :)
def eat(number, need, remaining)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_eat
    candidate = method(:eat)
    assert_equal([11, 4], candidate.call(5, 6, 10))
    assert_equal([12, 1], candidate.call(4, 8, 9))
    assert_equal([11, 0], candidate.call(1, 10, 10))
    assert_equal([7, 0], candidate.call(2, 11, 5))
    assert_equal([9, 2], candidate.call(4, 5, 7))
    assert_equal([5, 0], candidate.call(4, 5, 1))
  end
end


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.call([[0, 0, 1, 0], [0, 1, 0, 0], [1, 1, 1, 1]], 1)
# 6
# Example 2:
# >>> max_fill.call([[0, 0, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1], [0, 1, 1, 1]], 2)
# 5
# Example 3:
# >>> max_fill.call([[0, 0, 0], [0, 0, 0]], 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
def max_fill(grid, capacity)

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


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.
def do_algebra(operator, operand)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_do_algebra
    candidate = method(:do_algebra)
    assert_equal(37, candidate.call(["**", "*", "+"], [2, 3, 4, 5]))
    assert_equal(9, candidate.call(["+", "*", "-"], [2, 3, 4, 5]))
    assert_equal(8, candidate.call(["//", "*"], [7, 3, 4]))
  end
end


Prompt:
# For a given string, flip lowercase characters to uppercase and uppercase to lowercase.
# >>> flip_case.call("Hello")
# "hELLO"
def flip_case(string)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_flip_case
    candidate = method(:flip_case)
    assert_equal("", candidate.call(""))
    assert_equal("hELLO!", candidate.call("Hello!"))
    assert_equal("tHESE VIOLENT DELIGHTS HAVE VIOLENT ENDS", candidate.call("These violent delights have violent ends"))
  end
end


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.call([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.call([])
# []
# If the array has any strange number ignore it:
# >>> by_length.call([1, -1, 55])
# ["One"]
def by_length(arr)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_by_length
    candidate = method(:by_length)
    assert_equal(["Eight", "Five", "Four", "Three", "Two", "Two", "One", "One"], candidate.call([2, 1, 1, 4, 5, 8, 2, 3]))
    assert_equal([], candidate.call([]))
    assert_equal(["One"], candidate.call([1, -1, 55]))
    assert_equal(["Three", "Two", "One"], candidate.call([1, -1, 3, 2]))
    assert_equal(["Nine", "Eight", "Four"], candidate.call([9, 4, 8]))
  end
end


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.call(8)
# [2, 2, 2]
# >>> factorize.call(25)
# [5, 5]
# >>> factorize.call(70)
# [2, 5, 7]
def factorize(n)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_factorize
    candidate = method(:factorize)
    assert_equal([2], candidate.call(2))
    assert_equal([2, 2], candidate.call(4))
    assert_equal([2, 2, 2], candidate.call(8))
    assert_equal([3, 19], candidate.call(57))
    assert_equal([3, 3, 19, 19], candidate.call(3249))
    assert_equal([3, 3, 3, 19, 19, 19], candidate.call(185193))
    assert_equal([3, 19, 19, 19], candidate.call(20577))
    assert_equal([2, 3, 3], candidate.call(18))
  end
end


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.call(5)
# [2, 3]
# >>> count_up_to.call(11)
# [2, 3, 5, 7]
# >>> count_up_to.call(0)
# []
# >>> count_up_to.call(20)
# [2, 3, 5, 7, 11, 13, 17, 19]
# >>> count_up_to.call(1)
# []
# >>> count_up_to.call(18)
# [2, 3, 5, 7, 11, 13, 17]
def count_up_to(n)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_count_up_to
    candidate = method(:count_up_to)
    assert_equal([2, 3], candidate.call(5))
    assert_equal([2, 3, 5], candidate.call(6))
    assert_equal([2, 3, 5], candidate.call(7))
    assert_equal([2, 3, 5, 7], candidate.call(10))
    assert_equal([], candidate.call(0))
    assert_equal([2, 3, 5, 7, 11, 13, 17, 19], candidate.call(22))
    assert_equal([], candidate.call(1))
    assert_equal([2, 3, 5, 7, 11, 13, 17], candidate.call(18))
    assert_equal([2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43], candidate.call(47))
    assert_equal([2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97], candidate.call(101))
  end
end


Prompt:
# Return sorted unique elements in an array
# >>> unique.call([5, 3, 5, 2, 3, 3, 9, 0, 123])
# [0, 2, 3, 5, 9, 123]
def unique(l)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_unique
    candidate = method(:unique)
    assert_equal([0, 2, 3, 5, 9, 123], candidate.call([5, 3, 5, 2, 3, 3, 9, 0, 123]))
  end
end


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.call([], [])
# []
# >>> total_match.call(["hi", "admin"], ["hI", "Hi"])
# ["hI", "Hi"]
# >>> total_match.call(["hi", "admin"], ["hi", "hi", "admin", "project"])
# ["hi", "admin"]
# >>> total_match.call(["hi", "admin"], ["hI", "hi", "hi"])
# ["hI", "hi", "hi"]
# >>> total_match.call(["4"], ["1", "2", "3", "4", "5"])
# ["4"]
def total_match(lst1, lst2)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_total_match
    candidate = method(:total_match)
    assert_equal([], candidate.call([], []))
    assert_equal(["hi", "hi"], candidate.call(["hi", "admin"], ["hi", "hi"]))
    assert_equal(["hi", "admin"], candidate.call(["hi", "admin"], ["hi", "hi", "admin", "project"]))
    assert_equal(["4"], candidate.call(["4"], ["1", "2", "3", "4", "5"]))
    assert_equal(["hI", "Hi"], candidate.call(["hi", "admin"], ["hI", "Hi"]))
    assert_equal(["hI", "hi", "hi"], candidate.call(["hi", "admin"], ["hI", "hi", "hi"]))
    assert_equal(["hi", "admin"], candidate.call(["hi", "admin"], ["hI", "hi", "hii"]))
    assert_equal([], candidate.call([], ["this"]))
    assert_equal([], candidate.call(["this"], []))
  end
end


Prompt:
# Return maximum element in the array.
# >>> max_element.call([1, 2, 3])
# 3
# >>> max_element.call([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])
# 123
def max_element(l)

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


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.call("[[]]")
# true
# >>> is_nested.call("[]]]]]]][[[[[]")
# false
# >>> is_nested.call("[][]")
# false
# >>> is_nested.call("[]")
# false
# >>> is_nested.call("[[][]]")
# true
# >>> is_nested.call("[[]][[")
# true
def is_nested(string)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_is_nested
    candidate = method(:is_nested)
    assert_equal(true, candidate.call("[[]]"))
    assert_equal(false, candidate.call("[]]]]]]][[[[[]"))
    assert_equal(false, candidate.call("[][]"))
    assert_equal(false, candidate.call("[]"))
    assert_equal(true, candidate.call("[[[[]]]]"))
    assert_equal(false, candidate.call("[]]]]]]]]]]"))
    assert_equal(true, candidate.call("[][][[]]"))
    assert_equal(false, candidate.call("[[]"))
    assert_equal(false, 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("]]]]]]]]"))
  end
end


Prompt:
# 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.call(1, 5)
# "0b11"
# >>> rounded_avg.call(7, 5)
# -1
# >>> rounded_avg.call(10, 20)
# "0b1111"
# >>> rounded_avg.call(20, 33)
# "0b11010"
def rounded_avg(n, m)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_rounded_avg
    candidate = method(:rounded_avg)
    assert_equal("0b11", candidate.call(1, 5))
    assert_equal("0b1010", candidate.call(7, 13))
    assert_equal("0b1111001010", candidate.call(964, 977))
    assert_equal("0b1111100100", candidate.call(996, 997))
    assert_equal("0b1011000010", candidate.call(560, 851))
    assert_equal("0b101101110", candidate.call(185, 546))
    assert_equal("0b110101101", candidate.call(362, 496))
    assert_equal("0b1001110010", candidate.call(350, 902))
    assert_equal("0b11010111", candidate.call(197, 233))
    assert_equal(-1, candidate.call(7, 5))
    assert_equal(-1, candidate.call(5, 1))
    assert_equal("0b101", candidate.call(5, 5))
  end
end


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.call(["1234567"])
# ["the number of odd elements 4n the str4ng 4 of the 4nput."]
# >>> odd_count.call(["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."]
def odd_count(lst)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_odd_count
    candidate = method(:odd_count)
    assert_equal(["the number of odd elements 4n the str4ng 4 of the 4nput."], candidate.call(["1234567"]))
    assert_equal(["the number of odd elements 1n the str1ng 1 of the 1nput.", "the number of odd elements 8n the str8ng 8 of the 8nput."], candidate.call(["3", "11111111"]))
    assert_equal(["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."], candidate.call(["271", "137", "314"]))
  end
end


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.call([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.call([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.
def move_one_ball(arr)

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


Prompt:
# Given a positive integer n, return an array that has the number of even and odd
# integer palindromes that fall within the range(1, n), inclusive.
# Example 1:
# >>> even_odd_palindrome.call(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.call(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 array has the number of even and odd integer palindromes respectively.
def even_odd_palindrome(n)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_even_odd_palindrome
    candidate = method(:even_odd_palindrome)
    assert_equal([8, 13], candidate.call(123))
    assert_equal([4, 6], candidate.call(12))
    assert_equal([1, 2], candidate.call(3))
    assert_equal([6, 8], candidate.call(63))
    assert_equal([5, 6], candidate.call(25))
    assert_equal([4, 6], candidate.call(19))
    assert_equal([4, 5], candidate.call(9))
    assert_equal([0, 1], candidate.call(1))
  end
end


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.call(4)
# false
# >>> is_equal_to_sum_even.call(6)
# false
# >>> is_equal_to_sum_even.call(8)
# true
def is_equal_to_sum_even(n)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_is_equal_to_sum_even
    candidate = method(:is_equal_to_sum_even)
    assert_equal(false, candidate.call(4))
    assert_equal(false, candidate.call(6))
    assert_equal(true, candidate.call(8))
    assert_equal(true, candidate.call(10))
    assert_equal(false, candidate.call(11))
    assert_equal(true, candidate.call(12))
    assert_equal(false, candidate.call(13))
    assert_equal(true, candidate.call(16))
  end
end


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.call([3, 1, 2, 4, 5])
# [1, 4, 12, 20]
# >>> derivative.call([1, 2, 3])
# [2, 6]
def derivative(xs)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_derivative
    candidate = method(:derivative)
    assert_equal([1, 4, 12, 20], candidate.call([3, 1, 2, 4, 5]))
    assert_equal([2, 6], candidate.call([1, 2, 3]))
    assert_equal([2, 2], candidate.call([3, 2, 1]))
    assert_equal([2, 2, 0, 16], candidate.call([3, 2, 1, 0, 4]))
    assert_equal([], candidate.call([1]))
  end
end


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.call([5])
# true
# >>> is_sorted.call([1, 2, 3, 4, 5])
# true
# >>> is_sorted.call([1, 3, 2, 4, 5])
# false
# >>> is_sorted.call([1, 2, 3, 4, 5, 6])
# true
# >>> is_sorted.call([1, 2, 3, 4, 5, 6, 7])
# true
# >>> is_sorted.call([1, 3, 2, 4, 5, 6, 7])
# false
# >>> is_sorted.call([1, 2, 2, 3, 3, 4])
# true
# >>> is_sorted.call([1, 2, 2, 2, 3, 4])
# false
def is_sorted(lst)

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


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.call("1234")
# "4321"
# >>> solve.call("ab")
# "AB"
# >>> solve.call("#a@C")
# "#A@c"
def solve(s)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_solve
    candidate = method(:solve)
    assert_equal("aSdF", candidate.call("AsDf"))
    assert_equal("4321", candidate.call("1234"))
    assert_equal("AB", candidate.call("ab"))
    assert_equal("#A@c", candidate.call("#a@C"))
    assert_equal("#aSDFw^45", candidate.call("#AsdfW^45"))
    assert_equal("2@6#", candidate.call("#6@2"))
    assert_equal("#$A^d", candidate.call("#$a^D"))
    assert_equal("#CCC", candidate.call("#ccc"))
  end
end


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.call(3)
# [1, 3, 2, 8]
def tri(n)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_tri
    candidate = method(:tri)
    assert_equal([1, 3, 2, 8], candidate.call(3))
    assert_equal([1, 3, 2, 8, 3], candidate.call(4))
    assert_equal([1, 3, 2, 8, 3, 15], candidate.call(5))
    assert_equal([1, 3, 2, 8, 3, 15, 4], candidate.call(6))
    assert_equal([1, 3, 2, 8, 3, 15, 4, 24], candidate.call(7))
    assert_equal([1, 3, 2, 8, 3, 15, 4, 24, 5], candidate.call(8))
    assert_equal([1, 3, 2, 8, 3, 15, 4, 24, 5, 35], candidate.call(9))
    assert_equal([1, 3, 2, 8, 3, 15, 4, 24, 5, 35, 6, 48, 7, 63, 8, 80, 9, 99, 10, 120, 11], candidate.call(20))
    assert_equal([1], candidate.call(0))
    assert_equal([1, 3], candidate.call(1))
  end
end


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

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_fizz_buzz
    candidate = method(:fizz_buzz)
    assert_equal(0, candidate.call(50))
    assert_equal(2, candidate.call(78))
    assert_equal(3, candidate.call(79))
    assert_equal(3, candidate.call(100))
    assert_equal(6, candidate.call(200))
    assert_equal(192, candidate.call(4000))
    assert_equal(639, candidate.call(10000))
    assert_equal(8026, candidate.call(100000))
  end
end


Prompt:
# Filter an input array of strings only for ones that start with a given prefix.
# >>> filter_by_prefix.call([], "a")
# []
# >>> filter_by_prefix.call(["abc", "bcd", "cde", "array"], "a")
# ["abc", "array"]
def filter_by_prefix(strings, prefix)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_filter_by_prefix
    candidate = method(:filter_by_prefix)
    assert_equal([], candidate.call([], "john"))
    assert_equal(["xxx", "xxxAAA", "xxx"], candidate.call(["xxx", "asd", "xxy", "john doe", "xxxAAA", "xxx"], "xxx"))
  end
end


Prompt:
# Given a positive integer N, return the total sum of its digits in binary.
# Example
# >>> solve.call(1000)
# "1"
# >>> solve.call(150)
# "110"
# >>> solve.call(147)
# "1100"
# Variables:
# @N integer
# Constraints: 0 ≤ N ≤ 10000.
# Output:
# a string of binary number
def solve(n)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_solve
    candidate = method(:solve)
    assert_equal("1", candidate.call(1000))
    assert_equal("110", candidate.call(150))
    assert_equal("1100", candidate.call(147))
    assert_equal("1001", candidate.call(333))
    assert_equal("10010", candidate.call(963))
  end
end


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.call([[1, 2, 3], [4, 5, 6], [7, 8, 9]], 3)
# [1, 2, 1]
# >>> minPath.call([[5, 9, 3], [4, 1, 6], [7, 8, 2]], 1)
# [1]
def minPath(grid, k)


Prompt:
# Given a string s, count the number of uppercase vowels in even indices.
# For example:
# >>> count_upper.call("aBCdEf")
# 1
# >>> count_upper.call("abcdefg")
# 0
# >>> count_upper.call("dBBE")
# 0
def count_upper(s)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_count_upper
    candidate = method(:count_upper)
    assert_equal(1, candidate.call("aBCdEf"))
    assert_equal(0, candidate.call("abcdefg"))
    assert_equal(0, candidate.call("dBBE"))
    assert_equal(0, candidate.call("B"))
    assert_equal(1, candidate.call("U"))
    assert_equal(0, candidate.call(""))
    assert_equal(2, candidate.call("EEEE"))
  end
end


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.call([-3, -4, 5], 3)
# [-4, -3, 5]
# Example 2:
# >>> maximum.call([4, -4, 4], 2)
# [4, 4]
# Example 3:
# >>> maximum.call([-3, 2, 1, 2, -1, -2, 1], 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)
def maximum(arr, k)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_maximum
    candidate = method(:maximum)
    assert_equal([-4, -3, 5], candidate.call([-3, -4, 5], 3))
    assert_equal([4, 4], candidate.call([4, -4, 4], 2))
    assert_equal([2], candidate.call([-3, 2, 1, 2, -1, -2, 1], 1))
    assert_equal([2, 20, 123], candidate.call([123, -123, 20, 0, 1, 2, -3], 3))
    assert_equal([0, 1, 2, 20], candidate.call([-123, 20, 0, 1, 2, -3], 4))
    assert_equal([-13, -8, 0, 0, 3, 5, 15], candidate.call([5, 15, 0, 3, -13, -8, 0], 7))
    assert_equal([3, 5], candidate.call([-1, 0, 2, 5, 3, -10], 2))
    assert_equal([5], candidate.call([1, 0, 5, -7], 1))
    assert_equal([-4, 4], candidate.call([4, -4], 2))
    assert_equal([-10, 10], candidate.call([-10, 10], 2))
    assert_equal([], candidate.call([1, 2, 3, -23, 243, -400, 0], 0))
  end
end


Prompt:
# For a given number n, find the largest number that divides n evenly, smaller than n
# >>> largest_divisor.call(15)
# 5
def largest_divisor(n)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_largest_divisor
    candidate = method(:largest_divisor)
    assert_equal(1, candidate.call(3))
    assert_equal(1, candidate.call(7))
    assert_equal(5, candidate.call(10))
    assert_equal(50, candidate.call(100))
    assert_equal(7, candidate.call(49))
  end
end


Prompt:
# Given an array of non-negative integers, return a corb 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.call([])
# []
# >>> sort_array.call([5])
# [5]
# >>> sort_array.call([2, 4, 3, 0, 1, 5])
# [0, 1, 2, 3, 4, 5]
# >>> sort_array.call([2, 4, 3, 0, 1, 5, 6])
# [6, 5, 4, 3, 2, 1, 0]
def sort_array(array)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_sort_array
    candidate = method(:sort_array)
    assert_equal([], candidate.call([]))
    assert_equal([5], candidate.call([5]))
    assert_equal([0, 1, 2, 3, 4, 5], candidate.call([2, 4, 3, 0, 1, 5]))
    assert_equal([6, 5, 4, 3, 2, 1, 0], candidate.call([2, 4, 3, 0, 1, 5, 6]))
    assert_equal([1, 2], candidate.call([2, 1]))
    assert_equal([0, 11, 15, 32, 42, 87], candidate.call([15, 42, 87, 32, 11, 0]))
    assert_equal([23, 21, 14, 11], candidate.call([21, 14, 23, 11]))
  end
end


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.call(5)
# [1, 2, 6, 24, 15]
def f(n)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_f
    candidate = method(:f)
    assert_equal([1, 2, 6, 24, 15], candidate.call(5))
    assert_equal([1, 2, 6, 24, 15, 720, 28], candidate.call(7))
    assert_equal([1], candidate.call(1))
    assert_equal([1, 2, 6], candidate.call(3))
  end
end


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.call(1)
# true
# >>> iscube.call(2)
# false
# >>> iscube.call(-1)
# true
# >>> iscube.call(64)
# true
# >>> iscube.call(0)
# true
# >>> iscube.call(180)
# false
def iscube(a)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_iscube
    candidate = method(:iscube)
    assert_equal(true, candidate.call(1))
    assert_equal(false, candidate.call(2))
    assert_equal(true, candidate.call(-1))
    assert_equal(true, candidate.call(64))
    assert_equal(false, candidate.call(180))
    assert_equal(true, candidate.call(1000))
    assert_equal(true, candidate.call(0))
    assert_equal(false, candidate.call(1729))
  end
end


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.call("test")
# "TGST"
# >>> encode.call("This is a message")
# "tHKS KS C MGSSCGG"
def encode(message)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_encode
    candidate = method(:encode)
    assert_equal("tgst", candidate.call("TEST"))
    assert_equal("mWDCSKR", candidate.call("Mudasir"))
    assert_equal("ygs", candidate.call("YES"))
    assert_equal("tHKS KS C MGSSCGG", candidate.call("This is a message"))
    assert_equal("k dQnT kNqW wHcT Tq wRkTg", candidate.call("I DoNt KnOw WhAt tO WrItE"))
  end
end


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.call("Hello world")
# 0
# >>> is_bored.call("The sky is blue. The sun is shining. I love this weather")
# 1
def is_bored(s)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_is_bored
    candidate = method(:is_bored)
    assert_equal(0, candidate.call("Hello world"))
    assert_equal(0, candidate.call("Is the sky blue?"))
    assert_equal(1, candidate.call("I love It !"))
    assert_equal(0, candidate.call("bIt"))
    assert_equal(2, candidate.call("I feel good today. I will be productive. will kill It"))
    assert_equal(0, candidate.call("You and I are going for a walk"))
  end
end


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.call([1, 3, 5, 0])
# false
# >>> pairs_sum_to_zero.call([1, 3, -2, 1])
# false
# >>> pairs_sum_to_zero.call([1, 2, 3, 7])
# false
# >>> pairs_sum_to_zero.call([2, 4, -5, 3, 5, 7])
# true
# >>> pairs_sum_to_zero.call([1])
# false
def pairs_sum_to_zero(l)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_pairs_sum_to_zero
    candidate = method(:pairs_sum_to_zero)
    assert_equal(false, candidate.call([1, 3, 5, 0]))
    assert_equal(false, candidate.call([1, 3, -2, 1]))
    assert_equal(false, candidate.call([1, 2, 3, 7]))
    assert_equal(true, candidate.call([2, 4, -5, 3, 5, 7]))
    assert_equal(false, candidate.call([1]))
    assert_equal(true, candidate.call([-3, 9, -1, 3, 2, 30]))
    assert_equal(true, candidate.call([-3, 9, -1, 3, 2, 31]))
    assert_equal(false, candidate.call([-3, 9, -1, 4, 2, 30]))
    assert_equal(false, candidate.call([-3, 9, -1, 4, 2, 31]))
  end
end


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.call(3, 4, 5)
# 6.0
# >>> triangle_area.call(1, 2, 10)
# -1
def triangle_area(a, b, c)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_triangle_area
    candidate = method(:triangle_area)
    assert_equal(6.0, candidate.call(3, 4, 5))
    assert_equal(-1, candidate.call(1, 2, 10))
    assert_equal(8.18, candidate.call(4, 8, 5))
    assert_equal(1.73, candidate.call(2, 2, 2))
    assert_equal(-1, candidate.call(1, 2, 3))
    assert_equal(16.25, candidate.call(10, 5, 7))
    assert_equal(-1, candidate.call(2, 6, 3))
    assert_equal(0.43, candidate.call(1, 1, 1))
    assert_equal(-1, candidate.call(2, 2, 10))
  end
end


Prompt:
# There are eight planets in our solar system: the closerst to the Sun
# is Mercury, the next one is Venus, then Earth, Mars, Jupiter, Saturn,
# Uranus, Neptune.
# Write a function that takes two planet names as strings planet1 and planet2.
# The function should return an array containing all planets whose orbits are
# located between the orbit of planet1 and the orbit of planet2, sorted by
# the proximity to the sun.
# The function should return an empty array if planet1 or planet2
# are not correct planet names.
# Examples
# >>> bf.call("Jupiter", "Neptune")
# ["Saturn", "Uranus"]
# >>> bf.call("Earth", "Mercury")
# "Venus"
# >>> bf.call("Mercury", "Uranus")
# ["Venus", "Earth", "Mars", "Jupiter", "Saturn"]
def bf(planet1, planet2)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_bf
    candidate = method(:bf)
    assert_equal(["Saturn", "Uranus"], candidate.call("Jupiter", "Neptune"))
    assert_equal(["Venus"], candidate.call("Earth", "Mercury"))
    assert_equal(["Venus", "Earth", "Mars", "Jupiter", "Saturn"], candidate.call("Mercury", "Uranus"))
    assert_equal(["Earth", "Mars", "Jupiter", "Saturn", "Uranus"], candidate.call("Neptune", "Venus"))
    assert_equal([], candidate.call("Earth", "Earth"))
    assert_equal([], candidate.call("Mars", "Earth"))
    assert_equal([], candidate.call("Jupiter", "Makemake"))
  end
end


Prompt:
# Given a positive integer n, return the product of the odd digits.
# Return 0 if all digits are even.
# For example:
# >>> digits.call(1)
# 1
# >>> digits.call(4)
# 0
# >>> digits.call(235)
# 15
def digits(n)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_digits
    candidate = method(:digits)
    assert_equal(5, candidate.call(5))
    assert_equal(5, candidate.call(54))
    assert_equal(1, candidate.call(120))
    assert_equal(5, candidate.call(5014))
    assert_equal(315, candidate.call(98765))
    assert_equal(2625, candidate.call(5576543))
    assert_equal(0, candidate.call(2468))
  end
end


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.call("Hi, my name is John")
# ["Hi", "my", "name", "is", "John"]
# >>> words_string.call("One, two, three, four, five, six")
# ["One", "two", "three", "four", "five", "six"]
def words_string(s)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_words_string
    candidate = method(:words_string)
    assert_equal(["Hi", "my", "name", "is", "John"], candidate.call("Hi, my name is John"))
    assert_equal(["One", "two", "three", "four", "five", "six"], candidate.call("One, two, three, four, five, six"))
    assert_equal(["Hi", "my", "name"], candidate.call("Hi, my name"))
    assert_equal(["One", "two", "three", "four", "five", "six"], candidate.call("One,, two, three, four, five, six,"))
    assert_equal([], candidate.call(""))
    assert_equal(["ahmed", "gamal"], candidate.call("ahmed     , gamal"))
  end
end


Prompt:
# Find how many times a given substring can be found in the original string. Count overlaping cases.
# >>> how_many_times.call("", "a")
# 0
# >>> how_many_times.call("aaa", "a")
# 3
# >>> how_many_times.call("aaaa", "aa")
# 3
def how_many_times(string, substring)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_how_many_times
    candidate = method(:how_many_times)
    assert_equal(0, candidate.call("", "x"))
    assert_equal(4, candidate.call("xyxyxyx", "x"))
    assert_equal(4, candidate.call("cacacacac", "cac"))
    assert_equal(1, candidate.call("john doe", "john"))
  end
end


Prompt:
# 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.call(1, 2.5)
# 2.5
# >>> compare_one.call(1, "2,3")
# "2,3"
# >>> compare_one.call("5,1", "6")
# "6"
# >>> compare_one.call("1", 1)
# nil
def compare_one(a, b)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_compare_one
    candidate = method(:compare_one)
    assert_equal(2, candidate.call(1, 2))
    assert_equal(2.5, candidate.call(1, 2.5))
    assert_equal(3, candidate.call(2, 3))
    assert_equal(6, candidate.call(5, 6))
    assert_equal("2,3", candidate.call(1, "2,3"))
    assert_equal("6", candidate.call("5,1", "6"))
    assert_equal("2", candidate.call("1", "2"))
    assert_equal(nil, candidate.call("1", 1))
  end
end


Prompt:
# remove_vowels is a function that takes string and returns string without vowels.
# >>> remove_vowels.call("")
# ""
# >>> remove_vowels.call("abcdef")
# "bcdf"
# >>> remove_vowels.call("aaaaa")
# ""
# >>> remove_vowels.call("aaBAA")
# "B"
# >>> remove_vowels.call("zbcd")
# "zbcd"
def remove_vowels(text)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_remove_vowels
    candidate = method(:remove_vowels)
    assert_equal("", candidate.call(""))
    assert_equal("bcdf
ghjklm", candidate.call("abcdef
ghijklm"))
    assert_equal("fdcb", candidate.call("fedcba"))
    assert_equal("", candidate.call("eeeee"))
    assert_equal("cB", candidate.call("acBAA"))
    assert_equal("cB", candidate.call("EcBOO"))
    assert_equal("ybcd", candidate.call("ybcd"))
  end
end


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.call([1, 2, 3, 4])
# [1, 4, 2, 3]
# >>> strange_sort_list.call([5, 5, 5, 5])
# [5, 5, 5, 5]
# >>> strange_sort_list.call([])
# []
def strange_sort_list(lst)

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


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.call([1.0, 2.0, 3.0, 4.0, 5.0, 2.2])
# [2.0, 2.2]
# >>> find_closest_elements.call([1.0, 2.0, 3.0, 4.0, 5.0, 2.0])
# [2.0, 2.0]
def find_closest_elements(numbers)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_find_closest_elements
    candidate = method(:find_closest_elements)
    assert_equal([3.9, 4.0], candidate.call([1.0, 2.0, 3.9, 4.0, 5.0, 2.2]))
    assert_equal([5.0, 5.9], candidate.call([1.0, 2.0, 5.9, 4.0, 5.0]))
    assert_equal([2.0, 2.2], candidate.call([1.0, 2.0, 3.0, 4.0, 5.0, 2.2]))
    assert_equal([2.0, 2.0], candidate.call([1.0, 2.0, 3.0, 4.0, 5.0, 2.0]))
    assert_equal([2.2, 3.1], candidate.call([1.1, 2.2, 3.1, 4.1, 5.1]))
  end
end


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.call(1, 4)
# true
# >>> is_simple_power.call(2, 2)
# true
# >>> is_simple_power.call(8, 2)
# true
# >>> is_simple_power.call(3, 2)
# false
# >>> is_simple_power.call(3, 1)
# false
# >>> is_simple_power.call(5, 3)
# false
def is_simple_power(x, n)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_is_simple_power
    candidate = method(:is_simple_power)
    assert_equal(true, candidate.call(16, 2))
    assert_equal(false, candidate.call(143214, 16))
    assert_equal(true, candidate.call(4, 2))
    assert_equal(true, candidate.call(9, 3))
    assert_equal(true, candidate.call(16, 4))
    assert_equal(false, candidate.call(24, 2))
    assert_equal(false, candidate.call(128, 4))
    assert_equal(false, candidate.call(12, 6))
    assert_equal(true, candidate.call(1, 1))
    assert_equal(true, candidate.call(1, 12))
  end
end


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

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_prime_fib
    candidate = method(:prime_fib)
    assert_equal(2, candidate.call(1))
    assert_equal(3, candidate.call(2))
    assert_equal(5, candidate.call(3))
    assert_equal(13, candidate.call(4))
    assert_equal(89, candidate.call(5))
    assert_equal(233, candidate.call(6))
    assert_equal(1597, candidate.call(7))
    assert_equal(28657, candidate.call(8))
    assert_equal(514229, candidate.call(9))
    assert_equal(433494437, candidate.call(10))
  end
end


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.call([1, 11, -1, -11, -12])
# [-1, -11, 1, -12, 11]
# >>> order_by_points.call([])
# []
def order_by_points(nums)


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

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_has_close_elements
    candidate = method(:has_close_elements)
    assert_equal(true, candidate.call([1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.3))
    assert_equal(false, candidate.call([1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.05))
    assert_equal(true, candidate.call([1.0, 2.0, 5.9, 4.0, 5.0], 0.95))
    assert_equal(false, candidate.call([1.0, 2.0, 5.9, 4.0, 5.0], 0.8))
    assert_equal(true, candidate.call([1.0, 2.0, 3.0, 4.0, 5.0, 2.0], 0.1))
    assert_equal(true, candidate.call([1.1, 2.2, 3.1, 4.1, 5.1], 1.0))
    assert_equal(false, candidate.call([1.1, 2.2, 3.1, 4.1, 5.1], 0.5))
  end
end


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.call("")
# ""
# >>> make_palindrome.call("cat")
# "catac"
# >>> make_palindrome.call("cata")
# "catac"
def make_palindrome(string)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_make_palindrome
    candidate = method(:make_palindrome)
    assert_equal("", candidate.call(""))
    assert_equal("x", candidate.call("x"))
    assert_equal("xyzyx", candidate.call("xyz"))
    assert_equal("xyx", candidate.call("xyx"))
    assert_equal("jerryrrej", candidate.call("jerry"))
  end
end


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.call("010", "110")
# "100"
def string_xor(a, b)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_string_xor
    candidate = method(:string_xor)
    assert_equal("010010", candidate.call("111000", "101010"))
    assert_equal("0", candidate.call("1", "1"))
    assert_equal("0101", candidate.call("0101", "0000"))
  end
end


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

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_special_factorial
    candidate = method(:special_factorial)
    assert_equal(288, candidate.call(4))
    assert_equal(34560, candidate.call(5))
    assert_equal(125411328000, candidate.call(7))
    assert_equal(1, candidate.call(1))
  end
end


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

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_add_elements
    candidate = method(:add_elements)
    assert_equal(-4, candidate.call([1, -2, -3, 41, 57, 76, 87, 88, 99], 3))
    assert_equal(0, candidate.call([111, 121, 3, 4000, 5, 6], 2))
    assert_equal(125, candidate.call([11, 21, 3, 90, 5, 6, 7, 8, 9], 4))
    assert_equal(24, candidate.call([111, 21, 3, 4000, 5, 6, 7, 8, 9], 4))
    assert_equal(1, candidate.call([1], 1))
  end
end


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.call(5)
# 4
# >>> fib4.call(6)
# 8
# >>> fib4.call(7)
# 14
def fib4(n)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_fib4
    candidate = method(:fib4)
    assert_equal(4, candidate.call(5))
    assert_equal(28, candidate.call(8))
    assert_equal(104, candidate.call(10))
    assert_equal(386, candidate.call(12))
  end
end


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.call([15, 33, 1422, 1])
# [1, 15, 33]
# >>> unique_digits.call([152, 323, 1422, 10])
# []
def unique_digits(x)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_unique_digits
    candidate = method(:unique_digits)
    assert_equal([1, 15, 33], candidate.call([15, 33, 1422, 1]))
    assert_equal([], candidate.call([152, 323, 1422, 10]))
    assert_equal([111, 151], candidate.call([12345, 2033, 111, 151]))
    assert_equal([31, 135], candidate.call([135, 103, 31]))
  end
end


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.call("Mary had a little lamb", 4)
# ["little"]
# >>> select_words.call("Mary had a little lamb", 3)
# ["Mary", "lamb"]
# >>> select_words.call("simple white space", 2)
# []
# >>> select_words.call("Hello world", 4)
# ["world"]
# >>> select_words.call("Uncle sam", 3)
# ["Uncle"]
def select_words(s, n)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_select_words
    candidate = method(:select_words)
    assert_equal(["little"], candidate.call("Mary had a little lamb", 4))
    assert_equal(["Mary", "lamb"], candidate.call("Mary had a little lamb", 3))
    assert_equal([], candidate.call("simple white space", 2))
    assert_equal(["world"], candidate.call("Hello world", 4))
    assert_equal(["Uncle"], candidate.call("Uncle sam", 3))
    assert_equal([], candidate.call("", 4))
    assert_equal(["b", "c", "d", "f"], candidate.call("a b c d e f", 1))
  end
end


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.call([1, 2], 5)
# false
# # 1+2 is less than the maximum possible weight, but it's unbalanced.
# >>> will_it_fly.call([3, 2, 3], 1)
# false
# # it's balanced, but 3+2+3 is more than the maximum possible weight.
# >>> will_it_fly.call([3, 2, 3], 9)
# true
# # 3+2+3 is less than the maximum possible weight, and it's balanced.
# >>> will_it_fly.call([3], 5)
# true
# # 3 is less than the maximum possible weight, and it's balanced.
def will_it_fly(q, w)

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


Prompt:
# Return n-th Fibonacci number.
# >>> fib.call(10)
# 55
# >>> fib.call(1)
# 1
# >>> fib.call(8)
# 21
def fib(n)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_fib
    candidate = method(:fib)
    assert_equal(55, candidate.call(10))
    assert_equal(1, candidate.call(1))
    assert_equal(21, candidate.call(8))
    assert_equal(89, candidate.call(11))
    assert_equal(144, candidate.call(12))
  end
end


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.call("my_class", ["AA", "Be", "CC"])
# "my_class.AA"
def Strongest_Extension(class_name, extensions)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_Strongest_Extension
    candidate = method(:Strongest_Extension)
    assert_equal("Watashi.eIGHt8OKe", candidate.call("Watashi", ["tEN", "niNE", "eIGHt8OKe"]))
    assert_equal("Boku123.YEs.WeCaNe", candidate.call("Boku123", ["nani", "NazeDa", "YEs.WeCaNe", "32145tggg"]))
    assert_equal("__YESIMHERE.NuLl__", candidate.call("__YESIMHERE", ["t", "eMptY", "nothing", "zeR00", "NuLl__", "123NoooneB321"]))
    assert_equal("K.TAR", candidate.call("K", ["Ta", "TAR", "t234An", "cosSo"]))
    assert_equal("__HAHA.123", candidate.call("__HAHA", ["Tab", "123", "781345", "-_-"]))
    assert_equal("YameRore.okIWILL123", candidate.call("YameRore", ["HhAas", "okIWILL123", "WorkOut", "Fails", "-_-"]))
    assert_equal("finNNalLLly.WoW", candidate.call("finNNalLLly", ["Die", "NowW", "Wow", "WoW"]))
    assert_equal("_.Bb", candidate.call("_", ["Bb", "91245"]))
    assert_equal("Sp.671235", candidate.call("Sp", ["671235", "Bb"]))
  end
end


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.call(["()(", ")"])
# "Yes"
# >>> match_parens.call([")", ")"])
# "No"
def match_parens(lst)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_match_parens
    candidate = method(:match_parens)
    assert_equal("Yes", candidate.call(["()(", ")"]))
    assert_equal("No", candidate.call([")", ")"]))
    assert_equal("No", candidate.call(["(()(())", "())())"]))
    assert_equal("Yes", candidate.call([")())", "(()()("]))
    assert_equal("Yes", candidate.call(["(())))", "(()())(("]))
    assert_equal("No", candidate.call(["()", "())"]))
    assert_equal("Yes", candidate.call(["(()(", "()))()"]))
    assert_equal("No", candidate.call(["((((", "((())"]))
    assert_equal("No", candidate.call([")(()", "(()("]))
    assert_equal("No", candidate.call([")(", ")("]))
    assert_equal("Yes", candidate.call(["(", ")"]))
    assert_equal("Yes", candidate.call([")", "("]))
  end
end


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.call([1, 2, 3, 4, 5])
# 2
# >>> next_smallest.call([5, 1, 4, 3, 2])
# 2
# >>> next_smallest.call([])
# nil
# >>> next_smallest.call([1, 1])
# nil
def next_smallest(lst)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_next_smallest
    candidate = method(:next_smallest)
    assert_equal(2, candidate.call([1, 2, 3, 4, 5]))
    assert_equal(2, candidate.call([5, 1, 4, 3, 2]))
    assert_equal(nil, candidate.call([]))
    assert_equal(nil, candidate.call([1, 1]))
    assert_equal(1, candidate.call([1, 1, 1, 1, 0]))
    assert_equal(nil, candidate.call([1, 1]))
    assert_equal(-35, candidate.call([-35, 34, 12, -45]))
  end
end


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.call(5, 2, 7)
# true
# >>> any_int.call(3, 2, 2)
# false
# >>> any_int.call(3, -2, 1)
# true
# >>> any_int.call(3.6, -2.2, 2)
# false
def any_int(x, y, z)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_any_int
    candidate = method(:any_int)
    assert_equal(true, candidate.call(2, 3, 1))
    assert_equal(false, candidate.call(2.5, 2, 3))
    assert_equal(false, candidate.call(1.5, 5, 3.5))
    assert_equal(false, candidate.call(2, 6, 2))
    assert_equal(true, candidate.call(4, 2, 2))
    assert_equal(false, candidate.call(2.2, 2.2, 2.2))
    assert_equal(true, candidate.call(-4, 6, 2))
    assert_equal(true, candidate.call(2, 1, 1))
    assert_equal(true, candidate.call(3, 4, 7))
    assert_equal(false, candidate.call(3.0, 4, 7))
  end
end


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.call(3.5)
# 0.5
def truncate_number(number)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_truncate_number
    candidate = method(:truncate_number)
    assert_equal(0.5, candidate.call(3.5))
    assert_equal(0.25, candidate.call(1.25))
    assert_equal(0.0, candidate.call(123.0))
  end
end


Prompt:
# Return array with elements incremented by 1.
# >>> incr_list.call([1, 2, 3])
# [2, 3, 4]
# >>> incr_list.call([5, 3, 5, 2, 3, 3, 9, 0, 123])
# [6, 4, 6, 3, 4, 4, 10, 1, 124]
def incr_list(l)

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


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.call(7, 34, 12)
# 34
# >>> x_or_y.call(15, 8, 5)
# 5
def x_or_y(n, x, y)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_x_or_y
    candidate = method(:x_or_y)
    assert_equal(34, candidate.call(7, 34, 12))
    assert_equal(5, candidate.call(15, 8, 5))
    assert_equal(33, candidate.call(3, 33, 5212))
    assert_equal(3, candidate.call(1259, 3, 52))
    assert_equal(-1, candidate.call(7919, -1, 12))
    assert_equal(583, candidate.call(3609, 1245, 583))
    assert_equal(129, candidate.call(91, 56, 129))
    assert_equal(1234, candidate.call(6, 34, 1234))
    assert_equal(0, candidate.call(1, 2, 0))
    assert_equal(2, candidate.call(2, 2, 0))
  end
end


Prompt:
# Return 2^n modulo p (be aware of numerics).
# >>> modp.call(3, 5)
# 3
# >>> modp.call(1101, 101)
# 2
# >>> modp.call(0, 101)
# 1
# >>> modp.call(3, 11)
# 8
# >>> modp.call(100, 101)
# 1
def modp(n, p)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_modp
    candidate = method(:modp)
    assert_equal(3, candidate.call(3, 5))
    assert_equal(2, candidate.call(1101, 101))
    assert_equal(1, candidate.call(0, 101))
    assert_equal(8, candidate.call(3, 11))
    assert_equal(1, candidate.call(100, 101))
    assert_equal(4, candidate.call(30, 5))
    assert_equal(3, candidate.call(31, 5))
  end
end


Prompt:
# Given an integer. return an array that has the number of even and odd digits respectively.
# Example:
# >>> even_odd_count.call(-12)
# [1, 1]
# >>> even_odd_count.call(123)
# [1, 2]
def even_odd_count(num)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_even_odd_count
    candidate = method(:even_odd_count)
    assert_equal([0, 1], candidate.call(7))
    assert_equal([1, 1], candidate.call(-78))
    assert_equal([2, 2], candidate.call(3452))
    assert_equal([3, 3], candidate.call(346211))
    assert_equal([3, 3], candidate.call(-345821))
    assert_equal([1, 0], candidate.call(-2))
    assert_equal([2, 3], candidate.call(-45347))
    assert_equal([1, 0], candidate.call(0))
  end
end


Prompt:
# You are given a string s.
# Your task is to check if the string is haprb or not.
# A string is haprb if its length is at least 3 and every 3 consecutive letters are distinct
# For example:
# >>> is_happy.call("a")
# false
# >>> is_happy.call("aa")
# false
# >>> is_happy.call("abcd")
# true
# >>> is_happy.call("aabb")
# false
# >>> is_happy.call("adb")
# true
# >>> is_happy.call("xyy")
# false
def is_happy(s)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_is_happy
    candidate = method(:is_happy)
    assert_equal(false, candidate.call("a"))
    assert_equal(false, candidate.call("aa"))
    assert_equal(true, candidate.call("abcd"))
    assert_equal(false, candidate.call("aabb"))
    assert_equal(true, candidate.call("adb"))
    assert_equal(false, candidate.call("xyy"))
    assert_equal(true, candidate.call("iopaxpoi"))
    assert_equal(false, candidate.call("iopaxioi"))
  end
end


Prompt:
# Return the largest prime factor of n. Assume n > 1 and is not a prime.
# >>> largest_prime_factor.call(13195)
# 29
# >>> largest_prime_factor.call(2048)
# 2
def largest_prime_factor(n)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_largest_prime_factor
    candidate = method(:largest_prime_factor)
    assert_equal(5, candidate.call(15))
    assert_equal(3, candidate.call(27))
    assert_equal(7, candidate.call(63))
    assert_equal(11, candidate.call(330))
    assert_equal(29, candidate.call(13195))
  end
end


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

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_digitSum
    candidate = method(:digitSum)
    assert_equal(0, candidate.call(""))
    assert_equal(131, candidate.call("abAB"))
    assert_equal(67, candidate.call("abcCd"))
    assert_equal(69, candidate.call("helloE"))
    assert_equal(131, candidate.call("woArBld"))
    assert_equal(153, candidate.call("aAaaaXa"))
    assert_equal(151, candidate.call(" How are yOu?"))
    assert_equal(327, candidate.call("You arE Very Smart"))
  end
end


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.call([1.0, 2.0, 3.0, 4.0, 5.0])
# [0.0, 0.25, 0.5, 0.75, 1.0]
def rescale_to_unit(numbers)


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

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_solution
    candidate = method(:solution)
    assert_equal(12, candidate.call([5, 8, 7, 1]))
    assert_equal(9, candidate.call([3, 3, 3, 3, 3]))
    assert_equal(0, candidate.call([30, 13, 24, 321]))
    assert_equal(5, candidate.call([5, 9]))
    assert_equal(0, candidate.call([2, 4, 8]))
    assert_equal(23, candidate.call([30, 13, 23, 32]))
    assert_equal(3, candidate.call([3, 13, 2, 9]))
  end
end


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.call([4, 2, 3])
# [2, 1]
# Explanation: 2 has the smallest even value, and 2 has the smallest index.
# Example 2:
# >>> pluck.call([1, 2, 3])
# [2, 1]
# Explanation: 2 has the smallest even value, and 2 has the smallest index.
# Example 3:
# >>> pluck.call([])
# []
# Example 4:
# >>> pluck.call([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
def pluck(arr)

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


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.call(5)
# 1
# Explanation:
# a = [1, 3, 7, 13, 21]
# The only valid triple is (1, 7, 13).
def get_max_triples(n)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_get_max_triples
    candidate = method(:get_max_triples)
    assert_equal(1, candidate.call(5))
    assert_equal(4, candidate.call(6))
    assert_equal(36, candidate.call(10))
    assert_equal(53361, candidate.call(100))
  end
end


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.call([1, 2, 3, 4], [1, 2, 3, 4])
# "YES"
# >>> exchange.call([1, 2, 3, 4], [1, 5, 3, 4])
# "NO"
# It is assumed that the input arrays will be non-empty.
def exchange(lst1, lst2)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_exchange
    candidate = method(:exchange)
    assert_equal("YES", candidate.call([1, 2, 3, 4], [1, 2, 3, 4]))
    assert_equal("NO", candidate.call([1, 2, 3, 4], [1, 5, 3, 4]))
    assert_equal("YES", candidate.call([1, 2, 3, 4], [2, 1, 4, 3]))
    assert_equal("YES", candidate.call([5, 7, 3], [2, 6, 4]))
    assert_equal("NO", candidate.call([5, 7, 3], [2, 6, 3]))
    assert_equal("NO", candidate.call([3, 2, 6, 1, 8, 9], [3, 5, 5, 1, 1, 1]))
    assert_equal("YES", candidate.call([100, 200], [200, 200]))
  end
end


Prompt:
# Return median of elements in the array l.
# >>> median.call([3, 1, 2, 4, 5])
# 3
# >>> median.call([-10, 4, 6, 1000, 10, 20])
# 15.0
def median(l)

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


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.call("Hello")
# true
# >>> prime_length.call("abcdcba")
# true
# >>> prime_length.call("kittens")
# true
# >>> prime_length.call("orange")
# false
def prime_length(string)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_prime_length
    candidate = method(:prime_length)
    assert_equal(true, candidate.call("Hello"))
    assert_equal(true, candidate.call("abcdcba"))
    assert_equal(true, candidate.call("kittens"))
    assert_equal(false, candidate.call("orange"))
    assert_equal(true, candidate.call("wow"))
    assert_equal(true, candidate.call("world"))
    assert_equal(true, candidate.call("MadaM"))
    assert_equal(true, candidate.call("Wow"))
    assert_equal(false, candidate.call(""))
    assert_equal(true, candidate.call("HI"))
    assert_equal(true, candidate.call("go"))
    assert_equal(false, candidate.call("gogo"))
    assert_equal(false, candidate.call("aaaaaaaaaaaaaaa"))
    assert_equal(true, candidate.call("Madam"))
    assert_equal(false, candidate.call("M"))
    assert_equal(false, candidate.call("0"))
  end
end


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.call([1, 2, 3, 5, 4, 7, 9, 6])
# 4
# >>> smallest_change.call([1, 2, 3, 4, 3, 2, 2])
# 1
# >>> smallest_change.call([1, 2, 3, 2, 1])
# 0
def smallest_change(arr)

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


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:
# >>> lst.call([1.0, 2.0, 3.0])
# 14
# >>> lst.call([1.0, 4.0, 9.0])
# 98
# >>> lst.call([1.0, 3.0, 5.0, 7.0])
# 84
# >>> lst.call([1.4, 4.2, 0.0])
# 29
# >>> lst.call([-2.4, 1.0, 1.0])
# 6
def sum_squares(lst)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_sum_squares
    candidate = method(:sum_squares)
    assert_equal(14, candidate.call([1.0, 2.0, 3.0]))
    assert_equal(14, candidate.call([1.0, 2.0, 3.0]))
    assert_equal(84, candidate.call([1.0, 3.0, 5.0, 7.0]))
    assert_equal(29, candidate.call([1.4, 4.2, 0.0]))
    assert_equal(6, candidate.call([-2.4, 1.0, 1.0]))
    assert_equal(10230, candidate.call([100.0, 1.0, 15.0, 2.0]))
    assert_equal(200000000, candidate.call([10000.0, 10000.0]))
    assert_equal(75, candidate.call([-1.4, 4.6, 6.3]))
    assert_equal(1086, candidate.call([-1.4, 17.9, 18.9, 19.9]))
    assert_equal(0, candidate.call([0.0]))
    assert_equal(1, candidate.call([-1.0]))
    assert_equal(2, candidate.call([-1.0, 1.0, 0.0]))
  end
end


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.call("example.txt")
# "Yes"
# >>> file_name_check.call("1example.dll")
# "No"
def file_name_check(file_name)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_file_name_check
    candidate = method(:file_name_check)
    assert_equal("Yes", candidate.call("example.txt"))
    assert_equal("No", candidate.call("1example.dll"))
    assert_equal("No", candidate.call("s1sdf3.asd"))
    assert_equal("Yes", candidate.call("K.dll"))
    assert_equal("Yes", candidate.call("MY16FILE3.exe"))
    assert_equal("No", candidate.call("His12FILE94.exe"))
    assert_equal("No", candidate.call("_Y.txt"))
    assert_equal("No", candidate.call("?aREYA.exe"))
    assert_equal("No", candidate.call("/this_is_valid.dll"))
    assert_equal("No", candidate.call("this_is_valid.wow"))
    assert_equal("Yes", candidate.call("this_is_valid.txt"))
    assert_equal("No", candidate.call("this_is_valid.txtexe"))
    assert_equal("No", candidate.call("#this2_i4s_5valid.ten"))
    assert_equal("No", candidate.call("@this1_is6_valid.exe"))
    assert_equal("No", candidate.call("this_is_12valid.6exe4.txt"))
    assert_equal("No", candidate.call("all.exe.txt"))
    assert_equal("Yes", candidate.call("I563_No.exe"))
    assert_equal("Yes", candidate.call("Is3youfault.txt"))
    assert_equal("Yes", candidate.call("no_one#knows.dll"))
    assert_equal("No", candidate.call("1I563_Yes3.exe"))
    assert_equal("No", candidate.call("I563_Yes3.txtt"))
    assert_equal("No", candidate.call("final..txt"))
    assert_equal("No", candidate.call("final132"))
    assert_equal("No", candidate.call("_f4indsartal132."))
    assert_equal("No", candidate.call(".txt"))
    assert_equal("No", candidate.call("s."))
  end
end


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.call([1, 3, 5, 0])
# false
# >>> triples_sum_to_zero.call([1, 3, -2, 1])
# true
# >>> triples_sum_to_zero.call([1, 2, 3, 7])
# false
# >>> triples_sum_to_zero.call([2, 4, -5, 3, 9, 7])
# true
# >>> triples_sum_to_zero.call([1])
# false
def triples_sum_to_zero(l)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_triples_sum_to_zero
    candidate = method(:triples_sum_to_zero)
    assert_equal(false, candidate.call([1, 3, 5, 0]))
    assert_equal(false, candidate.call([1, 3, 5, -1]))
    assert_equal(true, candidate.call([1, 3, -2, 1]))
    assert_equal(false, candidate.call([1, 2, 3, 7]))
    assert_equal(false, candidate.call([1, 2, 5, 7]))
    assert_equal(true, candidate.call([2, 4, -5, 3, 9, 7]))
    assert_equal(false, candidate.call([1]))
    assert_equal(false, candidate.call([1, 3, 5, -100]))
    assert_equal(false, candidate.call([100, 3, 5, -100]))
  end
end


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.call([1, 2], [2, 3])
# "NO"
# >>> intersection.call([-1, 1], [0, 4])
# "NO"
# >>> intersection.call([-3, -1], [-5, 5])
# "YES"
def intersection(interval1, interval2)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_intersection
    candidate = method(:intersection)
    assert_equal("NO", candidate.call([1, 2], [2, 3]))
    assert_equal("NO", candidate.call([-1, 1], [0, 4]))
    assert_equal("YES", candidate.call([-3, -1], [-5, 5]))
    assert_equal("YES", candidate.call([-2, 2], [-4, 0]))
    assert_equal("NO", candidate.call([-11, 2], [-1, -1]))
    assert_equal("NO", candidate.call([1, 2], [3, 5]))
    assert_equal("NO", candidate.call([1, 2], [1, 2]))
    assert_equal("NO", candidate.call([-2, -2], [-3, -2]))
  end
end


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.call("( ) (( )) (( )( ))")
# ["()", "(())", "(()())"]
def separate_paren_groups(paren_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.call([1, 2, 3, 4, 5, 1], [1, 2, 3, 4, 2, -2])
# [0, 0, 0, 0, 3, 3]
# >>> compare.call([0, 5, 0, 0, 0, 4], [4, 1, 1, 0, 0, -2])
# [4, 4, 1, 0, 0, 6]
def compare(game, guess)

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


Prompt:
# Given a positive integer n, return the count of the numbers of n-digit
# positive integers that start or end with 1.
def starts_one_ends(n)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_starts_one_ends
    candidate = method(:starts_one_ends)
    assert_equal(1, candidate.call(1))
    assert_equal(18, candidate.call(2))
    assert_equal(180, candidate.call(3))
    assert_equal(1800, candidate.call(4))
    assert_equal(18000, candidate.call(5))
  end
end


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.call("apple pie")
# false
# >>> check_if_last_char_is_a_letter.call("apple pi e")
# true
# >>> check_if_last_char_is_a_letter.call("apple pi e ")
# false
# >>> check_if_last_char_is_a_letter.call("")
# false
def check_if_last_char_is_a_letter(txt)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_check_if_last_char_is_a_letter
    candidate = method(:check_if_last_char_is_a_letter)
    assert_equal(false, candidate.call("apple"))
    assert_equal(true, candidate.call("apple pi e"))
    assert_equal(false, candidate.call("eeeee"))
    assert_equal(true, candidate.call("A"))
    assert_equal(false, candidate.call("Pumpkin pie "))
    assert_equal(false, candidate.call("Pumpkin pie 1"))
    assert_equal(false, candidate.call(""))
    assert_equal(false, candidate.call("eeeee e "))
    assert_equal(false, candidate.call("apple pie"))
    assert_equal(false, candidate.call("apple pi e "))
  end
end


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.call("03-11-2000")
# true
# >>> valid_date.call("15-01-2012")
# false
# >>> valid_date.call("04-0-2040")
# false
# >>> valid_date.call("06-04-2020")
# true
# >>> valid_date.call("06/04/2020")
# false
def valid_date(date)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_valid_date
    candidate = method(:valid_date)
    assert_equal(true, candidate.call("03-11-2000"))
    assert_equal(false, candidate.call("15-01-2012"))
    assert_equal(false, candidate.call("04-0-2040"))
    assert_equal(true, candidate.call("06-04-2020"))
    assert_equal(true, candidate.call("01-01-2007"))
    assert_equal(false, candidate.call("03-32-2011"))
    assert_equal(false, candidate.call(""))
    assert_equal(false, candidate.call("04-31-3000"))
    assert_equal(true, candidate.call("06-06-2005"))
    assert_equal(false, candidate.call("21-31-2000"))
    assert_equal(true, candidate.call("04-12-2003"))
    assert_equal(false, candidate.call("04122003"))
    assert_equal(false, candidate.call("20030412"))
    assert_equal(false, candidate.call("2003-04"))
    assert_equal(false, candidate.call("2003-04-12"))
    assert_equal(false, candidate.call("04-2003"))
  end
end


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.call([])
# 0
# >>> count_nums.call([-1, 11, -11])
# 1
# >>> count_nums.call([1, 1, 2])
# 3
def count_nums(arr)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_count_nums
    candidate = method(:count_nums)
    assert_equal(0, candidate.call([]))
    assert_equal(0, candidate.call([-1, -2, 0]))
    assert_equal(6, candidate.call([1, 1, 2, -2, 3, 4, 5]))
    assert_equal(5, candidate.call([1, 6, 9, -6, 0, 1, 5]))
    assert_equal(4, candidate.call([1, 100, 98, -7, 1, -1]))
    assert_equal(5, candidate.call([12, 23, 34, -45, -56, 0]))
    assert_equal(1, candidate.call([0, 1]))
    assert_equal(1, candidate.call([1]))
  end
end


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.call("Hi")
# "Hi"
# >>> anti_shuffle.call("hello")
# "ehllo"
# >>> anti_shuffle.call("Hello World!!!")
# "Hello !!!Wdlor"
def anti_shuffle(s)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_anti_shuffle
    candidate = method(:anti_shuffle)
    assert_equal("Hi", candidate.call("Hi"))
    assert_equal("ehllo", candidate.call("hello"))
    assert_equal("bemnru", candidate.call("number"))
    assert_equal("abcd", candidate.call("abcd"))
    assert_equal("Hello !!!Wdlor", candidate.call("Hello World!!!"))
    assert_equal("", candidate.call(""))
    assert_equal(".Hi My aemn is Meirst .Rboot How aer ?ouy", candidate.call("Hi. My name is Mister Robot. How are you?"))
  end
end


Prompt:
# Checks if given string is a palindrome
# >>> is_palindrome.call("")
# true
# >>> is_palindrome.call("aba")
# true
# >>> is_palindrome.call("aaaaa")
# true
# >>> is_palindrome.call("zbcd")
# false
def is_palindrome(text)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_is_palindrome
    candidate = method(:is_palindrome)
    assert_equal(true, candidate.call(""))
    assert_equal(true, candidate.call("aba"))
    assert_equal(true, candidate.call("aaaaa"))
    assert_equal(false, candidate.call("zbcd"))
    assert_equal(true, candidate.call("xywyx"))
    assert_equal(false, candidate.call("xywyz"))
    assert_equal(false, candidate.call("xywzx"))
  end
end


Prompt:
# You are given a word. Your task is to find the closest vowel that stands between
# two consonants from the right side of the word (case sensitive).
# Vowels in the beginning and ending doesn't count. Return empty string if you didn't
# find any vowel met the above condition.
# You may assume that the given string contains English letter only.
# Example:
# >>> get_closest_vowel.call("yogurt")
# "u"
# >>> get_closest_vowel.call("FULL")
# "U"
# >>> get_closest_vowel.call("quick")
# ""
# >>> get_closest_vowel.call("ab")
# ""
def get_closest_vowel(word)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_get_closest_vowel
    candidate = method(:get_closest_vowel)
    assert_equal("u", candidate.call("yogurt"))
    assert_equal("u", candidate.call("full"))
    assert_equal("", candidate.call("easy"))
    assert_equal("", candidate.call("eAsy"))
    assert_equal("", candidate.call("ali"))
    assert_equal("a", candidate.call("bad"))
    assert_equal("o", candidate.call("most"))
    assert_equal("", candidate.call("ab"))
    assert_equal("", candidate.call("ba"))
    assert_equal("", candidate.call("quick"))
    assert_equal("i", candidate.call("anime"))
    assert_equal("", candidate.call("Asia"))
    assert_equal("o", candidate.call("Above"))
  end
end


Prompt:
# Return true if a given number is prime, and false otherwise.
# >>> is_prime.call(6)
# false
# >>> is_prime.call(101)
# true
# >>> is_prime.call(11)
# true
# >>> is_prime.call(13441)
# true
# >>> is_prime.call(61)
# true
# >>> is_prime.call(4)
# false
# >>> is_prime.call(1)
# false
def is_prime(n)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_is_prime
    candidate = method(:is_prime)
    assert_equal(false, candidate.call(6))
    assert_equal(true, candidate.call(101))
    assert_equal(true, candidate.call(11))
    assert_equal(true, candidate.call(13441))
    assert_equal(true, candidate.call(61))
    assert_equal(false, candidate.call(4))
    assert_equal(false, candidate.call(1))
    assert_equal(true, candidate.call(5))
    assert_equal(true, candidate.call(11))
    assert_equal(true, candidate.call(17))
    assert_equal(false, candidate.call(85))
    assert_equal(false, candidate.call(77))
    assert_equal(false, candidate.call(255379))
  end
end


Prompt:
# Your task is to implement a function that will simplify the expression
# x * n. The function returns true if x * n evaluates to a whole number and false
# otherwise. Both x and n, are string representation of a fraction, and have the following format,
# <numerator>/<denominator> where both numerator and denominator are positive whole numbers.
# You can assume that x, and n are valid fractions, and do not have zero as denominator.
# >>> simplify.call("1/5", "5/1")
# true
# >>> simplify.call("1/6", "2/1")
# false
# >>> simplify.call("7/10", "10/2")
# false
def simplify(x, n)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_simplify
    candidate = method(:simplify)
    assert_equal(true, candidate.call("1/5", "5/1"))
    assert_equal(false, candidate.call("1/6", "2/1"))
    assert_equal(true, candidate.call("5/1", "3/1"))
    assert_equal(false, candidate.call("7/10", "10/2"))
    assert_equal(true, candidate.call("2/10", "50/10"))
    assert_equal(true, candidate.call("7/2", "4/2"))
    assert_equal(true, candidate.call("11/6", "6/1"))
    assert_equal(false, candidate.call("2/3", "5/2"))
    assert_equal(false, candidate.call("5/2", "3/5"))
    assert_equal(true, candidate.call("2/4", "8/4"))
    assert_equal(true, candidate.call("2/4", "4/2"))
    assert_equal(true, candidate.call("1/5", "5/1"))
    assert_equal(false, candidate.call("1/5", "1/5"))
  end
end


Prompt:
# You have been tasked to write a function that receives
# a hexadecimal number as a string and counts the number of hexadecimal
# digits that are primes (prime number, or a prime, is a natural number
# greater than 1 that is not a product of two smaller natural numbers).
# Hexadecimal digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
# Prime numbers are 2, 3, 5, 7, 11, 13, 17,...
# So you have to determine a number of the following digits: 2, 3, 5, 7,
# B (=decimal 11), D (=decimal 13).
# Note: you may assume the input is always correct or empty string,
# and symbols A,B,C,D,E,F are always uppercase.
# Examples:
# >>> hex_key.call("AB")
# 1
# >>> hex_key.call("1077E")
# 2
# >>> hex_key.call("ABED1A33")
# 4
# >>> hex_key.call("123456789ABCDEF0")
# 6
# >>> hex_key.call("2020")
# 2
def hex_key(num)

require 'test/unit'
class TestHumanEval < Test::Unit::TestCase
  def test_hex_key
    candidate = method(:hex_key)
    assert_equal(1, candidate.call("AB"))
    assert_equal(2, candidate.call("1077E"))
    assert_equal(4, candidate.call("ABED1A33"))
    assert_equal(2, candidate.call("2020"))
    assert_equal(6, candidate.call("123456789ABCDEF0"))
    assert_equal(12, candidate.call("112233445566778899AABBCCDDEEFF00"))
  end
end