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_75_is_multiply_prime | ts | //Write a function that returns true if the given number is the multiplication of 3 prime numbers
// and false otherwise.
// Knowing that (a) is less then 100.
// Example:
// >>> is_multiply_prime(30)
// true
// 30 = 2 * 3 * 5
function is_multiply_prime(a: number): boolean {
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_75_is_multiply_prime.py | verbatim | declare var require: any;
const assert = require('node:assert');
function test() {
let candidate = is_multiply_prime;
assert.deepEqual(candidate(5),false);
assert.deepEqual(candidate(30),true);
assert.deepEqual(candidate(8),true);
assert.deepEqual(candidate(10),false);
assert.deepEqual(candidate(125),true... | [
"\nfunction ",
"\n/*",
"\n//",
"\nclass"
] |
HumanEval_76_is_simple_power | ts | //Your task is to write a function that returns true if a number x is a simple
// power of n and false in other cases.
// x is a simple power of n if n**int=x
// For example:
// >>> is_simple_power(1, 4)
// true
// >>> is_simple_power(2, 2)
// true
// >>> is_simple_power(8, 2)
// true
// >>> is_simple_power(3, 2)
// fa... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_76_is_simple_power.py | verbatim | declare var require: any;
const assert = require('node:assert');
function test() {
let candidate = is_simple_power;
assert.deepEqual(candidate(16, 2),true);
assert.deepEqual(candidate(143214, 16),false);
assert.deepEqual(candidate(4, 2),true);
assert.deepEqual(candidate(9, 3),true);
assert.deepEqual(candi... | [
"\nfunction ",
"\n/*",
"\n//",
"\nclass"
] |
HumanEval_77_iscube | ts | //Write a function that takes an integer a and returns True
// if this ingeger is a cube of some integer number.
// Note: you may assume the input is always valid.
// Examples:
// >>> iscube(1)
// true
// >>> iscube(2)
// false
// >>> iscube(-1)
// true
// >>> iscube(64)
// true
// >>> iscube(0)
// true
// >>> iscube(... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_77_iscube.py | verbatim | declare var require: any;
const assert = require('node:assert');
function test() {
let candidate = iscube;
assert.deepEqual(candidate(1),true);
assert.deepEqual(candidate(2),false);
assert.deepEqual(candidate(-1),true);
assert.deepEqual(candidate(64),true);
assert.deepEqual(candidate(180),false);
assert... | [
"\nfunction ",
"\n/*",
"\n//",
"\nclass"
] |
HumanEval_78_hex_key | ts | //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 not a product of two smaller natural numbers).
// Hexadecimal digits are 0, 1, 2, 3, 4, ... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_78_hex_key.py | verbatim | declare var require: any;
const assert = require('node:assert');
function test() {
let candidate = hex_key;
assert.deepEqual(candidate("AB"),1);
assert.deepEqual(candidate("1077E"),2);
assert.deepEqual(candidate("ABED1A33"),4);
assert.deepEqual(candidate("2020"),2);
assert.deepEqual(candidate("123456789AB... | [
"\nfunction ",
"\n/*",
"\n//",
"\nclass"
] |
HumanEval_79_decimal_to_binary | ts | //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'.
// There will be an extra couple of characters 'db' at the beginning and at the end ... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_79_decimal_to_binary.py | verbatim | declare var require: any;
const assert = require('node:assert');
function test() {
let candidate = decimal_to_binary;
assert.deepEqual(candidate(0),"db0db");
assert.deepEqual(candidate(32),"db100000db");
assert.deepEqual(candidate(103),"db1100111db");
assert.deepEqual(candidate(15),"db1111db");
}
test(); | [
"\nfunction ",
"\n/*",
"\n//",
"\nclass"
] |
HumanEval_7_filter_by_substring | ts | //Filter an input list of strings only for ones that contain given substring
// >>> filter_by_substring([], "a")
// []
// >>> filter_by_substring(["abc", "bacd", "cde", "array"], "a")
// ["abc", "bacd", "array"]
function filter_by_substring(strings: string[], substring: string): string[] {
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_7_filter_by_substring.py | verbatim | declare var require: any;
const assert = require('node:assert');
function test() {
let candidate = filter_by_substring;
assert.deepEqual(candidate([], "john"),[]);
assert.deepEqual(candidate(["xxx", "asd", "xxy", "john doe", "xxxAAA", "xxx"], "xxx"),["xxx", "xxxAAA", "xxx"]);
assert.deepEqual(candidate(["xxx"... | [
"\nfunction ",
"\n/*",
"\n//",
"\nclass"
] |
HumanEval_80_is_happy | ts | //You are given a string s.
// Your task is to check if the string is happy or not.
// A string is happy if its length is at least 3 and every 3 consecutive letters are distinct
// For example:
// >>> is_happy("a")
// false
// >>> is_happy("aa")
// false
// >>> is_happy("abcd")
// true
// >>> is_happy("aabb")
// false
... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_80_is_happy.py | verbatim | declare var require: any;
const assert = require('node:assert');
function test() {
let candidate = is_happy;
assert.deepEqual(candidate("a"),false);
assert.deepEqual(candidate("aa"),false);
assert.deepEqual(candidate("abcd"),true);
assert.deepEqual(candidate("aabb"),false);
assert.deepEqual(candidate("adb... | [
"\nfunction ",
"\n/*",
"\n//",
"\nclass"
] |
HumanEval_81_numerical_letter_grade | ts | //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 given you a list of GPAs for some students and you have to write
// a function that can ... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_81_numerical_letter_grade.py | verbatim | declare var require: any;
const assert = require('node:assert');
function test() {
let candidate = numerical_letter_grade;
assert.deepEqual(candidate([4.0, 3, 1.7, 2, 3.5]),["A+", "B", "C-", "C", "A-"]);
assert.deepEqual(candidate([1.2]),["D+"]);
assert.deepEqual(candidate([0.5]),["D-"]);
assert.deepEqual(c... | [
"\nfunction ",
"\n/*",
"\n//",
"\nclass"
] |
HumanEval_82_prime_length | ts | //Write a function that takes a string and returns True if the string
// length is a prime number or False otherwise
// Examples
// >>> prime_length("Hello")
// true
// >>> prime_length("abcdcba")
// true
// >>> prime_length("kittens")
// true
// >>> prime_length("orange")
// false
function prime_length(string: string)... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_82_prime_length.py | verbatim | declare var require: any;
const assert = require('node:assert');
function test() {
let candidate = prime_length;
assert.deepEqual(candidate("Hello"),true);
assert.deepEqual(candidate("abcdcba"),true);
assert.deepEqual(candidate("kittens"),true);
assert.deepEqual(candidate("orange"),false);
assert.deepEqua... | [
"\nfunction ",
"\n/*",
"\n//",
"\nclass"
] |
HumanEval_83_starts_one_ends | ts | //Given a positive integer n, return the count of the numbers of n-digit
// positive integers that start or end with 1.
function starts_one_ends(n: number): number {
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_83_starts_one_ends.py | verbatim | declare var require: any;
const assert = require('node:assert');
function test() {
let candidate = starts_one_ends;
assert.deepEqual(candidate(1),1);
assert.deepEqual(candidate(2),18);
assert.deepEqual(candidate(3),180);
assert.deepEqual(candidate(4),1800);
assert.deepEqual(candidate(5),18000);
}
test(); | [
"\nfunction ",
"\n/*",
"\n//",
"\nclass"
] |
HumanEval_84_solve | ts | //Given a positive integer N, return the total sum of its digits in binary.
// Example
// >>> solve(1000)
// "1"
// >>> solve(150)
// "110"
// >>> solve(147)
// "1100"
// Variables:
// @N integer
// Constraints: 0 ≤ N ≤ 10000.
// Output:
// a string of binary number
function solve(N: number): string {
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_84_solve.py | verbatim | declare var require: any;
const assert = require('node:assert');
function test() {
let candidate = solve;
assert.deepEqual(candidate(1000),"1");
assert.deepEqual(candidate(150),"110");
assert.deepEqual(candidate(147),"1100");
assert.deepEqual(candidate(333),"1001");
assert.deepEqual(candidate(963),"10010"... | [
"\nfunction ",
"\n/*",
"\n//",
"\nclass"
] |
HumanEval_85_add | ts | //Given a non-empty list of integers lst. add the even elements that are at odd indices..
// Examples:
// >>> add([4, 2, 6, 7])
// 2
function add(lst: number[]): number {
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_85_add.py | verbatim | declare var require: any;
const assert = require('node:assert');
function test() {
let candidate = add;
assert.deepEqual(candidate([4, 88]),88);
assert.deepEqual(candidate([4, 5, 6, 7, 2, 122]),122);
assert.deepEqual(candidate([4, 0, 6, 7]),0);
assert.deepEqual(candidate([4, 4, 6, 8]),12);
}
test(); | [
"\nfunction ",
"\n/*",
"\n//",
"\nclass"
] |
HumanEval_86_anti_shuffle | ts | //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
// ascending order based on ascii value.
// Note: You should keep the order of words and blank sp... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_86_anti_shuffle.py | verbatim | declare var require: any;
const assert = require('node:assert');
function test() {
let candidate = anti_shuffle;
assert.deepEqual(candidate("Hi"),"Hi");
assert.deepEqual(candidate("hello"),"ehllo");
assert.deepEqual(candidate("number"),"bemnru");
assert.deepEqual(candidate("abcd"),"abcd");
assert.deepEqua... | [
"\nfunction ",
"\n/*",
"\n//",
"\nclass"
] |
HumanEval_87_get_row | ts | //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,
// and return list of tuples, [(x1, y1), (x2, y2) ...] such that
// each tuple is a coordinat... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_87_get_row.py | verbatim | declare var require: any;
const assert = require('node:assert');
function test() {
let candidate = get_row;
assert.deepEqual(candidate([[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 1, 6], [1, 2, 3, 4, 5, 1]], 1),[[0, 0], [1, 4], [1, 0], [2, 5], [2, 0]]);
assert.deepEqual(candidate([[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 5, 6], [... | [
"\nfunction ",
"\n/*",
"\n//",
"\nclass"
] |
HumanEval_88_sort_array | ts | //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 the sum( first index value, last index value) is even.
// Note:
// * don't change t... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_88_sort_array.py | verbatim | declare var require: any;
const assert = require('node:assert');
function test() {
let candidate = sort_array;
assert.deepEqual(candidate([]),[]);
assert.deepEqual(candidate([5]),[5]);
assert.deepEqual(candidate([2, 4, 3, 0, 1, 5]),[0, 1, 2, 3, 4, 5]);
assert.deepEqual(candidate([2, 4, 3, 0, 1, 5, 6]),[6, 5... | [
"\nfunction ",
"\n/*",
"\n//",
"\nclass"
] |
HumanEval_89_encrypt | ts | //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 to two places.
// For example:
// >>> encrypt("hi")
// "lm"
// >>> encrypt("asdfghjkl")
... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_89_encrypt.py | verbatim | declare var require: any;
const assert = require('node:assert');
function test() {
let candidate = encrypt;
assert.deepEqual(candidate("hi"),"lm");
assert.deepEqual(candidate("asdfghjkl"),"ewhjklnop");
assert.deepEqual(candidate("gf"),"kj");
assert.deepEqual(candidate("et"),"ix");
assert.deepEqual(candida... | [
"\nfunction ",
"\n/*",
"\n//",
"\nclass"
] |
HumanEval_8_sum_product | ts | //For a given list of integers, return a tuple consisting of a sum and a product of all the integers in a list.
// Empty sum should be equal to 0 and empty product should be equal to 1.
// >>> sum_product([])
// [0, 1]
// >>> sum_product([1, 2, 3, 4])
// [10, 24]
function sum_product(numbers: number[]): [number, number... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_8_sum_product.py | verbatim | declare var require: any;
const assert = require('node:assert');
function test() {
let candidate = sum_product;
assert.deepEqual(candidate([]),[0, 1]);
assert.deepEqual(candidate([1, 1, 1]),[3, 1]);
assert.deepEqual(candidate([100, 0]),[100, 0]);
assert.deepEqual(candidate([3, 5, 7]),[15, 105]);
assert.de... | [
"\nfunction ",
"\n/*",
"\n//",
"\nclass"
] |
HumanEval_90_next_smallest | ts | //You are given a list of integers.
// Write a function next_smallest() that returns the 2nd smallest element of the list.
// Return None if there is no such element.
// >>> next_smallest([1, 2, 3, 4, 5])
// 2
// >>> next_smallest([5, 1, 4, 3, 2])
// 2
// >>> next_smallest([])
// undefined
// >>> next_smallest([1, 1])
... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_90_next_smallest.py | verbatim | declare var require: any;
const assert = require('node:assert');
function test() {
let candidate = next_smallest;
assert.deepEqual(candidate([1, 2, 3, 4, 5]),2);
assert.deepEqual(candidate([5, 1, 4, 3, 2]),2);
assert.deepEqual(candidate([]),undefined);
assert.deepEqual(candidate([1, 1]),undefined);
assert... | [
"\nfunction ",
"\n/*",
"\n//",
"\nclass"
] |
HumanEval_91_is_bored | ts | //You'll be given a string of words, and your task is to count the number
// of boredoms. A boredom is a sentence that starts with the word "I".
// Sentences are delimited by '.', '?' or '!'.
// For example:
// >>> is_bored("Hello world")
// 0
// >>> is_bored("The sky is blue. The sun is shining. I love this weather")
... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_91_is_bored.py | verbatim | declare var require: any;
const assert = require('node:assert');
function test() {
let candidate = is_bored;
assert.deepEqual(candidate("Hello world"),0);
assert.deepEqual(candidate("Is the sky blue?"),0);
assert.deepEqual(candidate("I love It !"),1);
assert.deepEqual(candidate("bIt"),0);
assert.deepEqual... | [
"\nfunction ",
"\n/*",
"\n//",
"\nclass"
] |
HumanEval_92_any_int | ts | //Create a function that takes 3 numbers.
// Returns true if one of the numbers is equal to the sum of the other two, and all numbers are integers.
// Returns false in any other cases.
// Examples
// >>> any_int(5, 2, 7)
// true
// >>> any_int(3, 2, 2)
// false
// >>> any_int(3, -2, 1)
// true
// >>> any_int(3.6, -2.2,... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_92_any_int.py | verbatim | declare var require: any;
const assert = require('node:assert');
function test() {
let candidate = any_int;
assert.deepEqual(candidate(2, 3, 1),true);
assert.deepEqual(candidate(2.5, 2, 3),false);
assert.deepEqual(candidate(1.5, 5, 3.5),false);
assert.deepEqual(candidate(2, 6, 2),false);
assert.deepEqual(... | [
"\nfunction ",
"\n/*",
"\n//",
"\nclass"
] |
HumanEval_93_encode | ts | //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.
// Assume only letters.
// Examples:
// >>> encode("test")
// "TGST"
// >>> encode("Th... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_93_encode.py | verbatim | declare var require: any;
const assert = require('node:assert');
function test() {
let candidate = encode;
assert.deepEqual(candidate("TEST"),"tgst");
assert.deepEqual(candidate("Mudasir"),"mWDCSKR");
assert.deepEqual(candidate("YES"),"ygs");
assert.deepEqual(candidate("This is a message"),"tHKS KS C MGSSCG... | [
"\nfunction ",
"\n/*",
"\n//",
"\nclass"
] |
HumanEval_94_skjkasdkd | ts | //You are given a list of integers.
// You need to find the largest prime value and return the sum of its digits.
// Examples:
// >>> skjkasdkd([0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3])
// 10
// >>> skjkasdkd([1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1])
// 25
// >>> skjka... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_94_skjkasdkd.py | verbatim | declare var require: any;
const assert = require('node:assert');
function test() {
let candidate = skjkasdkd;
assert.deepEqual(candidate([0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3]),10);
assert.deepEqual(candidate([1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1]),25);
a... | [
"\nfunction ",
"\n/*",
"\n//",
"\nclass"
] |
HumanEval_95_check_dict_case | ts | //Given a dictionary, return True if all keys are strings in lower
// case or all keys are strings in upper case, else return False.
// The function should return False is the given dictionary is empty.
// Examples:
// >>> check_dict_case({"a": "apple", "b": "banana"})
// true
// >>> check_dict_case({"a": "apple", "A"... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_95_check_dict_case.py | verbatim | declare var require: any;
const assert = require('node:assert');
function test() {
let candidate = check_dict_case;
assert.deepEqual(candidate({"p": "pineapple", "b": "banana"}),true);
assert.deepEqual(candidate({"p": "pineapple", "A": "banana", "B": "banana"}),false);
assert.deepEqual(candidate({"p": "pineap... | [
"\nfunction ",
"\n/*",
"\n//",
"\nclass"
] |
HumanEval_96_count_up_to | ts | //Implement a function that takes an non-negative integer and returns an array of the first n
// integers that are prime numbers and less than n.
// for example:
// >>> count_up_to(5)
// [2, 3]
// >>> count_up_to(11)
// [2, 3, 5, 7]
// >>> count_up_to(0)
// []
// >>> count_up_to(20)
// [2, 3, 5, 7, 11, 13, 17, 19]
// >... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_96_count_up_to.py | verbatim | declare var require: any;
const assert = require('node:assert');
function test() {
let candidate = count_up_to;
assert.deepEqual(candidate(5),[2, 3]);
assert.deepEqual(candidate(6),[2, 3, 5]);
assert.deepEqual(candidate(7),[2, 3, 5]);
assert.deepEqual(candidate(10),[2, 3, 5, 7]);
assert.deepEqual(candidat... | [
"\nfunction ",
"\n/*",
"\n//",
"\nclass"
] |
HumanEval_97_multiply | ts | //Complete the function that takes two integers and returns
// the product of their unit digits.
// Assume the input is always valid.
// Examples:
// >>> multiply(148, 412)
// 16
// >>> multiply(19, 28)
// 72
// >>> multiply(2020, 1851)
// 0
// >>> multiply(14, -15)
// 20
function multiply(a: number, b: number): numbe... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_97_multiply.py | verbatim | declare var require: any;
const assert = require('node:assert');
function test() {
let candidate = multiply;
assert.deepEqual(candidate(148, 412),16);
assert.deepEqual(candidate(19, 28),72);
assert.deepEqual(candidate(2020, 1851),0);
assert.deepEqual(candidate(14, -15),20);
assert.deepEqual(candidate(76, ... | [
"\nfunction ",
"\n/*",
"\n//",
"\nclass"
] |
HumanEval_98_count_upper | ts | //Given a string s, count the number of uppercase vowels in even indices.
// For example:
// >>> count_upper("aBCdEf")
// 1
// >>> count_upper("abcdefg")
// 0
// >>> count_upper("dBBE")
// 0
function count_upper(s: string): number {
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_98_count_upper.py | verbatim | declare var require: any;
const assert = require('node:assert');
function test() {
let candidate = count_upper;
assert.deepEqual(candidate("aBCdEf"),1);
assert.deepEqual(candidate("abcdefg"),0);
assert.deepEqual(candidate("dBBE"),0);
assert.deepEqual(candidate("B"),0);
assert.deepEqual(candidate("U"),1);
... | [
"\nfunction ",
"\n/*",
"\n//",
"\nclass"
] |
HumanEval_99_closest_integer | ts | //Create a function that takes a value (string) representing a number
// and returns the closest integer to it. If the number is equidistant
// from two integers, round it away from zero.
// Examples
// >>> closest_integer("10")
// 10
// >>> closest_integer("15.3")
// 15
// Note:
// Rounding away from zero means that i... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_99_closest_integer.py | verbatim | declare var require: any;
const assert = require('node:assert');
function test() {
let candidate = closest_integer;
assert.deepEqual(candidate("10"),10);
assert.deepEqual(candidate("14.5"),15);
assert.deepEqual(candidate("-15.5"),-16);
assert.deepEqual(candidate("15.3"),15);
assert.deepEqual(candidate("0"... | [
"\nfunction ",
"\n/*",
"\n//",
"\nclass"
] |
HumanEval_9_rolling_max | ts | //From a given list of integers, generate a list of rolling maximum element found until given moment
// in the sequence.
// >>> rolling_max([1, 2, 3, 2, 3, 4, 2])
// [1, 2, 3, 3, 3, 4, 4]
function rolling_max(numbers: number[]): number[] {
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_9_rolling_max.py | verbatim | declare var require: any;
const assert = require('node:assert');
function test() {
let candidate = rolling_max;
assert.deepEqual(candidate([]),[]);
assert.deepEqual(candidate([1, 2, 3, 4]),[1, 2, 3, 4]);
assert.deepEqual(candidate([4, 3, 2, 1]),[4, 4, 4, 4]);
assert.deepEqual(candidate([3, 2, 3, 100, 3]),[3... | [
"\nfunction ",
"\n/*",
"\n//",
"\nclass"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.