name
stringclasses
161 values
language
stringclasses
22 values
prompt
stringlengths
40
2.27k
doctests
stringclasses
3 values
original
stringclasses
956 values
prompt_terminology
stringclasses
2 values
tests
stringlengths
125
5.35k
stop_tokens
listlengths
1
7
HumanEval_126_is_sorted
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Given a list of numbers, return whether or not they are sorted // in ascending order. If list has more than 1 duplicate of the same // number, return False. Assume no negative numbers and only integers. // Examples // >>> isSo...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_126_is_sorted.py
verbatim
} def main(args: Array[String]) = { assert(isSorted((List[Long](5l.toLong))) == (true)); assert(isSorted((List[Long](1l.toLong, 2l.toLong, 3l.toLong, 4l.toLong, 5l.toLong))) == (true)); assert(isSorted((List[Long](1l.toLong, 3l.toLong, 2l.toLong, 4l.toLong, 5l.toLong))) == (false)); assert(isSor...
[ "\n }\n" ]
HumanEval_127_intersection
scala
import scala.math._ import scala.collection.mutable._ object Problem { // You are given two intervals, // where each interval is a pair of integers. For example, interval = (start, end) = (1, 2). // The given intervals are closed which means that the interval (start, end) // includes both start and end....
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_127_intersection.py
verbatim
} def main(args: Array[String]) = { assert(intersection(((1l, 2l)), ((2l, 3l))).equals(("NO"))); assert(intersection(((-1l, 1l)), ((0l, 4l))).equals(("NO"))); assert(intersection(((-3l, -1l)), ((-5l, 5l))).equals(("YES"))); assert(intersection(((-2l, 2l)), ((-4l, 0l))).equals(("YES"))); asse...
[ "\n }\n" ]
HumanEval_128_prod_signs
scala
import scala.math._ import scala.collection.mutable._ object Problem { // You are given an array arr of integers and you need to return // sum of magnitudes of integers multiplied by product of all signs // of each number in the array, represented by 1, -1 or 0. // Note: return None for empty arr. /...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_128_prod_signs.py
verbatim
} def main(args: Array[String]) = { assert(prodSigns((List[Long](1l.toLong, 2l.toLong, 2l.toLong, -4l.toLong))).equals(Some(-9l))); assert(prodSigns((List[Long](0l.toLong, 1l.toLong))).equals(Some(0l))); assert(prodSigns((List[Long](1l.toLong, 1l.toLong, 1l.toLong, 2l.toLong, 3l.toLong, -1l.toLong, ...
[ "\n }\n" ]
HumanEval_129_minPath
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Given a grid with N rows and N columns (N >= 2) and a positive integer k, // each cell of the grid contains a value. Every integer in the range [1, N * N] // inclusive appears exactly once on the cells of the grid. // You have to...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_129_minPath.py
verbatim
} def main(args: Array[String]) = { assert(minPath((List[List[Long]](List[Long](1l.toLong, 2l.toLong, 3l.toLong), List[Long](4l.toLong, 5l.toLong, 6l.toLong), List[Long](7l.toLong, 8l.toLong, 9l.toLong))), (3l)).equals((List[Long](1l.toLong, 2l.toLong, 1l.toLong)))); assert(minPath((List[List[Long]](Lis...
[ "\n }\n" ]
HumanEval_12_longest
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Out of list of strings, return the longest one. Return the first one in case of multiple // strings of the same length. Return None in case the input list is empty. // >>> longest((List[String]())) // None // >>> longest((List...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_12_longest.py
verbatim
} 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"))); } }
[ "\n }\n" ]
HumanEval_130_tri
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Everyone knows Fibonacci sequence, it was studied deeply by mathematicians in // the last couple centuries. However, what people don't know is Tribonacci sequence. // Tribonacci sequence is defined by the recurrence: // tri(1) = ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_130_tri.py
verbatim
} def main(args: Array[String]) = { assert(tri((3l)).equals((List[Long](1l.toLong, 3l.toLong, 2l.toLong, 8l.toLong)))); assert(tri((4l)).equals((List[Long](1l.toLong, 3l.toLong, 2l.toLong, 8l.toLong, 3l.toLong)))); assert(tri((5l)).equals((List[Long](1l.toLong, 3l.toLong, 2l.toLong, 8l.toLong, 3l.to...
[ "\n }\n" ]
HumanEval_131_digits
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Given a positive integer n, return the product of the odd digits. // Return 0 if all digits are even. // For example: // >>> digits((1l)) // (1l) // >>> digits((4l)) // (0l) // >>> digits((235l)) // (15l) d...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_131_digits.py
verbatim
} def main(args: Array[String]) = { assert(digits((5l)) == (5l)); assert(digits((54l)) == (5l)); assert(digits((120l)) == (1l)); assert(digits((5014l)) == (5l)); assert(digits((98765l)) == (315l)); assert(digits((5576543l)) == (2625l)); assert(digits((2468l)) == (0l)); } }
[ "\n }\n" ]
HumanEval_132_is_nested
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Create a function that takes a string as input which contains only square brackets. // The function should return True if and only if there is a valid subsequence of brackets // where at least one bracket in the subsequence is nested...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_132_is_nested.py
verbatim
} def main(args: Array[String]) = { assert(isNested(("[[]]")) == (true)); assert(isNested(("[]]]]]]][[[[[]")) == (false)); assert(isNested(("[][]")) == (false)); assert(isNested(("[]")) == (false)); assert(isNested(("[[[[]]]]")) == (true)); assert(isNested(("[]]]]]]]]]]")) == (false)); ...
[ "\n }\n" ]
HumanEval_133_sum_squares
scala
import scala.math._ import scala.collection.mutable._ object Problem { // You are given a list of numbers. // You need to return the sum of squared numbers in the given list, // round each element in the list to the upper int(Ceiling) first. // Examples: // >>> lst((List[Float](1.0f.toFloat, 2.0f.to...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_133_sum_squares.py
verbatim
} def main(args: Array[String]) = { assert(sumSquares((List[Float](1.0f.toFloat, 2.0f.toFloat, 3.0f.toFloat))) == (14l)); assert(sumSquares((List[Float](1.0f.toFloat, 2.0f.toFloat, 3.0f.toFloat))) == (14l)); assert(sumSquares((List[Float](1.0f.toFloat, 3.0f.toFloat, 5.0f.toFloat, 7.0f.toFloat))) == ...
[ "\n }\n" ]
HumanEval_134_check_if_last_char_is_a_letter
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Create a function that returns True if the last character // of a given string is an alphabetical character and is not // a part of a word, and False otherwise. // Note: "word" is a group of characters separated by space. // E...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_134_check_if_last_char_is_a_letter.py
verbatim
} def main(args: Array[String]) = { assert(checkIfLastCharIsALetter(("apple")) == (false)); assert(checkIfLastCharIsALetter(("apple pi e")) == (true)); assert(checkIfLastCharIsALetter(("eeeee")) == (false)); assert(checkIfLastCharIsALetter(("A")) == (true)); assert(checkIfLastCharIsALetter((...
[ "\n }\n" ]
HumanEval_135_can_arrange
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Create a function which returns the largest index of an element which // is not greater than or equal to the element immediately preceding it. If // no such element exists then return -1. The given array will not contain // duplic...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_135_can_arrange.py
verbatim
} def main(args: Array[String]) = { assert(canArrange((List[Long](1l.toLong, 2l.toLong, 4l.toLong, 3l.toLong, 5l.toLong))) == (3l)); assert(canArrange((List[Long](1l.toLong, 2l.toLong, 4l.toLong, 5l.toLong))) == (-1l)); assert(canArrange((List[Long](1l.toLong, 4l.toLong, 2l.toLong, 5l.toLong, 6l.toL...
[ "\n }\n" ]
HumanEval_136_largest_smallest_integers
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Create a function that returns a tuple (a, b), where 'a' is // the largest of negative integers, and 'b' is the smallest // of positive integers in a list. // If there is no negative or positive integers, return them as None. ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_136_largest_smallest_integers.py
verbatim
} def main(args: Array[String]) = { assert(largestSmallestIntegers((List[Long](2l.toLong, 4l.toLong, 1l.toLong, 3l.toLong, 5l.toLong, 7l.toLong))).equals((Some(None), Some(1l)))); assert(largestSmallestIntegers((List[Long](2l.toLong, 4l.toLong, 1l.toLong, 3l.toLong, 5l.toLong, 7l.toLong, 0l.toLong))).eq...
[ "\n }\n" ]
HumanEval_138_is_equal_to_sum_even
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Evaluate whether the given number n can be written as the sum of exactly 4 positive even numbers // Example // >>> isEqualToSumEven((4l)) // (false) // >>> isEqualToSumEven((6l)) // (false) // >>> isEqualToSumEven((8l)...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_138_is_equal_to_sum_even.py
verbatim
} def main(args: Array[String]) = { assert(isEqualToSumEven((4l)) == (false)); assert(isEqualToSumEven((6l)) == (false)); assert(isEqualToSumEven((8l)) == (true)); assert(isEqualToSumEven((10l)) == (true)); assert(isEqualToSumEven((11l)) == (false)); assert(isEqualToSumEven((12l)) == (tr...
[ "\n }\n" ]
HumanEval_139_special_factorial
scala
import scala.math._ import scala.collection.mutable._ object Problem { // The Brazilian factorial is defined as: // brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1! // where n > 0 // For example: // >>> specialFactorial((4l)) // (288l) // The function will receive an integer as input...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_139_special_factorial.py
verbatim
} def main(args: Array[String]) = { assert(specialFactorial((4l)) == (288l)); assert(specialFactorial((5l)) == (34560l)); assert(specialFactorial((7l)) == (125411328000l)); assert(specialFactorial((1l)) == (1l)); } }
[ "\n }\n" ]
HumanEval_13_greatest_common_divisor
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Return a greatest common divisor of two integers a and b // >>> greatestCommonDivisor((3l), (5l)) // (1l) // >>> greatestCommonDivisor((25l), (15l)) // (5l) def greatestCommonDivisor(a : Long, b : Long) : Long = {
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_13_greatest_common_divisor.py
verbatim
} 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)); } }
[ "\n }\n" ]
HumanEval_140_fix_spaces
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Given a string text, replace all spaces in it with underscores, // and if a string has more than 2 consecutive spaces, // then replace all consecutive spaces with - // >>> fixSpaces((" Example")) // ("Example") // >>> f...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_140_fix_spaces.py
verbatim
} def main(args: Array[String]) = { assert(fixSpaces(("Example")).equals(("Example"))); assert(fixSpaces(("Mudasir Hanif ")).equals(("Mudasir_Hanif_"))); assert(fixSpaces(("Yellow Yellow Dirty Fellow")).equals(("Yellow_Yellow__Dirty__Fellow"))); assert(fixSpaces(("Exa mple")).equals(("Exa-mp...
[ "\n }\n" ]
HumanEval_141_file_name_check
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Create a function which takes a string representing a file's name, and returns // 'Yes' if the the file's name is valid, and returns 'No' otherwise. // A file's name is considered to be valid if and only if all the following condition...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_141_file_name_check.py
verbatim
} def main(args: Array[String]) = { assert(fileNameCheck(("example.txt")).equals(("Yes"))); assert(fileNameCheck(("1example.dll")).equals(("No"))); assert(fileNameCheck(("s1sdf3.asd")).equals(("No"))); assert(fileNameCheck(("K.dll")).equals(("Yes"))); assert(fileNameCheck(("MY16FILE3.exe"))....
[ "\n }\n" ]
HumanEval_142_sum_squares
scala
import scala.math._ import scala.collection.mutable._ object Problem { // " // This function will take a list of integers. For all entries in the list, the function shall square the integer entry if its index is a // multiple of 3 and will cube the integer entry if its index is a multiple of 4 and not a mu...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_142_sum_squares.py
verbatim
} def main(args: Array[String]) = { assert(sumSquares((List[Long](1l.toLong, 2l.toLong, 3l.toLong))) == (6l)); assert(sumSquares((List[Long](1l.toLong, 4l.toLong, 9l.toLong))) == (14l)); assert(sumSquares((List[Long]())) == (0l)); assert(sumSquares((List[Long](1l.toLong, 1l.toLong, 1l.toLong, 1l...
[ "\n }\n" ]
HumanEval_143_words_in_sentence
scala
import scala.math._ import scala.collection.mutable._ object Problem { // You are given a string representing a sentence, // the sentence contains some words separated by a space, // and you have to return a string that contains the words from the original sentence, // whose lengths are prime numbers, ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_143_words_in_sentence.py
verbatim
} def main(args: Array[String]) = { assert(wordsInSentence(("This is a test")).equals(("is"))); assert(wordsInSentence(("lets go for swimming")).equals(("go for"))); assert(wordsInSentence(("there is no place available here")).equals(("there is no place"))); assert(wordsInSentence(("Hi I am Huss...
[ "\n }\n" ]
HumanEval_144_simplify
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Your task is to implement a function that will simplify the expression // x * n. The function returns True if x * n evaluates to a whole number and False // otherwise. Both x and n, are string representation of a fraction, and have th...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_144_simplify.py
verbatim
} def main(args: Array[String]) = { assert(simplify(("1/5"), ("5/1")) == (true)); assert(simplify(("1/6"), ("2/1")) == (false)); assert(simplify(("5/1"), ("3/1")) == (true)); assert(simplify(("7/10"), ("10/2")) == (false)); assert(simplify(("2/10"), ("50/10")) == (true)); assert(simplify...
[ "\n }\n" ]
HumanEval_145_order_by_points
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Write a function which sorts the given list of integers // in ascending order according to the sum of their digits. // Note: if there are several items with similar sum of their digits, // order them based on their index in origin...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_145_order_by_points.py
verbatim
} def main(args: Array[String]) = { assert(orderByPoints((List[Long](1l.toLong, 11l.toLong, -1l.toLong, -11l.toLong, -12l.toLong))).equals((List[Long](-1l.toLong, -11l.toLong, 1l.toLong, -12l.toLong, 11l.toLong)))); assert(orderByPoints((List[Long](1234l.toLong, 423l.toLong, 463l.toLong, 145l.toLong, 2l...
[ "\n }\n" ]
HumanEval_146_specialFilter
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Write a function that takes an array of numbers as input and returns // the number of elements in the array that are greater than 10 and both // first and last digits of a number are odd (1, 3, 5, 7, 9). // For example: // >...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_146_specialFilter.py
verbatim
} def main(args: Array[String]) = { assert(specialFilter((List[Long](5l.toLong, -2l.toLong, 1l.toLong, -5l.toLong))) == (0l)); assert(specialFilter((List[Long](15l.toLong, -73l.toLong, 14l.toLong, -15l.toLong))) == (1l)); assert(specialFilter((List[Long](33l.toLong, -2l.toLong, -3l.toLong, 45l.toLon...
[ "\n }\n" ]
HumanEval_147_get_max_triples
scala
import scala.math._ import scala.collection.mutable._ object Problem { // You are given a positive integer n. You have to create an integer array a of length n. // For each i (1 ≤ i ≤ n), the value of a[i] = i * i - i + 1. // Return the number of triples (a[i], a[j], a[k]) of a where i < j < k, // and ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_147_get_max_triples.py
verbatim
} def main(args: Array[String]) = { assert(getMaxTriples((5l)) == (1l)); assert(getMaxTriples((6l)) == (4l)); assert(getMaxTriples((10l)) == (36l)); assert(getMaxTriples((100l)) == (53361l)); } }
[ "\n }\n" ]
HumanEval_148_bf
scala
import scala.math._ import scala.collection.mutable._ object Problem { // There are eight planets in our solar system: the closerst to the Sun // is Mercury, the next one is Venus, then Earth, Mars, Jupiter, Saturn, // Uranus, Neptune. // Write a function that takes two planet names as strings planet1...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_148_bf.py
verbatim
} def main(args: Array[String]) = { assert(bf(("Jupiter"), ("Neptune")).equals((List[String]("Saturn", "Uranus")))); assert(bf(("Earth"), ("Mercury")).equals((List[String]("Venus")))); assert(bf(("Mercury"), ("Uranus")).equals((List[String]("Venus", "Earth", "Mars", "Jupiter", "Saturn")))); asse...
[ "\n }\n" ]
HumanEval_149_sorted_list_sum
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Write a function that accepts a list of strings as a parameter, // deletes the strings that have odd lengths from it, // and returns the resulted list with a sorted order, // The list is always a list of strings and never an array...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_149_sorted_list_sum.py
verbatim
} def main(args: Array[String]) = { assert(sortedListSum((List[String]("aa", "a", "aaa"))).equals((List[String]("aa")))); assert(sortedListSum((List[String]("school", "AI", "asdf", "b"))).equals((List[String]("AI", "asdf", "school")))); assert(sortedListSum((List[String]("d", "b", "c", "a"))).equals...
[ "\n }\n" ]
HumanEval_14_all_prefixes
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Return list of all prefixes from shortest to longest of the input string // >>> allPrefixes(("abc")) // (List[String]("a", "ab", "abc")) def allPrefixes(string : String) : List[String] = {
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_14_all_prefixes.py
verbatim
} 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")))); } }
[ "\n }\n" ]
HumanEval_150_x_or_y
scala
import scala.math._ import scala.collection.mutable._ object Problem { // A simple program which should return the value of x if n is // a prime number and should return the value of y otherwise. // Examples: // >>> xOrY((7l), (34l), (12l)) // (34l) // >>> xOrY((15l), (8l), (5l)) // (5l) ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_150_x_or_y.py
verbatim
} def main(args: Array[String]) = { assert(xOrY((7l), (34l), (12l)) == (34l)); assert(xOrY((15l), (8l), (5l)) == (5l)); assert(xOrY((3l), (33l), (5212l)) == (33l)); assert(xOrY((1259l), (3l), (52l)) == (3l)); assert(xOrY((7919l), (-1l), (12l)) == (-1l)); assert(xOrY((3609l), (1245l), (58...
[ "\n }\n" ]
HumanEval_151_double_the_difference
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Given a list of numbers, return the sum of squares of the numbers // in the list that are odd. Ignore numbers that are negative or not integers. // >>> doubleTheDifference((List[Float](1l.toLong, 3l.toLong, 2l.toLong, 0l.toLong))) ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_151_double_the_difference.py
verbatim
} def main(args: Array[String]) = { assert(doubleTheDifference((List[Float]())) == (0l)); assert(doubleTheDifference((List[Float](5.0f.toFloat, 4.0f.toFloat))) == (25l)); assert(doubleTheDifference((List[Float](0.1f.toFloat, 0.2f.toFloat, 0.3f.toFloat))) == (0l)); assert(doubleTheDifference((Lis...
[ "\n }\n" ]
HumanEval_152_compare
scala
import scala.math._ import scala.collection.mutable._ object Problem { // I think we all remember that feeling when the result of some long-awaited // event is finally known. The feelings and thoughts you have at that moment are // definitely worth noting down and comparing. // Your task is to determine...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_152_compare.py
verbatim
} def main(args: Array[String]) = { assert(compare((List[Long](1l.toLong, 2l.toLong, 3l.toLong, 4l.toLong, 5l.toLong, 1l.toLong)), (List[Long](1l.toLong, 2l.toLong, 3l.toLong, 4l.toLong, 2l.toLong, -2l.toLong))).equals((List[Long](0l.toLong, 0l.toLong, 0l.toLong, 0l.toLong, 3l.toLong, 3l.toLong)))); ass...
[ "\n }\n" ]
HumanEval_153_Strongest_Extension
scala
import scala.math._ import scala.collection.mutable._ object Problem { // You will be given the name of a class (a string) and a list of extensions. // The extensions are to be used to load additional classes to the class. The // strength of the extension is as follows: Let CAP be the number of the uppercas...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_153_Strongest_Extension.py
verbatim
} def main(args: Array[String]) = { assert(StrongestExtension(("Watashi"), (List[String]("tEN", "niNE", "eIGHt8OKe"))).equals(("Watashi.eIGHt8OKe"))); assert(StrongestExtension(("Boku123"), (List[String]("nani", "NazeDa", "YEs.WeCaNe", "32145tggg"))).equals(("Boku123.YEs.WeCaNe"))); assert(Strongest...
[ "\n }\n" ]
HumanEval_154_cycpattern_check
scala
import scala.math._ import scala.collection.mutable._ object Problem { // You are given 2 words. You need to return True if the second word or any of its rotations is a substring in the first word // >>> cycpatternCheck(("abcd"), ("abd")) // (false) // >>> cycpatternCheck(("hello"), ("ell")) // (tru...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_154_cycpattern_check.py
verbatim
} def main(args: Array[String]) = { assert(cycpatternCheck(("xyzw"), ("xyw")) == (false)); assert(cycpatternCheck(("yello"), ("ell")) == (true)); assert(cycpatternCheck(("whattup"), ("ptut")) == (false)); assert(cycpatternCheck(("efef"), ("fee")) == (true)); assert(cycpatternCheck(("abab"), ...
[ "\n }\n" ]
HumanEval_155_even_odd_count
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Given an integer. return a tuple that has the number of even and odd digits respectively. // Example: // >>> evenOddCount((-12l)) // ((1l, 1l)) // >>> evenOddCount((123l)) // ((1l, 2l)) def evenOddCount(num : Long) : T...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_155_even_odd_count.py
verbatim
} def main(args: Array[String]) = { assert(evenOddCount((7l)).equals(((0l, 1l)))); assert(evenOddCount((-78l)).equals(((1l, 1l)))); assert(evenOddCount((3452l)).equals(((2l, 2l)))); assert(evenOddCount((346211l)).equals(((3l, 3l)))); assert(evenOddCount((-345821l)).equals(((3l, 3l)))); a...
[ "\n }\n" ]
HumanEval_156_int_to_mini_roman
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Given a positive integer, obtain its roman numeral equivalent as a string, // and return it in lowercase. // Restrictions: 1 <= num <= 1000 // Examples: // >>> intToMiniRoman((19l)) // ("xix") // >>> intToMiniRoman((15...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_156_int_to_mini_roman.py
verbatim
} def main(args: Array[String]) = { assert(intToMiniRoman((19l)).equals(("xix"))); assert(intToMiniRoman((152l)).equals(("clii"))); assert(intToMiniRoman((251l)).equals(("ccli"))); assert(intToMiniRoman((426l)).equals(("cdxxvi"))); assert(intToMiniRoman((500l)).equals(("d"))); assert(int...
[ "\n }\n" ]
HumanEval_157_right_angle_triangle
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Given the lengths of the three sides of a triangle. Return True if the three // sides form a right-angled triangle, False otherwise. // A right-angled triangle is a triangle in which one angle is right angle or // 90 degree. ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_157_right_angle_triangle.py
verbatim
} def main(args: Array[String]) = { assert(rightAngleTriangle((3l), (4l), (5l)) == (true)); assert(rightAngleTriangle((1l), (2l), (3l)) == (false)); assert(rightAngleTriangle((10l), (6l), (8l)) == (true)); assert(rightAngleTriangle((2l), (2l), (2l)) == (false)); assert(rightAngleTriangle((7l...
[ "\n }\n" ]
HumanEval_158_find_max
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Write a function that accepts a list of strings. // The list contains different words. Return the word with maximum number // of unique characters. If multiple strings have maximum number of unique // characters, return the one wh...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_158_find_max.py
verbatim
} def main(args: Array[String]) = { assert(findMax((List[String]("name", "of", "string"))).equals(("string"))); assert(findMax((List[String]("name", "enam", "game"))).equals(("enam"))); assert(findMax((List[String]("aaaaaaa", "bb", "cc"))).equals(("aaaaaaa"))); assert(findMax((List[String]("abc"...
[ "\n }\n" ]
HumanEval_159_eat
scala
import scala.math._ import scala.collection.mutable._ object Problem { // You're a hungry rabbit, and you already have eaten a certain number of carrots, // but now you need to eat more carrots to complete the day's meals. // you should return an array of [ total number of eaten carrots after your meals, ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_159_eat.py
verbatim
} def main(args: Array[String]) = { assert(eat((5l), (6l), (10l)).equals((List[Long](11l.toLong, 4l.toLong)))); assert(eat((4l), (8l), (9l)).equals((List[Long](12l.toLong, 1l.toLong)))); assert(eat((1l), (10l), (10l)).equals((List[Long](11l.toLong, 0l.toLong)))); assert(eat((2l), (11l), (5l)).eq...
[ "\n }\n" ]
HumanEval_15_string_sequence
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Return a string containing space-delimited numbers starting from 0 upto n inclusive. // >>> stringSequence((0l)) // ("0") // >>> stringSequence((5l)) // ("0 1 2 3 4 5") def stringSequence(n : Long) : String = {
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_15_string_sequence.py
verbatim
} 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"))); } }
[ "\n }\n" ]
HumanEval_160_do_algebra
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Given two lists operator, and operand. The first list has basic algebra operations, and // the second list is a list of integers. Use the two given lists to build the algebric // expression and return the evaluation of this expressi...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_160_do_algebra.py
verbatim
} def main(args: Array[String]) = { assert(doAlgebra((List[String]("**", "*", "+")), (List[Long](2l.toLong, 3l.toLong, 4l.toLong, 5l.toLong))) == (37l)); assert(doAlgebra((List[String]("+", "*", "-")), (List[Long](2l.toLong, 3l.toLong, 4l.toLong, 5l.toLong))) == (9l)); assert(doAlgebra((List[String]...
[ "\n }\n" ]
HumanEval_161_solve
scala
import scala.math._ import scala.collection.mutable._ object Problem { // You are given a string s. // if s[i] is a letter, reverse its case from lower to upper or vise versa, // otherwise keep it as it is. // If the string contains no letters, reverse the string. // The function should return the ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_161_solve.py
verbatim
} def main(args: Array[String]) = { assert(solve(("AsDf")).equals(("aSdF"))); assert(solve(("1234")).equals(("4321"))); assert(solve(("ab")).equals(("AB"))); assert(solve(("#a@C")).equals(("#A@c"))); assert(solve(("#AsdfW^45")).equals(("#aSDFw^45"))); assert(solve(("#6@2")).equals(("2@6#...
[ "\n }\n" ]
HumanEval_162_string_to_md5
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Given a string 'text', return its md5 hash equivalent string. // If 'text' is an empty string, return None. // >>> stringToMd5(("Hello world")) // Some("3e25960a79dbc69b674cd4ec67a72c62") def stringToMd5(text : String) : Optio...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_162_string_to_md5.py
verbatim
} def main(args: Array[String]) = { assert(stringToMd5(("Hello world")).equals(Some("3e25960a79dbc69b674cd4ec67a72c62"))); assert(stringToMd5(("")).equals(None)); assert(stringToMd5(("A B C")).equals(Some("0ef78513b0cb8cef12743f5aeb35f888"))); assert(stringToMd5(("password")).equals(Some("5f4dcc...
[ "\n }\n" ]
HumanEval_163_generate_integers
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Given two positive integers a and b, return the even digits between a // and b, in ascending order. // For example: // >>> generateIntegers((2l), (8l)) // (List[Long](2l.toLong, 4l.toLong, 6l.toLong, 8l.toLong)) // >>> gen...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_163_generate_integers.py
verbatim
} def main(args: Array[String]) = { assert(generateIntegers((2l), (10l)).equals((List[Long](2l.toLong, 4l.toLong, 6l.toLong, 8l.toLong)))); assert(generateIntegers((10l), (2l)).equals((List[Long](2l.toLong, 4l.toLong, 6l.toLong, 8l.toLong)))); assert(generateIntegers((132l), (2l)).equals((List[Long]...
[ "\n }\n" ]
HumanEval_16_count_distinct_characters
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Given a string, find out how many distinct characters (regardless of case) does it consist of // >>> countDistinctCharacters(("xyzXYZ")) // (3l) // >>> countDistinctCharacters(("Jerry")) // (4l) def countDistinctCharacters...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_16_count_distinct_characters.py
verbatim
} def main(args: Array[String]) = { assert(countDistinctCharacters(("")) == (0l)); assert(countDistinctCharacters(("abcde")) == (5l)); assert(countDistinctCharacters(("abcdecadeCADE")) == (5l)); assert(countDistinctCharacters(("aaaaAAAAaaaa")) == (1l)); assert(countDistinctCharacters(("Jerry...
[ "\n }\n" ]
HumanEval_17_parse_music
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Input to this function is a string representing musical notes in a special ASCII format. // Your task is to parse this string and return list of integers corresponding to how many beats does each // not last. // Here is a legend: ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_17_parse_music.py
verbatim
} 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(pars...
[ "\n }\n" ]
HumanEval_18_how_many_times
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Find how many times a given substring can be found in the original string. Count overlaping cases. // >>> howManyTimes((""), ("a")) // (0l) // >>> howManyTimes(("aaa"), ("a")) // (3l) // >>> howManyTimes(("aaaa"), ("aa")) ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_18_how_many_times.py
verbatim
} 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)); } }
[ "\n }\n" ]
HumanEval_19_sort_numbers
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Input is a space-delimited string of numberals from 'zero' to 'nine'. // Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'. // Return the string with numbers sorted from smallest to la...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_19_sort_numbers.py
verbatim
} 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")))...
[ "\n }\n" ]
HumanEval_1_separate_paren_groups
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Input to this function is a string containing multiple groups of nested parentheses. Your goal is to // separate those group into separate strings and return the list of those. // Separate groups are balanced (each open brace is prope...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_1_separate_paren_groups.py
verbatim
} def main(args: Array[String]) = { assert(separateParenGroups(("(()()) ((())) () ((())()())")).equals((List[String]("(()())", "((()))", "()", "((())()())")))); assert(separateParenGroups(("() (()) ((())) (((())))")).equals((List[String]("()", "(())", "((()))", "(((())))")))); assert(separateParenGr...
[ "\n }\n" ]
HumanEval_20_find_closest_elements
scala
import scala.math._ import scala.collection.mutable._ object Problem { // From a supplied list of numbers (of length at least two) select and return two that are the closest to each // other and return them in order (smaller number, larger number). // >>> findClosestElements((List[Float](1.0f.toFloat, 2.0f....
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_20_find_closest_elements.py
verbatim
} 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))).equal...
[ "\n }\n" ]
HumanEval_21_rescale_to_unit
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Given list of numbers (of at least two elements), apply a linear transform to that list, // such that the smallest number will become 0 and the largest will become 1 // >>> rescaleToUnit((List[Float](1.0f.toFloat, 2.0f.toFloat, 3.0f.t...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_21_rescale_to_unit.py
verbatim
} 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[F...
[ "\n }\n" ]
HumanEval_22_filter_integers
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Filter given list of any python values only for integers // >>> filterIntegers((List[Any]("a", 3.14f, 5l))) // (List[Long](5l.toLong)) // >>> filterIntegers((List[Any](1l, 2l, 3l, "abc", Map[Long,Long](), List[Long]()))) // (L...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_22_filter_integers.py
verbatim
} 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"))).equa...
[ "\n }\n" ]
HumanEval_23_strlen
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Return length of given string // >>> stringLength(("")) // (0l) // >>> stringLength(("abc")) // (3l) def strlen(string : String) : Long = {
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_23_strlen.py
verbatim
} def main(args: Array[String]) = { assert(strlen(("")) == (0l)); assert(strlen(("x")) == (1l)); assert(strlen(("asdasnakj")) == (9l)); } }
[ "\n }\n" ]
HumanEval_24_largest_divisor
scala
import scala.math._ import scala.collection.mutable._ object Problem { // For a given number n, find the largest number that divides n evenly, smaller than n // >>> largestDivisor((15l)) // (5l) def largestDivisor(n : Long) : Long = {
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_24_largest_divisor.py
verbatim
} 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)); } }
[ "\n }\n" ]
HumanEval_25_factorize
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Return list of prime factors of given integer in the order from smallest to largest. // Each of the factors should be listed number of times corresponding to how many times it appeares in factorization. // Input number should be equal...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_25_factorize.py
verbatim
} 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, 19...
[ "\n }\n" ]
HumanEval_26_remove_duplicates
scala
import scala.math._ import scala.collection.mutable._ object Problem { // From a list of integers, remove all elements that occur more than once. // Keep order of elements left the same as in the input. // >>> removeDuplicates((List[Long](1l.toLong, 2l.toLong, 3l.toLong, 2l.toLong, 4l.toLong))) // (List...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_26_remove_duplicates.py
verbatim
} 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....
[ "\n }\n" ]
HumanEval_27_flip_case
scala
import scala.math._ import scala.collection.mutable._ object Problem { // For a given string, flip lowercase characters to uppercase and uppercase to lowercase. // >>> flipCase(("Hello")) // ("hELLO") def flipCase(string : String) : String = {
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_27_flip_case.py
verbatim
} 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"))); } }
[ "\n }\n" ]
HumanEval_28_concatenate
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Concatenate list of strings into a single string // >>> concatenate((List[String]())) // ("") // >>> concatenate((List[String]("a", "b", "c"))) // ("abc") def concatenate(strings : List[String]) : String = {
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_28_concatenate.py
verbatim
} 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"))); } }
[ "\n }\n" ]
HumanEval_29_filter_by_prefix
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Filter an input list of strings only for ones that start with a given prefix. // >>> filterByPrefix((List[String]()), ("a")) // (List[String]()) // >>> filterByPrefix((List[String]("abc", "bcd", "cde", "array")), ("a")) // (Li...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_29_filter_by_prefix.py
verbatim
} 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")))); } }
[ "\n }\n" ]
HumanEval_2_truncate_number
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Given a positive floating point number, it can be decomposed into // and integer part (largest integer smaller than given number) and decimals // (leftover part always smaller than 1). // Return the decimal part of the number. ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_2_truncate_number.py
verbatim
} def main(args: Array[String]) = { assert(truncateNumber((3.5f)) == (0.5f)); assert(truncateNumber((1.25f)) == (0.25f)); assert(truncateNumber((123.0f)) == (0.0f)); } }
[ "\n }\n" ]
HumanEval_30_get_positive
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Return only positive numbers in the list. // >>> 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.toLo...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_30_get_positive.py
verbatim
} 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, 12...
[ "\n }\n" ]
HumanEval_31_is_prime
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Return true if a given number is prime, and false otherwise. // >>> isPrime((6l)) // (false) // >>> isPrime((101l)) // (true) // >>> isPrime((11l)) // (true) // >>> isPrime((13441l)) // (true) // >>> isPrim...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_31_is_prime.py
verbatim
} 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)); as...
[ "\n }\n" ]
HumanEval_33_sort_third
scala
import scala.math._ import scala.collection.mutable._ object Problem { // This function takes a list l and returns a list l' such that // l' is identical to l in the indicies that are not divisible by three, while its values at the indicies that are divisible by three are equal // to the values of the corre...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_33_sort_third.py
verbatim
} 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...
[ "\n }\n" ]
HumanEval_34_unique
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Return sorted unique elements in a list // >>> 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.toL...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_34_unique.py
verbatim
} 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)))); } }
[ "\n }\n" ]
HumanEval_35_max_element
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Return maximum element in the list. // >>> 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, 1...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_35_max_element.py
verbatim
} 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)); } }
[ "\n }\n" ]
HumanEval_36_fizz_buzz
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Return the number of times the digit 7 appears in integers less than n which are divisible by 11 or 13. // >>> fizzBuzz((50l)) // (0l) // >>> fizzBuzz((78l)) // (2l) // >>> fizzBuzz((79l)) // (3l) def fizzBuzz(n : ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_36_fizz_buzz.py
verbatim
} 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)); as...
[ "\n }\n" ]
HumanEval_37_sort_even
scala
import scala.math._ import scala.collection.mutable._ object Problem { // This function takes a list l and returns a list l' such that // l' is identical to l in the odd indicies, while its values at the even indicies are equal // to the values of the even indicies of l, but sorted. // >>> sortEven((Lis...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_37_sort_even.py
verbatim
} 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.to...
[ "\n }\n" ]
HumanEval_39_prime_fib
scala
import scala.math._ import scala.collection.mutable._ object Problem { // prime_fib returns n-th number that is a Fibonacci number and it's also prime. // >>> primeFib((1l)) // (2l) // >>> primeFib((2l)) // (3l) // >>> primeFib((3l)) // (5l) // >>> primeFib((4l)) // (13l) // >>> ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_39_prime_fib.py
verbatim
} 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(primeF...
[ "\n }\n" ]
HumanEval_3_below_zero
scala
import scala.math._ import scala.collection.mutable._ object Problem { // You're given a list of deposit and withdrawal operations on a bank account that starts with // zero balance. Your task is to detect if at any point the balance of account fallls below zero, and // at that point function should return ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_3_below_zero.py
verbatim
} 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)); ass...
[ "\n }\n" ]
HumanEval_40_triples_sum_to_zero
scala
import scala.math._ import scala.collection.mutable._ object Problem { // triples_sum_to_zero takes a list of integers as an input. // it returns True if there are three distinct elements in the list that // sum to zero, and False otherwise. // >>> triplesSumToZero((List[Long](1l.toLong, 3l.toLong, 5l.t...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_40_triples_sum_to_zero.py
verbatim
} 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....
[ "\n }\n" ]
HumanEval_41_car_race_collision
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Imagine a road that's a perfectly straight infinitely long line. // n cars are driving left to right; simultaneously, a different set of n cars // are driving right to left. The two sets of cars start out being very far from //...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_41_car_race_collision.py
verbatim
} 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)); } }
[ "\n }\n" ]
HumanEval_42_incr_list
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Return list with elements incremented by 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...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_42_incr_list.py
verbatim
} 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.to...
[ "\n }\n" ]
HumanEval_43_pairs_sum_to_zero
scala
import scala.math._ import scala.collection.mutable._ object Problem { // pairs_sum_to_zero takes a list of integers as an input. // it returns True if there are two distinct elements in the list that // sum to zero, and False otherwise. // >>> pairsSumToZero((List[Long](1l.toLong, 3l.toLong, 5l.toLong,...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_43_pairs_sum_to_zero.py
verbatim
} 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)...
[ "\n }\n" ]
HumanEval_44_change_base
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Change numerical base of input number x to base. // return string representation after the conversion. // base numbers are less than 10. // >>> changeBase((8l), (3l)) // ("22") // >>> changeBase((8l), (2l)) // ("1000")...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_44_change_base.py
verbatim
} 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"))); as...
[ "\n }\n" ]
HumanEval_45_triangle_area
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Given length of a side and high return area for a triangle. // >>> triangleArea((5l), (3l)) // (7.5f) def triangleArea(a : Long, h : Long) : Float = {
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_45_triangle_area.py
verbatim
} def main(args: Array[String]) = { assert(triangleArea((5l), (3l)) == (7.5f)); assert(triangleArea((2l), (2l)) == (2.0f)); assert(triangleArea((10l), (8l)) == (40.0f)); } }
[ "\n }\n" ]
HumanEval_46_fib4
scala
import scala.math._ import scala.collection.mutable._ object Problem { // The Fib4 number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows: // 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-...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_46_fib4.py
verbatim
} def main(args: Array[String]) = { assert(fib4((5l)) == (4l)); assert(fib4((8l)) == (28l)); assert(fib4((10l)) == (104l)); assert(fib4((12l)) == (386l)); } }
[ "\n }\n" ]
HumanEval_47_median
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Return median of elements in the list 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)))...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_47_median.py
verbatim
} 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(me...
[ "\n }\n" ]
HumanEval_48_is_palindrome
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Checks if given string is a palindrome // >>> isPalindrome(("")) // (true) // >>> isPalindrome(("aba")) // (true) // >>> isPalindrome(("aaaaa")) // (true) // >>> isPalindrome(("zbcd")) // (false) def isPali...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_48_is_palindrome.py
verbatim
} 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)); ...
[ "\n }\n" ]
HumanEval_49_modp
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Return 2^n modulo p (be aware of numerics). // >>> modp((3l), (5l)) // (3l) // >>> modp((1101l), (101l)) // (2l) // >>> modp((0l), (101l)) // (1l) // >>> modp((3l), (11l)) // (8l) // >>> modp((100l), (101l)...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_49_modp.py
verbatim
} 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...
[ "\n }\n" ]
HumanEval_4_mean_absolute_deviation
scala
import scala.math._ import scala.collection.mutable._ object Problem { // For a given list of input numbers, calculate Mean Absolute Deviation // around the mean of this dataset. // Mean Absolute Deviation is the average absolute difference between each // element and a centerpoint (mean in this case): ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_4_mean_absolute_deviation.py
verbatim
} 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...
[ "\n }\n" ]
HumanEval_51_remove_vowels
scala
import scala.math._ import scala.collection.mutable._ object Problem { // remove_vowels is a function that takes string and returns string without vowels. // >>> removeVowels(("")) // ("") // >>> removeVowels(("abcdef")) // ("bcdf") // >>> removeVowels(("aaaaa")) // ("") // >>> removeVow...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_51_remove_vowels.py
verbatim
} 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"))); ...
[ "\n }\n" ]
HumanEval_52_below_threshold
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Return True if all numbers in the list l are below threshold t. // >>> belowThreshold((List[Long](1l.toLong, 2l.toLong, 4l.toLong, 10l.toLong)), (100l)) // (true) // >>> belowThreshold((List[Long](1l.toLong, 20l.toLong, 4l.toLong,...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_52_below_threshold.py
verbatim
} 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.to...
[ "\n }\n" ]
HumanEval_53_add
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Add two numbers x and y // >>> add((2l), (3l)) // (5l) // >>> add((5l), (7l)) // (12l) def add(x : Long, y : Long) : Long = {
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_53_add.py
verbatim
} 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)); } }
[ "\n }\n" ]
HumanEval_54_same_chars
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Check if two words have the same characters. // >>> sameChars(("eabcdzzzz"), ("dddzzzzzzzddeddabc")) // (true) // >>> sameChars(("abcd"), ("dddddddabc")) // (true) // >>> sameChars(("dddddddabc"), ("abcd")) // (true) ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_54_same_chars.py
verbatim
} 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(("ab...
[ "\n }\n" ]
HumanEval_55_fib
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Return n-th Fibonacci number. // >>> fib((10l)) // (55l) // >>> fib((1l)) // (1l) // >>> fib((8l)) // (21l) def fib(n : Long) : Long = {
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_55_fib.py
verbatim
} 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)); } }
[ "\n }\n" ]
HumanEval_56_correct_bracketing
scala
import scala.math._ import scala.collection.mutable._ object Problem { // brackets is a string of "<" and ">". // return True if every opening bracket has a corresponding closing bracket. // >>> correctBracketing(("<")) // (false) // >>> correctBracketing(("<>")) // (true) // >>> correctBrac...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_56_correct_bracketing.py
verbatim
} def main(args: Array[String]) = { assert(correctBracketing(("<>")) == (true)); assert(correctBracketing(("<<><>>")) == (true)); assert(correctBracketing(("<><><<><>><>")) == (true)); assert(correctBracketing(("<><><<<><><>><>><<><><<>>>")) == (true)); assert(correctBracketing(("<<<><>>>>")...
[ "\n }\n" ]
HumanEval_57_monotonic
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Return True is list elements are monotonically increasing or decreasing. // >>> monotonic((List[Long](1l.toLong, 2l.toLong, 4l.toLong, 20l.toLong))) // (true) // >>> monotonic((List[Long](1l.toLong, 20l.toLong, 4l.toLong, 10l.toLo...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_57_monotonic.py
verbatim
} 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))...
[ "\n }\n" ]
HumanEval_58_common
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Return sorted unique common elements for two lists. // >>> 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...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_58_common.py
verbatim
} 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(...
[ "\n }\n" ]
HumanEval_59_largest_prime_factor
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Return the largest prime factor of n. Assume n > 1 and is not a prime. // >>> largestPrimeFactor((13195l)) // (29l) // >>> largestPrimeFactor((2048l)) // (2l) def largestPrimeFactor(n : Long) : Long = {
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_59_largest_prime_factor.py
verbatim
} 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)); } }
[ "\n }\n" ]
HumanEval_5_intersperse
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Insert a number 'delimeter' between every two consecutive elements of input list `numbers' // >>> intersperse((List[Long]()), (4l)) // (List[Long]()) // >>> intersperse((List[Long](1l.toLong, 2l.toLong, 3l.toLong)), (4l)) // (...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_5_intersperse.py
verbatim
} 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(interspe...
[ "\n }\n" ]
HumanEval_60_sum_to_n
scala
import scala.math._ import scala.collection.mutable._ object Problem { // sum_to_n is a function that sums numbers from 1 to n. // >>> sumToN((30l)) // (465l) // >>> sumToN((100l)) // (5050l) // >>> sumToN((5l)) // (15l) // >>> sumToN((10l)) // (55l) // >>> sumToN((1l)) // (1...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_60_sum_to_n.py
verbatim
} 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)); } }
[ "\n }\n" ]
HumanEval_61_correct_bracketing
scala
import scala.math._ import scala.collection.mutable._ object Problem { // brackets is a string of "(" and ")". // return True if every opening bracket has a corresponding closing bracket. // >>> correctBracketing(("(")) // (false) // >>> correctBracketing(("()")) // (true) // >>> correctBrac...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_61_correct_bracketing.py
verbatim
} def main(args: Array[String]) = { assert(correctBracketing(("()")) == (true)); assert(correctBracketing(("(()())")) == (true)); assert(correctBracketing(("()()(()())()")) == (true)); assert(correctBracketing(("()()((()()())())(()()(()))")) == (true)); assert(correctBracketing(("((()())))")...
[ "\n }\n" ]
HumanEval_62_derivative
scala
import scala.math._ import scala.collection.mutable._ object Problem { // xs represent coefficients of a polynomial. // xs[0] + xs[1] * x + xs[2] * x^2 + .... // Return derivative of this polynomial in the same form. // >>> derivative((List[Long](3l.toLong, 1l.toLong, 2l.toLong, 4l.toLong, 5l.toLong))) ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_62_derivative.py
verbatim
} 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)))); ...
[ "\n }\n" ]
HumanEval_63_fibfib
scala
import scala.math._ import scala.collection.mutable._ object Problem { // The FibFib number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows: // fibfib(0) == 0 // fibfib(1) == 0 // fibfib(2) == 1 // fibfib(n) == fibfib(n-1) + fibfib(n-2) + fibfib(n-3). // Pleas...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_63_fibfib.py
verbatim
} 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)); } }
[ "\n }\n" ]
HumanEval_64_vowels_count
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Write a function vowels_count which takes a string representing // a word as input and returns the number of vowels in the string. // Vowels in this case are 'a', 'e', 'i', 'o', 'u'. Here, 'y' is also a // vowel, but only when it ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_64_vowels_count.py
verbatim
} 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(vowelsCou...
[ "\n }\n" ]
HumanEval_65_circular_shift
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Circular shift the digits of the integer x, shift the digits right by shift // and return the result as a string. // If shift > number of digits, return digits reversed. // >>> circularShift((12l), (1l)) // ("21") // >>> c...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_65_circular_shift.py
verbatim
} 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"))...
[ "\n }\n" ]
HumanEval_66_digitSum
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Task // Write a function that takes a string as input and returns the sum of the upper characters only' // ASCII codes. // Examples: // >>> digitSum(("")) // (0l) // >>> digitSum(("abAB")) // (131l) // >>> digi...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_66_digitSum.py
verbatim
} 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((" ...
[ "\n }\n" ]
HumanEval_67_fruit_distribution
scala
import scala.math._ import scala.collection.mutable._ object Problem { // In this task, you will be given a string that represents a number of apples and oranges // that are distributed in a basket of fruit this basket contains // apples, oranges, and mango fruits. Given the string that represents the tot...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_67_fruit_distribution.py
verbatim
} 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"...
[ "\n }\n" ]
HumanEval_68_pluck
scala
import scala.math._ import scala.collection.mutable._ object Problem { // "Given an array representing a branch of a tree that has non-negative integer nodes // your task is to pluck one of the nodes and return it. // The plucked node should be the node with the smallest even value. // If multiple nodes...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_68_pluck.py
verbatim
} 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]()))); ...
[ "\n }\n" ]
HumanEval_69_search
scala
import scala.math._ import scala.collection.mutable._ object Problem { // You are given a non-empty list of positive integers. Return the greatest integer that is greater than // zero, and has a frequency greater than or equal to the value of the integer itself. // The frequency of an integer is the numbe...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_69_search.py
verbatim
} 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)); as...
[ "\n }\n" ]
HumanEval_6_parse_nested_parens
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Input to this function is a string represented multiple groups for nested parentheses separated by spaces. // For each of the group, output the deepest level of nesting of parentheses. // E.g. (()()) has maximum two levels of nesting ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_6_parse_nested_parens.py
verbatim
} 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(parseNested...
[ "\n }\n" ]
HumanEval_70_strange_sort_list
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Given list of integers, return list in strange order. // Strange sorting, is when you start with the minimum value, // then maximum of the remaining integers, then minimum and so on. // Examples: // >>> strangeSortList((List[L...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_70_strange_sort_list.py
verbatim
} 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...
[ "\n }\n" ]
HumanEval_71_triangle_area
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Given the lengths of the three sides of a triangle. Return the area of // the triangle rounded to 2 decimal points if the three sides form a valid triangle. // Otherwise return -1 // Three sides make a valid triangle when the sum...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_71_triangle_area.py
verbatim
} 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); asser...
[ "\n }\n" ]