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_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. def nextSmallest(lst : List[Long]) : Option[Long] = {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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: def isBored(S : Stri...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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 def anyInt(x : Float, y : Float...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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. ...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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: def skjkasdkd(lst : List[Long]) : Long = {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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: def checkDi...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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: def countUpTo(n : Long) : List[Long] = {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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: def multiply(a : Long, b : Long) : Long = {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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: def countUpper(s : String) : Long = {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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 // Note: // Rounding awa...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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. def rollingMax(numbers : List[Long]) : List[Long] = {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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. // >>> hasCloseElements((List[Float](1.0f.toFloat, 2.0f.toFloat, 3.0f.toFloat)), (0.5f)) // (false) // >>> hasCloseElements((...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_0_has_close_elements.py
reworded
} 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 ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_100_make_a_pile.py
reworded
} 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 a list of the words. // For example: // >>> wordsString(("Hi, my name is John")) // (List[String]("Hi...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_101_words_string.py
reworded
} 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: // >>> c...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_102_choose_num.py
reworded
} 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...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_103_rounded_avg.py
reworded
} 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: // >>> uniqueDigits((List[Long](15l.toLong,...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_104_unique_digits.py
reworded
} 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 a list of integers, sort the integers that are between 1 and 9 inclusive, // reverse the resulting list, and then replace each digit by its corresponding name from // "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_105_by_length.py
reworded
} 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...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_106_f.py
reworded
} 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: // >>> evenOddPalindrome((3l)) // ((1l, 2l)) // Explanation: ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_107_even_odd_palindrome.py
reworded
} 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 a list 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 digi...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_108_count_nums.py
reworded
} 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 a list 'arr' of N integers arr[1], arr[2], ..., arr[N].The // numbers in the list will be randomly ordered. Your task is to determine if // it is possible to get a list sorted in non-decreasing order by performing // the ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_109_move_one_ball.py
reworded
} 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...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_10_make_palindrome.py
reworded
} 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...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_110_exchange.py
reworded
} 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 map // of the letter with the most repetition and containing the corresponding count. // If several letters have the same occurrence, return all of them. //...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_111_histogram.py
reworded
} 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...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_112_reverse_delete.py
reworded
} 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...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_113_odd_count.py
reworded
} 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 a list of integers nums, find the minimum sum of any non-empty sub-list // of nums. // Example // >>> minSubArraySum((List[Long](2l.toLong, 3l.toLong, 4l.toLong, 1l.toLong, 2l.toLong, 4l.toLong))) // (1l) // >>> minS...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_114_minSubArraySum.py
reworded
} 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...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_115_max_fill.py
reworded
} 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 a list 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 implemented...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_116_sort_array.py
reworded
} 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...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_117_select_words.py
reworded
} 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...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_118_get_closest_vowel.py
reworded
} 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...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_119_match_parens.py
reworded
} 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. // >>> stringXor(("010"), ("110")) // ("100") def stringXor(a : String, b : String) : String...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_11_string_xor.py
reworded
} 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 a list arr of integers and a positive integer k, return a sorted list // of length k with the maximum k numbers in arr. // Example 1: // >>> maximum((List[Long](-3l.toLong, -4l.toLong, 5l.toLong)), (3l)) // (List[Long](...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_120_maximum.py
reworded
} 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 // >>> solution((List[Long](5l.toLong, 8l.toLong, 7l.toLong, 1l.toLong))) // (12l) // >>> solution((List[Lon...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_121_solution.py
reworded
} 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 list 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: // >>> addElements((List[Long](111l.toLong, 21l.toLong, 3l.toLong, 40...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_122_add_elements.py
reworded
} 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....
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_123_get_odd_collatz.py
reworded
} 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. /...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_124_valid_date.py
reworded
} 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 /...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_125_split_words.py
reworded
} 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 // >>> isSo...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_126_is_sorted.py
reworded
} 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
reworded
} 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 a list arr of integers and you need to return // sum of magnitudes of integers multiplied by product of all signs // of each number in the list, represented by 1, -1 or 0. // Note: return None for empty arr. // E...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_128_prod_signs.py
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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 list will not contain // duplica...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_135_can_arrange.py
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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 a list of numbers as input and returns // the number of elements in the list 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
reworded
} 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 list 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 a...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_147_get_max_triples.py
reworded
} 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
reworded
} 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 a list o...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_149_sorted_list_sum.py
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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 a list 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
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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 scalathon 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]()))) //...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_22_filter_integers.py
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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" ]