name stringclasses 161
values | language stringclasses 22
values | prompt stringlengths 40 2.27k | doctests stringclasses 3
values | original stringclasses 956
values | prompt_terminology stringclasses 2
values | tests stringlengths 125 5.35k | stop_tokens listlengths 1 7 |
|---|---|---|---|---|---|---|---|
HumanEval_53_add | elixir | # Add two numbers x and y
# >>> add(2, 3)
# 5
# >>> add(5, 7)
# 12
defmodule HumanEval do
def candidate(x, y), do: add(x, y)
def add(x, y) do
| keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_53_add.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'add' do
assert 1 == HumanEval.candidate(0, 1)
assert 1 == HumanEval.candidate(1, 0)
assert 5 == HumanEval.candidate(2, 3)
assert 12 == HumanEval.candidate(5, 7)
assert 12 == HumanEval.candidate(7, 5)
end
end
| [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_54_same_chars | elixir | # Check if two words have the same characters.
# >>> same_chars('eabcdzzzz', 'dddzzzzzzzddeddabc')
# True
# >>> same_chars('abcd', 'dddddddabc')
# True
# >>> same_chars('dddddddabc', 'abcd')
# True
# >>> same_chars('eabcd', 'dddddddabc')
# False
# >>> same_chars('abcd', 'dddddddabce')
# False
# >>> same_chars('eabcdzzz... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_54_same_chars.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'same_chars' do
assert true == HumanEval.candidate("eabcdzzzz", "dddzzzzzzzddeddabc")
assert true == HumanEval.candidate("abcd", "dddddddabc")
assert true == HumanEval.candidate("dddddddabc", "abcd")
assert false == HumanEva... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_55_fib | elixir | # Return n-th Fibonacci number.
# >>> fib(10)
# 55
# >>> fib(1)
# 1
# >>> fib(8)
# 21
defmodule HumanEval do
def candidate(n), do: fib(n)
def fib(n) do
| keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_55_fib.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'fib' do
assert 55 == HumanEval.candidate(10)
assert 1 == HumanEval.candidate(1)
assert 21 == HumanEval.candidate(8)
assert 89 == HumanEval.candidate(11)
assert 144 == HumanEval.candidate(12)
end
end
| [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_56_correct_bracketing | elixir | # brackets is a string of "<" and ">".
# return True if every opening bracket has a corresponding closing bracket.
# >>> correct_bracketing("<")
# False
# >>> correct_bracketing("<>")
# True
# >>> correct_bracketing("<<><>>")
# True
# >>> correct_bracketing("><<>")
# False
defmodule HumanEval do
def candidate(bracke... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_56_correct_bracketing.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'correct_bracketing' do
assert true == HumanEval.candidate("<>")
assert true == HumanEval.candidate("<<><>>")
assert true == HumanEval.candidate("<><><<><>><>")
assert true == HumanEval.candidate("<><><<<><><>><>><<><><<>>>"... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_57_monotonic | elixir | # Return True is list elements are monotonically increasing or decreasing.
# >>> monotonic([1, 2, 4, 20])
# True
# >>> monotonic([1, 20, 4, 10])
# False
# >>> monotonic([4, 1, 0, -10])
# True
defmodule HumanEval do
def candidate(l), do: monotonic(l)
def monotonic(l) do
| keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_57_monotonic.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'monotonic' do
assert true == HumanEval.candidate([1, 2, 4, 10])
assert true == HumanEval.candidate([1, 2, 4, 20])
assert false == HumanEval.candidate([1, 20, 4, 10])
assert true == HumanEval.candidate([4, 1, 0, -10])
as... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_58_common | elixir | # Return sorted unique common elements for two lists.
# >>> common([1, 4, 3, 34, 653, 2, 5], [5, 7, 1, 5, 9, 653, 121])
# [1, 5, 653]
# >>> common([5, 3, 2, 8], [3, 2])
# [2, 3]
defmodule HumanEval do
def candidate(l1, l2), do: common(l1, l2)
def common(l1, l2) do
| keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_58_common.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'common' do
assert [1, 5, 653] == HumanEval.candidate([1, 4, 3, 34, 653, 2, 5], [5, 7, 1, 5, 9, 653, 121])
assert [2, 3] == HumanEval.candidate([5, 3, 2, 8], [3, 2])
assert [2, 3, 4] == HumanEval.candidate([4, 3, 2, 8], [3, 2, 4... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_59_largest_prime_factor | elixir | # Return the largest prime factor of n. Assume n > 1 and is not a prime.
# >>> largest_prime_factor(13195)
# 29
# >>> largest_prime_factor(2048)
# 2
defmodule HumanEval do
def candidate(n), do: largest_prime_factor(n)
def largest_prime_factor(n) do
| keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_59_largest_prime_factor.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'largest_prime_factor' do
assert 5 == HumanEval.candidate(15)
assert 3 == HumanEval.candidate(27)
assert 7 == HumanEval.candidate(63)
assert 11 == HumanEval.candidate(330)
assert 29 == HumanEval.candidate(13195)
end
en... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_5_intersperse | elixir | # Insert a number 'delimeter' between every two consecutive elements of input list `numbers'
# >>> intersperse([], 4)
# []
# >>> intersperse([1, 2, 3], 4)
# [1, 4, 2, 4, 3]
defmodule HumanEval do
def candidate(numbers, delimeter), do: intersperse(numbers, delimeter)
def intersperse(numbers, delimeter) do
| keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_5_intersperse.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'intersperse' do
assert [] == HumanEval.candidate([], 7)
assert [5, 8, 6, 8, 3, 8, 2] == HumanEval.candidate([5, 6, 3, 2], 8)
assert [2, 2, 2, 2, 2] == HumanEval.candidate([2, 2, 2], 2)
end
end
| [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_60_sum_to_n | elixir | # sum_to_n is a function that sums numbers from 1 to n.
# >>> sum_to_n(30)
# 465
# >>> sum_to_n(100)
# 5050
# >>> sum_to_n(5)
# 15
# >>> sum_to_n(10)
# 55
# >>> sum_to_n(1)
# 1
defmodule HumanEval do
def candidate(n), do: sum_to_n(n)
def sum_to_n(n) do
| keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_60_sum_to_n.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'sum_to_n' do
assert 1 == HumanEval.candidate(1)
assert 21 == HumanEval.candidate(6)
assert 66 == HumanEval.candidate(11)
assert 465 == HumanEval.candidate(30)
assert 5050 == HumanEval.candidate(100)
end
end
| [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_61_correct_bracketing | elixir | # brackets is a string of "(" and ")".
# return True if every opening bracket has a corresponding closing bracket.
# >>> correct_bracketing("(")
# False
# >>> correct_bracketing("()")
# True
# >>> correct_bracketing("(()())")
# True
# >>> correct_bracketing(")(()")
# False
defmodule HumanEval do
def candidate(bracke... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_61_correct_bracketing.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'correct_bracketing' do
assert true == HumanEval.candidate("()")
assert true == HumanEval.candidate("(()())")
assert true == HumanEval.candidate("()()(()())()")
assert true == HumanEval.candidate("()()((()()())())(()()(()))"... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_62_derivative | elixir | # xs represent coefficients of a polynomial.
# xs[0] + xs[1] * x + xs[2] * x^2 + ....
# Return derivative of this polynomial in the same form.
# >>> derivative([3, 1, 2, 4, 5])
# [1, 4, 12, 20]
# >>> derivative([1, 2, 3])
# [2, 6]
defmodule HumanEval do
def candidate(xs), do: derivative(xs)
def derivative(xs) do
... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_62_derivative.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'derivative' do
assert [1, 4, 12, 20] == HumanEval.candidate([3, 1, 2, 4, 5])
assert [2, 6] == HumanEval.candidate([1, 2, 3])
assert [2, 2] == HumanEval.candidate([3, 2, 1])
assert [2, 2, 0, 16] == HumanEval.candidate([3, 2,... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_63_fibfib | elixir | # The FibFib number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
# fibfib(0) == 0
# fibfib(1) == 0
# fibfib(2) == 1
# fibfib(n) == fibfib(n-1) + fibfib(n-2) + fibfib(n-3).
# Please write a function to efficiently compute the n-th element of the fibfib number sequence.
# >>> fibfi... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_63_fibfib.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'fibfib' do
assert 1 == HumanEval.candidate(2)
assert 0 == HumanEval.candidate(1)
assert 4 == HumanEval.candidate(5)
assert 24 == HumanEval.candidate(8)
assert 81 == HumanEval.candidate(10)
assert 274 == HumanEval.ca... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_64_vowels_count | elixir | # Write a function vowels_count which takes a string representing
# a word as input and returns the number of vowels in the string.
# Vowels in this case are 'a', 'e', 'i', 'o', 'u'. Here, 'y' is also a
# vowel, but only when it is at the end of the given word.
# Example:
# >>> vowels_count("abcde")
# 2
# >>> vowels_co... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_64_vowels_count.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'vowels_count' do
assert 2 == HumanEval.candidate("abcde")
assert 3 == HumanEval.candidate("Alone")
assert 2 == HumanEval.candidate("key")
assert 1 == HumanEval.candidate("bye")
assert 2 == HumanEval.candidate("keY")
... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_65_circular_shift | elixir | # Circular shift the digits of the integer x, shift the digits right by shift
# and return the result as a string.
# If shift > number of digits, return digits reversed.
# >>> circular_shift(12, 1)
# "21"
# >>> circular_shift(12, 2)
# "12"
defmodule HumanEval do
def candidate(x, shift), do: circular_shift(x, shift)
... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_65_circular_shift.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'circular_shift' do
assert "001" == HumanEval.candidate(100, 2)
assert "12" == HumanEval.candidate(12, 2)
assert "79" == HumanEval.candidate(97, 8)
assert "21" == HumanEval.candidate(12, 1)
assert "11" == HumanEval.candi... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_66_digitSum | elixir | # Task
# Write a function that takes a string as input and returns the sum of the upper characters only'
# ASCII codes.
# Examples:
# digitSum("") => 0
# digitSum("abAB") => 131
# digitSum("abcCd") => 67
# digitSum("helloE") => 69
# digitSum("woArBld") => 131
# digitSum("aAaaaXa") => 153
defmodule HumanEval do
def c... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_66_digitSum.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'digitSum' do
assert 0 == HumanEval.candidate("")
assert 131 == HumanEval.candidate("abAB")
assert 67 == HumanEval.candidate("abcCd")
assert 69 == HumanEval.candidate("helloE")
assert 131 == HumanEval.candidate("woArBld"... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_67_fruit_distribution | elixir | # In this task, you will be given a string that represents a number of apples and oranges
# that are distributed in a basket of fruit this basket contains
# apples, oranges, and mango fruits. Given the string that represents the total number of
# the oranges and apples and an integer that represent the total number ... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_67_fruit_distribution.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'fruit_distribution' do
assert 8 == HumanEval.candidate("5 apples and 6 oranges", 19)
assert 10 == HumanEval.candidate("5 apples and 6 oranges", 21)
assert 2 == HumanEval.candidate("0 apples and 1 oranges", 3)
assert 2 == Hu... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_68_pluck | elixir | # "Given an array representing a branch of a tree that has non-negative integer nodes
# your task is to pluck one of the nodes and return it.
# The plucked node should be the node with the smallest even value.
# If multiple nodes with the same smallest even value are found return the node that has smallest index.
# The... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_68_pluck.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'pluck' do
assert [2, 1] == HumanEval.candidate([4, 2, 3])
assert [2, 1] == HumanEval.candidate([1, 2, 3])
assert [] == HumanEval.candidate([])
assert [0, 1] == HumanEval.candidate([5, 0, 3, 0, 4, 2])
assert [0, 3] == Hu... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_69_search | elixir | # You are given a non-empty list of positive integers. Return the greatest integer that is greater than
# zero, and has a frequency greater than or equal to the value of the integer itself.
# The frequency of an integer is the number of times it appears in the list.
# If no such a value exist, return -1.
# Examples:
... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_69_search.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'search' do
assert 1 == HumanEval.candidate([5, 5, 5, 5, 1])
assert 4 == HumanEval.candidate([4, 1, 4, 1, 4, 4])
assert -1 == HumanEval.candidate([3, 3])
assert 8 == HumanEval.candidate([8, 8, 8, 8, 8, 8, 8, 8])
assert 2... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_6_parse_nested_parens | elixir | # Input to this function is a string represented multiple groups for nested parentheses separated by spaces.
# For each of the group, output the deepest level of nesting of parentheses.
# E.g. (()()) has maximum two levels of nesting while ((())) has three.
# >>> parse_nested_parens('(()()) ((())) () ((())()())')
# [2,... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_6_parse_nested_parens.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'parse_nested_parens' do
assert [2, 3, 1, 3] == HumanEval.candidate("(()()) ((())) () ((())()())")
assert [1, 2, 3, 4] == HumanEval.candidate("() (()) ((())) (((())))")
assert [4] == HumanEval.candidate("(()(())((())))")
end
e... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_70_strange_sort_list | elixir | # Given list of integers, return list in strange order.
# Strange sorting, is when you start with the minimum value,
# then maximum of the remaining integers, then minimum and so on.
# Examples:
# strange_sort_list([1, 2, 3, 4]) == [1, 4, 2, 3]
# strange_sort_list([5, 5, 5, 5]) == [5, 5, 5, 5]
# strange_sort_list([]) =... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_70_strange_sort_list.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'strange_sort_list' do
assert [1, 4, 2, 3] == HumanEval.candidate([1, 2, 3, 4])
assert [5, 9, 6, 8, 7] == HumanEval.candidate([5, 6, 7, 8, 9])
assert [1, 5, 2, 4, 3] == HumanEval.candidate([1, 2, 3, 4, 5])
assert [1, 9, 5, 8... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_71_triangle_area | elixir | # Given the lengths of the three sides of a triangle. Return the area of
# the triangle rounded to 2 decimal points if the three sides form a valid triangle.
# Otherwise return -1
# Three sides make a valid triangle when the sum of any two sides is greater
# than the third side.
# Example:
# triangle_area(3, 4, 5) ==... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_71_triangle_area.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'triangle_area' do
assert 6.0 == HumanEval.candidate(3, 4, 5)
assert -1 == HumanEval.candidate(1, 2, 10)
assert 8.18 == HumanEval.candidate(4, 8, 5)
assert 1.73 == HumanEval.candidate(2, 2, 2)
assert -1 == HumanEval.cand... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_72_will_it_fly | elixir | # Write a function that returns True if the object q will fly, and False otherwise.
# The object q will fly if it's balanced (it is a palindromic list) and the sum of its elements is less than or equal the maximum possible weight w.
# Example:
# will_it_fly([1, 2], 5) ➞ False
# # 1+2 is less than the maximum possible ... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_72_will_it_fly.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'will_it_fly' do
assert true == HumanEval.candidate([3, 2, 3], 9)
assert false == HumanEval.candidate([1, 2], 5)
assert true == HumanEval.candidate([3], 5)
assert false == HumanEval.candidate([3, 2, 3], 1)
assert false =... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_73_smallest_change | elixir | # Given an array arr of integers, find the minimum number of elements that
# need to be changed to make the array palindromic. A palindromic array is an array that
# is read the same backwards and forwards. In one change, you can change one element to any other element.
# For example:
# smallest_change([1,2,3,5,4,7,9,6... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_73_smallest_change.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'smallest_change' do
assert 4 == HumanEval.candidate([1, 2, 3, 5, 4, 7, 9, 6])
assert 1 == HumanEval.candidate([1, 2, 3, 4, 3, 2, 2])
assert 1 == HumanEval.candidate([1, 4, 2])
assert 1 == HumanEval.candidate([1, 4, 4, 2])
... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_74_total_match | elixir | # Write a function that accepts two lists of strings and returns the list that has
# total number of chars in the all strings of the list less than the other list.
# if the two lists have the same number of chars, return the first list.
# Examples
# total_match([], []) ➞ []
# total_match(['hi', 'admin'], ['hI', 'Hi'])... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_74_total_match.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'total_match' do
assert [] == HumanEval.candidate([], [])
assert ["hi", "hi"] == HumanEval.candidate(["hi", "admin"], ["hi", "hi"])
assert ["hi", "admin"] == HumanEval.candidate(["hi", "admin"], ["hi", "hi", "admin", "project"])... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_75_is_multiply_prime | elixir | # Write a function that returns true if the given number is the multiplication of 3 prime numbers
# and false otherwise.
# Knowing that (a) is less then 100.
# Example:
# is_multiply_prime(30) == True
# 30 = 2 * 3 * 5
defmodule HumanEval do
def candidate(a), do: is_multiply_prime(a)
def is_multiply_prime(a) do
... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_75_is_multiply_prime.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'is_multiply_prime' do
assert false == HumanEval.candidate(5)
assert true == HumanEval.candidate(30)
assert true == HumanEval.candidate(8)
assert false == HumanEval.candidate(10)
assert true == HumanEval.candidate(125)
... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_76_is_simple_power | elixir | # Your task is to write a function that returns true if a number x is a simple
# power of n and false in other cases.
# x is a simple power of n if n**int=x
# For example:
# is_simple_power(1, 4) => true
# is_simple_power(2, 2) => true
# is_simple_power(8, 2) => true
# is_simple_power(3, 2) => false
# is_simple_power(3... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_76_is_simple_power.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'is_simple_power' do
assert true == HumanEval.candidate(16, 2)
assert false == HumanEval.candidate(143214, 16)
assert true == HumanEval.candidate(4, 2)
assert true == HumanEval.candidate(9, 3)
assert true == HumanEval.ca... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_77_iscube | elixir | # Write a function that takes an integer a and returns True
# if this ingeger is a cube of some integer number.
# Note: you may assume the input is always valid.
# Examples:
# iscube(1) ==> True
# iscube(2) ==> False
# iscube(-1) ==> True
# iscube(64) ==> True
# iscube(0) ==> True
# iscube(180) ==> False
defmodule Hu... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_77_iscube.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'iscube' do
assert true == HumanEval.candidate(1)
assert false == HumanEval.candidate(2)
assert true == HumanEval.candidate(-1)
assert true == HumanEval.candidate(64)
assert false == HumanEval.candidate(180)
assert t... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_78_hex_key | elixir | # You have been tasked to write a function that receives
# a hexadecimal number as a string and counts the number of hexadecimal
# digits that are primes (prime number, or a prime, is a natural number
# greater than 1 that is not a product of two smaller natural numbers).
# Hexadecimal digits are 0, 1, 2, 3, 4, 5, 6... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_78_hex_key.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'hex_key' do
assert 1 == HumanEval.candidate("AB")
assert 2 == HumanEval.candidate("1077E")
assert 4 == HumanEval.candidate("ABED1A33")
assert 2 == HumanEval.candidate("2020")
assert 6 == HumanEval.candidate("123456789AB... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_79_decimal_to_binary | elixir | # You will be given a number in decimal form and your task is to convert it to
# binary format. The function should return a string, with each character representing a binary
# number. Each character in the string will be '0' or '1'.
# There will be an extra couple of characters 'db' at the beginning and at the end of ... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_79_decimal_to_binary.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'decimal_to_binary' do
assert "db0db" == HumanEval.candidate(0)
assert "db100000db" == HumanEval.candidate(32)
assert "db1100111db" == HumanEval.candidate(103)
assert "db1111db" == HumanEval.candidate(15)
end
end
| [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_7_filter_by_substring | elixir | # Filter an input list of strings only for ones that contain given substring
# >>> filter_by_substring([], 'a')
# []
# >>> filter_by_substring(['abc', 'bacd', 'cde', 'array'], 'a')
# ['abc', 'bacd', 'array']
defmodule HumanEval do
def candidate(strings, substring), do: filter_by_substring(strings, substring)
def f... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_7_filter_by_substring.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'filter_by_substring' do
assert [] == HumanEval.candidate([], "john")
assert ["xxx", "xxxAAA", "xxx"] == HumanEval.candidate(["xxx", "asd", "xxy", "john doe", "xxxAAA", "xxx"], "xxx")
assert ["xxx", "aaaxxy", "xxxAAA", "xxx"] ==... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_80_is_happy | elixir | # You are given a string s.
# Your task is to check if the string is happy or not.
# A string is happy if its length is at least 3 and every 3 consecutive letters are distinct
# For example:
# is_happy(a) => False
# is_happy(aa) => False
# is_happy(abcd) => True
# is_happy(aabb) => False
# is_happy(adb) => True
# is_ha... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_80_is_happy.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'is_happy' do
assert false == HumanEval.candidate("a")
assert false == HumanEval.candidate("aa")
assert true == HumanEval.candidate("abcd")
assert false == HumanEval.candidate("aabb")
assert true == HumanEval.candidate("... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_81_numerical_letter_grade | elixir | # It is the last week of the semester and the teacher has to give the grades
# to students. The teacher has been making her own algorithm for grading.
# The only problem is, she has lost the code she used for grading.
# She has given you a list of GPAs for some students and you have to write
# a function that can outp... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_81_numerical_letter_grade.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'numerical_letter_grade' do
assert ["A+", "B", "C-", "C", "A-"] == HumanEval.candidate([4.0, 3, 1.7, 2, 3.5])
assert ["D+"] == HumanEval.candidate([1.2])
assert ["D-"] == HumanEval.candidate([0.5])
assert ["E"] == HumanEval.... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_82_prime_length | elixir | # Write a function that takes a string and returns True if the string
# length is a prime number or False otherwise
# Examples
# prime_length('Hello') == True
# prime_length('abcdcba') == True
# prime_length('kittens') == True
# prime_length('orange') == False
defmodule HumanEval do
def candidate(string), do: prime_... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_82_prime_length.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'prime_length' do
assert true == HumanEval.candidate("Hello")
assert true == HumanEval.candidate("abcdcba")
assert true == HumanEval.candidate("kittens")
assert false == HumanEval.candidate("orange")
assert true == Human... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_83_starts_one_ends | elixir | # Given a positive integer n, return the count of the numbers of n-digit
# positive integers that start or end with 1.
defmodule HumanEval do
def candidate(n), do: starts_one_ends(n)
def starts_one_ends(n) do
| keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_83_starts_one_ends.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'starts_one_ends' do
assert 1 == HumanEval.candidate(1)
assert 18 == HumanEval.candidate(2)
assert 180 == HumanEval.candidate(3)
assert 1800 == HumanEval.candidate(4)
assert 18000 == HumanEval.candidate(5)
end
end
| [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_84_solve | elixir | # Given a positive integer N, return the total sum of its digits in binary.
# Example
# For N = 1000, the sum of digits will be 1 the output should be "1".
# For N = 150, the sum of digits will be 6 the output should be "110".
# For N = 147, the sum of digits will be 12 the output should be "1100".
# Variables:
# @N in... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_84_solve.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'solve' do
assert "1" == HumanEval.candidate(1000)
assert "110" == HumanEval.candidate(150)
assert "1100" == HumanEval.candidate(147)
assert "1001" == HumanEval.candidate(333)
assert "10010" == HumanEval.candidate(963)
... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_85_add | elixir | # Given a non-empty list of integers lst. add the even elements that are at odd indices..
# Examples:
# add([4, 2, 6, 7]) ==> 2
defmodule HumanEval do
def candidate(lst), do: add(lst)
def add(lst) do
| keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_85_add.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'add' do
assert 88 == HumanEval.candidate([4, 88])
assert 122 == HumanEval.candidate([4, 5, 6, 7, 2, 122])
assert 0 == HumanEval.candidate([4, 0, 6, 7])
assert 12 == HumanEval.candidate([4, 4, 6, 8])
end
end
| [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_86_anti_shuffle | elixir | # Write a function that takes a string and returns an ordered version of it.
# Ordered version of string, is a string where all words (separated by space)
# are replaced by a new word where all the characters arranged in
# ascending order based on ascii value.
# Note: You should keep the order of words and blank spaces... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_86_anti_shuffle.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'anti_shuffle' do
assert "Hi" == HumanEval.candidate("Hi")
assert "ehllo" == HumanEval.candidate("hello")
assert "bemnru" == HumanEval.candidate("number")
assert "abcd" == HumanEval.candidate("abcd")
assert "Hello !!!Wdl... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_87_get_row | elixir | # You are given a 2 dimensional data, as a nested lists,
# which is similar to matrix, however, unlike matrices,
# each row may contain a different number of columns.
# Given lst, and integer x, find integers x in the list,
# and return list of tuples, [(x1, y1), (x2, y2) ...] such that
# each tuple is a coordinate - (... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_87_get_row.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'get_row' do
assert [{0, 0}, {1, 4}, {1, 0}, {2, 5}, {2, 0}] == HumanEval.candidate([[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 1, 6], [1, 2, 3, 4, 5, 1]], 1)
assert [{0, 1}, {1, 1}, {2, 1}, {3, 1}, {4, 1}, {5, 1}] == HumanEval.candidate([[1,... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_88_sort_array | elixir | # Given an array of non-negative integers, return a copy of the given array after sorting,
# you will sort the given array in ascending order if the sum( first index value, last index value) is odd,
# or sort it in descending order if the sum( first index value, last index value) is even.
# Note:
# * don't change the g... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_88_sort_array.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'sort_array' do
assert [] == HumanEval.candidate([])
assert [5] == HumanEval.candidate([5])
assert [0, 1, 2, 3, 4, 5] == HumanEval.candidate([2, 4, 3, 0, 1, 5])
assert [6, 5, 4, 3, 2, 1, 0] == HumanEval.candidate([2, 4, 3, 0... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_89_encrypt | elixir | # Create a function encrypt that takes a string as an argument and
# returns a string encrypted with the alphabet being rotated.
# The alphabet should be rotated in a manner such that the letters
# shift down by two multiplied to two places.
# For example:
# encrypt('hi') returns 'lm'
# encrypt('asdfghjkl') returns '... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_89_encrypt.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'encrypt' do
assert "lm" == HumanEval.candidate("hi")
assert "ewhjklnop" == HumanEval.candidate("asdfghjkl")
assert "kj" == HumanEval.candidate("gf")
assert "ix" == HumanEval.candidate("et")
assert "jeiajeaijeiak" == Hum... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_8_sum_product | elixir | # For a given list of integers, return a tuple consisting of a sum and a product of all the integers in a list.
# Empty sum should be equal to 0 and empty product should be equal to 1.
# >>> sum_product([])
# (0, 1)
# >>> sum_product([1, 2, 3, 4])
# (10, 24)
defmodule HumanEval do
def candidate(numbers), do: sum_pro... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_8_sum_product.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'sum_product' do
assert {0, 1} == HumanEval.candidate([])
assert {3, 1} == HumanEval.candidate([1, 1, 1])
assert {100, 0} == HumanEval.candidate([100, 0])
assert {15, 105} == HumanEval.candidate([3, 5, 7])
assert {10, 10... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_90_next_smallest | elixir | # You are given a list of integers.
# Write a function next_smallest() that returns the 2nd smallest element of the list.
# Return None if there is no such element.
# next_smallest([1, 2, 3, 4, 5]) == 2
# next_smallest([5, 1, 4, 3, 2]) == 2
# next_smallest([]) == None
# next_smallest([1, 1]) == None
defmodule HumanEva... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_90_next_smallest.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'next_smallest' do
assert 2 == HumanEval.candidate([1, 2, 3, 4, 5])
assert 2 == HumanEval.candidate([5, 1, 4, 3, 2])
assert nil == HumanEval.candidate([])
assert nil == HumanEval.candidate([1, 1])
assert 1 == HumanEval.c... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_91_is_bored | elixir | # You'll be given a string of words, and your task is to count the number
# of boredoms. A boredom is a sentence that starts with the word "I".
# Sentences are delimited by '.', '?' or '!'.
# For example:
# >>> is_bored("Hello world")
# 0
# >>> is_bored("The sky is blue. The sun is shining. I love this weather")
# 1
d... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_91_is_bored.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'is_bored' do
assert 0 == HumanEval.candidate("Hello world")
assert 0 == HumanEval.candidate("Is the sky blue?")
assert 1 == HumanEval.candidate("I love It !")
assert 0 == HumanEval.candidate("bIt")
assert 2 == HumanEval... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_92_any_int | elixir | # Create a function that takes 3 numbers.
# Returns true if one of the numbers is equal to the sum of the other two, and all numbers are integers.
# Returns false in any other cases.
# Examples
# any_int(5, 2, 7) ➞ True
# any_int(3, 2, 2) ➞ False
# any_int(3, -2, 1) ➞ True
# any_int(3.6, -2.2, 2) ➞ False
defmodule Hum... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_92_any_int.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'any_int' do
assert true == HumanEval.candidate(2, 3, 1)
assert false == HumanEval.candidate(2.5, 2, 3)
assert false == HumanEval.candidate(1.5, 5, 3.5)
assert false == HumanEval.candidate(2, 6, 2)
assert true == HumanEv... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_93_encode | elixir | # Write a function that takes a message, and encodes in such a
# way that it swaps case of all letters, replaces all vowels in
# the message with the letter that appears 2 places ahead of that
# vowel in the english alphabet.
# Assume only letters.
# Examples:
# >>> encode('test')
# 'TGST'
# >>> encode('This is a ... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_93_encode.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'encode' do
assert "tgst" == HumanEval.candidate("TEST")
assert "mWDCSKR" == HumanEval.candidate("Mudasir")
assert "ygs" == HumanEval.candidate("YES")
assert "tHKS KS C MGSSCGG" == HumanEval.candidate("This is a message")
... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_94_skjkasdkd | elixir | # You are given a list of integers.
# You need to find the largest prime value and return the sum of its digits.
# Examples:
# For lst = [0,3,2,1,3,5,7,4,5,5,5,2,181,32,4,32,3,2,32,324,4,3] the output should be 10
# For lst = [1,0,1,8,2,4597,2,1,3,40,1,2,1,2,4,2,5,1] the output should be 25
# For lst = [1,3,1,32,5107,3... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_94_skjkasdkd.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'skjkasdkd' do
assert 10 == HumanEval.candidate([0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3])
assert 25 == HumanEval.candidate([1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1])
assert 13 ==... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_95_check_dict_case | elixir | # Given a dictionary, return True if all keys are strings in lower
# case or all keys are strings in upper case, else return False.
# The function should return False is the given dictionary is empty.
# Examples:
# check_dict_case({"a":"apple", "b":"banana"}) should return True.
# check_dict_case({"a":"apple", "A":"ba... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_95_check_dict_case.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'check_dict_case' do
assert true == HumanEval.candidate(%{"p" => "pineapple", "b" => "banana"})
assert false == HumanEval.candidate(%{"p" => "pineapple", "A" => "banana", "B" => "banana"})
assert false == HumanEval.candidate(%{"... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_96_count_up_to | elixir | # Implement a function that takes an non-negative integer and returns an array of the first n
# integers that are prime numbers and less than n.
# for example:
# count_up_to(5) => [2,3]
# count_up_to(11) => [2,3,5,7]
# count_up_to(0) => []
# count_up_to(20) => [2,3,5,7,11,13,17,19]
# count_up_to(1) => []
# count_up_to(... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_96_count_up_to.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'count_up_to' do
assert [2, 3] == HumanEval.candidate(5)
assert [2, 3, 5] == HumanEval.candidate(6)
assert [2, 3, 5] == HumanEval.candidate(7)
assert [2, 3, 5, 7] == HumanEval.candidate(10)
assert [] == HumanEval.candida... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_97_multiply | elixir | # Complete the function that takes two integers and returns
# the product of their unit digits.
# Assume the input is always valid.
# Examples:
# multiply(148, 412) should return 16.
# multiply(19, 28) should return 72.
# multiply(2020, 1851) should return 0.
# multiply(14,-15) should return 20.
defmodule HumanEval d... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_97_multiply.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'multiply' do
assert 16 == HumanEval.candidate(148, 412)
assert 72 == HumanEval.candidate(19, 28)
assert 0 == HumanEval.candidate(2020, 1851)
assert 20 == HumanEval.candidate(14, -15)
assert 42 == HumanEval.candidate(76,... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_98_count_upper | elixir | # Given a string s, count the number of uppercase vowels in even indices.
# For example:
# count_upper('aBCdEf') returns 1
# count_upper('abcdefg') returns 0
# count_upper('dBBE') returns 0
defmodule HumanEval do
def candidate(s), do: count_upper(s)
def count_upper(s) do
| keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_98_count_upper.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'count_upper' do
assert 1 == HumanEval.candidate("aBCdEf")
assert 0 == HumanEval.candidate("abcdefg")
assert 0 == HumanEval.candidate("dBBE")
assert 0 == HumanEval.candidate("B")
assert 1 == HumanEval.candidate("U")
... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_99_closest_integer | elixir | # Create a function that takes a value (string) representing a number
# and returns the closest integer to it. If the number is equidistant
# from two integers, round it away from zero.
# Examples
# >>> closest_integer("10")
# 10
# >>> closest_integer("15.3")
# 15
# Note:
# Rounding away from zero means that if the giv... | keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_99_closest_integer.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'closest_integer' do
assert 10 == HumanEval.candidate("10")
assert 15 == HumanEval.candidate("14.5")
assert -16 == HumanEval.candidate("-15.5")
assert 15 == HumanEval.candidate("15.3")
assert 0 == HumanEval.candidate("0"... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_9_rolling_max | elixir | # From a given list of integers, generate a list of rolling maximum element found until given moment
# in the sequence.
# >>> rolling_max([1, 2, 3, 2, 3, 4, 2])
# [1, 2, 3, 3, 3, 4, 4]
defmodule HumanEval do
def candidate(numbers), do: rolling_max(numbers)
def rolling_max(numbers) do
| keep | /home/MultiPL-E/datasets/../datasets/originals/HumanEval_9_rolling_max.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'rolling_max' do
assert [] == HumanEval.candidate([])
assert [1, 2, 3, 4] == HumanEval.candidate([1, 2, 3, 4])
assert [4, 4, 4, 4] == HumanEval.candidate([4, 3, 2, 1])
assert [3, 3, 3, 100, 100] == HumanEval.candidate([3, 2,... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_0_has_close_elements | elixir | # Check if in given list of numbers, are any two numbers closer to each other than
# given threshold.
defmodule HumanEval do
def candidate(numbers, threshold), do: has_close_elements(numbers, threshold)
def has_close_elements(numbers, threshold) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_0_has_close_elements.py | verbatim | 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.... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_100_make_a_pile | elixir | # 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 represen... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_100_make_a_pile.py | verbatim | 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... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_101_words_string | elixir | # You will be given a string of words separated by commas or spaces. Your task is
# to split the string into words and return an array of the words.
# For example:
defmodule HumanEval do
def candidate(s), do: words_string(s)
def words_string(s) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_101_words_string.py | verbatim | 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 ["... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_102_choose_num | elixir | # 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:
defmodule HumanEval do
def candidate(x, y), do: choose_num(x, y)
def choose_num(x, y) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_102_choose_num.py | verbatim | 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.candida... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_103_rounded_avg | elixir | # 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:
defmodule HumanEval do
def candidate(n, m), do: rounded... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_103_rounded_avg.py | verbatim | 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)
asse... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_104_unique_digits | elixir | # 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:
defmodule HumanEval do
def candidate(x), do: unique_digits(x)
def unique_digits(x) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_104_unique_digits.py | verbatim | 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] == Hum... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_105_by_length | elixir | # Given an array of integers, sort the integers that are between 1 and 9 inclusive,
# reverse the resulting array, and then replace each digit by its corresponding name from
# "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine".
# For example:
# If the array is empty, return an empty array:
# If the ... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_105_by_length.py | verbatim | 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])
as... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_106_f | elixir | # 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 * ... * ... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_106_f.py | verbatim | 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
| [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_107_even_odd_palindrome | elixir | # 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:
# Explanation:
# Integer palindrome are 1, 2, 3. one of them is even, and two of them are odd.
# Example 2:
# Explanation:
# Integer palindrome are 1, 2, 3, 4,... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_107_even_odd_palindrome.py | verbatim | 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.can... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_108_count_nums | elixir | # Write a function count_nums which takes an array of integers and returns
# the number of elements which has a sum of digits > 0.
# If a number is negative, then its first signed digit will be negative:
# e.g. -123 has signed digits -1, 2, and 3.
defmodule HumanEval do
def candidate(arr), do: count_nums(arr)
def ... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_108_count_nums.py | verbatim | 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 ==... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_109_move_one_ball | elixir | # We have an array 'arr' of N integers arr[1], arr[2], ..., arr[N].The
# numbers in the array will be randomly ordered. Your task is to determine if
# it is possible to get an array sorted in non-decreasing order by performing
# the following operation on the given array:
# You are allowed to perform right shift opera... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_109_move_one_ball.py | verbatim | 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... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_10_make_palindrome | elixir | # 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.
defmodule HumanEval do
def candidate(string), d... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_10_make_palindrome.py | verbatim | 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.can... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_110_exchange | elixir | # 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 exch... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_110_exchange.py | verbatim | 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" == Hum... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_111_histogram | elixir | # Given a string representing a space separated lowercase letters, return a dictionary
# of the letter with the most repetition and containing the corresponding count.
# If several letters have the same occurrence, return all of them.
# Example:
defmodule HumanEval do
def candidate(test), do: histogram(test)
def h... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_111_histogram.py | verbatim | 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 ... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_112_reverse_delete | elixir | # 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 f... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_112_reverse_delete.py | verbatim | 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", fa... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_113_odd_count | elixir | # 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.
defmodule HumanEval do
def can... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_113_odd_count.py | verbatim | 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 o... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_114_minSubArraySum | elixir | # Given an array of integers nums, find the minimum sum of any non-empty sub-array
# of nums.
# Example
defmodule HumanEval do
def candidate(nums), do: minSubArraySum(nums)
def minSubArraySum(nums) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_114_minSubArraySum.py | verbatim | 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([... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_115_max_fill | elixir | # 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.
# Ou... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_115_max_fill.py | verbatim | 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]... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_116_sort_array | elixir | # In this Kata, you have to sort an array of non-negative integers according to
# number of ones in their binary representation in ascending order.
# For similar number of ones, sort based on decimal value.
# It must be implemented like this:
defmodule HumanEval do
def candidate(arr), do: sort_array(arr)
def sort_... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_116_sort_array.py | verbatim | 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 []... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_117_select_words | elixir | # 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 th... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_117_select_words.py | verbatim | 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)
as... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_118_get_closest_vowel | elixir | # 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 c... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_118_get_closest_vowel.py | verbatim | 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.candid... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_119_match_parens | elixir | # 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
... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_119_match_parens.py | verbatim | 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([")())", "(()()... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_11_string_xor | elixir | # 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.
defmodule HumanEval do
def candidate(a, b), do: string_xor(a, b)
def string_xor(a, b) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_11_string_xor.py | verbatim | 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
| [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_120_maximum | elixir | # Given an array arr of integers and a positive integer k, return a sorted list
# of length k with the maximum k numbers in arr.
# Example 1:
# Example 2:
# Example 3:
# Note:
# 1. The length of the array will be in the range of [1, 1000].
# 2. The elements in the array will be in the range of [-1000, 1000].
# 3. 0 <=... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_120_maximum.py | verbatim | 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.candi... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_121_solution | elixir | # Given a non-empty list of integers, return the sum of all of the odd elements that are in even positions.
# Examples
defmodule HumanEval do
def candidate(lst), do: solution(lst)
def solution(lst) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_121_solution.py | verbatim | 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 == HumanEv... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_122_add_elements | elixir | # Given a non-empty array of integers arr and an integer k, return
# the sum of the elements with at most two digits from the first k elements of arr.
# Example:
# 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(... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_122_add_elements.py | verbatim | 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)
as... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_123_get_odd_collatz | elixir | # 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... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_123_get_odd_collatz.py | verbatim | 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
| [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_124_valid_date | elixir | # 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. An... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_124_valid_date.py | verbatim | 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 ... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_125_split_words | elixir | # 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
defmodule HumanE... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_125_split_words.py | verbatim | 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 ... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_126_is_sorted | elixir | # 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
defmodule HumanEval do
def candidate(lst), do: is_sorted(lst)
def is_sorted(lst) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_126_is_sorted.py | verbatim | 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])
asser... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_127_intersection | elixir | # 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 t... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_127_intersection.py | verbatim | 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... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_128_prod_signs | elixir | # You are given an array arr of integers and you need to return
# sum of magnitudes of integers multiplied by product of all signs
# of each number in the array, represented by 1, -1 or 0.
# Note: return None for empty arr.
# Example:
defmodule HumanEval do
def candidate(arr), do: prod_signs(arr)
def prod_signs(ar... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_128_prod_signs.py | verbatim | 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 == HumanEv... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_129_minPath | elixir | # 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 ... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_129_minPath.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'minPath' do
assert [1, 2, 1] == HumanEval.candidate([[1, 2, 3], [4, 5, 6], [7, 8, 9]], 3)
assert [1] == HumanEval.candidate([[5, 9, 3], [4, 1, 6], [7, 8, 2]], 1)
assert [1, 2, 1, 2] == HumanEval.candidate([[1, 2, 3, 4], [5, 6, ... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_12_longest | elixir | # Out of list of strings, return the longest one. Return the first one in case of multiple
# strings of the same length. Return None in case the input list is empty.
defmodule HumanEval do
def candidate(strings), do: longest(strings)
def longest(strings) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_12_longest.py | verbatim | 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
| [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_130_tri | elixir | # 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 ... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_130_tri.py | verbatim | 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 ... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_131_digits | elixir | # Given a positive integer n, return the product of the odd digits.
# Return 0 if all digits are even.
# For example:
defmodule HumanEval do
def candidate(n), do: digits(n)
def digits(n) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_131_digits.py | verbatim | 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 == Hu... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_132_is_nested | elixir | # 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.
defmodule HumanEval do
def candidate(string), do: is_nested(string)
def is_nest... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_132_is_nested.py | verbatim | 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 == HumanEv... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_133_sum_squares | elixir | # 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:
defmodule HumanEval do
def candidate(lst), do: sum_squares(lst)
def sum_squares(lst) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_133_sum_squares.py | verbatim | 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])
... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_134_check_if_last_char_is_a_letter | elixir | # 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:
defmodule HumanEval do
def candidate(txt), do: check_if_last_char_is_a_letter(txt)
... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_134_check_if_last_char_is_a_letter.py | verbatim | 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")
asser... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_135_can_arrange | elixir | # Create a function which returns the largest index of an element which
# is not greater than or equal to the element immediately preceding it. If
# no such element exists then return -1. The given array will not contain
# duplicate values.
# Examples:
defmodule HumanEval do
def candidate(arr), do: can_arrange(arr)
... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_135_can_arrange.py | verbatim | 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])
... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_136_largest_smallest_integers | elixir | # 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 None.
# Examples:
defmodule HumanEval do
def candidate(lst), do: largest_smallest_integers(lst)
... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_136_largest_smallest_integers.py | verbatim | 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... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_137_compare_one | elixir | # Create a function that takes integers, floats, or strings representing
# real numbers, and returns the larger variable in its given variable type.
# Return None if the values are equal.
# Note: If a real number is represented as a string, the floating point might be . or ,
defmodule HumanEval do
def candidate(a, b... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_137_compare_one.py | verbatim | 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")
... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_138_is_equal_to_sum_even | elixir | # Evaluate whether the given number n can be written as the sum of exactly 4 positive even numbers
# Example
defmodule HumanEval do
def candidate(n), do: is_equal_to_sum_even(n)
def is_equal_to_sum_even(n) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_138_is_equal_to_sum_even.py | verbatim | 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)... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_139_special_factorial | elixir | # The Brazilian factorial is defined as:
# brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1!
# where n > 0
# For example:
# 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_f... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_139_special_factorial.py | verbatim | 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
| [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_13_greatest_common_divisor | elixir | # Return a greatest common divisor of two integers a and b
defmodule HumanEval do
def candidate(a, b), do: greatest_common_divisor(a, b)
def greatest_common_divisor(a, b) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_13_greatest_common_divisor.py | verbatim | 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
| [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_140_fix_spaces | elixir | # 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 -
defmodule HumanEval do
def candidate(text), do: fix_spaces(text)
def fix_spaces(text) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_140_fix_spaces.py | verbatim | 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")
... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_141_file_name_check | elixir | # 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 n... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_141_file_name_check.py | verbatim | 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")
ass... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_142_sum_squares | elixir | # "
# 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... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_142_sum_squares.py | verbatim | 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 == HumanE... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.