Datasets:
name
stringlengths 15
44
| language
stringclasses 1
value | prompt
stringlengths 89
1.25k
| doctests
stringclasses 1
value | original
stringlengths 130
159
| prompt_terminology
stringclasses 1
value | tests
stringlengths 194
1.5k
| stop_tokens
sequencelengths 3
3
|
---|---|---|---|---|---|---|---|
HumanEval_0_has_close_elements | clj | (defn has_close_elements
" Check if in given list of numbers, are any two numbers closer to each other than
given threshold.
>>> (has_close_elements [1.0 2.0 3.0] 0.5)
false
>>> (has_close_elements [1.0 2.8 3.0 4.0 5.0 2.0] 0.3)
true"
[numbers threshold]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_0_has_close_elements.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate has_close_elements)
(deftest test-humaneval
(is (= (candidate [1.0 2.0 3.9 4.0 5.0 2.2] 0.3) true))
(is (= (candidate [1.0 2.0 3.9 4.0 5.0 2.2] 0.05) false))
(is (= (candidate [1.0 2.0 5.9 4.0 5.0] 0.95) true))
(is (= (candidate [1.0 2.0 5.9 4.0 5.0] 0.8) false))
(is (= (candidate [1.0 2.0 3.0 4.0 5.0 2.0] 0.1) true))
(is (= (candidate [1.1 2.2 3.1 4.1 5.1] 1.0) true))
(is (= (candidate [1.1 2.2 3.1 4.1 5.1] 0.5) false))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_1_separate_paren_groups | clj | (defn separate_paren_groups
" Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
separate those group into separate strings and return the list of those.
Separate groups are balanced (each open brace is properly closed) and not nested within each other
Ignore any spaces in the input string.
>>> (separate_paren_groups "( ) (( )) (( )( ))")
["()" "(())" "(()())"]"
[paren_string]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_1_separate_paren_groups.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate separate_paren_groups)
(deftest test-humaneval
(is (= (candidate "(()()) ((())) () ((())()())") ["(()())" "((()))" "()" "((())()())"]))
(is (= (candidate "() (()) ((())) (((())))") ["()" "(())" "((()))" "(((())))"]))
(is (= (candidate "(()(())((())))") ["(()(())((())))"]))
(is (= (candidate "( ) (( )) (( )( ))") ["()" "(())" "(()())"]))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_2_truncate_number | clj | (defn truncate_number
" 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.
>>> (truncate_number 3.5)
0.5"
[number]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_2_truncate_number.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate truncate_number)
(deftest test-humaneval
(is (= (candidate 3.5) 0.5))
(is (= (candidate 1.25) 0.25))
(is (= (candidate 123.0) 0.0))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_3_below_zero | clj | (defn below_zero
" 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.
>>> (below_zero [1 2 3])
false
>>> (below_zero [1 2 -4 5])
true"
[operations]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_3_below_zero.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate below_zero)
(deftest test-humaneval
(is (= (candidate []) false))
(is (= (candidate [1 2 -3 1 2 -3]) false))
(is (= (candidate [1 2 -4 5 6]) true))
(is (= (candidate [1 -1 2 -2 5 -5 4 -4]) false))
(is (= (candidate [1 -1 2 -2 5 -5 4 -5]) true))
(is (= (candidate [1 -2 2 -2 5 -5 4 -4]) true))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_4_mean_absolute_deviation | clj | (defn mean_absolute_deviation
" 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 |
>>> (mean_absolute_deviation [1.0 2.0 3.0 4.0])
1.0"
[numbers]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_4_mean_absolute_deviation.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate mean_absolute_deviation)
(deftest test-humaneval
(is (= (candidate [1.0 2.0]) 0.5))
(is (= (candidate [1.0 2.0 3.0 4.0]) 1.0))
(is (= (candidate [1.0 2.0 3.0 4.0 5.0]) 1.2))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_5_intersperse | clj | (defn intersperse
" 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]"
[numbers delimeter]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_5_intersperse.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate intersperse)
(deftest test-humaneval
(is (= (candidate [] 7) []))
(is (= (candidate [5 6 3 2] 8) [5 8 6 8 3 8 2]))
(is (= (candidate [2 2 2] 2) [2 2 2 2 2]))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_6_parse_nested_parens | clj | (defn parse_nested_parens
" 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.
>>> (parse_nested_parens "(()()) ((())) () ((())()())")
[2 3 1 3]"
[paren_string]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_6_parse_nested_parens.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate parse_nested_parens)
(deftest test-humaneval
(is (= (candidate "(()()) ((())) () ((())()())") [2 3 1 3]))
(is (= (candidate "() (()) ((())) (((())))") [1 2 3 4]))
(is (= (candidate "(()(())((())))") [4]))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_7_filter_by_substring | clj | (defn filter_by_substring
" Filter an input list of strings only for ones that contain given substring
>>> (filter_by_substring [] "a")
[]
>>> (filter_by_substring ["abc" "bacd" "cde" "array"] "a")
["abc" "bacd" "array"]"
[strings substring]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_7_filter_by_substring.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate filter_by_substring)
(deftest test-humaneval
(is (= (candidate [] "john") []))
(is (= (candidate ["xxx" "asd" "xxy" "john doe" "xxxAAA" "xxx"] "xxx") ["xxx" "xxxAAA" "xxx"]))
(is (= (candidate ["xxx" "asd" "aaaxxy" "john doe" "xxxAAA" "xxx"] "xx") ["xxx" "aaaxxy" "xxxAAA" "xxx"]))
(is (= (candidate ["grunt" "trumpet" "prune" "gruesome"] "run") ["grunt" "prune"]))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_8_sum_product | clj | (defn sum_product
" For a given list of integers, return a vector 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.
>>> (sum_product [])
[0 1]
>>> (sum_product [1 2 3 4])
[10 24]"
[numbers]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_8_sum_product.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate sum_product)
(deftest test-humaneval
(is (= (candidate []) [0 1]))
(is (= (candidate [1 1 1]) [3 1]))
(is (= (candidate [100 0]) [100 0]))
(is (= (candidate [3 5 7]) [15 105]))
(is (= (candidate [10]) [10 10]))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_9_rolling_max | clj | (defn rolling_max
" 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]"
[numbers]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_9_rolling_max.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate rolling_max)
(deftest test-humaneval
(is (= (candidate []) []))
(is (= (candidate [1 2 3 4]) [1 2 3 4]))
(is (= (candidate [4 3 2 1]) [4 4 4 4]))
(is (= (candidate [3 2 3 100 3]) [3 3 3 100 100]))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_10_make_palindrome | clj | (defn make_palindrome
" 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.
>>> (make_palindrome "")
""
>>> (make_palindrome "cat")
"catac"
>>> (make_palindrome "cata")
"catac""
[string]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_10_make_palindrome.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate make_palindrome)
(deftest test-humaneval
(is (= (candidate "") ""))
(is (= (candidate "x") "x"))
(is (= (candidate "xyz") "xyzyx"))
(is (= (candidate "xyx") "xyx"))
(is (= (candidate "jerry") "jerryrrej"))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_11_string_xor | clj | (defn string_xor
" 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.
>>> (string_xor "010" "110")
"100""
[a b]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_11_string_xor.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate string_xor)
(deftest test-humaneval
(is (= (candidate "111000" "101010") "010010"))
(is (= (candidate "1" "1") "0"))
(is (= (candidate "0101" "0000") "0101"))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_12_longest | clj | (defn longest
" Out of list of strings, return the longest one. Return the first one in case of multiple
strings of the same length. Return nil in case the input list is empty.
>>> (longest [])
nil
>>> (longest ["a" "b" "c"])
"a"
>>> (longest ["a" "bb" "ccc"])
"ccc""
[strings]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_12_longest.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate longest)
(deftest test-humaneval
(is (= (candidate []) nil))
(is (= (candidate ["x" "y" "z"]) "x"))
(is (= (candidate ["x" "yyy" "zzzz" "www" "kkkk" "abc"]) "zzzz"))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_13_greatest_common_divisor | clj | (defn greatest_common_divisor
" Return a greatest common divisor of two integers a and b
>>> (greatest_common_divisor 3 5)
1
>>> (greatest_common_divisor 25 15)
5"
[a b]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_13_greatest_common_divisor.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate greatest_common_divisor)
(deftest test-humaneval
(is (= (candidate 3 7) 1))
(is (= (candidate 10 15) 5))
(is (= (candidate 49 14) 7))
(is (= (candidate 144 60) 12))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_14_all_prefixes | clj | (defn all_prefixes
" Return list of all prefixes from shortest to longest of the input string
>>> (all_prefixes "abc")
["a" "ab" "abc"]"
[string]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_14_all_prefixes.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate all_prefixes)
(deftest test-humaneval
(is (= (candidate "") []))
(is (= (candidate "asdfgh") ["a" "as" "asd" "asdf" "asdfg" "asdfgh"]))
(is (= (candidate "WWW") ["W" "WW" "WWW"]))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_15_string_sequence | clj | (defn string_sequence
" Return a string containing space-delimited numbers starting from 0 upto n inclusive.
>>> (string_sequence 0)
"0"
>>> (string_sequence 5)
"0 1 2 3 4 5""
[n]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_15_string_sequence.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate string_sequence)
(deftest test-humaneval
(is (= (candidate 0) "0"))
(is (= (candidate 3) "0 1 2 3"))
(is (= (candidate 10) "0 1 2 3 4 5 6 7 8 9 10"))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_16_count_distinct_characters | clj | (defn count_distinct_characters
" Given a string, find out how many distinct characters (regardless of case) does it consist of
>>> (count_distinct_characters "xyzXYZ")
3
>>> (count_distinct_characters "Jerry")
4"
[string]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_16_count_distinct_characters.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate count_distinct_characters)
(deftest test-humaneval
(is (= (candidate "") 0))
(is (= (candidate "abcde") 5))
(is (= (candidate "abcdecadeCADE") 5))
(is (= (candidate "aaaaAAAAaaaa") 1))
(is (= (candidate "Jerry jERRY JeRRRY") 5))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_17_parse_music | clj | (defn parse_music
" Input to this function is a string representing musical notes in a special ASCII format.
Your task is to parse this string and return list of integers corresponding to how many beats does each
not last.
Here is a legend:
'o' - whole note, lasts four beats
'o|' - half note, lasts two beats
'.|' - quater note, lasts one beat
>>> (parse_music "o o| .| o| o| .| .| .| .| o o")
[4 2 1 2 2 1 1 1 1 4 4]"
[music_string]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_17_parse_music.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate parse_music)
(deftest test-humaneval
(is (= (candidate "") []))
(is (= (candidate "o o o o") [4 4 4 4]))
(is (= (candidate ".| .| .| .|") [1 1 1 1]))
(is (= (candidate "o| o| .| .| o o o o") [2 2 1 1 4 4 4 4]))
(is (= (candidate "o| .| o| .| o o| o o|") [2 1 2 1 4 2 4 2]))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_18_how_many_times | clj | (defn how_many_times
" Find how many times a given substring can be found in the original string. Count overlaping cases.
>>> (how_many_times "" "a")
0
>>> (how_many_times "aaa" "a")
3
>>> (how_many_times "aaaa" "aa")
3"
[string substring]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_18_how_many_times.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate how_many_times)
(deftest test-humaneval
(is (= (candidate "" "x") 0))
(is (= (candidate "xyxyxyx" "x") 4))
(is (= (candidate "cacacacac" "cac") 4))
(is (= (candidate "john doe" "john") 1))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_19_sort_numbers | clj | (defn sort_numbers
" 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
>>> (sort_numbers "three one five")
"one three five""
[numbers]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_19_sort_numbers.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate sort_numbers)
(deftest test-humaneval
(is (= (candidate "") ""))
(is (= (candidate "three") "three"))
(is (= (candidate "three five nine") "three five nine"))
(is (= (candidate "five zero four seven nine eight") "zero four five seven eight nine"))
(is (= (candidate "six five four three two one zero") "zero one two three four five six"))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_20_find_closest_elements | clj | (defn find_closest_elements
" 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).
>>> (find_closest_elements [1.0 2.0 3.0 4.0 5.0 2.2])
[2.0 2.2]
>>> (find_closest_elements [1.0 2.0 3.0 4.0 5.0 2.0])
[2.0 2.0]"
[numbers]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_20_find_closest_elements.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate find_closest_elements)
(deftest test-humaneval
(is (= (candidate [1.0 2.0 3.9 4.0 5.0 2.2]) [3.9 4.0]))
(is (= (candidate [1.0 2.0 5.9 4.0 5.0]) [5.0 5.9]))
(is (= (candidate [1.0 2.0 3.0 4.0 5.0 2.2]) [2.0 2.2]))
(is (= (candidate [1.0 2.0 3.0 4.0 5.0 2.0]) [2.0 2.0]))
(is (= (candidate [1.1 2.2 3.1 4.1 5.1]) [2.2 3.1]))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_21_rescale_to_unit | clj | (defn rescale_to_unit
" 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
>>> (rescale_to_unit [1.0 2.0 3.0 4.0 5.0])
[0.0 0.25 0.5 0.75 1.0]"
[numbers]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_21_rescale_to_unit.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate rescale_to_unit)
(deftest test-humaneval
(is (= (candidate [2.0 49.9]) [0.0 1.0]))
(is (= (candidate [100.0 49.9]) [1.0 0.0]))
(is (= (candidate [1.0 2.0 3.0 4.0 5.0]) [0.0 0.25 0.5 0.75 1.0]))
(is (= (candidate [2.0 1.0 5.0 3.0 4.0]) [0.25 0.0 1.0 0.5 0.75]))
(is (= (candidate [12.0 11.0 15.0 13.0 14.0]) [0.25 0.0 1.0 0.5 0.75]))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_22_filter_integers | clj | (defn filter_integers
" Filter given list of any cljthon values only for integers
>>> (filter_integers ["a" 3.14 5])
[5]
>>> (filter_integers [1 2 3 "abc" {} []])
[1 2 3]"
[values]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_22_filter_integers.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate filter_integers)
(deftest test-humaneval
(is (= (candidate []) []))
(is (= (candidate [4 {} [] 23.2 9 "adasd"]) [4 9]))
(is (= (candidate [3 "c" 3 3 "a" "b"]) [3 3 3]))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_23_strlen | clj | (defn strlen
" Return length of given string
>>> (strlen "")
0
>>> (strlen "abc")
3"
[string]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_23_strlen.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate strlen)
(deftest test-humaneval
(is (= (candidate "") 0))
(is (= (candidate "x") 1))
(is (= (candidate "asdasnakj") 9))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_24_largest_divisor | clj | (defn largest_divisor
" For a given number n, find the largest number that divides n evenly, smaller than n
>>> (largest_divisor 15)
5"
[n]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_24_largest_divisor.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate largest_divisor)
(deftest test-humaneval
(is (= (candidate 3) 1))
(is (= (candidate 7) 1))
(is (= (candidate 10) 5))
(is (= (candidate 100) 50))
(is (= (candidate 49) 7))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_25_factorize | clj | (defn factorize
" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> (factorize 8)
[2 2 2]
>>> (factorize 25)
[5 5]
>>> (factorize 70)
[2 5 7]"
[n]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_25_factorize.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate factorize)
(deftest test-humaneval
(is (= (candidate 2) [2]))
(is (= (candidate 4) [2 2]))
(is (= (candidate 8) [2 2 2]))
(is (= (candidate 57) [3 19]))
(is (= (candidate 3249) [3 3 19 19]))
(is (= (candidate 185193) [3 3 3 19 19 19]))
(is (= (candidate 20577) [3 19 19 19]))
(is (= (candidate 18) [2 3 3]))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_26_remove_duplicates | clj | (defn remove_duplicates
" From a list of integers, remove all elements that occur more than once.
Keep order of elements left the same as in the input.
>>> (remove_duplicates [1 2 3 2 4])
[1 3 4]"
[numbers]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_26_remove_duplicates.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate remove_duplicates)
(deftest test-humaneval
(is (= (candidate []) []))
(is (= (candidate [1 2 3 4]) [1 2 3 4]))
(is (= (candidate [1 2 3 2 4 3 5]) [1 4 5]))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_27_flip_case | clj | (defn flip_case
" For a given string, flip lowercase characters to uppercase and uppercase to lowercase.
>>> (flip_case "Hello")
"hELLO""
[string]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_27_flip_case.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate flip_case)
(deftest test-humaneval
(is (= (candidate "") ""))
(is (= (candidate "Hello!") "hELLO!"))
(is (= (candidate "These violent delights have violent ends") "tHESE VIOLENT DELIGHTS HAVE VIOLENT ENDS"))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_28_concatenate | clj | (defn concatenate
" Concatenate list of strings into a single string
>>> (concatenate [])
""
>>> (concatenate ["a" "b" "c"])
"abc""
[strings]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_28_concatenate.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate concatenate)
(deftest test-humaneval
(is (= (candidate []) ""))
(is (= (candidate ["x" "y" "z"]) "xyz"))
(is (= (candidate ["x" "y" "z" "w" "k"]) "xyzwk"))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_29_filter_by_prefix | clj | (defn filter_by_prefix
" Filter an input list of strings only for ones that start with a given prefix.
>>> (filter_by_prefix [] "a")
[]
>>> (filter_by_prefix ["abc" "bcd" "cde" "array"] "a")
["abc" "array"]"
[strings prefix]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_29_filter_by_prefix.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate filter_by_prefix)
(deftest test-humaneval
(is (= (candidate [] "john") []))
(is (= (candidate ["xxx" "asd" "xxy" "john doe" "xxxAAA" "xxx"] "xxx") ["xxx" "xxxAAA" "xxx"]))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_30_get_positive | clj | (defn get_positive
"Return only positive numbers in the list.
>>> (get_positive [-1 2 -4 5 6])
[2 5 6]
>>> (get_positive [5 3 -5 2 -3 3 9 0 123 1 -10])
[5 3 2 3 9 123 1]"
[l]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_30_get_positive.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate get_positive)
(deftest test-humaneval
(is (= (candidate [-1 -2 4 5 6]) [4 5 6]))
(is (= (candidate [5 3 -5 2 3 3 9 0 123 1 -10]) [5 3 2 3 3 9 123 1]))
(is (= (candidate [-1 -2]) []))
(is (= (candidate []) []))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_31_is_prime | clj | (defn is_prime
"Return true if a given number is prime, and false otherwise.
>>> (is_prime 6)
false
>>> (is_prime 101)
true
>>> (is_prime 11)
true
>>> (is_prime 13441)
true
>>> (is_prime 61)
true
>>> (is_prime 4)
false
>>> (is_prime 1)
false"
[n]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_31_is_prime.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate is_prime)
(deftest test-humaneval
(is (= (candidate 6) false))
(is (= (candidate 101) true))
(is (= (candidate 11) true))
(is (= (candidate 13441) true))
(is (= (candidate 61) true))
(is (= (candidate 4) false))
(is (= (candidate 1) false))
(is (= (candidate 5) true))
(is (= (candidate 11) true))
(is (= (candidate 17) true))
(is (= (candidate 85) false))
(is (= (candidate 77) false))
(is (= (candidate 255379) false))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_33_sort_third | clj | (defn sort_third
"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.
>>> (sort_third [1 2 3])
[1 2 3]
>>> (sort_third [5 6 3 4 8 9 2])
[2 6 3 4 8 9 5]"
[l]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_33_sort_third.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate sort_third)
(deftest test-humaneval
(is (= (candidate [5 6 3 4 8 9 2]) [2 6 3 4 8 9 5]))
(is (= (candidate [5 8 3 4 6 9 2]) [2 8 3 4 6 9 5]))
(is (= (candidate [5 6 9 4 8 3 2]) [2 6 9 4 8 3 5]))
(is (= (candidate [5 6 3 4 8 9 2 1]) [2 6 3 4 8 9 5 1]))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_34_unique | clj | (defn unique
"Return sorted unique elements in a list
>>> (unique [5 3 5 2 3 3 9 0 123])
[0 2 3 5 9 123]"
[l]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_34_unique.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate unique)
(deftest test-humaneval
(is (= (candidate [5 3 5 2 3 3 9 0 123]) [0 2 3 5 9 123]))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_35_max_element | clj | (defn max_element
"Return maximum element in the list.
>>> (max_element [1 2 3])
3
>>> (max_element [5 3 -5 2 -3 3 9 0 123 1 -10])
123"
[l]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_35_max_element.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate max_element)
(deftest test-humaneval
(is (= (candidate [1 2 3]) 3))
(is (= (candidate [5 3 -5 2 -3 3 9 0 124 1 -10]) 124))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_36_fizz_buzz | clj | (defn fizz_buzz
"Return the number of times the digit 7 appears in integers less than n which are divisible by 11 or 13.
>>> (fizz_buzz 50)
0
>>> (fizz_buzz 78)
2
>>> (fizz_buzz 79)
3"
[n]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_36_fizz_buzz.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate fizz_buzz)
(deftest test-humaneval
(is (= (candidate 50) 0))
(is (= (candidate 78) 2))
(is (= (candidate 79) 3))
(is (= (candidate 100) 3))
(is (= (candidate 200) 6))
(is (= (candidate 4000) 192))
(is (= (candidate 10000) 639))
(is (= (candidate 100000) 8026))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_37_sort_even | clj | (defn sort_even
"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.
>>> (sort_even [1 2 3])
[1 2 3]
>>> (sort_even [5 6 3 4])
[3 6 5 4]"
[l]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_37_sort_even.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate sort_even)
(deftest test-humaneval
(is (= (candidate [1 2 3]) [1 2 3]))
(is (= (candidate [5 3 -5 2 -3 3 9 0 123 1 -10]) [-10 3 -5 2 -3 3 5 0 9 1 123]))
(is (= (candidate [5 8 -12 4 23 2 3 11 12 -10]) [-12 8 3 4 5 2 12 11 23 -10]))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_39_prime_fib | clj | (defn prime_fib
"prime_fib returns n-th number that is a Fibonacci number and it's also prime.
>>> (prime_fib 1)
2
>>> (prime_fib 2)
3
>>> (prime_fib 3)
5
>>> (prime_fib 4)
13
>>> (prime_fib 5)
89"
[n]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_39_prime_fib.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate prime_fib)
(deftest test-humaneval
(is (= (candidate 1) 2))
(is (= (candidate 2) 3))
(is (= (candidate 3) 5))
(is (= (candidate 4) 13))
(is (= (candidate 5) 89))
(is (= (candidate 6) 233))
(is (= (candidate 7) 1597))
(is (= (candidate 8) 28657))
(is (= (candidate 9) 514229))
(is (= (candidate 10) 433494437))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_40_triples_sum_to_zero | clj | (defn triples_sum_to_zero
"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.
>>> (triples_sum_to_zero [1 3 5 0])
false
>>> (triples_sum_to_zero [1 3 -2 1])
true
>>> (triples_sum_to_zero [1 2 3 7])
false
>>> (triples_sum_to_zero [2 4 -5 3 9 7])
true
>>> (triples_sum_to_zero [1])
false"
[l]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_40_triples_sum_to_zero.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate triples_sum_to_zero)
(deftest test-humaneval
(is (= (candidate [1 3 5 0]) false))
(is (= (candidate [1 3 5 -1]) false))
(is (= (candidate [1 3 -2 1]) true))
(is (= (candidate [1 2 3 7]) false))
(is (= (candidate [1 2 5 7]) false))
(is (= (candidate [2 4 -5 3 9 7]) true))
(is (= (candidate [1]) false))
(is (= (candidate [1 3 5 -100]) false))
(is (= (candidate [100 3 5 -100]) false))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_41_car_race_collision | clj | (defn car_race_collision
"Imagine a road that's a perfectly straight infinitely long line.
n cars are driving left to right; simultaneously, a different set of n cars
are driving right to left. The two sets of cars start out being very far from
each other. All cars move in the same speed. Two cars are said to collide
when a car that's moving left to right hits a car that's moving right to left.
However, the cars are infinitely sturdy and strong; as a result, they continue moving
in their trajectory as if they did not collide.
This function outputs the number of such collisions."
[n]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_41_car_race_collision.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate car_race_collision)
(deftest test-humaneval
(is (= (candidate 2) 4))
(is (= (candidate 3) 9))
(is (= (candidate 4) 16))
(is (= (candidate 8) 64))
(is (= (candidate 10) 100))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_42_incr_list | clj | (defn incr_list
"Return list with elements incremented by 1.
>>> (incr_list [1 2 3])
[2 3 4]
>>> (incr_list [5 3 5 2 3 3 9 0 123])
[6 4 6 3 4 4 10 1 124]"
[l]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_42_incr_list.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate incr_list)
(deftest test-humaneval
(is (= (candidate []) []))
(is (= (candidate [3 2 1]) [4 3 2]))
(is (= (candidate [5 2 5 2 3 3 9 0 123]) [6 3 6 3 4 4 10 1 124]))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_43_pairs_sum_to_zero | clj | (defn pairs_sum_to_zero
"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.
>>> (pairs_sum_to_zero [1 3 5 0])
false
>>> (pairs_sum_to_zero [1 3 -2 1])
false
>>> (pairs_sum_to_zero [1 2 3 7])
false
>>> (pairs_sum_to_zero [2 4 -5 3 5 7])
true
>>> (pairs_sum_to_zero [1])
false"
[l]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_43_pairs_sum_to_zero.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate pairs_sum_to_zero)
(deftest test-humaneval
(is (= (candidate [1 3 5 0]) false))
(is (= (candidate [1 3 -2 1]) false))
(is (= (candidate [1 2 3 7]) false))
(is (= (candidate [2 4 -5 3 5 7]) true))
(is (= (candidate [1]) false))
(is (= (candidate [-3 9 -1 3 2 30]) true))
(is (= (candidate [-3 9 -1 3 2 31]) true))
(is (= (candidate [-3 9 -1 4 2 30]) false))
(is (= (candidate [-3 9 -1 4 2 31]) false))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_44_change_base | clj | (defn change_base
"Change numerical base of input number x to base.
return string representation after the conversion.
base numbers are less than 10.
>>> (change_base 8 3)
"22"
>>> (change_base 8 2)
"1000"
>>> (change_base 7 2)
"111""
[x base]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_44_change_base.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate change_base)
(deftest test-humaneval
(is (= (candidate 8 3) "22"))
(is (= (candidate 9 3) "100"))
(is (= (candidate 234 2) "11101010"))
(is (= (candidate 16 2) "10000"))
(is (= (candidate 8 2) "1000"))
(is (= (candidate 7 2) "111"))
(is (= (candidate 2 3) "2"))
(is (= (candidate 3 4) "3"))
(is (= (candidate 4 5) "4"))
(is (= (candidate 5 6) "5"))
(is (= (candidate 6 7) "6"))
(is (= (candidate 7 8) "7"))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_45_triangle_area | clj | (defn triangle_area
"Given length of a side and high return area for a triangle.
>>> (triangle_area 5 3)
7.5"
[a h]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_45_triangle_area.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate triangle_area)
(deftest test-humaneval
(is (= (candidate 5 3) 7.5))
(is (= (candidate 2 2) 2.0))
(is (= (candidate 10 8) 40.0))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_46_fib4 | clj | (defn fib4
"The Fib4 number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
fib4(0) -> 0
fib4(1) -> 0
fib4(2) -> 2
fib4(3) -> 0
fib4(n) -> fib4(n-1) + fib4(n-2) + fib4(n-3) + fib4(n-4).
Please write a function to efficiently compute the n-th element of the fib4 number sequence. Do not use recursion.
>>> (fib4 5)
4
>>> (fib4 6)
8
>>> (fib4 7)
14"
[n]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_46_fib4.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate fib4)
(deftest test-humaneval
(is (= (candidate 5) 4))
(is (= (candidate 8) 28))
(is (= (candidate 10) 104))
(is (= (candidate 12) 386))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_47_median | clj | (defn median
"Return median of elements in the list l.
>>> (median [3 1 2 4 5])
3
>>> (median [-10 4 6 1000 10 20])
15.0"
[l]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_47_median.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate median)
(deftest test-humaneval
(is (= (candidate [3 1 2 4 5]) 3))
(is (= (candidate [-10 4 6 1000 10 20]) 8.0))
(is (= (candidate [5]) 5))
(is (= (candidate [6 5]) 5.5))
(is (= (candidate [8 1 3 9 9 2 7]) 7))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_48_is_palindrome | clj | (defn is_palindrome
"Checks if given string is a palindrome
>>> (is_palindrome "")
true
>>> (is_palindrome "aba")
true
>>> (is_palindrome "aaaaa")
true
>>> (is_palindrome "zbcd")
false"
[text]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_48_is_palindrome.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate is_palindrome)
(deftest test-humaneval
(is (= (candidate "") true))
(is (= (candidate "aba") true))
(is (= (candidate "aaaaa") true))
(is (= (candidate "zbcd") false))
(is (= (candidate "xywyx") true))
(is (= (candidate "xywyz") false))
(is (= (candidate "xywzx") false))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_49_modp | clj | (defn modp
"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"
[n p]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_49_modp.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate modp)
(deftest test-humaneval
(is (= (candidate 3 5) 3))
(is (= (candidate 1101 101) 2))
(is (= (candidate 0 101) 1))
(is (= (candidate 3 11) 8))
(is (= (candidate 100 101) 1))
(is (= (candidate 30 5) 4))
(is (= (candidate 31 5) 3))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_51_remove_vowels | clj | (defn remove_vowels
"remove_vowels is a function that takes string and returns string without vowels.
>>> (remove_vowels "")
""
>>> (remove_vowels "abcdef")
"bcdf"
>>> (remove_vowels "aaaaa")
""
>>> (remove_vowels "aaBAA")
"B"
>>> (remove_vowels "zbcd")
"zbcd""
[text]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_51_remove_vowels.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate remove_vowels)
(deftest test-humaneval
(is (= (candidate "") ""))
(is (= (candidate "abcdef
ghijklm") "bcdf
ghjklm"))
(is (= (candidate "fedcba") "fdcb"))
(is (= (candidate "eeeee") ""))
(is (= (candidate "acBAA") "cB"))
(is (= (candidate "EcBOO") "cB"))
(is (= (candidate "ybcd") "ybcd"))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_52_below_threshold | clj | (defn below_threshold
"Return true if all numbers in the list l are below threshold t.
>>> (below_threshold [1 2 4 10] 100)
true
>>> (below_threshold [1 20 4 10] 5)
false"
[l t]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_52_below_threshold.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate below_threshold)
(deftest test-humaneval
(is (= (candidate [1 2 4 10] 100) true))
(is (= (candidate [1 20 4 10] 5) false))
(is (= (candidate [1 20 4 10] 21) true))
(is (= (candidate [1 20 4 10] 22) true))
(is (= (candidate [1 8 4 10] 11) true))
(is (= (candidate [1 8 4 10] 10) false))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_53_add | clj | (defn add
"Add two numbers x and y
>>> (add 2 3)
5
>>> (add 5 7)
12"
[x y]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_53_add.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate add)
(deftest test-humaneval
(is (= (candidate 0 1) 1))
(is (= (candidate 1 0) 1))
(is (= (candidate 2 3) 5))
(is (= (candidate 5 7) 12))
(is (= (candidate 7 5) 12))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_54_same_chars | clj | (defn same_chars
"Check if two words have the same characters.
>>> (same_chars "eabcdzzzz" "dddzzzzzzzddeddabc")
true
>>> (same_chars "abcd" "dddddddabc")
true
>>> (same_chars "dddddddabc" "abcd")
true
>>> (same_chars "eabcd" "dddddddabc")
false
>>> (same_chars "abcd" "dddddddabce")
false
>>> (same_chars "eabcdzzzz" "dddzzzzzzzddddabc")
false"
[s0 s1]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_54_same_chars.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate same_chars)
(deftest test-humaneval
(is (= (candidate "eabcdzzzz" "dddzzzzzzzddeddabc") true))
(is (= (candidate "abcd" "dddddddabc") true))
(is (= (candidate "dddddddabc" "abcd") true))
(is (= (candidate "eabcd" "dddddddabc") false))
(is (= (candidate "abcd" "dddddddabcf") false))
(is (= (candidate "eabcdzzzz" "dddzzzzzzzddddabc") false))
(is (= (candidate "aabb" "aaccc") false))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_55_fib | clj | (defn fib
"Return n-th Fibonacci number.
>>> (fib 10)
55
>>> (fib 1)
1
>>> (fib 8)
21"
[n]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_55_fib.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate fib)
(deftest test-humaneval
(is (= (candidate 10) 55))
(is (= (candidate 1) 1))
(is (= (candidate 8) 21))
(is (= (candidate 11) 89))
(is (= (candidate 12) 144))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_56_correct_bracketing | clj | (defn correct_bracketing
" brackets is a string of "<" and ">".
return true if every opening bracket has a corresponding closing bracket.
>>> (correct_bracketing "<")
false
>>> (correct_bracketing "<>")
true
>>> (correct_bracketing "<<><>>")
true
>>> (correct_bracketing "><<>")
false"
[brackets]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_56_correct_bracketing.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate correct_bracketing)
(deftest test-humaneval
(is (= (candidate "<>") true))
(is (= (candidate "<<><>>") true))
(is (= (candidate "<><><<><>><>") true))
(is (= (candidate "<><><<<><><>><>><<><><<>>>") true))
(is (= (candidate "<<<><>>>>") false))
(is (= (candidate "><<>") false))
(is (= (candidate "<") false))
(is (= (candidate "<<<<") false))
(is (= (candidate ">") false))
(is (= (candidate "<<>") false))
(is (= (candidate "<><><<><>><>><<>") false))
(is (= (candidate "<><><<><>><>>><>") false))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_57_monotonic | clj | (defn monotonic
"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"
[l]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_57_monotonic.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate monotonic)
(deftest test-humaneval
(is (= (candidate [1 2 4 10]) true))
(is (= (candidate [1 2 4 20]) true))
(is (= (candidate [1 20 4 10]) false))
(is (= (candidate [4 1 0 -10]) true))
(is (= (candidate [4 1 1 0]) true))
(is (= (candidate [1 2 3 2 5 60]) false))
(is (= (candidate [1 2 3 4 5 60]) true))
(is (= (candidate [9 9 9 9]) true))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_58_common | clj | (defn common
"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]"
[l1 l2]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_58_common.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate common)
(deftest test-humaneval
(is (= (candidate [1 4 3 34 653 2 5] [5 7 1 5 9 653 121]) [1 5 653]))
(is (= (candidate [5 3 2 8] [3 2]) [2 3]))
(is (= (candidate [4 3 2 8] [3 2 4]) [2 3 4]))
(is (= (candidate [4 3 2 8] []) []))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_59_largest_prime_factor | clj | (defn largest_prime_factor
"Return the largest prime factor of n. Assume n > 1 and is not a prime.
>>> (largest_prime_factor 13195)
29
>>> (largest_prime_factor 2048)
2"
[n]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_59_largest_prime_factor.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate largest_prime_factor)
(deftest test-humaneval
(is (= (candidate 15) 5))
(is (= (candidate 27) 3))
(is (= (candidate 63) 7))
(is (= (candidate 330) 11))
(is (= (candidate 13195) 29))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_60_sum_to_n | clj | (defn sum_to_n
"sum_to_n is a function that sums numbers from 1 to n.
>>> (sum_to_n 30)
465
>>> (sum_to_n 100)
5050
>>> (sum_to_n 5)
15
>>> (sum_to_n 10)
55
>>> (sum_to_n 1)
1"
[n]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_60_sum_to_n.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate sum_to_n)
(deftest test-humaneval
(is (= (candidate 1) 1))
(is (= (candidate 6) 21))
(is (= (candidate 11) 66))
(is (= (candidate 30) 465))
(is (= (candidate 100) 5050))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_61_correct_bracketing | clj | (defn correct_bracketing
" brackets is a string of "(" and ")".
return true if every opening bracket has a corresponding closing bracket.
>>> (correct_bracketing "(")
false
>>> (correct_bracketing "()")
true
>>> (correct_bracketing "(()())")
true
>>> (correct_bracketing ")(()")
false"
[brackets]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_61_correct_bracketing.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate correct_bracketing)
(deftest test-humaneval
(is (= (candidate "()") true))
(is (= (candidate "(()())") true))
(is (= (candidate "()()(()())()") true))
(is (= (candidate "()()((()()())())(()()(()))") true))
(is (= (candidate "((()())))") false))
(is (= (candidate ")(()") false))
(is (= (candidate "(") false))
(is (= (candidate "((((") false))
(is (= (candidate ")") false))
(is (= (candidate "(()") false))
(is (= (candidate "()()(()())())(()") false))
(is (= (candidate "()()(()())()))()") false))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_62_derivative | clj | (defn derivative
" 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]"
[xs]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_62_derivative.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate derivative)
(deftest test-humaneval
(is (= (candidate [3 1 2 4 5]) [1 4 12 20]))
(is (= (candidate [1 2 3]) [2 6]))
(is (= (candidate [3 2 1]) [2 2]))
(is (= (candidate [3 2 1 0 4]) [2 2 0 16]))
(is (= (candidate [1]) []))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_63_fibfib | clj | (defn fibfib
"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.
>>> (fibfib 1)
0
>>> (fibfib 5)
4
>>> (fibfib 8)
24"
[n]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_63_fibfib.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate fibfib)
(deftest test-humaneval
(is (= (candidate 2) 1))
(is (= (candidate 1) 0))
(is (= (candidate 5) 4))
(is (= (candidate 8) 24))
(is (= (candidate 10) 81))
(is (= (candidate 12) 274))
(is (= (candidate 14) 927))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_64_vowels_count | clj | (defn vowels_count
"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:
>>> (vowels_count "abcde")
2
>>> (vowels_count "ACEDY")
3"
[s]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_64_vowels_count.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate vowels_count)
(deftest test-humaneval
(is (= (candidate "abcde") 2))
(is (= (candidate "Alone") 3))
(is (= (candidate "key") 2))
(is (= (candidate "bye") 1))
(is (= (candidate "keY") 2))
(is (= (candidate "bYe") 1))
(is (= (candidate "ACEDY") 3))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_65_circular_shift | clj | (defn circular_shift
"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.
>>> (circular_shift 12 1)
"21"
>>> (circular_shift 12 2)
"12""
[x shift]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_65_circular_shift.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate circular_shift)
(deftest test-humaneval
(is (= (candidate 100 2) "001"))
(is (= (candidate 12 2) "12"))
(is (= (candidate 97 8) "79"))
(is (= (candidate 12 1) "21"))
(is (= (candidate 11 101) "11"))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_66_digitSum | clj | (defn digitSum
"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 "aAaaaXa")
153"
[s]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_66_digitSum.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate digitSum)
(deftest test-humaneval
(is (= (candidate "") 0))
(is (= (candidate "abAB") 131))
(is (= (candidate "abcCd") 67))
(is (= (candidate "helloE") 69))
(is (= (candidate "woArBld") 131))
(is (= (candidate "aAaaaXa") 153))
(is (= (candidate " How are yOu?") 151))
(is (= (candidate "You arE Very Smart") 327))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_67_fruit_distribution | clj | (defn fruit_distribution
"In this task, you will be given a string that represents a number of apples and oranges
that are distributed in a basket of fruit this basket contains
apples, oranges, and mango fruits. Given the string that represents the total number of
the oranges and apples and an integer that represent the total number of the fruits
in the basket return the number of the mango fruits in the basket.
for examble:
>>> (fruit_distribution "5 apples and 6 oranges" 19)
8
>>> (fruit_distribution "0 apples and 1 oranges" 3)
2
>>> (fruit_distribution "2 apples and 3 oranges" 100)
95
>>> (fruit_distribution "100 apples and 1 oranges" 120)
19"
[s n]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_67_fruit_distribution.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate fruit_distribution)
(deftest test-humaneval
(is (= (candidate "5 apples and 6 oranges" 19) 8))
(is (= (candidate "5 apples and 6 oranges" 21) 10))
(is (= (candidate "0 apples and 1 oranges" 3) 2))
(is (= (candidate "1 apples and 0 oranges" 3) 2))
(is (= (candidate "2 apples and 3 oranges" 100) 95))
(is (= (candidate "2 apples and 3 oranges" 5) 0))
(is (= (candidate "1 apples and 100 oranges" 120) 19))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_68_pluck | clj | (defn pluck
""Given a vector representing a branch of a tree that has non-negative integer nodes
your task is to pluck one of the nodes and return it.
The plucked node should be the node with the smallest even value.
If multiple nodes with the same smallest even value are found return the node that has smallest index.
The plucked node should be returned in a list, [ smalest_value, its index ],
If there are no even values or the given vector is empty, return [].
Example 1:
>>> (pluck [4 2 3])
[2 1]
Explanation: 2 has the smallest even value, and 2 has the smallest index.
Example 2:
>>> (pluck [1 2 3])
[2 1]
Explanation: 2 has the smallest even value, and 2 has the smallest index.
Example 3:
>>> (pluck [])
[]
Example 4:
>>> (pluck [5 0 3 0 4 2])
[0 1]
Explanation: 0 is the smallest value, but there are two zeros,
so we will choose the first zero, which has the smallest index.
Constraints:
* 1 <= nodes.length <= 10000
* 0 <= node.value"
[arr]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_68_pluck.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate pluck)
(deftest test-humaneval
(is (= (candidate [4 2 3]) [2 1]))
(is (= (candidate [1 2 3]) [2 1]))
(is (= (candidate []) []))
(is (= (candidate [5 0 3 0 4 2]) [0 1]))
(is (= (candidate [1 2 3 0 5 3]) [0 3]))
(is (= (candidate [5 4 8 4 8]) [4 1]))
(is (= (candidate [7 6 7 1]) [6 1]))
(is (= (candidate [7 9 7 1]) []))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_69_search | clj | (defn search
"You are given a non-empty list of positive integers. Return the greatest integer that is greater than
zero, and has a frequency greater than or equal to the value of the integer itself.
The frequency of an integer is the number of times it appears in the list.
If no such a value exist, return -1.
Examples:
>>> (search [4 1 2 2 3 1])
2
>>> (search [1 2 2 3 3 3 4 4 4])
3
>>> (search [5 5 4 4 4])
-1"
[lst]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_69_search.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate search)
(deftest test-humaneval
(is (= (candidate [5 5 5 5 1]) 1))
(is (= (candidate [4 1 4 1 4 4]) 4))
(is (= (candidate [3 3]) -1))
(is (= (candidate [8 8 8 8 8 8 8 8]) 8))
(is (= (candidate [2 3 3 2 2]) 2))
(is (= (candidate [2 7 8 8 4 8 7 3 9 6 5 10 4 3 6 7 1 7 4 10 8 1]) 1))
(is (= (candidate [3 2 8 2]) 2))
(is (= (candidate [6 7 1 8 8 10 5 8 5 3 10]) 1))
(is (= (candidate [8 8 3 6 5 6 4]) -1))
(is (= (candidate [6 9 6 7 1 4 7 1 8 8 9 8 10 10 8 4 10 4 10 1 2 9 5 7 9]) 1))
(is (= (candidate [1 9 10 1 3]) 1))
(is (= (candidate [6 9 7 5 8 7 5 3 7 5 10 10 3 6 10 2 8 6 5 4 9 5 3 10]) 5))
(is (= (candidate [1]) 1))
(is (= (candidate [8 8 10 6 4 3 5 8 2 4 2 8 4 6 10 4 2 1 10 2 1 1 5]) 4))
(is (= (candidate [2 10 4 8 2 10 5 1 2 9 5 5 6 3 8 6 4 10]) 2))
(is (= (candidate [1 6 10 1 6 9 10 8 6 8 7 3]) 1))
(is (= (candidate [9 2 4 1 5 1 5 2 5 7 7 7 3 10 1 5 4 2 8 4 1 9 10 7 10 2 8 10 9 4]) 4))
(is (= (candidate [2 6 4 2 8 7 5 6 4 10 4 6 3 7 8 8 3 1 4 2 2 10 7]) 4))
(is (= (candidate [9 8 6 10 2 6 10 2 7 8 10 3 8 2 6 2 3 1]) 2))
(is (= (candidate [5 5 3 9 5 6 3 2 8 5 6 10 10 6 8 4 10 7 7 10 8]) -1))
(is (= (candidate [10]) -1))
(is (= (candidate [9 7 7 2 4 7 2 10 9 7 5 7 2]) 2))
(is (= (candidate [5 4 10 2 1 1 10 3 6 1 8]) 1))
(is (= (candidate [7 9 9 9 3 4 1 5 9 1 2 1 1 10 7 5 6 7 6 7 7 6]) 1))
(is (= (candidate [3 10 10 9 2]) -1))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_70_strange_sort_list | clj | (defn strange_sort_list
"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:
>>> (strange_sort_list [1 2 3 4])
[1 4 2 3]
>>> (strange_sort_list [5 5 5 5])
[5 5 5 5]
>>> (strange_sort_list [])
[]"
[lst]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_70_strange_sort_list.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate strange_sort_list)
(deftest test-humaneval
(is (= (candidate [1 2 3 4]) [1 4 2 3]))
(is (= (candidate [5 6 7 8 9]) [5 9 6 8 7]))
(is (= (candidate [1 2 3 4 5]) [1 5 2 4 3]))
(is (= (candidate [5 6 7 8 9 1]) [1 9 5 8 6 7]))
(is (= (candidate [5 5 5 5]) [5 5 5 5]))
(is (= (candidate []) []))
(is (= (candidate [1 2 3 4 5 6 7 8]) [1 8 2 7 3 6 4 5]))
(is (= (candidate [0 2 2 2 5 5 -5 -5]) [-5 5 -5 5 0 2 2 2]))
(is (= (candidate [111111]) [111111]))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_71_triangle_area | clj | (defn triangle_area
"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:
>>> (triangle_area 3 4 5)
6.0
>>> (triangle_area 1 2 10)
-1"
[a b c]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_71_triangle_area.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate triangle_area)
(deftest test-humaneval
(is (= (candidate 3 4 5) 6.0))
(is (= (candidate 1 2 10) -1))
(is (= (candidate 4 8 5) 8.18))
(is (= (candidate 2 2 2) 1.73))
(is (= (candidate 1 2 3) -1))
(is (= (candidate 10 5 7) 16.25))
(is (= (candidate 2 6 3) -1))
(is (= (candidate 1 1 1) 0.43))
(is (= (candidate 2 2 10) -1))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_72_will_it_fly | clj | (defn will_it_fly
"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:
>>> (will_it_fly [1 2] 5)
false
# 1+2 is less than the maximum possible weight, but it's unbalanced.
>>> (will_it_fly [3 2 3] 1)
false
# it's balanced, but 3+2+3 is more than the maximum possible weight.
>>> (will_it_fly [3 2 3] 9)
true
# 3+2+3 is less than the maximum possible weight, and it's balanced.
>>> (will_it_fly [3] 5)
true
# 3 is less than the maximum possible weight, and it's balanced."
[q w]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_72_will_it_fly.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate will_it_fly)
(deftest test-humaneval
(is (= (candidate [3 2 3] 9) true))
(is (= (candidate [1 2] 5) false))
(is (= (candidate [3] 5) true))
(is (= (candidate [3 2 3] 1) false))
(is (= (candidate [1 2 3] 6) false))
(is (= (candidate [5] 5) true))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_73_smallest_change | clj | (defn smallest_change
"Given a vector arr of integers, find the minimum number of elements that
need to be changed to make the vector palindromic. A palindromic vector is a vector that
is read the same backwards and forwards. In one change, you can change one element to any other element.
For example:
>>> (smallest_change [1 2 3 5 4 7 9 6])
4
>>> (smallest_change [1 2 3 4 3 2 2])
1
>>> (smallest_change [1 2 3 2 1])
0"
[arr]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_73_smallest_change.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate smallest_change)
(deftest test-humaneval
(is (= (candidate [1 2 3 5 4 7 9 6]) 4))
(is (= (candidate [1 2 3 4 3 2 2]) 1))
(is (= (candidate [1 4 2]) 1))
(is (= (candidate [1 4 4 2]) 1))
(is (= (candidate [1 2 3 2 1]) 0))
(is (= (candidate [3 1 1 3]) 0))
(is (= (candidate [1]) 0))
(is (= (candidate [0 1]) 1))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_74_total_match | clj | (defn total_match
"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
>>> (total_match [] [])
[]
>>> (total_match ["hi" "admin"] ["hI" "Hi"])
["hI" "Hi"]
>>> (total_match ["hi" "admin"] ["hi" "hi" "admin" "project"])
["hi" "admin"]
>>> (total_match ["hi" "admin"] ["hI" "hi" "hi"])
["hI" "hi" "hi"]
>>> (total_match ["4"] ["1" "2" "3" "4" "5"])
["4"]"
[lst1 lst2]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_74_total_match.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate total_match)
(deftest test-humaneval
(is (= (candidate [] []) []))
(is (= (candidate ["hi" "admin"] ["hi" "hi"]) ["hi" "hi"]))
(is (= (candidate ["hi" "admin"] ["hi" "hi" "admin" "project"]) ["hi" "admin"]))
(is (= (candidate ["4"] ["1" "2" "3" "4" "5"]) ["4"]))
(is (= (candidate ["hi" "admin"] ["hI" "Hi"]) ["hI" "Hi"]))
(is (= (candidate ["hi" "admin"] ["hI" "hi" "hi"]) ["hI" "hi" "hi"]))
(is (= (candidate ["hi" "admin"] ["hI" "hi" "hii"]) ["hi" "admin"]))
(is (= (candidate [] ["this"]) []))
(is (= (candidate ["this"] []) []))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_75_is_multiply_prime | clj | (defn is_multiply_prime
"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:
>>> (is_multiply_prime 30)
true
30 = 2 * 3 * 5"
[a]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_75_is_multiply_prime.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate is_multiply_prime)
(deftest test-humaneval
(is (= (candidate 5) false))
(is (= (candidate 30) true))
(is (= (candidate 8) true))
(is (= (candidate 10) false))
(is (= (candidate 125) true))
(is (= (candidate 105) true))
(is (= (candidate 126) false))
(is (= (candidate 729) false))
(is (= (candidate 891) false))
(is (= (candidate 1001) true))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_76_is_simple_power | clj | (defn is_simple_power
"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:
>>> (is_simple_power 1 4)
true
>>> (is_simple_power 2 2)
true
>>> (is_simple_power 8 2)
true
>>> (is_simple_power 3 2)
false
>>> (is_simple_power 3 1)
false
>>> (is_simple_power 5 3)
false"
[x n]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_76_is_simple_power.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate is_simple_power)
(deftest test-humaneval
(is (= (candidate 16 2) true))
(is (= (candidate 143214 16) false))
(is (= (candidate 4 2) true))
(is (= (candidate 9 3) true))
(is (= (candidate 16 4) true))
(is (= (candidate 24 2) false))
(is (= (candidate 128 4) false))
(is (= (candidate 12 6) false))
(is (= (candidate 1 1) true))
(is (= (candidate 1 12) true))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_77_iscube | clj | (defn iscube
"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
>>> (iscube 180)
false"
[a]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_77_iscube.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate iscube)
(deftest test-humaneval
(is (= (candidate 1) true))
(is (= (candidate 2) false))
(is (= (candidate -1) true))
(is (= (candidate 64) true))
(is (= (candidate 180) false))
(is (= (candidate 1000) true))
(is (= (candidate 0) true))
(is (= (candidate 1729) false))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_78_hex_key | clj | (defn hex_key
"You have been tasked to write a function that receives
a hexadecimal number as a string and counts the number of hexadecimal
digits that are primes (prime number, or a prime, is a natural number
greater than 1 that is not a product of two smaller natural numbers).
Hexadecimal digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
Prime numbers are 2, 3, 5, 7, 11, 13, 17,...
So you have to determine a number of the following digits: 2, 3, 5, 7,
B (=decimal 11), D (=decimal 13).
Note: you may assume the input is always correct or empty string,
and symbols A,B,C,D,E,F are always uppercase.
Examples:
>>> (hex_key "AB")
1
>>> (hex_key "1077E")
2
>>> (hex_key "ABED1A33")
4
>>> (hex_key "123456789ABCDEF0")
6
>>> (hex_key "2020")
2"
[num]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_78_hex_key.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate hex_key)
(deftest test-humaneval
(is (= (candidate "AB") 1))
(is (= (candidate "1077E") 2))
(is (= (candidate "ABED1A33") 4))
(is (= (candidate "2020") 2))
(is (= (candidate "123456789ABCDEF0") 6))
(is (= (candidate "112233445566778899AABBCCDDEEFF00") 12))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_79_decimal_to_binary | clj | (defn decimal_to_binary
"You will be given a number in decimal form and your task is to convert it to
binary format. The function should return a string, with each character representing a binary
number. Each character in the string will be '0' or '1'.
There will be an extra couple of characters 'db' at the beginning and at the end of the string.
The extra characters are there to help with the format.
Examples:
>>> (decimal_to_binary 15)
"db1111db"
>>> (decimal_to_binary 32)
"db100000db""
[decimal]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_79_decimal_to_binary.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate decimal_to_binary)
(deftest test-humaneval
(is (= (candidate 0) "db0db"))
(is (= (candidate 32) "db100000db"))
(is (= (candidate 103) "db1100111db"))
(is (= (candidate 15) "db1111db"))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_80_is_happy | clj | (defn is_happy
"You are given a string s.
Your task is to check if the string is hapclj or not.
A string is hapclj if its length is at least 3 and every 3 consecutive letters are distinct
For example:
>>> (is_happy "a")
false
>>> (is_happy "aa")
false
>>> (is_happy "abcd")
true
>>> (is_happy "aabb")
false
>>> (is_happy "adb")
true
>>> (is_happy "xyy")
false"
[s]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_80_is_happy.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate is_happy)
(deftest test-humaneval
(is (= (candidate "a") false))
(is (= (candidate "aa") false))
(is (= (candidate "abcd") true))
(is (= (candidate "aabb") false))
(is (= (candidate "adb") true))
(is (= (candidate "xyy") false))
(is (= (candidate "iopaxpoi") true))
(is (= (candidate "iopaxioi") false))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_81_numerical_letter_grade | clj | (defn numerical_letter_grade
"It is the last week of the semester and the teacher has to give the grades
to students. The teacher has been making her own algorithm for grading.
The only problem is, she has lost the code she used for grading.
She has given you a list of GPAs for some students and you have to write
a function that can output a list of letter grades using the following table:
GPA | Letter grade
4.0 A+
> 3.7 A
> 3.3 A-
> 3.0 B+
> 2.7 B
> 2.3 B-
> 2.0 C+
> 1.7 C
> 1.3 C-
> 1.0 D+
> 0.7 D
> 0.0 D-
0.0 E
Example:
>>> (grade_equation [4.0 3 1.7 2 3.5])
["A+" "B" "C-" "C" "A-"]"
[grades]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_81_numerical_letter_grade.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate numerical_letter_grade)
(deftest test-humaneval
(is (= (candidate [4.0 3 1.7 2 3.5]) ["A+" "B" "C-" "C" "A-"]))
(is (= (candidate [1.2]) ["D+"]))
(is (= (candidate [0.5]) ["D-"]))
(is (= (candidate [0.0]) ["E"]))
(is (= (candidate [1.0 0.3 1.5 2.8 3.3]) ["D" "D-" "C-" "B" "B+"]))
(is (= (candidate [0.0 0.7]) ["E" "D-"]))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_82_prime_length | clj | (defn prime_length
"Write a function that takes a string and returns true if the string
length is a prime number or false otherwise
Examples
>>> (prime_length "Hello")
true
>>> (prime_length "abcdcba")
true
>>> (prime_length "kittens")
true
>>> (prime_length "orange")
false"
[string]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_82_prime_length.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate prime_length)
(deftest test-humaneval
(is (= (candidate "Hello") true))
(is (= (candidate "abcdcba") true))
(is (= (candidate "kittens") true))
(is (= (candidate "orange") false))
(is (= (candidate "wow") true))
(is (= (candidate "world") true))
(is (= (candidate "MadaM") true))
(is (= (candidate "Wow") true))
(is (= (candidate "") false))
(is (= (candidate "HI") true))
(is (= (candidate "go") true))
(is (= (candidate "gogo") false))
(is (= (candidate "aaaaaaaaaaaaaaa") false))
(is (= (candidate "Madam") true))
(is (= (candidate "M") false))
(is (= (candidate "0") false))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_83_starts_one_ends | clj | (defn starts_one_ends
"Given a positive integer n, return the count of the numbers of n-digit
positive integers that start or end with 1."
[n]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_83_starts_one_ends.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate starts_one_ends)
(deftest test-humaneval
(is (= (candidate 1) 1))
(is (= (candidate 2) 18))
(is (= (candidate 3) 180))
(is (= (candidate 4) 1800))
(is (= (candidate 5) 18000))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_84_solve | clj | (defn solve
"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"
[N]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_84_solve.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate solve)
(deftest test-humaneval
(is (= (candidate 1000) "1"))
(is (= (candidate 150) "110"))
(is (= (candidate 147) "1100"))
(is (= (candidate 333) "1001"))
(is (= (candidate 963) "10010"))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_85_add | clj | (defn add
"Given a non-empty list of integers lst. add the even elements that are at odd indices..
Examples:
>>> (add [4 2 6 7])
2"
[lst]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_85_add.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate add)
(deftest test-humaneval
(is (= (candidate [4 88]) 88))
(is (= (candidate [4 5 6 7 2 122]) 122))
(is (= (candidate [4 0 6 7]) 0))
(is (= (candidate [4 4 6 8]) 12))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_86_anti_shuffle | clj | (defn anti_shuffle
"Write a function that takes a string and returns an ordered version of it.
Ordered version of string, is a string where all words (separated by space)
are replaced by a new word where all the characters arranged in
ascending order based on ascii value.
Note: You should keep the order of words and blank spaces in the sentence.
For example:
>>> (anti_shuffle "Hi")
"Hi"
>>> (anti_shuffle "hello")
"ehllo"
>>> (anti_shuffle "Hello World!!!")
"Hello !!!Wdlor""
[s]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_86_anti_shuffle.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate anti_shuffle)
(deftest test-humaneval
(is (= (candidate "Hi") "Hi"))
(is (= (candidate "hello") "ehllo"))
(is (= (candidate "number") "bemnru"))
(is (= (candidate "abcd") "abcd"))
(is (= (candidate "Hello World!!!") "Hello !!!Wdlor"))
(is (= (candidate "") ""))
(is (= (candidate "Hi. My name is Mister Robot. How are you?") ".Hi My aemn is Meirst .Rboot How aer ?ouy"))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_87_get_row | clj | (defn get_row
"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 vectors, [(x1, y1), (x2, y2) ...] such that
each vector is a coordinate - (row, columns), starting with 0.
Sort coordinates initially by rows in ascending order.
Also, sort coordinates of the row by columns in descending order.
Examples:
>>> (get_row [[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]]
>>> (get_row [] 1)
[]
>>> (get_row [[] [1] [1 2 3]] 3)
[[2 2]]"
[lst x]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_87_get_row.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate get_row)
(deftest test-humaneval
(is (= (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]]))
(is (= (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] [3 1] [4 1] [5 1]]))
(is (= (candidate [[1 2 3 4 5 6] [1 2 3 4 5 6] [1 1 3 4 5 6] [1 2 1 4 5 6] [1 2 3 1 5 6] [1 2 3 4 1 6] [1 2 3 4 5 1]] 1) [[0 0] [1 0] [2 1] [2 0] [3 2] [3 0] [4 3] [4 0] [5 4] [5 0] [6 5] [6 0]]))
(is (= (candidate [] 1) []))
(is (= (candidate [[1]] 2) []))
(is (= (candidate [[] [1] [1 2 3]] 3) [[2 2]]))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_88_sort_array | clj | (defn sort_array
"Given a vector of non-negative integers, return a coclj of the given vector after sorting,
you will sort the given vector in ascending order if the sum( first index value, last index value) is odd,
or sort it in descending order if the sum( first index value, last index value) is even.
Note:
* don't change the given vector.
Examples:
>>> (sort_array [])
[]
>>> (sort_array [5])
[5]
>>> (sort_array [2 4 3 0 1 5])
[0 1 2 3 4 5]
>>> (sort_array [2 4 3 0 1 5 6])
[6 5 4 3 2 1 0]"
[array]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_88_sort_array.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate sort_array)
(deftest test-humaneval
(is (= (candidate []) []))
(is (= (candidate [5]) [5]))
(is (= (candidate [2 4 3 0 1 5]) [0 1 2 3 4 5]))
(is (= (candidate [2 4 3 0 1 5 6]) [6 5 4 3 2 1 0]))
(is (= (candidate [2 1]) [1 2]))
(is (= (candidate [15 42 87 32 11 0]) [0 11 15 32 42 87]))
(is (= (candidate [21 14 23 11]) [23 21 14 11]))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_89_encrypt | clj | (defn encrypt
"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 "asdfghjkl")
"ewhjklnop"
>>> (encrypt "gf")
"kj"
>>> (encrypt "et")
"ix""
[s]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_89_encrypt.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate encrypt)
(deftest test-humaneval
(is (= (candidate "hi") "lm"))
(is (= (candidate "asdfghjkl") "ewhjklnop"))
(is (= (candidate "gf") "kj"))
(is (= (candidate "et") "ix"))
(is (= (candidate "faewfawefaewg") "jeiajeaijeiak"))
(is (= (candidate "hellomyfriend") "lippsqcjvmirh"))
(is (= (candidate "dxzdlmnilfuhmilufhlihufnmlimnufhlimnufhfucufh") "hbdhpqrmpjylqmpyjlpmlyjrqpmqryjlpmqryjljygyjl"))
(is (= (candidate "a") "e"))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_90_next_smallest | clj | (defn next_smallest
"You are given a list of integers.
Write a function next_smallest() that returns the 2nd smallest element of the list.
Return nil if there is no such element.
>>> (next_smallest [1 2 3 4 5])
2
>>> (next_smallest [5 1 4 3 2])
2
>>> (next_smallest [])
nil
>>> (next_smallest [1 1])
nil"
[lst]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_90_next_smallest.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate next_smallest)
(deftest test-humaneval
(is (= (candidate [1 2 3 4 5]) 2))
(is (= (candidate [5 1 4 3 2]) 2))
(is (= (candidate []) nil))
(is (= (candidate [1 1]) nil))
(is (= (candidate [1 1 1 1 0]) 1))
(is (= (candidate [1 1]) nil))
(is (= (candidate [-35 34 12 -45]) -35))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_91_is_bored | clj | (defn is_bored
"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:
>>> (is_bored "Hello world")
0
>>> (is_bored "The sky is blue. The sun is shining. I love this weather")
1"
[S]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_91_is_bored.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate is_bored)
(deftest test-humaneval
(is (= (candidate "Hello world") 0))
(is (= (candidate "Is the sky blue?") 0))
(is (= (candidate "I love It !") 1))
(is (= (candidate "bIt") 0))
(is (= (candidate "I feel good today. I will be productive. will kill It") 2))
(is (= (candidate "You and I are going for a walk") 0))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_92_any_int | clj | (defn any_int
"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
>>> (any_int 5 2 7)
true
>>> (any_int 3 2 2)
false
>>> (any_int 3 -2 1)
true
>>> (any_int 3.6 -2.2 2)
false"
[x y z]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_92_any_int.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate any_int)
(deftest test-humaneval
(is (= (candidate 2 3 1) true))
(is (= (candidate 2.5 2 3) false))
(is (= (candidate 1.5 5 3.5) false))
(is (= (candidate 2 6 2) false))
(is (= (candidate 4 2 2) true))
(is (= (candidate 2.2 2.2 2.2) false))
(is (= (candidate -4 6 2) true))
(is (= (candidate 2 1 1) true))
(is (= (candidate 3 4 7) true))
(is (= (candidate 3.0 4 7) false))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_93_encode | clj | (defn encode
"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"
>>> (encode "This is a message")
"tHKS KS C MGSSCGG""
[message]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_93_encode.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate encode)
(deftest test-humaneval
(is (= (candidate "TEST") "tgst"))
(is (= (candidate "Mudasir") "mWDCSKR"))
(is (= (candidate "YES") "ygs"))
(is (= (candidate "This is a message") "tHKS KS C MGSSCGG"))
(is (= (candidate "I DoNt KnOw WhAt tO WrItE") "k dQnT kNqW wHcT Tq wRkTg"))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_94_skjkasdkd | clj | (defn skjkasdkd
"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 109 163 23 2323 32 30 1 9 3])
13
>>> (skjkasdkd [0 724 32 71 99 32 6 0 5 91 83 0 5 6])
11
>>> (skjkasdkd [0 81 12 3 1 21])
3
>>> (skjkasdkd [0 8 1 2 1 7])
7"
[lst]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_94_skjkasdkd.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate skjkasdkd)
(deftest test-humaneval
(is (= (candidate [0 3 2 1 3 5 7 4 5 5 5 2 181 32 4 32 3 2 32 324 4 3]) 10))
(is (= (candidate [1 0 1 8 2 4597 2 1 3 40 1 2 1 2 4 2 5 1]) 25))
(is (= (candidate [1 3 1 32 5107 34 83278 109 163 23 2323 32 30 1 9 3]) 13))
(is (= (candidate [0 724 32 71 99 32 6 0 5 91 83 0 5 6]) 11))
(is (= (candidate [0 81 12 3 1 21]) 3))
(is (= (candidate [0 8 1 2 1 7]) 7))
(is (= (candidate [8191]) 19))
(is (= (candidate [8191 123456 127 7]) 19))
(is (= (candidate [127 97 8192]) 10))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_95_check_dict_case | clj | (defn check_dict_case
"Given a map, return true if all keys are strings in lower
case or all keys are strings in upper case, else return false.
The function should return false is the given map is empty.
Examples:
>>> (check_dict_case {"a" "apple" "b" "banana"})
true
>>> (check_dict_case {"a" "apple" "A" "banana" "B" "banana"})
false
>>> (check_dict_case {"a" "apple" 8 "banana" "a" "apple"})
false
>>> (check_dict_case {"Name" "John" "Age" "36" "City" "Houston"})
false
>>> (check_dict_case {"STATE" "NC" "ZIP" "12345"})
true"
[dict]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_95_check_dict_case.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate check_dict_case)
(deftest test-humaneval
(is (= (candidate {"p" "pineapple" "b" "banana"}) true))
(is (= (candidate {"p" "pineapple" "A" "banana" "B" "banana"}) false))
(is (= (candidate {"p" "pineapple" "5" "banana" "a" "apple"}) false))
(is (= (candidate {"Name" "John" "Age" "36" "City" "Houston"}) false))
(is (= (candidate {"STATE" "NC" "ZIP" "12345"}) true))
(is (= (candidate {"fruit" "Orange" "taste" "Sweet"}) true))
(is (= (candidate {}) false))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_96_count_up_to | clj | (defn count_up_to
"Implement a function that takes an non-negative integer and returns a vector of the first n
integers that are prime numbers and less than n.
for example:
>>> (count_up_to 5)
[2 3]
>>> (count_up_to 11)
[2 3 5 7]
>>> (count_up_to 0)
[]
>>> (count_up_to 20)
[2 3 5 7 11 13 17 19]
>>> (count_up_to 1)
[]
>>> (count_up_to 18)
[2 3 5 7 11 13 17]"
[n]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_96_count_up_to.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate count_up_to)
(deftest test-humaneval
(is (= (candidate 5) [2 3]))
(is (= (candidate 6) [2 3 5]))
(is (= (candidate 7) [2 3 5]))
(is (= (candidate 10) [2 3 5 7]))
(is (= (candidate 0) []))
(is (= (candidate 22) [2 3 5 7 11 13 17 19]))
(is (= (candidate 1) []))
(is (= (candidate 18) [2 3 5 7 11 13 17]))
(is (= (candidate 47) [2 3 5 7 11 13 17 19 23 29 31 37 41 43]))
(is (= (candidate 101) [2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97]))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_97_multiply | clj | (defn multiply
"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"
[a b]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_97_multiply.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate multiply)
(deftest test-humaneval
(is (= (candidate 148 412) 16))
(is (= (candidate 19 28) 72))
(is (= (candidate 2020 1851) 0))
(is (= (candidate 14 -15) 20))
(is (= (candidate 76 67) 42))
(is (= (candidate 17 27) 49))
(is (= (candidate 0 1) 0))
(is (= (candidate 0 0) 0))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_98_count_upper | clj | (defn count_upper
"Given a string s, count the number of uppercase vowels in even indices.
For example:
>>> (count_upper "aBCdEf")
1
>>> (count_upper "abcdefg")
0
>>> (count_upper "dBBE")
0"
[s]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_98_count_upper.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate count_upper)
(deftest test-humaneval
(is (= (candidate "aBCdEf") 1))
(is (= (candidate "abcdefg") 0))
(is (= (candidate "dBBE") 0))
(is (= (candidate "B") 0))
(is (= (candidate "U") 1))
(is (= (candidate "") 0))
(is (= (candidate "EEEE") 2))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_99_closest_integer | clj | (defn closest_integer
"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
>>> (closest_integer "10")
10
>>> (closest_integer "15.3")
15
Note:
Rounding away from zero means that if the given number is equidistant
from two integers, the one you should return is the one that is the
farthest from zero. For example closest_integer("14.5") should
return 15 and closest_integer("-14.5") should return -15."
[value]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_99_closest_integer.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate closest_integer)
(deftest test-humaneval
(is (= (candidate "10") 10))
(is (= (candidate "14.5") 15))
(is (= (candidate "-15.5") -16))
(is (= (candidate "15.3") 15))
(is (= (candidate "0") 0))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_100_make_a_pile | clj | (defn make_a_pile
"Given a positive integer n, you have to make a pile of n levels of stones.
The first level has n stones.
The number of stones in the next level is:
- the next odd number if n is odd.
- the next even number if n is even.
Return the number of stones in each level in a list, where element at index
i represents the number of stones in the level (i+1).
Examples:
>>> (make_a_pile 3)
[3 5 7]"
[n]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_100_make_a_pile.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate make_a_pile)
(deftest test-humaneval
(is (= (candidate 3) [3 5 7]))
(is (= (candidate 4) [4 6 8 10]))
(is (= (candidate 5) [5 7 9 11 13]))
(is (= (candidate 6) [6 8 10 12 14 16]))
(is (= (candidate 8) [8 10 12 14 16 18 20 22]))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_101_words_string | clj | (defn words_string
"You will be given a string of words separated by commas or spaces. Your task is
to split the string into words and return a vector of the words.
For example:
>>> (words_string "Hi, my name is John")
["Hi" "my" "name" "is" "John"]
>>> (words_string "One, two, three, four, five, six")
["One" "two" "three" "four" "five" "six"]"
[s]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_101_words_string.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate words_string)
(deftest test-humaneval
(is (= (candidate "Hi, my name is John") ["Hi" "my" "name" "is" "John"]))
(is (= (candidate "One, two, three, four, five, six") ["One" "two" "three" "four" "five" "six"]))
(is (= (candidate "Hi, my name") ["Hi" "my" "name"]))
(is (= (candidate "One,, two, three, four, five, six,") ["One" "two" "three" "four" "five" "six"]))
(is (= (candidate "") []))
(is (= (candidate "ahmed , gamal") ["ahmed" "gamal"]))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
HumanEval_102_choose_num | clj | (defn choose_num
"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:
>>> (choose_num 12 15)
14
>>> (choose_num 13 12)
-1"
[x y]
| transform | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_102_choose_num.py | reworded | (require '[clojure.test :refer [deftest is run-test]])
(def candidate choose_num)
(deftest test-humaneval
(is (= (candidate 12 15) 14))
(is (= (candidate 13 12) -1))
(is (= (candidate 33 12354) 12354))
(is (= (candidate 5234 5233) -1))
(is (= (candidate 6 29) 28))
(is (= (candidate 27 10) -1))
(is (= (candidate 7 7) -1))
(is (= (candidate 546 546) 546))
)
(run-test test-humaneval) | [
"\n(def",
"\n;",
"\n("
] |
Dataset Card for MultiPL-E
Dataset Summary
MultiPL-E is a dataset for evaluating large language models for code generation that supports 22 programming languages. It takes the OpenAI HumanEval and the Mostly Basic Python Programs (MBPP) benchmarks and uses little compilers to translate them to other languages. It is easy to add support for new languages and benchmarks.
The dataset is divided into several configurations named SRCDATA-LANG, where SRCDATA is either "humaneval" or "mbpp" and LANG is one of the supported languages. We use the canonical file extension for each language to identify the language, e.g., "cpp" for C++, "lua" for Lua, "clj" for Clojure, and so on.
Using MultiPL-E
MultiPL-E is part of the BigCode Code Generation LM Harness. This is the easiest way to use MultiPL-E.
MultiPL-E has its own evaluation framework that supports proprietary models, the prompt ablations, more source benchmarks, and more recently added programming languages. See the MultiPL-E tutorial on how to use this framework directly.
The MultiPL-E Ablations
The MultiPL-E paper presented several ablations of the prompt for the original
set of programming languages. We do not include them in the current version of
MultiPL-E, but they are still available in this repository from revision
d23b094
or earlier. (You can optionally pass the revision to
datasets.load_dataset
.)
These are the prompt variations:
SRCDATA-LANG-keep is the same as SRCDATA-LANG, but the text of the prompt is totally unchanged. If the original prompt had Python doctests, they remain as Python instead of being translated to LANG. If the original prompt had Python-specific terminology, e.g., "list", it remains "list", instead of being translated, e.g., to "vector" for C++.
SRCDATA-LANG-transform transforms the doctests to LANG but leaves the natural language text of the prompt unchanged.
SRCDATA-LANG-removed removes the doctests from the prompt.
Note that MBPP does not have any doctests, so the "removed" and "transform" variations are not available for MBPP.
Changelog
Version 3.1.1
This version fixes a bug that affected some TypeScript problems, thanks to Niels Mündler . The issue impacts MBPP-based problems. The fix changes whitespace in a few HumanEval-based problems that should be insignificant. These are the relevant changes:
=== mbpp-ts_prompt_mbpp_253_count_integer.diff ===
- function count_integer(list1: number| string| number[]): number {
+ function count_integer(list1: (number | string | number)[]): number {
=== mbpp-ts_prompt_mbpp_278_count_first_elements.diff ===
- function count_first_elements(test_tup: number| [number, number][]): number {
+ function count_first_elements(test_tup: (number | [number, number])[]): number {
=== mbpp-ts_prompt_mbpp_294_max_val.diff ===
- function max_val(listval: string| number[]): number {
+ function max_val(listval: (string | number)[]): number {
=== mbpp-ts_prompt_mbpp_297_flatten_list.diff ===
- function flatten_list(list1: number| number[][]): number[] {
+ function flatten_list(list1: (number | number[])[]): number[] {
=== mbpp-ts_prompt_mbpp_405_check_tuplex.diff ===
- function check_tuplex(tuplex: string| number[], tuple1: any): boolean {
+ function check_tuplex(tuplex: (string | number)[], tuple1: any): boolean {
=== mbpp-ts_prompt_mbpp_410_min_val.diff ===
- function min_val(listval: string| number[]): number {
+ function min_val(listval: (string | number)[]): number {
=== mbpp-ts_prompt_mbpp_419_round_and_sum.diff ===
- function round_and_sum(list1: number| number[]): number {
+ function round_and_sum(list1: (number | number)[]): number {
=== mbpp-ts_prompt_mbpp_65_recursive_list_sum.diff ===
- function recursive_list_sum(data_list: number| number[][]): number {
+ function recursive_list_sum(data_list: (number | number[])[]): number {
=== mbpp-ts_prompt_mbpp_755_second_smallest.diff ===
- function second_smallest(numbers: number| number[]): number | undefined {
+ function second_smallest(numbers: (number | number)[]): number | undefined {
See Github Issue 160 for more information.
Version 3.1
MultiPL-E now supports Dart, thanks to Devon Carew.
Version 3.0
This is the first significant update since MultiPL-E was used in StarCoder 1.
- We no longer publish the MultiPL-E ablations, but they are available in
revision
d23b094
and earlier. - New programming languages supported:
- Clojure, thanks to Alex Miller
- Elixir, thanks to Marko Vukovic
- Haskell, thanks to Thomas Dwyer
- OCaml, thanks to John Gouwar
- Changes to existing HumanEval-based problems:
- Four Scala problems have fixed prompts/tests (12, 90, 128, 162).
- Some whitespace-only changes to problems for Racket (18 problems), R (36 problems), Julia (159 problems), and D (156 problems). We will try to avoid these kinds of changes in the future.
- The MBPP-based problems have changes analogous to the HumanEval-based problems.
See the directory diffs_v3.0
in the dataset repository for the diffs to
each prompt.
- Downloads last month
- 649,362