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_143_words_in_sentence | elixir | # 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... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_143_words_in_sentence.py | verbatim | 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")
... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_144_simplify | elixir | # 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 a... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_144_simplify.py | verbatim | 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... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_145_order_by_points | elixir | # 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:
defmodule HumanEval do
def candidate(nums), do: order_by_points(... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_145_order_by_points.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'order_by_points' do
assert [-1, -11, 1, -12, 11] == HumanEval.candidate([1, 11, -1, -11, -12])
assert [0, 2, 3, 6, 53, 423, 423, 423, 1234, 145, 37, 46, 56, 463, 3457] == HumanEval.candidate([1234, 423, 463, 145, 2, 423, 423, 53, 6... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_146_specialFilter | elixir | # Write a function that takes an array of numbers as input and returns
# the number of elements in the array that are greater than 10 and both
# first and last digits of a number are odd (1, 3, 5, 7, 9).
# For example:
defmodule HumanEval do
def candidate(nums), do: specialFilter(nums)
def specialFilter(nums) do... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_146_specialFilter.py | verbatim | 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, ... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_147_get_max_triples | elixir | # You are given a positive integer n. You have to create an integer array a of length n.
# For each i (1 ≤ i ≤ n), the value of a[i] = i * i - i + 1.
# Return the number of triples (a[i], a[j], a[k]) of a where i < j < k,
# and a[i] + a[j] + a[k] is a multiple of 3.
# Example :
# Explanation:
# a = [1, 3, 7, 13, 21]
... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_147_get_max_triples.py | verbatim | 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
| [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_148_bf | elixir | # 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... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_148_bf.py | verbatim | 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"... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_149_sorted_list_sum | elixir | # 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 an array of numbers,
# and it may contain duplicates.
# The order of the list should be ascending b... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_149_sorted_list_sum.py | verbatim | 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"])
asser... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_14_all_prefixes | elixir | # Return list of all prefixes from shortest to longest of the input string
defmodule HumanEval do
def candidate(string), do: all_prefixes(string)
def all_prefixes(string) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_14_all_prefixes.py | verbatim | 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
| [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_150_x_or_y | elixir | # 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:
defmodule HumanEval do
def candidate(n, x, y), do: x_or_y(n, x, y)
def x_or_y(n, x, y) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_150_x_or_y.py | verbatim | 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.candidat... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_151_double_the_difference | elixir | # 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.
# 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
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_151_double_the_difference.py | verbatim | 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... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_152_compare | elixir | # 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 arra... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_152_compare.py | verbatim | 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.candid... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_153_Strongest_Extension | elixir | # 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
# ... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_153_Strongest_Extension.py | verbatim | 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"])
ass... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_154_cycpattern_check | elixir | # 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
defmodule HumanEval do
def candidate(a, b), do: cycpattern_check(a, b)
def cycpattern_check(a, b) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_154_cycpattern_check.py | verbatim | 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", "f... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_155_even_odd_count | elixir | # Given an integer. return a tuple that has the number of even and odd digits respectively.
# Example:
defmodule HumanEval do
def candidate(num), do: even_odd_count(num)
def even_odd_count(num) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_155_even_odd_count.py | verbatim | 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.can... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_156_int_to_mini_roman | elixir | # Given a positive integer, obtain its roman numeral equivalent as a string,
# and return it in lowercase.
# Restrictions: 1 <= num <= 1000
# Examples:
defmodule HumanEval do
def candidate(number), do: int_to_mini_roman(number)
def int_to_mini_roman(number) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_156_int_to_mini_roman.py | verbatim | 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.candi... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_157_right_angle_triangle | elixir | # 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:
defmodule HumanEval do
def candidate(a, b, c), do: right_angle_triangle(a, b, c)
... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_157_right_angle_triangle.py | verbatim | 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 == ... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_158_find_max | elixir | # 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.
defmodule HumanEval do
def candidate(words), d... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_158_find_max.py | verbatim | 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" == H... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_159_eat | elixir | # You're a hungry rabbit, and you already have eaten a certain number of carrots,
# but now you need to eat more carrots to complete the day's meals.
# you should return an array of [ total number of eaten carrots after your meals,
# the number of carrots left after your meals ]
# if there are not enough remaining carr... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_159_eat.py | verbatim | 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] == Hum... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_15_string_sequence | elixir | # Return a string containing space-delimited numbers starting from 0 upto n inclusive.
defmodule HumanEval do
def candidate(n), do: string_sequence(n)
def string_sequence(n) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_15_string_sequence.py | verbatim | 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
| [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_161_solve | elixir | # 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
defmodule HumanEval do
def candidate(s), do: solve(s)
def solve... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_161_solve.py | verbatim | 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.c... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_162_string_to_md5 | elixir | # Given a string 'text', return its md5 hash equivalent string.
# If 'text' is an empty string, return None.
defmodule HumanEval do
def candidate(text), do: string_to_md5(text)
def string_to_md5(text) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_162_string_to_md5.py | verbatim | 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 "5f4dc... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_163_generate_integers | elixir | # Given two positive integers a and b, return the even digits between a
# and b, in ascending order.
# For example:
defmodule HumanEval do
def candidate(a, b), do: generate_integers(a, b)
def generate_integers(a, b) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_163_generate_integers.py | verbatim | 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... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_16_count_distinct_characters | elixir | # Given a string, find out how many distinct characters (regardless of case) does it consist of
defmodule HumanEval do
def candidate(string), do: count_distinct_characters(string)
def count_distinct_characters(string) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_16_count_distinct_characters.py | verbatim | 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 == Hum... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_17_parse_music | elixir | # 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 no... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_17_parse_music.py | verbatim | 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|... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_18_how_many_times | elixir | # Find how many times a given substring can be found in the original string. Count overlaping cases.
defmodule HumanEval do
def candidate(string, substring), do: how_many_times(string, substring)
def how_many_times(string, substring) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_18_how_many_times.py | verbatim | 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
| [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_19_sort_numbers | elixir | # 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
defmodule HumanEval do
def candidate(numbers), do: sort_numbers(numbers)
de... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_19_sort_numbers.py | verbatim | 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.c... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_1_separate_paren_groups | elixir | # 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.
... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_1_separate_paren_groups.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'separate_paren_groups' do
assert ["(()())", "((()))", "()", "((())()())"] == HumanEval.candidate("(()()) ((())) () ((())()())")
assert ["()", "(())", "((()))", "(((())))"] == HumanEval.candidate("() (()) ((())) (((())))")
asser... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_20_find_closest_elements | elixir | # 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).
defmodule HumanEval do
def candidate(numbers), do: find_closest_elements(numbers)
def find_closest_elements(numbers) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_20_find_closest_elements.py | verbatim | 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... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_21_rescale_to_unit | elixir | # 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
defmodule HumanEval do
def candidate(numbers), do: rescale_to_unit(numbers)
def rescale_to_unit(numbers) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_21_rescale_to_unit.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'rescale_to_unit' do
assert [0.0, 1.0] == HumanEval.candidate([2.0, 49.9])
assert [1.0, 0.0] == HumanEval.candidate([100.0, 49.9])
assert [0.0, 0.25, 0.5, 0.75, 1.0] == HumanEval.candidate([1.0, 2.0, 3.0, 4.0, 5.0])
assert [... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_22_filter_integers | elixir | # Filter given list of any python values only for integers
defmodule HumanEval do
def candidate(values), do: filter_integers(values)
def filter_integers(values) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_22_filter_integers.py | verbatim | 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
| [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_23_strlen | elixir | # Return length of given string
defmodule HumanEval do
def candidate(string), do: strlen(string)
def strlen(string) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_23_strlen.py | verbatim | 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
| [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_24_largest_divisor | elixir | # For a given number n, find the largest number that divides n evenly, smaller than n
defmodule HumanEval do
def candidate(n), do: largest_divisor(n)
def largest_divisor(n) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_24_largest_divisor.py | verbatim | 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
| [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_25_factorize | elixir | # 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
defmodule HumanEval do
def candidate(n), do: factori... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_25_factorize.py | verbatim | 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.candidat... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_26_remove_duplicates | elixir | # From a list of integers, remove all elements that occur more than once.
# Keep order of elements left the same as in the input.
defmodule HumanEval do
def candidate(numbers), do: remove_duplicates(numbers)
def remove_duplicates(numbers) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_26_remove_duplicates.py | verbatim | 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
| [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_27_flip_case | elixir | # For a given string, flip lowercase characters to uppercase and uppercase to lowercase.
defmodule HumanEval do
def candidate(string), do: flip_case(string)
def flip_case(string) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_27_flip_case.py | verbatim | 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
| [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_28_concatenate | elixir | # Concatenate list of strings into a single string
defmodule HumanEval do
def candidate(strings), do: concatenate(strings)
def concatenate(strings) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_28_concatenate.py | verbatim | 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
| [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_29_filter_by_prefix | elixir | # Filter an input list of strings only for ones that start with a given prefix.
defmodule HumanEval do
def candidate(strings, prefix), do: filter_by_prefix(strings, prefix)
def filter_by_prefix(strings, prefix) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_29_filter_by_prefix.py | verbatim | 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
| [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_2_truncate_number | elixir | # 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.
defmodule HumanEval do
def candidate(number), do: truncate_number(number)
def truncate_nu... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_2_truncate_number.py | verbatim | 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
| [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_30_get_positive | elixir | # Return only positive numbers in the list.
defmodule HumanEval do
def candidate(l), do: get_positive(l)
def get_positive(l) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_30_get_positive.py | verbatim | 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 ... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_31_is_prime | elixir | # Return true if a given number is prime, and false otherwise.
defmodule HumanEval do
def candidate(n), do: is_prime(n)
def is_prime(n) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_31_is_prime.py | verbatim | 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)
ass... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_33_sort_third | elixir | # 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.
defmodule HumanEval do
def candidate(l), do: so... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_33_sort_third.py | verbatim | 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, ... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_34_unique | elixir | # Return sorted unique elements in a list
defmodule HumanEval do
def candidate(l), do: unique(l)
def unique(l) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_34_unique.py | verbatim | 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
| [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_35_max_element | elixir | # Return maximum element in the list.
defmodule HumanEval do
def candidate(l), do: max_element(l)
def max_element(l) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_35_max_element.py | verbatim | 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
| [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_36_fizz_buzz | elixir | # Return the number of times the digit 7 appears in integers less than n which are divisible by 11 or 13.
defmodule HumanEval do
def candidate(n), do: fizz_buzz(n)
def fizz_buzz(n) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_36_fizz_buzz.py | verbatim | 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 == Human... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_37_sort_even | elixir | # 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.
defmodule HumanEval do
def candidate(l), do: sort_even(l)
def sort_even(l) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_37_sort_even.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'sort_even' do
assert [1, 2, 3] == HumanEval.candidate([1, 2, 3])
assert [-10, 3, -5, 2, -3, 3, 5, 0, 9, 1, 123] == HumanEval.candidate([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])
assert [-12, 8, 3, 4, 5, 2, 12, 11, 23, -10] == Hum... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_39_prime_fib | elixir | # prime_fib returns n-th number that is a Fibonacci number and it's also prime.
defmodule HumanEval do
def candidate(n), do: prime_fib(n)
def prime_fib(n) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_39_prime_fib.py | verbatim | 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.... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_3_below_zero | elixir | # 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.
defmodule HumanEval do
def candidate(operat... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_3_below_zero.py | verbatim | 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,... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_40_triples_sum_to_zero | elixir | # 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.
defmodule HumanEval do
def candidate(l), do: triples_sum_to_zero(l)
def triples_sum_to_zero(l) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_40_triples_sum_to_zero.py | verbatim | 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]... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_42_incr_list | elixir | # Return list with elements incremented by 1.
defmodule HumanEval do
def candidate(l), do: incr_list(l)
def incr_list(l) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_42_incr_list.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'incr_list' do
assert [] == HumanEval.candidate([])
assert [4, 3, 2] == HumanEval.candidate([3, 2, 1])
assert [6, 3, 6, 3, 4, 4, 10, 1, 124] == HumanEval.candidate([5, 2, 5, 2, 3, 3, 9, 0, 123])
end
end
| [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_43_pairs_sum_to_zero | elixir | # pairs_sum_to_zero takes a list of integers as an input.
# it returns True if there are two distinct elements in the list that
# sum to zero, and False otherwise.
defmodule HumanEval do
def candidate(l), do: pairs_sum_to_zero(l)
def pairs_sum_to_zero(l) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_43_pairs_sum_to_zero.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'pairs_sum_to_zero' do
assert false == HumanEval.candidate([1, 3, 5, 0])
assert false == HumanEval.candidate([1, 3, -2, 1])
assert false == HumanEval.candidate([1, 2, 3, 7])
assert true == HumanEval.candidate([2, 4, -5, 3, 5... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_44_change_base | elixir | # Change numerical base of input number x to base.
# return string representation after the conversion.
# base numbers are less than 10.
defmodule HumanEval do
def candidate(x, base), do: change_base(x, base)
def change_base(x, base) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_44_change_base.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'change_base' do
assert "22" == HumanEval.candidate(8, 3)
assert "100" == HumanEval.candidate(9, 3)
assert "11101010" == HumanEval.candidate(234, 2)
assert "10000" == HumanEval.candidate(16, 2)
assert "1000" == HumanEval... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_45_triangle_area | elixir | # Given length of a side and high return area for a triangle.
defmodule HumanEval do
def candidate(a, h), do: triangle_area(a, h)
def triangle_area(a, h) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_45_triangle_area.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'triangle_area' do
assert 7.5 == HumanEval.candidate(5, 3)
assert 2.0 == HumanEval.candidate(2, 2)
assert 40.0 == HumanEval.candidate(10, 8)
end
end
| [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_46_fib4 | elixir | # The Fib4 number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
# fib4(0) -> 0
# fib4(1) -> 0
# fib4(2) -> 2
# fib4(3) -> 0
# fib4(n) -> fib4(n-1) + fib4(n-2) + fib4(n-3) + fib4(n-4).
# Please write a function to efficiently compute the n-th element of the fib4 number sequence. D... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_46_fib4.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'fib4' do
assert 4 == HumanEval.candidate(5)
assert 28 == HumanEval.candidate(8)
assert 104 == HumanEval.candidate(10)
assert 386 == HumanEval.candidate(12)
end
end
| [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_47_median | elixir | # Return median of elements in the list l.
defmodule HumanEval do
def candidate(l), do: median(l)
def median(l) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_47_median.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'median' do
assert 3 == HumanEval.candidate([3, 1, 2, 4, 5])
assert 8.0 == HumanEval.candidate([-10, 4, 6, 1000, 10, 20])
assert 5 == HumanEval.candidate([5])
assert 5.5 == HumanEval.candidate([6, 5])
assert 7 == HumanEv... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_48_is_palindrome | elixir | # Checks if given string is a palindrome
defmodule HumanEval do
def candidate(text), do: is_palindrome(text)
def is_palindrome(text) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_48_is_palindrome.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'is_palindrome' do
assert true == HumanEval.candidate("")
assert true == HumanEval.candidate("aba")
assert true == HumanEval.candidate("aaaaa")
assert false == HumanEval.candidate("zbcd")
assert true == HumanEval.candida... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_49_modp | elixir | # Return 2^n modulo p (be aware of numerics).
defmodule HumanEval do
def candidate(n, p), do: modp(n, p)
def modp(n, p) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_49_modp.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'modp' do
assert 3 == HumanEval.candidate(3, 5)
assert 2 == HumanEval.candidate(1101, 101)
assert 1 == HumanEval.candidate(0, 101)
assert 8 == HumanEval.candidate(3, 11)
assert 1 == HumanEval.candidate(100, 101)
asse... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_4_mean_absolute_deviation | elixir | # For a given list of input numbers, calculate Mean Absolute Deviation
# around the mean of this dataset.
# Mean Absolute Deviation is the average absolute difference between each
# element and a centerpoint (mean in this case):
# MAD = average | x - x_mean |
defmodule HumanEval do
def candidate(numbers), do: mean_a... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_4_mean_absolute_deviation.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'mean_absolute_deviation' do
assert 0.5 == HumanEval.candidate([1.0, 2.0])
assert 1.0 == HumanEval.candidate([1.0, 2.0, 3.0, 4.0])
assert 1.2 == HumanEval.candidate([1.0, 2.0, 3.0, 4.0, 5.0])
end
end
| [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_51_remove_vowels | elixir | # remove_vowels is a function that takes string and returns string without vowels.
defmodule HumanEval do
def candidate(text), do: remove_vowels(text)
def remove_vowels(text) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_51_remove_vowels.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'remove_vowels' do
assert "" == HumanEval.candidate("")
assert "bcdf
ghjklm" == HumanEval.candidate("abcdef
ghijklm")
assert "fdcb" == HumanEval.candidate("fedcba")
assert "" == HumanEval.candidate("eeeee")
assert "cB" =... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_52_below_threshold | elixir | # Return True if all numbers in the list l are below threshold t.
defmodule HumanEval do
def candidate(l, t), do: below_threshold(l, t)
def below_threshold(l, t) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_52_below_threshold.py | verbatim | ExUnit.start()
defmodule HumanEvalTest do
use ExUnit.Case, async: true
test 'below_threshold' do
assert true == HumanEval.candidate([1, 2, 4, 10], 100)
assert false == HumanEval.candidate([1, 20, 4, 10], 5)
assert true == HumanEval.candidate([1, 20, 4, 10], 21)
assert true == HumanEval.candidate([1,... | [
"\ndefmodule",
"\ndefp",
"\ndef ",
"\n#",
"\n\n"
] |
HumanEval_53_add | elixir | # Add two numbers x and y
defmodule HumanEval do
def candidate(x, y), do: add(x, y)
def add(x, y) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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.
defmodule HumanEval do
def candidate(s0, s1), do: same_chars(s0, s1)
def same_chars(s0, s1) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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.
defmodule HumanEval do
def candidate(n), do: fib(n)
def fib(n) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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.
defmodule HumanEval do
def candidate(brackets), do: correct_bracketing(brackets)
def correct_bracketing(brackets) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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.
defmodule HumanEval do
def candidate(l), do: monotonic(l)
def monotonic(l) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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.
defmodule HumanEval do
def candidate(l1, l2), do: common(l1, l2)
def common(l1, l2) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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.
defmodule HumanEval do
def candidate(n), do: largest_prime_factor(n)
def largest_prime_factor(n) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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'
defmodule HumanEval do
def candidate(numbers, delimeter), do: intersperse(numbers, delimeter)
def intersperse(numbers, delimeter) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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.
defmodule HumanEval do
def candidate(n), do: sum_to_n(n)
def sum_to_n(n) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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.
defmodule HumanEval do
def candidate(brackets), do: correct_bracketing(brackets)
def correct_bracketing(brackets) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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.
defmodule HumanEval do
def candidate(xs), do: derivative(xs)
def derivative(xs) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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.
defmodule ... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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:
defmodule HumanEval do
def candidate(s), do:... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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.
defmodule HumanEval do
def candidate(x, shift), do: circular_shift(x, shift)
def circular_shift(x, shift) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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:
defmodule HumanEval do
def candidate(s), do: digitSum(s)
def digitSum(s) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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 ... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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:
... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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.
defmodule HumanEval do
def candidate(paren_string), do: par... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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:
defmodule HumanEval do
def candidate(lst), do: strange_sort_list(lst)
def strange_sort_list(lst) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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:
defmodule HumanEval do
d... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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:
# # 1+2 is less than the maximum possible weight, but it's unbalanced.
# # i... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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:
defmodule HumanEval do
def cand... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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
defmodule HumanEval do
def candidate(lst1, lst2), do: total_match(ls... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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:
# 30 = 2 * 3 * 5
defmodule HumanEval do
def candidate(a), do: is_multiply_prime(a)
def is_multiply_prime(a) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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:
defmodule HumanEval do
def candidate(x, n), do: is_simple_power(x, n)
def is_simple_power(x, n) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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:
defmodule HumanEval do
def candidate(a), do: iscube(a)
def iscube(a) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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 ... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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
defmodule HumanEval do
def candidate(strings, substring), do: filter_by_substring(strings, substring)
def filter_by_substring(strings, substring) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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:
defmodule HumanEval do
def candidate(s), do: is_happy(s)
def is_happy(s) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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
defmodule HumanEval do
def candidate(string), do: prime_length(string)
def prime_length(string) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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_84_solve | elixir | # Given a positive integer N, return the total sum of its digits in binary.
# Example
# Variables:
# @N integer
# Constraints: 0 ≤ N ≤ 10000.
# Output:
# a string of binary number
defmodule HumanEval do
def candidate(N), do: solve(N)
def solve(N) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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:
defmodule HumanEval do
def candidate(lst), do: add(lst)
def add(lst) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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 - (... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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:
defmodule HumanEval do
def candidate(s), do: encrypt(s)
... | remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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.
defmodule HumanEval do
def candidate(numbers), do: sum_product(numbers)
def sum_product(numbers) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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.
defmodule HumanEval do
def candidate(lst), do: next_smallest(lst)
def next_smallest(lst) do
| remove | /home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.