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_9_rolling_max | hs | -- | From a given list of integers, generate a list of rolling maximum element found until given moment
-- in the sequence.
-- >>> rolling_max([1, 2, 3, 2, 3, 4, 2])
-- [1, 2, 3, 3, 3, 4, 4]
rollingMax :: [Int] -> [Int]
rollingMax numbers = | keep | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals\HumanEval_9_rolling_max.py | verbatim |
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 :: [Float] -> Float -> Bool
hasCloseElements numbers threshold = | remove | 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... | remove | 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 :: String -> [String]
wordsString s = | remove | 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 :: Int -> Int -> Int
chooseNum x y = | remove | 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 :: [Int] -> [Int]
uniqueDigits x = | remove | 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:
-- If the array is empty, return an empty array... | remove | 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 *... | remove | 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:
-- Explanation:
-- Integer palindrome are 1, 2, 3. one of them is even, and two of them are odd.
-- Example 2:
-- Explanation:
-- Integer palindrom... | remove | 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 :: [Int] -> Int
countNums arr = | remove | 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 ... | remove | 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 :: String -> String
makePa... | remove | 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... | remove | 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 :: String -> [(String, Int)]
histogram test = | remove | 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... | remove | 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 :: [String] -> ... | remove | 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 :: [Int] -> Int
minsubarraysum nums = | remove | 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 ... | remove | 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 :: [Int] -> [Int]
sortArray arr = | remove | 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... | remove | 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... | remove | 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... | remove | 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 :: String -> String -> String
stringXor a b = | remove | 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:
-- Example 2:
-- Example 3:
-- Note:
-- 1. The length of the array will be in the range of [1, 1000].
-- 2. The elements in the array will be in the range of [-1000,... | remove | 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 :: [Int] -> Int
solution lst = | remove | 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:
-- Constraints:
-- 1. 1 <= len(arr) <= 100
-- 2. 1 <= k <= len(arr)
addElements :: [Int] -> Int -> Int
addElements arr k = | remove | 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... | remove | 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,... | remove | 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 :: [Int] -> Bool
isSorted lst = | remove | 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... | remove | 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 :: [Int] -> Maybe Int
prodSigns arr = | remove | 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... | remove | 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 :: [String] -> Maybe String
longest strings = | remove | 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... | remove | 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 :: Int -> Int
digits n = | remove | 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 :: String -> Bool
isNested string = | remove | 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:
sumSquares :: [Float] -> Int
sumSquares lst = | remove | 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 :: String -> Bool
checkIfLastCharIsALetter txt = | remove | 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 :: [Int] -> Int
canArrange arr = | remove | 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 :: [Int] -> (Maybe Int, Maybe Int)
largestSmalle... | remove | 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 :: Int -> Bool
isEqualToSumEven n = | remove | 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:
-- The function will receive an integer as input and should return the special
-- factorial of this integer.
specialFactorial :: Int -> Int
specialFactorial n = | remove | 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 :: Int -> Int -> Int
greatestCommonDivisor a b = | remove | 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 :: String -> String
fixSpaces text = | remove | 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... | remove | 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... | remove | 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... | remove | 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... | remove | 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 :: [Int] -> [Int]
orderByPoints nums = | remove | 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 :: [Int] -> Int
specialfilter nums = | remove | 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 :
-- Explanation:
-- a =... | remove | 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... | remove | 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 :: String -> [String]
allPrefixes string = | remove | 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 :: Int -> Int -> Int -> Int
xOrY n x y = | remove | 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.
-- If the input list is empty, return 0.
doubleTheDifference :: [Float] -> Int
doubleTheDifference lst = | remove | 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... | remove | 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... | remove | 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 :: String -> String -> Bool
cycpatternCheck a b = | remove | 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 :: Int -> (Int, Int)
evenOddCount num = | remove | 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 :: Int -> String
intToMiniRoman number = | remove | 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 :: Int -> Int -> Int -> Bool
rightAngleTriangle a b c ... | remove | 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 :: [String] -> String
findMax wo... | remove | 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... | remove | 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 :: Int -> String
stringSequence n = | remove | 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_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 :: String -> String
solve s = | remove | 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 :: String -> Maybe String
stringToMd5 text = | remove | 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 :: Int -> Int -> [Int]
generateIntegers a b = | remove | 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 :: String -> Int
countDistinctCharacters string = | remove | 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
-- '... | remove | 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 :: String -> String -> Int
howManyTimes string substring = | remove | 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 :: String -> String
sortNumbers numbers = | remove | 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... | remove | 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 :: [Float] -> (Float, Float)
findClosestElements numbers = | remove | 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 :: [Float] -> [Float]
rescaleToUnit numbers = | remove | 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 :: String -> Int
strlen string = | remove | 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 :: Int -> Int
largestDivisor n = | remove | 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 :: Int -> [Int]
factorize n = | remove | 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 :: [Int] -> [Int]
removeDuplicates numbers = | remove | 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 :: String -> String
flipCase string = | remove | 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 :: [String] -> String
concatenate strings = | remove | 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 :: [String] -> String -> [String]
filterByPrefix strings prefix = | remove | 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 :: Float -> Float
truncateNumber number = | remove | 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 :: [Int] -> [Int]
getPositive l = | remove | 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 :: Int -> Bool
isPrime n = | remove | 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 :: [Int] -> [Int]
sortThird l = | remove | 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 :: [Int] -> [Int]
unique l = | remove | 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 :: [Int] -> Int
maxElement l = | remove | 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 :: Int -> Int
fizzBuzz n = | remove | 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 :: [Int] -> [Int]
sortEven l = | remove | 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 :: Int -> Int
primeFib n = | remove | 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"
] |
HumanEval_3_below_zero | hs | -- | 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.
belowZero :: [Int] -> Bool
belowZero op... | remove | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_3_below_zero.py | verbatim |
main :: IO ()
main = do
let candidate = belowZero
if candidate [] == False then pure () else error "assertion failed"
if candidate [1,2,(-3),1,2,(-3)] == False then pure () else error "assertion failed"
if candidate [1,2,(-4),5,6] == True then pure () else error "assertion failed"
if candidate [1,(-1),2,(-2)... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_40_triples_sum_to_zero | hs | -- | 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.
triplesSumToZero :: [Int] -> Bool
triplesSumToZero l = | remove | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_40_triples_sum_to_zero.py | verbatim |
main :: IO ()
main = do
let candidate = triplesSumToZero
if candidate [1,3,5,0] == False then pure () else error "assertion failed"
if candidate [1,3,5,(-1)] == False then pure () else error "assertion failed"
if candidate [1,3,(-2),1] == True then pure () else error "assertion failed"
if candidate [1,2,3,7]... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_42_incr_list | hs | -- | Return list with elements incremented by 1.
incrList :: [Int] -> [Int]
incrList l = | remove | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_42_incr_list.py | verbatim |
main :: IO ()
main = do
let candidate = incrList
if candidate [] == [] then pure () else error "assertion failed"
if candidate [3,2,1] == [4,3,2] then pure () else error "assertion failed"
if candidate [5,2,5,2,3,3,9,0,123] == [6,3,6,3,4,4,10,1,124] then pure () else error "assertion failed"
pure () | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_43_pairs_sum_to_zero | hs | -- | 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.
pairsSumToZero :: [Int] -> Bool
pairsSumToZero l = | remove | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_43_pairs_sum_to_zero.py | verbatim |
main :: IO ()
main = do
let candidate = pairsSumToZero
if candidate [1,3,5,0] == False then pure () else error "assertion failed"
if candidate [1,3,(-2),1] == False then pure () else error "assertion failed"
if candidate [1,2,3,7] == False then pure () else error "assertion failed"
if candidate [2,4,(-5),3,5... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_44_change_base | hs | -- | Change numerical base of input number x to base.
-- return string representation after the conversion.
-- base numbers are less than 10.
changeBase :: Int -> Int -> String
changeBase x base = | remove | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_44_change_base.py | verbatim |
main :: IO ()
main = do
let candidate = changeBase
if candidate 8 3 == "22" then pure () else error "assertion failed"
if candidate 9 3 == "100" then pure () else error "assertion failed"
if candidate 234 2 == "11101010" then pure () else error "assertion failed"
if candidate 16 2 == "10000" then pure () els... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_45_triangle_area | hs | -- | Given length of a side and high return area for a triangle.
triangleArea :: Int -> Int -> Float
triangleArea a h = | remove | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_45_triangle_area.py | verbatim |
main :: IO ()
main = do
let candidate = triangleArea
if candidate 5 3 == 7.5 then pure () else error "assertion failed"
if candidate 2 2 == 2.0 then pure () else error "assertion failed"
if candidate 10 8 == 40.0 then pure () else error "assertion failed"
pure () | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_46_fib4 | hs | -- | 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 numb... | remove | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_46_fib4.py | verbatim |
main :: IO ()
main = do
let candidate = fib4
if candidate 5 == 4 then pure () else error "assertion failed"
if candidate 8 == 28 then pure () else error "assertion failed"
if candidate 10 == 104 then pure () else error "assertion failed"
if candidate 12 == 386 then pure () else error "assertion failed"
pur... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_47_median | hs | -- | Return median of elements in the list l.
median :: [Int] -> Float
median l = | remove | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_47_median.py | verbatim |
main :: IO ()
main = do
let candidate = median
if candidate [3,1,2,4,5] == 3.0 then pure () else error "assertion failed"
if candidate [(-10),4,6,1000,10,20] == 8.0 then pure () else error "assertion failed"
if candidate [5] == 5.0 then pure () else error "assertion failed"
if candidate [6,5] == 5.5 then pur... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_48_is_palindrome | hs | -- | Checks if given string is a palindrome
isPalindrome :: String -> Bool
isPalindrome text = | remove | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_48_is_palindrome.py | verbatim |
main :: IO ()
main = do
let candidate = isPalindrome
if candidate "" == True then pure () else error "assertion failed"
if candidate "aba" == True then pure () else error "assertion failed"
if candidate "aaaaa" == True then pure () else error "assertion failed"
if candidate "zbcd" == False then pure () else ... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_49_modp | hs | -- | Return 2^n modulo p (be aware of numerics).
modp :: Int -> Int -> Int
modp n p = | remove | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_49_modp.py | verbatim |
main :: IO ()
main = do
let candidate = modp
if candidate 3 5 == 3 then pure () else error "assertion failed"
if candidate 1101 101 == 2 then pure () else error "assertion failed"
if candidate 0 101 == 1 then pure () else error "assertion failed"
if candidate 3 11 == 8 then pure () else error "assertion fail... | [
"\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.