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

Dataset Card for "JMultiPL-E-rb"

More Information needed

Downloads last month
2