stop_tokens listlengths 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
;; 2つの正の整数nとmが与えられており、あなたのタスクはnからmまでの
;; 整数(nとmを含む)の平均を計算することである。
;; 答えを最も近い整数に丸め、2進数に変換せよ。
;; nがmより大きい場合は-1を返す。
;; 例:
;; >>> (rounded_avg 1 5)
;; "0b11"
;; >>> (rounded_avg 7 5)
;; -1
;; >>> (rounded_avg 10 20)
;; "0b1111"
;; >>> (rounded_avg 20 33)
;; "0b11010"
(define (rounded_avg n m)
| reworded | transform | HumanEval_103_rounded_avg | (require rackunit)
(define (test-humaneval)
(let (( candidate rounded_avg))
(check-within (candidate 1 5) "0b11" 0.001)
(check-within (candidate 7 13) "0b1010" 0.001)
(check-within (candidate 964 977) "0b1111001010" 0.001)
(check-within (candidate 996 997) "0b1111100100" 0.001)
(check-within (c... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_103_rounded_avg.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 正の整数xのリストが与えられたとき、偶数桁の要素を持たない全ての
;; 要素をソートしたリストを返す。
;;注意: 返されるリストは昇順にソートされていなければならない。
;; 例えば:
;; >>> (unique_digits (list 15 33 1422 1))
;; (list 1 15 33)
;; >>> (unique_digits (list 152 323 1422 10))
;; (list )
(define (unique_digits x)
| reworded | transform | HumanEval_104_unique_digits | (require rackunit)
(define (test-humaneval)
(let (( candidate unique_digits))
(check-within (candidate (list 15 33 1422 1)) (list 1 15 33) 0.001)
(check-within (candidate (list 152 323 1422 10)) (list ) 0.001)
(check-within (candidate (list 12345 2033 111 151)) (list 111 151) 0.001)
(check-within (... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_104_unique_digits.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 整数の配列が与えられたとき、1から9までの整数をソートし、
;; 得られた配列を逆順にし、各桁を以下の数字に相当する名前に置き換える。
;; "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine".
;; 例えば:
;; >>> (by_length (list 2 1 1 4 5 8 2 3))
;; (list "Eight" "Five" "Four" "Three" "Two" "Two" "One" "One")
;; もし空配列なら、空配列を返す:
;; >>> (by_length (list )... | reworded | transform | HumanEval_105_by_length | (require rackunit)
(define (test-humaneval)
(let (( candidate by_length))
(check-within (candidate (list 2 1 1 4 5 8 2 3)) (list "Eight" "Five" "Four" "Three" "Two" "Two" "One" "One") 0.001)
(check-within (candidate (list )) (list ) 0.001)
(check-within (candidate (list 1 -1 55)) (list "One") 0.001)
... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_105_by_length.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; iは1から始まる。iの階乗は1からiまでの数の掛け算(1 * 2 * ... * i)である。
;; 例:
;; >>> (f 5)
;; (list 1 2 6 24 15)
(define (f n)
| reworded | transform | HumanEval_106_f | (require rackunit)
(define (test-humaneval)
(let (( candidate f))
(check-within (candidate 5) (list 1 2 6 24 15) 0.001)
(check-within (candidate 7) (list 1 2 6 24 15 720 28) 0.001)
(check-within (candidate 1) (list 1) 0.001)
(check-within (candidate 3) (list 1 2 6) 0.001)
))
(test-humaneval) | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_106_f.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 与えられた正の整数 nに対して、範囲 1 から n まで(両端を含む)に存在する
;; 偶数の回文数(integer palindrome)と奇数の回文数の個数をタプル形式で返す。
;; 例 1:
;; >>> (even_odd_palindrome 3)
;; (list 1 2)
;; 解説:
;; 回文数は1、2、3であり、そのうち1つは偶数、2つは奇数である。\n;; 例 2:
;; >>> (even_odd_palindrome 12)
;; (list 4 6)
;; 解説:
;; 回文数は、1、2、3、4、5、6、7、8、9、11であり、そのうち4つ... | reworded | transform | HumanEval_107_even_odd_palindrome | (require rackunit)
(define (test-humaneval)
(let (( candidate even_odd_palindrome))
(check-within (candidate 123) (list 8 13) 0.001)
(check-within (candidate 12) (list 4 6) 0.001)
(check-within (candidate 3) (list 1 2) 0.001)
(check-within (candidate 63) (list 6 8) 0.001)
(check-within (candida... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_107_even_odd_palindrome.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; count_nums 関数は、整数の配列を引数として受け取り、その配列内の各整数の各桁の合計が
;; >0 となるような整数の個数を返す。負の数に関しては、最初の桁(符号付き桁)は負となる。
;; たとえば、−123 の符号付き桁は −1, 2, 3 である。
;; >>> (count_nums (list ))
;; 0
;; >>> (count_nums (list -1 11 -11))
;; 1
;; >>> (count_nums (list 1 1 2))
;; 3
(define (count_nums arr)
| reworded | transform | HumanEval_108_count_nums | (require rackunit)
(define (test-humaneval)
(let (( candidate count_nums))
(check-within (candidate (list )) 0 0.001)
(check-within (candidate (list -1 -2 0)) 0 0.001)
(check-within (candidate (list 1 1 2 -2 3 4 5)) 6 0.001)
(check-within (candidate (list 1 6 9 -6 0 1 5)) 5 0.001)
(check-within... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_108_count_nums.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; N個の整数arr[1], arr[2], ..., arr[N]なる配列 'arr' があります。
;; この配列の数字はランダムな順番に並んでいます。あなたの課題は、以下の操作を何度でも行うことで、
;; 配列を非減少.の順番にソートできるかどうかを判断することです。
;; 操作として許されているのは「右シフト」です。
;; 一回の「右シフト」操作とは、配列のすべての要素を右方向に一つずつずらすことを意味します。
;; 配列の最後の要素は配列の先頭、すなわち0番目のインデックスに移動します。
;; 上記の操作を行ってソートされた配列を得られる場合は #t を、そうでない場合は #f を返し... | reworded | transform | HumanEval_109_move_one_ball | (require rackunit)
(define (test-humaneval)
(let (( candidate move_one_ball))
(check-within (candidate (list 3 4 5 1 2)) #t 0.001)
(check-within (candidate (list 3 5 10 1 2)) #t 0.001)
(check-within (candidate (list 4 3 1 2)) #f 0.001)
(check-within (candidate (list 3 5 4 1 2)) #f 0.001)
(check... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_109_move_one_ball.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; この問題では、2つの数のリストを受け取り、lst1を偶数のみのリストに
;; するために、それらの間で要素の交換を行うことが可能かどうかを判断す
;; る関数を実装する。
;; lst1とlst2の間で交換される要素の数に制限はない。
;; lst1とlst2の間で要素の交換を行い、lst1の要素をすべて偶数にすることが
;; 可能であれば、"YES "を返す。
;; そうでなければ "NO "を返す。
;; 例えば:
;; >>> (exchange (list 1 2 3 4) (list 1 2 3 4))
;; "YES"
;; >>> (exchange (list 1 2 3 4) (l... | reworded | transform | HumanEval_110_exchange | (require rackunit)
(define (test-humaneval)
(let (( candidate exchange))
(check-within (candidate (list 1 2 3 4) (list 1 2 3 4)) "YES" 0.001)
(check-within (candidate (list 1 2 3 4) (list 1 5 3 4)) "NO" 0.001)
(check-within (candidate (list 1 2 3 4) (list 2 1 4 3)) "YES" 0.001)
(check-within (candi... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_110_exchange.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 空白で区切られた小文字を表す文字列が与えられる。最も出現回数が多い文字と
;; 対応するカウントの辞書を返す。
;; 複数の文字が同じ出現回数を持つ場合、それらすべてを返す。
;; 例:
;; >>> (histogram "a b c")
;; #hash(("a" . 1) ("b" . 1) ("c" . 1))
;; >>> (histogram "a b b a")
;; #hash(("a" . 2) ("b" . 2))
;; >>> (histogram "a b c a b")
;; #hash(("a" . 2) ("b" . 2))
;; >>> (histogr... | reworded | transform | HumanEval_111_histogram | (require rackunit)
(define (test-humaneval)
(let (( candidate histogram))
(check-within (candidate "a b b a") #hash(("a" . 2) ("b" . 2)) 0.001)
(check-within (candidate "a b c a b") #hash(("a" . 2) ("b" . 2)) 0.001)
(check-within (candidate "a b c d g") #hash(("a" . 1) ("b" . 1) ("c" . 1) ("d" .... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_111_histogram.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 課題
;; sとcの2つの文字列が与えられる。sに含まれる文字のうち、cに含まれる文字と
;; 等しいものをすべて削除し、その結果の文字列が回文かどうかをチェックする。
;; 文字列は、後ろから読んでも前から読んでも同じであれば回文と呼ばれる。
;; 結果文字列とチェックのための#t/#fを含むタプルを返す必要がある。
;; 例
;; >>> (reverse_delete "abcde" "ae")
;; (list "bcd" #f)
;; >>> (reverse_delete "abcdef" "b")
;; (list "acdef" #f)
;; >>> (reverse_delete ... | reworded | transform | HumanEval_112_reverse_delete | (require rackunit)
(define (test-humaneval)
(let (( candidate reverse_delete))
(check-within (candidate "abcde" "ae") (list "bcd" #f) 0.001)
(check-within (candidate "abcdef" "b") (list "acdef" #f) 0.001)
(check-within (candidate "abcdedcba" "ab") (list "cdedc" #t) 0.001)
(check-within (candidate "... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_112_reverse_delete.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; ;; 数字のみで構成された文字列のリストを引数として受け取り、新しいリストを返します。
;; 出力される新しいリストの各要素は、"the number of odd elements in the string i of the
;; input."となりますが、この文字列内のすべての 'i' は、入力リストのi番目の文字列に含ま
;; る奇数の数に置き換えられます。
;; >>> (odd_count (list "1234567"))
;; (list "the number of odd elements 4n the str4ng 4 of the 4nput.")
;; >>> (odd... | reworded | transform | HumanEval_113_odd_count | (require rackunit)
(define (test-humaneval)
(let (( candidate odd_count))
(check-within (candidate (list "1234567")) (list "the number of odd elements 4n the str4ng 4 of the 4nput.") 0.001)
(check-within (candidate (list "3" "11111111")) (list "the number of odd elements 1n the str1ng 1 of the 1nput." "the... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_113_odd_count.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 整数の配列 nums が与えられたとき、nums の空でない部分配列の最小和を求めよ。
;; 例:
;; >>> (minSubArraySum (list 2 3 4 1 2 4))
;; 1
;; >>> (minSubArraySum (list -1 -2 -3))
;; -6
(define (minSubArraySum nums)
| reworded | transform | HumanEval_114_minSubArraySum | (require rackunit)
(define (test-humaneval)
(let (( candidate minSubArraySum))
(check-within (candidate (list 2 3 4 1 2 4)) 1 0.001)
(check-within (candidate (list -1 -2 -3)) -6 0.001)
(check-within (candidate (list -1 -2 -3 2 -10)) -14 0.001)
(check-within (candidate (list -9999999999999999)) -999... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_114_minSubArraySum.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 長方形のグリッド状(grid)の井戸が与えられる。各行が1つの井戸を表し、
;; 行の1が1単位の水を表す。
;; 各井戸には,そこから水を汲み上げるのに使える対応するバケツがあり,
;; すべてのバケツ容量(capacity)は同じである.
;; あなたの仕事は,バケツを使って井戸を空にすることである.
;; バケツを降ろす回数を出力せよ.
;; 例 1:
;; >>> (max_fill (list (list 0 0 1 0) (list 0 1 0 0) (list 1 1 1 1)) 1)
;; 6
;; 例 2:
;; >>> (max_fill (list (list 0 0 1 ... | reworded | transform | HumanEval_115_max_fill | (require rackunit)
(define (test-humaneval)
(let (( candidate max_fill))
(check-within (candidate (list (list 0 0 1 0) (list 0 1 0 0) (list 1 1 1 1)) 1) 6 0.001)
(check-within (candidate (list (list 0 0 1 1) (list 0 0 0 0) (list 1 1 1 1) (list 0 1 1 1)) 2) 5 0.001)
(check-within (candidate (list (list ... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_115_max_fill.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; この問題では、非負整数の配列を2進数表現における"1"の個数を昇順でソートする。
;; "1"の個数が同じ場合は,10進数に基づいてソートする。
;; 次のように実装する:
;; >>> (sort_array (list 1 5 2 3 4))
;; (list 1 2 3 4 5)
;; >>> (sort_array (list -2 -3 -4 -5 -6))
;; (list -6 -5 -4 -3 -2)
;; >>> (sort_array (list 1 0 2 3 4))
;; (list 0 1 2 3 4)
(define (sort_array arr)
| reworded | transform | HumanEval_116_sort_array | (require rackunit)
(define (test-humaneval)
(let (( candidate sort_array))
(check-within (candidate (list 1 5 2 3 4)) (list 1 2 4 3 5) 0.001)
(check-within (candidate (list -2 -3 -4 -5 -6)) (list -4 -2 -6 -5 -3) 0.001)
(check-within (candidate (list 1 0 2 3 4)) (list 0 1 2 4 3) 0.001)
(check-within... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_116_sort_array.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; ある文字列sと自然数nが与えらる。あなたに課せられたタスクは、文字列s
;; の中から、ちょうどn個の子音を含むすべての単語のリストを現れる順に返す
;; 関数を実装することである。
;; 注意:入力文字列には英文字と空白しか含まれないと仮定してもよい。
;; 例:
;; >>> (select_words "Mary had a little lamb" 4)
;; (list "little")
;; >>> (select_words "Mary had a little lamb" 3)
;; (list "Mary" "lamb")
;; >>> (select_words "simple... | reworded | transform | HumanEval_117_select_words | (require rackunit)
(define (test-humaneval)
(let (( candidate select_words))
(check-within (candidate "Mary had a little lamb" 4) (list "little") 0.001)
(check-within (candidate "Mary had a little lamb" 3) (list "Mary" "lamb") 0.001)
(check-within (candidate "simple white space" 2) (list ) 0.001)
(... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_117_select_words.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 単語が与えられる。あなたの仕事は、単語の右側から2つの子音(大文字と
;; 小文字を区別)の間に立っている最も近い母音を見つけることである。
;; 最初と最後の母音はカウントされない。上記の条件を満たす母音が見つから
;; なかった場合は、空の文字列を返せ。
;; 指定された文字列は英字のみを含むとみなしてよい。
;; 例:
;; >>> (get_closest_vowel "yogurt")
;; "u"
;; >>> (get_closest_vowel "FULL")
;; "U"
;; >>> (get_closest_vowel "quick")
;; ""
;; >>> (get_cl... | reworded | transform | HumanEval_118_get_closest_vowel | (require rackunit)
(define (test-humaneval)
(let (( candidate get_closest_vowel))
(check-within (candidate "yogurt") "u" 0.001)
(check-within (candidate "full") "u" 0.001)
(check-within (candidate "easy") "" 0.001)
(check-within (candidate "eAsy") "" 0.001)
(check-within (candidate "ali") "" 0.... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_118_get_closest_vowel.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 2つの文字列からなるリストが与えられます。両方の文字列は開き括弧 '(' または
;; 閉じ括弧 ')' のみで構成されています。
;; あなたの仕事は、2つの文字列を何らかの順序で結合して、「良い」文字列にすることが
;; 可能かどうかを確認することです。
;; 文字列Sが「良い」とは、文字列内のすべての括弧がバランスしている場合に限ります。
;; 例えば、文字列 '(())()' は良いですが、文字列 '())' は良くありません。
;; 良い文字列を作る方法がある場合は 'Yes' を返し、そうでない場合は 'No' を返してください。
;; 例
;; >>> (match_parens (l... | reworded | transform | HumanEval_119_match_parens | (require rackunit)
(define (test-humaneval)
(let (( candidate match_parens))
(check-within (candidate (list "()(" ")")) "Yes" 0.001)
(check-within (candidate (list ")" ")")) "No" 0.001)
(check-within (candidate (list "(()(())" "())())")) "No" 0.001)
(check-within (candidate (list ")())" "(()()(")) ... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_119_match_parens.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 整数の配列 arr と正の整数 k が与えられる。arr に含まれる大きい方から k 個の数を含む
;; 長さ k のソート済みリストを返す。
;; 例 1:
;; >>> (maximum (list -3 -4 5) 3)
;; (list -4 -3 5)
;; 例 2:
;; >>> (maximum (list 4 -4 4) 2)
;; (list 4 4)
;; 例 3:
;; >>> (maximum (list -3 2 1 2 -1 -2 1) 1)
;; (list 2)
;; ノート:
;; 1. 配列の長さは[1, 1000]の範囲とする。
;; 2. 配列... | reworded | transform | HumanEval_120_maximum | (require rackunit)
(define (test-humaneval)
(let (( candidate maximum))
(check-within (candidate (list -3 -4 5) 3) (list -4 -3 5) 0.001)
(check-within (candidate (list 4 -4 4) 2) (list 4 4) 0.001)
(check-within (candidate (list -3 2 1 2 -1 -2 1) 1) (list 2) 0.001)
(check-within (candidate (list 123... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_120_maximum.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 整数の空でないリストが与えられた時、偶数の位置にある奇数の要素の合計を返す。
;; 例
;; >>> (solution (list 5 8 7 1))
;; 12
;; >>> (solution (list 3 3 3 3 3))
;; 9
;; >>> (solution (list 30 13 24 321))
;; 0
(define (solution lst)
| reworded | transform | HumanEval_121_solution | (require rackunit)
(define (test-humaneval)
(let (( candidate solution))
(check-within (candidate (list 5 8 7 1)) 12 0.001)
(check-within (candidate (list 3 3 3 3 3)) 9 0.001)
(check-within (candidate (list 30 13 24 321)) 0 0.001)
(check-within (candidate (list 5 9)) 5 0.001)
(check-within (can... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_121_solution.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 整数の空でない配列 arr と整数 k が与えられたとき、
;; arr の最初の k 個の要素から高々 2 桁までの要素の和を返す。
;; 例:
;; >>> (add_elements (list 111 21 3 4000 5 6 7 8 9) 4)
;; 24
;; 制約:
;; 1. 1 <= len(arr) <= 100
;; 2. 1 <= k <= len(arr)
(define (add_elements arr k)
| reworded | transform | HumanEval_122_add_elements | (require rackunit)
(define (test-humaneval)
(let (( candidate add_elements))
(check-within (candidate (list 1 -2 -3 41 57 76 87 88 99) 3) -4 0.001)
(check-within (candidate (list 111 121 3 4000 5 6) 2) 0 0.001)
(check-within (candidate (list 11 21 3 90 5 6 7 8 9) 4) 125 0.001)
(check-within (candid... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_122_add_elements.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 正の整数nが与えられたとき、コラッツ数列の奇数を持つソートされたリストを返す。
;; コラッツ予想とは数学の予想で、次のように定義される数列に関するものである:
;; 任意の正の整数nから始め、各項は前の項から次のように求められる。
;; 前の項が偶数なら、次の項は前の項の2分の1である。前の項が奇数の場合、次の項は前の項の3倍+1である。
;; 予想では、nがどのような値であっても、数列は必ず1に達する。
;; 注:
;; 1. Collatz(1)は[1]である。
;; 2. 返されるリストは昇順にソートされている。
;; 例えば:
;; get_odd_collatz(5) ... | reworded | transform | HumanEval_123_get_odd_collatz | (require rackunit)
(define (test-humaneval)
(let (( candidate get_odd_collatz))
(check-within (candidate 14) (list 1 5 7 11 13 17) 0.001)
(check-within (candidate 5) (list 1 5) 0.001)
(check-within (candidate 12) (list 1 3 5) 0.001)
(check-within (candidate 1) (list 1) 0.001)
))
(test-humaneval) | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_123_get_odd_collatz.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 与えられた日付文字列を検証し、その日付が有効であれば#tを、そうでなければ#fを返す関数を書く必要がある。
;; T日付が有効であるのは、以下のルールがすべて満たされている場合である:
;; 1. 日付文字列が空でない。
;;2. 日数が、月1,3,5,7,8,10,12の場合、1日以上31日以下である。また、月4,6,9,11については、日数が1以上30日以下である。また、月2については、日数が1以上29以下であること。
;; 3. 月は1未満または12以上であってはならない。
;; 4. 日付はmm-dd-yyyyの形式でなければならない。
;; >>> (valid_date "03-11-2... | reworded | transform | HumanEval_124_valid_date | (require rackunit)
(define (test-humaneval)
(let (( candidate valid_date))
(check-within (candidate "03-11-2000") #t 0.001)
(check-within (candidate "15-01-2012") #f 0.001)
(check-within (candidate "04-0-2040") #f 0.001)
(check-within (candidate "06-04-2020") #t 0.001)
(check-within (candidate ... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_124_valid_date.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 単語の文字列が与えられた場合、空白で分割された単語のリストを返す。
;; テキスト中に空白が存在しない場合は、カンマ ',' で分割する必要がある。カンマが存在しない場合は、
;; アルファベットの奇数順の小文字の数を返す必要がある。ord('a') = 0, ord('b') = 1, ... ord('z') = 25
;; 例
;; >>> (split_words "Hello world!")
;; (list "Hello" "world!")
;; >>> (split_words "Hello,world!")
;; (list "Hello" "world!")
;; >>> (s... | reworded | transform | HumanEval_125_split_words | (require rackunit)
(define (test-humaneval)
(let (( candidate split_words))
(check-within (candidate "Hello world!") (list "Hello" "world!") 0.001)
(check-within (candidate "Hello,world!") (list "Hello" "world!") 0.001)
(check-within (candidate "Hello world,!") (list "Hello" "world,!") 0.001)
(chec... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_125_split_words.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 数字のリストが与えられたとき、昇順に整列されているかどうかを返す。
;; リストに同じ数の重複が1つ以上ある場合は、#fを返す。
;; 負の数はなく、整数のみであると仮定する。
;; 例
;; >>> (is_sorted (list 5))
;; #t
;; >>> (is_sorted (list 1 2 3 4 5))
;; #t
;; >>> (is_sorted (list 1 3 2 4 5))
;; #f
;; >>> (is_sorted (list 1 2 3 4 5 6))
;; #t
;; >>> (is_sorted (list 1 2 3 4 5 6 7))
;; #t
... | reworded | transform | HumanEval_126_is_sorted | (require rackunit)
(define (test-humaneval)
(let (( candidate is_sorted))
(check-within (candidate (list 5)) #t 0.001)
(check-within (candidate (list 1 2 3 4 5)) #t 0.001)
(check-within (candidate (list 1 3 2 4 5)) #f 0.001)
(check-within (candidate (list 1 2 3 4 5 6)) #t 0.001)
(check-within (... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_126_is_sorted.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 2つの区間が与えられます。
;; それぞれの区間は整数のペアで示されます。例えば、区間 = (start, end ) = (1, 2) です。
;; 与えられた区間は閉区間であり、start と end の両端が含まれます。
;; 各区間について、start は end 以下であると仮定します。
;; あなたの仕事は、これら2つの区間の交差部分の長さが素数であるかどうかを判断することです。
;; 例えば、区間 (1, 3) と (2, 4) の交差部分は (2, 3) で、その長さは1ですが、これは素数ではありません。
;; 交差部分の長さが素数であれば "YES" を返し、そうでな... | reworded | transform | HumanEval_127_intersection | (require rackunit)
(define (test-humaneval)
(let (( candidate intersection))
(check-within (candidate (list 1 2) (list 2 3)) "NO" 0.001)
(check-within (candidate (list -1 1) (list 0 4)) "NO" 0.001)
(check-within (candidate (list -3 -1) (list -5 5)) "YES" 0.001)
(check-within (candidate (list -2 2) ... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_127_intersection.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 整数の配列 arr が与えられます。この配列に含まれる各数値の絶対値の合計と、
;; 各数値の符号(プラスは1、マイナスは-1、ゼロは0)の積を掛け合わせた値を
;; 返してください。
;; 注意:配列`arr`が空の場合は`#f`を返してください。
;; 例::
;; >>> (prod_signs (list 1 2 2 -4))
;; 9
;; >>> (prod_signs (list 0 1))
;; 0
;; >>> (prod_signs (list ))
;; #f
(define (prod_signs arr)
| reworded | transform | HumanEval_128_prod_signs | (require rackunit)
(define (test-humaneval)
(let (( candidate prod_signs))
(check-within (candidate (list 1 2 2 -4)) -9 0.001)
(check-within (candidate (list 0 1)) 0 0.001)
(check-within (candidate (list 1 1 1 2 3 -1 1)) -10 0.001)
(check-within (candidate (list )) #f 0.001)
(check-within (cand... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_128_prod_signs.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; N行とN列 (N >= 2)) のグリッドと正の整数kが与えられた場合、各セルには値が含まれている。
;; 囲[1, N * N](両端を含む)のすべての整数は、グリッドのセルに一度だけ表れる。
;; このグリッド内で長さkの最短の経路を見つける必要がある。任意のセルからスタートでき、
;; 各ステップで隣接するセルに移動できる。言い換えれば、現在のセルと辺を共有するセルに
;; 移動できる。長さkの経路とは、正確にk個のセル(必ずしも異なるとは限らない)を訪れる
;; ことを意味する。ただし、グリッドから出ることはない。
;; 長さkの2つの経路AとBがある場合、AとBが通るセルの値を順番にリスト... | reworded | transform | HumanEval_129_minPath | (require rackunit)
(define (test-humaneval)
(let (( candidate minPath))
(check-within (candidate (list (list 1 2 3) (list 4 5 6) (list 7 8 9)) 3) (list 1 2 1) 0.001)
(check-within (candidate (list (list 5 9 3) (list 4 1 6) (list 7 8 2)) 1) (list 1) 0.001)
(check-within (candidate (list (list 1 2 3 4) (... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_129_minPath.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; フィボナッチ数列は、ここ数世紀の間に数学者によって深く研究され、誰もが知っている。
;; しかし、人々が知らないのはトリボナッチ数列である。
;; トリボナッチ数列は再帰によって定義される:
;; tri(1) = 3
;; tri(n) = 1 + n / 2, n が偶数の場合.
;; tri(n) = tri(n - 1) + tri(n - 2) + tri(n + 1), n が奇数の場合
;; 例えば:
;; tri(2) = 1 + (2 / 2) = 2
;; tri(4) = 3
;; tri(3) = tri(2) + tri(1) + tri(4)
;; = 2... | reworded | transform | HumanEval_130_tri | (require rackunit)
(define (test-humaneval)
(let (( candidate tri))
(check-within (candidate 3) (list 1 3 2 8) 0.001)
(check-within (candidate 4) (list 1 3 2 8 3) 0.001)
(check-within (candidate 5) (list 1 3 2 8 3 15) 0.001)
(check-within (candidate 6) (list 1 3 2 8 3 15 4) 0.001)
(check-within... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_130_tri.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 正の整数 n が与えられた時、奇数桁数の積を返す。
;; 全ての桁が偶数の場合は0を返す。
;; 例えば:
;; >>> (digits 1)
;; 1
;; >>> (digits 4)
;; 0
;; >>> (digits 235)
;; 15
(define (digits n)
| reworded | transform | HumanEval_131_digits | (require rackunit)
(define (test-humaneval)
(let (( candidate digits))
(check-within (candidate 5) 5 0.001)
(check-within (candidate 54) 5 0.001)
(check-within (candidate 120) 1 0.001)
(check-within (candidate 5014) 5 0.001)
(check-within (candidate 98765) 315 0.001)
(check-within (candidat... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_131_digits.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; この関数は、角括弧だけを含む文字列を入力として受け取ります。括弧が有効な順序で
;; 並んでいて、その中に少なくとも1つの括弧が入れ子になっている場合、関数は#tを
;; 返すようにしてください。
;; >>> (is_nested "[[]]")
;; #t
;; >>> (is_nested "[]]]]]]][[[[[]")
;; #f
;; >>> (is_nested "[][]")
;; #f
;; >>> (is_nested "[]")
;; #f
;; >>> (is_nested "[[][]]")
;; #t
;; >>> (is_nested "[[]][[")
;; #t
... | reworded | transform | HumanEval_132_is_nested | (require rackunit)
(define (test-humaneval)
(let (( candidate is_nested))
(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 "[[[[]]]]") #t 0... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_132_is_nested.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 数字のリストが与えられます。
;; 与えられたリスト内の各数値をまず切り上げ(天井関数を使って最も近い整数に丸める)、
;; その後それぞれの数値を二乗した値の合計を返してください。
;; 例:
;; >>> (lst (list 1.0 2.0 3.0))
;; 14
;; >>> (lst (list 1.0 4.0 9.0))
;; 98
;; >>> (lst (list 1.0 3.0 5.0 7.0))
;; 84
;; >>> (lst (list 1.4 4.2 0.0))
;; 29
;; >>> (lst (list -2.4 1.0 1.0))
;; 6
(define (su... | reworded | transform | HumanEval_133_sum_squares | (require rackunit)
(define (test-humaneval)
(let (( candidate sum_squares))
(check-within (candidate (list 1.0 2.0 3.0)) 14 0.001)
(check-within (candidate (list 1.0 2.0 3.0)) 14 0.001)
(check-within (candidate (list 1.0 3.0 5.0 7.0)) 84 0.001)
(check-within (candidate (list 1.4 4.2 0.0)) 29 0.001)... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_133_sum_squares.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 与えられた文字列の最後の文字がアルファベットであり、かつ単語の一部でなければ#tを、
;; そうでなければ#fを返す関数を作成せよ。
;; 注意:単語とはスペースで区切られた文字の並びである。
;; 例:
;; >>> (check_if_last_char_is_a_letter "apple pie")
;; #f
;; >>> (check_if_last_char_is_a_letter "apple pi e")
;; #t
;; >>> (check_if_last_char_is_a_letter "apple pi e ")
;; #f
;; >>> (check_if_last_c... | reworded | transform | HumanEval_134_check_if_last_char_is_a_letter | (require rackunit)
(define (test-humaneval)
(let (( candidate check_if_last_char_is_a_letter))
(check-within (candidate "apple") #f 0.001)
(check-within (candidate "apple pi e") #t 0.001)
(check-within (candidate "eeeee") #f 0.001)
(check-within (candidate "A") #t 0.001)
(check-within (candidat... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_134_check_if_last_char_is_a_letter.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 直前の要素よりも大きくない要素の中で、最も大きなインデックスを持つ要素を探して
;; そのインデックスを返す関数を作成してください。そのような要素が存在しない場合は、
;; -1を返してください。与えられる配列には重複する値は含まれません。
;; 例:
;; >>> (can_arrange (list 1 2 4 3 5))
;; 3
;; >>> (can_arrange (list 1 2 3))
;; -1
(define (can_arrange arr)
| reworded | transform | HumanEval_135_can_arrange | (require rackunit)
(define (test-humaneval)
(let (( candidate can_arrange))
(check-within (candidate (list 1 2 4 3 5)) 3 0.001)
(check-within (candidate (list 1 2 4 5)) -1 0.001)
(check-within (candidate (list 1 4 2 5 6 7 8 9 10)) 2 0.001)
(check-within (candidate (list 4 8 5 7 3)) 4 0.001)
(ch... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_135_can_arrange.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; リストから最も大きな負の整数と最も小さな正の整数を見つけ、それらをタプル(a, b)
;; として返す関数を作成してください。リストに負の整数もしくは正の整数がない場合は、
;; 代わりに#fを返します。
;; 例:
;; >>> (largest_smallest_integers (list 2 4 1 3 5 7))
;; (list #f 1)
;; >>> (largest_smallest_integers (list ))
;; (list #f #f)
;; >>> (largest_smallest_integers (list 0))
;; (list #f #f)
(defin... | reworded | transform | HumanEval_136_largest_smallest_integers | (require rackunit)
(define (test-humaneval)
(let (( candidate largest_smallest_integers))
(check-within (candidate (list 2 4 1 3 5 7)) (list #f 1) 0.001)
(check-within (candidate (list 2 4 1 3 5 7 0)) (list #f 1) 0.001)
(check-within (candidate (list 1 3 2 4 5 6 -2)) (list -2 1) 0.001)
(check-withi... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_136_largest_smallest_integers.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 整数、浮動小数点数、または実数を表す文字列を引数として受け取り、その中で最も大きい値を
;; その元の型で返す関数を作成してください。もし値が同じであれば、#fを返してください。
;; 注意:実数が文字列として表されている場合、小数点はピリオド(.)またはカンマ(,)の可能性があります。
;; >>> (compare_one 1 2.5)
;; 2.5
;; >>> (compare_one 1 "2,3")
;; "2,3"
;; >>> (compare_one "5,1" "6")
;; "6"
;; >>> (compare_one "1" 1)
;; #f
(define (compar... | reworded | transform | HumanEval_137_compare_one | (require rackunit)
(define (test-humaneval)
(let (( candidate compare_one))
(check-within (candidate 1 2) 2 0.001)
(check-within (candidate 1 2.5) 2.5 0.001)
(check-within (candidate 2 3) 3 0.001)
(check-within (candidate 5 6) 6 0.001)
(check-within (candidate 1 "2,3") "2,3" 0.001)
(check-w... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_137_compare_one.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 与えられた数値nが、ちょうど4つの正の偶数の合計として表現できるかどうかを評価してください。
;; 例
;; >>> (is_equal_to_sum_even 4)
;; #f
;; >>> (is_equal_to_sum_even 6)
;; #f
;; >>> (is_equal_to_sum_even 8)
;; #t
(define (is_equal_to_sum_even n)
| reworded | transform | HumanEval_138_is_equal_to_sum_even | (require rackunit)
(define (test-humaneval)
(let (( candidate is_equal_to_sum_even))
(check-within (candidate 4) #f 0.001)
(check-within (candidate 6) #f 0.001)
(check-within (candidate 8) #t 0.001)
(check-within (candidate 10) #t 0.001)
(check-within (candidate 11) #f 0.001)
(check-within ... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_138_is_equal_to_sum_even.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; ブラジリアン階乗は次のように定義される:
;; brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1!
;; where n > 0
;; 例えば:
;; >>> (special_factorial 4)
;; 288
;; この関数は入力として整数を受け取り、整数の特殊な階乗を返す。
;; factorial of this integer.
(define (special_factorial n)
| reworded | transform | HumanEval_139_special_factorial | (require rackunit)
(define (test-humaneval)
(let (( candidate special_factorial))
(check-within (candidate 4) 288 0.001)
(check-within (candidate 5) 34560 0.001)
(check-within (candidate 7) 125411328000 0.001)
(check-within (candidate 1) 1 0.001)
))
(test-humaneval) | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_139_special_factorial.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 文字列テキストが与えられた場合、その中のすべての空白をアンダースコアに置換し、
;; 文字列が2つ以上の連続した空白を持つ場合、すべての連続した空白を - に置換する
;; >>> (fix_spaces " Example")
;; "Example"
;; >>> (fix_spaces " Example 1")
;; "Example_1"
;; >>> (fix_spaces " Example 2")
;; "_Example_2"
;; >>> (fix_spaces " Example 3")
;; "_Example-3"
(define (fix_spaces text)
| reworded | transform | HumanEval_140_fix_spaces | (require rackunit)
(define (test-humaneval)
(let (( candidate fix_spaces))
(check-within (candidate "Example") "Example" 0.001)
(check-within (candidate "Mudasir Hanif ") "Mudasir_Hanif_" 0.001)
(check-within (candidate "Yellow Yellow Dirty Fellow") "Yellow_Yellow__Dirty__Fellow" 0.001)
(check-wi... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_140_fix_spaces.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; ファイル名を表す文字列を受け取り、そのファイル名が有効であれば'Yes'を返し、そうでなければ'No'
;; を返す関数を作成する。ファイル名が有効であるとみなされるのは、
;; 以下の条件をすべて満たす場合のみである:
;; - ファイル名に3桁以上の数字('0'-'9')があってはならない。
;; - ファイル名に含まれるドット '.' はひとつのみ。
;; - ドットの前の部分文字列は空であってはならず、英文字('a'-'z'および'A'-'Z')から始まる文字でなければならない。
;; - ドットの後の部分文字列は、以下のいずれかでなければならない: ['txt'、'exe'、'dll']。... | reworded | transform | HumanEval_141_file_name_check | (require rackunit)
(define (test-humaneval)
(let (( candidate file_name_check))
(check-within (candidate "example.txt") "Yes" 0.001)
(check-within (candidate "1example.dll") "No" 0.001)
(check-within (candidate "s1sdf3.asd") "No" 0.001)
(check-within (candidate "K.dll") "Yes" 0.001)
(check-with... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_141_file_name_check.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; "
;; この関数は整数のリストを受け取ります。リスト内の各要素に対して、そのインデックスが3の倍数で
;; あればその整数を二乗し、インデックスが4の倍数でかつ3の倍数でない場合はその整数を三乗します。
;; インデックスが3または4の倍数でない要素については、何も変更しません。最後に、すべての要素の
;; 合計値を返します。
;; 例:
;; >>> lst
;; (list 1 2 3)
;; >>> lst
;; (list )
;; >>> lst
;; (list -1 -5 2 -1 -5)
(define (sum_squares lst)
| reworded | transform | HumanEval_142_sum_squares | (require rackunit)
(define (test-humaneval)
(let (( candidate sum_squares))
(check-within (candidate (list 1 2 3)) 6 0.001)
(check-within (candidate (list 1 4 9)) 14 0.001)
(check-within (candidate (list )) 0 0.001)
(check-within (candidate (list 1 1 1 1 1 1 1 1 1)) 9 0.001)
(check-within (cand... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_142_sum_squares.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 文を表す文字列が与えられ、その文には空白で区切られたいくつかの単語が含まれている。
;; 元の文の単語を含みその長さが素数である文字列を返す必要がある。
;; 新しい文字列の単語の順序は元の文字列と同じでなければならない。
;; 例 1:
;; >>> (words_in_sentence "This is a test")
;; "is"
;; 例 2:
;; >>> (words_in_sentence "lets go for swimming")
;; "go for"
;; 制約:
;; * 1 <= len(sentence) <= 100
;; * sentence c... | reworded | transform | HumanEval_143_words_in_sentence | (require rackunit)
(define (test-humaneval)
(let (( candidate words_in_sentence))
(check-within (candidate "This is a test") "is" 0.001)
(check-within (candidate "lets go for swimming") "go for" 0.001)
(check-within (candidate "there is no place available here") "there is no place" 0.001)
(check-wi... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_143_words_in_sentence.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; あなたの仕事は、式 x * n を簡単にする関数を実装することです。
;; この関数は、x * n が整数になる場合は#tを、そうでない場合は#fを
;; 返します。xとnはともに分数の文字列表現であり、<分子>/<分母>という形式で、
;; 分子と分母はともに正の整数です。
;; xとnが有効な分数であり、分母がゼロでないことは仮定してかまいません。
;; >>> (simplify "1/5" "5/1")
;; #t
;; >>> (simplify "1/6" "2/1")
;; #f
;; >>> (simplify "7/10" "10/2")
;; #f
(define (simpli... | reworded | transform | HumanEval_144_simplify | (require rackunit)
(define (test-humaneval)
(let (( candidate simplify))
(check-within (candidate "1/5" "5/1") #t 0.001)
(check-within (candidate "1/6" "2/1") #f 0.001)
(check-within (candidate "5/1" "3/1") #t 0.001)
(check-within (candidate "7/10" "10/2") #f 0.001)
(check-within (candidate "2/... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_144_simplify.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 各数字の桁の合計に基づいて、与えられた整数のリストを昇順に並べる
;; 関数を作成してください。
;; 注意:もし桁の合計が同じである複数の項目がある場合は、
;; 元のリストでの位置に基づいて並べてください。
;; 例えば
;; >>> (order_by_points (list 1 11 -1 -11 -12))
;; (list -1 -11 1 -12 11)
;; >>> (order_by_points (list ))
;; (list )
(define (order_by_points nums)
| reworded | transform | HumanEval_145_order_by_points | (require rackunit)
(define (test-humaneval)
(let (( candidate order_by_points))
(check-within (candidate (list 1 11 -1 -11 -12)) (list -1 -11 1 -12 11) 0.001)
(check-within (candidate (list 1234 423 463 145 2 423 423 53 6 37 3457 3 56 0 46)) (list 0 2 3 6 53 423 423 423 1234 145 37 46 56 463 3457) 0.001)
... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_145_order_by_points.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 数値の配列を入力とし、配列中の要素のうち、10より大きく、
;; かつ数値の最初と最後の桁の両方が奇数(1, 3, 5, 7, 9)である要素の数を返す関数を書く。
;; 例えば
;; >>> (specialFilter (list 15 -73 14 -15))
;; 1
;; >>> (specialFilter (list 33 -2 -3 45 21 109))
;; 2
(define (specialFilter nums)
| reworded | transform | HumanEval_146_specialFilter | (require rackunit)
(define (test-humaneval)
(let (( candidate specialFilter))
(check-within (candidate (list 5 -2 1 -5)) 0 0.001)
(check-within (candidate (list 15 -73 14 -15)) 1 0.001)
(check-within (candidate (list 33 -2 -3 45 21 109)) 2 0.001)
(check-within (candidate (list 43 -12 93 125 121 109... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_146_specialFilter.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 正の整数 n が与えられるので、長さ n の整数配列 a を作成せよ。
;; 各 i (1 ≤ i ≤ n) に対して、 a[i] = i * i - i + 1 とする。
;; i < j < k において、a[i] + a[j] + a[k] が3の倍数となるような三つ組 (a[i], a[j], a[k]) を返す。
;; 例:
;; >>> (get_max_triples 5)
;; 1
;; 解説:
;; a = [1, 3, 7, 13, 21]
;; 唯一の妥当な三つ組は (1, 7, 13)である。
(define (get_max_triples n)
| reworded | transform | HumanEval_147_get_max_triples | (require rackunit)
(define (test-humaneval)
(let (( candidate get_max_triples))
(check-within (candidate 5) 1 0.001)
(check-within (candidate 6) 4 0.001)
(check-within (candidate 10) 36 0.001)
(check-within (candidate 100) 53361 0.001)
))
(test-humaneval) | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_147_get_max_triples.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 私たちの太陽系には8つの惑星があります:太陽に最も近いのはVenus, Earth, Mars, Jupiter, Saturn,
;; Uranus, Neptuneです。
;; planet1とplanet2という2つの惑星名を文字列として受け取る関数を作成してください。
;; この関数は、planet1の軌道とplanet2の軌道の間に位置するすべての惑星を太陽に近い順に並べたタプルを返すべきです。
;; planet1またはplanet2が正確な惑星名でない場合、関数は空のタプルを返すべきです。
;; 例
;; >>> (bf "Jupiter" "Neptune")
;; (list "... | reworded | transform | HumanEval_148_bf | (require rackunit)
(define (test-humaneval)
(let (( candidate bf))
(check-within (candidate "Jupiter" "Neptune") (list "Saturn" "Uranus") 0.001)
(check-within (candidate "Earth" "Mercury") (list "Venus") 0.001)
(check-within (candidate "Mercury" "Uranus") (list "Venus" "Earth" "Mars" "Jupiter" "Saturn"... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_148_bf.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 文字列のリストを引数として受け取る関数を作成してください。
;; この関数は、リストから奇数の長さを持つ文字列を削除し、
;; 結果として得られるリストを長さで昇順に並べ替えて返します。
;; リストは常に文字列のリストであり、数字の配列ではありません。
;; また、重複する文字列が含まれる可能性があります。
;; リストは各単語の長さで昇順に並べられるべきで、そのルールに従ってソートされたリストを返してください。
;; もし二つの単語が同じ長さであれば、リストをアルファベット順に並べ替えてください。
;; 関数はソートされた順序で文字列のリストを返すべきです。
;; すべての単語が同じ長さを持つと... | reworded | transform | HumanEval_149_sorted_list_sum | (require rackunit)
(define (test-humaneval)
(let (( candidate sorted_list_sum))
(check-within (candidate (list "aa" "a" "aaa")) (list "aa") 0.001)
(check-within (candidate (list "school" "AI" "asdf" "b")) (list "AI" "asdf" "school") 0.001)
(check-within (candidate (list "d" "b" "c" "a")) (list ) 0.001)... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_149_sorted_list_sum.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 素数である場合はxの値を返し、それ以外の場合はyの値を返す簡単なプログラム。
;; 例:
;; >>> (x_or_y 7 34 12)
;; 34
;; >>> (x_or_y 15 8 5)
;; 5
(define (x_or_y n x y)
| reworded | transform | HumanEval_150_x_or_y | (require rackunit)
(define (test-humaneval)
(let (( candidate x_or_y))
(check-within (candidate 7 34 12) 34 0.001)
(check-within (candidate 15 8 5) 5 0.001)
(check-within (candidate 3 33 5212) 33 0.001)
(check-within (candidate 1259 3 52) 3 0.001)
(check-within (candidate 7919 -1 12) -1 0.001)
... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_150_x_or_y.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 数字のリストが与えられた場合、そのリスト内の奇数の数値の二乗の合計を返してください。
;; 負の数や整数でない数は無視してください。
;; >>> (double_the_difference (list 1 3 2 0))
;; 10
;; >>> (double_the_difference (list -1 -2 0))
;; 0
;; >>> (double_the_difference (list 9 -2))
;; 81
;; >>> (double_the_difference (list 0))
;; 0
;; 入力リストが空の場合は0を返すようにしてください。
(define (d... | reworded | transform | HumanEval_151_double_the_difference | (require rackunit)
(define (test-humaneval)
(let (( candidate double_the_difference))
(check-within (candidate (list )) 0 0.001)
(check-within (candidate (list 5.0 4.0)) 25 0.001)
(check-within (candidate (list 0.1 0.2 0.3)) 0 0.001)
(check-within (candidate (list -10.0 -20.0 -30.0)) 0 0.001)
(... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_151_double_the_difference.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 待ち望んでいた出来事の結果がようやく判明したときの感覚は、誰もが覚えていると思う。
;; その瞬間に抱いた感情や思考は、間違いなくメモして比較する価値がある。
;; あなたの仕事は、人がいくつかの試合の結果を正確に予想したかどうかを判断することです。
;; スコアと予想の2つの配列が等しい長さで与えられます。各インデックスは1つの試合を示しています。
;; 各予想がどれだけ外れていたかを示す同じ長さの配列を返してください。予想が正確であれば、
;; その値は0です。そうでなければ、その値は予想とスコアの絶対的な差です。
;; 例:
;; >>> (compare (list 1 2 3 4 5 1... | reworded | transform | HumanEval_152_compare | (require rackunit)
(define (test-humaneval)
(let (( candidate compare))
(check-within (candidate (list 1 2 3 4 5 1) (list 1 2 3 4 2 -2)) (list 0 0 0 0 3 3) 0.001)
(check-within (candidate (list 0 0 0 0 0 0) (list 0 0 0 0 0 0)) (list 0 0 0 0 0 0) 0.001)
(check-within (candidate (list 1 2 3) (list -1 -2 ... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_152_compare.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; クラスの名前(文字列)と拡張子のリストが与えられます。
;; この拡張子は、指定されたクラスに追加のクラスをロードするために使用されます。
;; 拡張子の強度は次のように計算されます:CAPは拡張子の名前に含まれる
;; 大文字の数、SMは小文字の数です。強度は、CAP - SM で与えられます。
;; 最も強い拡張子を見つけて、この形式の文字列を返してください:ClassName.StrongestExtensionName。
;; 同じ強度を持つ2つ以上の拡張子がある場合は、リストで最初に来るものを選びます。
;; 例えば、"Slices"というクラスと、拡張子のリスト['SErviNGSliC... | reworded | transform | HumanEval_153_Strongest_Extension | (require rackunit)
(define (test-humaneval)
(let (( candidate Strongest_Extension))
(check-within (candidate "Watashi" (list "tEN" "niNE" "eIGHt8OKe")) "Watashi.eIGHt8OKe" 0.001)
(check-within (candidate "Boku123" (list "nani" "NazeDa" "YEs.WeCaNe" "32145tggg")) "Boku123.YEs.WeCaNe" 0.001)
(check-withi... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_153_Strongest_Extension.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 2つの単語が与えられる。2番目の単語またはその回転させた文字列が最初の単語の部分文字列である場合、#tを返す必要がある。
;; >>> (cycpattern_check "abcd" "abd")
;; #f
;; >>> (cycpattern_check "hello" "ell")
;; #t
;; >>> (cycpattern_check "whassup" "psus")
;; #f
;; >>> (cycpattern_check "abab" "baa")
;; #t
;; >>> (cycpattern_check "efef" "eeff")
;; #f
;; >>> (cyc... | reworded | transform | HumanEval_154_cycpattern_check | (require rackunit)
(define (test-humaneval)
(let (( candidate cycpattern_check))
(check-within (candidate "xyzw" "xyw") #f 0.001)
(check-within (candidate "yello" "ell") #t 0.001)
(check-within (candidate "whattup" "ptut") #f 0.001)
(check-within (candidate "efef" "fee") #t 0.001)
(check-within... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_154_cycpattern_check.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 整数が与えられた場合、偶数桁数と奇数桁数をそれぞれ持つタプルを返す。
;; 例:
;; >>> (even_odd_count -12)
;; (list 1 1)
;; >>> (even_odd_count 123)
;; (list 1 2)
(define (even_odd_count num)
| reworded | transform | HumanEval_155_even_odd_count | (require rackunit)
(define (test-humaneval)
(let (( candidate even_odd_count))
(check-within (candidate 7) (list 0 1) 0.001)
(check-within (candidate -78) (list 1 1) 0.001)
(check-within (candidate 3452) (list 2 2) 0.001)
(check-within (candidate 346211) (list 3 3) 0.001)
(check-within (candida... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_155_even_odd_count.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 正の整数が与えられたとき、ローマ数字に相当する文字列を小文字で返す。
;; 制限事項1 <= num <= 1000
;; 例:
;; >>> (int_to_mini_roman 19)
;; "xix"
;; >>> (int_to_mini_roman 152)
;; "clii"
;; >>> (int_to_mini_roman 426)
;; "cdxxvi"
(define (int_to_mini_roman number)
| reworded | transform | HumanEval_156_int_to_mini_roman | (require rackunit)
(define (test-humaneval)
(let (( candidate int_to_mini_roman))
(check-within (candidate 19) "xix" 0.001)
(check-within (candidate 152) "clii" 0.001)
(check-within (candidate 251) "ccli" 0.001)
(check-within (candidate 426) "cdxxvi" 0.001)
(check-within (candidate 500) "d" 0.0... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_156_int_to_mini_roman.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 三角形の3辺の長さを与える。三角形が直角三角形なら#tを、そうでなければ#fを返す。
;; 直角三角形とは、1つの角が直角または90度である三角形のことである。
;; 例:
;; >>> (right_angle_triangle 3 4 5)
;; #t
;; >>> (right_angle_triangle 1 2 3)
;; #f
(define (right_angle_triangle a b c)
| reworded | transform | HumanEval_157_right_angle_triangle | (require rackunit)
(define (test-humaneval)
(let (( candidate right_angle_triangle))
(check-within (candidate 3 4 5) #t 0.001)
(check-within (candidate 1 2 3) #f 0.001)
(check-within (candidate 10 6 8) #t 0.001)
(check-within (candidate 2 2 2) #f 0.001)
(check-within (candidate 7 24 25) #t 0.00... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_157_right_angle_triangle.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 文字列のリストを受け取る関数を書きなさい。
;; リストは異なる単語を含む。異なる固有の文字数が最も多い単語を返す。
;; 複数の文字列が同じ文字数を持つ場合は、辞書順で最初に来るものを返すことにする。
;; >>> (find_max (list "name" "of" "string"))
;; "string"
;; >>> (find_max (list "name" "enam" "game"))
;; "enam"
;; >>> (find_max (list "aaaaaaa" "bb" "cc"))
;; "aaaaaaa"
(define (find_max words)
| reworded | transform | HumanEval_158_find_max | (require rackunit)
(define (test-humaneval)
(let (( candidate find_max))
(check-within (candidate (list "name" "of" "string")) "string" 0.001)
(check-within (candidate (list "name" "enam" "game")) "enam" 0.001)
(check-within (candidate (list "aaaaaaa" "bb" "cc")) "aaaaaaa" 0.001)
(check-within (can... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_158_find_max.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; あなたはお腹を空かせたウサギです。すでに一定数のニンジンを食べました。
;; これからさらにニンジンを食べなければその日の食事は完了しません。
;; あなたは [ 食事の後に食べたニンジンの総数, 食事の後に残ったニンジンの数 ] の配列を返してください。
;; もし残りのニンジンが十分でなければ、あなたは残りのニンジンをすべて食べますが、まだお腹が空いています。
;; 例:
;; >>> (eat 5 6 10)
;; (list 11 4)
;; >>> (eat 4 8 9)
;; (list 12 1)
;; >>> (eat 1 10 10)
;; (list 11 0)
;; >>> (... | reworded | transform | HumanEval_159_eat | (require rackunit)
(define (test-humaneval)
(let (( candidate eat))
(check-within (candidate 5 6 10) (list 11 4) 0.001)
(check-within (candidate 4 8 9) (list 12 1) 0.001)
(check-within (candidate 1 10 10) (list 11 0) 0.001)
(check-within (candidate 2 11 5) (list 7 0) 0.001)
(check-within (candi... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_159_eat.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 演算子(operator)とオペランド(operand)の2つのリストが与えられる。ひとつ目のリストは
;; 基本的な算術演算を持ち、二つ目のリストは整数のリストである。与えられた2つのリストを
;; 使って算術式を構築し、その評価結果を返そう。
;; 基本的な算術演算:
;; 加算 ( + )
;; 減算 ( - )
;; 乗算 ( * )
;; 階除算 ( // )
;; 指数化 ( ** )
;; 例:
;; operator['+', '*', '-']
;; list = [2, 3, 4, 5]
;; result = 2 + 3 * 4 - 5
;; => result = 9
... | reworded | transform | HumanEval_160_do_algebra | (require rackunit)
(define (test-humaneval)
(let (( candidate do_algebra))
(check-within (candidate (list "**" "*" "+") (list 2 3 4 5)) 37 0.001)
(check-within (candidate (list "+" "*" "-") (list 2 3 4 5)) 9 0.001)
(check-within (candidate (list "//" "*") (list 7 3 4)) 8 0.001)
))
(test-humaneval) | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_160_do_algebra.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 文字列sが与えられます。
;; もしs[i]がアルファベットなら、その文字の大文字と小文字を反転させる。そうでない場合は、そのままにしておく。
;; もし文字列にアルファベットが一つも含まれていない場合は、文字列全体を逆順にする。
;; 関数は結果の文字列を返すようにします。
;; 例
;; >>> (solve "1234")
;; "4321"
;; >>> (solve "ab")
;; "AB"
;; >>> (solve "#a@C")
;; "#A@c"
(define (solve s)
| reworded | transform | HumanEval_161_solve | (require rackunit)
(define (test-humaneval)
(let (( candidate solve))
(check-within (candidate "AsDf") "aSdF" 0.001)
(check-within (candidate "1234") "4321" 0.001)
(check-within (candidate "ab") "AB" 0.001)
(check-within (candidate "#a@C") "#A@c" 0.001)
(check-within (candidate "#AsdfW^45") "#a... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_161_solve.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
文字列 text が与えられたとき、その md5 ハッシュと等価な文字列を返す。
;; text' が空文字列の場合は #f を返す。
;; >>> (string_to_md5 "Hello world")
;; "3e25960a79dbc69b674cd4ec67a72c62"
(define (string_to_md5 text)
| reworded | transform | HumanEval_162_string_to_md5 | (require rackunit)
(define (test-humaneval)
(let (( candidate string_to_md5))
(check-within (candidate "Hello world") "3e25960a79dbc69b674cd4ec67a72c62" 0.001)
(check-within (candidate "") #f 0.001)
(check-within (candidate "A B C") "0ef78513b0cb8cef12743f5aeb35f888" 0.001)
(check-within (candidate... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_162_string_to_md5.py | rkt |
[
"\n(define ",
"\n#|",
"\n;",
"\n("
] | #lang racket
;; 正の整数aとbが与えられたとき、aとbの間にある偶数の数字を昇順で返してください。
;; >>> (generate_integers 2 8)
;; (list 2 4 6 8)
;; >>> (generate_integers 8 2)
;; (list 2 4 6 8)
;; >>> (generate_integers 10 14)
;; (list )
(define (generate_integers a b)
| reworded | transform | HumanEval_163_generate_integers | (require rackunit)
(define (test-humaneval)
(let (( candidate generate_integers))
(check-within (candidate 2 10) (list 2 4 6 8) 0.001)
(check-within (candidate 10 2) (list 2 4 6 8) 0.001)
(check-within (candidate 132 2) (list 2 4 6 8) 0.001)
(check-within (candidate 17 89) (list ) 0.001)
))
(test-... | /work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_163_generate_integers.py | rkt |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.