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