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