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_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 [1,2,3]
-- False
-- ... | transform | 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 [1,3,5,0]
-- False
-- >>> triplesSumToZero [1,3,(-2),1]
-- True
-- >>> triplesSumToZero [1,2,3,7]
-- False
-- >>> ... | transform | 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_41_car_race_collision | hs | -- | Imagine a road that's a perfectly straight infinitely long line.
-- n cars are driving left to right; simultaneously, a different set of n cars
-- are driving right to left. The two sets of cars start out being very far from
-- each other. All cars move in the same speed. Two cars are said to collide
-- w... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_41_car_race_collision.py | verbatim |
main :: IO ()
main = do
let candidate = carRaceCollision
if candidate 2 == 4 then pure () else error "assertion failed"
if candidate 3 == 9 then pure () else error "assertion failed"
if candidate 4 == 16 then pure () else error "assertion failed"
if candidate 8 == 64 then pure () else error "assertion failed... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_42_incr_list | hs | -- | Return list with elements incremented by 1.
-- >>> incrList [1,2,3]
-- [2,3,4]
-- >>> incrList [5,3,5,2,3,3,9,0,123]
-- [6,4,6,3,4,4,10,1,124]
incrList :: [Int] -> [Int]
incrList l = | transform | 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 [1,3,5,0]
-- False
-- >>> pairsSumToZero [1,3,(-2),1]
-- False
-- >>> pairsSumToZero [1,2,3,7]
-- False
-- >>> pairsSumT... | transform | 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 8 3
-- "22"
-- >>> changeBase 8 2
-- "1000"
-- >>> changeBase 7 2
-- "111"
changeBase :: Int -> Int -> String
changeBase x base = | transform | 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 5 3
-- 7.5
triangleArea :: Int -> Int -> Float
triangleArea a h = | transform | 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... | transform | 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 [3,1,2,4,5]
-- 3.0
-- >>> median [(-10),4,6,1000,10,20]
-- 15.0
median :: [Int] -> Float
median l = | transform | 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 ""
-- True
-- >>> isPalindrome "aba"
-- True
-- >>> isPalindrome "aaaaa"
-- True
-- >>> isPalindrome "zbcd"
-- False
isPalindrome :: String -> Bool
isPalindrome text = | transform | 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 3 5
-- 3
-- >>> modp 1101 101
-- 2
-- >>> modp 0 101
-- 1
-- >>> modp 3 11
-- 8
-- >>> modp 100 101
-- 1
modp :: Int -> Int -> Int
modp n p = | transform | 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"
] |
HumanEval_4_mean_absolute_deviation | hs | -- | For a given list of input numbers, calculate Mean Absolute Deviation
-- around the mean of this dataset.
-- Mean Absolute Deviation is the average absolute difference between each
-- element and a centerpoint (mean in this case):
-- MAD = average | x - x_mean |
-- >>> meanAbsoluteDeviation [1.0,2.0,3.0,4.0]
-... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_4_mean_absolute_deviation.py | verbatim |
main :: IO ()
main = do
let candidate = meanAbsoluteDeviation
if candidate [1.0,2.0] == 0.5 then pure () else error "assertion failed"
if candidate [1.0,2.0,3.0,4.0] == 1.0 then pure () else error "assertion failed"
if candidate [1.0,2.0,3.0,4.0,5.0] == 1.2 then pure () else error "assertion failed"
pure () | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_51_remove_vowels | hs | -- | remove_vowels is a function that takes string and returns string without vowels.
-- >>> removeVowels ""
-- ""
-- >>> removeVowels "abcdef"
-- "bcdf"
-- >>> removeVowels "aaaaa"
-- ""
-- >>> removeVowels "aaBAA"
-- "B"
-- >>> removeVowels "zbcd"
-- "zbcd"
removeVowels :: String -> String
removeVowels text... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_51_remove_vowels.py | verbatim |
main :: IO ()
main = do
let candidate = removeVowels
if candidate "" == "" then pure () else error "assertion failed"
if candidate "abcdef
ghijklm" == "bcdf
ghjklm" then pure () else error "assertion failed"
if candidate "fedcba" == "fdcb" then pure () else error "assertion failed"
if candidate "eeeee" == ""... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_52_below_threshold | hs | -- | Return True if all numbers in the list l are below threshold t.
-- >>> belowThreshold [1,2,4,10] 100
-- True
-- >>> belowThreshold [1,20,4,10] 5
-- False
belowThreshold :: [Int] -> Int -> Bool
belowThreshold l t = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_52_below_threshold.py | verbatim |
main :: IO ()
main = do
let candidate = belowThreshold
if candidate [1,2,4,10] 100 == True then pure () else error "assertion failed"
if candidate [1,20,4,10] 5 == False then pure () else error "assertion failed"
if candidate [1,20,4,10] 21 == True then pure () else error "assertion failed"
if candidate [1,2... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_53_add | hs | -- | Add two numbers x and y
-- >>> add 2 3
-- 5
-- >>> add 5 7
-- 12
add :: Int -> Int -> Int
add x y = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_53_add.py | verbatim |
main :: IO ()
main = do
let candidate = add
if candidate 0 1 == 1 then pure () else error "assertion failed"
if candidate 1 0 == 1 then pure () else error "assertion failed"
if candidate 2 3 == 5 then pure () else error "assertion failed"
if candidate 5 7 == 12 then pure () else error "assertion failed"
if... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_54_same_chars | hs | -- | Check if two words have the same characters.
-- >>> sameChars "eabcdzzzz" "dddzzzzzzzddeddabc"
-- True
-- >>> sameChars "abcd" "dddddddabc"
-- True
-- >>> sameChars "dddddddabc" "abcd"
-- True
-- >>> sameChars "eabcd" "dddddddabc"
-- False
-- >>> sameChars "abcd" "dddddddabce"
-- False
-- >>> sameChars ... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_54_same_chars.py | verbatim |
main :: IO ()
main = do
let candidate = sameChars
if candidate "eabcdzzzz" "dddzzzzzzzddeddabc" == True then pure () else error "assertion failed"
if candidate "abcd" "dddddddabc" == True then pure () else error "assertion failed"
if candidate "dddddddabc" "abcd" == True then pure () else error "assertion fail... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_55_fib | hs | -- | Return n-th Fibonacci number.
-- >>> fib 10
-- 55
-- >>> fib 1
-- 1
-- >>> fib 8
-- 21
fib :: Int -> Int
fib n = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_55_fib.py | verbatim |
main :: IO ()
main = do
let candidate = fib
if candidate 10 == 55 then pure () else error "assertion failed"
if candidate 1 == 1 then pure () else error "assertion failed"
if candidate 8 == 21 then pure () else error "assertion failed"
if candidate 11 == 89 then pure () else error "assertion failed"
if can... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_56_correct_bracketing | hs | -- | brackets is a string of "<" and ">".
-- return True if every opening bracket has a corresponding closing bracket.
-- >>> correctBracketing "<"
-- False
-- >>> correctBracketing "<>"
-- True
-- >>> correctBracketing "<<><>>"
-- True
-- >>> correctBracketing "><<>"
-- False
correctBracketing :: String -> Bo... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_56_correct_bracketing.py | verbatim |
main :: IO ()
main = do
let candidate = correctBracketing
if candidate "<>" == True then pure () else error "assertion failed"
if candidate "<<><>>" == True then pure () else error "assertion failed"
if candidate "<><><<><>><>" == True then pure () else error "assertion failed"
if candidate "<><><<<><><>><>>... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_57_monotonic | hs | -- | Return True is list elements are monotonically increasing or decreasing.
-- >>> monotonic [1,2,4,20]
-- True
-- >>> monotonic [1,20,4,10]
-- False
-- >>> monotonic [4,1,0,(-10)]
-- True
monotonic :: [Int] -> Bool
monotonic l = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_57_monotonic.py | verbatim |
main :: IO ()
main = do
let candidate = monotonic
if candidate [1,2,4,10] == True then pure () else error "assertion failed"
if candidate [1,2,4,20] == True then pure () else error "assertion failed"
if candidate [1,20,4,10] == False then pure () else error "assertion failed"
if candidate [4,1,0,(-10)] == Tr... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_58_common | hs | -- | Return sorted unique common elements for two lists.
-- >>> common [1,4,3,34,653,2,5] [5,7,1,5,9,653,121]
-- [1,5,653]
-- >>> common [5,3,2,8] [3,2]
-- [2,3]
common :: [Int] -> [Int] -> [Int]
common l1 l2 = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_58_common.py | verbatim |
main :: IO ()
main = do
let candidate = common
if candidate [1,4,3,34,653,2,5] [5,7,1,5,9,653,121] == [1,5,653] then pure () else error "assertion failed"
if candidate [5,3,2,8] [3,2] == [2,3] then pure () else error "assertion failed"
if candidate [4,3,2,8] [3,2,4] == [2,3,4] then pure () else error "assertio... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_59_largest_prime_factor | hs | -- | Return the largest prime factor of n. Assume n > 1 and is not a prime.
-- >>> largestPrimeFactor 13195
-- 29
-- >>> largestPrimeFactor 2048
-- 2
largestPrimeFactor :: Int -> Int
largestPrimeFactor n = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_59_largest_prime_factor.py | verbatim |
main :: IO ()
main = do
let candidate = largestPrimeFactor
if candidate 15 == 5 then pure () else error "assertion failed"
if candidate 27 == 3 then pure () else error "assertion failed"
if candidate 63 == 7 then pure () else error "assertion failed"
if candidate 330 == 11 then pure () else error "assertion ... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_5_intersperse | hs | -- | Insert a number 'delimeter' between every two consecutive elements of input list `numbers'
-- >>> intersperse [] 4
-- []
-- >>> intersperse [1,2,3] 4
-- [1,4,2,4,3]
intersperse :: [Int] -> Int -> [Int]
intersperse numbers delimeter = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_5_intersperse.py | verbatim |
main :: IO ()
main = do
let candidate = intersperse
if candidate [] 7 == [] then pure () else error "assertion failed"
if candidate [5,6,3,2] 8 == [5,8,6,8,3,8,2] then pure () else error "assertion failed"
if candidate [2,2,2] 2 == [2,2,2,2,2] then pure () else error "assertion failed"
pure () | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_60_sum_to_n | hs | -- | sum_to_n is a function that sums numbers from 1 to n.
-- >>> sumToN 30
-- 465
-- >>> sumToN 100
-- 5050
-- >>> sumToN 5
-- 15
-- >>> sumToN 10
-- 55
-- >>> sumToN 1
-- 1
sumToN :: Int -> Int
sumToN n = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_60_sum_to_n.py | verbatim |
main :: IO ()
main = do
let candidate = sumToN
if candidate 1 == 1 then pure () else error "assertion failed"
if candidate 6 == 21 then pure () else error "assertion failed"
if candidate 11 == 66 then pure () else error "assertion failed"
if candidate 30 == 465 then pure () else error "assertion failed"
if... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_61_correct_bracketing | hs | -- | brackets is a string of "(" and ")".
-- return True if every opening bracket has a corresponding closing bracket.
-- >>> correctBracketing "("
-- False
-- >>> correctBracketing "()"
-- True
-- >>> correctBracketing "(()())"
-- True
-- >>> correctBracketing ")(()"
-- False
correctBracketing :: String -> Bo... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_61_correct_bracketing.py | verbatim |
main :: IO ()
main = do
let candidate = correctBracketing
if candidate "()" == True then pure () else error "assertion failed"
if candidate "(()())" == True then pure () else error "assertion failed"
if candidate "()()(()())()" == True then pure () else error "assertion failed"
if candidate "()()((()()())())... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_62_derivative | hs | -- | xs represent coefficients of a polynomial.
-- xs[0] + xs[1] * x + xs[2] * x^2 + ....
-- Return derivative of this polynomial in the same form.
-- >>> derivative [3,1,2,4,5]
-- [1,4,12,20]
-- >>> derivative [1,2,3]
-- [2,6]
derivative :: [Int] -> [Int]
derivative xs = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_62_derivative.py | verbatim |
main :: IO ()
main = do
let candidate = derivative
if candidate [3,1,2,4,5] == [1,4,12,20] then pure () else error "assertion failed"
if candidate [1,2,3] == [2,6] then pure () else error "assertion failed"
if candidate [3,2,1] == [2,2] then pure () else error "assertion failed"
if candidate [3,2,1,0,4] == [... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_63_fibfib | hs | -- | The FibFib number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
-- fibfib(0) == 0
-- fibfib(1) == 0
-- fibfib(2) == 1
-- fibfib(n) == fibfib(n-1) + fibfib(n-2) + fibfib(n-3).
-- Please write a function to efficiently compute the n-th element of the fibfib number sequence... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_63_fibfib.py | verbatim |
main :: IO ()
main = do
let candidate = fibfib
if candidate 2 == 1 then pure () else error "assertion failed"
if candidate 1 == 0 then pure () else error "assertion failed"
if candidate 5 == 4 then pure () else error "assertion failed"
if candidate 8 == 24 then pure () else error "assertion failed"
if cand... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_64_vowels_count | hs | -- | Write a function vowels_count which takes a string representing
-- a word as input and returns the number of vowels in the string.
-- Vowels in this case are 'a', 'e', 'i', 'o', 'u'. Here, 'y' is also a
-- vowel, but only when it is at the end of the given word.
-- Example:
-- >>> vowelsCount "abcde"
-- 2
--... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_64_vowels_count.py | verbatim |
main :: IO ()
main = do
let candidate = vowelsCount
if candidate "abcde" == 2 then pure () else error "assertion failed"
if candidate "Alone" == 3 then pure () else error "assertion failed"
if candidate "key" == 2 then pure () else error "assertion failed"
if candidate "bye" == 1 then pure () else error "ass... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_65_circular_shift | hs | -- | Circular shift the digits of the integer x, shift the digits right by shift
-- and return the result as a string.
-- If shift > number of digits, return digits reversed.
-- >>> circularShift 12 1
-- "21"
-- >>> circularShift 12 2
-- "12"
circularShift :: Int -> Int -> String
circularShift x shift = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_65_circular_shift.py | verbatim |
main :: IO ()
main = do
let candidate = circularShift
if candidate 100 2 == "001" then pure () else error "assertion failed"
if candidate 12 2 == "12" then pure () else error "assertion failed"
if candidate 97 8 == "79" then pure () else error "assertion failed"
if candidate 12 1 == "21" then pure () else er... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_66_digitSum | hs | -- | Task
-- Write a function that takes a string as input and returns the sum of the upper characters only'
-- ASCII codes.
-- Examples:
-- >>> digitsum ""
-- 0
-- >>> digitsum "abAB"
-- 131
-- >>> digitsum "abcCd"
-- 67
-- >>> digitsum "helloE"
-- 69
-- >>> digitsum "woArBld"
-- 131
-- >>> digitsum "aAa... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_66_digitSum.py | verbatim |
main :: IO ()
main = do
let candidate = digitsum
if candidate "" == 0 then pure () else error "assertion failed"
if candidate "abAB" == 131 then pure () else error "assertion failed"
if candidate "abcCd" == 67 then pure () else error "assertion failed"
if candidate "helloE" == 69 then pure () else error "ass... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_67_fruit_distribution | hs | -- | In this task, you will be given a string that represents a number of apples and oranges
-- that are distributed in a basket of fruit this basket contains
-- apples, oranges, and mango fruits. Given the string that represents the total number of
-- the oranges and apples and an integer that represent the tota... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_67_fruit_distribution.py | verbatim |
main :: IO ()
main = do
let candidate = fruitDistribution
if candidate "5 apples and 6 oranges" 19 == 8 then pure () else error "assertion failed"
if candidate "5 apples and 6 oranges" 21 == 10 then pure () else error "assertion failed"
if candidate "0 apples and 1 oranges" 3 == 2 then pure () else error "asse... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_68_pluck | hs | -- | "Given an array representing a branch of a tree that has non-negative integer nodes
-- your task is to pluck one of the nodes and return it.
-- The plucked node should be the node with the smallest even value.
-- If multiple nodes with the same smallest even value are found return the node that has smallest ind... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_68_pluck.py | verbatim |
main :: IO ()
main = do
let candidate = pluck
if candidate [4,2,3] == [2,1] then pure () else error "assertion failed"
if candidate [1,2,3] == [2,1] then pure () else error "assertion failed"
if candidate [] == [] then pure () else error "assertion failed"
if candidate [5,0,3,0,4,2] == [0,1] then pure () els... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_69_search | hs | -- | You are given a non-empty list of positive integers. Return the greatest integer that is greater than
-- zero, and has a frequency greater than or equal to the value of the integer itself.
-- The frequency of an integer is the number of times it appears in the list.
-- If no such a value exist, return -1.
-- ... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_69_search.py | verbatim |
main :: IO ()
main = do
let candidate = search
if candidate [5,5,5,5,1] == 1 then pure () else error "assertion failed"
if candidate [4,1,4,1,4,4] == 4 then pure () else error "assertion failed"
if candidate [3,3] == (-1) then pure () else error "assertion failed"
if candidate [8,8,8,8,8,8,8,8] == 8 then pur... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_6_parse_nested_parens | hs | -- | Input to this function is a string represented multiple groups for nested parentheses separated by spaces.
-- For each of the group, output the deepest level of nesting of parentheses.
-- E.g. (()()) has maximum two levels of nesting while ((())) has three.
-- >>> parseNestedParens "(()()) ((())) () ((())()())"... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_6_parse_nested_parens.py | verbatim |
main :: IO ()
main = do
let candidate = parseNestedParens
if candidate "(()()) ((())) () ((())()())" == [2,3,1,3] then pure () else error "assertion failed"
if candidate "() (()) ((())) (((())))" == [1,2,3,4] then pure () else error "assertion failed"
if candidate "(()(())((())))" == [4] then pure () else erro... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_70_strange_sort_list | hs | -- | Given list of integers, return list in strange order.
-- Strange sorting, is when you start with the minimum value,
-- then maximum of the remaining integers, then minimum and so on.
-- Examples:
-- >>> strangeSortList [1,2,3,4]
-- [1,4,2,3]
-- >>> strangeSortList [5,5,5,5]
-- [5,5,5,5]
-- >>> strangeSortL... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_70_strange_sort_list.py | verbatim |
main :: IO ()
main = do
let candidate = strangeSortList
if candidate [1,2,3,4] == [1,4,2,3] then pure () else error "assertion failed"
if candidate [5,6,7,8,9] == [5,9,6,8,7] then pure () else error "assertion failed"
if candidate [1,2,3,4,5] == [1,5,2,4,3] then pure () else error "assertion failed"
if candi... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_71_triangle_area | hs | -- | Given the lengths of the three sides of a triangle. Return the area of
-- the triangle rounded to 2 decimal points if the three sides form a valid triangle.
-- Otherwise return -1
-- Three sides make a valid triangle when the sum of any two sides is greater
-- than the third side.
-- Example:
-- >>> triang... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_71_triangle_area.py | verbatim |
main :: IO ()
main = do
let candidate = triangleArea
if candidate 3 4 5 == 6.0 then pure () else error "assertion failed"
if candidate 1 2 10 == (-1).0 then pure () else error "assertion failed"
if candidate 4 8 5 == 8.18 then pure () else error "assertion failed"
if candidate 2 2 2 == 1.73 then pure () else... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_72_will_it_fly | hs | -- | Write a function that returns True if the object q will fly, and False otherwise.
-- The object q will fly if it's balanced (it is a palindromic list) and the sum of its elements is less than or equal the maximum possible weight w.
-- Example:
-- >>> willItFly [1,2] 5
-- False
-- # 1+2 is less than the maximu... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_72_will_it_fly.py | verbatim |
main :: IO ()
main = do
let candidate = willItFly
if candidate [3,2,3] 9 == True then pure () else error "assertion failed"
if candidate [1,2] 5 == False then pure () else error "assertion failed"
if candidate [3] 5 == True then pure () else error "assertion failed"
if candidate [3,2,3] 1 == False then pure ... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_73_smallest_change | hs | -- | Given an array arr of integers, find the minimum number of elements that
-- need to be changed to make the array palindromic. A palindromic array is an array that
-- is read the same backwards and forwards. In one change, you can change one element to any other element.
-- For example:
-- >>> smallestChange [1... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_73_smallest_change.py | verbatim |
main :: IO ()
main = do
let candidate = smallestChange
if candidate [1,2,3,5,4,7,9,6] == 4 then pure () else error "assertion failed"
if candidate [1,2,3,4,3,2,2] == 1 then pure () else error "assertion failed"
if candidate [1,4,2] == 1 then pure () else error "assertion failed"
if candidate [1,4,4,2] == 1 t... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_74_total_match | hs | -- | Write a function that accepts two lists of strings and returns the list that has
-- total number of chars in the all strings of the list less than the other list.
-- if the two lists have the same number of chars, return the first list.
-- Examples
-- >>> totalMatch [] []
-- []
-- >>> totalMatch ["hi","admi... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_74_total_match.py | verbatim |
main :: IO ()
main = do
let candidate = totalMatch
if candidate [] [] == [] then pure () else error "assertion failed"
if candidate ["hi","admin"] ["hi","hi"] == ["hi","hi"] then pure () else error "assertion failed"
if candidate ["hi","admin"] ["hi","hi","admin","project"] == ["hi","admin"] then pure () else ... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_75_is_multiply_prime | hs | -- | Write a function that returns true if the given number is the multiplication of 3 prime numbers
-- and false otherwise.
-- Knowing that (a) is less then 100.
-- Example:
-- >>> isMultiplyPrime 30
-- True
-- 30 = 2 * 3 * 5
isMultiplyPrime :: Int -> Bool
isMultiplyPrime a = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_75_is_multiply_prime.py | verbatim |
main :: IO ()
main = do
let candidate = isMultiplyPrime
if candidate 5 == False then pure () else error "assertion failed"
if candidate 30 == True then pure () else error "assertion failed"
if candidate 8 == True then pure () else error "assertion failed"
if candidate 10 == False then pure () else error "ass... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_76_is_simple_power | hs | -- | Your task is to write a function that returns true if a number x is a simple
-- power of n and false in other cases.
-- x is a simple power of n if n**int=x
-- For example:
-- >>> isSimplePower 1 4
-- True
-- >>> isSimplePower 2 2
-- True
-- >>> isSimplePower 8 2
-- True
-- >>> isSimplePower 3 2
-- Fals... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_76_is_simple_power.py | verbatim |
main :: IO ()
main = do
let candidate = isSimplePower
if candidate 16 2 == True then pure () else error "assertion failed"
if candidate 143214 16 == False then pure () else error "assertion failed"
if candidate 4 2 == True then pure () else error "assertion failed"
if candidate 9 3 == True then pure () else ... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_77_iscube | hs | -- | Write a function that takes an integer a and returns True
-- if this ingeger is a cube of some integer number.
-- Note: you may assume the input is always valid.
-- Examples:
-- >>> iscube 1
-- True
-- >>> iscube 2
-- False
-- >>> iscube (-1)
-- True
-- >>> iscube 64
-- True
-- >>> iscube 0
-- True
-... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_77_iscube.py | verbatim |
main :: IO ()
main = do
let candidate = iscube
if candidate 1 == True then pure () else error "assertion failed"
if candidate 2 == False then pure () else error "assertion failed"
if candidate (-1) == True then pure () else error "assertion failed"
if candidate 64 == True then pure () else error "assertion f... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_78_hex_key | hs | -- | You have been tasked to write a function that receives
-- a hexadecimal number as a string and counts the number of hexadecimal
-- digits that are primes (prime number, or a prime, is a natural number
-- greater than 1 that is not a product of two smaller natural numbers).
-- Hexadecimal digits are 0, 1, 2,... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_78_hex_key.py | verbatim |
main :: IO ()
main = do
let candidate = hexKey
if candidate "AB" == 1 then pure () else error "assertion failed"
if candidate "1077E" == 2 then pure () else error "assertion failed"
if candidate "ABED1A33" == 4 then pure () else error "assertion failed"
if candidate "2020" == 2 then pure () else error "asser... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_79_decimal_to_binary | hs | -- | You will be given a number in decimal form and your task is to convert it to
-- binary format. The function should return a string, with each character representing a binary
-- number. Each character in the string will be '0' or '1'.
-- There will be an extra couple of characters 'db' at the beginning and at th... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_79_decimal_to_binary.py | verbatim |
main :: IO ()
main = do
let candidate = decimalToBinary
if candidate 0 == "db0db" then pure () else error "assertion failed"
if candidate 32 == "db100000db" then pure () else error "assertion failed"
if candidate 103 == "db1100111db" then pure () else error "assertion failed"
if candidate 15 == "db1111db" th... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_7_filter_by_substring | hs | -- | Filter an input list of strings only for ones that contain given substring
-- >>> filterBySubstring [] "a"
-- []
-- >>> filterBySubstring ["abc","bacd","cde","array"] "a"
-- ["abc","bacd","array"]
filterBySubstring :: [String] -> String -> [String]
filterBySubstring strings substring = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_7_filter_by_substring.py | verbatim |
main :: IO ()
main = do
let candidate = filterBySubstring
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"
if candidate ["xxx","asd","aaaxxy","john doe","... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_80_is_happy | hs | -- | You are given a string s.
-- Your task is to check if the string is happy or not.
-- A string is happy if its length is at least 3 and every 3 consecutive letters are distinct
-- For example:
-- >>> isHappy "a"
-- False
-- >>> isHappy "aa"
-- False
-- >>> isHappy "abcd"
-- True
-- >>> isHappy "aabb"
-- ... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_80_is_happy.py | verbatim |
main :: IO ()
main = do
let candidate = isHappy
if candidate "a" == False then pure () else error "assertion failed"
if candidate "aa" == False then pure () else error "assertion failed"
if candidate "abcd" == True then pure () else error "assertion failed"
if candidate "aabb" == False then pure () else erro... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_81_numerical_letter_grade | hs | -- | It is the last week of the semester and the teacher has to give the grades
-- to students. The teacher has been making her own algorithm for grading.
-- The only problem is, she has lost the code she used for grading.
-- She has given you a list of GPAs for some students and you have to write
-- a function th... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_81_numerical_letter_grade.py | verbatim |
main :: IO ()
main = do
let candidate = numericalLetterGrade
if candidate [4.0,3,1.7,2,3.5] == ["A+","B","C-","C","A-"] then pure () else error "assertion failed"
if candidate [1.2] == ["D+"] then pure () else error "assertion failed"
if candidate [0.5] == ["D-"] then pure () else error "assertion failed"
if... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_82_prime_length | hs | -- | Write a function that takes a string and returns True if the string
-- length is a prime number or False otherwise
-- Examples
-- >>> primeLength "Hello"
-- True
-- >>> primeLength "abcdcba"
-- True
-- >>> primeLength "kittens"
-- True
-- >>> primeLength "orange"
-- False
primeLength :: String -> Bool
pr... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_82_prime_length.py | verbatim |
main :: IO ()
main = do
let candidate = primeLength
if candidate "Hello" == True then pure () else error "assertion failed"
if candidate "abcdcba" == True then pure () else error "assertion failed"
if candidate "kittens" == True then pure () else error "assertion failed"
if candidate "orange" == False then p... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_83_starts_one_ends | hs | -- | Given a positive integer n, return the count of the numbers of n-digit
-- positive integers that start or end with 1.
startsOneEnds :: Int -> Int
startsOneEnds n = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_83_starts_one_ends.py | verbatim |
main :: IO ()
main = do
let candidate = startsOneEnds
if candidate 1 == 1 then pure () else error "assertion failed"
if candidate 2 == 18 then pure () else error "assertion failed"
if candidate 3 == 180 then pure () else error "assertion failed"
if candidate 4 == 1800 then pure () else error "assertion faile... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_84_solve | hs | -- | Given a positive integer N, return the total sum of its digits in binary.
-- Example
-- >>> solve 1000
-- "1"
-- >>> solve 150
-- "110"
-- >>> solve 147
-- "1100"
-- Variables:
-- @N integer
-- Constraints: 0 ≤ N ≤ 10000.
-- Output:
-- a string of binary number
solve :: Int -> String
solve N = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_84_solve.py | verbatim |
main :: IO ()
main = do
let candidate = solve
if candidate 1000 == "1" then pure () else error "assertion failed"
if candidate 150 == "110" then pure () else error "assertion failed"
if candidate 147 == "1100" then pure () else error "assertion failed"
if candidate 333 == "1001" then pure () else error "asse... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_85_add | hs | -- | Given a non-empty list of integers lst. add the even elements that are at odd indices..
-- Examples:
-- >>> add [4,2,6,7]
-- 2
add :: [Int] -> Int
add lst = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_85_add.py | verbatim |
main :: IO ()
main = do
let candidate = add
if candidate [4,88] == 88 then pure () else error "assertion failed"
if candidate [4,5,6,7,2,122] == 122 then pure () else error "assertion failed"
if candidate [4,0,6,7] == 0 then pure () else error "assertion failed"
if candidate [4,4,6,8] == 12 then pure () else... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_86_anti_shuffle | hs | -- | Write a function that takes a string and returns an ordered version of it.
-- Ordered version of string, is a string where all words (separated by space)
-- are replaced by a new word where all the characters arranged in
-- ascending order based on ascii value.
-- Note: You should keep the order of words and b... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_86_anti_shuffle.py | verbatim |
main :: IO ()
main = do
let candidate = antiShuffle
if candidate "Hi" == "Hi" then pure () else error "assertion failed"
if candidate "hello" == "ehllo" then pure () else error "assertion failed"
if candidate "number" == "bemnru" then pure () else error "assertion failed"
if candidate "abcd" == "abcd" then p... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_87_get_row | hs | -- | You are given a 2 dimensional data, as a nested lists,
-- which is similar to matrix, however, unlike matrices,
-- each row may contain a different number of columns.
-- Given lst, and integer x, find integers x in the list,
-- and return list of tuples, [(x1, y1), (x2, y2) ...] such that
-- each tuple is a c... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_87_get_row.py | verbatim |
main :: IO ()
main = do
let candidate = getRow
if candidate [[1,2,3,4,5,6],[1,2,3,4,1,6],[1,2,3,4,5,1]] 1 == [(0, 0),(1, 4),(1, 0),(2, 5),(2, 0)] then pure () else error "assertion failed"
if candidate [[1,2,3,4,5,6],[1,2,3,4,5,6],[1,2,3,4,5,6],[1,2,3,4,5,6],[1,2,3,4,5,6],[1,2,3,4,5,6]] 2 == [(0, 1),(1, 1),(2, 1... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_88_sort_array | hs | -- | Given an array of non-negative integers, return a copy of the given array after sorting,
-- you will sort the given array in ascending order if the sum( first index value, last index value) is odd,
-- or sort it in descending order if the sum( first index value, last index value) is even.
-- Note:
-- * don't c... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_88_sort_array.py | verbatim |
main :: IO ()
main = do
let candidate = sortArray
if candidate [] == [] then pure () else error "assertion failed"
if candidate [5] == [5] then pure () else error "assertion failed"
if candidate [2,4,3,0,1,5] == [0,1,2,3,4,5] then pure () else error "assertion failed"
if candidate [2,4,3,0,1,5,6] == [6,5,4,3... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_89_encrypt | hs | -- | Create a function encrypt that takes a string as an argument and
-- returns a string encrypted with the alphabet being rotated.
-- The alphabet should be rotated in a manner such that the letters
-- shift down by two multiplied to two places.
-- For example:
-- >>> encrypt "hi"
-- "lm"
-- >>> encrypt "asd... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_89_encrypt.py | verbatim |
main :: IO ()
main = do
let candidate = encrypt
if candidate "hi" == "lm" then pure () else error "assertion failed"
if candidate "asdfghjkl" == "ewhjklnop" then pure () else error "assertion failed"
if candidate "gf" == "kj" then pure () else error "assertion failed"
if candidate "et" == "ix" then pure () e... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_8_sum_product | hs | -- | For a given list of integers, return a tuple consisting of a sum and a product of all the integers in a list.
-- Empty sum should be equal to 0 and empty product should be equal to 1.
-- >>> sumProduct []
-- (0, 1)
-- >>> sumProduct [1,2,3,4]
-- (10, 24)
sumProduct :: [Int] -> (Int, Int)
sumProduct numbers = | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_8_sum_product.py | verbatim |
main :: IO ()
main = do
let candidate = sumProduct
if candidate [] == (0, 1) then pure () else error "assertion failed"
if candidate [1,1,1] == (3, 1) then pure () else error "assertion failed"
if candidate [100,0] == (100, 0) then pure () else error "assertion failed"
if candidate [3,5,7] == (15, 105) then ... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
HumanEval_90_next_smallest | hs | -- | You are given a list of integers.
-- Write a function next_smallest() that returns the 2nd smallest element of the list.
-- Return None if there is no such element.
-- >>> nextSmallest [1,2,3,4,5]
-- Just (2)
-- >>> nextSmallest [5,1,4,3,2]
-- Just (2)
-- >>> nextSmallest []
-- Just (Nothing)
-- >>> nextS... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_90_next_smallest.py | verbatim |
main :: IO ()
main = do
let candidate = nextSmallest
if candidate [1,2,3,4,5] == Just (2) then pure () else error "assertion failed"
if candidate [5,1,4,3,2] == Just (2) then pure () else error "assertion failed"
if candidate [] == Just (Nothing) then pure () else error "assertion failed"
if candidate [1,1] ... | [
"\n\n",
"\n{-",
"\n-- |",
"\n--",
"\ntype",
"\ndata",
"\nnewtype"
] |
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 | verbatim |
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 | verbatim |
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 | verbatim |
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 | verbatim |
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 a dictionary, return True if all keys are strings in lower
-- case or all keys are strings in upper case, else return False.
-- The function should return False is the given dictionary is empty.
-- Examples:
-- >>> checkDictCase [("a", "apple"), ("b", "banana")]
-- True
-- >>> checkDictCase [("a", "ap... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_95_check_dict_case.py | verbatim |
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 an array 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]
-- >>> countU... | transform | C:\Users\Thomas\PycharmProjects\MultiPL-E\datasets\..\datasets\originals-with-cleaned-doctests\HumanEval_96_count_up_to.py | verbatim |
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 | verbatim |
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 | verbatim |
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 | verbatim |
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 | 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 | java | import java.util.*;
import java.lang.reflect.*;
import org.javatuples.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Check if in given list of numbers, are any two numbers closer to each other than
// given threshold.
// >>> has_close_elements(... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_0_has_close_elements.py | verbatim | }
public static void main(String[] args) {
assert(hasCloseElements((new ArrayList<Float>(Arrays.asList((float)1.0f, (float)2.0f, (float)3.9f, (float)4.0f, (float)5.0f, (float)2.2f))), (0.3f)) == (true));
assert(hasCloseElements((new ArrayList<Float>(Arrays.asList((float)1.0f, (float)2.0f, (float)3.9f, (... | [
"\n }\n"
] |
HumanEval_100_make_a_pile | java | import java.util.*;
import java.lang.reflect.*;
import org.javatuples.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// 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 st... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_100_make_a_pile.py | verbatim | }
public static void main(String[] args) {
assert(makeAPile((3l)).equals((new ArrayList<Long>(Arrays.asList((long)3l, (long)5l, (long)7l)))));
assert(makeAPile((4l)).equals((new ArrayList<Long>(Arrays.asList((long)4l, (long)6l, (long)8l, (long)10l)))));
assert(makeAPile((5l)).equals((new ArrayList<L... | [
"\n }\n"
] |
HumanEval_101_words_string | java | import java.util.*;
import java.lang.reflect.*;
import org.javatuples.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// 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 arr... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_101_words_string.py | verbatim | }
public static void main(String[] args) {
assert(wordsString(("Hi, my name is John")).equals((new ArrayList<String>(Arrays.asList((String)"Hi", (String)"my", (String)"name", (String)"is", (String)"John")))));
assert(wordsString(("One, two, three, four, five, six")).equals((new ArrayList<String>(Arrays.... | [
"\n }\n"
] |
HumanEval_102_choose_num | java | import java.util.*;
import java.lang.reflect.*;
import org.javatuples.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// This function takes two positive numbers x and y and returns the
// biggest even integer number that is in the range [x, y] inclusi... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_102_choose_num.py | verbatim | }
public static void main(String[] args) {
assert(chooseNum((12l), (15l)) == (14l));
assert(chooseNum((13l), (12l)) == (-1l));
assert(chooseNum((33l), (12354l)) == (12354l));
assert(chooseNum((5234l), (5233l)) == (-1l));
assert(chooseNum((6l), (29l)) == (28l));
assert(chooseNum((27l), (1... | [
"\n }\n"
] |
HumanEval_104_unique_digits | java | import java.util.*;
import java.lang.reflect.*;
import org.javatuples.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Given a list of positive integers x. return a sorted list of all
// elements that hasn't any even digit.
// Note: Returned lis... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_104_unique_digits.py | verbatim | }
public static void main(String[] args) {
assert(uniqueDigits((new ArrayList<Long>(Arrays.asList((long)15l, (long)33l, (long)1422l, (long)1l)))).equals((new ArrayList<Long>(Arrays.asList((long)1l, (long)15l, (long)33l)))));
assert(uniqueDigits((new ArrayList<Long>(Arrays.asList((long)152l, (long)323l, ... | [
"\n }\n"
] |
HumanEval_105_by_length | java | import java.util.*;
import java.lang.reflect.*;
import org.javatuples.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Given an array of integers, sort the integers that are between 1 and 9 inclusive,
// reverse the resulting array, and then replace ... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_105_by_length.py | verbatim | }
public static void main(String[] args) {
assert(byLength((new ArrayList<Long>(Arrays.asList((long)2l, (long)1l, (long)1l, (long)4l, (long)5l, (long)8l, (long)2l, (long)3l)))).equals((new ArrayList<String>(Arrays.asList((String)"Eight", (String)"Five", (String)"Four", (String)"Three", (String)"Two", (Strin... | [
"\n }\n"
] |
HumanEval_106_f | java | import java.util.*;
import java.lang.reflect.*;
import org.javatuples.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// 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 ... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_106_f.py | verbatim | }
public static void main(String[] args) {
assert(f((5l)).equals((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)6l, (long)24l, (long)15l)))));
assert(f((7l)).equals((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)6l, (long)24l, (long)15l, (long)720l, (long)28l)))));
assert... | [
"\n }\n"
] |
HumanEval_107_even_odd_palindrome | java | import java.util.*;
import java.lang.reflect.*;
import org.javatuples.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Given a positive integer n, return a tuple that has the number of even and odd
// integer palindromes that fall within the range(1,... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_107_even_odd_palindrome.py | verbatim | }
public static void main(String[] args) {
assert(evenOddPalindrome((123l)).equals((Pair.with(8l, 13l))));
assert(evenOddPalindrome((12l)).equals((Pair.with(4l, 6l))));
assert(evenOddPalindrome((3l)).equals((Pair.with(1l, 2l))));
assert(evenOddPalindrome((63l)).equals((Pair.with(6l, 8l))));
... | [
"\n }\n"
] |
HumanEval_108_count_nums | java | import java.util.*;
import java.lang.reflect.*;
import org.javatuples.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Write a function count_nums which takes an array of integers and returns
// the number of elements which has a sum of digits > 0.
... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_108_count_nums.py | verbatim | }
public static void main(String[] args) {
assert(countNums((new ArrayList<Long>(Arrays.asList()))) == (0l));
assert(countNums((new ArrayList<Long>(Arrays.asList((long)-1l, (long)-2l, (long)0l)))) == (0l));
assert(countNums((new ArrayList<Long>(Arrays.asList((long)1l, (long)1l, (long)2l, (long)-2l, ... | [
"\n }\n"
] |
HumanEval_109_move_one_ball | java | import java.util.*;
import java.lang.reflect.*;
import org.javatuples.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// 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... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_109_move_one_ball.py | verbatim | }
public static void main(String[] args) {
assert(moveOneBall((new ArrayList<Long>(Arrays.asList((long)3l, (long)4l, (long)5l, (long)1l, (long)2l)))) == (true));
assert(moveOneBall((new ArrayList<Long>(Arrays.asList((long)3l, (long)5l, (long)10l, (long)1l, (long)2l)))) == (true));
assert(moveOneBall... | [
"\n }\n"
] |
HumanEval_10_make_palindrome | java | import java.util.*;
import java.lang.reflect.*;
import org.javatuples.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Find the shortest palindrome that begins with a supplied string.
// Algorithm idea is simple:
// - Find the longest postfix of ... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_10_make_palindrome.py | verbatim | }
public static void main(String[] args) {
assert(makePalindrome(("")).equals(("")));
assert(makePalindrome(("x")).equals(("x")));
assert(makePalindrome(("xyz")).equals(("xyzyx")));
assert(makePalindrome(("xyx")).equals(("xyx")));
assert(makePalindrome(("jerry")).equals(("jerryrrej")));
... | [
"\n }\n"
] |
HumanEval_110_exchange | java | import java.util.*;
import java.lang.reflect.*;
import org.javatuples.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// In this problem, you will implement a function that takes two lists of numbers,
// and determines whether it is possible to perform... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_110_exchange.py | verbatim | }
public static void main(String[] args) {
assert(exchange((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)4l))), (new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)4l)))).equals(("YES")));
assert(exchange((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, ... | [
"\n }\n"
] |
HumanEval_111_histogram | java | import java.util.*;
import java.lang.reflect.*;
import org.javatuples.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Given a string representing a space separated lowercase letters, return a dictionary
// of the letter with the most repetition and ... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_111_histogram.py | verbatim | }
public static void main(String[] args) {
assert(histogram(("a b b a")).equals((new HashMap<String,Long>(Map.of("a", 2l, "b", 2l)))));
assert(histogram(("a b c a b")).equals((new HashMap<String,Long>(Map.of("a", 2l, "b", 2l)))));
assert(histogram(("a b c d g")).equals((new HashMap<String,Long>(Map.... | [
"\n }\n"
] |
HumanEval_112_reverse_delete | java | import java.util.*;
import java.lang.reflect.*;
import org.javatuples.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// 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
// t... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_112_reverse_delete.py | verbatim | }
public static void main(String[] args) {
assert(reverseDelete(("abcde"), ("ae")).equals((Pair.with("bcd", false))));
assert(reverseDelete(("abcdef"), ("b")).equals((Pair.with("acdef", false))));
assert(reverseDelete(("abcdedcba"), ("ab")).equals((Pair.with("cdedc", true))));
assert(reverseDele... | [
"\n }\n"
] |
HumanEval_113_odd_count | java | import java.util.*;
import java.lang.reflect.*;
import org.javatuples.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Given a list of strings, where each string consists of only digits, return a list.
// Each element i of the output should be "the n... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_113_odd_count.py | verbatim | }
public static void main(String[] args) {
assert(oddCount((new ArrayList<String>(Arrays.asList((String)"1234567")))).equals((new ArrayList<String>(Arrays.asList((String)"the number of odd elements 4n the str4ng 4 of the 4nput.")))));
assert(oddCount((new ArrayList<String>(Arrays.asList((String)"3", (St... | [
"\n }\n"
] |
HumanEval_114_minSubArraySum | java | import java.util.*;
import java.lang.reflect.*;
import org.javatuples.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Given an array of integers nums, find the minimum sum of any non-empty sub-array
// of nums.
// Example
// minSubArraySum([... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_114_minSubArraySum.py | verbatim | }
public static void main(String[] args) {
assert(minSubArraySum((new ArrayList<Long>(Arrays.asList((long)2l, (long)3l, (long)4l, (long)1l, (long)2l, (long)4l)))) == (1l));
assert(minSubArraySum((new ArrayList<Long>(Arrays.asList((long)-1l, (long)-2l, (long)-3l)))) == (-6l));
assert(minSubArraySum((... | [
"\n }\n"
] |
HumanEval_115_max_fill | java | import java.util.*;
import java.lang.reflect.*;
import org.javatuples.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// 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 wa... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_115_max_fill.py | verbatim | }
public static void main(String[] args) {
assert(maxFill((new ArrayList<ArrayList<Long>>(Arrays.asList((ArrayList<Long>)new ArrayList<Long>(Arrays.asList((long)0l, (long)0l, (long)1l, (long)0l)), (ArrayList<Long>)new ArrayList<Long>(Arrays.asList((long)0l, (long)1l, (long)0l, (long)0l)), (ArrayList<Long>)n... | [
"\n }\n"
] |
HumanEval_116_sort_array | java | import java.util.*;
import java.lang.reflect.*;
import org.javatuples.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// In this Kata, you have to sort an array of non-negative integers according to
// number of ones in their binary representation in a... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_116_sort_array.py | verbatim | }
public static void main(String[] args) {
assert(sortArray((new ArrayList<Long>(Arrays.asList((long)1l, (long)5l, (long)2l, (long)3l, (long)4l)))).equals((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)4l, (long)3l, (long)5l)))));
assert(sortArray((new ArrayList<Long>(Arrays.asList((long)-... | [
"\n }\n"
] |
HumanEval_117_select_words | java | import java.util.*;
import java.lang.reflect.*;
import org.javatuples.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// 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 str... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_117_select_words.py | verbatim | }
public static void main(String[] args) {
assert(selectWords(("Mary had a little lamb"), (4l)).equals((new ArrayList<String>(Arrays.asList((String)"little")))));
assert(selectWords(("Mary had a little lamb"), (3l)).equals((new ArrayList<String>(Arrays.asList((String)"Mary", (String)"lamb")))));
ass... | [
"\n }\n"
] |
HumanEval_118_get_closest_vowel | java | import java.util.*;
import java.lang.reflect.*;
import org.javatuples.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// 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... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_118_get_closest_vowel.py | verbatim | }
public static void main(String[] args) {
assert(getClosestVowel(("yogurt")).equals(("u")));
assert(getClosestVowel(("full")).equals(("u")));
assert(getClosestVowel(("easy")).equals(("")));
assert(getClosestVowel(("eAsy")).equals(("")));
assert(getClosestVowel(("ali")).equals(("")));
as... | [
"\n }\n"
] |
HumanEval_119_match_parens | java | import java.util.*;
import java.lang.reflect.*;
import org.javatuples.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// You are given a list of two strings, both strings consist of open
// parentheses '(' or close parentheses ')' only.
// Your job... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_119_match_parens.py | verbatim | }
public static void main(String[] args) {
assert(matchParens((new ArrayList<String>(Arrays.asList((String)"()(", (String)")")))).equals(("Yes")));
assert(matchParens((new ArrayList<String>(Arrays.asList((String)")", (String)")")))).equals(("No")));
assert(matchParens((new ArrayList<String>(Arrays.a... | [
"\n }\n"
] |
HumanEval_11_string_xor | java | import java.util.*;
import java.lang.reflect.*;
import org.javatuples.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// 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 strin... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_11_string_xor.py | verbatim | }
public static void main(String[] args) {
assert(stringXor(("111000"), ("101010")).equals(("010010")));
assert(stringXor(("1"), ("1")).equals(("0")));
assert(stringXor(("0101"), ("0000")).equals(("0101")));
}
}
| [
"\n }\n"
] |
HumanEval_120_maximum | java | import java.util.*;
import java.lang.reflect.*;
import org.javatuples.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// 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.
... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_120_maximum.py | verbatim | }
public static void main(String[] args) {
assert(maximum((new ArrayList<Long>(Arrays.asList((long)-3l, (long)-4l, (long)5l))), (3l)).equals((new ArrayList<Long>(Arrays.asList((long)-4l, (long)-3l, (long)5l)))));
assert(maximum((new ArrayList<Long>(Arrays.asList((long)4l, (long)-4l, (long)4l))), (2l)).e... | [
"\n }\n"
] |
HumanEval_121_solution | java | import java.util.*;
import java.lang.reflect.*;
import org.javatuples.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Given a non-empty list of integers, return the sum of all of the odd elements that are in even positions.
// Examples
// soluti... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_121_solution.py | verbatim | }
public static void main(String[] args) {
assert(solution((new ArrayList<Long>(Arrays.asList((long)5l, (long)8l, (long)7l, (long)1l)))) == (12l));
assert(solution((new ArrayList<Long>(Arrays.asList((long)3l, (long)3l, (long)3l, (long)3l, (long)3l)))) == (9l));
assert(solution((new ArrayList<Long>(A... | [
"\n }\n"
] |
HumanEval_122_add_elements | java | import java.util.*;
import java.lang.reflect.*;
import org.javatuples.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// 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 ... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_122_add_elements.py | verbatim | }
public static void main(String[] args) {
assert(addElements((new ArrayList<Long>(Arrays.asList((long)1l, (long)-2l, (long)-3l, (long)41l, (long)57l, (long)76l, (long)87l, (long)88l, (long)99l))), (3l)) == (-4l));
assert(addElements((new ArrayList<Long>(Arrays.asList((long)111l, (long)121l, (long)3l, (... | [
"\n }\n"
] |
HumanEval_123_get_odd_collatz | java | import java.util.*;
import java.lang.reflect.*;
import org.javatuples.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Given a positive integer n, return a sorted list that has the odd numbers in collatz sequence.
// The Collatz conjecture is a conje... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_123_get_odd_collatz.py | verbatim | }
public static void main(String[] args) {
assert(getOddCollatz((14l)).equals((new ArrayList<Long>(Arrays.asList((long)1l, (long)5l, (long)7l, (long)11l, (long)13l, (long)17l)))));
assert(getOddCollatz((5l)).equals((new ArrayList<Long>(Arrays.asList((long)1l, (long)5l)))));
assert(getOddCollatz((12l... | [
"\n }\n"
] |
HumanEval_124_valid_date | java | import java.util.*;
import java.lang.reflect.*;
import org.javatuples.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// You have to write a function which validates a given date string and
// returns True if the date is valid otherwise False.
// T... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_124_valid_date.py | verbatim | }
public static void main(String[] args) {
assert(validDate(("03-11-2000")) == (true));
assert(validDate(("15-01-2012")) == (false));
assert(validDate(("04-0-2040")) == (false));
assert(validDate(("06-04-2020")) == (true));
assert(validDate(("01-01-2007")) == (true));
assert(validDate(("... | [
"\n }\n"
] |
HumanEval_126_is_sorted | java | import java.util.*;
import java.lang.reflect.*;
import org.javatuples.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// 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... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_126_is_sorted.py | verbatim | }
public static void main(String[] args) {
assert(isSorted((new ArrayList<Long>(Arrays.asList((long)5l)))) == (true));
assert(isSorted((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l, (long)4l, (long)5l)))) == (true));
assert(isSorted((new ArrayList<Long>(Arrays.asList((long)1l, (lon... | [
"\n }\n"
] |
HumanEval_127_intersection | java | import java.util.*;
import java.lang.reflect.*;
import org.javatuples.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// You are given two intervals,
// where each interval is a pair of integers. For example, interval = (start, end) = (1, 2).
// Th... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_127_intersection.py | verbatim | }
public static void main(String[] args) {
assert(intersection((Pair.with(1l, 2l)), (Pair.with(2l, 3l))).equals(("NO")));
assert(intersection((Pair.with(-1l, 1l)), (Pair.with(0l, 4l))).equals(("NO")));
assert(intersection((Pair.with(-3l, -1l)), (Pair.with(-5l, 5l))).equals(("YES")));
assert(inte... | [
"\n }\n"
] |
HumanEval_128_prod_signs | java | import java.util.*;
import java.lang.reflect.*;
import org.javatuples.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// You are given an array arr of integers and you need to return
// sum of magnitudes of integers multiplied by product of all signs
... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_128_prod_signs.py | verbatim | }
public static void main(String[] args) {
assert(prodSigns((new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)2l, (long)-4l)))).equals(Optional.of(-9l)));
assert(prodSigns((new ArrayList<Long>(Arrays.asList((long)0l, (long)1l)))).equals(Optional.of(0l)));
assert(prodSigns((new ArrayList<L... | [
"\n }\n"
] |
HumanEval_129_minPath | java | import java.util.*;
import java.lang.reflect.*;
import org.javatuples.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// 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... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_129_minPath.py | verbatim | }
public static void main(String[] args) {
assert(minPath((new ArrayList<ArrayList<Long>>(Arrays.asList((ArrayList<Long>)new ArrayList<Long>(Arrays.asList((long)1l, (long)2l, (long)3l)), (ArrayList<Long>)new ArrayList<Long>(Arrays.asList((long)4l, (long)5l, (long)6l)), (ArrayList<Long>)new ArrayList<Long>(A... | [
"\n }\n"
] |
HumanEval_12_longest | java | import java.util.*;
import java.lang.reflect.*;
import org.javatuples.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Out of list of strings, return the longest one. Return the first one in case of multiple
// strings of the same length. Return None... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_12_longest.py | verbatim | }
public static void main(String[] args) {
assert(longest((new ArrayList<String>(Arrays.asList()))).equals(Optional.empty()));
assert(longest((new ArrayList<String>(Arrays.asList((String)"x", (String)"y", (String)"z")))).equals(Optional.of("x")));
assert(longest((new ArrayList<String>(Arrays.asList(... | [
"\n }\n"
] |
HumanEval_130_tri | java | import java.util.*;
import java.lang.reflect.*;
import org.javatuples.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Everyone knows Fibonacci sequence, it was studied deeply by mathematicians in
// the last couple centuries. However, what people d... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_130_tri.py | verbatim | }
public static void main(String[] args) {
assert(tri((3l)).equals((new ArrayList<Long>(Arrays.asList((long)1l, (long)3l, (long)2l, (long)8l)))));
assert(tri((4l)).equals((new ArrayList<Long>(Arrays.asList((long)1l, (long)3l, (long)2l, (long)8l, (long)3l)))));
assert(tri((5l)).equals((new ArrayList<... | [
"\n }\n"
] |
HumanEval_131_digits | java | import java.util.*;
import java.lang.reflect.*;
import org.javatuples.*;
import java.security.*;
import java.math.*;
import java.io.*;
import java.util.stream.*;
class Problem {
// Given a positive integer n, return the product of the odd digits.
// Return 0 if all digits are even.
// For example:
// di... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_131_digits.py | verbatim | }
public static void main(String[] args) {
assert(digits((5l)) == (5l));
assert(digits((54l)) == (5l));
assert(digits((120l)) == (1l));
assert(digits((5014l)) == (5l));
assert(digits((98765l)) == (315l));
assert(digits((5576543l)) == (2625l));
assert(digits((2468l)) == (0l));
}
... | [
"\n }\n"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.