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_34_unique
elixir
# Return sorted unique elements in a list # >>> HumanEval.unique([5, 3, 5, 2, 3, 3, 9, 0, 123]) # [0, 2, 3, 5, 9, 123] defmodule HumanEval do def candidate(l), do: unique(l) def unique(l) do
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_34_unique.py
reworded
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. # >>> HumanEval.max_element([1, 2, 3]) # 3 # >>> HumanEval.max_element([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) # 123 defmodule HumanEval do def candidate(l), do: max_element(l) def max_element(l) do
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_35_max_element.py
reworded
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. # >>> HumanEval.fizz_buzz(50) # 0 # >>> HumanEval.fizz_buzz(78) # 2 # >>> HumanEval.fizz_buzz(79) # 3 defmodule HumanEval do def candidate(n), do: fizz_buzz(n) def fizz_buzz(n) do
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_36_fizz_buzz.py
reworded
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. # >>> HumanEval.sort_even([1, 2, 3]) # [1, 2, 3] # >>> HumanEval.sort_even([5, 6, 3, 4]) # [3, 6, 5, 4] defmo...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_37_sort_even.py
reworded
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. # >>> HumanEval.prime_fib(1) # 2 # >>> HumanEval.prime_fib(2) # 3 # >>> HumanEval.prime_fib(3) # 5 # >>> HumanEval.prime_fib(4) # 13 # >>> HumanEval.prime_fib(5) # 89 defmodule HumanEval do def candidate(n), do: prime_fib(n) def prime_...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_39_prime_fib.py
reworded
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. # >>> HumanEval.below_zero([1, 2, 3]) # false ...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_3_below_zero.py
reworded
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. # >>> HumanEval.triples_sum_to_zero([1, 3, 5, 0]) # false # >>> HumanEval.triples_sum_to_zero([1, 3, -2, 1]) # true # >>> HumanEval.triples_sum_to_zero(...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_40_triples_sum_to_zero.py
reworded
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_41_car_race_collision
elixir
# Imagine a road that's a perfectly straight infinitely long line. # n cars are driving left to right; simultaneously, a different set of n cars # are driving right to left. The two sets of cars start out being very far from # each other. All cars move in the same speed. Two cars are said to collide # when a car t...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_41_car_race_collision.py
reworded
ExUnit.start() defmodule HumanEvalTest do use ExUnit.Case, async: true test 'car_race_collision' do assert 4 == HumanEval.candidate(2) assert 9 == HumanEval.candidate(3) assert 16 == HumanEval.candidate(4) assert 64 == HumanEval.candidate(8) assert 100 == HumanEval.candidate(10) end end
[ "\ndefmodule", "\ndefp", "\ndef ", "\n#", "\n\n" ]
HumanEval_42_incr_list
elixir
# Return list with elements incremented by 1. # >>> HumanEval.incr_list([1, 2, 3]) # [2, 3, 4] # >>> HumanEval.incr_list([5, 3, 5, 2, 3, 3, 9, 0, 123]) # [6, 4, 6, 3, 4, 4, 10, 1, 124] defmodule HumanEval do def candidate(l), do: incr_list(l) def incr_list(l) do
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_42_incr_list.py
reworded
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. # >>> HumanEval.pairs_sum_to_zero([1, 3, 5, 0]) # false # >>> HumanEval.pairs_sum_to_zero([1, 3, -2, 1]) # false # >>> HumanEval.pairs_sum_to_zero([1, 2, 3,...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_43_pairs_sum_to_zero.py
reworded
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. # >>> HumanEval.change_base(8, 3) # "22" # >>> HumanEval.change_base(8, 2) # "1000" # >>> HumanEval.change_base(7, 2) # "111" defmodule HumanEval do def candidate(x, base), do: cha...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_44_change_base.py
reworded
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. # >>> HumanEval.triangle_area(5, 3) # 7.5 defmodule HumanEval do def candidate(a, h), do: triangle_area(a, h) def triangle_area(a, h) do
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_45_triangle_area.py
reworded
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...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_46_fib4.py
reworded
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. # >>> HumanEval.median([3, 1, 2, 4, 5]) # 3 # >>> HumanEval.median([-10, 4, 6, 1000, 10, 20]) # 15.0 defmodule HumanEval do def candidate(l), do: median(l) def median(l) do
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_47_median.py
reworded
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 # >>> HumanEval.is_palindrome("") # true # >>> HumanEval.is_palindrome("aba") # true # >>> HumanEval.is_palindrome("aaaaa") # true # >>> HumanEval.is_palindrome("zbcd") # false defmodule HumanEval do def candidate(text), do: is_palindrome(text) def is_palindrome(text) do ...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_48_is_palindrome.py
reworded
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). # >>> HumanEval.modp(3, 5) # 3 # >>> HumanEval.modp(1101, 101) # 2 # >>> HumanEval.modp(0, 101) # 1 # >>> HumanEval.modp(3, 11) # 8 # >>> HumanEval.modp(100, 101) # 1 defmodule HumanEval do def candidate(n, p), do: modp(n, p) def modp(n, p) do
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_49_modp.py
reworded
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 | # >>> HumanEval.mean_absolute_deviation([1.0, 2.0, 3.0, 4.0]...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_4_mean_absolute_deviation.py
reworded
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. # >>> HumanEval.remove_vowels("") # "" # >>> HumanEval.remove_vowels("abcdef") # "bcdf" # >>> HumanEval.remove_vowels("aaaaa") # "" # >>> HumanEval.remove_vowels("aaBAA") # "B" # >>> HumanEval.remove_vowels("zbcd") # "zbcd" defmodule Hu...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_51_remove_vowels.py
reworded
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. # >>> HumanEval.below_threshold([1, 2, 4, 10], 100) # true # >>> HumanEval.below_threshold([1, 20, 4, 10], 5) # false defmodule HumanEval do def candidate(l, t), do: below_threshold(l, t) def below_threshold(l, t) do
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_52_below_threshold.py
reworded
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 # >>> HumanEval.add(2, 3) # 5 # >>> HumanEval.add(5, 7) # 12 defmodule HumanEval do def candidate(x, y), do: add(x, y) def add(x, y) do
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_53_add.py
reworded
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. # >>> HumanEval.same_chars("eabcdzzzz", "dddzzzzzzzddeddabc") # true # >>> HumanEval.same_chars("abcd", "dddddddabc") # true # >>> HumanEval.same_chars("dddddddabc", "abcd") # true # >>> HumanEval.same_chars("eabcd", "dddddddabc") # false # >>> HumanEval.same_chars("abcd",...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_54_same_chars.py
reworded
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. # >>> HumanEval.fib(10) # 55 # >>> HumanEval.fib(1) # 1 # >>> HumanEval.fib(8) # 21 defmodule HumanEval do def candidate(n), do: fib(n) def fib(n) do
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_55_fib.py
reworded
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. # >>> HumanEval.correct_bracketing("<") # false # >>> HumanEval.correct_bracketing("<>") # true # >>> HumanEval.correct_bracketing("<<><>>") # true # >>> HumanEval.correct_bracketing("><<>") # false defmo...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_56_correct_bracketing.py
reworded
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. # >>> HumanEval.monotonic([1, 2, 4, 20]) # true # >>> HumanEval.monotonic([1, 20, 4, 10]) # false # >>> HumanEval.monotonic([4, 1, 0, -10]) # true defmodule HumanEval do def candidate(l), do: monotonic(l) def monotonic(l) do
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_57_monotonic.py
reworded
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. # >>> HumanEval.common([1, 4, 3, 34, 653, 2, 5], [5, 7, 1, 5, 9, 653, 121]) # [1, 5, 653] # >>> HumanEval.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
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_58_common.py
reworded
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. # >>> HumanEval.largest_prime_factor(13195) # 29 # >>> HumanEval.largest_prime_factor(2048) # 2 defmodule HumanEval do def candidate(n), do: largest_prime_factor(n) def largest_prime_factor(n) do
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_59_largest_prime_factor.py
reworded
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' # >>> HumanEval.intersperse([], 4) # [] # >>> HumanEval.intersperse([1, 2, 3], 4) # [1, 4, 2, 4, 3] defmodule HumanEval do def candidate(numbers, delimeter), do: intersperse(numbers, delimeter) def intersperse(numbers, del...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_5_intersperse.py
reworded
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. # >>> HumanEval.sum_to_n(30) # 465 # >>> HumanEval.sum_to_n(100) # 5050 # >>> HumanEval.sum_to_n(5) # 15 # >>> HumanEval.sum_to_n(10) # 55 # >>> HumanEval.sum_to_n(1) # 1 defmodule HumanEval do def candidate(n), do: sum_to_n(n) def sum_to_n(n) do
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_60_sum_to_n.py
reworded
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. # >>> HumanEval.correct_bracketing("(") # false # >>> HumanEval.correct_bracketing("()") # true # >>> HumanEval.correct_bracketing("(()())") # true # >>> HumanEval.correct_bracketing(")(()") # false defmo...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_61_correct_bracketing.py
reworded
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. # >>> HumanEval.derivative([3, 1, 2, 4, 5]) # [1, 4, 12, 20] # >>> HumanEval.derivative([1, 2, 3]) # [2, 6] defmodule HumanEval do def candidate(xs), do: derivative(xs) def...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_62_derivative.py
reworded
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. # >>> Human...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_63_fibfib.py
reworded
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: # >>> HumanEval.vowels_count("abcde") # 2 # >>>...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_64_vowels_count.py
reworded
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. # >>> HumanEval.circular_shift(12, 1) # "21" # >>> HumanEval.circular_shift(12, 2) # "12" defmodule HumanEval do def candidate(x, shift), do: circu...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_65_circular_shift.py
reworded
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: # >>> HumanEval.digitSum("") # 0 # >>> HumanEval.digitSum("abAB") # 131 # >>> HumanEval.digitSum("abcCd") # 67 # >>> HumanEval.digitSum("helloE") # 69 # >>> HumanEval.digitSum("woArBld") #...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_66_digitSum.py
reworded
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 ...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_67_fruit_distribution.py
reworded
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 a list 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 p...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_68_pluck.py
reworded
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: ...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_69_search.py
reworded
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. # >>> HumanEval.parse_nested_parens("(()()) ((())) () ((())()(...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_6_parse_nested_parens.py
reworded
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: # >>> HumanEval.strange_sort_list([1, 2, 3, 4]) # [1, 4, 2, 3] # >>> HumanEval.strange_sort_list([5, 5, 5, 5]) # [5, 5, 5, 5]...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_70_strange_sort_list.py
reworded
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: # >>> HumanEval.triangle_ar...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_71_triangle_area.py
reworded
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: # >>> HumanEval.will_it_fly([1, 2], 5) # false # # 1+2 is less than the maxi...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_72_will_it_fly.py
reworded
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 a list arr of integers, find the minimum number of elements that # need to be changed to make the list palindromic. A palindromic list is a list that # is read the same backwards and forwards. In one change, you can change one element to any other element. # For example: # >>> HumanEval.smallest_change([1, 2, 3...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_73_smallest_change.py
reworded
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 # >>> HumanEval.total_match([], []) # [] # >>> HumanEval.total_match(["...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_74_total_match.py
reworded
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: # >>> HumanEval.is_multiply_prime(30) # true # 30 = 2 * 3 * 5 defmodule HumanEval do def candidate(a), do: is_multiply_prime(a) def is_multiply_p...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_75_is_multiply_prime.py
reworded
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: # >>> HumanEval.is_simple_power(1, 4) # true # >>> HumanEval.is_simple_power(2, 2) # true # >>> HumanEval.is_simple_power(8, 2) # true # >>> HumanEv...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_76_is_simple_power.py
reworded
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: # >>> HumanEval.iscube(1) # true # >>> HumanEval.iscube(2) # false # >>> HumanEval.iscube(-1) # true # >>> HumanEval.iscube(64) # true # >>> Huma...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_77_iscube.py
reworded
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...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_78_hex_key.py
reworded
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 ...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_79_decimal_to_binary.py
reworded
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 # >>> HumanEval.filter_by_substring([], "a") # [] # >>> HumanEval.filter_by_substring(["abc", "bacd", "cde", "array"], "a") # ["abc", "bacd", "array"] defmodule HumanEval do def candidate(strings, substring), do: filter_by_substring(strings...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_7_filter_by_substring.py
reworded
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 hapelixir or not. # A string is hapelixir if its length is at least 3 and every 3 consecutive letters are distinct # For example: # >>> HumanEval.is_happy("a") # false # >>> HumanEval.is_happy("aa") # false # >>> HumanEval.is_happy("abcd") # true # >>...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_80_is_happy.py
reworded
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...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_81_numerical_letter_grade.py
reworded
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 # >>> HumanEval.prime_length("Hello") # true # >>> HumanEval.prime_length("abcdcba") # true # >>> HumanEval.prime_length("kittens") # true # >>> HumanEval.prime_length("orange") # false defmod...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_82_prime_length.py
reworded
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
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_83_starts_one_ends.py
reworded
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 # >>> HumanEval.solve(1000) # "1" # >>> HumanEval.solve(150) # "110" # >>> HumanEval.solve(147) # "1100" # Variables: # @N integer # Constraints: 0 ≤ N ≤ 10000. # Output: # a string of binary number defmodule HumanEval do def candi...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_84_solve.py
reworded
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: # >>> HumanEval.add([4, 2, 6, 7]) # 2 defmodule HumanEval do def candidate(lst), do: add(lst) def add(lst) do
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_85_add.py
reworded
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...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_86_anti_shuffle.py
reworded
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 - (...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_87_get_row.py
reworded
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 a list of non-negative integers, return a coelixir of the given list after sorting, # you will sort the given list 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...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_88_sort_array.py
reworded
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: # >>> HumanEval.encrypt("hi") # "lm" # >>> HumanEval.encrypt(...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_89_encrypt.py
reworded
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. # >>> HumanEval.sum_product([]) # {0, 1} # >>> HumanEval.sum_product([1, 2, 3, 4]) # {10, 24} defmodule HumanEval do def candidate(n...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_8_sum_product.py
reworded
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 nil if there is no such element. # >>> HumanEval.next_smallest([1, 2, 3, 4, 5]) # 2 # >>> HumanEval.next_smallest([5, 1, 4, 3, 2]) # 2 # >>> HumanEval.next_smallest([]) # nil # >>> HumanEva...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_90_next_smallest.py
reworded
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: # >>> HumanEval.is_bored("Hello world") # 0 # >>> HumanEval.is_bored("The sky is blue. The sun is shining. I love t...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_91_is_bored.py
reworded
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 # >>> HumanEval.any_int(5, 2, 7) # true # >>> HumanEval.any_int(3, 2, 2) # false # >>> HumanEval.any_int(3, -2, 1) # true # >>...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_92_any_int.py
reworded
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: # >>> HumanEval.encode("test") # "TGST" # >>> HumanEva...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_93_encode.py
reworded
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: # >>> HumanEval.skjkasdkd([0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3]) # 10 # >>> HumanEval.skjkasdkd([1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1]) # 2...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_94_skjkasdkd.py
reworded
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 map, 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 map is empty. # Examples: # >>> HumanEval.check_dict_case(%{"a" => "apple", "b" => "banana"}) # true # >>> HumanEval.check_dict_case(%{"a" => "app...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_95_check_dict_case.py
reworded
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 a list of the first n # integers that are prime numbers and less than n. # for example: # >>> HumanEval.count_up_to(5) # [2, 3] # >>> HumanEval.count_up_to(11) # [2, 3, 5, 7] # >>> HumanEval.count_up_to(0) # [] # >>> HumanEval.count_up_to(20) # [2, 3...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_96_count_up_to.py
reworded
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: # >>> HumanEval.multiply(148, 412) # 16 # >>> HumanEval.multiply(19, 28) # 72 # >>> HumanEval.multiply(2020, 1851) # 0 # >>> HumanEval.multiply(14, -15) # 20 defmodule HumanE...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_97_multiply.py
reworded
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: # >>> HumanEval.count_upper("aBCdEf") # 1 # >>> HumanEval.count_upper("abcdefg") # 0 # >>> HumanEval.count_upper("dBBE") # 0 defmodule HumanEval do def candidate(s), do: count_upper(s) def count_upper(s) do
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_98_count_upper.py
reworded
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 # >>> HumanEval.closest_integer("10") # 10 # >>> HumanEval.closest_integer("15.3") # 15 # Note: # Rounding away from zero m...
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_99_closest_integer.py
reworded
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. # >>> HumanEval.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
transform
/home/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_9_rolling_max.py
reworded
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. # >>> HumanEval.has_close_elements([1.0, 2.0, 3.0], 0.5) # false # >>> HumanEval.has_close_elements([1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3) # true defmodule HumanEval do def candidate(numbers, threshold), do: has_close...
transform
/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...
transform
/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: # >>> HumanEval.words_string("Hi, my name is John") # ["Hi", "my", "name", "is", "John"] # >>> HumanEval.words_string("One, two, three, four, five, six") # ...
transform
/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: # >>> HumanEval.choose_num(12, 15) # 14 # >>> HumanEval.choose_num(13, 12) # -1 defmodule HumanEval do...
transform
/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: # >>> HumanEval.rounded_avg(1, 5) # "0b11" # >>> HumanEval...
transform
/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: # >>> HumanEval.unique_digits([15, 33, 1422, 1]) # [1, 15, 33] # >>> HumanEval.unique_digits([152, 323, 1422, 10]) # [] defmodule HumanEv...
transform
/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: # >>> HumanEval.by_length([2, 1, 1, 4, 5, 8, 2, 3]) # ["E...
transform
/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 * ... * ...
transform
/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: # >>> HumanEval.even_odd_palindrome(3) # {1, 2} # Explanation: # Integer palindrome are 1, 2, 3. one of them is even, and two of them are odd. # Example 2: # >...
transform
/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. # >>> HumanEval.count_nums([]) # 0 # >>> HumanEval.count_nums([-1, 11, -...
transform
/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...
transform
/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. # >>> HumanEval.make_palindrome("") # "" # >>> Hum...
transform
/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...
transform
/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: # >>> HumanEval.histogram("a b c") # %{"a" => 1, "b" => 1, "c" => 1} # >>>...
transform
/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...
transform
/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. # >>> HumanEval.odd_count(["12345...
transform
/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 # >>> HumanEval.minSubArraySum([2, 3, 4, 1, 2, 4]) # 1 # >>> HumanEval.minSubArraySum([-1, -2, -3]) # -6 defmodule HumanEval do def candidate(nums), do: minSubArraySum(nums) def minSubArraySum(nums) do
transform
/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...
transform
/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: # >>> HumanEval.sort_array([1, 5, 2, 3, 4]) # [1, 2, 3, 4, 5] # >>> HumanEval...
transform
/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...
transform
/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...
transform
/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 ...
transform
/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. # >>> HumanEval.string_xor("010", "110") # "100" defmodule HumanEval do def candidate(a, b), do: string_xor(a, b) def string_xor(a, b) do
transform
/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: # >>> HumanEval.maximum([-3, -4, 5], 3) # [-4, -3, 5] # Example 2: # >>> HumanEval.maximum([4, -4, 4], 2) # [4, 4] # Example 3: # >>> HumanEval.maximum([-3, 2, 1, 2, -1, -2, 1],...
transform
/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 # >>> HumanEval.solution([5, 8, 7, 1]) # 12 # >>> HumanEval.solution([3, 3, 3, 3, 3]) # 9 # >>> HumanEval.solution([30, 13, 24, 321]) # 0 defmodule HumanEval do def candidate(lst), do: solution(lst)...
transform
/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: # >>> HumanEval.add_elements([111, 21, 3, 4000, 5, 6, 7, 8, 9], 4) # 24 # Constraints: # 1. 1 <= len(arr) <= 100 # 2. 1 <= k <= len(arr) defmodule HumanEval ...
transform
/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...
transform
/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...
transform
/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 # >>> HumanEval.s...
transform
/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" ]