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

defmodule HumanEval do
  def candidate(numbers, threshold), do: has_close_elements(numbers, threshold)
  def has_close_elements(numbers, threshold) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'has_close_elements' do
    assert true == HumanEval.candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.3)
    assert false == HumanEval.candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.05)
    assert true == HumanEval.candidate([1.0, 2.0, 5.9, 4.0, 5.0], 0.95)
    assert false == HumanEval.candidate([1.0, 2.0, 5.9, 4.0, 5.0], 0.8)
    assert true == HumanEval.candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.0], 0.1)
    assert true == HumanEval.candidate([1.1, 2.2, 3.1, 4.1, 5.1], 1.0)
    assert false == HumanEval.candidate([1.1, 2.2, 3.1, 4.1, 5.1], 0.5)
  end
end


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

defmodule HumanEval do
  def candidate(n), do: make_a_pile(n)
  def make_a_pile(n) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'make_a_pile' do
    assert [3, 5, 7] == HumanEval.candidate(3)
    assert [4, 6, 8, 10] == HumanEval.candidate(4)
    assert [5, 7, 9, 11, 13] == HumanEval.candidate(5)
    assert [6, 8, 10, 12, 14, 16] == HumanEval.candidate(6)
    assert [8, 10, 12, 14, 16, 18, 20, 22] == HumanEval.candidate(8)
  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 a list of the words.
# For example:
# >>> HumanEval.words_string("Hi, my name is John")
# ["Hi", "my", "name", "is", "John"]
# >>> HumanEval.words_string("One, two, three, four, five, six")
# ["One", "two", "three", "four", "five", "six"]

defmodule HumanEval do
  def candidate(s), do: words_string(s)
  def words_string(s) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'words_string' do
    assert ["Hi", "my", "name", "is", "John"] == HumanEval.candidate("Hi, my name is John")
    assert ["One", "two", "three", "four", "five", "six"] == HumanEval.candidate("One, two, three, four, five, six")
    assert ["Hi", "my", "name"] == HumanEval.candidate("Hi, my name")
    assert ["One", "two", "three", "four", "five", "six"] == HumanEval.candidate("One,, two, three, four, five, six,")
    assert [] == HumanEval.candidate("")
    assert ["ahmed", "gamal"] == HumanEval.candidate("ahmed     , gamal")
  end
end


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

defmodule HumanEval do
  def candidate(x, y), do: choose_num(x, y)
  def choose_num(x, y) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'choose_num' do
    assert 14 == HumanEval.candidate(12, 15)
    assert -1 == HumanEval.candidate(13, 12)
    assert 12354 == HumanEval.candidate(33, 12354)
    assert -1 == HumanEval.candidate(5234, 5233)
    assert 28 == HumanEval.candidate(6, 29)
    assert -1 == HumanEval.candidate(27, 10)
    assert -1 == HumanEval.candidate(7, 7)
    assert 546 == HumanEval.candidate(546, 546)
  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:
# >>> HumanEval.rounded_avg(1, 5)
# "0b11"
# >>> HumanEval.rounded_avg(7, 5)
# -1
# >>> HumanEval.rounded_avg(10, 20)
# "0b1111"
# >>> HumanEval.rounded_avg(20, 33)
# "0b11010"

defmodule HumanEval do
  def candidate(n, m), do: rounded_avg(n, m)
  def rounded_avg(n, m) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'rounded_avg' do
    assert "0b11" == HumanEval.candidate(1, 5)
    assert "0b1010" == HumanEval.candidate(7, 13)
    assert "0b1111001010" == HumanEval.candidate(964, 977)
    assert "0b1111100100" == HumanEval.candidate(996, 997)
    assert "0b1011000010" == HumanEval.candidate(560, 851)
    assert "0b101101110" == HumanEval.candidate(185, 546)
    assert "0b110101101" == HumanEval.candidate(362, 496)
    assert "0b1001110010" == HumanEval.candidate(350, 902)
    assert "0b11010111" == HumanEval.candidate(197, 233)
    assert -1 == HumanEval.candidate(7, 5)
    assert -1 == HumanEval.candidate(5, 1)
    assert "0b101" == HumanEval.candidate(5, 5)
  end
end


Prompt:
# Given a list of positive integers x. return a sorted list of all
# elements that hasn't any even digit.
# Note: Returned list should be sorted in increasing order.
# For example:
# >>> HumanEval.unique_digits([15, 33, 1422, 1])
# [1, 15, 33]
# >>> HumanEval.unique_digits([152, 323, 1422, 10])
# []

defmodule HumanEval do
  def candidate(x), do: unique_digits(x)
  def unique_digits(x) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'unique_digits' do
    assert [1, 15, 33] == HumanEval.candidate([15, 33, 1422, 1])
    assert [] == HumanEval.candidate([152, 323, 1422, 10])
    assert [111, 151] == HumanEval.candidate([12345, 2033, 111, 151])
    assert [31, 135] == HumanEval.candidate([135, 103, 31])
  end
end


Prompt:
# Given a list of integers, sort the integers that are between 1 and 9 inclusive,
# reverse the resulting list, and then replace each digit by its corresponding name from
# "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine".
# For example:
# >>> HumanEval.by_length([2, 1, 1, 4, 5, 8, 2, 3])
# ["Eight", "Five", "Four", "Three", "Two", "Two", "One", "One"]
# If the list is empty, return an empty list:
# >>> HumanEval.by_length([])
# []
# If the list has any strange number ignore it:
# >>> HumanEval.by_length([1, -1, 55])
# ["One"]

defmodule HumanEval do
  def candidate(arr), do: by_length(arr)
  def by_length(arr) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'by_length' do
    assert ["Eight", "Five", "Four", "Three", "Two", "Two", "One", "One"] == HumanEval.candidate([2, 1, 1, 4, 5, 8, 2, 3])
    assert [] == HumanEval.candidate([])
    assert ["One"] == HumanEval.candidate([1, -1, 55])
    assert ["Three", "Two", "One"] == HumanEval.candidate([1, -1, 3, 2])
    assert ["Nine", "Eight", "Four"] == HumanEval.candidate([9, 4, 8])
  end
end


Prompt:
# Implement the function f that takes n as a parameter,
# and returns a list of size n, such that the value of the element at index i is the factorial of i if i is even
# or the sum of numbers from 1 to i otherwise.
# i starts from 1.
# the factorial of i is the multiplication of the numbers from 1 to i (1 * 2 * ... * i).
# Example:
# >>> HumanEval.f(5)
# [1, 2, 6, 24, 15]

defmodule HumanEval do
  def candidate(n), do: f(n)
  def f(n) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'f' do
    assert [1, 2, 6, 24, 15] == HumanEval.candidate(5)
    assert [1, 2, 6, 24, 15, 720, 28] == HumanEval.candidate(7)
    assert [1] == HumanEval.candidate(1)
    assert [1, 2, 6] == HumanEval.candidate(3)
  end
end


Prompt:
# Given a positive integer n, return a tuple that has the number of even and odd
# integer palindromes that fall within the range(1, n), inclusive.
# Example 1:
# >>> HumanEval.even_odd_palindrome(3)
# {1, 2}
# Explanation:
# Integer palindrome are 1, 2, 3. one of them is even, and two of them are odd.
# Example 2:
# >>> HumanEval.even_odd_palindrome(12)
# {4, 6}
# Explanation:
# Integer palindrome are 1, 2, 3, 4, 5, 6, 7, 8, 9, 11. four of them are even, and 6 of them are odd.
# Note:
# 1. 1 <= n <= 10^3
# 2. returned tuple has the number of even and odd integer palindromes respectively.

defmodule HumanEval do
  def candidate(n), do: even_odd_palindrome(n)
  def even_odd_palindrome(n) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'even_odd_palindrome' do
    assert {8, 13} == HumanEval.candidate(123)
    assert {4, 6} == HumanEval.candidate(12)
    assert {1, 2} == HumanEval.candidate(3)
    assert {6, 8} == HumanEval.candidate(63)
    assert {5, 6} == HumanEval.candidate(25)
    assert {4, 6} == HumanEval.candidate(19)
    assert {4, 5} == HumanEval.candidate(9)
    assert {0, 1} == HumanEval.candidate(1)
  end
end


Prompt:
# Write a function count_nums which takes a list 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.
# >>> HumanEval.count_nums([])
# 0
# >>> HumanEval.count_nums([-1, 11, -11])
# 1
# >>> HumanEval.count_nums([1, 1, 2])
# 3

defmodule HumanEval do
  def candidate(arr), do: count_nums(arr)
  def count_nums(arr) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'count_nums' do
    assert 0 == HumanEval.candidate([])
    assert 0 == HumanEval.candidate([-1, -2, 0])
    assert 6 == HumanEval.candidate([1, 1, 2, -2, 3, 4, 5])
    assert 5 == HumanEval.candidate([1, 6, 9, -6, 0, 1, 5])
    assert 4 == HumanEval.candidate([1, 100, 98, -7, 1, -1])
    assert 5 == HumanEval.candidate([12, 23, 34, -45, -56, 0])
    assert 1 == HumanEval.candidate([0, 1])
    assert 1 == HumanEval.candidate([1])
  end
end


Prompt:
# We have a list 'arr' of N integers arr[1], arr[2], ..., arr[N].The
# numbers in the list will be randomly ordered. Your task is to determine if
# it is possible to get a list sorted in non-decreasing order by performing
# the following operation on the given list:
# You are allowed to perform right shift operation any number of times.
# One right shift operation means shifting all elements of the list by one
# position in the right direction. The last element of the list will be moved to
# the starting position in the list i.e. 0th index.
# If it is possible to obtain the sorted list by performing the above operation
# then return true else return false.
# If the given list is empty then return true.
# Note: The given list is guaranteed to have unique elements.
# For Example:
# >>> HumanEval.move_one_ball([3, 4, 5, 1, 2])
# true
# Explanation: By performin 2 right shift operations, non-decreasing order can
# be achieved for the given list.
# >>> HumanEval.move_one_ball([3, 5, 4, 1, 2])
# false
# Explanation:It is not possible to get non-decreasing order for the given
# list by performing any number of right shift operations.

defmodule HumanEval do
  def candidate(arr), do: move_one_ball(arr)
  def move_one_ball(arr) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'move_one_ball' do
    assert true == HumanEval.candidate([3, 4, 5, 1, 2])
    assert true == HumanEval.candidate([3, 5, 10, 1, 2])
    assert false == HumanEval.candidate([4, 3, 1, 2])
    assert false == HumanEval.candidate([3, 5, 4, 1, 2])
    assert true == HumanEval.candidate([])
  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.
# >>> HumanEval.make_palindrome("")
# ""
# >>> HumanEval.make_palindrome("cat")
# "catac"
# >>> HumanEval.make_palindrome("cata")
# "catac"

defmodule HumanEval do
  def candidate(string), do: make_palindrome(string)
  def make_palindrome(string) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'make_palindrome' do
    assert "" == HumanEval.candidate("")
    assert "x" == HumanEval.candidate("x")
    assert "xyzyx" == HumanEval.candidate("xyz")
    assert "xyx" == HumanEval.candidate("xyx")
    assert "jerryrrej" == HumanEval.candidate("jerry")
  end
end


Prompt:
# In this problem, you will implement a function that takes two lists of numbers,
# and determines whether it is possible to perform an exchange of elements
# between them to make lst1 a list of only even numbers.
# There is no limit on the number of exchanged elements between lst1 and lst2.
# If it is 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:
# >>> HumanEval.exchange([1, 2, 3, 4], [1, 2, 3, 4])
# "YES"
# >>> HumanEval.exchange([1, 2, 3, 4], [1, 5, 3, 4])
# "NO"
# It is assumed that the input lists will be non-empty.

defmodule HumanEval do
  def candidate(lst1, lst2), do: exchange(lst1, lst2)
  def exchange(lst1, lst2) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'exchange' do
    assert "YES" == HumanEval.candidate([1, 2, 3, 4], [1, 2, 3, 4])
    assert "NO" == HumanEval.candidate([1, 2, 3, 4], [1, 5, 3, 4])
    assert "YES" == HumanEval.candidate([1, 2, 3, 4], [2, 1, 4, 3])
    assert "YES" == HumanEval.candidate([5, 7, 3], [2, 6, 4])
    assert "NO" == HumanEval.candidate([5, 7, 3], [2, 6, 3])
    assert "NO" == HumanEval.candidate([3, 2, 6, 1, 8, 9], [3, 5, 5, 1, 1, 1])
    assert "YES" == HumanEval.candidate([100, 200], [200, 200])
  end
end


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

defmodule HumanEval do
  def candidate(test), do: histogram(test)
  def histogram(test) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'histogram' do
    assert %{"a" => 2, "b" => 2} == HumanEval.candidate("a b b a")
    assert %{"a" => 2, "b" => 2} == HumanEval.candidate("a b c a b")
    assert %{"a" => 1, "b" => 1, "c" => 1, "d" => 1, "g" => 1} == HumanEval.candidate("a b c d g")
    assert %{"r" => 1, "t" => 1, "g" => 1} == HumanEval.candidate("r t g")
    assert %{"b" => 4} == HumanEval.candidate("b b b b a")
    assert %{"r" => 1, "t" => 1, "g" => 1} == HumanEval.candidate("r t g")
    assert %{} == HumanEval.candidate("")
    assert %{"a" => 1} == HumanEval.candidate("a")
  end
end


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

defmodule HumanEval do
  def candidate(s, c), do: reverse_delete(s, c)
  def reverse_delete(s, c) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'reverse_delete' do
    assert {"bcd", false} == HumanEval.candidate("abcde", "ae")
    assert {"acdef", false} == HumanEval.candidate("abcdef", "b")
    assert {"cdedc", true} == HumanEval.candidate("abcdedcba", "ab")
    assert {"dik", false} == HumanEval.candidate("dwik", "w")
    assert {"", true} == HumanEval.candidate("a", "a")
    assert {"abcdedcba", true} == HumanEval.candidate("abcdedcba", "")
    assert {"abcdedcba", true} == HumanEval.candidate("abcdedcba", "v")
    assert {"abba", true} == HumanEval.candidate("vabba", "v")
    assert {"", true} == HumanEval.candidate("mamma", "mia")
  end
end


Prompt:
# Given a list of strings, where each string consists of only digits, return a list.
# Each element i of the output should be "the number of odd elements in the
# string i of the input." where all the i's should be replaced by the number
# of odd digits in the i'th string of the input.
# >>> HumanEval.odd_count(["1234567"])
# ["the number of odd elements 4n the str4ng 4 of the 4nput."]
# >>> HumanEval.odd_count(["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."]

defmodule HumanEval do
  def candidate(lst), do: odd_count(lst)
  def odd_count(lst) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'odd_count' do
    assert ["the number of odd elements 4n the str4ng 4 of the 4nput."] == HumanEval.candidate(["1234567"])
    assert ["the number of odd elements 1n the str1ng 1 of the 1nput.", "the number of odd elements 8n the str8ng 8 of the 8nput."] == HumanEval.candidate(["3", "11111111"])
    assert ["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."] == HumanEval.candidate(["271", "137", "314"])
  end
end


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

defmodule HumanEval do
  def candidate(nums), do: minSubArraySum(nums)
  def minSubArraySum(nums) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'minSubArraySum' do
    assert 1 == HumanEval.candidate([2, 3, 4, 1, 2, 4])
    assert -6 == HumanEval.candidate([-1, -2, -3])
    assert -14 == HumanEval.candidate([-1, -2, -3, 2, -10])
    assert -9999999999999999 == HumanEval.candidate([-9999999999999999])
    assert 0 == HumanEval.candidate([0, 10, 20, 1000000])
    assert -6 == HumanEval.candidate([-1, -2, -3, 10, -5])
    assert -6 == HumanEval.candidate([100, -1, -2, -3, 10, -5])
    assert 3 == HumanEval.candidate([10, 11, 13, 8, 3, 4])
    assert -33 == HumanEval.candidate([100, -33, 32, -1, 0, -2])
    assert -10 == HumanEval.candidate([-10])
    assert 7 == HumanEval.candidate([7])
    assert -1 == HumanEval.candidate([1, -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:
# >>> HumanEval.max_fill([[0, 0, 1, 0], [0, 1, 0, 0], [1, 1, 1, 1]], 1)
# 6
# Example 2:
# >>> HumanEval.max_fill([[0, 0, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1], [0, 1, 1, 1]], 2)
# 5
# Example 3:
# >>> HumanEval.max_fill([[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

defmodule HumanEval do
  def candidate(grid, capacity), do: max_fill(grid, capacity)
  def max_fill(grid, capacity) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'max_fill' do
    assert 6 == HumanEval.candidate([[0, 0, 1, 0], [0, 1, 0, 0], [1, 1, 1, 1]], 1)
    assert 5 == HumanEval.candidate([[0, 0, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1], [0, 1, 1, 1]], 2)
    assert 0 == HumanEval.candidate([[0, 0, 0], [0, 0, 0]], 5)
    assert 4 == HumanEval.candidate([[1, 1, 1, 1], [1, 1, 1, 1]], 2)
    assert 2 == HumanEval.candidate([[1, 1, 1, 1], [1, 1, 1, 1]], 9)
  end
end


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

defmodule HumanEval do
  def candidate(arr), do: sort_array(arr)
  def sort_array(arr) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'sort_array' do
    assert [1, 2, 4, 3, 5] == HumanEval.candidate([1, 5, 2, 3, 4])
    assert [-4, -2, -6, -5, -3] == HumanEval.candidate([-2, -3, -4, -5, -6])
    assert [0, 1, 2, 4, 3] == HumanEval.candidate([1, 0, 2, 3, 4])
    assert [] == HumanEval.candidate([])
    assert [2, 2, 4, 4, 3, 3, 5, 5, 5, 7, 77] == HumanEval.candidate([2, 5, 77, 4, 5, 3, 5, 7, 2, 3, 4])
    assert [32, 3, 5, 6, 12, 44] == HumanEval.candidate([3, 6, 44, 12, 32, 5])
    assert [2, 4, 8, 16, 32] == HumanEval.candidate([2, 4, 8, 16, 32])
    assert [2, 4, 8, 16, 32] == HumanEval.candidate([2, 4, 8, 16, 32])
  end
end


Prompt:
# Given a string s and a natural number n, you have been tasked to implement
# a function that returns a list of all words from string s that contain exactly
# n consonants, in order these words appear in the string s.
# If the string s is empty then the function should return an empty list.
# Note: you may assume the input string contains only letters and spaces.
# Examples:
# >>> HumanEval.select_words("Mary had a little lamb", 4)
# ["little"]
# >>> HumanEval.select_words("Mary had a little lamb", 3)
# ["Mary", "lamb"]
# >>> HumanEval.select_words("simple white space", 2)
# []
# >>> HumanEval.select_words("Hello world", 4)
# ["world"]
# >>> HumanEval.select_words("Uncle sam", 3)
# ["Uncle"]

defmodule HumanEval do
  def candidate(s, n), do: select_words(s, n)
  def select_words(s, n) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'select_words' do
    assert ["little"] == HumanEval.candidate("Mary had a little lamb", 4)
    assert ["Mary", "lamb"] == HumanEval.candidate("Mary had a little lamb", 3)
    assert [] == HumanEval.candidate("simple white space", 2)
    assert ["world"] == HumanEval.candidate("Hello world", 4)
    assert ["Uncle"] == HumanEval.candidate("Uncle sam", 3)
    assert [] == HumanEval.candidate("", 4)
    assert ["b", "c", "d", "f"] == HumanEval.candidate("a b c d e f", 1)
  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:
# >>> HumanEval.get_closest_vowel("yogurt")
# "u"
# >>> HumanEval.get_closest_vowel("FULL")
# "U"
# >>> HumanEval.get_closest_vowel("quick")
# ""
# >>> HumanEval.get_closest_vowel("ab")
# ""

defmodule HumanEval do
  def candidate(word), do: get_closest_vowel(word)
  def get_closest_vowel(word) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'get_closest_vowel' do
    assert "u" == HumanEval.candidate("yogurt")
    assert "u" == HumanEval.candidate("full")
    assert "" == HumanEval.candidate("easy")
    assert "" == HumanEval.candidate("eAsy")
    assert "" == HumanEval.candidate("ali")
    assert "a" == HumanEval.candidate("bad")
    assert "o" == HumanEval.candidate("most")
    assert "" == HumanEval.candidate("ab")
    assert "" == HumanEval.candidate("ba")
    assert "" == HumanEval.candidate("quick")
    assert "i" == HumanEval.candidate("anime")
    assert "" == HumanEval.candidate("Asia")
    assert "o" == HumanEval.candidate("Above")
  end
end


Prompt:
# You are given a list of two strings, both strings consist of open
# parentheses '(' or close parentheses ')' only.
# Your job is to check if it is possible to concatenate the two strings in
# some order, that the resulting string will be good.
# A string S is considered to be good if and only if all 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:
# >>> HumanEval.match_parens(["()(", ")"])
# "Yes"
# >>> HumanEval.match_parens([")", ")"])
# "No"

defmodule HumanEval do
  def candidate(lst), do: match_parens(lst)
  def match_parens(lst) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'match_parens' do
    assert "Yes" == HumanEval.candidate(["()(", ")"])
    assert "No" == HumanEval.candidate([")", ")"])
    assert "No" == HumanEval.candidate(["(()(())", "())())"])
    assert "Yes" == HumanEval.candidate([")())", "(()()("])
    assert "Yes" == HumanEval.candidate(["(())))", "(()())(("])
    assert "No" == HumanEval.candidate(["()", "())"])
    assert "Yes" == HumanEval.candidate(["(()(", "()))()"])
    assert "No" == HumanEval.candidate(["((((", "((())"])
    assert "No" == HumanEval.candidate([")(()", "(()("])
    assert "No" == HumanEval.candidate([")(", ")("])
    assert "Yes" == HumanEval.candidate(["(", ")"])
    assert "Yes" == HumanEval.candidate([")", "("])
  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.
# >>> HumanEval.string_xor("010", "110")
# "100"

defmodule HumanEval do
  def candidate(a, b), do: string_xor(a, b)
  def string_xor(a, b) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'string_xor' do
    assert "010010" == HumanEval.candidate("111000", "101010")
    assert "0" == HumanEval.candidate("1", "1")
    assert "0101" == HumanEval.candidate("0101", "0000")
  end
end


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

defmodule HumanEval do
  def candidate(arr, k), do: maximum(arr, k)
  def maximum(arr, k) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'maximum' do
    assert [-4, -3, 5] == HumanEval.candidate([-3, -4, 5], 3)
    assert [4, 4] == HumanEval.candidate([4, -4, 4], 2)
    assert [2] == HumanEval.candidate([-3, 2, 1, 2, -1, -2, 1], 1)
    assert [2, 20, 123] == HumanEval.candidate([123, -123, 20, 0, 1, 2, -3], 3)
    assert [0, 1, 2, 20] == HumanEval.candidate([-123, 20, 0, 1, 2, -3], 4)
    assert [-13, -8, 0, 0, 3, 5, 15] == HumanEval.candidate([5, 15, 0, 3, -13, -8, 0], 7)
    assert [3, 5] == HumanEval.candidate([-1, 0, 2, 5, 3, -10], 2)
    assert [5] == HumanEval.candidate([1, 0, 5, -7], 1)
    assert [-4, 4] == HumanEval.candidate([4, -4], 2)
    assert [-10, 10] == HumanEval.candidate([-10, 10], 2)
    assert [] == HumanEval.candidate([1, 2, 3, -23, 243, -400, 0], 0)
  end
end


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

defmodule HumanEval do
  def candidate(lst), do: solution(lst)
  def solution(lst) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'solution' do
    assert 12 == HumanEval.candidate([5, 8, 7, 1])
    assert 9 == HumanEval.candidate([3, 3, 3, 3, 3])
    assert 0 == HumanEval.candidate([30, 13, 24, 321])
    assert 5 == HumanEval.candidate([5, 9])
    assert 0 == HumanEval.candidate([2, 4, 8])
    assert 23 == HumanEval.candidate([30, 13, 23, 32])
    assert 3 == HumanEval.candidate([3, 13, 2, 9])
  end
end


Prompt:
# Given a non-empty list 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:
# >>> HumanEval.add_elements([111, 21, 3, 4000, 5, 6, 7, 8, 9], 4)
# 24
# Constraints:
# 1. 1 <= len(arr) <= 100
# 2. 1 <= k <= len(arr)

defmodule HumanEval do
  def candidate(arr, k), do: add_elements(arr, k)
  def add_elements(arr, k) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'add_elements' do
    assert -4 == HumanEval.candidate([1, -2, -3, 41, 57, 76, 87, 88, 99], 3)
    assert 0 == HumanEval.candidate([111, 121, 3, 4000, 5, 6], 2)
    assert 125 == HumanEval.candidate([11, 21, 3, 90, 5, 6, 7, 8, 9], 4)
    assert 24 == HumanEval.candidate([111, 21, 3, 4000, 5, 6, 7, 8, 9], 4)
    assert 1 == HumanEval.candidate([1], 1)
  end
end


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

defmodule HumanEval do
  def candidate(n), do: get_odd_collatz(n)
  def get_odd_collatz(n) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'get_odd_collatz' do
    assert [1, 5, 7, 11, 13, 17] == HumanEval.candidate(14)
    assert [1, 5] == HumanEval.candidate(5)
    assert [1, 3, 5] == HumanEval.candidate(12)
    assert [1] == HumanEval.candidate(1)
  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
# >>> HumanEval.valid_date("03-11-2000")
# true
# >>> HumanEval.valid_date("15-01-2012")
# false
# >>> HumanEval.valid_date("04-0-2040")
# false
# >>> HumanEval.valid_date("06-04-2020")
# true
# >>> HumanEval.valid_date("06/04/2020")
# false

defmodule HumanEval do
  def candidate(date), do: valid_date(date)
  def valid_date(date) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'valid_date' do
    assert true == HumanEval.candidate("03-11-2000")
    assert false == HumanEval.candidate("15-01-2012")
    assert false == HumanEval.candidate("04-0-2040")
    assert true == HumanEval.candidate("06-04-2020")
    assert true == HumanEval.candidate("01-01-2007")
    assert false == HumanEval.candidate("03-32-2011")
    assert false == HumanEval.candidate("")
    assert false == HumanEval.candidate("04-31-3000")
    assert true == HumanEval.candidate("06-06-2005")
    assert false == HumanEval.candidate("21-31-2000")
    assert true == HumanEval.candidate("04-12-2003")
    assert false == HumanEval.candidate("04122003")
    assert false == HumanEval.candidate("20030412")
    assert false == HumanEval.candidate("2003-04")
    assert false == HumanEval.candidate("2003-04-12")
    assert false == HumanEval.candidate("04-2003")
  end
end


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

defmodule HumanEval do
  def candidate(txt), do: split_words(txt)
  def split_words(txt) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'split_words' do
    assert ["Hello", "world!"] == HumanEval.candidate("Hello world!")
    assert ["Hello", "world!"] == HumanEval.candidate("Hello,world!")
    assert ["Hello", "world,!"] == HumanEval.candidate("Hello world,!")
    assert ["Hello,Hello,world", "!"] == HumanEval.candidate("Hello,Hello,world !")
    assert 3 == HumanEval.candidate("abcdef")
    assert 2 == HumanEval.candidate("aaabb")
    assert 1 == HumanEval.candidate("aaaBb")
    assert 0 == HumanEval.candidate("")
  end
end


Prompt:
# Given a list of numbers, return whether or not they are sorted
# in ascending order. If list has more than 1 duplicate of the same
# number, return false. Assume no negative numbers and only integers.
# Examples
# >>> HumanEval.is_sorted([5])
# true
# >>> HumanEval.is_sorted([1, 2, 3, 4, 5])
# true
# >>> HumanEval.is_sorted([1, 3, 2, 4, 5])
# false
# >>> HumanEval.is_sorted([1, 2, 3, 4, 5, 6])
# true
# >>> HumanEval.is_sorted([1, 2, 3, 4, 5, 6, 7])
# true
# >>> HumanEval.is_sorted([1, 3, 2, 4, 5, 6, 7])
# false
# >>> HumanEval.is_sorted([1, 2, 2, 3, 3, 4])
# true
# >>> HumanEval.is_sorted([1, 2, 2, 2, 3, 4])
# false

defmodule HumanEval do
  def candidate(lst), do: is_sorted(lst)
  def is_sorted(lst) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'is_sorted' do
    assert true == HumanEval.candidate([5])
    assert true == HumanEval.candidate([1, 2, 3, 4, 5])
    assert false == HumanEval.candidate([1, 3, 2, 4, 5])
    assert true == HumanEval.candidate([1, 2, 3, 4, 5, 6])
    assert true == HumanEval.candidate([1, 2, 3, 4, 5, 6, 7])
    assert false == HumanEval.candidate([1, 3, 2, 4, 5, 6, 7])
    assert true == HumanEval.candidate([])
    assert true == HumanEval.candidate([1])
    assert false == HumanEval.candidate([3, 2, 1])
    assert false == HumanEval.candidate([1, 2, 2, 2, 3, 4])
    assert false == HumanEval.candidate([1, 2, 3, 3, 3, 4])
    assert true == HumanEval.candidate([1, 2, 2, 3, 3, 4])
    assert true == HumanEval.candidate([1, 2, 3, 4])
  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:
# >>> HumanEval.intersection({1, 2}, {2, 3})
# "NO"
# >>> HumanEval.intersection({-1, 1}, {0, 4})
# "NO"
# >>> HumanEval.intersection({-3, -1}, {-5, 5})
# "YES"

defmodule HumanEval do
  def candidate(interval1, interval2), do: intersection(interval1, interval2)
  def intersection(interval1, interval2) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'intersection' do
    assert "NO" == HumanEval.candidate({1, 2}, {2, 3})
    assert "NO" == HumanEval.candidate({-1, 1}, {0, 4})
    assert "YES" == HumanEval.candidate({-3, -1}, {-5, 5})
    assert "YES" == HumanEval.candidate({-2, 2}, {-4, 0})
    assert "NO" == HumanEval.candidate({-11, 2}, {-1, -1})
    assert "NO" == HumanEval.candidate({1, 2}, {3, 5})
    assert "NO" == HumanEval.candidate({1, 2}, {1, 2})
    assert "NO" == HumanEval.candidate({-2, -2}, {-3, -2})
  end
end


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

defmodule HumanEval do
  def candidate(arr), do: prod_signs(arr)
  def prod_signs(arr) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'prod_signs' do
    assert -9 == HumanEval.candidate([1, 2, 2, -4])
    assert 0 == HumanEval.candidate([0, 1])
    assert -10 == HumanEval.candidate([1, 1, 1, 2, 3, -1, 1])
    assert nil == HumanEval.candidate([])
    assert 20 == HumanEval.candidate([2, 4, 1, 2, -1, -1, 9])
    assert 4 == HumanEval.candidate([-1, 1, -1, 1])
    assert -4 == HumanEval.candidate([-1, 1, 1, 1])
    assert 0 == HumanEval.candidate([-1, 1, 1, 0])
  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 lists 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 list of the values on the cells that the minimum path go through.
# Examples:
# >>> HumanEval.minPath([[1, 2, 3], [4, 5, 6], [7, 8, 9]], 3)
# [1, 2, 1]
# >>> HumanEval.minPath([[5, 9, 3], [4, 1, 6], [7, 8, 2]], 1)
# [1]

defmodule HumanEval do
  def candidate(grid, k), do: minPath(grid, k)
  def minPath(grid, k) do


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

defmodule HumanEval do
  def candidate(strings), do: longest(strings)
  def longest(strings) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'longest' do
    assert nil == HumanEval.candidate([])
    assert "x" == HumanEval.candidate(["x", "y", "z"])
    assert "zzzz" == HumanEval.candidate(["x", "yyy", "zzzz", "www", "kkkk", "abc"])
  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 a list of the
# first n + 1 numbers of the Tribonacci sequence.
# Examples:
# >>> HumanEval.tri(3)
# [1, 3, 2, 8]

defmodule HumanEval do
  def candidate(n), do: tri(n)
  def tri(n) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'tri' do
    assert [1, 3, 2, 8] == HumanEval.candidate(3)
    assert [1, 3, 2, 8, 3] == HumanEval.candidate(4)
    assert [1, 3, 2, 8, 3, 15] == HumanEval.candidate(5)
    assert [1, 3, 2, 8, 3, 15, 4] == HumanEval.candidate(6)
    assert [1, 3, 2, 8, 3, 15, 4, 24] == HumanEval.candidate(7)
    assert [1, 3, 2, 8, 3, 15, 4, 24, 5] == HumanEval.candidate(8)
    assert [1, 3, 2, 8, 3, 15, 4, 24, 5, 35] == HumanEval.candidate(9)
    assert [1, 3, 2, 8, 3, 15, 4, 24, 5, 35, 6, 48, 7, 63, 8, 80, 9, 99, 10, 120, 11] == HumanEval.candidate(20)
    assert [1] == HumanEval.candidate(0)
    assert [1, 3] == HumanEval.candidate(1)
  end
end


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

defmodule HumanEval do
  def candidate(n), do: digits(n)
  def digits(n) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'digits' do
    assert 5 == HumanEval.candidate(5)
    assert 5 == HumanEval.candidate(54)
    assert 1 == HumanEval.candidate(120)
    assert 5 == HumanEval.candidate(5014)
    assert 315 == HumanEval.candidate(98765)
    assert 2625 == HumanEval.candidate(5576543)
    assert 0 == HumanEval.candidate(2468)
  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.
# >>> HumanEval.is_nested("[[]]")
# true
# >>> HumanEval.is_nested("[]]]]]]][[[[[]")
# false
# >>> HumanEval.is_nested("[][]")
# false
# >>> HumanEval.is_nested("[]")
# false
# >>> HumanEval.is_nested("[[][]]")
# true
# >>> HumanEval.is_nested("[[]][[")
# true

defmodule HumanEval do
  def candidate(string), do: is_nested(string)
  def is_nested(string) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'is_nested' do
    assert true == HumanEval.candidate("[[]]")
    assert false == HumanEval.candidate("[]]]]]]][[[[[]")
    assert false == HumanEval.candidate("[][]")
    assert false == HumanEval.candidate("[]")
    assert true == HumanEval.candidate("[[[[]]]]")
    assert false == HumanEval.candidate("[]]]]]]]]]]")
    assert true == HumanEval.candidate("[][][[]]")
    assert false == HumanEval.candidate("[[]")
    assert false == HumanEval.candidate("[]]")
    assert true == HumanEval.candidate("[[]][[")
    assert true == HumanEval.candidate("[[][]]")
    assert false == HumanEval.candidate("")
    assert false == HumanEval.candidate("[[[[[[[[")
    assert false == HumanEval.candidate("]]]]]]]]")
  end
end


Prompt:
# You are given a list of numbers.
# You need to return the sum of squared numbers in the given list,
# round each element in the list to the upper int(Ceiling) first.
# Examples:
# >>> HumanEval.lst([1.0, 2.0, 3.0])
# 14
# >>> HumanEval.lst([1.0, 4.0, 9.0])
# 98
# >>> HumanEval.lst([1.0, 3.0, 5.0, 7.0])
# 84
# >>> HumanEval.lst([1.4, 4.2, 0.0])
# 29
# >>> HumanEval.lst([-2.4, 1.0, 1.0])
# 6

defmodule HumanEval do
  def candidate(lst), do: sum_squares(lst)
  def sum_squares(lst) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'sum_squares' do
    assert 14 == HumanEval.candidate([1.0, 2.0, 3.0])
    assert 14 == HumanEval.candidate([1.0, 2.0, 3.0])
    assert 84 == HumanEval.candidate([1.0, 3.0, 5.0, 7.0])
    assert 29 == HumanEval.candidate([1.4, 4.2, 0.0])
    assert 6 == HumanEval.candidate([-2.4, 1.0, 1.0])
    assert 10230 == HumanEval.candidate([100.0, 1.0, 15.0, 2.0])
    assert 200000000 == HumanEval.candidate([10000.0, 10000.0])
    assert 75 == HumanEval.candidate([-1.4, 4.6, 6.3])
    assert 1086 == HumanEval.candidate([-1.4, 17.9, 18.9, 19.9])
    assert 0 == HumanEval.candidate([0.0])
    assert 1 == HumanEval.candidate([-1.0])
    assert 2 == HumanEval.candidate([-1.0, 1.0, 0.0])
  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:
# >>> HumanEval.check_if_last_char_is_a_letter("apple pie")
# false
# >>> HumanEval.check_if_last_char_is_a_letter("apple pi e")
# true
# >>> HumanEval.check_if_last_char_is_a_letter("apple pi e ")
# false
# >>> HumanEval.check_if_last_char_is_a_letter("")
# false

defmodule HumanEval do
  def candidate(txt), do: check_if_last_char_is_a_letter(txt)
  def check_if_last_char_is_a_letter(txt) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'check_if_last_char_is_a_letter' do
    assert false == HumanEval.candidate("apple")
    assert true == HumanEval.candidate("apple pi e")
    assert false == HumanEval.candidate("eeeee")
    assert true == HumanEval.candidate("A")
    assert false == HumanEval.candidate("Pumpkin pie ")
    assert false == HumanEval.candidate("Pumpkin pie 1")
    assert false == HumanEval.candidate("")
    assert false == HumanEval.candidate("eeeee e ")
    assert false == HumanEval.candidate("apple pie")
    assert false == HumanEval.candidate("apple pi e ")
  end
end


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

defmodule HumanEval do
  def candidate(arr), do: can_arrange(arr)
  def can_arrange(arr) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'can_arrange' do
    assert 3 == HumanEval.candidate([1, 2, 4, 3, 5])
    assert -1 == HumanEval.candidate([1, 2, 4, 5])
    assert 2 == HumanEval.candidate([1, 4, 2, 5, 6, 7, 8, 9, 10])
    assert 4 == HumanEval.candidate([4, 8, 5, 7, 3])
    assert -1 == HumanEval.candidate([])
  end
end


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

defmodule HumanEval do
  def candidate(lst), do: largest_smallest_integers(lst)
  def largest_smallest_integers(lst) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'largest_smallest_integers' do
    assert {nil, 1} == HumanEval.candidate([2, 4, 1, 3, 5, 7])
    assert {nil, 1} == HumanEval.candidate([2, 4, 1, 3, 5, 7, 0])
    assert {-2, 1} == HumanEval.candidate([1, 3, 2, 4, 5, 6, -2])
    assert {-7, 2} == HumanEval.candidate([4, 5, 3, 6, 2, 7, -7])
    assert {-9, 2} == HumanEval.candidate([7, 3, 8, 4, 9, 2, 5, -9])
    assert {nil, nil} == HumanEval.candidate([])
    assert {nil, nil} == HumanEval.candidate([0])
    assert {-1, nil} == HumanEval.candidate([-1, -3, -5, -6])
    assert {-1, nil} == HumanEval.candidate([-1, -3, -5, -6, 0])
    assert {-3, 1} == HumanEval.candidate([-6, -4, -4, -3, 1])
    assert {-3, 1} == HumanEval.candidate([-6, -4, -4, -3, -100, 1])
  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 ,
# >>> HumanEval.compare_one(1, 2.5)
# 2.5
# >>> HumanEval.compare_one(1, "2,3")
# "2,3"
# >>> HumanEval.compare_one("5,1", "6")
# "6"
# >>> HumanEval.compare_one("1", 1)
# nil

defmodule HumanEval do
  def candidate(a, b), do: compare_one(a, b)
  def compare_one(a, b) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'compare_one' do
    assert 2 == HumanEval.candidate(1, 2)
    assert 2.5 == HumanEval.candidate(1, 2.5)
    assert 3 == HumanEval.candidate(2, 3)
    assert 6 == HumanEval.candidate(5, 6)
    assert "2,3" == HumanEval.candidate(1, "2,3")
    assert "6" == HumanEval.candidate("5,1", "6")
    assert "2" == HumanEval.candidate("1", "2")
    assert nil == HumanEval.candidate("1", 1)
  end
end


Prompt:
# Evaluate whether the given number n can be written as the sum of exactly 4 positive even numbers
# Example
# >>> HumanEval.is_equal_to_sum_even(4)
# false
# >>> HumanEval.is_equal_to_sum_even(6)
# false
# >>> HumanEval.is_equal_to_sum_even(8)
# true

defmodule HumanEval do
  def candidate(n), do: is_equal_to_sum_even(n)
  def is_equal_to_sum_even(n) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'is_equal_to_sum_even' do
    assert false == HumanEval.candidate(4)
    assert false == HumanEval.candidate(6)
    assert true == HumanEval.candidate(8)
    assert true == HumanEval.candidate(10)
    assert false == HumanEval.candidate(11)
    assert true == HumanEval.candidate(12)
    assert false == HumanEval.candidate(13)
    assert true == HumanEval.candidate(16)
  end
end


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

defmodule HumanEval do
  def candidate(n), do: special_factorial(n)
  def special_factorial(n) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'special_factorial' do
    assert 288 == HumanEval.candidate(4)
    assert 34560 == HumanEval.candidate(5)
    assert 125411328000 == HumanEval.candidate(7)
    assert 1 == HumanEval.candidate(1)
  end
end


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

defmodule HumanEval do
  def candidate(a, b), do: greatest_common_divisor(a, b)
  def greatest_common_divisor(a, b) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'greatest_common_divisor' do
    assert 1 == HumanEval.candidate(3, 7)
    assert 5 == HumanEval.candidate(10, 15)
    assert 7 == HumanEval.candidate(49, 14)
    assert 12 == HumanEval.candidate(144, 60)
  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 -
# >>> HumanEval.fix_spaces(" Example")
# "Example"
# >>> HumanEval.fix_spaces(" Example 1")
# "Example_1"
# >>> HumanEval.fix_spaces(" Example 2")
# "_Example_2"
# >>> HumanEval.fix_spaces(" Example 3")
# "_Example-3"

defmodule HumanEval do
  def candidate(text), do: fix_spaces(text)
  def fix_spaces(text) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'fix_spaces' do
    assert "Example" == HumanEval.candidate("Example")
    assert "Mudasir_Hanif_" == HumanEval.candidate("Mudasir Hanif ")
    assert "Yellow_Yellow__Dirty__Fellow" == HumanEval.candidate("Yellow Yellow  Dirty  Fellow")
    assert "Exa-mple" == HumanEval.candidate("Exa   mple")
    assert "-Exa_1_2_2_mple" == HumanEval.candidate("   Exa 1 2 2 mple")
  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:
# >>> HumanEval.file_name_check("example.txt")
# "Yes"
# >>> HumanEval.file_name_check("1example.dll")
# "No"

defmodule HumanEval do
  def candidate(file_name), do: file_name_check(file_name)
  def file_name_check(file_name) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'file_name_check' do
    assert "Yes" == HumanEval.candidate("example.txt")
    assert "No" == HumanEval.candidate("1example.dll")
    assert "No" == HumanEval.candidate("s1sdf3.asd")
    assert "Yes" == HumanEval.candidate("K.dll")
    assert "Yes" == HumanEval.candidate("MY16FILE3.exe")
    assert "No" == HumanEval.candidate("His12FILE94.exe")
    assert "No" == HumanEval.candidate("_Y.txt")
    assert "No" == HumanEval.candidate("?aREYA.exe")
    assert "No" == HumanEval.candidate("/this_is_valid.dll")
    assert "No" == HumanEval.candidate("this_is_valid.wow")
    assert "Yes" == HumanEval.candidate("this_is_valid.txt")
    assert "No" == HumanEval.candidate("this_is_valid.txtexe")
    assert "No" == HumanEval.candidate("#this2_i4s_5valid.ten")
    assert "No" == HumanEval.candidate("@this1_is6_valid.exe")
    assert "No" == HumanEval.candidate("this_is_12valid.6exe4.txt")
    assert "No" == HumanEval.candidate("all.exe.txt")
    assert "Yes" == HumanEval.candidate("I563_No.exe")
    assert "Yes" == HumanEval.candidate("Is3youfault.txt")
    assert "Yes" == HumanEval.candidate("no_one#knows.dll")
    assert "No" == HumanEval.candidate("1I563_Yes3.exe")
    assert "No" == HumanEval.candidate("I563_Yes3.txtt")
    assert "No" == HumanEval.candidate("final..txt")
    assert "No" == HumanEval.candidate("final132")
    assert "No" == HumanEval.candidate("_f4indsartal132.")
    assert "No" == HumanEval.candidate(".txt")
    assert "No" == HumanEval.candidate("s.")
  end
end


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

defmodule HumanEval do
  def candidate(lst), do: sum_squares(lst)
  def sum_squares(lst) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'sum_squares' do
    assert 6 == HumanEval.candidate([1, 2, 3])
    assert 14 == HumanEval.candidate([1, 4, 9])
    assert 0 == HumanEval.candidate([])
    assert 9 == HumanEval.candidate([1, 1, 1, 1, 1, 1, 1, 1, 1])
    assert -3 == HumanEval.candidate([-1, -1, -1, -1, -1, -1, -1, -1, -1])
    assert 0 == HumanEval.candidate([0])
    assert -126 == HumanEval.candidate([-1, -5, 2, -1, -5])
    assert 3030 == HumanEval.candidate([-56, -99, 1, 0, -2])
    assert 0 == HumanEval.candidate([-1, 0, 0, 0, 0, 0, 0, 0, -1])
    assert -14196 == HumanEval.candidate([-16, -9, -2, 36, 36, 26, -20, 25, -40, 20, -4, 12, -26, 35, 37])
    assert -1448 == HumanEval.candidate([-1, -3, 17, -1, -15, 13, -1, 14, -14, -12, -5, 14, -14, 6, 13, 11, 16, 16, 4, 10])
  end
end


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

defmodule HumanEval do
  def candidate(sentence), do: words_in_sentence(sentence)
  def words_in_sentence(sentence) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'words_in_sentence' do
    assert "is" == HumanEval.candidate("This is a test")
    assert "go for" == HumanEval.candidate("lets go for swimming")
    assert "there is no place" == HumanEval.candidate("there is no place available here")
    assert "Hi am Hussein" == HumanEval.candidate("Hi I am Hussein")
    assert "go for it" == HumanEval.candidate("go for it")
    assert "" == HumanEval.candidate("here")
    assert "is" == HumanEval.candidate("here is")
  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.
# >>> HumanEval.simplify("1/5", "5/1")
# true
# >>> HumanEval.simplify("1/6", "2/1")
# false
# >>> HumanEval.simplify("7/10", "10/2")
# false

defmodule HumanEval do
  def candidate(x, n), do: simplify(x, n)
  def simplify(x, n) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'simplify' do
    assert true == HumanEval.candidate("1/5", "5/1")
    assert false == HumanEval.candidate("1/6", "2/1")
    assert true == HumanEval.candidate("5/1", "3/1")
    assert false == HumanEval.candidate("7/10", "10/2")
    assert true == HumanEval.candidate("2/10", "50/10")
    assert true == HumanEval.candidate("7/2", "4/2")
    assert true == HumanEval.candidate("11/6", "6/1")
    assert false == HumanEval.candidate("2/3", "5/2")
    assert false == HumanEval.candidate("5/2", "3/5")
    assert true == HumanEval.candidate("2/4", "8/4")
    assert true == HumanEval.candidate("2/4", "4/2")
    assert true == HumanEval.candidate("1/5", "5/1")
    assert false == HumanEval.candidate("1/5", "1/5")
  end
end


Prompt:
# Write a function which sorts the given list of integers
# in ascending order according to the sum of their digits.
# Note: if there are several items with similar sum of their digits,
# order them based on their index in original list.
# For example:
# >>> HumanEval.order_by_points([1, 11, -1, -11, -12])
# [-1, -11, 1, -12, 11]
# >>> HumanEval.order_by_points([])
# []

defmodule HumanEval do
  def candidate(nums), do: order_by_points(nums)
  def order_by_points(nums) do


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

defmodule HumanEval do
  def candidate(nums), do: specialFilter(nums)
  def specialFilter(nums) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'specialFilter' do
    assert 0 == HumanEval.candidate([5, -2, 1, -5])
    assert 1 == HumanEval.candidate([15, -73, 14, -15])
    assert 2 == HumanEval.candidate([33, -2, -3, 45, 21, 109])
    assert 4 == HumanEval.candidate([43, -12, 93, 125, 121, 109])
    assert 3 == HumanEval.candidate([71, -2, -33, 75, 21, 19])
    assert 0 == HumanEval.candidate([1])
    assert 0 == HumanEval.candidate([])
  end
end


Prompt:
# You are given a positive integer n. You have to create an integer list 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 :
# >>> HumanEval.get_max_triples(5)
# 1
# Explanation:
# a = [1, 3, 7, 13, 21]
# The only valid triple is (1, 7, 13).

defmodule HumanEval do
  def candidate(n), do: get_max_triples(n)
  def get_max_triples(n) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'get_max_triples' do
    assert 1 == HumanEval.candidate(5)
    assert 4 == HumanEval.candidate(6)
    assert 36 == HumanEval.candidate(10)
    assert 53361 == HumanEval.candidate(100)
  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 a tuple 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 tuple if planet1 or planet2
# are not correct planet names.
# Examples
# >>> HumanEval.bf("Jupiter", "Neptune")
# {"Saturn", "Uranus"}
# >>> HumanEval.bf("Earth", "Mercury")
# "Venus"
# >>> HumanEval.bf("Mercury", "Uranus")
# {"Venus", "Earth", "Mars", "Jupiter", "Saturn"}

defmodule HumanEval do
  def candidate(planet1, planet2), do: bf(planet1, planet2)
  def bf(planet1, planet2) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'bf' do
    assert {"Saturn", "Uranus"} == HumanEval.candidate("Jupiter", "Neptune")
    assert {"Venus"} == HumanEval.candidate("Earth", "Mercury")
    assert {"Venus", "Earth", "Mars", "Jupiter", "Saturn"} == HumanEval.candidate("Mercury", "Uranus")
    assert {"Earth", "Mars", "Jupiter", "Saturn", "Uranus"} == HumanEval.candidate("Neptune", "Venus")
    assert {} == HumanEval.candidate("Earth", "Earth")
    assert {} == HumanEval.candidate("Mars", "Earth")
    assert {} == HumanEval.candidate("Jupiter", "Makemake")
  end
end


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

defmodule HumanEval do
  def candidate(lst), do: sorted_list_sum(lst)
  def sorted_list_sum(lst) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'sorted_list_sum' do
    assert ["aa"] == HumanEval.candidate(["aa", "a", "aaa"])
    assert ["AI", "asdf", "school"] == HumanEval.candidate(["school", "AI", "asdf", "b"])
    assert [] == HumanEval.candidate(["d", "b", "c", "a"])
    assert ["abcd", "dcba"] == HumanEval.candidate(["d", "dcba", "abcd", "a"])
    assert ["AI", "ai", "au"] == HumanEval.candidate(["AI", "ai", "au"])
    assert [] == HumanEval.candidate(["a", "b", "b", "c", "c", "a"])
    assert ["cc", "dd", "aaaa", "bbbb"] == HumanEval.candidate(["aaaa", "bbbb", "dd", "cc"])
  end
end


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

defmodule HumanEval do
  def candidate(string), do: all_prefixes(string)
  def all_prefixes(string) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'all_prefixes' do
    assert [] == HumanEval.candidate("")
    assert ["a", "as", "asd", "asdf", "asdfg", "asdfgh"] == HumanEval.candidate("asdfgh")
    assert ["W", "WW", "WWW"] == HumanEval.candidate("WWW")
  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:
# >>> HumanEval.x_or_y(7, 34, 12)
# 34
# >>> HumanEval.x_or_y(15, 8, 5)
# 5

defmodule HumanEval do
  def candidate(n, x, y), do: x_or_y(n, x, y)
  def x_or_y(n, x, y) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'x_or_y' do
    assert 34 == HumanEval.candidate(7, 34, 12)
    assert 5 == HumanEval.candidate(15, 8, 5)
    assert 33 == HumanEval.candidate(3, 33, 5212)
    assert 3 == HumanEval.candidate(1259, 3, 52)
    assert -1 == HumanEval.candidate(7919, -1, 12)
    assert 583 == HumanEval.candidate(3609, 1245, 583)
    assert 129 == HumanEval.candidate(91, 56, 129)
    assert 1234 == HumanEval.candidate(6, 34, 1234)
    assert 0 == HumanEval.candidate(1, 2, 0)
    assert 2 == HumanEval.candidate(2, 2, 0)
  end
end


Prompt:
# Given a list of numbers, return the sum of squares of the numbers
# in the list that are odd. Ignore numbers that are negative or not integers.
# >>> HumanEval.double_the_difference([1, 3, 2, 0])
# 10
# >>> HumanEval.double_the_difference([-1, -2, 0])
# 0
# >>> HumanEval.double_the_difference([9, -2])
# 81
# >>> HumanEval.double_the_difference([0])
# 0
# If the input list is empty, return 0.

defmodule HumanEval do
  def candidate(lst), do: double_the_difference(lst)
  def double_the_difference(lst) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'double_the_difference' do
    assert 0 == HumanEval.candidate([])
    assert 25 == HumanEval.candidate([5.0, 4.0])
    assert 0 == HumanEval.candidate([0.1, 0.2, 0.3])
    assert 0 == HumanEval.candidate([-10.0, -20.0, -30.0])
    assert 0 == HumanEval.candidate([-1.0, -2.0, 8.0])
    assert 34 == HumanEval.candidate([0.2, 3.0, 5.0])
    assert 165 == HumanEval.candidate([-9.0, -7.0, -5.0, -3.0, -1.0, 1.0, 3.0, 5.0, 7.0, 9.0])
  end
end


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 lists of scores and guesses of equal length, where each index shows a match.
# Return a list 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:
# >>> HumanEval.compare([1, 2, 3, 4, 5, 1], [1, 2, 3, 4, 2, -2])
# [0, 0, 0, 0, 3, 3]
# >>> HumanEval.compare([0, 5, 0, 0, 0, 4], [4, 1, 1, 0, 0, -2])
# [4, 4, 1, 0, 0, 6]

defmodule HumanEval do
  def candidate(game, guess), do: compare(game, guess)
  def compare(game, guess) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'compare' do
    assert [0, 0, 0, 0, 3, 3] == HumanEval.candidate([1, 2, 3, 4, 5, 1], [1, 2, 3, 4, 2, -2])
    assert [0, 0, 0, 0, 0, 0] == HumanEval.candidate([0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0])
    assert [2, 4, 6] == HumanEval.candidate([1, 2, 3], [-1, -2, -3])
    assert [2, 0, 0, 1] == HumanEval.candidate([1, 2, 3, 5], [-1, 2, 3, 4])
  end
end


Prompt:
# You will be given the name of a class (a string) and a list of extensions.
# The extensions are to be used to load additional classes to the class. The
# strength of the extension is as follows: Let CAP be the number of the uppercase
# letters in the extension's name, and let SM be the number of lowercase 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 list.
# For example, if you are given "Slices" as the class and a list of the
# extensions: ['SErviNGSliCes', 'Cheese', 'StuFfed'] then you should
# return 'Slices.SErviNGSliCes' since 'SErviNGSliCes' is the strongest extension
# (its strength is -1).
# Example:
# >>> HumanEval.Strongest_Extension("my_class", ["AA", "Be", "CC"])
# "my_class.AA"

defmodule HumanEval do
  def candidate(class_name, extensions), do: Strongest_Extension(class_name, extensions)
  def Strongest_Extension(class_name, extensions) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'Strongest_Extension' do
    assert "Watashi.eIGHt8OKe" == HumanEval.candidate("Watashi", ["tEN", "niNE", "eIGHt8OKe"])
    assert "Boku123.YEs.WeCaNe" == HumanEval.candidate("Boku123", ["nani", "NazeDa", "YEs.WeCaNe", "32145tggg"])
    assert "__YESIMHERE.NuLl__" == HumanEval.candidate("__YESIMHERE", ["t", "eMptY", "nothing", "zeR00", "NuLl__", "123NoooneB321"])
    assert "K.TAR" == HumanEval.candidate("K", ["Ta", "TAR", "t234An", "cosSo"])
    assert "__HAHA.123" == HumanEval.candidate("__HAHA", ["Tab", "123", "781345", "-_-"])
    assert "YameRore.okIWILL123" == HumanEval.candidate("YameRore", ["HhAas", "okIWILL123", "WorkOut", "Fails", "-_-"])
    assert "finNNalLLly.WoW" == HumanEval.candidate("finNNalLLly", ["Die", "NowW", "Wow", "WoW"])
    assert "_.Bb" == HumanEval.candidate("_", ["Bb", "91245"])
    assert "Sp.671235" == HumanEval.candidate("Sp", ["671235", "Bb"])
  end
end


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

defmodule HumanEval do
  def candidate(a, b), do: cycpattern_check(a, b)
  def cycpattern_check(a, b) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'cycpattern_check' do
    assert false == HumanEval.candidate("xyzw", "xyw")
    assert true == HumanEval.candidate("yello", "ell")
    assert false == HumanEval.candidate("whattup", "ptut")
    assert true == HumanEval.candidate("efef", "fee")
    assert false == HumanEval.candidate("abab", "aabb")
    assert true == HumanEval.candidate("winemtt", "tinem")
  end
end


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

defmodule HumanEval do
  def candidate(num), do: even_odd_count(num)
  def even_odd_count(num) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'even_odd_count' do
    assert {0, 1} == HumanEval.candidate(7)
    assert {1, 1} == HumanEval.candidate(-78)
    assert {2, 2} == HumanEval.candidate(3452)
    assert {3, 3} == HumanEval.candidate(346211)
    assert {3, 3} == HumanEval.candidate(-345821)
    assert {1, 0} == HumanEval.candidate(-2)
    assert {2, 3} == HumanEval.candidate(-45347)
    assert {1, 0} == HumanEval.candidate(0)
  end
end


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

defmodule HumanEval do
  def candidate(number), do: int_to_mini_roman(number)
  def int_to_mini_roman(number) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'int_to_mini_roman' do
    assert "xix" == HumanEval.candidate(19)
    assert "clii" == HumanEval.candidate(152)
    assert "ccli" == HumanEval.candidate(251)
    assert "cdxxvi" == HumanEval.candidate(426)
    assert "d" == HumanEval.candidate(500)
    assert "i" == HumanEval.candidate(1)
    assert "iv" == HumanEval.candidate(4)
    assert "xliii" == HumanEval.candidate(43)
    assert "xc" == HumanEval.candidate(90)
    assert "xciv" == HumanEval.candidate(94)
    assert "dxxxii" == HumanEval.candidate(532)
    assert "cm" == HumanEval.candidate(900)
    assert "cmxciv" == HumanEval.candidate(994)
    assert "m" == HumanEval.candidate(1000)
  end
end


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

defmodule HumanEval do
  def candidate(a, b, c), do: right_angle_triangle(a, b, c)
  def right_angle_triangle(a, b, c) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'right_angle_triangle' do
    assert true == HumanEval.candidate(3, 4, 5)
    assert false == HumanEval.candidate(1, 2, 3)
    assert true == HumanEval.candidate(10, 6, 8)
    assert false == HumanEval.candidate(2, 2, 2)
    assert true == HumanEval.candidate(7, 24, 25)
    assert false == HumanEval.candidate(10, 5, 7)
    assert true == HumanEval.candidate(5, 12, 13)
    assert true == HumanEval.candidate(15, 8, 17)
    assert true == HumanEval.candidate(48, 55, 73)
    assert false == HumanEval.candidate(1, 1, 1)
    assert false == HumanEval.candidate(2, 2, 10)
  end
end


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

defmodule HumanEval do
  def candidate(words), do: find_max(words)
  def find_max(words) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'find_max' do
    assert "string" == HumanEval.candidate(["name", "of", "string"])
    assert "enam" == HumanEval.candidate(["name", "enam", "game"])
    assert "aaaaaaa" == HumanEval.candidate(["aaaaaaa", "bb", "cc"])
    assert "abc" == HumanEval.candidate(["abc", "cba"])
    assert "footbott" == HumanEval.candidate(["play", "this", "game", "of", "footbott"])
    assert "gonna" == HumanEval.candidate(["we", "are", "gonna", "rock"])
    assert "nation" == HumanEval.candidate(["we", "are", "a", "mad", "nation"])
    assert "this" == HumanEval.candidate(["this", "is", "a", "prrk"])
    assert "b" == HumanEval.candidate(["b"])
    assert "play" == HumanEval.candidate(["play", "play", "play"])
  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 a list 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:
# >>> HumanEval.eat(5, 6, 10)
# [11, 4]
# >>> HumanEval.eat(4, 8, 9)
# [12, 1]
# >>> HumanEval.eat(1, 10, 10)
# [11, 0]
# >>> HumanEval.eat(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 :)

defmodule HumanEval do
  def candidate(number, need, remaining), do: eat(number, need, remaining)
  def eat(number, need, remaining) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'eat' do
    assert [11, 4] == HumanEval.candidate(5, 6, 10)
    assert [12, 1] == HumanEval.candidate(4, 8, 9)
    assert [11, 0] == HumanEval.candidate(1, 10, 10)
    assert [7, 0] == HumanEval.candidate(2, 11, 5)
    assert [9, 2] == HumanEval.candidate(4, 5, 7)
    assert [5, 0] == HumanEval.candidate(4, 5, 1)
  end
end


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

defmodule HumanEval do
  def candidate(n), do: string_sequence(n)
  def string_sequence(n) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'string_sequence' do
    assert "0" == HumanEval.candidate(0)
    assert "0 1 2 3" == HumanEval.candidate(3)
    assert "0 1 2 3 4 5 6 7 8 9 10" == HumanEval.candidate(10)
  end
end


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

defmodule HumanEval do
  def candidate(operator, operand), do: do_algebra(operator, operand)
  def do_algebra(operator, operand) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'do_algebra' do
    assert 37 == HumanEval.candidate(["**", "*", "+"], [2, 3, 4, 5])
    assert 9 == HumanEval.candidate(["+", "*", "-"], [2, 3, 4, 5])
    assert 8 == HumanEval.candidate(["//", "*"], [7, 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
# >>> HumanEval.solve("1234")
# "4321"
# >>> HumanEval.solve("ab")
# "AB"
# >>> HumanEval.solve("#a@C")
# "#A@c"

defmodule HumanEval do
  def candidate(s), do: solve(s)
  def solve(s) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'solve' do
    assert "aSdF" == HumanEval.candidate("AsDf")
    assert "4321" == HumanEval.candidate("1234")
    assert "AB" == HumanEval.candidate("ab")
    assert "#A@c" == HumanEval.candidate("#a@C")
    assert "#aSDFw^45" == HumanEval.candidate("#AsdfW^45")
    assert "2@6#" == HumanEval.candidate("#6@2")
    assert "#$A^d" == HumanEval.candidate("#$a^D")
    assert "#CCC" == HumanEval.candidate("#ccc")
  end
end


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

defmodule HumanEval do
  def candidate(text), do: string_to_md5(text)
  def string_to_md5(text) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'string_to_md5' do
    assert "3e25960a79dbc69b674cd4ec67a72c62" == HumanEval.candidate("Hello world")
    assert nil == HumanEval.candidate("")
    assert "0ef78513b0cb8cef12743f5aeb35f888" == HumanEval.candidate("A B C")
    assert "5f4dcc3b5aa765d61d8327deb882cf99" == HumanEval.candidate("password")
  end
end


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

defmodule HumanEval do
  def candidate(a, b), do: generate_integers(a, b)
  def generate_integers(a, b) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'generate_integers' do
    assert [2, 4, 6, 8] == HumanEval.candidate(2, 10)
    assert [2, 4, 6, 8] == HumanEval.candidate(10, 2)
    assert [2, 4, 6, 8] == HumanEval.candidate(132, 2)
    assert [] == HumanEval.candidate(17, 89)
  end
end


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

defmodule HumanEval do
  def candidate(string), do: count_distinct_characters(string)
  def count_distinct_characters(string) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'count_distinct_characters' do
    assert 0 == HumanEval.candidate("")
    assert 5 == HumanEval.candidate("abcde")
    assert 5 == HumanEval.candidate("abcdecadeCADE")
    assert 1 == HumanEval.candidate("aaaaAAAAaaaa")
    assert 5 == HumanEval.candidate("Jerry jERRY JeRRRY")
  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 list 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
# >>> HumanEval.parse_music("o o| .| o| o| .| .| .| .| o o")
# [4, 2, 1, 2, 2, 1, 1, 1, 1, 4, 4]

defmodule HumanEval do
  def candidate(music_string), do: parse_music(music_string)
  def parse_music(music_string) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'parse_music' do
    assert [] == HumanEval.candidate("")
    assert [4, 4, 4, 4] == HumanEval.candidate("o o o o")
    assert [1, 1, 1, 1] == HumanEval.candidate(".| .| .| .|")
    assert [2, 2, 1, 1, 4, 4, 4, 4] == HumanEval.candidate("o| o| .| .| o o o o")
    assert [2, 1, 2, 1, 4, 2, 4, 2] == HumanEval.candidate("o| .| o| .| o o| o o|")
  end
end


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

defmodule HumanEval do
  def candidate(string, substring), do: how_many_times(string, substring)
  def how_many_times(string, substring) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'how_many_times' do
    assert 0 == HumanEval.candidate("", "x")
    assert 4 == HumanEval.candidate("xyxyxyx", "x")
    assert 4 == HumanEval.candidate("cacacacac", "cac")
    assert 1 == HumanEval.candidate("john doe", "john")
  end
end


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

defmodule HumanEval do
  def candidate(numbers), do: sort_numbers(numbers)
  def sort_numbers(numbers) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'sort_numbers' do
    assert "" == HumanEval.candidate("")
    assert "three" == HumanEval.candidate("three")
    assert "three five nine" == HumanEval.candidate("three five nine")
    assert "zero four five seven eight nine" == HumanEval.candidate("five zero four seven nine eight")
    assert "zero one two three four five six" == HumanEval.candidate("six five four three two one zero")
  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 list 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.
# >>> HumanEval.separate_paren_groups("( ) (( )) (( )( ))")
# ["()", "(())", "(()())"]

defmodule HumanEval do
  def candidate(paren_string), do: separate_paren_groups(paren_string)
  def separate_paren_groups(paren_string) do


Prompt:
# From a supplied list 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).
# >>> HumanEval.find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.2])
# {2.0, 2.2}
# >>> HumanEval.find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.0])
# {2.0, 2.0}

defmodule HumanEval do
  def candidate(numbers), do: find_closest_elements(numbers)
  def find_closest_elements(numbers) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'find_closest_elements' do
    assert {3.9, 4.0} == HumanEval.candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2])
    assert {5.0, 5.9} == HumanEval.candidate([1.0, 2.0, 5.9, 4.0, 5.0])
    assert {2.0, 2.2} == HumanEval.candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.2])
    assert {2.0, 2.0} == HumanEval.candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.0])
    assert {2.2, 3.1} == HumanEval.candidate([1.1, 2.2, 3.1, 4.1, 5.1])
  end
end


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

defmodule HumanEval do
  def candidate(numbers), do: rescale_to_unit(numbers)
  def rescale_to_unit(numbers) do


Prompt:
# Filter given list of any elixirthon values only for integers
# >>> HumanEval.filter_integers(["a", 3.14, 5])
# [5]
# >>> HumanEval.filter_integers([1, 2, 3, "abc", %{}, []])
# [1, 2, 3]

defmodule HumanEval do
  def candidate(values), do: filter_integers(values)
  def filter_integers(values) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'filter_integers' do
    assert [] == HumanEval.candidate([])
    assert [4, 9] == HumanEval.candidate([4, %{}, [], 23.2, 9, "adasd"])
    assert [3, 3, 3] == HumanEval.candidate([3, "c", 3, 3, "a", "b"])
  end
end


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

defmodule HumanEval do
  def candidate(string), do: strlen(string)
  def strlen(string) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'strlen' do
    assert 0 == HumanEval.candidate("")
    assert 1 == HumanEval.candidate("x")
    assert 9 == HumanEval.candidate("asdasnakj")
  end
end


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

defmodule HumanEval do
  def candidate(n), do: largest_divisor(n)
  def largest_divisor(n) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'largest_divisor' do
    assert 1 == HumanEval.candidate(3)
    assert 1 == HumanEval.candidate(7)
    assert 5 == HumanEval.candidate(10)
    assert 50 == HumanEval.candidate(100)
    assert 7 == HumanEval.candidate(49)
  end
end


Prompt:
# Return list of prime factors of given integer in the order from smallest to largest.
# Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
# Input number should be equal to the product of all factors
# >>> HumanEval.factorize(8)
# [2, 2, 2]
# >>> HumanEval.factorize(25)
# [5, 5]
# >>> HumanEval.factorize(70)
# [2, 5, 7]

defmodule HumanEval do
  def candidate(n), do: factorize(n)
  def factorize(n) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'factorize' do
    assert [2] == HumanEval.candidate(2)
    assert [2, 2] == HumanEval.candidate(4)
    assert [2, 2, 2] == HumanEval.candidate(8)
    assert [3, 19] == HumanEval.candidate(57)
    assert [3, 3, 19, 19] == HumanEval.candidate(3249)
    assert [3, 3, 3, 19, 19, 19] == HumanEval.candidate(185193)
    assert [3, 19, 19, 19] == HumanEval.candidate(20577)
    assert [2, 3, 3] == HumanEval.candidate(18)
  end
end


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

defmodule HumanEval do
  def candidate(numbers), do: remove_duplicates(numbers)
  def remove_duplicates(numbers) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'remove_duplicates' do
    assert [] == HumanEval.candidate([])
    assert [1, 2, 3, 4] == HumanEval.candidate([1, 2, 3, 4])
    assert [1, 4, 5] == HumanEval.candidate([1, 2, 3, 2, 4, 3, 5])
  end
end


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

defmodule HumanEval do
  def candidate(string), do: flip_case(string)
  def flip_case(string) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'flip_case' do
    assert "" == HumanEval.candidate("")
    assert "hELLO!" == HumanEval.candidate("Hello!")
    assert "tHESE VIOLENT DELIGHTS HAVE VIOLENT ENDS" == HumanEval.candidate("These violent delights have violent ends")
  end
end


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

defmodule HumanEval do
  def candidate(strings), do: concatenate(strings)
  def concatenate(strings) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'concatenate' do
    assert "" == HumanEval.candidate([])
    assert "xyz" == HumanEval.candidate(["x", "y", "z"])
    assert "xyzwk" == HumanEval.candidate(["x", "y", "z", "w", "k"])
  end
end


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

defmodule HumanEval do
  def candidate(strings, prefix), do: filter_by_prefix(strings, prefix)
  def filter_by_prefix(strings, prefix) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'filter_by_prefix' do
    assert [] == HumanEval.candidate([], "john")
    assert ["xxx", "xxxAAA", "xxx"] == HumanEval.candidate(["xxx", "asd", "xxy", "john doe", "xxxAAA", "xxx"], "xxx")
  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.
# >>> HumanEval.truncate_number(3.5)
# 0.5

defmodule HumanEval do
  def candidate(number), do: truncate_number(number)
  def truncate_number(number) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'truncate_number' do
    assert 0.5 == HumanEval.candidate(3.5)
    assert 0.25 == HumanEval.candidate(1.25)
    assert 0.0 == HumanEval.candidate(123.0)
  end
end


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

defmodule HumanEval do
  def candidate(l), do: get_positive(l)
  def get_positive(l) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'get_positive' do
    assert [4, 5, 6] == HumanEval.candidate([-1, -2, 4, 5, 6])
    assert [5, 3, 2, 3, 3, 9, 123, 1] == HumanEval.candidate([5, 3, -5, 2, 3, 3, 9, 0, 123, 1, -10])
    assert [] == HumanEval.candidate([-1, -2])
    assert [] == HumanEval.candidate([])
  end
end


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

defmodule HumanEval do
  def candidate(n), do: is_prime(n)
  def is_prime(n) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'is_prime' do
    assert false == HumanEval.candidate(6)
    assert true == HumanEval.candidate(101)
    assert true == HumanEval.candidate(11)
    assert true == HumanEval.candidate(13441)
    assert true == HumanEval.candidate(61)
    assert false == HumanEval.candidate(4)
    assert false == HumanEval.candidate(1)
    assert true == HumanEval.candidate(5)
    assert true == HumanEval.candidate(11)
    assert true == HumanEval.candidate(17)
    assert false == HumanEval.candidate(85)
    assert false == HumanEval.candidate(77)
    assert false == HumanEval.candidate(255379)
  end
end


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

defmodule HumanEval do
  def candidate(l), do: sort_third(l)
  def sort_third(l) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'sort_third' do
    assert [2, 6, 3, 4, 8, 9, 5] == HumanEval.candidate([5, 6, 3, 4, 8, 9, 2])
    assert [2, 8, 3, 4, 6, 9, 5] == HumanEval.candidate([5, 8, 3, 4, 6, 9, 2])
    assert [2, 6, 9, 4, 8, 3, 5] == HumanEval.candidate([5, 6, 9, 4, 8, 3, 2])
    assert [2, 6, 3, 4, 8, 9, 5, 1] == HumanEval.candidate([5, 6, 3, 4, 8, 9, 2, 1])
  end
end


Prompt:
# Return sorted unique elements in a list
# >>> HumanEval.unique([5, 3, 5, 2, 3, 3, 9, 0, 123])
# [0, 2, 3, 5, 9, 123]

defmodule HumanEval do
  def candidate(l), do: unique(l)
  def unique(l) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'unique' do
    assert [0, 2, 3, 5, 9, 123] == HumanEval.candidate([5, 3, 5, 2, 3, 3, 9, 0, 123])
  end
end


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

defmodule HumanEval do
  def candidate(l), do: max_element(l)
  def max_element(l) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'max_element' do
    assert 3 == HumanEval.candidate([1, 2, 3])
    assert 124 == HumanEval.candidate([5, 3, -5, 2, -3, 3, 9, 0, 124, 1, -10])
  end
end


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

defmodule HumanEval do
  def candidate(n), do: fizz_buzz(n)
  def fizz_buzz(n) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'fizz_buzz' do
    assert 0 == HumanEval.candidate(50)
    assert 2 == HumanEval.candidate(78)
    assert 3 == HumanEval.candidate(79)
    assert 3 == HumanEval.candidate(100)
    assert 6 == HumanEval.candidate(200)
    assert 192 == HumanEval.candidate(4000)
    assert 639 == HumanEval.candidate(10000)
    assert 8026 == HumanEval.candidate(100000)
  end
end


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

defmodule HumanEval do
  def candidate(l), do: sort_even(l)
  def sort_even(l) do


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

defmodule HumanEval do
  def candidate(n), do: prime_fib(n)
  def prime_fib(n) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'prime_fib' do
    assert 2 == HumanEval.candidate(1)
    assert 3 == HumanEval.candidate(2)
    assert 5 == HumanEval.candidate(3)
    assert 13 == HumanEval.candidate(4)
    assert 89 == HumanEval.candidate(5)
    assert 233 == HumanEval.candidate(6)
    assert 1597 == HumanEval.candidate(7)
    assert 28657 == HumanEval.candidate(8)
    assert 514229 == HumanEval.candidate(9)
    assert 433494437 == HumanEval.candidate(10)
  end
end


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

defmodule HumanEval do
  def candidate(operations), do: below_zero(operations)
  def below_zero(operations) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'below_zero' do
    assert false == HumanEval.candidate([])
    assert false == HumanEval.candidate([1, 2, -3, 1, 2, -3])
    assert true == HumanEval.candidate([1, 2, -4, 5, 6])
    assert false == HumanEval.candidate([1, -1, 2, -2, 5, -5, 4, -4])
    assert true == HumanEval.candidate([1, -1, 2, -2, 5, -5, 4, -5])
    assert true == HumanEval.candidate([1, -2, 2, -2, 5, -5, 4, -4])
  end
end


Prompt:
# triples_sum_to_zero takes a list of integers as an input.
# it returns true if there are three distinct elements in the list that
# sum to zero, and false otherwise.
# >>> HumanEval.triples_sum_to_zero([1, 3, 5, 0])
# false
# >>> HumanEval.triples_sum_to_zero([1, 3, -2, 1])
# true
# >>> HumanEval.triples_sum_to_zero([1, 2, 3, 7])
# false
# >>> HumanEval.triples_sum_to_zero([2, 4, -5, 3, 9, 7])
# true
# >>> HumanEval.triples_sum_to_zero([1])
# false

defmodule HumanEval do
  def candidate(l), do: triples_sum_to_zero(l)
  def triples_sum_to_zero(l) do

ExUnit.start()
defmodule HumanEvalTest do
  use ExUnit.Case, async: true
  test 'triples_sum_to_zero' do
    assert false == HumanEval.candidate([1, 3, 5, 0])
    assert false == HumanEval.candidate([1, 3, 5, -1])
    assert true == HumanEval.candidate([1, 3, -2, 1])
    assert false == HumanEval.candidate([1, 2, 3, 7])
    assert false == HumanEval.candidate([1, 2, 5, 7])
    assert true == HumanEval.candidate([2, 4, -5, 3, 9, 7])
    assert false == HumanEval.candidate([1])
    assert false == HumanEval.candidate([1, 3, 5, -100])
    assert false == HumanEval.candidate([100, 3, 5, -100])
  end
end