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_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... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_142_sum_squares.py | verbatim | }
def main(args: Array[String]) = {
assert(sumSquares((List[Long](1l.toLong, 2l.toLong, 3l.toLong))) == (6l));
assert(sumSquares((List[Long](1l.toLong, 4l.toLong, 9l.toLong))) == (14l));
assert(sumSquares((List[Long]())) == (0l));
assert(sumSquares((List[Long](1l.toLong, 1l.toLong, 1l.toLong, 1l... | [
"\n }\n"
] |
HumanEval_143_words_in_sentence | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// You are given a string representing a sentence,
// the sentence contains some words separated by a space,
// and you have to return a string that contains the words from the original sentence,
// whose lengths are prime numbers,
... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_143_words_in_sentence.py | verbatim | }
def main(args: Array[String]) = {
assert(wordsInSentence(("This is a test")).equals(("is")));
assert(wordsInSentence(("lets go for swimming")).equals(("go for")));
assert(wordsInSentence(("there is no place available here")).equals(("there is no place")));
assert(wordsInSentence(("Hi I am Huss... | [
"\n }\n"
] |
HumanEval_144_simplify | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Your task is to implement a function that will simplify the expression
// x * n. The function returns True if x * n evaluates to a whole number and False
// otherwise. Both x and n, are string representation of a fraction, and have th... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_144_simplify.py | verbatim | }
def main(args: Array[String]) = {
assert(simplify(("1/5"), ("5/1")) == (true));
assert(simplify(("1/6"), ("2/1")) == (false));
assert(simplify(("5/1"), ("3/1")) == (true));
assert(simplify(("7/10"), ("10/2")) == (false));
assert(simplify(("2/10"), ("50/10")) == (true));
assert(simplify... | [
"\n }\n"
] |
HumanEval_145_order_by_points | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Write a function which sorts the given list of integers
// in ascending order according to the sum of their digits.
// Note: if there are several items with similar sum of their digits,
// order them based on their index in origin... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_145_order_by_points.py | verbatim | }
def main(args: Array[String]) = {
assert(orderByPoints((List[Long](1l.toLong, 11l.toLong, -1l.toLong, -11l.toLong, -12l.toLong))).equals((List[Long](-1l.toLong, -11l.toLong, 1l.toLong, -12l.toLong, 11l.toLong))));
assert(orderByPoints((List[Long](1234l.toLong, 423l.toLong, 463l.toLong, 145l.toLong, 2l... | [
"\n }\n"
] |
HumanEval_146_specialFilter | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Write a function that takes an array of numbers as input and returns
// the number of elements in the array that are greater than 10 and both
// first and last digits of a number are odd (1, 3, 5, 7, 9).
// For example:
def ... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_146_specialFilter.py | verbatim | }
def main(args: Array[String]) = {
assert(specialFilter((List[Long](5l.toLong, -2l.toLong, 1l.toLong, -5l.toLong))) == (0l));
assert(specialFilter((List[Long](15l.toLong, -73l.toLong, 14l.toLong, -15l.toLong))) == (1l));
assert(specialFilter((List[Long](33l.toLong, -2l.toLong, -3l.toLong, 45l.toLon... | [
"\n }\n"
] |
HumanEval_147_get_max_triples | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// You are given a positive integer n. You have to create an integer array a of length n.
// For each i (1 ≤ i ≤ n), the value of a[i] = i * i - i + 1.
// Return the number of triples (a[i], a[j], a[k]) of a where i < j < k,
// and ... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_147_get_max_triples.py | verbatim | }
def main(args: Array[String]) = {
assert(getMaxTriples((5l)) == (1l));
assert(getMaxTriples((6l)) == (4l));
assert(getMaxTriples((10l)) == (36l));
assert(getMaxTriples((100l)) == (53361l));
}
}
| [
"\n }\n"
] |
HumanEval_148_bf | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// There are eight planets in our solar system: the closerst to the Sun
// is Mercury, the next one is Venus, then Earth, Mars, Jupiter, Saturn,
// Uranus, Neptune.
// Write a function that takes two planet names as strings planet1... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_148_bf.py | verbatim | }
def main(args: Array[String]) = {
assert(bf(("Jupiter"), ("Neptune")).equals((List[String]("Saturn", "Uranus"))));
assert(bf(("Earth"), ("Mercury")).equals((List[String]("Venus"))));
assert(bf(("Mercury"), ("Uranus")).equals((List[String]("Venus", "Earth", "Mars", "Jupiter", "Saturn"))));
asse... | [
"\n }\n"
] |
HumanEval_149_sorted_list_sum | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Write a function that accepts a list of strings as a parameter,
// deletes the strings that have odd lengths from it,
// and returns the resulted list with a sorted order,
// The list is always a list of strings and never an array... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_149_sorted_list_sum.py | verbatim | }
def main(args: Array[String]) = {
assert(sortedListSum((List[String]("aa", "a", "aaa"))).equals((List[String]("aa"))));
assert(sortedListSum((List[String]("school", "AI", "asdf", "b"))).equals((List[String]("AI", "asdf", "school"))));
assert(sortedListSum((List[String]("d", "b", "c", "a"))).equals... | [
"\n }\n"
] |
HumanEval_14_all_prefixes | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Return list of all prefixes from shortest to longest of the input string
def allPrefixes(string : String) : List[String] = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_14_all_prefixes.py | verbatim | }
def main(args: Array[String]) = {
assert(allPrefixes(("")).equals((List[String]())));
assert(allPrefixes(("asdfgh")).equals((List[String]("a", "as", "asd", "asdf", "asdfg", "asdfgh"))));
assert(allPrefixes(("WWW")).equals((List[String]("W", "WW", "WWW"))));
}
}
| [
"\n }\n"
] |
HumanEval_150_x_or_y | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// A simple program which should return the value of x if n is
// a prime number and should return the value of y otherwise.
// Examples:
def xOrY(n : Long, x : Long, y : Long) : Long = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_150_x_or_y.py | verbatim | }
def main(args: Array[String]) = {
assert(xOrY((7l), (34l), (12l)) == (34l));
assert(xOrY((15l), (8l), (5l)) == (5l));
assert(xOrY((3l), (33l), (5212l)) == (33l));
assert(xOrY((1259l), (3l), (52l)) == (3l));
assert(xOrY((7919l), (-1l), (12l)) == (-1l));
assert(xOrY((3609l), (1245l), (58... | [
"\n }\n"
] |
HumanEval_151_double_the_difference | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Given a list of numbers, return the sum of squares of the numbers
// in the list that are odd. Ignore numbers that are negative or not integers.
// If the input list is empty, return 0.
def doubleTheDifference(lst : List[Float]) :... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_151_double_the_difference.py | verbatim | }
def main(args: Array[String]) = {
assert(doubleTheDifference((List[Float]())) == (0l));
assert(doubleTheDifference((List[Float](5.0f.toFloat, 4.0f.toFloat))) == (25l));
assert(doubleTheDifference((List[Float](0.1f.toFloat, 0.2f.toFloat, 0.3f.toFloat))) == (0l));
assert(doubleTheDifference((Lis... | [
"\n }\n"
] |
HumanEval_152_compare | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// I think we all remember that feeling when the result of some long-awaited
// event is finally known. The feelings and thoughts you have at that moment are
// definitely worth noting down and comparing.
// Your task is to determine... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_152_compare.py | verbatim | }
def main(args: Array[String]) = {
assert(compare((List[Long](1l.toLong, 2l.toLong, 3l.toLong, 4l.toLong, 5l.toLong, 1l.toLong)), (List[Long](1l.toLong, 2l.toLong, 3l.toLong, 4l.toLong, 2l.toLong, -2l.toLong))).equals((List[Long](0l.toLong, 0l.toLong, 0l.toLong, 0l.toLong, 3l.toLong, 3l.toLong))));
ass... | [
"\n }\n"
] |
HumanEval_153_Strongest_Extension | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// You will be given the name of a class (a string) and a list of extensions.
// The extensions are to be used to load additional classes to the class. The
// strength of the extension is as follows: Let CAP be the number of the uppercas... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_153_Strongest_Extension.py | verbatim | }
def main(args: Array[String]) = {
assert(StrongestExtension(("Watashi"), (List[String]("tEN", "niNE", "eIGHt8OKe"))).equals(("Watashi.eIGHt8OKe")));
assert(StrongestExtension(("Boku123"), (List[String]("nani", "NazeDa", "YEs.WeCaNe", "32145tggg"))).equals(("Boku123.YEs.WeCaNe")));
assert(Strongest... | [
"\n }\n"
] |
HumanEval_154_cycpattern_check | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// You are given 2 words. You need to return True if the second word or any of its rotations is a substring in the first word
def cycpatternCheck(a : String, b : String) : Boolean = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_154_cycpattern_check.py | verbatim | }
def main(args: Array[String]) = {
assert(cycpatternCheck(("xyzw"), ("xyw")) == (false));
assert(cycpatternCheck(("yello"), ("ell")) == (true));
assert(cycpatternCheck(("whattup"), ("ptut")) == (false));
assert(cycpatternCheck(("efef"), ("fee")) == (true));
assert(cycpatternCheck(("abab"), ... | [
"\n }\n"
] |
HumanEval_155_even_odd_count | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Given an integer. return a tuple that has the number of even and odd digits respectively.
// Example:
def evenOddCount(num : Long) : Tuple2[Long, Long] = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_155_even_odd_count.py | verbatim | }
def main(args: Array[String]) = {
assert(evenOddCount((7l)).equals(((0l, 1l))));
assert(evenOddCount((-78l)).equals(((1l, 1l))));
assert(evenOddCount((3452l)).equals(((2l, 2l))));
assert(evenOddCount((346211l)).equals(((3l, 3l))));
assert(evenOddCount((-345821l)).equals(((3l, 3l))));
a... | [
"\n }\n"
] |
HumanEval_156_int_to_mini_roman | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Given a positive integer, obtain its roman numeral equivalent as a string,
// and return it in lowercase.
// Restrictions: 1 <= num <= 1000
// Examples:
def intToMiniRoman(number : Long) : String = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_156_int_to_mini_roman.py | verbatim | }
def main(args: Array[String]) = {
assert(intToMiniRoman((19l)).equals(("xix")));
assert(intToMiniRoman((152l)).equals(("clii")));
assert(intToMiniRoman((251l)).equals(("ccli")));
assert(intToMiniRoman((426l)).equals(("cdxxvi")));
assert(intToMiniRoman((500l)).equals(("d")));
assert(int... | [
"\n }\n"
] |
HumanEval_157_right_angle_triangle | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Given the lengths of the three sides of a triangle. Return True if the three
// sides form a right-angled triangle, False otherwise.
// A right-angled triangle is a triangle in which one angle is right angle or
// 90 degree.
... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_157_right_angle_triangle.py | verbatim | }
def main(args: Array[String]) = {
assert(rightAngleTriangle((3l), (4l), (5l)) == (true));
assert(rightAngleTriangle((1l), (2l), (3l)) == (false));
assert(rightAngleTriangle((10l), (6l), (8l)) == (true));
assert(rightAngleTriangle((2l), (2l), (2l)) == (false));
assert(rightAngleTriangle((7l... | [
"\n }\n"
] |
HumanEval_158_find_max | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Write a function that accepts a list of strings.
// The list contains different words. Return the word with maximum number
// of unique characters. If multiple strings have maximum number of unique
// characters, return the one wh... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_158_find_max.py | verbatim | }
def main(args: Array[String]) = {
assert(findMax((List[String]("name", "of", "string"))).equals(("string")));
assert(findMax((List[String]("name", "enam", "game"))).equals(("enam")));
assert(findMax((List[String]("aaaaaaa", "bb", "cc"))).equals(("aaaaaaa")));
assert(findMax((List[String]("abc"... | [
"\n }\n"
] |
HumanEval_159_eat | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// You're a hungry rabbit, and you already have eaten a certain number of carrots,
// but now you need to eat more carrots to complete the day's meals.
// you should return an array of [ total number of eaten carrots after your meals,
... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_159_eat.py | verbatim | }
def main(args: Array[String]) = {
assert(eat((5l), (6l), (10l)).equals((List[Long](11l.toLong, 4l.toLong))));
assert(eat((4l), (8l), (9l)).equals((List[Long](12l.toLong, 1l.toLong))));
assert(eat((1l), (10l), (10l)).equals((List[Long](11l.toLong, 0l.toLong))));
assert(eat((2l), (11l), (5l)).eq... | [
"\n }\n"
] |
HumanEval_15_string_sequence | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Return a string containing space-delimited numbers starting from 0 upto n inclusive.
def stringSequence(n : Long) : String = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_15_string_sequence.py | verbatim | }
def main(args: Array[String]) = {
assert(stringSequence((0l)).equals(("0")));
assert(stringSequence((3l)).equals(("0 1 2 3")));
assert(stringSequence((10l)).equals(("0 1 2 3 4 5 6 7 8 9 10")));
}
}
| [
"\n }\n"
] |
HumanEval_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 ... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_161_solve.py | verbatim | }
def main(args: Array[String]) = {
assert(solve(("AsDf")).equals(("aSdF")));
assert(solve(("1234")).equals(("4321")));
assert(solve(("ab")).equals(("AB")));
assert(solve(("#a@C")).equals(("#A@c")));
assert(solve(("#AsdfW^45")).equals(("#aSDFw^45")));
assert(solve(("#6@2")).equals(("2@6#... | [
"\n }\n"
] |
HumanEval_162_string_to_md5 | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Given a string 'text', return its md5 hash equivalent string.
// If 'text' is an empty string, return None.
def stringToMd5(text : String) : Option[String] = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_162_string_to_md5.py | verbatim | }
def main(args: Array[String]) = {
assert(stringToMd5(("Hello world")).equals(Some("3e25960a79dbc69b674cd4ec67a72c62")));
assert(stringToMd5(("")).equals(None));
assert(stringToMd5(("A B C")).equals(Some("0ef78513b0cb8cef12743f5aeb35f888")));
assert(stringToMd5(("password")).equals(Some("5f4dcc... | [
"\n }\n"
] |
HumanEval_163_generate_integers | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Given two positive integers a and b, return the even digits between a
// and b, in ascending order.
// For example:
def generateIntegers(a : Long, b : Long) : List[Long] = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_163_generate_integers.py | verbatim | }
def main(args: Array[String]) = {
assert(generateIntegers((2l), (10l)).equals((List[Long](2l.toLong, 4l.toLong, 6l.toLong, 8l.toLong))));
assert(generateIntegers((10l), (2l)).equals((List[Long](2l.toLong, 4l.toLong, 6l.toLong, 8l.toLong))));
assert(generateIntegers((132l), (2l)).equals((List[Long]... | [
"\n }\n"
] |
HumanEval_16_count_distinct_characters | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Given a string, find out how many distinct characters (regardless of case) does it consist of
def countDistinctCharacters(string : String) : Long = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_16_count_distinct_characters.py | verbatim | }
def main(args: Array[String]) = {
assert(countDistinctCharacters(("")) == (0l));
assert(countDistinctCharacters(("abcde")) == (5l));
assert(countDistinctCharacters(("abcdecadeCADE")) == (5l));
assert(countDistinctCharacters(("aaaaAAAAaaaa")) == (1l));
assert(countDistinctCharacters(("Jerry... | [
"\n }\n"
] |
HumanEval_17_parse_music | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Input to this function is a string representing musical notes in a special ASCII format.
// Your task is to parse this string and return list of integers corresponding to how many beats does each
// not last.
// Here is a legend:
... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_17_parse_music.py | verbatim | }
def main(args: Array[String]) = {
assert(parseMusic(("")).equals((List[Long]())));
assert(parseMusic(("o o o o")).equals((List[Long](4l.toLong, 4l.toLong, 4l.toLong, 4l.toLong))));
assert(parseMusic((".| .| .| .|")).equals((List[Long](1l.toLong, 1l.toLong, 1l.toLong, 1l.toLong))));
assert(pars... | [
"\n }\n"
] |
HumanEval_18_how_many_times | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Find how many times a given substring can be found in the original string. Count overlaping cases.
def howManyTimes(string : String, substring : String) : Long = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_18_how_many_times.py | verbatim | }
def main(args: Array[String]) = {
assert(howManyTimes((""), ("x")) == (0l));
assert(howManyTimes(("xyxyxyx"), ("x")) == (4l));
assert(howManyTimes(("cacacacac"), ("cac")) == (4l));
assert(howManyTimes(("john doe"), ("john")) == (1l));
}
}
| [
"\n }\n"
] |
HumanEval_19_sort_numbers | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Input is a space-delimited string of numberals from 'zero' to 'nine'.
// Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'.
// Return the string with numbers sorted from smallest to la... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_19_sort_numbers.py | verbatim | }
def main(args: Array[String]) = {
assert(sortNumbers(("")).equals(("")));
assert(sortNumbers(("three")).equals(("three")));
assert(sortNumbers(("three five nine")).equals(("three five nine")));
assert(sortNumbers(("five zero four seven nine eight")).equals(("zero four five seven eight nine")))... | [
"\n }\n"
] |
HumanEval_1_separate_paren_groups | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
// separate those group into separate strings and return the list of those.
// Separate groups are balanced (each open brace is prope... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_1_separate_paren_groups.py | verbatim | }
def main(args: Array[String]) = {
assert(separateParenGroups(("(()()) ((())) () ((())()())")).equals((List[String]("(()())", "((()))", "()", "((())()())"))));
assert(separateParenGroups(("() (()) ((())) (((())))")).equals((List[String]("()", "(())", "((()))", "(((())))"))));
assert(separateParenGr... | [
"\n }\n"
] |
HumanEval_20_find_closest_elements | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// From a supplied list of numbers (of length at least two) select and return two that are the closest to each
// other and return them in order (smaller number, larger number).
def findClosestElements(numbers : List[Float]) : Tuple2[Flo... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_20_find_closest_elements.py | verbatim | }
def main(args: Array[String]) = {
assert(findClosestElements((List[Float](1.0f.toFloat, 2.0f.toFloat, 3.9f.toFloat, 4.0f.toFloat, 5.0f.toFloat, 2.2f.toFloat))).equals(((3.9f, 4.0f))));
assert(findClosestElements((List[Float](1.0f.toFloat, 2.0f.toFloat, 5.9f.toFloat, 4.0f.toFloat, 5.0f.toFloat))).equal... | [
"\n }\n"
] |
HumanEval_21_rescale_to_unit | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Given list of numbers (of at least two elements), apply a linear transform to that list,
// such that the smallest number will become 0 and the largest will become 1
def rescaleToUnit(numbers : List[Float]) : List[Float] = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_21_rescale_to_unit.py | verbatim | }
def main(args: Array[String]) = {
assert(rescaleToUnit((List[Float](2.0f.toFloat, 49.9f.toFloat))).equals((List[Float](0.0f.toFloat, 1.0f.toFloat))));
assert(rescaleToUnit((List[Float](100.0f.toFloat, 49.9f.toFloat))).equals((List[Float](1.0f.toFloat, 0.0f.toFloat))));
assert(rescaleToUnit((List[F... | [
"\n }\n"
] |
HumanEval_22_filter_integers | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Filter given list of any python values only for integers
def filterIntegers(values : List[Any]) : List[Long] = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_22_filter_integers.py | verbatim | }
def main(args: Array[String]) = {
assert(filterIntegers((List[Any]())).equals((List[Long]())));
assert(filterIntegers((List[Any](4l, Map[Long,Long](), List[Long](), 23.2f, 9l, "adasd"))).equals((List[Long](4l.toLong, 9l.toLong))));
assert(filterIntegers((List[Any](3l, "c", 3l, 3l, "a", "b"))).equa... | [
"\n }\n"
] |
HumanEval_23_strlen | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Return length of given string
def strlen(string : String) : Long = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_23_strlen.py | verbatim | }
def main(args: Array[String]) = {
assert(strlen(("")) == (0l));
assert(strlen(("x")) == (1l));
assert(strlen(("asdasnakj")) == (9l));
}
}
| [
"\n }\n"
] |
HumanEval_24_largest_divisor | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// For a given number n, find the largest number that divides n evenly, smaller than n
def largestDivisor(n : Long) : Long = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_24_largest_divisor.py | verbatim | }
def main(args: Array[String]) = {
assert(largestDivisor((3l)) == (1l));
assert(largestDivisor((7l)) == (1l));
assert(largestDivisor((10l)) == (5l));
assert(largestDivisor((100l)) == (50l));
assert(largestDivisor((49l)) == (7l));
}
}
| [
"\n }\n"
] |
HumanEval_25_factorize | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Return list of prime factors of given integer in the order from smallest to largest.
// Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
// Input number should be equal... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_25_factorize.py | verbatim | }
def main(args: Array[String]) = {
assert(factorize((2l)).equals((List[Long](2l.toLong))));
assert(factorize((4l)).equals((List[Long](2l.toLong, 2l.toLong))));
assert(factorize((8l)).equals((List[Long](2l.toLong, 2l.toLong, 2l.toLong))));
assert(factorize((57l)).equals((List[Long](3l.toLong, 19... | [
"\n }\n"
] |
HumanEval_26_remove_duplicates | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// From a list of integers, remove all elements that occur more than once.
// Keep order of elements left the same as in the input.
def removeDuplicates(numbers : List[Long]) : List[Long] = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_26_remove_duplicates.py | verbatim | }
def main(args: Array[String]) = {
assert(removeDuplicates((List[Long]())).equals((List[Long]())));
assert(removeDuplicates((List[Long](1l.toLong, 2l.toLong, 3l.toLong, 4l.toLong))).equals((List[Long](1l.toLong, 2l.toLong, 3l.toLong, 4l.toLong))));
assert(removeDuplicates((List[Long](1l.toLong, 2l.... | [
"\n }\n"
] |
HumanEval_27_flip_case | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// For a given string, flip lowercase characters to uppercase and uppercase to lowercase.
def flipCase(string : String) : String = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_27_flip_case.py | verbatim | }
def main(args: Array[String]) = {
assert(flipCase(("")).equals(("")));
assert(flipCase(("Hello!")).equals(("hELLO!")));
assert(flipCase(("These violent delights have violent ends")).equals(("tHESE VIOLENT DELIGHTS HAVE VIOLENT ENDS")));
}
}
| [
"\n }\n"
] |
HumanEval_28_concatenate | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Concatenate list of strings into a single string
def concatenate(strings : List[String]) : String = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_28_concatenate.py | verbatim | }
def main(args: Array[String]) = {
assert(concatenate((List[String]())).equals(("")));
assert(concatenate((List[String]("x", "y", "z"))).equals(("xyz")));
assert(concatenate((List[String]("x", "y", "z", "w", "k"))).equals(("xyzwk")));
}
}
| [
"\n }\n"
] |
HumanEval_29_filter_by_prefix | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Filter an input list of strings only for ones that start with a given prefix.
def filterByPrefix(strings : List[String], prefix : String) : List[String] = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_29_filter_by_prefix.py | verbatim | }
def main(args: Array[String]) = {
assert(filterByPrefix((List[String]()), ("john")).equals((List[String]())));
assert(filterByPrefix((List[String]("xxx", "asd", "xxy", "john doe", "xxxAAA", "xxx")), ("xxx")).equals((List[String]("xxx", "xxxAAA", "xxx"))));
}
}
| [
"\n }\n"
] |
HumanEval_2_truncate_number | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Given a positive floating point number, it can be decomposed into
// and integer part (largest integer smaller than given number) and decimals
// (leftover part always smaller than 1).
// Return the decimal part of the number.
... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_2_truncate_number.py | verbatim | }
def main(args: Array[String]) = {
assert(truncateNumber((3.5f)) == (0.5f));
assert(truncateNumber((1.25f)) == (0.25f));
assert(truncateNumber((123.0f)) == (0.0f));
}
}
| [
"\n }\n"
] |
HumanEval_30_get_positive | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Return only positive numbers in the list.
def getPositive(l : List[Long]) : List[Long] = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_30_get_positive.py | verbatim | }
def main(args: Array[String]) = {
assert(getPositive((List[Long](-1l.toLong, -2l.toLong, 4l.toLong, 5l.toLong, 6l.toLong))).equals((List[Long](4l.toLong, 5l.toLong, 6l.toLong))));
assert(getPositive((List[Long](5l.toLong, 3l.toLong, -5l.toLong, 2l.toLong, 3l.toLong, 3l.toLong, 9l.toLong, 0l.toLong, 12... | [
"\n }\n"
] |
HumanEval_31_is_prime | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Return true if a given number is prime, and false otherwise.
def isPrime(n : Long) : Boolean = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_31_is_prime.py | verbatim | }
def main(args: Array[String]) = {
assert(isPrime((6l)) == (false));
assert(isPrime((101l)) == (true));
assert(isPrime((11l)) == (true));
assert(isPrime((13441l)) == (true));
assert(isPrime((61l)) == (true));
assert(isPrime((4l)) == (false));
assert(isPrime((1l)) == (false));
as... | [
"\n }\n"
] |
HumanEval_33_sort_third | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// This function takes a list l and returns a list l' such that
// l' is identical to l in the indicies that are not divisible by three, while its values at the indicies that are divisible by three are equal
// to the values of the corre... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_33_sort_third.py | verbatim | }
def main(args: Array[String]) = {
assert(sortThird((List[Long](5l.toLong, 6l.toLong, 3l.toLong, 4l.toLong, 8l.toLong, 9l.toLong, 2l.toLong))).equals((List[Long](2l.toLong, 6l.toLong, 3l.toLong, 4l.toLong, 8l.toLong, 9l.toLong, 5l.toLong))));
assert(sortThird((List[Long](5l.toLong, 8l.toLong, 3l.toLong... | [
"\n }\n"
] |
HumanEval_34_unique | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Return sorted unique elements in a list
def unique(l : List[Long]) : List[Long] = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_34_unique.py | verbatim | }
def main(args: Array[String]) = {
assert(unique((List[Long](5l.toLong, 3l.toLong, 5l.toLong, 2l.toLong, 3l.toLong, 3l.toLong, 9l.toLong, 0l.toLong, 123l.toLong))).equals((List[Long](0l.toLong, 2l.toLong, 3l.toLong, 5l.toLong, 9l.toLong, 123l.toLong))));
}
}
| [
"\n }\n"
] |
HumanEval_35_max_element | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Return maximum element in the list.
def maxElement(l : List[Long]) : Long = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_35_max_element.py | verbatim | }
def main(args: Array[String]) = {
assert(maxElement((List[Long](1l.toLong, 2l.toLong, 3l.toLong))) == (3l));
assert(maxElement((List[Long](5l.toLong, 3l.toLong, -5l.toLong, 2l.toLong, -3l.toLong, 3l.toLong, 9l.toLong, 0l.toLong, 124l.toLong, 1l.toLong, -10l.toLong))) == (124l));
}
}
| [
"\n }\n"
] |
HumanEval_36_fizz_buzz | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Return the number of times the digit 7 appears in integers less than n which are divisible by 11 or 13.
def fizzBuzz(n : Long) : Long = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_36_fizz_buzz.py | verbatim | }
def main(args: Array[String]) = {
assert(fizzBuzz((50l)) == (0l));
assert(fizzBuzz((78l)) == (2l));
assert(fizzBuzz((79l)) == (3l));
assert(fizzBuzz((100l)) == (3l));
assert(fizzBuzz((200l)) == (6l));
assert(fizzBuzz((4000l)) == (192l));
assert(fizzBuzz((10000l)) == (639l));
as... | [
"\n }\n"
] |
HumanEval_37_sort_even | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// This function takes a list l and returns a list l' such that
// l' is identical to l in the odd indicies, while its values at the even indicies are equal
// to the values of the even indicies of l, but sorted.
def sortEven(l : Lis... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_37_sort_even.py | verbatim | }
def main(args: Array[String]) = {
assert(sortEven((List[Long](1l.toLong, 2l.toLong, 3l.toLong))).equals((List[Long](1l.toLong, 2l.toLong, 3l.toLong))));
assert(sortEven((List[Long](5l.toLong, 3l.toLong, -5l.toLong, 2l.toLong, -3l.toLong, 3l.toLong, 9l.toLong, 0l.toLong, 123l.toLong, 1l.toLong, -10l.to... | [
"\n }\n"
] |
HumanEval_39_prime_fib | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// prime_fib returns n-th number that is a Fibonacci number and it's also prime.
def primeFib(n : Long) : Long = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_39_prime_fib.py | verbatim | }
def main(args: Array[String]) = {
assert(primeFib((1l)) == (2l));
assert(primeFib((2l)) == (3l));
assert(primeFib((3l)) == (5l));
assert(primeFib((4l)) == (13l));
assert(primeFib((5l)) == (89l));
assert(primeFib((6l)) == (233l));
assert(primeFib((7l)) == (1597l));
assert(primeF... | [
"\n }\n"
] |
HumanEval_3_below_zero | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// You're given a list of deposit and withdrawal operations on a bank account that starts with
// zero balance. Your task is to detect if at any point the balance of account fallls below zero, and
// at that point function should return ... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_3_below_zero.py | verbatim | }
def main(args: Array[String]) = {
assert(belowZero((List[Long]())) == (false));
assert(belowZero((List[Long](1l.toLong, 2l.toLong, -3l.toLong, 1l.toLong, 2l.toLong, -3l.toLong))) == (false));
assert(belowZero((List[Long](1l.toLong, 2l.toLong, -4l.toLong, 5l.toLong, 6l.toLong))) == (true));
ass... | [
"\n }\n"
] |
HumanEval_40_triples_sum_to_zero | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// triples_sum_to_zero takes a list of integers as an input.
// it returns True if there are three distinct elements in the list that
// sum to zero, and False otherwise.
def triplesSumToZero(l : List[Long]) : Boolean = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_40_triples_sum_to_zero.py | verbatim | }
def main(args: Array[String]) = {
assert(triplesSumToZero((List[Long](1l.toLong, 3l.toLong, 5l.toLong, 0l.toLong))) == (false));
assert(triplesSumToZero((List[Long](1l.toLong, 3l.toLong, 5l.toLong, -1l.toLong))) == (false));
assert(triplesSumToZero((List[Long](1l.toLong, 3l.toLong, -2l.toLong, 1l.... | [
"\n }\n"
] |
HumanEval_42_incr_list | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Return list with elements incremented by 1.
def incrList(l : List[Long]) : List[Long] = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_42_incr_list.py | verbatim | }
def main(args: Array[String]) = {
assert(incrList((List[Long]())).equals((List[Long]())));
assert(incrList((List[Long](3l.toLong, 2l.toLong, 1l.toLong))).equals((List[Long](4l.toLong, 3l.toLong, 2l.toLong))));
assert(incrList((List[Long](5l.toLong, 2l.toLong, 5l.toLong, 2l.toLong, 3l.toLong, 3l.to... | [
"\n }\n"
] |
HumanEval_43_pairs_sum_to_zero | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// pairs_sum_to_zero takes a list of integers as an input.
// it returns True if there are two distinct elements in the list that
// sum to zero, and False otherwise.
def pairsSumToZero(l : List[Long]) : Boolean = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_43_pairs_sum_to_zero.py | verbatim | }
def main(args: Array[String]) = {
assert(pairsSumToZero((List[Long](1l.toLong, 3l.toLong, 5l.toLong, 0l.toLong))) == (false));
assert(pairsSumToZero((List[Long](1l.toLong, 3l.toLong, -2l.toLong, 1l.toLong))) == (false));
assert(pairsSumToZero((List[Long](1l.toLong, 2l.toLong, 3l.toLong, 7l.toLong)... | [
"\n }\n"
] |
HumanEval_44_change_base | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Change numerical base of input number x to base.
// return string representation after the conversion.
// base numbers are less than 10.
def changeBase(x : Long, base : Long) : String = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_44_change_base.py | verbatim | }
def main(args: Array[String]) = {
assert(changeBase((8l), (3l)).equals(("22")));
assert(changeBase((9l), (3l)).equals(("100")));
assert(changeBase((234l), (2l)).equals(("11101010")));
assert(changeBase((16l), (2l)).equals(("10000")));
assert(changeBase((8l), (2l)).equals(("1000")));
as... | [
"\n }\n"
] |
HumanEval_45_triangle_area | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Given length of a side and high return area for a triangle.
def triangleArea(a : Long, h : Long) : Float = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_45_triangle_area.py | verbatim | }
def main(args: Array[String]) = {
assert(triangleArea((5l), (3l)) == (7.5f));
assert(triangleArea((2l), (2l)) == (2.0f));
assert(triangleArea((10l), (8l)) == (40.0f));
}
}
| [
"\n }\n"
] |
HumanEval_46_fib4 | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// The Fib4 number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
// fib4(0) -> 0
// fib4(1) -> 0
// fib4(2) -> 2
// fib4(3) -> 0
// fib4(n) -> fib4(n-1) + fib4(n-2) + fib4(n-3) + fib4(n-... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_46_fib4.py | verbatim | }
def main(args: Array[String]) = {
assert(fib4((5l)) == (4l));
assert(fib4((8l)) == (28l));
assert(fib4((10l)) == (104l));
assert(fib4((12l)) == (386l));
}
}
| [
"\n }\n"
] |
HumanEval_47_median | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Return median of elements in the list l.
def median(l : List[Long]) : Float = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_47_median.py | verbatim | }
def main(args: Array[String]) = {
assert(median((List[Long](3l.toLong, 1l.toLong, 2l.toLong, 4l.toLong, 5l.toLong))) == 3l);
assert(median((List[Long](-10l.toLong, 4l.toLong, 6l.toLong, 1000l.toLong, 10l.toLong, 20l.toLong))) == (8.0f));
assert(median((List[Long](5l.toLong))) == 5l);
assert(me... | [
"\n }\n"
] |
HumanEval_48_is_palindrome | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Checks if given string is a palindrome
def isPalindrome(text : String) : Boolean = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_48_is_palindrome.py | verbatim | }
def main(args: Array[String]) = {
assert(isPalindrome(("")) == (true));
assert(isPalindrome(("aba")) == (true));
assert(isPalindrome(("aaaaa")) == (true));
assert(isPalindrome(("zbcd")) == (false));
assert(isPalindrome(("xywyx")) == (true));
assert(isPalindrome(("xywyz")) == (false));
... | [
"\n }\n"
] |
HumanEval_49_modp | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Return 2^n modulo p (be aware of numerics).
def modp(n : Long, p : Long) : Long = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_49_modp.py | verbatim | }
def main(args: Array[String]) = {
assert(modp((3l), (5l)) == (3l));
assert(modp((1101l), (101l)) == (2l));
assert(modp((0l), (101l)) == (1l));
assert(modp((3l), (11l)) == (8l));
assert(modp((100l), (101l)) == (1l));
assert(modp((30l), (5l)) == (4l));
assert(modp((31l), (5l)) == (3l... | [
"\n }\n"
] |
HumanEval_4_mean_absolute_deviation | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// For a given list of input numbers, calculate Mean Absolute Deviation
// around the mean of this dataset.
// Mean Absolute Deviation is the average absolute difference between each
// element and a centerpoint (mean in this case):
... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_4_mean_absolute_deviation.py | verbatim | }
def main(args: Array[String]) = {
assert(meanAbsoluteDeviation((List[Float](1.0f.toFloat, 2.0f.toFloat))) == (0.5f));
assert(meanAbsoluteDeviation((List[Float](1.0f.toFloat, 2.0f.toFloat, 3.0f.toFloat, 4.0f.toFloat))) == (1.0f));
assert(meanAbsoluteDeviation((List[Float](1.0f.toFloat, 2.0f.toFloat... | [
"\n }\n"
] |
HumanEval_51_remove_vowels | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// remove_vowels is a function that takes string and returns string without vowels.
def removeVowels(text : String) : String = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_51_remove_vowels.py | verbatim | }
def main(args: Array[String]) = {
assert(removeVowels(("")).equals(("")));
assert(removeVowels(("abcdef\nghijklm")).equals(("bcdf\nghjklm")));
assert(removeVowels(("fedcba")).equals(("fdcb")));
assert(removeVowels(("eeeee")).equals(("")));
assert(removeVowels(("acBAA")).equals(("cB")));
... | [
"\n }\n"
] |
HumanEval_52_below_threshold | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Return True if all numbers in the list l are below threshold t.
def belowThreshold(l : List[Long], t : Long) : Boolean = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_52_below_threshold.py | verbatim | }
def main(args: Array[String]) = {
assert(belowThreshold((List[Long](1l.toLong, 2l.toLong, 4l.toLong, 10l.toLong)), (100l)) == (true));
assert(belowThreshold((List[Long](1l.toLong, 20l.toLong, 4l.toLong, 10l.toLong)), (5l)) == (false));
assert(belowThreshold((List[Long](1l.toLong, 20l.toLong, 4l.to... | [
"\n }\n"
] |
HumanEval_53_add | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Add two numbers x and y
def add(x : Long, y : Long) : Long = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_53_add.py | verbatim | }
def main(args: Array[String]) = {
assert(add((0l), (1l)) == (1l));
assert(add((1l), (0l)) == (1l));
assert(add((2l), (3l)) == (5l));
assert(add((5l), (7l)) == (12l));
assert(add((7l), (5l)) == (12l));
}
}
| [
"\n }\n"
] |
HumanEval_54_same_chars | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Check if two words have the same characters.
def sameChars(s0 : String, s1 : String) : Boolean = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_54_same_chars.py | verbatim | }
def main(args: Array[String]) = {
assert(sameChars(("eabcdzzzz"), ("dddzzzzzzzddeddabc")) == (true));
assert(sameChars(("abcd"), ("dddddddabc")) == (true));
assert(sameChars(("dddddddabc"), ("abcd")) == (true));
assert(sameChars(("eabcd"), ("dddddddabc")) == (false));
assert(sameChars(("ab... | [
"\n }\n"
] |
HumanEval_55_fib | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Return n-th Fibonacci number.
def fib(n : Long) : Long = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_55_fib.py | verbatim | }
def main(args: Array[String]) = {
assert(fib((10l)) == (55l));
assert(fib((1l)) == (1l));
assert(fib((8l)) == (21l));
assert(fib((11l)) == (89l));
assert(fib((12l)) == (144l));
}
}
| [
"\n }\n"
] |
HumanEval_56_correct_bracketing | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// brackets is a string of "<" and ">".
// return True if every opening bracket has a corresponding closing bracket.
def correctBracketing(brackets : String) : Boolean = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_56_correct_bracketing.py | verbatim | }
def main(args: Array[String]) = {
assert(correctBracketing(("<>")) == (true));
assert(correctBracketing(("<<><>>")) == (true));
assert(correctBracketing(("<><><<><>><>")) == (true));
assert(correctBracketing(("<><><<<><><>><>><<><><<>>>")) == (true));
assert(correctBracketing(("<<<><>>>>")... | [
"\n }\n"
] |
HumanEval_57_monotonic | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Return True is list elements are monotonically increasing or decreasing.
def monotonic(l : List[Long]) : Boolean = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_57_monotonic.py | verbatim | }
def main(args: Array[String]) = {
assert(monotonic((List[Long](1l.toLong, 2l.toLong, 4l.toLong, 10l.toLong))) == (true));
assert(monotonic((List[Long](1l.toLong, 2l.toLong, 4l.toLong, 20l.toLong))) == (true));
assert(monotonic((List[Long](1l.toLong, 20l.toLong, 4l.toLong, 10l.toLong))) == (false))... | [
"\n }\n"
] |
HumanEval_58_common | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Return sorted unique common elements for two lists.
def common(l1 : List[Long], l2 : List[Long]) : List[Long] = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_58_common.py | verbatim | }
def main(args: Array[String]) = {
assert(common((List[Long](1l.toLong, 4l.toLong, 3l.toLong, 34l.toLong, 653l.toLong, 2l.toLong, 5l.toLong)), (List[Long](5l.toLong, 7l.toLong, 1l.toLong, 5l.toLong, 9l.toLong, 653l.toLong, 121l.toLong))).equals((List[Long](1l.toLong, 5l.toLong, 653l.toLong))));
assert(... | [
"\n }\n"
] |
HumanEval_59_largest_prime_factor | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Return the largest prime factor of n. Assume n > 1 and is not a prime.
def largestPrimeFactor(n : Long) : Long = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_59_largest_prime_factor.py | verbatim | }
def main(args: Array[String]) = {
assert(largestPrimeFactor((15l)) == (5l));
assert(largestPrimeFactor((27l)) == (3l));
assert(largestPrimeFactor((63l)) == (7l));
assert(largestPrimeFactor((330l)) == (11l));
assert(largestPrimeFactor((13195l)) == (29l));
}
}
| [
"\n }\n"
] |
HumanEval_5_intersperse | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Insert a number 'delimeter' between every two consecutive elements of input list `numbers'
def intersperse(numbers : List[Long], delimeter : Long) : List[Long] = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_5_intersperse.py | verbatim | }
def main(args: Array[String]) = {
assert(intersperse((List[Long]()), (7l)).equals((List[Long]())));
assert(intersperse((List[Long](5l.toLong, 6l.toLong, 3l.toLong, 2l.toLong)), (8l)).equals((List[Long](5l.toLong, 8l.toLong, 6l.toLong, 8l.toLong, 3l.toLong, 8l.toLong, 2l.toLong))));
assert(interspe... | [
"\n }\n"
] |
HumanEval_60_sum_to_n | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// sum_to_n is a function that sums numbers from 1 to n.
def sumToN(n : Long) : Long = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_60_sum_to_n.py | verbatim | }
def main(args: Array[String]) = {
assert(sumToN((1l)) == (1l));
assert(sumToN((6l)) == (21l));
assert(sumToN((11l)) == (66l));
assert(sumToN((30l)) == (465l));
assert(sumToN((100l)) == (5050l));
}
}
| [
"\n }\n"
] |
HumanEval_61_correct_bracketing | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// brackets is a string of "(" and ")".
// return True if every opening bracket has a corresponding closing bracket.
def correctBracketing(brackets : String) : Boolean = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_61_correct_bracketing.py | verbatim | }
def main(args: Array[String]) = {
assert(correctBracketing(("()")) == (true));
assert(correctBracketing(("(()())")) == (true));
assert(correctBracketing(("()()(()())()")) == (true));
assert(correctBracketing(("()()((()()())())(()()(()))")) == (true));
assert(correctBracketing(("((()())))")... | [
"\n }\n"
] |
HumanEval_62_derivative | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// xs represent coefficients of a polynomial.
// xs[0] + xs[1] * x + xs[2] * x^2 + ....
// Return derivative of this polynomial in the same form.
def derivative(xs : List[Long]) : List[Long] = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_62_derivative.py | verbatim | }
def main(args: Array[String]) = {
assert(derivative((List[Long](3l.toLong, 1l.toLong, 2l.toLong, 4l.toLong, 5l.toLong))).equals((List[Long](1l.toLong, 4l.toLong, 12l.toLong, 20l.toLong))));
assert(derivative((List[Long](1l.toLong, 2l.toLong, 3l.toLong))).equals((List[Long](2l.toLong, 6l.toLong))));
... | [
"\n }\n"
] |
HumanEval_63_fibfib | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// The FibFib number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
// fibfib(0) == 0
// fibfib(1) == 0
// fibfib(2) == 1
// fibfib(n) == fibfib(n-1) + fibfib(n-2) + fibfib(n-3).
// Pleas... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_63_fibfib.py | verbatim | }
def main(args: Array[String]) = {
assert(fibfib((2l)) == (1l));
assert(fibfib((1l)) == (0l));
assert(fibfib((5l)) == (4l));
assert(fibfib((8l)) == (24l));
assert(fibfib((10l)) == (81l));
assert(fibfib((12l)) == (274l));
assert(fibfib((14l)) == (927l));
}
}
| [
"\n }\n"
] |
HumanEval_64_vowels_count | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Write a function vowels_count which takes a string representing
// a word as input and returns the number of vowels in the string.
// Vowels in this case are 'a', 'e', 'i', 'o', 'u'. Here, 'y' is also a
// vowel, but only when it ... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_64_vowels_count.py | verbatim | }
def main(args: Array[String]) = {
assert(vowelsCount(("abcde")) == (2l));
assert(vowelsCount(("Alone")) == (3l));
assert(vowelsCount(("key")) == (2l));
assert(vowelsCount(("bye")) == (1l));
assert(vowelsCount(("keY")) == (2l));
assert(vowelsCount(("bYe")) == (1l));
assert(vowelsCou... | [
"\n }\n"
] |
HumanEval_65_circular_shift | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Circular shift the digits of the integer x, shift the digits right by shift
// and return the result as a string.
// If shift > number of digits, return digits reversed.
def circularShift(x : Long, shift : Long) : String = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_65_circular_shift.py | verbatim | }
def main(args: Array[String]) = {
assert(circularShift((100l), (2l)).equals(("001")));
assert(circularShift((12l), (2l)).equals(("12")));
assert(circularShift((97l), (8l)).equals(("79")));
assert(circularShift((12l), (1l)).equals(("21")));
assert(circularShift((11l), (101l)).equals(("11"))... | [
"\n }\n"
] |
HumanEval_66_digitSum | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Task
// Write a function that takes a string as input and returns the sum of the upper characters only'
// ASCII codes.
// Examples:
def digitSum(s : String) : Long = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_66_digitSum.py | verbatim | }
def main(args: Array[String]) = {
assert(digitSum(("")) == (0l));
assert(digitSum(("abAB")) == (131l));
assert(digitSum(("abcCd")) == (67l));
assert(digitSum(("helloE")) == (69l));
assert(digitSum(("woArBld")) == (131l));
assert(digitSum(("aAaaaXa")) == (153l));
assert(digitSum((" ... | [
"\n }\n"
] |
HumanEval_67_fruit_distribution | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// In this task, you will be given a string that represents a number of apples and oranges
// that are distributed in a basket of fruit this basket contains
// apples, oranges, and mango fruits. Given the string that represents the tot... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_67_fruit_distribution.py | verbatim | }
def main(args: Array[String]) = {
assert(fruitDistribution(("5 apples and 6 oranges"), (19l)) == (8l));
assert(fruitDistribution(("5 apples and 6 oranges"), (21l)) == (10l));
assert(fruitDistribution(("0 apples and 1 oranges"), (3l)) == (2l));
assert(fruitDistribution(("1 apples and 0 oranges"... | [
"\n }\n"
] |
HumanEval_68_pluck | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// "Given an array representing a branch of a tree that has non-negative integer nodes
// your task is to pluck one of the nodes and return it.
// The plucked node should be the node with the smallest even value.
// If multiple nodes... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_68_pluck.py | verbatim | }
def main(args: Array[String]) = {
assert(pluck((List[Long](4l.toLong, 2l.toLong, 3l.toLong))).equals((List[Long](2l.toLong, 1l.toLong))));
assert(pluck((List[Long](1l.toLong, 2l.toLong, 3l.toLong))).equals((List[Long](2l.toLong, 1l.toLong))));
assert(pluck((List[Long]())).equals((List[Long]())));
... | [
"\n }\n"
] |
HumanEval_69_search | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// You are given a non-empty list of positive integers. Return the greatest integer that is greater than
// zero, and has a frequency greater than or equal to the value of the integer itself.
// The frequency of an integer is the numbe... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_69_search.py | verbatim | }
def main(args: Array[String]) = {
assert(search((List[Long](5l.toLong, 5l.toLong, 5l.toLong, 5l.toLong, 1l.toLong))) == (1l));
assert(search((List[Long](4l.toLong, 1l.toLong, 4l.toLong, 1l.toLong, 4l.toLong, 4l.toLong))) == (4l));
assert(search((List[Long](3l.toLong, 3l.toLong))) == (-1l));
as... | [
"\n }\n"
] |
HumanEval_6_parse_nested_parens | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Input to this function is a string represented multiple groups for nested parentheses separated by spaces.
// For each of the group, output the deepest level of nesting of parentheses.
// E.g. (()()) has maximum two levels of nesting ... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_6_parse_nested_parens.py | verbatim | }
def main(args: Array[String]) = {
assert(parseNestedParens(("(()()) ((())) () ((())()())")).equals((List[Long](2l.toLong, 3l.toLong, 1l.toLong, 3l.toLong))));
assert(parseNestedParens(("() (()) ((())) (((())))")).equals((List[Long](1l.toLong, 2l.toLong, 3l.toLong, 4l.toLong))));
assert(parseNested... | [
"\n }\n"
] |
HumanEval_70_strange_sort_list | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Given list of integers, return list in strange order.
// Strange sorting, is when you start with the minimum value,
// then maximum of the remaining integers, then minimum and so on.
// Examples:
def strangeSortList(lst : List... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_70_strange_sort_list.py | verbatim | }
def main(args: Array[String]) = {
assert(strangeSortList((List[Long](1l.toLong, 2l.toLong, 3l.toLong, 4l.toLong))).equals((List[Long](1l.toLong, 4l.toLong, 2l.toLong, 3l.toLong))));
assert(strangeSortList((List[Long](5l.toLong, 6l.toLong, 7l.toLong, 8l.toLong, 9l.toLong))).equals((List[Long](5l.toLong... | [
"\n }\n"
] |
HumanEval_71_triangle_area | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Given the lengths of the three sides of a triangle. Return the area of
// the triangle rounded to 2 decimal points if the three sides form a valid triangle.
// Otherwise return -1
// Three sides make a valid triangle when the sum... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_71_triangle_area.py | verbatim | }
def main(args: Array[String]) = {
assert(triangleArea((3l), (4l), (5l)) == (6.0f));
assert(triangleArea((1l), (2l), (10l)) == -1l);
assert(triangleArea((4l), (8l), (5l)) == (8.18f));
assert(triangleArea((2l), (2l), (2l)) == (1.73f));
assert(triangleArea((1l), (2l), (3l)) == -1l);
asser... | [
"\n }\n"
] |
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.
//... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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:
// 30 = 2 * 3 * 5
def isMultiplyPrime(a : Long) : B... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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:
def isSimplePower(x : Long, n : Long) : Boolean = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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:
def iscube(a : Long) : Boolean = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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 ... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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'.
... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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
def filterBySubstring(strings : List[String], substring : String) : List[String] = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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:
def isHappy(s : String) : Boolean ... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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
def primeLength(string : String) : Boolean = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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_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
// Variables:
// @N integer
// Constraints: 0 ≤ N ≤ 10000.
// Output:
// a string of binary number
def solve(N : Long) : String =... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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:
def add(lst : List[Long]) : Long = {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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,
/... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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 ... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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.
def sumProduct(numbers : List[Long]) : Tuple2[Long... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/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"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.