stop_tokens
sequencelengths 4
4
| prompt
stringlengths 91
795
| prompt_terminology
stringclasses 1
value | doctests
stringclasses 1
value | name
stringlengths 15
44
| tests
stringlengths 181
1.94k
| original
stringlengths 130
159
| language
stringclasses 1
value |
|---|---|---|---|---|---|---|---|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; リストnumbersの中に、与えられたthresholdより近い2つの数値が存在するか判定する
;; >>> (has_close_elements (list 1.0 2.0 3.0) 0.5)
;; #f
;; >>> (has_close_elements (list 1.0 2.8 3.0 4.0 5.0 2.0) 0.3)
;; #t
(define (has_close_elements numbers threshold)
|
reworded
|
transform
|
HumanEval_0_has_close_elements
|
(require rackunit)
(define (test-humaneval)
(let (( candidate has_close_elements))
(check-within (candidate (list 1.0 2.0 3.9 4.0 5.0 2.2) 0.3) #t 0.001)
(check-within (candidate (list 1.0 2.0 3.9 4.0 5.0 2.2) 0.05) #f 0.001)
(check-within (candidate (list 1.0 2.0 5.9 4.0 5.0) 0.95) #t 0.001)
(check-within (candidate (list 1.0 2.0 5.9 4.0 5.0) 0.8) #f 0.001)
(check-within (candidate (list 1.0 2.0 3.0 4.0 5.0 2.0) 0.1) #t 0.001)
(check-within (candidate (list 1.1 2.2 3.1 4.1 5.1) 1.0) #t 0.001)
(check-within (candidate (list 1.1 2.2 3.1 4.1 5.1) 0.5) #f 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_0_has_close_elements.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; この関数への入力は、入れ子になった括弧が複数含まれる文字列である。
;; あなたの目的は、これらの括弧を別々の文字列に分割し、そのリストを返すことである。
;; 分離された括弧はバランスがとれ、つまり、開いた括弧はそれぞれ適切に閉じられていて、
;; 互いに入れ子になっていない。引数の文字列内の空白は無視せよ。
;; >>> (separate_paren_groups "( ) (( )) (( )( ))")
;; (list "()" "(())" "(()())")
(define (separate_paren_groups paren_string)
|
reworded
|
transform
|
HumanEval_1_separate_paren_groups
|
(require rackunit)
(define (test-humaneval)
(let (( candidate separate_paren_groups))
(check-within (candidate "(()()) ((())) () ((())()())") (list "(()())" "((()))" "()" "((())()())") 0.001)
(check-within (candidate "() (()) ((())) (((())))") (list "()" "(())" "((()))" "(((())))") 0.001)
(check-within (candidate "(()(())((())))") (list "(()(())((())))") 0.001)
(check-within (candidate "( ) (( )) (( )( ))") (list "()" "(())" "(()())") 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_1_separate_paren_groups.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 正の浮動小数点数が与えられると、それを整数部(与えられた数より小さい最大の整数)
;; と小数部(常に1より小さい残余部分)に分解することができる。
;; 関数は、数値の小数部を返す。
;; >>> (truncate_number 3.5)
;; 0.5
(define (truncate_number number)
|
reworded
|
transform
|
HumanEval_2_truncate_number
|
(require rackunit)
(define (test-humaneval)
(let (( candidate truncate_number))
(check-within (candidate 3.5) 0.5 0.001)
(check-within (candidate 1.25) 0.25 0.001)
(check-within (candidate 123.0) 0.0 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_2_truncate_number.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 銀行口座に対する入出金操作のリストが与えられます。あなたのタスクは、残高ゼロから
;; 始まて、口座の残高がゼロ未満になったかどうかを検出し、その時点で関数が#tを
;; 返すようにすることです。そうでなければ#fを返すようにしてください。
;; >>> (below_zero (list 1 2 3))
;; #f
;; >>> (below_zero (list 1 2 -4 5))
;; #t
(define (below_zero operations)
|
reworded
|
transform
|
HumanEval_3_below_zero
|
(require rackunit)
(define (test-humaneval)
(let (( candidate below_zero))
(check-within (candidate (list )) #f 0.001)
(check-within (candidate (list 1 2 -3 1 2 -3)) #f 0.001)
(check-within (candidate (list 1 2 -4 5 6)) #t 0.001)
(check-within (candidate (list 1 -1 2 -2 5 -5 4 -4)) #f 0.001)
(check-within (candidate (list 1 -1 2 -2 5 -5 4 -5)) #t 0.001)
(check-within (candidate (list 1 -2 2 -2 5 -5 4 -4)) #t 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_3_below_zero.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 第一引数の数値リストに対して、このデータセットの平均値を中心とした平均絶対偏差(MAD)を計算する。
;; 平均絶対偏差(MAD)とは、各要素と中心点(この場合は平均値)との差の絶対値の平均である:
;; MAD = 平均|x - x_mean|
;; >>> (mean_absolute_deviation (list 1.0 2.0 3.0 4.0))
;; 1.0
(define (mean_absolute_deviation numbers)
|
reworded
|
transform
|
HumanEval_4_mean_absolute_deviation
|
(require rackunit)
(define (test-humaneval)
(let (( candidate mean_absolute_deviation))
(check-within (candidate (list 1.0 2.0)) 0.5 0.001)
(check-within (candidate (list 1.0 2.0 3.0 4.0)) 1.0 0.001)
(check-within (candidate (list 1.0 2.0 3.0 4.0 5.0)) 1.2 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_4_mean_absolute_deviation.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 数値リスト numbers 中の全ての連続する二要素の間に、'delimeterの値を挿入する
;; >>> (intersperse (list ) 4)
;; (list )
;; >>> (intersperse (list 1 2 3) 4)
;; (list 1 4 2 4 3)
(define (intersperse numbers delimeter)
|
reworded
|
transform
|
HumanEval_5_intersperse
|
(require rackunit)
(define (test-humaneval)
(let (( candidate intersperse))
(check-within (candidate (list ) 7) (list ) 0.001)
(check-within (candidate (list 5 6 3 2) 8) (list 5 8 6 8 3 8 2) 0.001)
(check-within (candidate (list 2 2 2) 2) (list 2 2 2 2 2) 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_5_intersperse.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; この関数の入力は、空白で区切られた複数の入れ子になった括弧のグループを表す文字列です。
;; 各グループについて、括弧の最も深い入れ子のレベルを出力します。
;; 例えば、'(()())'は最大で2レベルの入れ子になっていますが、'((()))'は3レベルです。
;; >>> (parse_nested_parens "(()()) ((())) () ((())()())")
;; (list 2 3 1 3)
(define (parse_nested_parens paren_string)
|
reworded
|
transform
|
HumanEval_6_parse_nested_parens
|
(require rackunit)
(define (test-humaneval)
(let (( candidate parse_nested_parens))
(check-within (candidate "(()()) ((())) () ((())()())") (list 2 3 1 3) 0.001)
(check-within (candidate "() (()) ((())) (((())))") (list 1 2 3 4) 0.001)
(check-within (candidate "(()(())((())))") (list 4) 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_6_parse_nested_parens.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 文字列リストstringsを、与えれた部分文字列substringを含むものだけにフィルタする
;; >>> (filter_by_substring (list ) "a")
;; (list )
;; >>> (filter_by_substring (list "abc" "bacd" "cde" "array") "a")
;; (list "abc" "bacd" "array")
(define (filter_by_substring strings substring)
|
reworded
|
transform
|
HumanEval_7_filter_by_substring
|
(require rackunit)
(define (test-humaneval)
(let (( candidate filter_by_substring))
(check-within (candidate (list ) "john") (list ) 0.001)
(check-within (candidate (list "xxx" "asd" "xxy" "john doe" "xxxAAA" "xxx") "xxx") (list "xxx" "xxxAAA" "xxx") 0.001)
(check-within (candidate (list "xxx" "asd" "aaaxxy" "john doe" "xxxAAA" "xxx") "xx") (list "xxx" "aaaxxy" "xxxAAA" "xxx") 0.001)
(check-within (candidate (list "grunt" "trumpet" "prune" "gruesome") "run") (list "grunt" "prune") 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_7_filter_by_substring.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 与えられた整数リストに対して、リスト内のすべての整数の和と積からなるタプルを返す。
;; ただし、空の和は0、空の積は1とする。
;; >>> (sum_product (list ))
;; (list 0 1)
;; >>> (sum_product (list 1 2 3 4))
;; (list 10 24)
(define (sum_product numbers)
|
reworded
|
transform
|
HumanEval_8_sum_product
|
(require rackunit)
(define (test-humaneval)
(let (( candidate sum_product))
(check-within (candidate (list )) (list 0 1) 0.001)
(check-within (candidate (list 1 1 1)) (list 3 1) 0.001)
(check-within (candidate (list 100 0)) (list 100 0) 0.001)
(check-within (candidate (list 3 5 7)) (list 15 105) 0.001)
(check-within (candidate (list 10)) (list 10 10) 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_8_sum_product.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 与えられた整数リストから、各要素のそこまでの最大値(ローリング最大値)のリストを生成する。
;; >>> (rolling_max (list 1 2 3 2 3 4 2))
;; (list 1 2 3 3 3 4 4)
(define (rolling_max numbers)
|
reworded
|
transform
|
HumanEval_9_rolling_max
|
(require rackunit)
(define (test-humaneval)
(let (( candidate rolling_max))
(check-within (candidate (list )) (list ) 0.001)
(check-within (candidate (list 1 2 3 4)) (list 1 2 3 4) 0.001)
(check-within (candidate (list 4 3 2 1)) (list 4 4 4 4) 0.001)
(check-within (candidate (list 3 2 3 100 3)) (list 3 3 3 100 100) 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_9_rolling_max.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 与えられた文字列で始まる最短の回文を見つけてください。
;; アルゴリズムのアイデアは以下の通りです:
;; - 与えられた文字列の中で最も長い回文となる接尾辞を見つけます。
;; - その回文の接尾辞の前に来る接頭辞を逆順にして、文字列の末尾に追加します。
;; >>> (make_palindrome "")
;; ""
;; >>> (make_palindrome "cat")
;; "catac"
;; >>> (make_palindrome "cata")
;; "catac"
(define (make_palindrome string)
|
reworded
|
transform
|
HumanEval_10_make_palindrome
|
(require rackunit)
(define (test-humaneval)
(let (( candidate make_palindrome))
(check-within (candidate "") "" 0.001)
(check-within (candidate "x") "x" 0.001)
(check-within (candidate "xyz") "xyzyx" 0.001)
(check-within (candidate "xyx") "xyx" 0.001)
(check-within (candidate "jerry") "jerryrrej" 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_10_make_palindrome.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 引数は1と0のみからなる文字列aとbである。
;; これらの引数に対して排他論理和(XOR)を実行し、結果を文字列として返す。
;; >>> (string_xor "010" "110")
;; "100"
(define (string_xor a b)
|
reworded
|
transform
|
HumanEval_11_string_xor
|
(require rackunit)
(define (test-humaneval)
(let (( candidate string_xor))
(check-within (candidate "111000" "101010") "010010" 0.001)
(check-within (candidate "1" "1") "0" 0.001)
(check-within (candidate "0101" "0000") "0101" 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_11_string_xor.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 文字列のリストのうち、最も長いものを返す。同じ長さの文字列が
;; 複数ある場合は最初のものを返す。入力リストが空の場合は #f を返す。
;; >>> (longest (list ))
;; #f
;; >>> (longest (list "a" "b" "c"))
;; "a"
;; >>> (longest (list "a" "bb" "ccc"))
;; "ccc"
(define (longest strings)
|
reworded
|
transform
|
HumanEval_12_longest
|
(require rackunit)
(define (test-humaneval)
(let (( candidate longest))
(check-within (candidate (list )) #f 0.001)
(check-within (candidate (list "x" "y" "z")) "x" 0.001)
(check-within (candidate (list "x" "yyy" "zzzz" "www" "kkkk" "abc")) "zzzz" 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_12_longest.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 整数 a と b の最大公約数を返す
;; >>> (greatest_common_divisor 3 5)
;; 1
;; >>> (greatest_common_divisor 25 15)
;; 5
(define (greatest_common_divisor a b)
|
reworded
|
transform
|
HumanEval_13_greatest_common_divisor
|
(require rackunit)
(define (test-humaneval)
(let (( candidate greatest_common_divisor))
(check-within (candidate 3 7) 1 0.001)
(check-within (candidate 10 15) 5 0.001)
(check-within (candidate 49 14) 7 0.001)
(check-within (candidate 144 60) 12 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_13_greatest_common_divisor.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 引数で与えられた文字列に対して、短いものから長いものへ、全ての接頭辞のリストを返す
;; >>> (all_prefixes "abc")
;; (list "a" "ab" "abc")
(define (all_prefixes string)
|
reworded
|
transform
|
HumanEval_14_all_prefixes
|
(require rackunit)
(define (test-humaneval)
(let (( candidate all_prefixes))
(check-within (candidate "") (list ) 0.001)
(check-within (candidate "asdfgh") (list "a" "as" "asd" "asdf" "asdfg" "asdfgh") 0.001)
(check-within (candidate "WWW") (list "W" "WW" "WWW") 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_14_all_prefixes.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 0からnまでの数字を空白区切りで連結した文字列で返す。
;; >>> (string_sequence 0)
;; "0"
;; >>> (string_sequence 5)
;; "0 1 2 3 4 5"
(define (string_sequence n)
|
reworded
|
transform
|
HumanEval_15_string_sequence
|
(require rackunit)
(define (test-humaneval)
(let (( candidate string_sequence))
(check-within (candidate 0) "0" 0.001)
(check-within (candidate 3) "0 1 2 3" 0.001)
(check-within (candidate 10) "0 1 2 3 4 5 6 7 8 9 10" 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_15_string_sequence.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 文字列が与えられたとき、その文字列が(大文字小文字に関係なく)いくつの異なる文字が含まれているか数える
;; >>> (count_distinct_characters "xyzXYZ")
;; 3
;; >>> (count_distinct_characters "Jerry")
;; 4
(define (count_distinct_characters string)
|
reworded
|
transform
|
HumanEval_16_count_distinct_characters
|
(require rackunit)
(define (test-humaneval)
(let (( candidate count_distinct_characters))
(check-within (candidate "") 0 0.001)
(check-within (candidate "abcde") 5 0.001)
(check-within (candidate "abcdecadeCADE") 5 0.001)
(check-within (candidate "aaaaAAAAaaaa") 1 0.001)
(check-within (candidate "Jerry jERRY JeRRRY") 5 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_16_count_distinct_characters.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; この関数の引数は、特別なASCII形式の音符を表す文字列である。あなたの仕事は、この文字列を解析して、それぞれの音符が何拍続くかに対応する整数のリストを返すことである。
;; ここに凡例がある:
;; o' - 全音符、4拍続く
;; o|' - 2分音符、2拍続く
;; .|」-4分音符、1拍続く
;; >>> (parse_music "o o| .| o| o| .| .| .| .| o o")
;; (list 4 2 1 2 2 1 1 1 1 4 4)
(define (parse_music music_string)
|
reworded
|
transform
|
HumanEval_17_parse_music
|
(require rackunit)
(define (test-humaneval)
(let (( candidate parse_music))
(check-within (candidate "") (list ) 0.001)
(check-within (candidate "o o o o") (list 4 4 4 4) 0.001)
(check-within (candidate ".| .| .| .|") (list 1 1 1 1) 0.001)
(check-within (candidate "o| o| .| .| o o o o") (list 2 2 1 1 4 4 4 4) 0.001)
(check-within (candidate "o| .| o| .| o o| o o|") (list 2 1 2 1 4 2 4 2) 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_17_parse_music.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 部分文字列substringが文字列stringの中で何回見つかるか数える。
;; 重なるケースもカウントに含まれる。
;; >>> (how_many_times "" "a")
;; 0
;; >>> (how_many_times "aaa" "a")
;; 3
;; >>> (how_many_times "aaaa" "aa")
;; 3
(define (how_many_times string substring)
|
reworded
|
transform
|
HumanEval_18_how_many_times
|
(require rackunit)
(define (test-humaneval)
(let (( candidate how_many_times))
(check-within (candidate "" "x") 0 0.001)
(check-within (candidate "xyxyxyx" "x") 4 0.001)
(check-within (candidate "cacacacac" "cac") 4 0.001)
(check-within (candidate "john doe" "john") 1 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_18_how_many_times.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 引数は'zero'から'nine'までの英単語の数を空白で区切った文字列である。
;; 有効な英単語は''、'zero', 'one'、'two'、'three'、'four'、'five'、'six'、'seven'、'eight'、'nine'である。
;; 関数は、英単語の数を小さい方から大きい方へとソートした文字列を返す。
;; >>> (sort_numbers "three one five")
;; "one three five"
(define (sort_numbers numbers)
|
reworded
|
transform
|
HumanEval_19_sort_numbers
|
(require rackunit)
(define (test-humaneval)
(let (( candidate sort_numbers))
(check-within (candidate "") "" 0.001)
(check-within (candidate "three") "three" 0.001)
(check-within (candidate "three five nine") "three five nine" 0.001)
(check-within (candidate "five zero four seven nine eight") "zero four five seven eight nine" 0.001)
(check-within (candidate "six five four three two one zero") "zero one two three four five six" 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_19_sort_numbers.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; (少なくとも長さ2以上の)リストnumbersから、互いに最も近いものを2つ選び、
;; 順番に(小さい数、大きい数)返す。
;; >>> (find_closest_elements (list 1.0 2.0 3.0 4.0 5.0 2.2))
;; (list 2.0 2.2)
;; >>> (find_closest_elements (list 1.0 2.0 3.0 4.0 5.0 2.0))
;; (list 2.0 2.0)
(define (find_closest_elements numbers)
|
reworded
|
transform
|
HumanEval_20_find_closest_elements
|
(require rackunit)
(define (test-humaneval)
(let (( candidate find_closest_elements))
(check-within (candidate (list 1.0 2.0 3.9 4.0 5.0 2.2)) (list 3.9 4.0) 0.001)
(check-within (candidate (list 1.0 2.0 5.9 4.0 5.0)) (list 5.0 5.9) 0.001)
(check-within (candidate (list 1.0 2.0 3.0 4.0 5.0 2.2)) (list 2.0 2.2) 0.001)
(check-within (candidate (list 1.0 2.0 3.0 4.0 5.0 2.0)) (list 2.0 2.0) 0.001)
(check-within (candidate (list 1.1 2.2 3.1 4.1 5.1)) (list 2.2 3.1) 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_20_find_closest_elements.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; (少なくとも 2 つ以上の要素からなる) リストnumbersに線形変換を適用し、
;; 最小の数値が 0 になり、最大の数値が 1 になるリストを返す
;; >>> (rescale_to_unit (list 1.0 2.0 3.0 4.0 5.0))
;; (list 0.0 0.25 0.5 0.75 1.0)
(define (rescale_to_unit numbers)
|
reworded
|
transform
|
HumanEval_21_rescale_to_unit
|
(require rackunit)
(define (test-humaneval)
(let (( candidate rescale_to_unit))
(check-within (candidate (list 2.0 49.9)) (list 0.0 1.0) 0.001)
(check-within (candidate (list 100.0 49.9)) (list 1.0 0.0) 0.001)
(check-within (candidate (list 1.0 2.0 3.0 4.0 5.0)) (list 0.0 0.25 0.5 0.75 1.0) 0.001)
(check-within (candidate (list 2.0 1.0 5.0 3.0 4.0)) (list 0.25 0.0 1.0 0.5 0.75) 0.001)
(check-within (candidate (list 12.0 11.0 15.0 13.0 14.0)) (list 0.25 0.0 1.0 0.5 0.75) 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_21_rescale_to_unit.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 任意の種類の値が含まれるリストから整数値のみ抽出する
;; >>> (filter_integers (list "a" 3.14 5))
;; (list 5)
;; >>> (filter_integers (list 1 2 3 "abc" #hash() (list )))
;; (list 1 2 3)
(define (filter_integers values)
|
reworded
|
transform
|
HumanEval_22_filter_integers
|
(require rackunit)
(define (test-humaneval)
(let (( candidate filter_integers))
(check-within (candidate (list )) (list ) 0.001)
(check-within (candidate (list 4 #hash() (list ) 23.2 9 "adasd")) (list 4 9) 0.001)
(check-within (candidate (list 3 "c" 3 3 "a" "b")) (list 3 3 3) 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_22_filter_integers.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 引数で与えられた文字列の長さを返す
;; >>> (strlen "")
;; 0
;; >>> (strlen "abc")
;; 3
(define (strlen string)
|
reworded
|
transform
|
HumanEval_23_strlen
|
(require rackunit)
(define (test-humaneval)
(let (( candidate strlen))
(check-within (candidate "") 0 0.001)
(check-within (candidate "x") 1 0.001)
(check-within (candidate "asdasnakj") 9 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_23_strlen.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 与えられた数nについて、nの約数のうち、nより小さい最大の数を求める
;; >>> (largest_divisor 15)
;; 5
(define (largest_divisor n)
|
reworded
|
transform
|
HumanEval_24_largest_divisor
|
(require rackunit)
(define (test-humaneval)
(let (( candidate largest_divisor))
(check-within (candidate 3) 1 0.001)
(check-within (candidate 7) 1 0.001)
(check-within (candidate 10) 5 0.001)
(check-within (candidate 100) 50 0.001)
(check-within (candidate 49) 7 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_24_largest_divisor.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 与えられた整数の素因数のリストを小さいものから大きいものの順に返す。各因数は、
;; 因数分解で現れる回数分、リストに登場する。引数の整数は全ての因数の積に等しくな
;; ければならない。
;; >>> (factorize 8)
;; (list 2 2 2)
;; >>> (factorize 25)
;; (list 5 5)
;; >>> (factorize 70)
;; (list 2 5 7)
(define (factorize n)
|
reworded
|
transform
|
HumanEval_25_factorize
|
(require rackunit)
(define (test-humaneval)
(let (( candidate factorize))
(check-within (candidate 2) (list 2) 0.001)
(check-within (candidate 4) (list 2 2) 0.001)
(check-within (candidate 8) (list 2 2 2) 0.001)
(check-within (candidate 57) (list 3 19) 0.001)
(check-within (candidate 3249) (list 3 3 19 19) 0.001)
(check-within (candidate 185193) (list 3 3 3 19 19 19) 0.001)
(check-within (candidate 20577) (list 3 19 19 19) 0.001)
(check-within (candidate 18) (list 2 3 3) 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_25_factorize.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 整数のリストから、複数回出現する要素をすべて取り除く。
;; 要素の順序は入力と同じようにする。
;; >>> (remove_duplicates (list 1 2 3 2 4))
;; (list 1 3 4)
(define (remove_duplicates numbers)
|
reworded
|
transform
|
HumanEval_26_remove_duplicates
|
(require rackunit)
(define (test-humaneval)
(let (( candidate remove_duplicates))
(check-within (candidate (list )) (list ) 0.001)
(check-within (candidate (list 1 2 3 4)) (list 1 2 3 4) 0.001)
(check-within (candidate (list 1 2 3 2 4 3 5)) (list 1 4 5) 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_26_remove_duplicates.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 与えられた文字列に対して、英小文字を英大文字に、英大文字を英小文字に変換する。
;; >>> (flip_case "Hello")
;; "hELLO"
(define (flip_case string)
|
reworded
|
transform
|
HumanEval_27_flip_case
|
(require rackunit)
(define (test-humaneval)
(let (( candidate flip_case))
(check-within (candidate "") "" 0.001)
(check-within (candidate "Hello!") "hELLO!" 0.001)
(check-within (candidate "These violent delights have violent ends") "tHESE VIOLENT DELIGHTS HAVE VIOLENT ENDS" 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_27_flip_case.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 文字列のリストを1つの文字列に連結する
;; >>> (concatenate (list ))
;; ""
;; >>> (concatenate (list "a" "b" "c"))
;; "abc"
(define (concatenate strings)
|
reworded
|
transform
|
HumanEval_28_concatenate
|
(require rackunit)
(define (test-humaneval)
(let (( candidate concatenate))
(check-within (candidate (list )) "" 0.001)
(check-within (candidate (list "x" "y" "z")) "xyz" 0.001)
(check-within (candidate (list "x" "y" "z" "w" "k")) "xyzwk" 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_28_concatenate.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 文字列のリストから、指定された接頭辞prefixで始まるものだけを取り出す。
;; >>> (filter_by_prefix (list ) "a")
;; (list )
;; >>> (filter_by_prefix (list "abc" "bcd" "cde" "array") "a")
;; (list "abc" "array")
(define (filter_by_prefix strings prefix)
|
reworded
|
transform
|
HumanEval_29_filter_by_prefix
|
(require rackunit)
(define (test-humaneval)
(let (( candidate filter_by_prefix))
(check-within (candidate (list ) "john") (list ) 0.001)
(check-within (candidate (list "xxx" "asd" "xxy" "john doe" "xxxAAA" "xxx") "xxx") (list "xxx" "xxxAAA" "xxx") 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_29_filter_by_prefix.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; リスト内の正の数だけを返す。
;; >>> (get_positive (list -1 2 -4 5 6))
;; (list 2 5 6)
;; >>> (get_positive (list 5 3 -5 2 -3 3 9 0 123 1 -10))
;; (list 5 3 2 3 9 123 1)
(define (get_positive l)
|
reworded
|
transform
|
HumanEval_30_get_positive
|
(require rackunit)
(define (test-humaneval)
(let (( candidate get_positive))
(check-within (candidate (list -1 -2 4 5 6)) (list 4 5 6) 0.001)
(check-within (candidate (list 5 3 -5 2 3 3 9 0 123 1 -10)) (list 5 3 2 3 3 9 123 1) 0.001)
(check-within (candidate (list -1 -2)) (list ) 0.001)
(check-within (candidate (list )) (list ) 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_30_get_positive.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 与えられた数が素数であれば真を、そうでなければ偽を返す。
;; >>> (is_prime 6)
;; #f
;; >>> (is_prime 101)
;; #t
;; >>> (is_prime 11)
;; #t
;; >>> (is_prime 13441)
;; #t
;; >>> (is_prime 61)
;; #t
;; >>> (is_prime 4)
;; #f
;; >>> (is_prime 1)
;; #f
(define (is_prime n)
|
reworded
|
transform
|
HumanEval_31_is_prime
|
(require rackunit)
(define (test-humaneval)
(let (( candidate is_prime))
(check-within (candidate 6) #f 0.001)
(check-within (candidate 101) #t 0.001)
(check-within (candidate 11) #t 0.001)
(check-within (candidate 13441) #t 0.001)
(check-within (candidate 61) #t 0.001)
(check-within (candidate 4) #f 0.001)
(check-within (candidate 1) #f 0.001)
(check-within (candidate 5) #t 0.001)
(check-within (candidate 11) #t 0.001)
(check-within (candidate 17) #t 0.001)
(check-within (candidate 85) #f 0.001)
(check-within (candidate 77) #f 0.001)
(check-within (candidate 255379) #f 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_31_is_prime.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; この関数はリストlを受け取り、l'を返す。l'は、インデックスが3で割り
;; 切れない場合はlと同じであるが、インデックスが3で割り切れる要素は
;; ソートされている。
;; >>> (sort_third (list 1 2 3))
;; (list 1 2 3)
;; >>> (sort_third (list 5 6 3 4 8 9 2))
;; (list 2 6 3 4 8 9 5)
(define (sort_third l)
|
reworded
|
transform
|
HumanEval_33_sort_third
|
(require rackunit)
(define (test-humaneval)
(let (( candidate sort_third))
(check-within (candidate (list 5 6 3 4 8 9 2)) (list 2 6 3 4 8 9 5) 0.001)
(check-within (candidate (list 5 8 3 4 6 9 2)) (list 2 8 3 4 6 9 5) 0.001)
(check-within (candidate (list 5 6 9 4 8 3 2)) (list 2 6 9 4 8 3 5) 0.001)
(check-within (candidate (list 5 6 3 4 8 9 2 1)) (list 2 6 3 4 8 9 5 1) 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_33_sort_third.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; リスト内のユニークな要素をソートして返す
;; >>> (unique (list 5 3 5 2 3 3 9 0 123))
;; (list 0 2 3 5 9 123)
(define (unique l)
|
reworded
|
transform
|
HumanEval_34_unique
|
(require rackunit)
(define (test-humaneval)
(let (( candidate unique))
(check-within (candidate (list 5 3 5 2 3 3 9 0 123)) (list 0 2 3 5 9 123) 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_34_unique.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; リスト内の最大要素を返す。
;; >>> (max_element (list 1 2 3))
;; 3
;; >>> (max_element (list 5 3 -5 2 -3 3 9 0 123 1 -10))
;; 123
(define (max_element l)
|
reworded
|
transform
|
HumanEval_35_max_element
|
(require rackunit)
(define (test-humaneval)
(let (( candidate max_element))
(check-within (candidate (list 1 2 3)) 3 0.001)
(check-within (candidate (list 5 3 -5 2 -3 3 9 0 124 1 -10)) 124 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_35_max_element.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 与えられたn未満の整数の中で、11または13で割り切れる数の中に'7'という数字が何回現れるかを返す
;; >>> (fizz_buzz 50)
;; 0
;; >>> (fizz_buzz 78)
;; 2
;; >>> (fizz_buzz 79)
;; 3
(define (fizz_buzz n)
|
reworded
|
transform
|
HumanEval_36_fizz_buzz
|
(require rackunit)
(define (test-humaneval)
(let (( candidate fizz_buzz))
(check-within (candidate 50) 0 0.001)
(check-within (candidate 78) 2 0.001)
(check-within (candidate 79) 3 0.001)
(check-within (candidate 100) 3 0.001)
(check-within (candidate 200) 6 0.001)
(check-within (candidate 4000) 192 0.001)
(check-within (candidate 10000) 639 0.001)
(check-within (candidate 100000) 8026 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_36_fizz_buzz.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; この関数はリスト l を受け取り、l' を返す。l'は、インデックスが奇数の
;; ときは l と同じで、インデックスが偶数のときはソートされている。
;; >>> (sort_even (list 1 2 3))
;; (list 1 2 3)
;; >>> (sort_even (list 5 6 3 4))
;; (list 3 6 5 4)
(define (sort_even l)
|
reworded
|
transform
|
HumanEval_37_sort_even
|
(require rackunit)
(define (test-humaneval)
(let (( candidate sort_even))
(check-within (candidate (list 1 2 3)) (list 1 2 3) 0.001)
(check-within (candidate (list 5 3 -5 2 -3 3 9 0 123 1 -10)) (list -10 3 -5 2 -3 3 5 0 9 1 123) 0.001)
(check-within (candidate (list 5 8 -12 4 23 2 3 11 12 -10)) (list -12 8 3 4 5 2 12 11 23 -10) 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_37_sort_even.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; prime_fib はフィボナッチ数で、かつ素数であるn番目の数を返す。
;; >>> (prime_fib 1)
;; 2
;; >>> (prime_fib 2)
;; 3
;; >>> (prime_fib 3)
;; 5
;; >>> (prime_fib 4)
;; 13
;; >>> (prime_fib 5)
;; 89
(define (prime_fib n)
|
reworded
|
transform
|
HumanEval_39_prime_fib
|
(require rackunit)
(define (test-humaneval)
(let (( candidate prime_fib))
(check-within (candidate 1) 2 0.001)
(check-within (candidate 2) 3 0.001)
(check-within (candidate 3) 5 0.001)
(check-within (candidate 4) 13 0.001)
(check-within (candidate 5) 89 0.001)
(check-within (candidate 6) 233 0.001)
(check-within (candidate 7) 1597 0.001)
(check-within (candidate 8) 28657 0.001)
(check-within (candidate 9) 514229 0.001)
(check-within (candidate 10) 433494437 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_39_prime_fib.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; triples_sum_to_zero は整数のリストを引数に取り、
;; リストの中に和が0になる3つの要素があれば#tを、
;; そうでなければ#fを返す。
;; >>> (triples_sum_to_zero (list 1 3 5 0))
;; #f
;; >>> (triples_sum_to_zero (list 1 3 -2 1))
;; #t
;; >>> (triples_sum_to_zero (list 1 2 3 7))
;; #f
;; >>> (triples_sum_to_zero (list 2 4 -5 3 9 7))
;; #t
;; >>> (triples_sum_to_zero (list 1))
;; #f
(define (triples_sum_to_zero l)
|
reworded
|
transform
|
HumanEval_40_triples_sum_to_zero
|
(require rackunit)
(define (test-humaneval)
(let (( candidate triples_sum_to_zero))
(check-within (candidate (list 1 3 5 0)) #f 0.001)
(check-within (candidate (list 1 3 5 -1)) #f 0.001)
(check-within (candidate (list 1 3 -2 1)) #t 0.001)
(check-within (candidate (list 1 2 3 7)) #f 0.001)
(check-within (candidate (list 1 2 5 7)) #f 0.001)
(check-within (candidate (list 2 4 -5 3 9 7)) #t 0.001)
(check-within (candidate (list 1)) #f 0.001)
(check-within (candidate (list 1 3 5 -100)) #f 0.001)
(check-within (candidate (list 100 3 5 -100)) #f 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_40_triples_sum_to_zero.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; ;; 完全な直線で無限に長い道路を想像してほしい。
;; n台の車が左から右に向かって走っている。同時に、別のn台の車が
;; 右から左に向かって走っている。この2組の車は、最初は互いに非
;; 常に離れている。すべての車は同じ速度で動く。2台の車は次のよ
;; うに衝突する。左から右に動いている車が、右から左に動いている
;; 車にぶつかること。
;; しかし、車は限りなく頑丈で強い。あたかも衝突しなかったかのよ
;; うに、その軌道を進み続ける。
;; この関数は、このような衝突の回数を出力する。
(define (car_race_collision n)
|
reworded
|
transform
|
HumanEval_41_car_race_collision
|
(require rackunit)
(define (test-humaneval)
(let (( candidate car_race_collision))
(check-within (candidate 2) 4 0.001)
(check-within (candidate 3) 9 0.001)
(check-within (candidate 4) 16 0.001)
(check-within (candidate 8) 64 0.001)
(check-within (candidate 10) 100 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_41_car_race_collision.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 要素を1ずつ増やしたリストを返す。
;; >>> (incr_list (list 1 2 3))
;; (list 2 3 4)
;; >>> (incr_list (list 5 3 5 2 3 3 9 0 123))
;; (list 6 4 6 3 4 4 10 1 124)
(define (incr_list l)
|
reworded
|
transform
|
HumanEval_42_incr_list
|
(require rackunit)
(define (test-humaneval)
(let (( candidate incr_list))
(check-within (candidate (list )) (list ) 0.001)
(check-within (candidate (list 3 2 1)) (list 4 3 2) 0.001)
(check-within (candidate (list 5 2 5 2 3 3 9 0 123)) (list 6 3 6 3 4 4 10 1 124) 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_42_incr_list.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; pairs_sum_to_zero は整数のリストを引数にとる。
;; リストの中に2つの要素の和がゼロになる要素があれば#tを、
;; そうでなければ#fを返す。
;; >>> (pairs_sum_to_zero (list 1 3 5 0))
;; #f
;; >>> (pairs_sum_to_zero (list 1 3 -2 1))
;; #f
;; >>> (pairs_sum_to_zero (list 1 2 3 7))
;; #f
;; >>> (pairs_sum_to_zero (list 2 4 -5 3 5 7))
;; #t
;; >>> (pairs_sum_to_zero (list 1))
;; #f
(define (pairs_sum_to_zero l)
|
reworded
|
transform
|
HumanEval_43_pairs_sum_to_zero
|
(require rackunit)
(define (test-humaneval)
(let (( candidate pairs_sum_to_zero))
(check-within (candidate (list 1 3 5 0)) #f 0.001)
(check-within (candidate (list 1 3 -2 1)) #f 0.001)
(check-within (candidate (list 1 2 3 7)) #f 0.001)
(check-within (candidate (list 2 4 -5 3 5 7)) #t 0.001)
(check-within (candidate (list 1)) #f 0.001)
(check-within (candidate (list -3 9 -1 3 2 30)) #t 0.001)
(check-within (candidate (list -3 9 -1 3 2 31)) #t 0.001)
(check-within (candidate (list -3 9 -1 4 2 30)) #f 0.001)
(check-within (candidate (list -3 9 -1 4 2 31)) #f 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_43_pairs_sum_to_zero.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 引数xの基数をbaseに変換する。
;; 返り値は変換後の文字列表現である。
;; 基数は10未満である。
;; >>> (change_base 8 3)
;; "22"
;; >>> (change_base 8 2)
;; "1000"
;; >>> (change_base 7 2)
;; "111"
(define (change_base x base)
|
reworded
|
transform
|
HumanEval_44_change_base
|
(require rackunit)
(define (test-humaneval)
(let (( candidate change_base))
(check-within (candidate 8 3) "22" 0.001)
(check-within (candidate 9 3) "100" 0.001)
(check-within (candidate 234 2) "11101010" 0.001)
(check-within (candidate 16 2) "10000" 0.001)
(check-within (candidate 8 2) "1000" 0.001)
(check-within (candidate 7 2) "111" 0.001)
(check-within (candidate 2 3) "2" 0.001)
(check-within (candidate 3 4) "3" 0.001)
(check-within (candidate 4 5) "4" 0.001)
(check-within (candidate 5 6) "5" 0.001)
(check-within (candidate 6 7) "6" 0.001)
(check-within (candidate 7 8) "7" 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_44_change_base.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 三角形の一辺の長さと高さが与えられたとき、面積を返す。
;; >>> (triangle_area 5 3)
;; 7.5
(define (triangle_area a h)
|
reworded
|
transform
|
HumanEval_45_triangle_area
|
(require rackunit)
(define (test-humaneval)
(let (( candidate triangle_area))
(check-within (candidate 5 3) 7.5 0.001)
(check-within (candidate 2 2) 2.0 0.001)
(check-within (candidate 10 8) 40.0 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_45_triangle_area.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; fib4数列はフィボナッチ数列に似た数列で、次のように定義される:
;; 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).
;; fib4数列のn番目の要素を効率的に計算する関数を書け。再帰は使わないこと。
;; >>> (fib4 5)
;; 4
;; >>> (fib4 6)
;; 8
;; >>> (fib4 7)
;; 14
(define (fib4 n)
|
reworded
|
transform
|
HumanEval_46_fib4
|
(require rackunit)
(define (test-humaneval)
(let (( candidate fib4))
(check-within (candidate 5) 4 0.001)
(check-within (candidate 8) 28 0.001)
(check-within (candidate 10) 104 0.001)
(check-within (candidate 12) 386 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_46_fib4.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; リスト l の要素の中央値を返す。
;; >>> (median (list 3 1 2 4 5))
;; 3
;; >>> (median (list -10 4 6 1000 10 20))
;; 15.0
(define (median l)
|
reworded
|
transform
|
HumanEval_47_median
|
(require rackunit)
(define (test-humaneval)
(let (( candidate median))
(check-within (candidate (list 3 1 2 4 5)) 3 0.001)
(check-within (candidate (list -10 4 6 1000 10 20)) 8.0 0.001)
(check-within (candidate (list 5)) 5 0.001)
(check-within (candidate (list 6 5)) 5.5 0.001)
(check-within (candidate (list 8 1 3 9 9 2 7)) 7 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_47_median.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 与えられた文字列が回文かどうかを判定する
;; >>> (is_palindrome "")
;; #t
;; >>> (is_palindrome "aba")
;; #t
;; >>> (is_palindrome "aaaaa")
;; #t
;; >>> (is_palindrome "zbcd")
;; #f
(define (is_palindrome text)
|
reworded
|
transform
|
HumanEval_48_is_palindrome
|
(require rackunit)
(define (test-humaneval)
(let (( candidate is_palindrome))
(check-within (candidate "") #t 0.001)
(check-within (candidate "aba") #t 0.001)
(check-within (candidate "aaaaa") #t 0.001)
(check-within (candidate "zbcd") #f 0.001)
(check-within (candidate "xywyx") #t 0.001)
(check-within (candidate "xywyz") #f 0.001)
(check-within (candidate "xywzx") #f 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_48_is_palindrome.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 2^n を p で割ったモジュロを返す。計算精度に注意。
;; >>> (modp 3 5)
;; 3
;; >>> (modp 1101 101)
;; 2
;; >>> (modp 0 101)
;; 1
;; >>> (modp 3 11)
;; 8
;; >>> (modp 100 101)
;; 1
(define (modp n p)
|
reworded
|
transform
|
HumanEval_49_modp
|
(require rackunit)
(define (test-humaneval)
(let (( candidate modp))
(check-within (candidate 3 5) 3 0.001)
(check-within (candidate 1101 101) 2 0.001)
(check-within (candidate 0 101) 1 0.001)
(check-within (candidate 3 11) 8 0.001)
(check-within (candidate 100 101) 1 0.001)
(check-within (candidate 30 5) 4 0.001)
(check-within (candidate 31 5) 3 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_49_modp.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
remove_vowelsは文字列を引数に取り、母音を除いた文字列を返す関数である。
;; >>> (remove_vowels "")
;; ""
;; >>> (remove_vowels "abcdef")
;; "bcdf"
;; >>> (remove_vowels "aaaaa")
;; ""
;; >>> (remove_vowels "aaBAA")
;; "B"
;; >>> (remove_vowels "zbcd")
;; "zbcd"
(define (remove_vowels text)
|
reworded
|
transform
|
HumanEval_51_remove_vowels
|
(require rackunit)
(define (test-humaneval)
(let (( candidate remove_vowels))
(check-within (candidate "") "" 0.001)
(check-within (candidate "abcdef
ghijklm") "bcdf
ghjklm" 0.001)
(check-within (candidate "fedcba") "fdcb" 0.001)
(check-within (candidate "eeeee") "" 0.001)
(check-within (candidate "acBAA") "cB" 0.001)
(check-within (candidate "EcBOO") "cB" 0.001)
(check-within (candidate "ybcd") "ybcd" 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_51_remove_vowels.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; リスト l 内の全ての数値が閾値 t 未満の場合、#tを返す。
;; >>> (below_threshold (list 1 2 4 10) 100)
;; #t
;; >>> (below_threshold (list 1 20 4 10) 5)
;; #f
(define (below_threshold l t)
|
reworded
|
transform
|
HumanEval_52_below_threshold
|
(require rackunit)
(define (test-humaneval)
(let (( candidate below_threshold))
(check-within (candidate (list 1 2 4 10) 100) #t 0.001)
(check-within (candidate (list 1 20 4 10) 5) #f 0.001)
(check-within (candidate (list 1 20 4 10) 21) #t 0.001)
(check-within (candidate (list 1 20 4 10) 22) #t 0.001)
(check-within (candidate (list 1 8 4 10) 11) #t 0.001)
(check-within (candidate (list 1 8 4 10) 10) #f 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_52_below_threshold.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 2つの数xとyを足す
;; >>> (add 2 3)
;; 5
;; >>> (add 5 7)
;; 12
(define (add x y)
|
reworded
|
transform
|
HumanEval_53_add
|
(require rackunit)
(define (test-humaneval)
(let (( candidate add))
(check-within (candidate 0 1) 1 0.001)
(check-within (candidate 1 0) 1 0.001)
(check-within (candidate 2 3) 5 0.001)
(check-within (candidate 5 7) 12 0.001)
(check-within (candidate 7 5) 12 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_53_add.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 2つの単語が同じ文字セットから構成されるかどうか判定する。
;; >>> (same_chars "eabcdzzzz" "dddzzzzzzzddeddabc")
;; #t
;; >>> (same_chars "abcd" "dddddddabc")
;; #t
;; >>> (same_chars "dddddddabc" "abcd")
;; #t
;; >>> (same_chars "eabcd" "dddddddabc")
;; #f
;; >>> (same_chars "abcd" "dddddddabce")
;; #f
;; >>> (same_chars "eabcdzzzz" "dddzzzzzzzddddabc")
;; #f
(define (same_chars s0 s1)
|
reworded
|
transform
|
HumanEval_54_same_chars
|
(require rackunit)
(define (test-humaneval)
(let (( candidate same_chars))
(check-within (candidate "eabcdzzzz" "dddzzzzzzzddeddabc") #t 0.001)
(check-within (candidate "abcd" "dddddddabc") #t 0.001)
(check-within (candidate "dddddddabc" "abcd") #t 0.001)
(check-within (candidate "eabcd" "dddddddabc") #f 0.001)
(check-within (candidate "abcd" "dddddddabcf") #f 0.001)
(check-within (candidate "eabcdzzzz" "dddzzzzzzzddddabc") #f 0.001)
(check-within (candidate "aabb" "aaccc") #f 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_54_same_chars.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; n番目のフィボナッチ数を返す。
;; >>> (fib 10)
;; 55
;; >>> (fib 1)
;; 1
;; >>> (fib 8)
;; 21
(define (fib n)
|
reworded
|
transform
|
HumanEval_55_fib
|
(require rackunit)
(define (test-humaneval)
(let (( candidate fib))
(check-within (candidate 10) 55 0.001)
(check-within (candidate 1) 1 0.001)
(check-within (candidate 8) 21 0.001)
(check-within (candidate 11) 89 0.001)
(check-within (candidate 12) 144 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_55_fib.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 引数bracketsは"<"と">"の文字列である。
;; すべての開き括弧が対応する閉じ括弧を持つ場合、#tを返す。
;; >>> (correct_bracketing "<")
;; #f
;; >>> (correct_bracketing "<>")
;; #t
;; >>> (correct_bracketing "<<><>>")
;; #t
;; >>> (correct_bracketing "><<>")
;; #f
(define (correct_bracketing brackets)
|
reworded
|
transform
|
HumanEval_56_correct_bracketing
|
(require rackunit)
(define (test-humaneval)
(let (( candidate correct_bracketing))
(check-within (candidate "<>") #t 0.001)
(check-within (candidate "<<><>>") #t 0.001)
(check-within (candidate "<><><<><>><>") #t 0.001)
(check-within (candidate "<><><<<><><>><>><<><><<>>>") #t 0.001)
(check-within (candidate "<<<><>>>>") #f 0.001)
(check-within (candidate "><<>") #f 0.001)
(check-within (candidate "<") #f 0.001)
(check-within (candidate "<<<<") #f 0.001)
(check-within (candidate ">") #f 0.001)
(check-within (candidate "<<>") #f 0.001)
(check-within (candidate "<><><<><>><>><<>") #f 0.001)
(check-within (candidate "<><><<><>><>>><>") #f 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_56_correct_bracketing.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; リストの要素が単調増加または単調減少する場合に#tを返す。
;; >>> (monotonic (list 1 2 4 20))
;; #t
;; >>> (monotonic (list 1 20 4 10))
;; #f
;; >>> (monotonic (list 4 1 0 -10))
;; #t
(define (monotonic l)
|
reworded
|
transform
|
HumanEval_57_monotonic
|
(require rackunit)
(define (test-humaneval)
(let (( candidate monotonic))
(check-within (candidate (list 1 2 4 10)) #t 0.001)
(check-within (candidate (list 1 2 4 20)) #t 0.001)
(check-within (candidate (list 1 20 4 10)) #f 0.001)
(check-within (candidate (list 4 1 0 -10)) #t 0.001)
(check-within (candidate (list 4 1 1 0)) #t 0.001)
(check-within (candidate (list 1 2 3 2 5 60)) #f 0.001)
(check-within (candidate (list 1 2 3 4 5 60)) #t 0.001)
(check-within (candidate (list 9 9 9 9)) #t 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_57_monotonic.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 2つのリストについて、ユニークな共通要素をソートして返す。
;; >>> (common (list 1 4 3 34 653 2 5) (list 5 7 1 5 9 653 121))
;; (list 1 5 653)
;; >>> (common (list 5 3 2 8) (list 3 2))
;; (list 2 3)
(define (common l1 l2)
|
reworded
|
transform
|
HumanEval_58_common
|
(require rackunit)
(define (test-humaneval)
(let (( candidate common))
(check-within (candidate (list 1 4 3 34 653 2 5) (list 5 7 1 5 9 653 121)) (list 1 5 653) 0.001)
(check-within (candidate (list 5 3 2 8) (list 3 2)) (list 2 3) 0.001)
(check-within (candidate (list 4 3 2 8) (list 3 2 4)) (list 2 3 4) 0.001)
(check-within (candidate (list 4 3 2 8) (list )) (list ) 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_58_common.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; nの最大となる素因数を返す。ただし、 n > 1 を前提とし、素数ではないものとする。
;; >>> (largest_prime_factor 13195)
;; 29
;; >>> (largest_prime_factor 2048)
;; 2
(define (largest_prime_factor n)
|
reworded
|
transform
|
HumanEval_59_largest_prime_factor
|
(require rackunit)
(define (test-humaneval)
(let (( candidate largest_prime_factor))
(check-within (candidate 15) 5 0.001)
(check-within (candidate 27) 3 0.001)
(check-within (candidate 63) 7 0.001)
(check-within (candidate 330) 11 0.001)
(check-within (candidate 13195) 29 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_59_largest_prime_factor.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; sum_to_nは1から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
(define (sum_to_n n)
|
reworded
|
transform
|
HumanEval_60_sum_to_n
|
(require rackunit)
(define (test-humaneval)
(let (( candidate sum_to_n))
(check-within (candidate 1) 1 0.001)
(check-within (candidate 6) 21 0.001)
(check-within (candidate 11) 66 0.001)
(check-within (candidate 30) 465 0.001)
(check-within (candidate 100) 5050 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_60_sum_to_n.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 引数bracketsは"("と") "からなる文字列である。
;; すべての開き括弧が対応する閉じ括弧を持つ場合、#tを返す。
;; >>> (correct_bracketing "(")
;; #f
;; >>> (correct_bracketing "()")
;; #t
;; >>> (correct_bracketing "(()())")
;; #t
;; >>> (correct_bracketing ")(()")
;; #f
(define (correct_bracketing brackets)
|
reworded
|
transform
|
HumanEval_61_correct_bracketing
|
(require rackunit)
(define (test-humaneval)
(let (( candidate correct_bracketing))
(check-within (candidate "()") #t 0.001)
(check-within (candidate "(()())") #t 0.001)
(check-within (candidate "()()(()())()") #t 0.001)
(check-within (candidate "()()((()()())())(()()(()))") #t 0.001)
(check-within (candidate "((()())))") #f 0.001)
(check-within (candidate ")(()") #f 0.001)
(check-within (candidate "(") #f 0.001)
(check-within (candidate "((((") #f 0.001)
(check-within (candidate ")") #f 0.001)
(check-within (candidate "(()") #f 0.001)
(check-within (candidate "()()(()())())(()") #f 0.001)
(check-within (candidate "()()(()())()))()") #f 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_61_correct_bracketing.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; xs represent coefficients of a polynomial.
;; xs[0] + xs[1] * x + xs[2] * x^2 + ....
;; 関数は、この多項式の導関数を同じ形式で返す。
;; >>> (derivative (list 3 1 2 4 5))
;; (list 1 4 12 20)
;; >>> (derivative (list 1 2 3))
;; (list 2 6)
(define (derivative xs)
|
reworded
|
transform
|
HumanEval_62_derivative
|
(require rackunit)
(define (test-humaneval)
(let (( candidate derivative))
(check-within (candidate (list 3 1 2 4 5)) (list 1 4 12 20) 0.001)
(check-within (candidate (list 1 2 3)) (list 2 6) 0.001)
(check-within (candidate (list 3 2 1)) (list 2 2) 0.001)
(check-within (candidate (list 3 2 1 0 4)) (list 2 2 0 16) 0.001)
(check-within (candidate (list 1)) (list ) 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_62_derivative.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; FibFib数列はフィボナッチ数列に似た数列で、以下のように定義される:
;; fibfib(0) == 0
;; fibfib(1) == 0
;; fibfib(2) == 1
;; fibfib(n) == fibfib(n-1) + fibfib(n-2) + fibfib(n-3).
;; fibfib数列のn番目の要素を効率よく計算する関数を書いてください。
;; >>> (fibfib 1)
;; 0
;; >>> (fibfib 5)
;; 4
;; >>> (fibfib 8)
;; 24
(define (fibfib n)
|
reworded
|
transform
|
HumanEval_63_fibfib
|
(require rackunit)
(define (test-humaneval)
(let (( candidate fibfib))
(check-within (candidate 2) 1 0.001)
(check-within (candidate 1) 0 0.001)
(check-within (candidate 5) 4 0.001)
(check-within (candidate 8) 24 0.001)
(check-within (candidate 10) 81 0.001)
(check-within (candidate 12) 274 0.001)
(check-within (candidate 14) 927 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_63_fibfib.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 単語を表す文字列を引数とし、その文字列に含まれる母音の数を返す
;; 関数 vowels_count を書きなさい。この場合の母音は'a', 'e', 'i', 'o', 'u'である。
;; ここで、与えられた単語の末尾にある場合のみ、'y'も母音とする。
;; 例::
;; >>> (vowels_count "abcde")
;; 2
;; >>> (vowels_count "ACEDY")
;; 3
(define (vowels_count s)
|
reworded
|
transform
|
HumanEval_64_vowels_count
|
(require rackunit)
(define (test-humaneval)
(let (( candidate vowels_count))
(check-within (candidate "abcde") 2 0.001)
(check-within (candidate "Alone") 3 0.001)
(check-within (candidate "key") 2 0.001)
(check-within (candidate "bye") 1 0.001)
(check-within (candidate "keY") 2 0.001)
(check-within (candidate "bYe") 1 0.001)
(check-within (candidate "ACEDY") 3 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_64_vowels_count.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 整数 x の桁を循環シフトする。shift 分だけ桁を右にシフトし、結果を文字列として返す。
;; もし、shift > 桁数なら、桁を反転して返す。
;; >>> (circular_shift 12 1)
;; "21"
;; >>> (circular_shift 12 2)
;; "12"
(define (circular_shift x shift)
|
reworded
|
transform
|
HumanEval_65_circular_shift
|
(require rackunit)
(define (test-humaneval)
(let (( candidate circular_shift))
(check-within (candidate 100 2) "001" 0.001)
(check-within (candidate 12 2) "12" 0.001)
(check-within (candidate 97 8) "79" 0.001)
(check-within (candidate 12 1) "21" 0.001)
(check-within (candidate 11 101) "11" 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_65_circular_shift.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; タスク
;; 文字列を引数にとり、英大文字のみのASCIIコードの和を返す関数を書く。
;; 例:
;; >>> (digitSum "")
;; 0
;; >>> (digitSum "abAB")
;; 131
;; >>> (digitSum "abcCd")
;; 67
;; >>> (digitSum "helloE")
;; 69
;; >>> (digitSum "woArBld")
;; 131
;; >>> (digitSum "aAaaaXa")
;; 153
(define (digitSum s)
|
reworded
|
transform
|
HumanEval_66_digitSum
|
(require rackunit)
(define (test-humaneval)
(let (( candidate digitSum))
(check-within (candidate "") 0 0.001)
(check-within (candidate "abAB") 131 0.001)
(check-within (candidate "abcCd") 67 0.001)
(check-within (candidate "helloE") 69 0.001)
(check-within (candidate "woArBld") 131 0.001)
(check-within (candidate "aAaaaXa") 153 0.001)
(check-within (candidate " How are yOu?") 151 0.001)
(check-within (candidate "You arE Very Smart") 327 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_66_digitSum.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; この課題では、果物の入ったカゴに配られたリンゴとオレンジの数を表す文字列が
;; 与えられ、このカゴにはリンゴ、オレンジ、マンゴーの果実が入っている。オレンジ
;; とリンゴの総数を表す文字列と、かごの中の果物の総数を表す整数が与えられたら、
;; かごの中のマンゴーの果物の数を返しなさい。
;; たとえば:
;; >>> (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
(define (fruit_distribution s n)
|
reworded
|
transform
|
HumanEval_67_fruit_distribution
|
(require rackunit)
(define (test-humaneval)
(let (( candidate fruit_distribution))
(check-within (candidate "5 apples and 6 oranges" 19) 8 0.001)
(check-within (candidate "5 apples and 6 oranges" 21) 10 0.001)
(check-within (candidate "0 apples and 1 oranges" 3) 2 0.001)
(check-within (candidate "1 apples and 0 oranges" 3) 2 0.001)
(check-within (candidate "2 apples and 3 oranges" 100) 95 0.001)
(check-within (candidate "2 apples and 3 oranges" 5) 0 0.001)
(check-within (candidate "1 apples and 100 oranges" 120) 19 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_67_fruit_distribution.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; "非負整数のノードを持つ木の枝を表す配列が与えられたとする。あなたの仕事は、
;; ノードの1つを抜き取り、それを返すことである。
;; 摘出されるノードは、最小偶数値を持つノードでなければならない。
;; 同じ最小偶数値を持つノードが複数見つかった場合は、最小のインデックスを持つ
;; ノードを返す。
;; 摘出されたノードは [ smalest_value, its index ] というリストで返されなければならない。
;; 偶数値がない場合や与えられた配列が空の場合は [] を返します。
;; 例 1:
;; >>> (pluck (list 4 2 3))
;; (list 2 1)
;; 解説: 2は最小偶数値を持ち、最小インデックスを持つ。
;; 例 2:
;; >>> (pluck (list 1 2 3))
;; (list 2 1)
;; 解説: 2が最小偶数値で、2が最小インデックスを持つ。
;; 例 3:
;; >>> (pluck (list ))
;; (list )
;; 例 4:
;; >>> (pluck (list 5 0 3 0 4 2))
;; (list 0 1)
;; 解説: 0は最小値だが、0は2つあるので、最小インデックスを持つ最初の0を選ぶ。
;; 制約:
;; * 1 <= ノードの長さ <= 10000
;; * 0 <= ノードの値
(define (pluck arr)
|
reworded
|
transform
|
HumanEval_68_pluck
|
(require rackunit)
(define (test-humaneval)
(let (( candidate pluck))
(check-within (candidate (list 4 2 3)) (list 2 1) 0.001)
(check-within (candidate (list 1 2 3)) (list 2 1) 0.001)
(check-within (candidate (list )) (list ) 0.001)
(check-within (candidate (list 5 0 3 0 4 2)) (list 0 1) 0.001)
(check-within (candidate (list 1 2 3 0 5 3)) (list 0 3) 0.001)
(check-within (candidate (list 5 4 8 4 8)) (list 4 1) 0.001)
(check-within (candidate (list 7 6 7 1)) (list 6 1) 0.001)
(check-within (candidate (list 7 9 7 1)) (list ) 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_68_pluck.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 正の整数の空でないリストが与えられる。0より大きく、その整数自身の値以上の頻度を
;; 持つ最大の整数を返せ。整数の頻度とは、それがリストに現れる回数である。
;; のような値が存在しない場合は -1 を返す。
;; 例:
;; >>> (search (list 4 1 2 2 3 1))
;; 2
;; >>> (search (list 1 2 2 3 3 3 4 4 4))
;; 3
;; >>> (search (list 5 5 4 4 4))
;; -1
(define (search lst)
|
reworded
|
transform
|
HumanEval_69_search
|
(require rackunit)
(define (test-humaneval)
(let (( candidate search))
(check-within (candidate (list 5 5 5 5 1)) 1 0.001)
(check-within (candidate (list 4 1 4 1 4 4)) 4 0.001)
(check-within (candidate (list 3 3)) -1 0.001)
(check-within (candidate (list 8 8 8 8 8 8 8 8)) 8 0.001)
(check-within (candidate (list 2 3 3 2 2)) 2 0.001)
(check-within (candidate (list 2 7 8 8 4 8 7 3 9 6 5 10 4 3 6 7 1 7 4 10 8 1)) 1 0.001)
(check-within (candidate (list 3 2 8 2)) 2 0.001)
(check-within (candidate (list 6 7 1 8 8 10 5 8 5 3 10)) 1 0.001)
(check-within (candidate (list 8 8 3 6 5 6 4)) -1 0.001)
(check-within (candidate (list 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 0.001)
(check-within (candidate (list 1 9 10 1 3)) 1 0.001)
(check-within (candidate (list 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 0.001)
(check-within (candidate (list 1)) 1 0.001)
(check-within (candidate (list 8 8 10 6 4 3 5 8 2 4 2 8 4 6 10 4 2 1 10 2 1 1 5)) 4 0.001)
(check-within (candidate (list 2 10 4 8 2 10 5 1 2 9 5 5 6 3 8 6 4 10)) 2 0.001)
(check-within (candidate (list 1 6 10 1 6 9 10 8 6 8 7 3)) 1 0.001)
(check-within (candidate (list 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 0.001)
(check-within (candidate (list 2 6 4 2 8 7 5 6 4 10 4 6 3 7 8 8 3 1 4 2 2 10 7)) 4 0.001)
(check-within (candidate (list 9 8 6 10 2 6 10 2 7 8 10 3 8 2 6 2 3 1)) 2 0.001)
(check-within (candidate (list 5 5 3 9 5 6 3 2 8 5 6 10 10 6 8 4 10 7 7 10 8)) -1 0.001)
(check-within (candidate (list 10)) -1 0.001)
(check-within (candidate (list 9 7 7 2 4 7 2 10 9 7 5 7 2)) 2 0.001)
(check-within (candidate (list 5 4 10 2 1 1 10 3 6 1 8)) 1 0.001)
(check-within (candidate (list 7 9 9 9 3 4 1 5 9 1 2 1 1 10 7 5 6 7 6 7 7 6)) 1 0.001)
(check-within (candidate (list 3 10 10 9 2)) -1 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_69_search.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 整数のリストが与えられたとき、リストを奇妙な順序で返す。
;; 奇妙なソートとは、最小値から始まり、残りの整数の最大値、最小値の順で
;; ソートすることである。
;; 例:
;; >>> (strange_sort_list (list 1 2 3 4))
;; (list 1 4 2 3)
;; >>> (strange_sort_list (list 5 5 5 5))
;; (list 5 5 5 5)
;; >>> (strange_sort_list (list ))
;; (list )
(define (strange_sort_list lst)
|
reworded
|
transform
|
HumanEval_70_strange_sort_list
|
(require rackunit)
(define (test-humaneval)
(let (( candidate strange_sort_list))
(check-within (candidate (list 1 2 3 4)) (list 1 4 2 3) 0.001)
(check-within (candidate (list 5 6 7 8 9)) (list 5 9 6 8 7) 0.001)
(check-within (candidate (list 1 2 3 4 5)) (list 1 5 2 4 3) 0.001)
(check-within (candidate (list 5 6 7 8 9 1)) (list 1 9 5 8 6 7) 0.001)
(check-within (candidate (list 5 5 5 5)) (list 5 5 5 5) 0.001)
(check-within (candidate (list )) (list ) 0.001)
(check-within (candidate (list 1 2 3 4 5 6 7 8)) (list 1 8 2 7 3 6 4 5) 0.001)
(check-within (candidate (list 0 2 2 2 5 5 -5 -5)) (list -5 5 -5 5 0 2 2 2) 0.001)
(check-within (candidate (list 111111)) (list 111111) 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_70_strange_sort_list.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 三角形の3辺の長さが与えられた。3辺が有効な三角形を形成していれば、
;; 三角形の面積を小数点以下2桁で四捨五入して返す。そうでない場合は-1を
;; 返す。
;; 任意の2辺の和が3辺より大きいとき、3辺は有効な三角形となる。
;; 例:
;; >>> (triangle_area 3 4 5)
;; 6.0
;; >>> (triangle_area 1 2 10)
;; -1
(define (triangle_area a b c)
|
reworded
|
transform
|
HumanEval_71_triangle_area
|
(require rackunit)
(define (test-humaneval)
(let (( candidate triangle_area))
(check-within (candidate 3 4 5) 6.0 0.001)
(check-within (candidate 1 2 10) -1 0.001)
(check-within (candidate 4 8 5) 8.18 0.001)
(check-within (candidate 2 2 2) 1.73 0.001)
(check-within (candidate 1 2 3) -1 0.001)
(check-within (candidate 10 5 7) 16.25 0.001)
(check-within (candidate 2 6 3) -1 0.001)
(check-within (candidate 1 1 1) 0.43 0.001)
(check-within (candidate 2 2 10) -1 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_71_triangle_area.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 物体qが飛べば#tを、そうでなければ#fを返す関数を書け。
;; 物体qはバランスが取れていて(つまり、リストが回文であって)、その要素の和が
;; 最大荷重w以下であれば飛ぶ。
;; 例:
;; >>> (will_it_fly (list 1 2) 5)
;; #f
;; # 1+2 は最大荷重以下であるが、バランスが取れていない
;; >>> (will_it_fly (list 3 2 3) 1)
;; #f
;; # バランスが取れているが、3+2+3 は最大荷重を超える
;; >>> (will_it_fly (list 3 2 3) 9)
;; #t
;; # 33+2+3 は最大荷重以下であり、バランスも取れている
;; >>> (will_it_fly (list 3) 5)
;; #t
;; # 3 は最大荷重以下であり、バランスも取れている
(define (will_it_fly q w)
|
reworded
|
transform
|
HumanEval_72_will_it_fly
|
(require rackunit)
(define (test-humaneval)
(let (( candidate will_it_fly))
(check-within (candidate (list 3 2 3) 9) #t 0.001)
(check-within (candidate (list 1 2) 5) #f 0.001)
(check-within (candidate (list 3) 5) #t 0.001)
(check-within (candidate (list 3 2 3) 1) #f 0.001)
(check-within (candidate (list 1 2 3) 6) #f 0.001)
(check-within (candidate (list 5) 5) #t 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_72_will_it_fly.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 整数の配列arrが与えられたとき、その配列を回文配列にするために
;; 必要な要素の最小数を求めよ。回文配列とは、前からも後からも同じ
;; ようになる配列のことである。1回の変更で、1つの要素を他の任意の
;; 要素に変更できる。
;; 例えば:
;; >>> (smallest_change (list 1 2 3 5 4 7 9 6))
;; 4
;; >>> (smallest_change (list 1 2 3 4 3 2 2))
;; 1
;; >>> (smallest_change (list 1 2 3 2 1))
;; 0
(define (smallest_change arr)
|
reworded
|
transform
|
HumanEval_73_smallest_change
|
(require rackunit)
(define (test-humaneval)
(let (( candidate smallest_change))
(check-within (candidate (list 1 2 3 5 4 7 9 6)) 4 0.001)
(check-within (candidate (list 1 2 3 4 3 2 2)) 1 0.001)
(check-within (candidate (list 1 4 2)) 1 0.001)
(check-within (candidate (list 1 4 4 2)) 1 0.001)
(check-within (candidate (list 1 2 3 2 1)) 0 0.001)
(check-within (candidate (list 3 1 1 3)) 0 0.001)
(check-within (candidate (list 1)) 0 0.001)
(check-within (candidate (list 0 1)) 1 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_73_smallest_change.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 2つの文字列リストを受け取り、リストの全文字数の合計がもう一方
;; のリストより少ないリストを返す関数を書きなさい。
;; もし2つのリストの文字数が同じなら、最初のリストを返す。
;; 例
;; >>> (total_match (list ) (list ))
;; (list )
;; >>> (total_match (list "hi" "admin") (list "hI" "Hi"))
;; (list "hI" "Hi")
;; >>> (total_match (list "hi" "admin") (list "hi" "hi" "admin" "project"))
;; (list "hi" "admin")
;; >>> (total_match (list "hi" "admin") (list "hI" "hi" "hi"))
;; (list "hI" "hi" "hi")
;; >>> (total_match (list "4") (list "1" "2" "3" "4" "5"))
;; (list "4")
(define (total_match lst1 lst2)
|
reworded
|
transform
|
HumanEval_74_total_match
|
(require rackunit)
(define (test-humaneval)
(let (( candidate total_match))
(check-within (candidate (list ) (list )) (list ) 0.001)
(check-within (candidate (list "hi" "admin") (list "hi" "hi")) (list "hi" "hi") 0.001)
(check-within (candidate (list "hi" "admin") (list "hi" "hi" "admin" "project")) (list "hi" "admin") 0.001)
(check-within (candidate (list "4") (list "1" "2" "3" "4" "5")) (list "4") 0.001)
(check-within (candidate (list "hi" "admin") (list "hI" "Hi")) (list "hI" "Hi") 0.001)
(check-within (candidate (list "hi" "admin") (list "hI" "hi" "hi")) (list "hI" "hi" "hi") 0.001)
(check-within (candidate (list "hi" "admin") (list "hI" "hi" "hii")) (list "hi" "admin") 0.001)
(check-within (candidate (list ) (list "this")) (list ) 0.001)
(check-within (candidate (list "this") (list )) (list ) 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_74_total_match.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 与えられた数が3つの素数の掛け算であれば#tを、そうでなければ#fを返す
;; 関数を書きなさい。
;; 引数 aは100以下を既知としていよい。
;; 例:
;; >>> (is_multiply_prime 30)
;; #t
;; 30 = 2 * 3 * 5
(define (is_multiply_prime a)
|
reworded
|
transform
|
HumanEval_75_is_multiply_prime
|
(require rackunit)
(define (test-humaneval)
(let (( candidate is_multiply_prime))
(check-within (candidate 5) #f 0.001)
(check-within (candidate 30) #t 0.001)
(check-within (candidate 8) #t 0.001)
(check-within (candidate 10) #f 0.001)
(check-within (candidate 125) #t 0.001)
(check-within (candidate 105) #t 0.001)
(check-within (candidate 126) #f 0.001)
(check-within (candidate 729) #f 0.001)
(check-within (candidate 891) #f 0.001)
(check-within (candidate 1001) #t 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_75_is_multiply_prime.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; あなたのタスクは、ある数xがnの単純なべき乗である場合にtrueを、
;; それ以外の場合にfalseを返す関数を書くことである。
;; xは、n**int=xのとき、nの単純なべき乗である。
;; 例えば:
;; >>> (is_simple_power 1 4)
;; #t
;; >>> (is_simple_power 2 2)
;; #t
;; >>> (is_simple_power 8 2)
;; #t
;; >>> (is_simple_power 3 2)
;; #f
;; >>> (is_simple_power 3 1)
;; #f
;; >>> (is_simple_power 5 3)
;; #f
(define (is_simple_power x n)
|
reworded
|
transform
|
HumanEval_76_is_simple_power
|
(require rackunit)
(define (test-humaneval)
(let (( candidate is_simple_power))
(check-within (candidate 16 2) #t 0.001)
(check-within (candidate 143214 16) #f 0.001)
(check-within (candidate 4 2) #t 0.001)
(check-within (candidate 9 3) #t 0.001)
(check-within (candidate 16 4) #t 0.001)
(check-within (candidate 24 2) #f 0.001)
(check-within (candidate 128 4) #f 0.001)
(check-within (candidate 12 6) #f 0.001)
(check-within (candidate 1 1) #t 0.001)
(check-within (candidate 1 12) #t 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_76_is_simple_power.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 整数aを受け取り、この整数がある整数の3乗である場合に#t
;; を返す関数を書きなさい。
;; 注意:入力は常に処理可能であると仮定してよい。
;; 例:
;; >>> (iscube 1)
;; #t
;; >>> (iscube 2)
;; #f
;; >>> (iscube -1)
;; #t
;; >>> (iscube 64)
;; #t
;; >>> (iscube 0)
;; #t
;; >>> (iscube 180)
;; #f
(define (iscube a)
|
reworded
|
transform
|
HumanEval_77_iscube
|
(require rackunit)
(define (test-humaneval)
(let (( candidate iscube))
(check-within (candidate 1) #t 0.001)
(check-within (candidate 2) #f 0.001)
(check-within (candidate -1) #t 0.001)
(check-within (candidate 64) #t 0.001)
(check-within (candidate 180) #f 0.001)
(check-within (candidate 1000) #t 0.001)
(check-within (candidate 0) #t 0.001)
(check-within (candidate 1729) #f 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_77_iscube.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; ;; 16進数の数字を文字列として受け取り、その中に含まれる素数である16進数の桁数を
;; カウントする関数を作成するタスクが与えられました。素数とは、1より大きく、
;; 2つのより小さい自然数の積でない自然数です。
;; 16進数の桁には0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, Fがあります。
;; 素数としては2, 3, 5, 7, 11, 13, 17,...があります。
;; したがって、次の数字のいずれかがいくつあるかを判定する必要があります:
;; 2, 3, 5, 7, B(=10進数で11), D(=10進数で13)
;; 注意:入力は常に正確、または空の文字列であり、記号A, B, C, D, E, Fは常に
;; 大文字であると仮定してよいです。
;; 例:
;; >>> (hex_key "AB")
;; 1
;; >>> (hex_key "1077E")
;; 2
;; >>> (hex_key "ABED1A33")
;; 4
;; >>> (hex_key "123456789ABCDEF0")
;; 6
;; >>> (hex_key "2020")
;; 2
(define (hex_key num)
|
reworded
|
transform
|
HumanEval_78_hex_key
|
(require rackunit)
(define (test-humaneval)
(let (( candidate hex_key))
(check-within (candidate "AB") 1 0.001)
(check-within (candidate "1077E") 2 0.001)
(check-within (candidate "ABED1A33") 4 0.001)
(check-within (candidate "2020") 2 0.001)
(check-within (candidate "123456789ABCDEF0") 6 0.001)
(check-within (candidate "112233445566778899AABBCCDDEEFF00") 12 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_78_hex_key.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 10進数形式の数値が与えられ、あなたのタスクはそれを2進数形式に変換することである。
;; この関数は、文字列を返し、その各文字は2進数を表す。文字列の各文字は'0'か'1'である。
;; なお、文字列の最初と最後には'db'という余分な文字をつける。
;; この文字は書式を助けるためにある。
;; 例:
;; >>> (decimal_to_binary 15)
;; "db1111db"
;; >>> (decimal_to_binary 32)
;; "db100000db"
(define (decimal_to_binary decimal)
|
reworded
|
transform
|
HumanEval_79_decimal_to_binary
|
(require rackunit)
(define (test-humaneval)
(let (( candidate decimal_to_binary))
(check-within (candidate 0) "db0db" 0.001)
(check-within (candidate 32) "db100000db" 0.001)
(check-within (candidate 103) "db1100111db" 0.001)
(check-within (candidate 15) "db1111db" 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_79_decimal_to_binary.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; あなたは文字列sが与えられる。
;; あなたのタスクは、その文字列が幸せかどうかをチェックすることである。
;; 文字列は幸せとは、文字列の長さが少なくとも3以上で、連続する3文字がすべて異なる場合である。
;; 例えば:
;; >>> (is_happy "a")
;; #f
;; >>> (is_happy "aa")
;; #f
;; >>> (is_happy "abcd")
;; #t
;; >>> (is_happy "aabb")
;; #f
;; >>> (is_happy "adb")
;; #t
;; >>> (is_happy "xyy")
;; #f
(define (is_happy s)
|
reworded
|
transform
|
HumanEval_80_is_happy
|
(require rackunit)
(define (test-humaneval)
(let (( candidate is_happy))
(check-within (candidate "a") #f 0.001)
(check-within (candidate "aa") #f 0.001)
(check-within (candidate "abcd") #t 0.001)
(check-within (candidate "aabb") #f 0.001)
(check-within (candidate "adb") #t 0.001)
(check-within (candidate "xyy") #f 0.001)
(check-within (candidate "iopaxpoi") #t 0.001)
(check-within (candidate "iopaxioi") #f 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_80_is_happy.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 学期最終週、教師は生徒に成績をつけなければならない。教師は独自のアルゴリズムで採点している。
;; 問題は、彼女が成績評価に使ったコードを紛失してしまったことです。
;; 彼女は何人かの生徒のGPAのリストをあなたに渡したので、あなたは次の表を使って評点のリストを
;; 出力できる関数を書くことになりました。:
;; 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
;; 例:
;; >>> (grade_equation (list 4.0 3 1.7 2 3.5))
;; (list "A+" "B" "C-" "C" "A-")
(define (numerical_letter_grade grades)
|
reworded
|
transform
|
HumanEval_81_numerical_letter_grade
|
(require rackunit)
(define (test-humaneval)
(let (( candidate numerical_letter_grade))
(check-within (candidate (list 4.0 3 1.7 2 3.5)) (list "A+" "B" "C-" "C" "A-") 0.001)
(check-within (candidate (list 1.2)) (list "D+") 0.001)
(check-within (candidate (list 0.5)) (list "D-") 0.001)
(check-within (candidate (list 0.0)) (list "E") 0.001)
(check-within (candidate (list 1.0 0.3 1.5 2.8 3.3)) (list "D" "D-" "C-" "B" "B+") 0.001)
(check-within (candidate (list 0.0 0.7)) (list "E" "D-") 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_81_numerical_letter_grade.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 文字列を受け取り、文字列の長さが素数であれば#tを、そうでなければ#fを返す関数を書く。
;; 例
;; >>> (prime_length "Hello")
;; #t
;; >>> (prime_length "abcdcba")
;; #t
;; >>> (prime_length "kittens")
;; #t
;; >>> (prime_length "orange")
;; #f
(define (prime_length string)
|
reworded
|
transform
|
HumanEval_82_prime_length
|
(require rackunit)
(define (test-humaneval)
(let (( candidate prime_length))
(check-within (candidate "Hello") #t 0.001)
(check-within (candidate "abcdcba") #t 0.001)
(check-within (candidate "kittens") #t 0.001)
(check-within (candidate "orange") #f 0.001)
(check-within (candidate "wow") #t 0.001)
(check-within (candidate "world") #t 0.001)
(check-within (candidate "MadaM") #t 0.001)
(check-within (candidate "Wow") #t 0.001)
(check-within (candidate "") #f 0.001)
(check-within (candidate "HI") #t 0.001)
(check-within (candidate "go") #t 0.001)
(check-within (candidate "gogo") #f 0.001)
(check-within (candidate "aaaaaaaaaaaaaaa") #f 0.001)
(check-within (candidate "Madam") #t 0.001)
(check-within (candidate "M") #f 0.001)
(check-within (candidate "0") #f 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_82_prime_length.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 正の整数 n が与えられたとき、n 桁の正の整数で 1 で始まるか
;; もしくは終わる数のカウントを返す
(define (starts_one_ends n)
|
reworded
|
transform
|
HumanEval_83_starts_one_ends
|
(require rackunit)
(define (test-humaneval)
(let (( candidate starts_one_ends))
(check-within (candidate 1) 1 0.001)
(check-within (candidate 2) 18 0.001)
(check-within (candidate 3) 180 0.001)
(check-within (candidate 4) 1800 0.001)
(check-within (candidate 5) 18000 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_83_starts_one_ends.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 正の整数 N が与えられた時、その桁の総和を2進数で返す。
;; 例
;; >>> (solve 1000)
;; "1"
;; >>> (solve 150)
;; "110"
;; >>> (solve 147)
;; "1100"
;; 数:
;; @N 整数
;; 制約: 0 ≤ N ≤ 10000.
;; 返り値:
;; a 2進数表記の文字列
(define (solve N)
|
reworded
|
transform
|
HumanEval_84_solve
|
(require rackunit)
(define (test-humaneval)
(let (( candidate solve))
(check-within (candidate 1000) "1" 0.001)
(check-within (candidate 150) "110" 0.001)
(check-within (candidate 147) "1100" 0.001)
(check-within (candidate 333) "1001" 0.001)
(check-within (candidate 963) "10010" 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_84_solve.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 空でない整数のリストlstが与えられたとき、奇数のインデックスにある偶数の要素を加える。
;; 例:
;; >>> (add (list 4 2 6 7))
;; 2
(define (add lst)
|
reworded
|
transform
|
HumanEval_85_add
|
(require rackunit)
(define (test-humaneval)
(let (( candidate add))
(check-within (candidate (list 4 88)) 88 0.001)
(check-within (candidate (list 4 5 6 7 2 122)) 122 0.001)
(check-within (candidate (list 4 0 6 7)) 0 0.001)
(check-within (candidate (list 4 4 6 8)) 12 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_85_add.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 文字列を引数として受け取り、その「順序付けられたバージョン」を返す関数を作成してください。
;; 順序付けられたバージョンとは、各単語(空白で区切られた)の文字がASCII値に基づいて昇順に
;; 並べ替えられた新しい単語に置き換えられた文字列です。
;; 注意:文章内の単語と空白の順序はそのまま保ってください。
;; 例えば:
;; >>> (anti_shuffle "Hi")
;; "Hi"
;; >>> (anti_shuffle "hello")
;; "ehllo"
;; >>> (anti_shuffle "Hello World!!!")
;; "Hello !!!Wdlor"
(define (anti_shuffle s)
|
reworded
|
transform
|
HumanEval_86_anti_shuffle
|
(require rackunit)
(define (test-humaneval)
(let (( candidate anti_shuffle))
(check-within (candidate "Hi") "Hi" 0.001)
(check-within (candidate "hello") "ehllo" 0.001)
(check-within (candidate "number") "bemnru" 0.001)
(check-within (candidate "abcd") "abcd" 0.001)
(check-within (candidate "Hello World!!!") "Hello !!!Wdlor" 0.001)
(check-within (candidate "") "" 0.001)
(check-within (candidate "Hi. My name is Mister Robot. How are you?") ".Hi My aemn is Meirst .Rboot How aer ?ouy" 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_86_anti_shuffle.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 2次元のデータがネストされたリストとして与えられる。これは行列に似ているが、
;; 列とは異なり、各行は異なる数の列を含むことができる。
;; lstと整数xが与えられたとき、リスト内の整数xを見つけ、各タプルが0から始まる
;; 座標(行、列)であるようなタプルのリスト[(x1, y1), (x2, y2) ...]を返す。
;; 座標を最初は行の昇順でソートする。
;; また、行の座標を列の降順でソートする。
;; 例:
;; >>> (get_row (list (list 1 2 3 4 5 6) (list 1 2 3 4 1 6) (list 1 2 3 4 5 1)) 1)
;; (list (list 0 0) (list 1 4) (list 1 0) (list 2 5) (list 2 0))
;; >>> (get_row (list ) 1)
;; (list )
;; >>> (get_row (list (list ) (list 1) (list 1 2 3)) 3)
;; (list (list 2 2))
(define (get_row lst x)
|
reworded
|
transform
|
HumanEval_87_get_row
|
(require rackunit)
(define (test-humaneval)
(let (( candidate get_row))
(check-within (candidate (list (list 1 2 3 4 5 6) (list 1 2 3 4 1 6) (list 1 2 3 4 5 1)) 1) (list (list 0 0) (list 1 4) (list 1 0) (list 2 5) (list 2 0)) 0.001)
(check-within (candidate (list (list 1 2 3 4 5 6) (list 1 2 3 4 5 6) (list 1 2 3 4 5 6) (list 1 2 3 4 5 6) (list 1 2 3 4 5 6) (list 1 2 3 4 5 6)) 2) (list (list 0 1) (list 1 1) (list 2 1) (list 3 1) (list 4 1) (list 5 1)) 0.001)
(check-within (candidate (list (list 1 2 3 4 5 6) (list 1 2 3 4 5 6) (list 1 1 3 4 5 6) (list 1 2 1 4 5 6) (list 1 2 3 1 5 6) (list 1 2 3 4 1 6) (list 1 2 3 4 5 1)) 1) (list (list 0 0) (list 1 0) (list 2 1) (list 2 0) (list 3 2) (list 3 0) (list 4 3) (list 4 0) (list 5 4) (list 5 0) (list 6 5) (list 6 0)) 0.001)
(check-within (candidate (list ) 1) (list ) 0.001)
(check-within (candidate (list (list 1)) 2) (list ) 0.001)
(check-within (candidate (list (list ) (list 1) (list 1 2 3)) 3) (list (list 2 2)) 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_87_get_row.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 非負の整数からなる配列が与えられた場合、配列をソートしたコピーを返してください。
;; 配列の最初の要素と最後の要素の和が奇数であれば、配列を昇順(小さい順)にソートします。
;; の和が偶数であれば、配列を降順(大きい順)にソートします。
;; 注意点:
;; * 与えられた配列自体を変更しないでください.
;; 例:
;; >>> (sort_array (list ))
;; (list )
;; >>> (sort_array (list 5))
;; (list 5)
;; >>> (sort_array (list 2 4 3 0 1 5))
;; (list 0 1 2 3 4 5)
;; >>> (sort_array (list 2 4 3 0 1 5 6))
;; (list 6 5 4 3 2 1 0)
(define (sort_array array)
|
reworded
| null |
HumanEval_88_sort_array
|
(require rackunit)
(define (test-humaneval)
(let (( candidate sort_array))
(check-within (candidate (list )) (list ) 0.001)
(check-within (candidate (list 5)) (list 5) 0.001)
(check-within (candidate (list 2 4 3 0 1 5)) (list 0 1 2 3 4 5) 0.001)
(check-within (candidate (list 2 4 3 0 1 5 6)) (list 6 5 4 3 2 1 0) 0.001)
(check-within (candidate (list 2 1)) (list 1 2) 0.001)
(check-within (candidate (list 15 42 87 32 11 0)) (list 0 11 15 32 42 87) 0.001)
(check-within (candidate (list 21 14 23 11)) (list 23 21 14 11) 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_88_sort_array.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 文字列を引数にとり、アルファベットを回転させて暗号化した
;; 文字列を返す関数encryptを作成せよ。
;; アルファベットは、文字位置が2を2倍した4文字分だけ後ろにシフトされるように
;; 回転する。
;; 例:
;; >>> (encrypt "hi")
;; "lm"
;; >>> (encrypt "asdfghjkl")
;; "ewhjklnop"
;; >>> (encrypt "gf")
;; "kj"
;; >>> (encrypt "et")
;; "ix"
(define (encrypt s)
|
reworded
|
transform
|
HumanEval_89_encrypt
|
(require rackunit)
(define (test-humaneval)
(let (( candidate encrypt))
(check-within (candidate "hi") "lm" 0.001)
(check-within (candidate "asdfghjkl") "ewhjklnop" 0.001)
(check-within (candidate "gf") "kj" 0.001)
(check-within (candidate "et") "ix" 0.001)
(check-within (candidate "faewfawefaewg") "jeiajeaijeiak" 0.001)
(check-within (candidate "hellomyfriend") "lippsqcjvmirh" 0.001)
(check-within (candidate "dxzdlmnilfuhmilufhlihufnmlimnufhlimnufhfucufh") "hbdhpqrmpjylqmpyjlpmlyjrqpmqryjlpmqryjljygyjl" 0.001)
(check-within (candidate "a") "e" 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_89_encrypt.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 整数のリストが与えられる。
;; リストの2番目に小さい要素を返す関数 next_smallest() を書きなさい。
;; そのような要素がない場合は #f を返す。
;; >>> (next_smallest (list 1 2 3 4 5))
;; 2
;; >>> (next_smallest (list 5 1 4 3 2))
;; 2
;; >>> (next_smallest (list ))
;; #f
;; >>> (next_smallest (list 1 1))
;; #f
(define (next_smallest lst)
|
reworded
|
transform
|
HumanEval_90_next_smallest
|
(require rackunit)
(define (test-humaneval)
(let (( candidate next_smallest))
(check-within (candidate (list 1 2 3 4 5)) 2 0.001)
(check-within (candidate (list 5 1 4 3 2)) 2 0.001)
(check-within (candidate (list )) #f 0.001)
(check-within (candidate (list 1 1)) #f 0.001)
(check-within (candidate (list 1 1 1 1 0)) 1 0.001)
(check-within (candidate (list 1 1)) #f 0.001)
(check-within (candidate (list -35 34 12 -45)) -35 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_90_next_smallest.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 単語の文字列が与えられ、あなたのタスクは退屈指数を数える
;; ことである。退屈指数とは、"I "で始まる文のことである。
;; 文は'.'、’?’、'!'のいずれかで区切られる。
;; 例えば:
;; >>> (is_bored "Hello world")
;; 0
;; >>> (is_bored "The sky is blue. The sun is shining. I love this weather")
;; 1
(define (is_bored S)
|
reworded
|
transform
|
HumanEval_91_is_bored
|
(require rackunit)
(define (test-humaneval)
(let (( candidate is_bored))
(check-within (candidate "Hello world") 0 0.001)
(check-within (candidate "Is the sky blue?") 0 0.001)
(check-within (candidate "I love It !") 1 0.001)
(check-within (candidate "bIt") 0 0.001)
(check-within (candidate "I feel good today. I will be productive. will kill It") 2 0.001)
(check-within (candidate "You and I are going for a walk") 0 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_91_is_bored.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 3つの数値を受け取る関数を作る。
;; 1つの数値が他の2つの数値の和と等しく、すべての数値が整数である場合に#tを返す。
;; それ以外の場合は#fを返す。
;; 例
;; >>> (any_int 5 2 7)
;; #t
;; >>> (any_int 3 2 2)
;; #f
;; >>> (any_int 3 -2 1)
;; #t
;; >>> (any_int 3.6 -2.2 2)
;; #f
(define (any_int x y z)
|
reworded
|
transform
|
HumanEval_92_any_int
|
(require rackunit)
(define (test-humaneval)
(let (( candidate any_int))
(check-within (candidate 2 3 1) #t 0.001)
(check-within (candidate 2.5 2 3) #f 0.001)
(check-within (candidate 1.5 5 3.5) #f 0.001)
(check-within (candidate 2 6 2) #f 0.001)
(check-within (candidate 4 2 2) #t 0.001)
(check-within (candidate 2.2 2.2 2.2) #f 0.001)
(check-within (candidate -4 6 2) #t 0.001)
(check-within (candidate 2 1 1) #t 0.001)
(check-within (candidate 3 4 7) #t 0.001)
(check-within (candidate 3.0 4 7) #f 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_92_any_int.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; メッセージを受け取り、すべての文字の大文字と小文字を入れ替え、
;;メッセージ中のすべての母音を英語の母音の2つ前に現れる文字に置
;; き換えるようにエンコードする関数を書きなさい。
;; 文字だけを想定する。
;; 例:
;; >>> (encode "test")
;; "TGST"
;; >>> (encode "This is a message")
;; "tHKS KS C MGSSCGG"
(define (encode message)
|
reworded
|
transform
|
HumanEval_93_encode
|
(require rackunit)
(define (test-humaneval)
(let (( candidate encode))
(check-within (candidate "TEST") "tgst" 0.001)
(check-within (candidate "Mudasir") "mWDCSKR" 0.001)
(check-within (candidate "YES") "ygs" 0.001)
(check-within (candidate "This is a message") "tHKS KS C MGSSCGG" 0.001)
(check-within (candidate "I DoNt KnOw WhAt tO WrItE") "k dQnT kNqW wHcT Tq wRkTg" 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_93_encode.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 整数のリストが与えらる。
;; 最大の素数を求め、その桁数の和を返す必要がある。
;; 例:
;; >>> (skjkasdkd (list 0 3 2 1 3 5 7 4 5 5 5 2 181 32 4 32 3 2 32 324 4 3))
;; 10
;; >>> (skjkasdkd (list 1 0 1 8 2 4597 2 1 3 40 1 2 1 2 4 2 5 1))
;; 25
;; >>> (skjkasdkd (list 1 3 1 32 5107 34 83278 109 163 23 2323 32 30 1 9 3))
;; 13
;; >>> (skjkasdkd (list 0 724 32 71 99 32 6 0 5 91 83 0 5 6))
;; 11
;; >>> (skjkasdkd (list 0 81 12 3 1 21))
;; 3
;; >>> (skjkasdkd (list 0 8 1 2 1 7))
;; 7
(define (skjkasdkd lst)
|
reworded
|
transform
|
HumanEval_94_skjkasdkd
|
(require rackunit)
(define (test-humaneval)
(let (( candidate skjkasdkd))
(check-within (candidate (list 0 3 2 1 3 5 7 4 5 5 5 2 181 32 4 32 3 2 32 324 4 3)) 10 0.001)
(check-within (candidate (list 1 0 1 8 2 4597 2 1 3 40 1 2 1 2 4 2 5 1)) 25 0.001)
(check-within (candidate (list 1 3 1 32 5107 34 83278 109 163 23 2323 32 30 1 9 3)) 13 0.001)
(check-within (candidate (list 0 724 32 71 99 32 6 0 5 91 83 0 5 6)) 11 0.001)
(check-within (candidate (list 0 81 12 3 1 21)) 3 0.001)
(check-within (candidate (list 0 8 1 2 1 7)) 7 0.001)
(check-within (candidate (list 8191)) 19 0.001)
(check-within (candidate (list 8191 123456 127 7)) 19 0.001)
(check-within (candidate (list 127 97 8192)) 10 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_94_skjkasdkd.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;;辞書が与えられたとき、すべてのキーが小文字であれば#tを、
;; すべてのキーが大文字の文字列であれば#fを返す。
;; 与えられた辞書が空の場合、この関数は #f を返す。
;; 例:
;; >>> (check_dict_case #hash(("a" . "apple") ("b" . "banana")))
;; #t
;; >>> (check_dict_case #hash(("a" . "apple") ("A" . "banana") ("B" . "banana")))
;; #f
;; >>> (check_dict_case #hash(("a" . "apple") (8 . "banana") ("a" . "apple")))
;; #f
;; >>> (check_dict_case #hash(("Name" . "John") ("Age" . "36") ("City" . "Houston")))
;; #f
;; >>> (check_dict_case #hash(("STATE" . "NC") ("ZIP" . "12345")))
;; #t
(define (check_dict_case dict)
|
reworded
|
transform
|
HumanEval_95_check_dict_case
|
(require rackunit)
(define (test-humaneval)
(let (( candidate check_dict_case))
(check-within (candidate #hash(("p" . "pineapple") ("b" . "banana"))) #t 0.001)
(check-within (candidate #hash(("p" . "pineapple") ("A" . "banana") ("B" . "banana"))) #f 0.001)
(check-within (candidate #hash(("p" . "pineapple") ("5" . "banana") ("a" . "apple"))) #f 0.001)
(check-within (candidate #hash(("Name" . "John") ("Age" . "36") ("City" . "Houston"))) #f 0.001)
(check-within (candidate #hash(("STATE" . "NC") ("ZIP" . "12345"))) #t 0.001)
(check-within (candidate #hash(("fruit" . "Orange") ("taste" . "Sweet"))) #t 0.001)
(check-within (candidate #hash()) #f 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_95_check_dict_case.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 非負整数を受け取り、素数でnより小さい最初のn個の
;; 整数の配列を返す関数を実装せよ。
;; 例えば:
;; >>> (count_up_to 5)
;; (list 2 3)
;; >>> (count_up_to 11)
;; (list 2 3 5 7)
;; >>> (count_up_to 0)
;; (list )
;; >>> (count_up_to 20)
;; (list 2 3 5 7 11 13 17 19)
;; >>> (count_up_to 1)
;; (list )
;; >>> (count_up_to 18)
;; (list 2 3 5 7 11 13 17)
(define (count_up_to n)
|
reworded
|
transform
|
HumanEval_96_count_up_to
|
(require rackunit)
(define (test-humaneval)
(let (( candidate count_up_to))
(check-within (candidate 5) (list 2 3) 0.001)
(check-within (candidate 6) (list 2 3 5) 0.001)
(check-within (candidate 7) (list 2 3 5) 0.001)
(check-within (candidate 10) (list 2 3 5 7) 0.001)
(check-within (candidate 0) (list ) 0.001)
(check-within (candidate 22) (list 2 3 5 7 11 13 17 19) 0.001)
(check-within (candidate 1) (list ) 0.001)
(check-within (candidate 18) (list 2 3 5 7 11 13 17) 0.001)
(check-within (candidate 47) (list 2 3 5 7 11 13 17 19 23 29 31 37 41 43) 0.001)
(check-within (candidate 101) (list 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) 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_96_count_up_to.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 2つの整数を受け取り、その1の位の数の積を返す関数を完成させよ。
;; 入力は常に有効範囲にあるとする。
;; 例:
;; >>> (multiply 148 412)
;; 16
;; >>> (multiply 19 28)
;; 72
;; >>> (multiply 2020 1851)
;; 0
;; >>> (multiply 14 -15)
;; 20
(define (multiply a b)
|
reworded
|
transform
|
HumanEval_97_multiply
|
(require rackunit)
(define (test-humaneval)
(let (( candidate multiply))
(check-within (candidate 148 412) 16 0.001)
(check-within (candidate 19 28) 72 0.001)
(check-within (candidate 2020 1851) 0 0.001)
(check-within (candidate 14 -15) 20 0.001)
(check-within (candidate 76 67) 42 0.001)
(check-within (candidate 17 27) 49 0.001)
(check-within (candidate 0 1) 0 0.001)
(check-within (candidate 0 0) 0 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_97_multiply.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 文字列 s が与えられたとき、偶数のインデックスに含まれる大文字の母音の数を数える。
;; 例えば:
;; >>> (count_upper "aBCdEf")
;; 1
;; >>> (count_upper "abcdefg")
;; 0
;; >>> (count_upper "dBBE")
;; 0
(define (count_upper s)
|
reworded
|
transform
|
HumanEval_98_count_upper
|
(require rackunit)
(define (test-humaneval)
(let (( candidate count_upper))
(check-within (candidate "aBCdEf") 1 0.001)
(check-within (candidate "abcdefg") 0 0.001)
(check-within (candidate "dBBE") 0 0.001)
(check-within (candidate "B") 0 0.001)
(check-within (candidate "U") 1 0.001)
(check-within (candidate "") 0 0.001)
(check-within (candidate "EEEE") 2 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_98_count_upper.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 数値を表す文字列valueを受け取り、それに最も近い整数を返す関数を作る。
;; その数値が2つの整数から等距離にある場合は、ゼロから四捨五入する。
;; 例
;; >>> (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.
(define (closest_integer value)
|
reworded
|
transform
|
HumanEval_99_closest_integer
|
(require rackunit)
(define (test-humaneval)
(let (( candidate closest_integer))
(check-within (candidate "10") 10 0.001)
(check-within (candidate "14.5") 15 0.001)
(check-within (candidate "-15.5") -16 0.001)
(check-within (candidate "15.3") 15 0.001)
(check-within (candidate "0") 0 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_99_closest_integer.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; 正の整数nが与えられたとき、n段の石の山を作らなければならない。
;; 最初の段にはn個の石がある。
;; 次の段の石の数は
;; - nが奇数なら次の奇数。
;; - nが偶数なら次の偶数。
;; 各段の石の数をリストで返す。インデックス i の要素は、段 (i+1) の石の
;; 数を表すものとする。
;; 例:
;; >>> (make_a_pile 3)
;; (list 3 5 7)
(define (make_a_pile n)
|
reworded
|
transform
|
HumanEval_100_make_a_pile
|
(require rackunit)
(define (test-humaneval)
(let (( candidate make_a_pile))
(check-within (candidate 3) (list 3 5 7) 0.001)
(check-within (candidate 4) (list 4 6 8 10) 0.001)
(check-within (candidate 5) (list 5 7 9 11 13) 0.001)
(check-within (candidate 6) (list 6 8 10 12 14 16) 0.001)
(check-within (candidate 8) (list 8 10 12 14 16 18 20 22) 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_100_make_a_pile.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; カンマまたは空白で区切られた単語の文字列が与えられる。あなたのタスクは、
;; 文字列を単語に分割し、単語の配列を返すことである。
;; 例えば:
;; >>> (words_string "Hi, my name is John")
;; (list "Hi" "my" "name" "is" "John")
;; >>> (words_string "One, two, three, four, five, six")
;; (list "One" "two" "three" "four" "five" "six")
(define (words_string s)
|
reworded
|
transform
|
HumanEval_101_words_string
|
(require rackunit)
(define (test-humaneval)
(let (( candidate words_string))
(check-within (candidate "Hi, my name is John") (list "Hi" "my" "name" "is" "John") 0.001)
(check-within (candidate "One, two, three, four, five, six") (list "One" "two" "three" "four" "five" "six") 0.001)
(check-within (candidate "Hi, my name") (list "Hi" "my" "name") 0.001)
(check-within (candidate "One,, two, three, four, five, six,") (list "One" "two" "three" "four" "five" "six") 0.001)
(check-within (candidate "") (list ) 0.001)
(check-within (candidate "ahmed , gamal") (list "ahmed" "gamal") 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_101_words_string.py
|
rkt
|
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] |
#lang racket
;; この関数は2つの正の数xとyを受け取り、範囲[x, y](両端を含む)に含まれる
;; 最大の偶数整数を返す。そのような数がない場合、関数は-1を返す。
;; 例えば:
;; >>> (choose_num 12 15)
;; 14
;; >>> (choose_num 13 12)
;; -1
(define (choose_num x y)
|
reworded
|
transform
|
HumanEval_102_choose_num
|
(require rackunit)
(define (test-humaneval)
(let (( candidate choose_num))
(check-within (candidate 12 15) 14 0.001)
(check-within (candidate 13 12) -1 0.001)
(check-within (candidate 33 12354) 12354 0.001)
(check-within (candidate 5234 5233) -1 0.001)
(check-within (candidate 6 29) 28 0.001)
(check-within (candidate 27 10) -1 0.001)
(check-within (candidate 7 7) -1 0.001)
(check-within (candidate 546 546) 546 0.001)
))
(test-humaneval)
|
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_102_choose_num.py
|
rkt
|
End of preview. Expand
in Data Studio
- Downloads last month
- 5