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_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. // >>> remove_vowels('') // '' // >>> remove_vowels('abcdef') // 'bcdf' // >>> remove_vowels('aaaaa') // '' // >>> remove_vowels('aaB...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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. // >>> below_threshold([1, 2, 4, 10], 100) // True // >>> below_threshold([1, 20, 4, 10], 5) // False def belowThreshold(l : List[Long], t : Long) : Boolean =...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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(2, 3) // 5 // >>> add(5, 7) // 12 def add(x : Long, y : Long) : Long = {
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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. // >>> same_chars('eabcdzzzz', 'dddzzzzzzzddeddabc') // True // >>> same_chars('abcd', 'dddddddabc') // True // >>> same_chars('dddddddabc', 'abcd') // True // >>> same_...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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(10) // 55 // >>> fib(1) // 1 // >>> fib(8) // 21 def fib(n : Long) : Long = {
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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. // >>> correct_bracketing("<") // False // >>> correct_bracketing("<>") // True // >>> correct_bracketin...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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([1, 2, 4, 20]) // True // >>> monotonic([1, 20, 4, 10]) // False // >>> monotonic([4, 1, 0, -10]) // True def monotonic(l : ...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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([1, 4, 3, 34, 653, 2, 5], [5, 7, 1, 5, 9, 653, 121]) // [1, 5, 653] // >>> common([5, 3, 2, 8], [3, 2]) // [2, 3] def common(l1 : List[Long], l2 : List[Long...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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. // >>> largest_prime_factor(13195) // 29 // >>> largest_prime_factor(2048) // 2 def largestPrimeFactor(n : Long) : Long = {
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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([], 4) // [] // >>> intersperse([1, 2, 3], 4) // [1, 4, 2, 4, 3] def intersperse(numbers : List[Long], delimeter...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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. // >>> sum_to_n(30) // 465 // >>> sum_to_n(100) // 5050 // >>> sum_to_n(5) // 15 // >>> sum_to_n(10) // 55 // >>> sum_to_n(1) // 1 def sumToN(n ...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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. // >>> correct_bracketing("(") // False // >>> correct_bracketing("()") // True // >>> correct_bracketin...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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([3, 1, 2, 4, 5]) // [1, 4, 12, 20] // >>> derivative([1, 2, 3...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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 ...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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. // >>> circular_shift(12, 1) // "21" // >>> circular...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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("") => 0 // digitSum("abAB") => 131 // digitSum("abcCd") => 67 // dig...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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 ...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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: // strange_sort_list([1, 2, 3,...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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" ]
HumanEval_72_will_it_fly
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Write a function that returns True if the object q will fly, and False otherwise. // The object q will fly if it's balanced (it is a palindromic list) and the sum of its elements is less than or equal the maximum possible weight w. //...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_72_will_it_fly.py
verbatim
} 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.toL...
[ "\n }\n" ]
HumanEval_73_smallest_change
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Given an array arr of integers, find the minimum number of elements that // need to be changed to make the array palindromic. A palindromic array is an array that // is read the same backwards and forwards. In one change, you can chan...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_73_smallest_change.py
verbatim
} 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(...
[ "\n }\n" ]
HumanEval_74_total_match
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Write a function that accepts two lists of strings and returns the list that has // total number of chars in the all strings of the list less than the other list. // if the two lists have the same number of chars, return the first li...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_74_total_match.py
verbatim
} 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", ...
[ "\n }\n" ]
HumanEval_75_is_multiply_prime
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Write a function that returns true if the given number is the multiplication of 3 prime numbers // and false otherwise. // Knowing that (a) is less then 100. // Example: // is_multiply_prime(30) == True // 30 = 2 * 3 * 5 ...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_75_is_multiply_prime.py
verbatim
} 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))...
[ "\n }\n" ]
HumanEval_76_is_simple_power
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Your task is to write a function that returns true if a number x is a simple // power of n and false in other cases. // x is a simple power of n if n**int=x // For example: // is_simple_power(1, 4) => true // is_simple_pow...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_76_is_simple_power.py
verbatim
} 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(isSimplePow...
[ "\n }\n" ]
HumanEval_77_iscube
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Write a function that takes an integer a and returns True // if this ingeger is a cube of some integer number. // Note: you may assume the input is always valid. // Examples: // iscube(1) ==> True // iscube(2) ==> False ...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_77_iscube.py
verbatim
} 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(iscu...
[ "\n }\n" ]
HumanEval_78_hex_key
scala
import scala.math._ import scala.collection.mutable._ object Problem { // You have been tasked to write a function that receives // a hexadecimal number as a string and counts the number of hexadecimal // digits that are primes (prime number, or a prime, is a natural number // greater than 1 that is ...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_78_hex_key.py
verbatim
} 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)); ...
[ "\n }\n" ]
HumanEval_79_decimal_to_binary
scala
import scala.math._ import scala.collection.mutable._ object Problem { // You will be given a number in decimal form and your task is to convert it to // binary format. The function should return a string, with each character representing a binary // number. Each character in the string will be '0' or '1'. ...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_79_decimal_to_binary.py
verbatim
} 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"))); } }
[ "\n }\n" ]
HumanEval_7_filter_by_substring
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Filter an input list of strings only for ones that contain given substring // >>> filter_by_substring([], 'a') // [] // >>> filter_by_substring(['abc', 'bacd', 'cde', 'array'], 'a') // ['abc', 'bacd', 'array'] def filterBy...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_7_filter_by_substring.py
verbatim
} 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[Stri...
[ "\n }\n" ]
HumanEval_80_is_happy
scala
import scala.math._ import scala.collection.mutable._ object Problem { // You are given a string s. // Your task is to check if the string is happy or not. // A string is happy if its length is at least 3 and every 3 consecutive letters are distinct // For example: // is_happy(a) => False // is_...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_80_is_happy.py
verbatim
} 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")) ...
[ "\n }\n" ]
HumanEval_81_numerical_letter_grade
scala
import scala.math._ import scala.collection.mutable._ object Problem { // It is the last week of the semester and the teacher has to give the grades // to students. The teacher has been making her own algorithm for grading. // The only problem is, she has lost the code she used for grading. // She has g...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_81_numerical_letter_grade.py
verbatim
} 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(numeric...
[ "\n }\n" ]
HumanEval_82_prime_length
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Write a function that takes a string and returns True if the string // length is a prime number or False otherwise // Examples // prime_length('Hello') == True // prime_length('abcdcba') == True // prime_length('kittens') ...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_82_prime_length.py
verbatim
} 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...
[ "\n }\n" ]
HumanEval_83_starts_one_ends
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Given a positive integer n, return the count of the numbers of n-digit // positive integers that start or end with 1. def startsOneEnds(n : Long) : Long = {
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_83_starts_one_ends.py
verbatim
} 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)); } }
[ "\n }\n" ]
HumanEval_84_solve
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Given a positive integer N, return the total sum of its digits in binary. // Example // For N = 1000, the sum of digits will be 1 the output should be "1". // For N = 150, the sum of digits will be 6 the output should be "110". ...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_84_solve.py
verbatim
} 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"))); } }
[ "\n }\n" ]
HumanEval_85_add
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Given a non-empty list of integers lst. add the even elements that are at odd indices.. // Examples: // add([4, 2, 6, 7]) ==> 2 def add(lst : List[Long]) : Long = {
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_85_add.py
verbatim
} 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[...
[ "\n }\n" ]
HumanEval_86_anti_shuffle
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Write a function that takes a string and returns an ordered version of it. // Ordered version of string, is a string where all words (separated by space) // are replaced by a new word where all the characters arranged in // ascend...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_86_anti_shuffle.py
verbatim
} 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...
[ "\n }\n" ]
HumanEval_87_get_row
scala
import scala.math._ import scala.collection.mutable._ object Problem { // You are given a 2 dimensional data, as a nested lists, // which is similar to matrix, however, unlike matrices, // each row may contain a different number of columns. // Given lst, and integer x, find integers x in the list, /...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_87_get_row.py
verbatim
} 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)...
[ "\n }\n" ]
HumanEval_88_sort_array
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Given an array of non-negative integers, return a copy of the given array after sorting, // you will sort the given array in ascending order if the sum( first index value, last index value) is odd, // or sort it in descending order if...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_88_sort_array.py
verbatim
} 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....
[ "\n }\n" ]
HumanEval_89_encrypt
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Create a function encrypt that takes a string as an argument and // returns a string encrypted with the alphabet being rotated. // The alphabet should be rotated in a manner such that the letters // shift down by two multiplied ...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_89_encrypt.py
verbatim
} 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((...
[ "\n }\n" ]
HumanEval_8_sum_product
scala
import scala.math._ import scala.collection.mutable._ object Problem { // For a given list of integers, return a tuple consisting of a sum and a product of all the integers in a list. // Empty sum should be equal to 0 and empty product should be equal to 1. // >>> sum_product([]) // (0, 1) // >>> su...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_8_sum_product.py
verbatim
} 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,...
[ "\n }\n" ]
HumanEval_90_next_smallest
scala
import scala.math._ import scala.collection.mutable._ object Problem { // You are given a list of integers. // Write a function next_smallest() that returns the 2nd smallest element of the list. // Return None if there is no such element. // next_smallest([1, 2, 3, 4, 5]) == 2 // next_smallest([5, 1...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_90_next_smallest.py
verbatim
} 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)...
[ "\n }\n" ]
HumanEval_91_is_bored
scala
import scala.math._ import scala.collection.mutable._ object Problem { // You'll be given a string of words, and your task is to count the number // of boredoms. A boredom is a sentence that starts with the word "I". // Sentences are delimited by '.', '?' or '!'. // For example: // >>> is_bored("Hel...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_91_is_bored.py
verbatim
} 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)); ass...
[ "\n }\n" ]
HumanEval_92_any_int
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Create a function that takes 3 numbers. // Returns true if one of the numbers is equal to the sum of the other two, and all numbers are integers. // Returns false in any other cases. // Examples // any_int(5, 2, 7) ➞ True ...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_92_any_int.py
verbatim
} 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...
[ "\n }\n" ]
HumanEval_93_encode
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Write a function that takes a message, and encodes in such a // way that it swaps case of all letters, replaces all vowels in // the message with the letter that appears 2 places ahead of that // vowel in the english alphabet. ...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_93_encode.py
verbatim
} 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(("...
[ "\n }\n" ]
HumanEval_94_skjkasdkd
scala
import scala.math._ import scala.collection.mutable._ object Problem { // You are given a list of integers. // You need to find the largest prime value and return the sum of its digits. // Examples: // For lst = [0,3,2,1,3,5,7,4,5,5,5,2,181,32,4,32,3,2,32,324,4,3] the output should be 10 // For lst ...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_94_skjkasdkd.py
verbatim
} 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.to...
[ "\n }\n" ]
HumanEval_95_check_dict_case
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Given a dictionary, return True if all keys are strings in lower // case or all keys are strings in upper case, else return False. // The function should return False is the given dictionary is empty. // Examples: // check_di...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_95_check_dict_case.py
verbatim
} 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", "...
[ "\n }\n" ]
HumanEval_96_count_up_to
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Implement a function that takes an non-negative integer and returns an array of the first n // integers that are prime numbers and less than n. // for example: // count_up_to(5) => [2,3] // count_up_to(11) => [2,3,5,7] // ...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_96_count_up_to.py
verbatim
} 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((Li...
[ "\n }\n" ]
HumanEval_97_multiply
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Complete the function that takes two integers and returns // the product of their unit digits. // Assume the input is always valid. // Examples: // multiply(148, 412) should return 16. // multiply(19, 28) should return 72...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_97_multiply.py
verbatim
} 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)); ...
[ "\n }\n" ]
HumanEval_98_count_upper
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Given a string s, count the number of uppercase vowels in even indices. // For example: // count_upper('aBCdEf') returns 1 // count_upper('abcdefg') returns 0 // count_upper('dBBE') returns 0 def countUpper(s : String) : L...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_98_count_upper.py
verbatim
} 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"...
[ "\n }\n" ]
HumanEval_99_closest_integer
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Create a function that takes a value (string) representing a number // and returns the closest integer to it. If the number is equidistant // from two integers, round it away from zero. // Examples // >>> closest_integer("10")...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_99_closest_integer.py
verbatim
} 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)); } }
[ "\n }\n" ]
HumanEval_9_rolling_max
scala
import scala.math._ import scala.collection.mutable._ object Problem { // From a given list of integers, generate a list of rolling maximum element found until given moment // in the sequence. // >>> rolling_max([1, 2, 3, 2, 3, 4, 2]) // [1, 2, 3, 3, 3, 4, 4] def rollingMax(numbers : List[Long]) : L...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_9_rolling_max.py
verbatim
} 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,...
[ "\n }\n" ]
HumanEval_0_has_close_elements
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Check if in given list of numbers, are any two numbers closer to each other than // given threshold. def hasCloseElements(numbers : List[Float], threshold : Float) : Boolean = {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_0_has_close_elements.py
verbatim
} 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...
[ "\n }\n" ]
HumanEval_100_make_a_pile
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Given a positive integer n, you have to make a pile of n levels of stones. // The first level has n stones. // The number of stones in the next level is: // - the next odd number if n is odd. // - the next even number if n is ...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_100_make_a_pile.py
verbatim
} 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.toL...
[ "\n }\n" ]
HumanEval_101_words_string
scala
import scala.math._ import scala.collection.mutable._ object Problem { // You will be given a string of words separated by commas or spaces. Your task is // to split the string into words and return an array of the words. // For example: def wordsString(s : String) : List[String] = {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_101_words_string.py
verbatim
} 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"...
[ "\n }\n" ]
HumanEval_102_choose_num
scala
import scala.math._ import scala.collection.mutable._ object Problem { // This function takes two positive numbers x and y and returns the // biggest even integer number that is in the range [x, y] inclusive. If // there's no such number, then the function should return -1. // For example: def choo...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_102_choose_num.py
verbatim
} 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)) ==...
[ "\n }\n" ]
HumanEval_103_rounded_avg
scala
import scala.math._ import scala.collection.mutable._ object Problem { // You are given two positive integers n and m, and your task is to compute the // average of the integers from n through m (including n and m). // Round the answer to the nearest integer and convert that to binary. // If n is great...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_103_rounded_avg.py
verbatim
} def main(args: Array[String]) = { assert(roundedAvg((1l), (5l)).equals("0b11")); assert(roundedAvg((7l), (13l)).equals("0b1010")); assert(roundedAvg((964l), (977l)).equals("0b1111001010")); assert(roundedAvg((996l), (997l)).equals("0b1111100100")); assert(roundedAvg((560l), (851l)).equals(...
[ "\n }\n" ]
HumanEval_104_unique_digits
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Given a list of positive integers x. return a sorted list of all // elements that hasn't any even digit. // Note: Returned list should be sorted in increasing order. // For example: def uniqueDigits(x : List[Long]) : List[Lon...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_104_unique_digits.py
verbatim
} def main(args: Array[String]) = { assert(uniqueDigits((List[Long](15l.toLong, 33l.toLong, 1422l.toLong, 1l.toLong))).equals((List[Long](1l.toLong, 15l.toLong, 33l.toLong)))); assert(uniqueDigits((List[Long](152l.toLong, 323l.toLong, 1422l.toLong, 10l.toLong))).equals((List[Long]()))); assert(uniqu...
[ "\n }\n" ]
HumanEval_105_by_length
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Given an array of integers, sort the integers that are between 1 and 9 inclusive, // reverse the resulting array, and then replace each digit by its corresponding name from // "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Ei...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_105_by_length.py
verbatim
} def main(args: Array[String]) = { assert(byLength((List[Long](2l.toLong, 1l.toLong, 1l.toLong, 4l.toLong, 5l.toLong, 8l.toLong, 2l.toLong, 3l.toLong))).equals((List[String]("Eight", "Five", "Four", "Three", "Two", "Two", "One", "One")))); assert(byLength((List[Long]())).equals((List[String]()))); ...
[ "\n }\n" ]
HumanEval_106_f
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Implement the function f that takes n as a parameter, // and returns a list of size n, such that the value of the element at index i is the factorial of i if i is even // or the sum of numbers from 1 to i otherwise. // i starts fr...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_106_f.py
verbatim
} def main(args: Array[String]) = { assert(f((5l)).equals((List[Long](1l.toLong, 2l.toLong, 6l.toLong, 24l.toLong, 15l.toLong)))); assert(f((7l)).equals((List[Long](1l.toLong, 2l.toLong, 6l.toLong, 24l.toLong, 15l.toLong, 720l.toLong, 28l.toLong)))); assert(f((1l)).equals((List[Long](1l.toLong)))); ...
[ "\n }\n" ]
HumanEval_107_even_odd_palindrome
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Given a positive integer n, return a tuple that has the number of even and odd // integer palindromes that fall within the range(1, n), inclusive. // Example 1: // Explanation: // Integer palindrome are 1, 2, 3. one of them is...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_107_even_odd_palindrome.py
verbatim
} def main(args: Array[String]) = { assert(evenOddPalindrome((123l)).equals(((8l, 13l)))); assert(evenOddPalindrome((12l)).equals(((4l, 6l)))); assert(evenOddPalindrome((3l)).equals(((1l, 2l)))); assert(evenOddPalindrome((63l)).equals(((6l, 8l)))); assert(evenOddPalindrome((25l)).equals(((5l...
[ "\n }\n" ]
HumanEval_108_count_nums
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Write a function count_nums which takes an array of integers and returns // the number of elements which has a sum of digits > 0. // If a number is negative, then its first signed digit will be negative: // e.g. -123 has signed di...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_108_count_nums.py
verbatim
} def main(args: Array[String]) = { assert(countNums((List[Long]())) == (0l)); assert(countNums((List[Long](-1l.toLong, -2l.toLong, 0l.toLong))) == (0l)); assert(countNums((List[Long](1l.toLong, 1l.toLong, 2l.toLong, -2l.toLong, 3l.toLong, 4l.toLong, 5l.toLong))) == (6l)); assert(countNums((List...
[ "\n }\n" ]
HumanEval_109_move_one_ball
scala
import scala.math._ import scala.collection.mutable._ object Problem { // We have an array 'arr' of N integers arr[1], arr[2], ..., arr[N].The // numbers in the array will be randomly ordered. Your task is to determine if // it is possible to get an array sorted in non-decreasing order by performing //...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_109_move_one_ball.py
verbatim
} def main(args: Array[String]) = { assert(moveOneBall((List[Long](3l.toLong, 4l.toLong, 5l.toLong, 1l.toLong, 2l.toLong))) == (true)); assert(moveOneBall((List[Long](3l.toLong, 5l.toLong, 10l.toLong, 1l.toLong, 2l.toLong))) == (true)); assert(moveOneBall((List[Long](4l.toLong, 3l.toLong, 1l.toLong,...
[ "\n }\n" ]
HumanEval_10_make_palindrome
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Find the shortest palindrome that begins with a supplied string. // Algorithm idea is simple: // - Find the longest postfix of supplied string that is a palindrome. // - Append to the end of the string reverse of a string prefix t...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_10_make_palindrome.py
verbatim
} 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"))); } }
[ "\n }\n" ]
HumanEval_110_exchange
scala
import scala.math._ import scala.collection.mutable._ object Problem { // In this problem, you will implement a function that takes two lists of numbers, // and determines whether it is possible to perform an exchange of elements // between them to make lst1 a list of only even numbers. // There is no l...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_110_exchange.py
verbatim
} def main(args: Array[String]) = { assert(exchange((List[Long](1l.toLong, 2l.toLong, 3l.toLong, 4l.toLong)), (List[Long](1l.toLong, 2l.toLong, 3l.toLong, 4l.toLong))).equals(("YES"))); assert(exchange((List[Long](1l.toLong, 2l.toLong, 3l.toLong, 4l.toLong)), (List[Long](1l.toLong, 5l.toLong, 3l.toLong,...
[ "\n }\n" ]
HumanEval_111_histogram
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Given a string representing a space separated lowercase letters, return a dictionary // of the letter with the most repetition and containing the corresponding count. // If several letters have the same occurrence, return all of them....
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_111_histogram.py
verbatim
} def main(args: Array[String]) = { assert(histogram(("a b b a")).equals((Map[String,Long]("a" -> 2l, "b" -> 2l)))); assert(histogram(("a b c a b")).equals((Map[String,Long]("a" -> 2l, "b" -> 2l)))); assert(histogram(("a b c d g")).equals((Map[String,Long]("a" -> 1l, "b" -> 1l, "c" -> 1l, "d" -> 1l,...
[ "\n }\n" ]
HumanEval_112_reverse_delete
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Task // We are given two strings s and c, you have to deleted all the characters in s that are equal to any character in c // then check if the result string is palindrome. // A string is called palindrome if it reads the same bac...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_112_reverse_delete.py
verbatim
} def main(args: Array[String]) = { assert(reverseDelete(("abcde"), ("ae")).equals((("bcd", false)))); assert(reverseDelete(("abcdef"), ("b")).equals((("acdef", false)))); assert(reverseDelete(("abcdedcba"), ("ab")).equals((("cdedc", true)))); assert(reverseDelete(("dwik"), ("w")).equals((("dik"...
[ "\n }\n" ]
HumanEval_113_odd_count
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Given a list of strings, where each string consists of only digits, return a list. // Each element i of the output should be "the number of odd elements in the // string i of the input." where all the i's should be replaced by the num...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_113_odd_count.py
verbatim
} def main(args: Array[String]) = { assert(oddCount((List[String]("1234567"))).equals((List[String]("the number of odd elements 4n the str4ng 4 of the 4nput.")))); assert(oddCount((List[String]("3", "11111111"))).equals((List[String]("the number of odd elements 1n the str1ng 1 of the 1nput.", "the numbe...
[ "\n }\n" ]
HumanEval_114_minSubArraySum
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Given an array of integers nums, find the minimum sum of any non-empty sub-array // of nums. // Example def minSubArraySum(nums : List[Long]) : Long = {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_114_minSubArraySum.py
verbatim
} def main(args: Array[String]) = { assert(minSubArraySum((List[Long](2l.toLong, 3l.toLong, 4l.toLong, 1l.toLong, 2l.toLong, 4l.toLong))) == (1l)); assert(minSubArraySum((List[Long](-1l.toLong, -2l.toLong, -3l.toLong))) == (-6l)); assert(minSubArraySum((List[Long](-1l.toLong, -2l.toLong, -3l.toLong,...
[ "\n }\n" ]
HumanEval_115_max_fill
scala
import scala.math._ import scala.collection.mutable._ object Problem { // You are given a rectangular grid of wells. Each row represents a single well, // and each 1 in a row represents a single unit of water. // Each well has a corresponding bucket that can be used to extract water from it, // and all...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_115_max_fill.py
verbatim
} def main(args: Array[String]) = { assert(maxFill((List[List[Long]](List[Long](0l.toLong, 0l.toLong, 1l.toLong, 0l.toLong), List[Long](0l.toLong, 1l.toLong, 0l.toLong, 0l.toLong), List[Long](1l.toLong, 1l.toLong, 1l.toLong, 1l.toLong))), (1l)) == (6l)); assert(maxFill((List[List[Long]](List[Long](0l.to...
[ "\n }\n" ]
HumanEval_116_sort_array
scala
import scala.math._ import scala.collection.mutable._ object Problem { // In this Kata, you have to sort an array of non-negative integers according to // number of ones in their binary representation in ascending order. // For similar number of ones, sort based on decimal value. // It must be implement...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_116_sort_array.py
verbatim
} def main(args: Array[String]) = { assert(sortArray((List[Long](1l.toLong, 5l.toLong, 2l.toLong, 3l.toLong, 4l.toLong))).equals((List[Long](1l.toLong, 2l.toLong, 4l.toLong, 3l.toLong, 5l.toLong)))); assert(sortArray((List[Long](-2l.toLong, -3l.toLong, -4l.toLong, -5l.toLong, -6l.toLong))).equals((List[...
[ "\n }\n" ]
HumanEval_117_select_words
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Given a string s and a natural number n, you have been tasked to implement // a function that returns a list of all words from string s that contain exactly // n consonants, in order these words appear in the string s. // If the...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_117_select_words.py
verbatim
} def main(args: Array[String]) = { assert(selectWords(("Mary had a little lamb"), (4l)).equals((List[String]("little")))); assert(selectWords(("Mary had a little lamb"), (3l)).equals((List[String]("Mary", "lamb")))); assert(selectWords(("simple white space"), (2l)).equals((List[String]()))); as...
[ "\n }\n" ]
HumanEval_118_get_closest_vowel
scala
import scala.math._ import scala.collection.mutable._ object Problem { // You are given a word. Your task is to find the closest vowel that stands between // two consonants from the right side of the word (case sensitive). // Vowels in the beginning and ending doesn't count. Return empty string if you didn...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_118_get_closest_vowel.py
verbatim
} def main(args: Array[String]) = { assert(getClosestVowel(("yogurt")).equals(("u"))); assert(getClosestVowel(("full")).equals(("u"))); assert(getClosestVowel(("easy")).equals((""))); assert(getClosestVowel(("eAsy")).equals((""))); assert(getClosestVowel(("ali")).equals((""))); assert(ge...
[ "\n }\n" ]
HumanEval_119_match_parens
scala
import scala.math._ import scala.collection.mutable._ object Problem { // You are given a list of two strings, both strings consist of open // parentheses '(' or close parentheses ')' only. // Your job is to check if it is possible to concatenate the two strings in // some order, that the resulting stri...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_119_match_parens.py
verbatim
} def main(args: Array[String]) = { assert(matchParens((List[String]("()(", ")"))).equals(("Yes"))); assert(matchParens((List[String](")", ")"))).equals(("No"))); assert(matchParens((List[String]("(()(())", "())())"))).equals(("No"))); assert(matchParens((List[String](")())", "(()()("))).equals(...
[ "\n }\n" ]
HumanEval_11_string_xor
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Input are two strings a and b consisting only of 1s and 0s. // Perform binary XOR on these inputs and return result also as a string. def stringXor(a : String, b : String) : String = {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_11_string_xor.py
verbatim
} def main(args: Array[String]) = { assert(stringXor(("111000"), ("101010")).equals(("010010"))); assert(stringXor(("1"), ("1")).equals(("0"))); assert(stringXor(("0101"), ("0000")).equals(("0101"))); } }
[ "\n }\n" ]
HumanEval_120_maximum
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Given an array arr of integers and a positive integer k, return a sorted list // of length k with the maximum k numbers in arr. // Example 1: // Example 2: // Example 3: // Note: // 1. The length of the array will be ...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_120_maximum.py
verbatim
} def main(args: Array[String]) = { assert(maximum((List[Long](-3l.toLong, -4l.toLong, 5l.toLong)), (3l)).equals((List[Long](-4l.toLong, -3l.toLong, 5l.toLong)))); assert(maximum((List[Long](4l.toLong, -4l.toLong, 4l.toLong)), (2l)).equals((List[Long](4l.toLong, 4l.toLong)))); assert(maximum((List[L...
[ "\n }\n" ]
HumanEval_121_solution
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Given a non-empty list of integers, return the sum of all of the odd elements that are in even positions. // Examples def solution(lst : List[Long]) : Long = {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_121_solution.py
verbatim
} def main(args: Array[String]) = { assert(solution((List[Long](5l.toLong, 8l.toLong, 7l.toLong, 1l.toLong))) == (12l)); assert(solution((List[Long](3l.toLong, 3l.toLong, 3l.toLong, 3l.toLong, 3l.toLong))) == (9l)); assert(solution((List[Long](30l.toLong, 13l.toLong, 24l.toLong, 321l.toLong))) == (0...
[ "\n }\n" ]
HumanEval_122_add_elements
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Given a non-empty array of integers arr and an integer k, return // the sum of the elements with at most two digits from the first k elements of arr. // Example: // Constraints: // 1. 1 <= len(arr) <= 100 // 2. 1 <= k <= l...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_122_add_elements.py
verbatim
} def main(args: Array[String]) = { assert(addElements((List[Long](1l.toLong, -2l.toLong, -3l.toLong, 41l.toLong, 57l.toLong, 76l.toLong, 87l.toLong, 88l.toLong, 99l.toLong)), (3l)) == (-4l)); assert(addElements((List[Long](111l.toLong, 121l.toLong, 3l.toLong, 4000l.toLong, 5l.toLong, 6l.toLong)), (2l))...
[ "\n }\n" ]
HumanEval_123_get_odd_collatz
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Given a positive integer n, return a sorted list that has the odd numbers in collatz sequence. // The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined // as follows: start with any positive integer n....
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_123_get_odd_collatz.py
verbatim
} def main(args: Array[String]) = { assert(getOddCollatz((14l)).equals((List[Long](1l.toLong, 5l.toLong, 7l.toLong, 11l.toLong, 13l.toLong, 17l.toLong)))); assert(getOddCollatz((5l)).equals((List[Long](1l.toLong, 5l.toLong)))); assert(getOddCollatz((12l)).equals((List[Long](1l.toLong, 3l.toLong, 5l....
[ "\n }\n" ]
HumanEval_124_valid_date
scala
import scala.math._ import scala.collection.mutable._ object Problem { // You have to write a function which validates a given date string and // returns True if the date is valid otherwise False. // The date is valid if all of the following rules are satisfied: // 1. The date string is not empty. /...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_124_valid_date.py
verbatim
} def main(args: Array[String]) = { assert(validDate(("03-11-2000")) == (true)); assert(validDate(("15-01-2012")) == (false)); assert(validDate(("04-0-2040")) == (false)); assert(validDate(("06-04-2020")) == (true)); assert(validDate(("01-01-2007")) == (true)); assert(validDate(("03-32-2...
[ "\n }\n" ]
HumanEval_125_split_words
scala
import scala.math._ import scala.collection.mutable._ object Problem { // Given a string of words, return a list of words split on whitespace, if no whitespaces exists in the text you // should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the /...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_125_split_words.py
verbatim
} def main(args: Array[String]) = { assert(splitWords(("Hello world!")).equals(List[String]("Hello", "world!"))); assert(splitWords(("Hello,world!")).equals(List[String]("Hello", "world!"))); assert(splitWords(("Hello world,!")).equals(List[String]("Hello", "world,!"))); assert(splitWords(("Hell...
[ "\n }\n" ]
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 def isSorte...
remove
/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....
remove
/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. /...
remove
/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...
remove
/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. def longest(strings : List[String]) : Option[String] = {
remove
/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) = ...
remove
/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: def digits(n : Long) : Long = {
remove
/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...
remove
/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: def sumSquares(lst : List[Float]) : Long = {
remove
/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...
remove
/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...
remove
/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. ...
remove
/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 def isEqualToSumEven(n : Long) : Boolean = {
remove
/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: // The function will receive an integer as input and should return the special // factorial ...
remove
/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 def greatestCommonDivisor(a : Long, b : Long) : Long = {
remove
/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 - def fixSpaces(text : String) : String = {
remove
/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...
remove
/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" ]