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_91_is_bored | hs | -- | 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:
-- >>> isBored "Hello world"
-- 0
-- >>> isBored "The sky is blue. The sun is shining. I love this weat... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_91_is_bored.py | reworded |
main :: IO ()
main = do
let candidate = isBored
if candidate "Hello world" == 0 then pure () else error "assertion failed"
if candidate "Is the sky blue?" == 0 then pure () else error "assertion failed"
if candidate "I love It !" == 1 then pure () else error "assertion failed"
if candidate "bIt" == 0 then pu... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_92_any_int | hs | -- | 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
-- >>> anyInt 5 2 7
-- True
-- >>> anyInt 3 2 2
-- False
-- >>> anyInt 3 (-2) 1
-- True
-- >>> anyInt 3.6 -2.2... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_92_any_int.py | reworded |
main :: IO ()
main = do
let candidate = anyInt
if candidate 2.0 3.0 1.0 == True then pure () else error "assertion failed"
if candidate 2.5 2.0 3.0 == False then pure () else error "assertion failed"
if candidate 1.5 5.0 3.5 == False then pure () else error "assertion failed"
if candidate 2.0 6.0 2.0 == Fals... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_93_encode | hs | -- | Write a function that takes a message, and encodes in such a
-- way that it swaps case of all letters, replaces all vowels in
-- the message with the letter that appears 2 places ahead of that
-- vowel in the english alphabet.
-- Assume only letters.
-- Examples:
-- >>> encode "test"
-- "TGST"
-- >>> ... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_93_encode.py | reworded |
main :: IO ()
main = do
let candidate = encode
if candidate "TEST" == "tgst" then pure () else error "assertion failed"
if candidate "Mudasir" == "mWDCSKR" then pure () else error "assertion failed"
if candidate "YES" == "ygs" then pure () else error "assertion failed"
if candidate "This is a message" == "tH... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_94_skjkasdkd | hs | -- | You are given a list of integers.
-- You need to find the largest prime value and return the sum of its digits.
-- Examples:
-- >>> skjkasdkd [0,3,2,1,3,5,7,4,5,5,5,2,181,32,4,32,3,2,32,324,4,3]
-- 10
-- >>> skjkasdkd [1,0,1,8,2,4597,2,1,3,40,1,2,1,2,4,2,5,1]
-- 25
-- >>> skjkasdkd [1,3,1,32,5107,34,83278,1... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_94_skjkasdkd.py | reworded |
main :: IO ()
main = do
let candidate = skjkasdkd
if candidate [0,3,2,1,3,5,7,4,5,5,5,2,181,32,4,32,3,2,32,324,4,3] == 10 then pure () else error "assertion failed"
if candidate [1,0,1,8,2,4597,2,1,3,40,1,2,1,2,4,2,5,1] == 25 then pure () else error "assertion failed"
if candidate [1,3,1,32,5107,34,83278,109,1... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_95_check_dict_case | hs | -- | Given an association list, 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 association list is empty.
-- Examples:
-- >>> checkDictCase [("a", "apple"), ("b", "banana")]
-- True
-- >>> checkDictCa... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_95_check_dict_case.py | reworded |
main :: IO ()
main = do
let candidate = checkDictCase
if candidate [("p", "pineapple"), ("b", "banana")] == True then pure () else error "assertion failed"
if candidate [("p", "pineapple"), ("A", "banana"), ("B", "banana")] == False then pure () else error "assertion failed"
if candidate [("p", "pineapple"), (... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_96_count_up_to | hs | -- | 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:
-- >>> countUpTo 5
-- [2,3]
-- >>> countUpTo 11
-- [2,3,5,7]
-- >>> countUpTo 0
-- []
-- >>> countUpTo 20
-- [2,3,5,7,11,13,17,19]
-- >>> countUpT... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_96_count_up_to.py | reworded |
main :: IO ()
main = do
let candidate = countUpTo
if candidate 5 == [2,3] then pure () else error "assertion failed"
if candidate 6 == [2,3,5] then pure () else error "assertion failed"
if candidate 7 == [2,3,5] then pure () else error "assertion failed"
if candidate 10 == [2,3,5,7] then pure () else error "... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_97_multiply | hs | -- | Complete the function that takes two integers and returns
-- the product of their unit digits.
-- Assume the input is always valid.
-- Examples:
-- >>> multiply 148 412
-- 16
-- >>> multiply 19 28
-- 72
-- >>> multiply 2020 1851
-- 0
-- >>> multiply 14 (-15)
-- 20
multiply :: Int -> Int -> Int
multiply... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_97_multiply.py | reworded |
main :: IO ()
main = do
let candidate = multiply
if candidate 148 412 == 16 then pure () else error "assertion failed"
if candidate 19 28 == 72 then pure () else error "assertion failed"
if candidate 2020 1851 == 0 then pure () else error "assertion failed"
if candidate 14 (-15) == 20 then pure () else error... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_98_count_upper | hs | -- | Given a string s, count the number of uppercase vowels in even indices.
-- For example:
-- >>> countUpper "aBCdEf"
-- 1
-- >>> countUpper "abcdefg"
-- 0
-- >>> countUpper "dBBE"
-- 0
countUpper :: String -> Int
countUpper s = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_98_count_upper.py | reworded |
main :: IO ()
main = do
let candidate = countUpper
if candidate "aBCdEf" == 1 then pure () else error "assertion failed"
if candidate "abcdefg" == 0 then pure () else error "assertion failed"
if candidate "dBBE" == 0 then pure () else error "assertion failed"
if candidate "B" == 0 then pure () else error "as... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_99_closest_integer | hs | -- | 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
-- >>> closestInteger "10"
-- 10
-- >>> closestInteger "15.3"
-- 15
-- Note:
-- Rounding away from zero mean... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_99_closest_integer.py | reworded |
main :: IO ()
main = do
let candidate = closestInteger
if candidate "10" == 10 then pure () else error "assertion failed"
if candidate "14.5" == 15 then pure () else error "assertion failed"
if candidate "-15.5" == (-16) then pure () else error "assertion failed"
if candidate "15.3" == 15 then pure () else e... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_9_rolling_max | hs | -- | From a given list of integers, generate a list of rolling maximum element found until given moment
-- in the sequence.
-- >>> rollingMax [1,2,3,2,3,4,2]
-- [1,2,3,3,3,4,4]
rollingMax :: [Int] -> [Int]
rollingMax numbers = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_9_rolling_max.py | reworded |
main :: IO ()
main = do
let candidate = rollingMax
if candidate [] == [] then pure () else error "assertion failed"
if candidate [1,2,3,4] == [1,2,3,4] then pure () else error "assertion failed"
if candidate [4,3,2,1] == [4,4,4,4] then pure () else error "assertion failed"
if candidate [3,2,3,100,3] == [3,3,... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_0_has_close_elements | hs | -- | Check if in given list of numbers, are any two numbers closer to each other than
-- given threshold.
-- >>> hasCloseElements [1.0,2.0,3.0] 0.5
-- False
-- >>> hasCloseElements [1.0,2.8,3.0,4.0,5.0,2.0] 0.3
-- True
hasCloseElements :: [Float] -> Float -> Bool
hasCloseElements numbers threshold = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_0_has_close_elements.py | verbatim |
main :: IO ()
main = do
let candidate = hasCloseElements
if candidate [1.0,2.0,3.9,4.0,5.0,2.2] 0.3 == True then pure () else error "assertion failed"
if candidate [1.0,2.0,3.9,4.0,5.0,2.2] 0.05 == False then pure () else error "assertion failed"
if candidate [1.0,2.0,5.9,4.0,5.0] 0.95 == True then pure () els... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_100_make_a_pile | hs | -- | 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... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_100_make_a_pile.py | verbatim |
main :: IO ()
main = do
let candidate = makeAPile
if candidate 3 == [3,5,7] then pure () else error "assertion failed"
if candidate 4 == [4,6,8,10] then pure () else error "assertion failed"
if candidate 5 == [5,7,9,11,13] then pure () else error "assertion failed"
if candidate 6 == [6,8,10,12,14,16] then pu... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_101_words_string | hs | -- | 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:
-- >>> wordsString "Hi, my name is John"
-- ["Hi","my","name","is","John"]
-- >>> wordsString "One, two, three, four, five, six"
-- ["One","two",... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_101_words_string.py | verbatim |
main :: IO ()
main = do
let candidate = wordsString
if candidate "Hi, my name is John" == ["Hi","my","name","is","John"] then pure () else error "assertion failed"
if candidate "One, two, three, four, five, six" == ["One","two","three","four","five","six"] then pure () else error "assertion failed"
if candidat... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_102_choose_num | hs | -- | 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:
-- >>> chooseNum 12 15
-- 14
-- >>> chooseNum 13 12
-- (-1)
chooseNum :: Int -> Int -> Int... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_102_choose_num.py | verbatim |
main :: IO ()
main = do
let candidate = chooseNum
if candidate 12 15 == 14 then pure () else error "assertion failed"
if candidate 13 12 == (-1) then pure () else error "assertion failed"
if candidate 33 12354 == 12354 then pure () else error "assertion failed"
if candidate 5234 5233 == (-1) then pure () els... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_104_unique_digits | hs | -- | 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:
-- >>> uniqueDigits [15,33,1422,1]
-- [1,15,33]
-- >>> uniqueDigits [152,323,1422,10]
-- []
uniqueDigits :: [Int] -> [Int]
un... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_104_unique_digits.py | verbatim |
main :: IO ()
main = do
let candidate = uniqueDigits
if candidate [15,33,1422,1] == [1,15,33] then pure () else error "assertion failed"
if candidate [152,323,1422,10] == [] then pure () else error "assertion failed"
if candidate [12345,2033,111,151] == [111,151] then pure () else error "assertion failed"
if... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_105_by_length | hs | -- | 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:
-- >>> byLength [2,1,1,4,5,8,2,3]
-- ["Eight",... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_105_by_length.py | verbatim |
main :: IO ()
main = do
let candidate = byLength
if candidate [2,1,1,4,5,8,2,3] == ["Eight","Five","Four","Three","Two","Two","One","One"] then pure () else error "assertion failed"
if candidate [] == [] then pure () else error "assertion failed"
if candidate [1,(-1),55] == ["One"] then pure () else error "ass... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_106_f | hs | -- | 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 *... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_106_f.py | verbatim |
main :: IO ()
main = do
let candidate = f
if candidate 5 == [1,2,6,24,15] then pure () else error "assertion failed"
if candidate 7 == [1,2,6,24,15,720,28] then pure () else error "assertion failed"
if candidate 1 == [1] then pure () else error "assertion failed"
if candidate 3 == [1,2,6] then pure () else e... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_107_even_odd_palindrome | hs | -- | 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:
-- >>> evenOddPalindrome 3
-- (1, 2)
-- Explanation:
-- Integer palindrome are 1, 2, 3. one of them is even, and two of them are odd.
-- Example 2:... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_107_even_odd_palindrome.py | verbatim |
main :: IO ()
main = do
let candidate = evenOddPalindrome
if candidate 123 == (8, 13) then pure () else error "assertion failed"
if candidate 12 == (4, 6) then pure () else error "assertion failed"
if candidate 3 == (1, 2) then pure () else error "assertion failed"
if candidate 63 == (6, 8) then pure () else... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_108_count_nums | hs | -- | 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.
-- >>> countNums []
-- 0
-- >>> countNums [(-1),11,(-11)]
--... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_108_count_nums.py | verbatim |
main :: IO ()
main = do
let candidate = countNums
if candidate [] == 0 then pure () else error "assertion failed"
if candidate [(-1),(-2),0] == 0 then pure () else error "assertion failed"
if candidate [1,1,2,(-2),3,4,5] == 6 then pure () else error "assertion failed"
if candidate [1,6,9,(-6),0,1,5] == 5 the... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_109_move_one_ball | hs | -- | 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 ... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_109_move_one_ball.py | verbatim |
main :: IO ()
main = do
let candidate = moveOneBall
if candidate [3,4,5,1,2] == True then pure () else error "assertion failed"
if candidate [3,5,10,1,2] == True then pure () else error "assertion failed"
if candidate [4,3,1,2] == False then pure () else error "assertion failed"
if candidate [3,5,4,1,2] == F... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_10_make_palindrome | hs | -- | 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.
-- >>> makePalindrome ""
-- ""
-- >>> ... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_10_make_palindrome.py | verbatim |
main :: IO ()
main = do
let candidate = makePalindrome
if candidate "" == "" then pure () else error "assertion failed"
if candidate "x" == "x" then pure () else error "assertion failed"
if candidate "xyz" == "xyzyx" then pure () else error "assertion failed"
if candidate "xyx" == "xyx" then pure () else err... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_110_exchange | hs | -- | 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 possi... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_110_exchange.py | verbatim |
main :: IO ()
main = do
let candidate = exchange
if candidate [1,2,3,4] [1,2,3,4] == "YES" then pure () else error "assertion failed"
if candidate [1,2,3,4] [1,5,3,4] == "NO" then pure () else error "assertion failed"
if candidate [1,2,3,4] [2,1,4,3] == "YES" then pure () else error "assertion failed"
if can... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_111_histogram | hs | -- | 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:
-- >>> histogram "a b c"
-- [("a", 1), ("b", 1), ("c", 1)]
-- ... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_111_histogram.py | verbatim |
main :: IO ()
main = do
let candidate = histogram
if candidate "a b b a" == [("a", 2), ("b", 2)] then pure () else error "assertion failed"
if candidate "a b c a b" == [("a", 2), ("b", 2)] then pure () else error "assertion failed"
if candidate "a b c d g" == [("a", 1), ("b", 1), ("c", 1), ("d", 1), ("g", 1)] ... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_112_reverse_delete | hs | -- | 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 T... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_112_reverse_delete.py | verbatim |
main :: IO ()
main = do
let candidate = reverseDelete
if candidate "abcde" "ae" == ("bcd", False) then pure () else error "assertion failed"
if candidate "abcdef" "b" == ("acdef", False) then pure () else error "assertion failed"
if candidate "abcdedcba" "ab" == ("cdedc", True) then pure () else error "asserti... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_113_odd_count | hs | -- | 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.
-- >>> oddCount ["12345... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_113_odd_count.py | verbatim |
main :: IO ()
main = do
let candidate = oddCount
if candidate ["1234567"] == ["the number of odd elements 4n the str4ng 4 of the 4nput."] then pure () else error "assertion failed"
if candidate ["3","11111111"] == ["the number of odd elements 1n the str1ng 1 of the 1nput.","the number of odd elements 8n the str8... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_114_minSubArraySum | hs | -- | Given an array of integers nums, find the minimum sum of any non-empty sub-array
-- of nums.
-- Example
-- >>> minsubarraysum [2,3,4,1,2,4]
-- 1
-- >>> minsubarraysum [(-1),(-2),(-3)]
-- (-6)
minsubarraysum :: [Int] -> Int
minsubarraysum nums = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_114_minSubArraySum.py | verbatim |
main :: IO ()
main = do
let candidate = minsubarraysum
if candidate [2,3,4,1,2,4] == 1 then pure () else error "assertion failed"
if candidate [(-1),(-2),(-3)] == (-6) then pure () else error "assertion failed"
if candidate [(-1),(-2),(-3),2,(-10)] == (-14) then pure () else error "assertion failed"
if candi... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_115_max_fill | hs | -- | 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 ... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_115_max_fill.py | verbatim |
main :: IO ()
main = do
let candidate = maxFill
if candidate [[0,0,1,0],[0,1,0,0],[1,1,1,1]] 1 == 6 then pure () else error "assertion failed"
if candidate [[0,0,1,1],[0,0,0,0],[1,1,1,1],[0,1,1,1]] 2 == 5 then pure () else error "assertion failed"
if candidate [[0,0,0],[0,0,0]] 5 == 0 then pure () else error "... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_116_sort_array | hs | -- | 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:
-- >>> sortArray [1,5,2,3,4]
-- [1,2,3,4,5]
-- >>> sortArray [(-2... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_116_sort_array.py | verbatim |
main :: IO ()
main = do
let candidate = sortArray
if candidate [1,5,2,3,4] == [1,2,4,3,5] then pure () else error "assertion failed"
if candidate [(-2),(-3),(-4),(-5),(-6)] == [(-4),(-2),(-6),(-5),(-3)] then pure () else error "assertion failed"
if candidate [1,0,2,3,4] == [0,1,2,4,3] then pure () else error "... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_117_select_words | hs | -- | 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 ma... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_117_select_words.py | verbatim |
main :: IO ()
main = do
let candidate = selectWords
if candidate "Mary had a little lamb" 4 == ["little"] then pure () else error "assertion failed"
if candidate "Mary had a little lamb" 3 == ["Mary","lamb"] then pure () else error "assertion failed"
if candidate "simple white space" 2 == [] then pure () else ... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_118_get_closest_vowel | hs | -- | 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 giv... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_118_get_closest_vowel.py | verbatim |
main :: IO ()
main = do
let candidate = getClosestVowel
if candidate "yogurt" == "u" then pure () else error "assertion failed"
if candidate "full" == "u" then pure () else error "assertion failed"
if candidate "easy" == "" then pure () else error "assertion failed"
if candidate "eAsy" == "" then pure () els... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_119_match_parens | hs | -- | 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 parent... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_119_match_parens.py | verbatim |
main :: IO ()
main = do
let candidate = matchParens
if candidate ["()(",")"] == "Yes" then pure () else error "assertion failed"
if candidate [")",")"] == "No" then pure () else error "assertion failed"
if candidate ["(()(())","())())"] == "No" then pure () else error "assertion failed"
if candidate [")())",... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_11_string_xor | hs | -- | 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.
-- >>> stringXor "010" "110"
-- "100"
stringXor :: String -> String -> String
stringXor a b = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_11_string_xor.py | verbatim |
main :: IO ()
main = do
let candidate = stringXor
if candidate "111000" "101010" == "010010" then pure () else error "assertion failed"
if candidate "1" "1" == "0" then pure () else error "assertion failed"
if candidate "0101" "0000" == "0101" then pure () else error "assertion failed"
pure () | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_120_maximum | hs | -- | 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:
-- >>> maximum [(-3),(-4),5] 3
-- [(-4),(-3),5]
-- Example 2:
-- >>> maximum [4,(-4),4] 2
-- [4,4]
-- Example 3:
-- >>> maximum [(-3),2,1,2,(-1),(-2),1] 1
-- [2]
... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_120_maximum.py | verbatim |
main :: IO ()
main = do
let candidate = maximum
if candidate [(-3),(-4),5] 3 == [(-4),(-3),5] then pure () else error "assertion failed"
if candidate [4,(-4),4] 2 == [4,4] then pure () else error "assertion failed"
if candidate [(-3),2,1,2,(-1),(-2),1] 1 == [2] then pure () else error "assertion failed"
if c... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_121_solution | hs | -- | Given a non-empty list of integers, return the sum of all of the odd elements that are in even positions.
-- Examples
-- >>> solution [5,8,7,1]
-- 12
-- >>> solution [3,3,3,3,3]
-- 9
-- >>> solution [30,13,24,321]
-- 0
solution :: [Int] -> Int
solution lst = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_121_solution.py | verbatim |
main :: IO ()
main = do
let candidate = solution
if candidate [5,8,7,1] == 12 then pure () else error "assertion failed"
if candidate [3,3,3,3,3] == 9 then pure () else error "assertion failed"
if candidate [30,13,24,321] == 0 then pure () else error "assertion failed"
if candidate [5,9] == 5 then pure () el... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_122_add_elements | hs | -- | 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:
-- >>> addElements [111,21,3,4000,5,6,7,8,9] 4
-- 24
-- Constraints:
-- 1. 1 <= len(arr) <= 100
-- 2. 1 <= k <= len(arr)
addElements :: [Int] -> I... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_122_add_elements.py | verbatim |
main :: IO ()
main = do
let candidate = addElements
if candidate [1,(-2),(-3),41,57,76,87,88,99] 3 == (-4) then pure () else error "assertion failed"
if candidate [111,121,3,4000,5,6] 2 == 0 then pure () else error "assertion failed"
if candidate [11,21,3,90,5,6,7,8,9] 4 == 125 then pure () else error "asserti... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_123_get_odd_collatz | hs | -- | 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 prev... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_123_get_odd_collatz.py | verbatim |
main :: IO ()
main = do
let candidate = getOddCollatz
if candidate 14 == [1,5,7,11,13,17] then pure () else error "assertion failed"
if candidate 5 == [1,5] then pure () else error "assertion failed"
if candidate 12 == [1,3,5] then pure () else error "assertion failed"
if candidate 1 == [1] then pure () else... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_124_valid_date | hs | -- | 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,... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_124_valid_date.py | verbatim |
main :: IO ()
main = do
let candidate = validDate
if candidate "03-11-2000" == True then pure () else error "assertion failed"
if candidate "15-01-2012" == False then pure () else error "assertion failed"
if candidate "04-0-2040" == False then pure () else error "assertion failed"
if candidate "06-04-2020" =... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_126_is_sorted | hs | -- | Given a list of numbers, return whether or not they are sorted
-- in ascending order. If list has more than 1 duplicate of the same
-- number, return False. Assume no negative numbers and only integers.
-- Examples
-- >>> isSorted [5]
-- True
-- >>> isSorted [1,2,3,4,5]
-- True
-- >>> isSorted [1,3,2,4,5]
... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_126_is_sorted.py | verbatim |
main :: IO ()
main = do
let candidate = isSorted
if candidate [5] == True then pure () else error "assertion failed"
if candidate [1,2,3,4,5] == True then pure () else error "assertion failed"
if candidate [1,3,2,4,5] == False then pure () else error "assertion failed"
if candidate [1,2,3,4,5,6] == True then... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_127_intersection | hs | -- | You are given two intervals,
-- where each interval is a pair of integers. For example, interval = (start, end) = (1, 2).
-- The given intervals are closed which means that the interval (start, end)
-- includes both start and end.
-- For each given interval, it is assumed that its start is less or equal its en... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_127_intersection.py | verbatim |
main :: IO ()
main = do
let candidate = intersection
if candidate (1, 2) (2, 3) == "NO" then pure () else error "assertion failed"
if candidate ((-1), 1) (0, 4) == "NO" then pure () else error "assertion failed"
if candidate ((-3), (-1)) ((-5), 5) == "YES" then pure () else error "assertion failed"
if candid... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_128_prod_signs | hs | -- | You are given an array arr of integers and you need to return
-- sum of magnitudes of integers multiplied by product of all signs
-- of each number in the array, represented by 1, -1 or 0.
-- Note: return None for empty arr.
-- Example:
-- >>> prodSigns [1,2,2,(-4)]
-- Just (9)
-- >>> prodSigns [0,1]
-- Ju... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_128_prod_signs.py | verbatim |
main :: IO ()
main = do
let candidate = prodSigns
if candidate [1,2,2,(-4)] == Just ((-9)) then pure () else error "assertion failed"
if candidate [0,1] == Just (0) then pure () else error "assertion failed"
if candidate [1,1,1,2,3,(-1),1] == Just ((-10)) then pure () else error "assertion failed"
if candida... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_129_minPath | hs | -- | Given a grid with N rows and N columns (N >= 2) and a positive integer k,
-- each cell of the grid contains a value. Every integer in the range [1, N * N]
-- inclusive appears exactly once on the cells of the grid.
-- You have to find the minimum path of length k in the grid. You can start
-- from any cell, a... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_129_minPath.py | verbatim |
main :: IO ()
main = do
let candidate = minpath
if candidate [[1,2,3],[4,5,6],[7,8,9]] 3 == [1,2,1] then pure () else error "assertion failed"
if candidate [[5,9,3],[4,1,6],[7,8,2]] 1 == [1] then pure () else error "assertion failed"
if candidate [[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16]] 4 == [1,2,1,2] ... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_12_longest | hs | -- | Out of list of strings, return the longest one. Return the first one in case of multiple
-- strings of the same length. Return None in case the input list is empty.
-- >>> longest []
-- Just (Nothing)
-- >>> longest ["a","b","c"]
-- Just ("a")
-- >>> longest ["a","bb","ccc"]
-- Just ("ccc")
longest :: [Stri... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_12_longest.py | verbatim |
main :: IO ()
main = do
let candidate = longest
if candidate [] == Just (Nothing) then pure () else error "assertion failed"
if candidate ["x","y","z"] == Just ("x") then pure () else error "assertion failed"
if candidate ["x","yyy","zzzz","www","kkkk","abc"] == Just ("zzzz") then pure () else error "assertion... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_130_tri | hs | -- | Everyone knows Fibonacci sequence, it was studied deeply by mathematicians in
-- the last couple centuries. However, what people don't know is Tribonacci sequence.
-- Tribonacci sequence is defined by the recurrence:
-- tri(1) = 3
-- tri(n) = 1 + n / 2, if n is even.
-- tri(n) = tri(n - 1) + tri(n - 2) + tr... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_130_tri.py | verbatim |
main :: IO ()
main = do
let candidate = tri
if candidate 3 == [1,3,2,8] then pure () else error "assertion failed"
if candidate 4 == [1,3,2,8,3] then pure () else error "assertion failed"
if candidate 5 == [1,3,2,8,3,15] then pure () else error "assertion failed"
if candidate 6 == [1,3,2,8,3,15,4] then pure ... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_131_digits | hs | -- | Given a positive integer n, return the product of the odd digits.
-- Return 0 if all digits are even.
-- For example:
-- >>> digits 1
-- 1
-- >>> digits 4
-- 0
-- >>> digits 235
-- 15
digits :: Int -> Int
digits n = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_131_digits.py | verbatim |
main :: IO ()
main = do
let candidate = digits
if candidate 5 == 5 then pure () else error "assertion failed"
if candidate 54 == 5 then pure () else error "assertion failed"
if candidate 120 == 1 then pure () else error "assertion failed"
if candidate 5014 == 5 then pure () else error "assertion failed"
if... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_132_is_nested | hs | -- | Create a function that takes a string as input which contains only square brackets.
-- The function should return True if and only if there is a valid subsequence of brackets
-- where at least one bracket in the subsequence is nested.
-- >>> isNested "[[]]"
-- True
-- >>> isNested "[]]]]]]][[[[[]"
-- False
... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_132_is_nested.py | verbatim |
main :: IO ()
main = do
let candidate = isNested
if candidate "[[]]" == True then pure () else error "assertion failed"
if candidate "[]]]]]]][[[[[]" == False then pure () else error "assertion failed"
if candidate "[][]" == False then pure () else error "assertion failed"
if candidate "[]" == False then pur... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_133_sum_squares | hs | -- | You are given a list of numbers.
-- You need to return the sum of squared numbers in the given list,
-- round each element in the list to the upper int(Ceiling) first.
-- Examples:
-- >>> lst [1.0,2.0,3.0]
-- 14
-- >>> lst [1.0,4.0,9.0]
-- 98
-- >>> lst [1.0,3.0,5.0,7.0]
-- 84
-- >>> lst [1.4,4.2,0.0]
--... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_133_sum_squares.py | verbatim |
main :: IO ()
main = do
let candidate = sumSquares
if candidate [1.0,2.0,3.0] == 14 then pure () else error "assertion failed"
if candidate [1.0,2.0,3.0] == 14 then pure () else error "assertion failed"
if candidate [1.0,3.0,5.0,7.0] == 84 then pure () else error "assertion failed"
if candidate [1.4,4.2,0.0]... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_134_check_if_last_char_is_a_letter | hs | -- | Create a function that returns True if the last character
-- of a given string is an alphabetical character and is not
-- a part of a word, and False otherwise.
-- Note: "word" is a group of characters separated by space.
-- Examples:
-- >>> checkIfLastCharIsALetter "apple pie"
-- False
-- >>> checkIfLastCh... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_134_check_if_last_char_is_a_letter.py | verbatim |
main :: IO ()
main = do
let candidate = checkIfLastCharIsALetter
if candidate "apple" == False then pure () else error "assertion failed"
if candidate "apple pi e" == True then pure () else error "assertion failed"
if candidate "eeeee" == False then pure () else error "assertion failed"
if candidate "A" == T... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_135_can_arrange | hs | -- | Create a function which returns the largest index of an element which
-- is not greater than or equal to the element immediately preceding it. If
-- no such element exists then return -1. The given array will not contain
-- duplicate values.
-- Examples:
-- >>> canArrange [1,2,4,3,5]
-- 3
-- >>> canArrange ... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_135_can_arrange.py | verbatim |
main :: IO ()
main = do
let candidate = canArrange
if candidate [1,2,4,3,5] == 3 then pure () else error "assertion failed"
if candidate [1,2,4,5] == (-1) then pure () else error "assertion failed"
if candidate [1,4,2,5,6,7,8,9,10] == 2 then pure () else error "assertion failed"
if candidate [4,8,5,7,3] == 4... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_136_largest_smallest_integers | hs | -- | Create a function that returns a tuple (a, b), where 'a' is
-- the largest of negative integers, and 'b' is the smallest
-- of positive integers in a list.
-- If there is no negative or positive integers, return them as None.
-- Examples:
-- >>> largestSmallestIntegers [2,4,1,3,5,7]
-- (Nothing, 1)
-- >>> l... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_136_largest_smallest_integers.py | verbatim |
main :: IO ()
main = do
let candidate = largestSmallestIntegers
if candidate [2,4,1,3,5,7] == (Nothing, 1) then pure () else error "assertion failed"
if candidate [2,4,1,3,5,7,0] == (Nothing, 1) then pure () else error "assertion failed"
if candidate [1,3,2,4,5,6,(-2)] == ((-2), 1) then pure () else error "ass... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_138_is_equal_to_sum_even | hs | -- | Evaluate whether the given number n can be written as the sum of exactly 4 positive even numbers
-- Example
-- >>> isEqualToSumEven 4
-- False
-- >>> isEqualToSumEven 6
-- False
-- >>> isEqualToSumEven 8
-- True
isEqualToSumEven :: Int -> Bool
isEqualToSumEven n = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_138_is_equal_to_sum_even.py | verbatim |
main :: IO ()
main = do
let candidate = isEqualToSumEven
if candidate 4 == False then pure () else error "assertion failed"
if candidate 6 == False then pure () else error "assertion failed"
if candidate 8 == True then pure () else error "assertion failed"
if candidate 10 == True then pure () else error "ass... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_139_special_factorial | hs | -- | The Brazilian factorial is defined as:
-- brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1!
-- where n > 0
-- For example:
-- >>> specialFactorial 4
-- 288
-- The function will receive an integer as input and should return the special
-- factorial of this integer.
specialFactorial :: Int -> Int
speci... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_139_special_factorial.py | verbatim |
main :: IO ()
main = do
let candidate = specialFactorial
if candidate 4 == 288 then pure () else error "assertion failed"
if candidate 5 == 34560 then pure () else error "assertion failed"
if candidate 7 == 125411328000 then pure () else error "assertion failed"
if candidate 1 == 1 then pure () else error "a... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_13_greatest_common_divisor | hs | -- | Return a greatest common divisor of two integers a and b
-- >>> greatestCommonDivisor 3 5
-- 1
-- >>> greatestCommonDivisor 25 15
-- 5
greatestCommonDivisor :: Int -> Int -> Int
greatestCommonDivisor a b = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_13_greatest_common_divisor.py | verbatim |
main :: IO ()
main = do
let candidate = greatestCommonDivisor
if candidate 3 7 == 1 then pure () else error "assertion failed"
if candidate 10 15 == 5 then pure () else error "assertion failed"
if candidate 49 14 == 7 then pure () else error "assertion failed"
if candidate 144 60 == 12 then pure () else erro... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_140_fix_spaces | hs | -- | Given a string text, replace all spaces in it with underscores,
-- and if a string has more than 2 consecutive spaces,
-- then replace all consecutive spaces with -
-- >>> fixSpaces " Example"
-- "Example"
-- >>> fixSpaces " Example 1"
-- "Example_1"
-- >>> fixSpaces " Example 2"
-- "_Example_2"
-- >>>... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_140_fix_spaces.py | verbatim |
main :: IO ()
main = do
let candidate = fixSpaces
if candidate "Example" == "Example" then pure () else error "assertion failed"
if candidate "Mudasir Hanif " == "Mudasir_Hanif_" then pure () else error "assertion failed"
if candidate "Yellow Yellow Dirty Fellow" == "Yellow_Yellow__Dirty__Fellow" then pure (... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_141_file_name_check | hs | -- | Create a function which takes a string representing a file's name, and returns
-- 'Yes' if the the file's name is valid, and returns 'No' otherwise.
-- A file's name is considered to be valid if and only if all the following conditions
-- are met:
-- - There should not be more than three digits ('0'-'9') in t... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_141_file_name_check.py | verbatim |
main :: IO ()
main = do
let candidate = fileNameCheck
if candidate "example.txt" == "Yes" then pure () else error "assertion failed"
if candidate "1example.dll" == "No" then pure () else error "assertion failed"
if candidate "s1sdf3.asd" == "No" then pure () else error "assertion failed"
if candidate "K.dll"... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_142_sum_squares | hs | -- | "
-- This function will take a list of integers. For all entries in the list, the function shall square the integer entry if its index is a
-- multiple of 3 and will cube the integer entry if its index is a multiple of 4 and not a multiple of 3. The function will not
-- change the entries in the list whose in... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_142_sum_squares.py | verbatim |
main :: IO ()
main = do
let candidate = sumSquares
if candidate [1,2,3] == 6 then pure () else error "assertion failed"
if candidate [1,4,9] == 14 then pure () else error "assertion failed"
if candidate [] == 0 then pure () else error "assertion failed"
if candidate [1,1,1,1,1,1,1,1,1] == 9 then pure () else... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_143_words_in_sentence | hs | -- | 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... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_143_words_in_sentence.py | verbatim |
main :: IO ()
main = do
let candidate = wordsInSentence
if candidate "This is a test" == "is" then pure () else error "assertion failed"
if candidate "lets go for swimming" == "go for" then pure () else error "assertion failed"
if candidate "there is no place available here" == "there is no place" then pure ()... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_144_simplify | hs | -- | 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 deno... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_144_simplify.py | verbatim |
main :: IO ()
main = do
let candidate = simplify
if candidate "1/5" "5/1" == True then pure () else error "assertion failed"
if candidate "1/6" "2/1" == False then pure () else error "assertion failed"
if candidate "5/1" "3/1" == True then pure () else error "assertion failed"
if candidate "7/10" "10/2" == F... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_145_order_by_points | hs | -- | 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:
-- >>> orderByPoints [1,11,(-1),(-11),(-12)]
-- [(-1),... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_145_order_by_points.py | verbatim |
main :: IO ()
main = do
let candidate = orderByPoints
if candidate [1,11,(-1),(-11),(-12)] == [(-1),(-11),1,(-12),11] then pure () else error "assertion failed"
if candidate [1234,423,463,145,2,423,423,53,6,37,3457,3,56,0,46] == [0,2,3,6,53,423,423,423,1234,145,37,46,56,463,3457] then pure () else error "asserti... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_146_specialFilter | hs | -- | 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:
-- >>> specialfilter [15,(-73),14,(-15)]
-- 1
-- >>> specialfilter [33,(-2),(-3),45,21,... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_146_specialFilter.py | verbatim |
main :: IO ()
main = do
let candidate = specialfilter
if candidate [5,(-2),1,(-5)] == 0 then pure () else error "assertion failed"
if candidate [15,(-73),14,(-15)] == 1 then pure () else error "assertion failed"
if candidate [33,(-2),(-3),45,21,109] == 2 then pure () else error "assertion failed"
if candidat... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_147_get_max_triples | hs | -- | 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 :
-- >>> getMaxTriples 5
-... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_147_get_max_triples.py | verbatim |
main :: IO ()
main = do
let candidate = getMaxTriples
if candidate 5 == 1 then pure () else error "assertion failed"
if candidate 6 == 4 then pure () else error "assertion failed"
if candidate 10 == 36 then pure () else error "assertion failed"
if candidate 100 == 53361 then pure () else error "assertion fai... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_149_sorted_list_sum | hs | -- | 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 b... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_149_sorted_list_sum.py | verbatim |
main :: IO ()
main = do
let candidate = sortedListSum
if candidate ["aa","a","aaa"] == ["aa"] then pure () else error "assertion failed"
if candidate ["school","AI","asdf","b"] == ["AI","asdf","school"] then pure () else error "assertion failed"
if candidate ["d","b","c","a"] == [] then pure () else error "ass... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_14_all_prefixes | hs | -- | Return list of all prefixes from shortest to longest of the input string
-- >>> allPrefixes "abc"
-- ["a","ab","abc"]
allPrefixes :: String -> [String]
allPrefixes string = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_14_all_prefixes.py | verbatim |
main :: IO ()
main = do
let candidate = allPrefixes
if candidate "" == [] then pure () else error "assertion failed"
if candidate "asdfgh" == ["a","as","asd","asdf","asdfg","asdfgh"] then pure () else error "assertion failed"
if candidate "WWW" == ["W","WW","WWW"] then pure () else error "assertion failed"
p... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_150_x_or_y | hs | -- | 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:
-- >>> xOrY 7 34 12
-- 34
-- >>> xOrY 15 8 5
-- 5
xOrY :: Int -> Int -> Int -> Int
xOrY n x y = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_150_x_or_y.py | verbatim |
main :: IO ()
main = do
let candidate = xOrY
if candidate 7 34 12 == 34 then pure () else error "assertion failed"
if candidate 15 8 5 == 5 then pure () else error "assertion failed"
if candidate 3 33 5212 == 33 then pure () else error "assertion failed"
if candidate 1259 3 52 == 3 then pure () else error "a... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_151_double_the_difference | hs | -- | 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.
-- >>> doubleTheDifference [1,3,2,0]
-- 10
-- >>> doubleTheDifference [(-1),(-2),0]
-- 0
-- >>> doubleTheDifference [9,(-2)]
-- 81
-- >>> doubleTheDifference [0]
... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_151_double_the_difference.py | verbatim |
main :: IO ()
main = do
let candidate = doubleTheDifference
if candidate [.0] == 0 then pure () else error "assertion failed"
if candidate [5.0,4.0] == 25 then pure () else error "assertion failed"
if candidate [0.1,0.2,0.3] == 0 then pure () else error "assertion failed"
if candidate [-10.0,-20.0,-30.0] == ... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_152_compare | hs | -- | 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 giv... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_152_compare.py | verbatim |
main :: IO ()
main = do
let candidate = compare
if candidate [1,2,3,4,5,1] [1,2,3,4,2,(-2)] == [0,0,0,0,3,3] then pure () else error "assertion failed"
if candidate [0,0,0,0,0,0] [0,0,0,0,0,0] == [0,0,0,0,0,0] then pure () else error "assertion failed"
if candidate [1,2,3] [(-1),(-2),(-3)] == [2,4,6] then pure... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_153_Strongest_Extension | hs | -- | 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 le... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_153_Strongest_Extension.py | verbatim |
main :: IO ()
main = do
let candidate = strongestExtension
if candidate "Watashi" ["tEN","niNE","eIGHt8OKe"] == "Watashi.eIGHt8OKe" then pure () else error "assertion failed"
if candidate "Boku123" ["nani","NazeDa","YEs.WeCaNe","32145tggg"] == "Boku123.YEs.WeCaNe" then pure () else error "assertion failed"
if ... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_154_cycpattern_check | hs | -- | 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
-- >>> cycpatternCheck "abcd" "abd"
-- False
-- >>> cycpatternCheck "hello" "ell"
-- True
-- >>> cycpatternCheck "whassup" "psus"
-- False
-- >>> cycpatternCheck "abab" "baa"
-- True
-... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_154_cycpattern_check.py | verbatim |
main :: IO ()
main = do
let candidate = cycpatternCheck
if candidate "xyzw" "xyw" == False then pure () else error "assertion failed"
if candidate "yello" "ell" == True then pure () else error "assertion failed"
if candidate "whattup" "ptut" == False then pure () else error "assertion failed"
if candidate "e... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_155_even_odd_count | hs | -- | Given an integer. return a tuple that has the number of even and odd digits respectively.
-- Example:
-- >>> evenOddCount (-12)
-- (1, 1)
-- >>> evenOddCount 123
-- (1, 2)
evenOddCount :: Int -> (Int, Int)
evenOddCount num = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_155_even_odd_count.py | verbatim |
main :: IO ()
main = do
let candidate = evenOddCount
if candidate 7 == (0, 1) then pure () else error "assertion failed"
if candidate (-78) == (1, 1) then pure () else error "assertion failed"
if candidate 3452 == (2, 2) then pure () else error "assertion failed"
if candidate 346211 == (3, 3) then pure () el... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_156_int_to_mini_roman | hs | -- | Given a positive integer, obtain its roman numeral equivalent as a string,
-- and return it in lowercase.
-- Restrictions: 1 <= num <= 1000
-- Examples:
-- >>> intToMiniRoman 19
-- "xix"
-- >>> intToMiniRoman 152
-- "clii"
-- >>> intToMiniRoman 426
-- "cdxxvi"
intToMiniRoman :: Int -> String
intToMiniRoma... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_156_int_to_mini_roman.py | verbatim |
main :: IO ()
main = do
let candidate = intToMiniRoman
if candidate 19 == "xix" then pure () else error "assertion failed"
if candidate 152 == "clii" then pure () else error "assertion failed"
if candidate 251 == "ccli" then pure () else error "assertion failed"
if candidate 426 == "cdxxvi" then pure () else... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_157_right_angle_triangle | hs | -- | 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:
-- >>> rightAngleTriangle 3 4 5
-- True
-- >>> rightAngleTriangle 1 2 ... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_157_right_angle_triangle.py | verbatim |
main :: IO ()
main = do
let candidate = rightAngleTriangle
if candidate 3 4 5 == True then pure () else error "assertion failed"
if candidate 1 2 3 == False then pure () else error "assertion failed"
if candidate 10 6 8 == True then pure () else error "assertion failed"
if candidate 2 2 2 == False then pure ... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_158_find_max | hs | -- | 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.
-- >>> findMax ["name","of","string"]
-... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_158_find_max.py | verbatim |
main :: IO ()
main = do
let candidate = findMax
if candidate ["name","of","string"] == "string" then pure () else error "assertion failed"
if candidate ["name","enam","game"] == "enam" then pure () else error "assertion failed"
if candidate ["aaaaaaa","bb","cc"] == "aaaaaaa" then pure () else error "assertion ... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_159_eat | hs | -- | 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 rem... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_159_eat.py | verbatim |
main :: IO ()
main = do
let candidate = eat
if candidate 5 6 10 == [11,4] then pure () else error "assertion failed"
if candidate 4 8 9 == [12,1] then pure () else error "assertion failed"
if candidate 1 10 10 == [11,0] then pure () else error "assertion failed"
if candidate 2 11 5 == [7,0] then pure () else... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_15_string_sequence | hs | -- | Return a string containing space-delimited numbers starting from 0 upto n inclusive.
-- >>> stringSequence 0
-- "0"
-- >>> stringSequence 5
-- "0 1 2 3 4 5"
stringSequence :: Int -> String
stringSequence n = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_15_string_sequence.py | verbatim |
main :: IO ()
main = do
let candidate = stringSequence
if candidate 0 == "0" then pure () else error "assertion failed"
if candidate 3 == "0 1 2 3" then pure () else error "assertion failed"
if candidate 10 == "0 1 2 3 4 5 6 7 8 9 10" then pure () else error "assertion failed"
pure () | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_160_do_algebra | hs | -- | Given two lists operator, and operand. The first list has basic algebra operations, and
-- the second list is a list of integers. Use the two given lists to build the algebric
-- expression and return the evaluation of this expression.
-- The basic algebra operations:
-- Addition ( + )
-- Subtraction ( - )... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_160_do_algebra.py | verbatim |
main :: IO ()
main = do
let candidate = doAlgebra
if candidate ["**","*","+"] [2,3,4,5] == 37 then pure () else error "assertion failed"
if candidate ["+","*","-"] [2,3,4,5] == 9 then pure () else error "assertion failed"
if candidate ["//","*"] [7,3,4] == 8 then pure () else error "assertion failed"
pure () | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_161_solve | hs | -- | You are given a string s.
-- if s[i] is a letter, reverse its case from lower to upper or vise versa,
-- otherwise keep it as it is.
-- If the string contains no letters, reverse the string.
-- The function should return the resulted string.
-- Examples
-- >>> solve "1234"
-- "4321"
-- >>> solve "ab"
-- ... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_161_solve.py | verbatim |
main :: IO ()
main = do
let candidate = solve
if candidate "AsDf" == "aSdF" then pure () else error "assertion failed"
if candidate "1234" == "4321" then pure () else error "assertion failed"
if candidate "ab" == "AB" then pure () else error "assertion failed"
if candidate "#a@C" == "#A@c" then pure () else ... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_162_string_to_md5 | hs | -- | Given a string 'text', return its md5 hash equivalent string.
-- If 'text' is an empty string, return None.
-- >>> stringToMd5 "Hello world"
-- Just ("3e25960a79dbc69b674cd4ec67a72c62")
stringToMd5 :: String -> Maybe String
stringToMd5 text = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_162_string_to_md5.py | verbatim |
main :: IO ()
main = do
let candidate = stringToMd5
if candidate "Hello world" == Just ("3e25960a79dbc69b674cd4ec67a72c62") then pure () else error "assertion failed"
if candidate "" == Just (Nothing) then pure () else error "assertion failed"
if candidate "A B C" == Just ("0ef78513b0cb8cef12743f5aeb35f888") t... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_163_generate_integers | hs | -- | Given two positive integers a and b, return the even digits between a
-- and b, in ascending order.
-- For example:
-- >>> generateIntegers 2 8
-- [2,4,6,8]
-- >>> generateIntegers 8 2
-- [2,4,6,8]
-- >>> generateIntegers 10 14
-- []
generateIntegers :: Int -> Int -> [Int]
generateIntegers a b = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_163_generate_integers.py | verbatim |
main :: IO ()
main = do
let candidate = generateIntegers
if candidate 2 10 == [2,4,6,8] then pure () else error "assertion failed"
if candidate 10 2 == [2,4,6,8] then pure () else error "assertion failed"
if candidate 132 2 == [2,4,6,8] then pure () else error "assertion failed"
if candidate 17 89 == [] then... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_16_count_distinct_characters | hs | -- | Given a string, find out how many distinct characters (regardless of case) does it consist of
-- >>> countDistinctCharacters "xyzXYZ"
-- 3
-- >>> countDistinctCharacters "Jerry"
-- 4
countDistinctCharacters :: String -> Int
countDistinctCharacters string = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_16_count_distinct_characters.py | verbatim |
main :: IO ()
main = do
let candidate = countDistinctCharacters
if candidate "" == 0 then pure () else error "assertion failed"
if candidate "abcde" == 5 then pure () else error "assertion failed"
if candidate "abcdecadeCADE" == 5 then pure () else error "assertion failed"
if candidate "aaaaAAAAaaaa" == 1 th... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_17_parse_music | hs | -- | 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
-- '... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_17_parse_music.py | verbatim |
main :: IO ()
main = do
let candidate = parseMusic
if candidate "" == [] then pure () else error "assertion failed"
if candidate "o o o o" == [4,4,4,4] then pure () else error "assertion failed"
if candidate ".| .| .| .|" == [1,1,1,1] then pure () else error "assertion failed"
if candidate "o| o| .| .| o o o... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_18_how_many_times | hs | -- | Find how many times a given substring can be found in the original string. Count overlaping cases.
-- >>> howManyTimes "" "a"
-- 0
-- >>> howManyTimes "aaa" "a"
-- 3
-- >>> howManyTimes "aaaa" "aa"
-- 3
howManyTimes :: String -> String -> Int
howManyTimes string substring = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_18_how_many_times.py | verbatim |
main :: IO ()
main = do
let candidate = howManyTimes
if candidate "" "x" == 0 then pure () else error "assertion failed"
if candidate "xyxyxyx" "x" == 4 then pure () else error "assertion failed"
if candidate "cacacacac" "cac" == 4 then pure () else error "assertion failed"
if candidate "john doe" "john" == ... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_19_sort_numbers | hs | -- | 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
-- >>> sortNumbers "three one five"
-- "one three five"
sortNumbers :: ... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_19_sort_numbers.py | verbatim |
main :: IO ()
main = do
let candidate = sortNumbers
if candidate "" == "" then pure () else error "assertion failed"
if candidate "three" == "three" then pure () else error "assertion failed"
if candidate "three five nine" == "three five nine" then pure () else error "assertion failed"
if candidate "five zer... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_1_separate_paren_groups | hs | -- | 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... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_1_separate_paren_groups.py | verbatim |
main :: IO ()
main = do
let candidate = separateParenGroups
if candidate "(()()) ((())) () ((())()())" == ["(()())","((()))","()","((())()())"] then pure () else error "assertion failed"
if candidate "() (()) ((())) (((())))" == ["()","(())","((()))","(((())))"] then pure () else error "assertion failed"
if ca... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_20_find_closest_elements | hs | -- | 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).
-- >>> findClosestElements [1.0,2.0,3.0,4.0,5.0,2.2]
-- (2.0, 2.2)
-- >>> findClosestElements [1.0,2.0,3.0,4.0,5.0,2.0]
-- (2.0, 2.0)
f... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_20_find_closest_elements.py | verbatim |
main :: IO ()
main = do
let candidate = findClosestElements
if candidate [1.0,2.0,3.9,4.0,5.0,2.2] == (3.9, 4.0) then pure () else error "assertion failed"
if candidate [1.0,2.0,5.9,4.0,5.0] == (5.0, 5.9) then pure () else error "assertion failed"
if candidate [1.0,2.0,3.0,4.0,5.0,2.2] == (2.0, 2.2) then pure ... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_21_rescale_to_unit | hs | -- | 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
-- >>> rescaleToUnit [1.0,2.0,3.0,4.0,5.0]
-- [0.0,0.25,0.5,0.75,1.0]
rescaleToUnit :: [Float] -> [Float]
rescaleToUnit numbers = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_21_rescale_to_unit.py | verbatim |
main :: IO ()
main = do
let candidate = rescaleToUnit
if candidate [2.0,49.9] == [0.0,1.0] then pure () else error "assertion failed"
if candidate [100.0,49.9] == [1.0,0.0] then pure () else error "assertion failed"
if candidate [1.0,2.0,3.0,4.0,5.0] == [0.0,0.25,0.5,0.75,1.0] then pure () else error "assertio... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_23_strlen | hs | -- | Return length of given string
-- >>> strlen ""
-- 0
-- >>> strlen "abc"
-- 3
strlen :: String -> Int
strlen string = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_23_strlen.py | verbatim |
main :: IO ()
main = do
let candidate = strlen
if candidate "" == 0 then pure () else error "assertion failed"
if candidate "x" == 1 then pure () else error "assertion failed"
if candidate "asdasnakj" == 9 then pure () else error "assertion failed"
pure () | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_24_largest_divisor | hs | -- | For a given number n, find the largest number that divides n evenly, smaller than n
-- >>> largestDivisor 15
-- 5
largestDivisor :: Int -> Int
largestDivisor n = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_24_largest_divisor.py | verbatim |
main :: IO ()
main = do
let candidate = largestDivisor
if candidate 3 == 1 then pure () else error "assertion failed"
if candidate 7 == 1 then pure () else error "assertion failed"
if candidate 10 == 5 then pure () else error "assertion failed"
if candidate 100 == 50 then pure () else error "assertion failed... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_25_factorize | hs | -- | 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
-- >>> factorize 8
-- [2,2,2]
-- >>> factoriz... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_25_factorize.py | verbatim |
main :: IO ()
main = do
let candidate = factorize
if candidate 2 == [2] then pure () else error "assertion failed"
if candidate 4 == [2,2] then pure () else error "assertion failed"
if candidate 8 == [2,2,2] then pure () else error "assertion failed"
if candidate 57 == [3,19] then pure () else error "asserti... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_26_remove_duplicates | hs | -- | From a list of integers, remove all elements that occur more than once.
-- Keep order of elements left the same as in the input.
-- >>> removeDuplicates [1,2,3,2,4]
-- [1,3,4]
removeDuplicates :: [Int] -> [Int]
removeDuplicates numbers = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_26_remove_duplicates.py | verbatim |
main :: IO ()
main = do
let candidate = removeDuplicates
if candidate [] == [] then pure () else error "assertion failed"
if candidate [1,2,3,4] == [1,2,3,4] then pure () else error "assertion failed"
if candidate [1,2,3,2,4,3,5] == [1,4,5] then pure () else error "assertion failed"
pure () | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_27_flip_case | hs | -- | For a given string, flip lowercase characters to uppercase and uppercase to lowercase.
-- >>> flipCase "Hello"
-- "hELLO"
flipCase :: String -> String
flipCase string = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_27_flip_case.py | verbatim |
main :: IO ()
main = do
let candidate = flipCase
if candidate "" == "" then pure () else error "assertion failed"
if candidate "Hello!" == "hELLO!" then pure () else error "assertion failed"
if candidate "These violent delights have violent ends" == "tHESE VIOLENT DELIGHTS HAVE VIOLENT ENDS" then pure () else ... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_28_concatenate | hs | -- | Concatenate list of strings into a single string
-- >>> concatenate []
-- ""
-- >>> concatenate ["a","b","c"]
-- "abc"
concatenate :: [String] -> String
concatenate strings = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_28_concatenate.py | verbatim |
main :: IO ()
main = do
let candidate = concatenate
if candidate [] == "" then pure () else error "assertion failed"
if candidate ["x","y","z"] == "xyz" then pure () else error "assertion failed"
if candidate ["x","y","z","w","k"] == "xyzwk" then pure () else error "assertion failed"
pure () | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_29_filter_by_prefix | hs | -- | Filter an input list of strings only for ones that start with a given prefix.
-- >>> filterByPrefix [] "a"
-- []
-- >>> filterByPrefix ["abc","bcd","cde","array"] "a"
-- ["abc","array"]
filterByPrefix :: [String] -> String -> [String]
filterByPrefix strings prefix = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_29_filter_by_prefix.py | verbatim |
main :: IO ()
main = do
let candidate = filterByPrefix
if candidate [] "john" == [] then pure () else error "assertion failed"
if candidate ["xxx","asd","xxy","john doe","xxxAAA","xxx"] "xxx" == ["xxx","xxxAAA","xxx"] then pure () else error "assertion failed"
pure () | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_2_truncate_number | hs | -- | 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.
-- >>> truncateNumber 3.5
-- 0.5
truncateNumber :: Float -> Float
truncateNumber nu... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_2_truncate_number.py | verbatim |
main :: IO ()
main = do
let candidate = truncateNumber
if candidate 3.5 == 0.5 then pure () else error "assertion failed"
if candidate 1.25 == 0.25 then pure () else error "assertion failed"
if candidate 123.0 == 0.0 then pure () else error "assertion failed"
pure () | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_30_get_positive | hs | -- | Return only positive numbers in the list.
-- >>> getPositive [(-1),2,(-4),5,6]
-- [2,5,6]
-- >>> getPositive [5,3,(-5),2,(-3),3,9,0,123,1,(-10)]
-- [5,3,2,3,9,123,1]
getPositive :: [Int] -> [Int]
getPositive l = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_30_get_positive.py | verbatim |
main :: IO ()
main = do
let candidate = getPositive
if candidate [(-1),(-2),4,5,6] == [4,5,6] then pure () else error "assertion failed"
if candidate [5,3,(-5),2,3,3,9,0,123,1,(-10)] == [5,3,2,3,3,9,123,1] then pure () else error "assertion failed"
if candidate [(-1),(-2)] == [] then pure () else error "assert... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_31_is_prime | hs | -- | Return true if a given number is prime, and false otherwise.
-- >>> isPrime 6
-- False
-- >>> isPrime 101
-- True
-- >>> isPrime 11
-- True
-- >>> isPrime 13441
-- True
-- >>> isPrime 61
-- True
-- >>> isPrime 4
-- False
-- >>> isPrime 1
-- False
isPrime :: Int -> Bool
isPrime n = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_31_is_prime.py | verbatim |
main :: IO ()
main = do
let candidate = isPrime
if candidate 6 == False then pure () else error "assertion failed"
if candidate 101 == True then pure () else error "assertion failed"
if candidate 11 == True then pure () else error "assertion failed"
if candidate 13441 == True then pure () else error "asserti... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_33_sort_third | hs | -- | 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.
-- >>> sortThird [1,2,3]
-- [1,2,3]
-- >... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_33_sort_third.py | verbatim |
main :: IO ()
main = do
let candidate = sortThird
if candidate [5,6,3,4,8,9,2] == [2,6,3,4,8,9,5] then pure () else error "assertion failed"
if candidate [5,8,3,4,6,9,2] == [2,8,3,4,6,9,5] then pure () else error "assertion failed"
if candidate [5,6,9,4,8,3,2] == [2,6,9,4,8,3,5] then pure () else error "assert... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_34_unique | hs | -- | Return sorted unique elements in a list
-- >>> unique [5,3,5,2,3,3,9,0,123]
-- [0,2,3,5,9,123]
unique :: [Int] -> [Int]
unique l = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_34_unique.py | verbatim |
main :: IO ()
main = do
let candidate = unique
if candidate [5,3,5,2,3,3,9,0,123] == [0,2,3,5,9,123] then pure () else error "assertion failed"
pure () | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_35_max_element | hs | -- | Return maximum element in the list.
-- >>> maxElement [1,2,3]
-- 3
-- >>> maxElement [5,3,(-5),2,(-3),3,9,0,123,1,(-10)]
-- 123
maxElement :: [Int] -> Int
maxElement l = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_35_max_element.py | verbatim |
main :: IO ()
main = do
let candidate = maxElement
if candidate [1,2,3] == 3 then pure () else error "assertion failed"
if candidate [5,3,(-5),2,(-3),3,9,0,124,1,(-10)] == 124 then pure () else error "assertion failed"
pure () | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_36_fizz_buzz | hs | -- | Return the number of times the digit 7 appears in integers less than n which are divisible by 11 or 13.
-- >>> fizzBuzz 50
-- 0
-- >>> fizzBuzz 78
-- 2
-- >>> fizzBuzz 79
-- 3
fizzBuzz :: Int -> Int
fizzBuzz n = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_36_fizz_buzz.py | verbatim |
main :: IO ()
main = do
let candidate = fizzBuzz
if candidate 50 == 0 then pure () else error "assertion failed"
if candidate 78 == 2 then pure () else error "assertion failed"
if candidate 79 == 3 then pure () else error "assertion failed"
if candidate 100 == 3 then pure () else error "assertion failed"
i... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_37_sort_even | hs | -- | 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.
-- >>> sortEven [1,2,3]
-- [1,2,3]
-- >>> sortEven [5,6,3,4]
-- [3,6,5,4]
sortEven :: [Int] -> [Int... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_37_sort_even.py | verbatim |
main :: IO ()
main = do
let candidate = sortEven
if candidate [1,2,3] == [1,2,3] then pure () else error "assertion failed"
if candidate [5,3,(-5),2,(-3),3,9,0,123,1,(-10)] == [(-10),3,(-5),2,(-3),3,5,0,9,1,123] then pure () else error "assertion failed"
if candidate [5,8,(-12),4,23,2,3,11,12,(-10)] == [(-12),... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_39_prime_fib | hs | -- | prime_fib returns n-th number that is a Fibonacci number and it's also prime.
-- >>> primeFib 1
-- 2
-- >>> primeFib 2
-- 3
-- >>> primeFib 3
-- 5
-- >>> primeFib 4
-- 13
-- >>> primeFib 5
-- 89
primeFib :: Int -> Int
primeFib n = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_39_prime_fib.py | verbatim |
main :: IO ()
main = do
let candidate = primeFib
if candidate 1 == 2 then pure () else error "assertion failed"
if candidate 2 == 3 then pure () else error "assertion failed"
if candidate 3 == 5 then pure () else error "assertion failed"
if candidate 4 == 13 then pure () else error "assertion failed"
if ca... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.