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

Dataset Card for "JMultiPL-E-scala"

More Information needed

Downloads last month
2