id stringlengths 17 17 | task_id stringlengths 11 13 | entry_point stringlengths 1 30 | prompt stringlengths 130 1.36k | solution stringlengths 48 13.2k | passes bool 2
classes | model stringclasses 31
values | version stringclasses 1
value | evaluator stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|
code-verifier/000 | HumanEval/32 | find_zero | import math
def poly(xs: list, x: float):
"""
Evaluates polynomial with coefficients xs at point x.
return xs[0] + xs[1] * x + xs[1] * x^2 + .... xs[n] * x^n
"""
return sum([coeff * math.pow(x, i) for i, coeff in enumerate(xs)])
def find_zero(xs: list):
""" xs are coefficients of a polynomia... | import math
def poly(xs: list, x: float):
"""
Evaluates polynomial with coefficients xs at point x.
return xs[0] + xs[1] * x + xs[1] * x^2 + .... xs[n] * x^n
"""
return sum([coeff * math.pow(x, i) for i, coeff in enumerate(xs)])
def find_zero(xs: list):
""" xs are coefficients of a polynomia... | false | gemma4-e2b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/001 | HumanEval/108 | count_nums |
def count_nums(arr):
"""
Write a function count_nums which takes an array of integers and returns
the number of elements which has a sum of digits > 0.
If a number is negative, then its first signed digit will be negative:
e.g. -123 has signed digits -1, 2, and 3.
>>> count_nums([]) == 0
>>... | def count_nums(arr):
"""
Write a function count_nums which takes an array of integers and returns
the number of elements which has a sum of digits > 0.
If a number is negative, then its first signed digit will be negative:
e.g. -123 has signed digits -1, 2, and 3.
>>> count_nums([]) == 0
>>>... | true | minicpm5-2b-q8-bench-rp115 | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/002 | HumanEval/144 | simplify |
def simplify(x, n):
"""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 the following format,
<numerator>/<denominator> where ... | def simplify(x, n):
def to_float(frac):
num, den = map(int, frac.split('/'))
return num / den
x_val = to_float(x)
n_val = to_float(n)
product = x_val * n_val
return abs(product - round(product)) < 1e-10 | false | granite4.2-3b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/003 | HumanEval/103 | rounded_avg |
def rounded_avg(n, m):
"""You are given two positive integers n and m, and your task is to compute the
average of the integers from n through m (including n and m).
Round the answer to the nearest integer and convert that to binary.
If n is greater than m, return -1.
Example:
rounded_avg(1, 5)... | def rounded_avg(n,m):
"""You are given two positive integers n and m, ..."""
if n > m:
return -1
total = sum(range(n, m+1))
avg_rounded = round(total / (m-n + 1))
# Convert to binary string with '0b' prefix.
return bin(avg_rounded) | true | minicpm5-2b-q4-bench-rp | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/004 | HumanEval/41 | car_race_collision |
def car_race_collision(n: int):
"""
Imagine a road that's a perfectly straight infinitely long line.
n cars are driving left to right; simultaneously, a different set of n cars
are driving right to left. The two sets of cars start out being very far from
each other. All cars move in the same s... | def car_race_collision(n: int):
return n * (n - 1) // 2 | false | granite4.2-3b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/005 | HumanEval/93 | encode |
def encode(message):
"""
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:
>>>... | def encode(message):
vowels = 'aeiouAEIOU'
result = []
for char in message:
if char in vowels:
char = chr(ord(char) + 2)
if char.isalpha():
char = char.swapcase()
result.append(char)
return ''.join(result) | true | qwen3.8-27b-q4-low | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/006 | HumanEval/32 | find_zero | import math
def poly(xs: list, x: float):
"""
Evaluates polynomial with coefficients xs at point x.
return xs[0] + xs[1] * x + xs[1] * x^2 + .... xs[n] * x^n
"""
return sum([coeff * math.pow(x, i) for i, coeff in enumerate(xs)])
def find_zero(xs: list):
""" xs are coefficients of a polynomia... | import math
def find_zero(xs: list):
lo = -1.0
hi = 1.0
for _ in range(200):
if poly(xs, lo) == 0:
return lo
if poly(xs, hi) == 0:
return hi
if poly(xs, lo) * poly(xs, hi) < 0:
break
lo *= 2
hi *= 2
for _ in range(200):
... | false | muse-glimmer-30b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/007 | HumanEval/110 | exchange |
def exchange(lst1, lst2):
"""In this problem, you will implement a function that takes two lists of numbers,
and determines whether it is possible to perform an exchange of elements
between them to make lst1 a list of only even numbers.
There is no limit on the number of exchanged elements between lst1... | def exchange(lst1, lst2):
even_cnt = sum(1 for x in lst1 if x % 2 == 0) + sum(1 for x in lst2 if x % 2 == 0)
return "YES" if even_cnt >= len(lst1) else "NO" | true | lfm2.5-8b-a1b-control | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/008 | HumanEval/103 | rounded_avg |
def rounded_avg(n, m):
"""You are given two positive integers n and m, and your task is to compute the
average of the integers from n through m (including n and m).
Round the answer to the nearest integer and convert that to binary.
If n is greater than m, return -1.
Example:
rounded_avg(1, 5)... | def rounded_avg(n, m):
if n > m:
return -1
total = (n + m) * (m - n + 1) // 2
avg = total / (m - n + 1)
rounded = int(avg + 0.5)
binary = bin(rounded)[2:]
return "0b" + binary | false | lfm2.5-2.6b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/009 | HumanEval/141 | file_name_check |
def file_name_check(file_name):
"""Create a function which takes a string representing a file's name, and returns
'Yes' if the the file's name is valid, and returns 'No' otherwise.
A file's name is considered to be valid if and only if all the following conditions
are met:
- There should not be mo... | def file_name_check(file_name):
digit_count = sum(1 for ch in file_name if ch.isdigit())
if digit_count > 3:
return 'No'
if file_name.count('.') != 1:
return 'No'
name, ext = file_name.split('.')
if not name or not name[0].isalpha():
return 'No'
if ext not in ('txt', 'exe... | true | lfm2.5-8b-a1b-control | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/010 | HumanEval/64 | vowels_count |
FIX = """
Add more test cases.
"""
def vowels_count(s):
"""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 is at the end of the g... | def vowels_count(s):
count = 0
for ch in s.lower():
if ch in 'aeiou':
count += 1
elif ch == 'y' and s.endswith('y'):
count += 1
return count | false | lfm2.5-8b-a1b-control | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/011 | HumanEval/156 | int_to_mini_roman |
def int_to_mini_roman(number):
"""
Given a positive integer, obtain its roman numeral equivalent as a string,
and return it in lowercase.
Restrictions: 1 <= num <= 1000
Examples:
>>> int_to_mini_roman(19) == 'xix'
>>> int_to_mini_roman(152) == 'clii'
>>> int_to_mini_roman(426) == 'cdxx... | def int_to_mini_roman(number):
val = [
(1000, 'm'), (900, 'cm'), (500, 'd'), (400, 'cd'),
(100, 'c'), (90, 'xc'), (50, 'l'), (40, 'xl'),
(10, 'x'), (9, 'ix'), (5, 'v'), (4, 'iv'), (1, 'i')
]
roman = []
for digit, symbol in val:
while number >= digit:
roman.app... | true | lfm2.5-8b-a1b-control | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/012 | HumanEval/102 | choose_num |
def choose_num(x, y):
"""This function takes two positive numbers x and y and returns the
biggest even integer number that is in the range [x, y] inclusive. If
there's no such number, then the function should return -1.
For example:
choose_num(12, 15) = 14
choose_num(13, 12) = -1
"""
| def choose_num(x, y):
if x > y:
return -1
# Ensure we work with integers and correct order
start = max(x, 0)
end = min(y, 2 * 10**9) # large enough, but adjust as needed
if start > end:
return -1
# Find the largest even integer in [x, y]
if x % 2 == 0:
candidate = x ... | false | granite4.2-3b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/013 | HumanEval/160 | do_algebra |
def do_algebra(operator, operand):
"""
Given two lists operator, and operand. The first list has basic algebra operations, and
the second list is a list of integers. Use the two given lists to build the algebric
expression and return the evaluation of this expression.
The basic algebra operation... | def do_algebra(operator, operand):
expr_tokens = [str(operand[0])]
nxt_idx = 1
for op in operator:
expr_tokens.append(str(op))
expr_tokens.append(str(operand[nxt_idx]))
nxt_idx += 1
return eval(' '.join(expr_tokens), {}, {}) | true | minicpm5-2b-q8-bench-rp120 | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/014 | HumanEval/65 | circular_shift |
def circular_shift(x, shift):
"""Circular shift the digits of the integer x, shift the digits right by shift
and return the result as a string.
If shift > number of digits, return digits reversed.
>>> circular_shift(12, 1)
"21"
>>> circular_shift(12, 2)
"12"
"""
|
def circular_shift(x, shift):
"""Circular shift the digits of the integer x, shift the digits right by shift
and return the result as a string.
If shift > number of digits, return digits reversed.
>>> circular_shift(12, 1)
"21"
>>> circular_shift(12, 2)
"12"
"""
s = str(x)
n = l... | false | gemma4-e4b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/015 | HumanEval/128 | prod_signs |
def prod_signs(arr):
"""
You are given an array arr of integers and you need to return
sum of magnitudes of integers multiplied by product of all signs
of each number in the array, represented by 1, -1 or 0.
Note: return None for empty arr.
Example:
>>> prod_signs([1, 2, 2, -4]) == -9
... | def prod_signs(arr):
if not arr:
return None
signs = [1 if x > 0 else -1 if x < 0 else 0 for x in arr]
product_of_signs = 1
for s in signs:
if s == 0:
return 0
product_of_signs *= s
magnitude_sum = sum(abs(x) for x in arr)
return magnitude_sum * product_of_sig... | true | granite4.2-3b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/016 | HumanEval/88 | sort_array |
def sort_array(array):
"""
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) i... |
def sort_array(array):
"""
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) i... | false | gemma4-e2b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/017 | HumanEval/120 | maximum |
def maximum(arr, k):
"""
Given an array arr of integers and a positive integer k, return a sorted list
of length k with the maximum k numbers in arr.
Example 1:
Input: arr = [-3, -4, 5], k = 3
Output: [-4, -3, 5]
Example 2:
Input: arr = [4, -4, 4], k = 2
Output:... | def maximum(arr, k):
return sorted(sorted(arr, reverse=True)[:k]) | true | lfm2.5-2.6b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/018 | HumanEval/110 | exchange |
def exchange(lst1, lst2):
"""In this problem, you will implement a function that takes two lists of numbers,
and determines whether it is possible to perform an exchange of elements
between them to make lst1 a list of only even numbers.
There is no limit on the number of exchanged elements between lst1... |
def exchange(lst1, lst2):
"""In this problem, you will implement a function that takes two lists of numbers,
and determines whether it is possible to perform an exchange of elements
between them to make lst1 a list of only even numbers.
There is no limit on the number of exchanged elements between lst1... | false | gemma4-e2b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/019 | HumanEval/89 | encrypt |
def encrypt(s):
"""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') returns 'lm'
... | def encrypt(s):
result = ""
for char in s:
if 'a' <= char <= 'z':
shifted_char = chr((ord(char) - ord('a') + 4) % 26 + ord('a'))
result += shifted_char
elif 'A' <= char <= 'Z':
shifted_char = chr((ord(char) - ord('A') + 4) % 26 + ord('A'))
result +... | true | gemma4-e4b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/020 | HumanEval/1 | separate_paren_groups | from typing import List
def separate_paren_groups(paren_string: str) -> List[str]:
""" 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... | from typing import List
def separate_paren_groups(paren_string: str) -> List[str]:
s = paren_string.replace(' ', '')
result = []
stack = []
current = []
for ch in s:
if ch == '(':
stack.append(ch)
current.append(ch)
elif ch == ')':
start_idx = len... | false | lfm2.5-8b-a1b-dspark | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/021 | HumanEval/36 | fizz_buzz |
def fizz_buzz(n: int):
"""Return the number of times the digit 7 appears in integers less than n which are divisible by 11 or 13.
>>> fizz_buzz(50)
0
>>> fizz_buzz(78)
2
>>> fizz_buzz(79)
3
"""
| def fizz_buzz(n: int):
count = 0
for i in range(1, n):
if i % 11 == 0 or i % 13 == 0:
count += str(i).count('7')
return count | true | lfm2.5-8b-a1b-control | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/022 | HumanEval/122 | add_elements |
def add_elements(arr, k):
"""
Given a non-empty array of integers arr and an integer k, return
the sum of the elements with at most two digits from the first k elements of arr.
Example:
Input: arr = [111,21,3,4000,5,6,7,8,9], k = 4
Output: 24 # sum of 21 + 3
Constraints:
... |
def add_elements(arr, k):
"""
Given a non-empty array of integers arr and an integer k, return
the sum of the elements with at most two digits from the first k elements of arr.
Example:
Input: arr = [111,21,3,4000,5,6,7,8,9], k = 4
Output: 24 # sum of 21 + 3
Constraints:
... | false | gemma4-e2b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/023 | HumanEval/26 | remove_duplicates | from typing import List
def remove_duplicates(numbers: List[int]) -> List[int]:
""" From a list of integers, remove all elements that occur more than once.
Keep order of elements left the same as in the input.
>>> remove_duplicates([1, 2, 3, 2, 4])
[1, 3, 4]
"""
| from typing import List
def remove_duplicates(numbers: List[int]) -> List[int]:
""" From a list of integers, remove all elements that occur more than once.
Keep order of elements left the same as in the input.
>>> remove_duplicates([1, 2, 3, 2, 4])
[1, 3, 4]
"""
counts = {}
for n in number... | true | bonsai2-27b-pq2-np4 | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/024 | HumanEval/75 | is_multiply_prime |
def is_multiply_prime(a):
"""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
"""
|
def is_multiply_prime(a):
"""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
"""
if a < 6:
return False
for i in ran... | false | gemma4-e2b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/025 | HumanEval/26 | remove_duplicates | from typing import List
def remove_duplicates(numbers: List[int]) -> List[int]:
""" From a list of integers, remove all elements that occur more than once.
Keep order of elements left the same as in the input.
>>> remove_duplicates([1, 2, 3, 2, 4])
[1, 3, 4]
"""
| from typing import List
def remove_duplicates(numbers):
count = {}
for num in numbers:
count[num] = count.get(num, 0) + 1
return [num for num in numbers if count[num] == 1] | true | minicpm5-2b-q4-bench-rp | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/026 | HumanEval/97 | multiply |
def multiply(a, b):
"""Complete the function that takes two integers and returns
the product of their unit digits.
Assume the input is always valid.
Examples:
multiply(148, 412) should return 16.
multiply(19, 28) should return 72.
multiply(2020, 1851) should return 0.
multiply(14,-15) ... |
def multiply(a, b):
"""Complete the function that takes two integers and returns
the product of their unit digits.
Assume the input is always valid.
Examples:
multiply(148, 412) should return 16.
multiply(19, 28) should return 72.
multiply(2020, 1851) should return 0.
multiply(14,-15) ... | false | ornith-35b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/027 | HumanEval/8 | sum_product | from typing import List, Tuple
def sum_product(numbers: List[int]) -> Tuple[int, int]:
""" 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)
... | from typing import List, Tuple
def sum_product(numbers: List[int]) -> Tuple[int, int]:
""" 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)
... | true | gemma4-e2b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/028 | HumanEval/75 | is_multiply_prime |
def is_multiply_prime(a):
"""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
"""
|
def is_multiply_prime(a):
"""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
"""
# generate primes up to 100
primes = []
... | false | minicpm5-2b-q4-bench | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/029 | HumanEval/101 | words_string |
def words_string(s):
"""
You will be given a string of words separated by commas or spaces. Your task is
to split the string into words and return an array of the words.
For example:
words_string("Hi, my name is John") == ["Hi", "my", "name", "is", "John"]
words_string("One, two, three, fo... | def words_string(s):
return [w for w in s.replace(',', ' ').split() if w] | true | lfm2.5-8b-a1b-control | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/030 | HumanEval/121 | solution |
def solution(lst):
"""Given a non-empty list of integers, return the sum of all of the odd elements that are in even positions.
Examples
solution([5, 8, 7, 1]) ==> 12
solution([3, 3, 3, 3, 3]) ==> 9
solution([30, 13, 24, 321]) ==>0
"""
|
def solution(lst):
"""Given a non-empty list of integers, return the sum of all of the odd elements that are in even positions.
Examples
solution([5, 8, 7, 1]) ==> 12
solution([3, 3, 3, 3, 3]) ==> 9
solution([30, 13, 24, 321]) ==>0
"""
total_sum = 0
for i in range(len(lst)):
... | false | gemma4-e2b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/031 | HumanEval/77 | iscube |
def iscube(a):
'''
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) ==> ... | def iscube(a):
if a >= 0:
x = int(round(a ** (1/3)))
else:
x = -int(round((-a) ** (1/3)))
return x * x * x == a | true | lfm2.5-8b-a1b-control | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/032 | HumanEval/22 | filter_integers | from typing import List, Any
def filter_integers(values: List[Any]) -> List[int]:
""" Filter given list of any python values only for integers
>>> filter_integers(['a', 3.14, 5])
[5]
>>> filter_integers([1, 2, 3, 'abc', {}, []])
[1, 2, 3]
"""
| from typing import List, Any
def filter_integers(values: List[Any]) -> List[int]:
""" Filter given list of any python values only for integers
>>> filter_integers(['a', 3.14, 5])
[5]
>>> filter_integers([1, 2, 3, 'abc', {}, []])
[1, 2, 3]
"""
return [x for x in values if isinstance(x, int)... | false | gemma4-e4b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/033 | HumanEval/134 | check_if_last_char_is_a_letter |
def check_if_last_char_is_a_letter(txt):
'''
Create a function that returns True if the last character
of a given string is an alphabetical character and is not
a part of a word, and False otherwise.
Note: "word" is a group of characters separated by space.
Examples:
check_if_last_char_is_... | def check_if_last_char_is_a_letter(txt):
if not txt:
return False
if not txt[-1].isalpha():
return False
if len(txt) == 1:
return True
return txt[-2] == ' ' | true | qwen3.8-27b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/034 | HumanEval/140 | fix_spaces |
def fix_spaces(text):
"""
Given a string text, replace all spaces in it with underscores,
and if a string has more than 2 consecutive spaces,
then replace all consecutive spaces with -
fix_spaces("Example") == "Example"
fix_spaces("Example 1") == "Example_1"
fix_spaces(" Example 2")... | def fix_spaces(text):
# Replace multiple consecutive spaces with a single hyphen
import re
text = re.sub(r'\s+', '-', text)
# Replace single spaces with underscores
text = text.replace(' ', '_')
return text | false | granite4.2-3b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/035 | HumanEval/22 | filter_integers | from typing import List, Any
def filter_integers(values: List[Any]) -> List[int]:
""" Filter given list of any python values only for integers
>>> filter_integers(['a', 3.14, 5])
[5]
>>> filter_integers([1, 2, 3, 'abc', {}, []])
[1, 2, 3]
"""
| from typing import List, Any
def filter_integers(values: List[Any]) -> List[int]:
return [item for item in values if isinstance(item, int) and not isinstance(item, bool)] | true | lfm2.5-8b-a1b-control | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/036 | HumanEval/121 | solution |
def solution(lst):
"""Given a non-empty list of integers, return the sum of all of the odd elements that are in even positions.
Examples
solution([5, 8, 7, 1]) ==> 12
solution([3, 3, 3, 3, 3]) ==> 9
solution([30, 13, 24, 321]) ==>0
"""
|
def solution(lst):
"""Given a non-empty list of integers, return the sum of all of the odd elements that are in even positions.
Examples
solution([5, 8, 7, 1]) ==> 12
solution([3, 3, 3, 3, 3]) ==> 9
solution([30, 13, 24, 321]) ==>0
"""
total = 0
for i in range(len(lst)):
#... | false | gemma4-e4b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/037 | HumanEval/1 | separate_paren_groups | from typing import List
def separate_paren_groups(paren_string: str) -> List[str]:
""" 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... | from typing import List
def separate_paren_groups(paren_string: str) -> List[str]:
s = paren_string.replace(' ', '')
result = []
start = None
balance = 0
for i, ch in enumerate(s):
if ch == '(':
if balance == 0:
start = i
balance += 1
else:
... | true | lfm2.5-8b-a1b-control | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/038 | HumanEval/37 | sort_even |
def sort_even(l: list):
"""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.
>>> sort_even([1, 2, 3])
[1, 2, 3]
>>> sort_even([5, 6, 3, 4])
... | def sort_even(l: list):
evens = sorted([x for x in l if x % 2 == 0])
odds = [x for i, x in enumerate(l) if i % 2 != 0]
return [odds[i] if i % 2 != 0 else evens.pop(0) for i in range(len(l))] | false | lfm2.5-2.6b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/039 | HumanEval/38 | decode_cyclic |
def encode_cyclic(s: str):
"""
returns encoded string by cycling groups of three characters.
"""
# split string to groups. Each of length 3.
groups = [s[(3 * i):min((3 * i + 3), len(s))] for i in range((len(s) + 2) // 3)]
# cycle elements in each group. Unless group has fewer elements than 3.
... |
def encode_cyclic(s: str):
"""
returns encoded string by cycling groups of three characters.
"""
# split string to groups. Each of length 3.
groups = [s[(3 * i):min((3 * i + 3), len(s))] for i in range((len(s) + 2) // 3)]
# cycle elements in each group. Unless group has fewer elements than 3.
... | true | lfm2.5-8b-a1b-control | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/040 | HumanEval/85 | add |
def add(lst):
"""Given a non-empty list of integers lst. add the even elements that are at odd indices..
Examples:
add([4, 2, 6, 7]) ==> 2
"""
|
def add(lst):
"""Given a non-empty list of integers lst. add the even elements that are at odd indices..
Examples:
add([4, 2, 6, 7]) ==> 2
"""
result = []
for i in range(len(lst)):
if i % 2 != 0:
if lst[i] % 2 == 0:
result.append(lst[i])
return res... | false | gemma4-e2b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/041 | HumanEval/66 | digitSum |
def digitSum(s):
"""Task
Write a function that takes a string as input and returns the sum of the upper characters only'
ASCII codes.
Examples:
digitSum("") => 0
digitSum("abAB") => 131
digitSum("abcCd") => 67
digitSum("helloE") => 69
digitSum("woArBld") => 131
... | def digitSum(s):
return sum(ord(c) for c in s if c.isupper()) | true | lfm2.5-2.6b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/042 | HumanEval/113 | odd_count |
def odd_count(lst):
"""Given a list of strings, where each string consists of only digits, return a list.
Each element i of the output should be "the number of odd elements in the
string i of the input." where all the i's should be replaced by the number
of odd digits in the i'th string of the input.
... | def odd_count(lst):
return [f"the number of odd elements {sum(1 for c in s if c in '13579')} in the string {s} of the input." for s in lst] | false | lfm2.5-8b-a1b-control | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/043 | HumanEval/19 | sort_numbers | from typing import List
def sort_numbers(numbers: str) -> str:
""" 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 largest
>... | from typing import List
def sort_numbers(numbers: str) -> str:
word_to_num = {'zero':0,'one':1,'two':2,'three':3,'four':4,'five':5,'six':6,'seven':7,'eight':8,'nine':9}
numbers_list = numbers.split()
sorted_numbers = sorted(numbers_list, key=lambda w: word_to_num[w])
return ' '.join(sorted_numbers) | true | lfm2.5-8b-a1b-control | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/044 | HumanEval/130 | tri |
def tri(n):
"""Everyone knows Fibonacci sequence, it was studied deeply by mathematicians in
the last couple centuries. However, what people don't know is Tribonacci sequence.
Tribonacci sequence is defined by the recurrence:
tri(1) = 3
tri(n) = 1 + n / 2, if n is even.
tri(n) = tri(n - 1) + ... |
def tri(n):
"""Everyone knows Fibonacci sequence, it was studied deeply by mathematicians in
the last couple centuries. However, what people don't know is Tribonacci sequence.
Tribonacci sequence is defined by the recurrence:
tri(1) = 3
tri(n) = 1 + n / 2, if n is even.
tri(n) = tri(n - 1) + ... | false | gemma4-e2b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/045 | HumanEval/0 | has_close_elements | from typing import List
def has_close_elements(numbers: List[float], threshold: float) -> bool:
""" Check if in given list of numbers, are any two numbers closer to each other than
given threshold.
>>> has_close_elements([1.0, 2.0, 3.0], 0.5)
False
>>> has_close_elements([1.0, 2.8, 3.0, 4.0, 5.0, ... | from typing import List
def has_close_elements(numbers: List[float], threshold: float) -> bool:
""" Check if in given list of numbers, are any two numbers closer to each other than
given threshold.
>>> has_close_elements([1.0, 2.0, 3.0], 0.5)
False
>>> has_close_elements([1.0, 2.8, 3.0, 4.0, 5.0, ... | true | spark-x2.5-4b-bench-rp115 | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/046 | HumanEval/131 | digits |
def digits(n):
"""Given a positive integer n, return the product of the odd digits.
Return 0 if all digits are even.
For example:
digits(1) == 1
digits(4) == 0
digits(235) == 15
"""
| def digits(n):
product = 1
for d in str(n):
digit = int(d)
if digit % 2 == 1:
product *= digit
return product if product != 1 else 0 | false | granite4.2-3b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/047 | HumanEval/100 | make_a_pile |
def make_a_pile(n):
"""
Given a positive integer n, you have to make a pile of n levels of stones.
The first level has n stones.
The number of stones in the next level is:
- the next odd number if n is odd.
- the next even number if n is even.
Return the number of stones in each lev... | def make_a_pile(n):
result = []
current = n
while len(result) < n:
result.append(current)
if n % 2 == 1:
current += 2
else:
current += 2 if current % 2 == 0 else 1
return result | true | granite4.2-3b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/048 | HumanEval/63 | fibfib |
def fibfib(n: int):
"""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).
Please write a function to efficiently compute the n-th element of th... |
def fibfib(n: int):
"""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).
Please write a function to efficiently compute the n-th element of th... | false | minicpm5-2b-q8-bench-rp110 | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/049 | HumanEval/10 | make_palindrome |
def is_palindrome(string: str) -> bool:
""" Test if given string is a palindrome """
return string == string[::-1]
def make_palindrome(string: str) -> str:
""" Find the shortest palindrome that begins with a supplied string.
Algorithm idea is simple:
- Find the longest postfix of supplied string... | def make_palindrome(string: str) -> str:
n = len(string)
for i in range(n, 0, -1):
suffix = string[n-i:]
if suffix == suffix[::-1]:
prefix = string[:n-i]
return string + prefix[::-1]
return string | true | lfm2.5-8b-a1b-control | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/050 | HumanEval/116 | sort_array |
def sort_array(arr):
"""
In this Kata, you have to sort an array of non-negative integers according to
number of ones in their binary representation in ascending order.
For similar number of ones, sort based on decimal value.
It must be implemented like this:
>>> sort_array([1, 5, 2, 3, 4]) ==... |
def sort_array(arr):
"""
In this Kata, you have to sort an array of non-negative integers according to
number of ones in their binary representation in ascending order.
For similar number of ones, sort based on decimal value.
It must be implemented like this:
>>> sort_array([1, 5, 2, 3, 4]) ==... | false | minicpm5-2b-q8-bench-rp105 | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/051 | HumanEval/47 | median |
def median(l: list):
"""Return median of elements in the list l.
>>> median([3, 1, 2, 4, 5])
3
>>> median([-10, 4, 6, 1000, 10, 20])
15.0
"""
| def median(l: list):
"""Return median of elements in the list l.
>>> median([3, 1, 2, 4, 5])
3
>>> median([-10, 4, 6, 1000, 10, 20])
15.0
"""
sorted_l = sorted(l)
n = len(sorted_l)
if n % 2 == 1:
return sorted_l[n // 2]
else:
return (sorted_l[n // 2 - 1] + sorted_... | true | granite4.2-3b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/052 | HumanEval/10 | make_palindrome |
def is_palindrome(string: str) -> bool:
""" Test if given string is a palindrome """
return string == string[::-1]
def make_palindrome(string: str) -> str:
""" Find the shortest palindrome that begins with a supplied string.
Algorithm idea is simple:
- Find the longest postfix of supplied string... | def make_palindrome(string: str) -> str:
n = len(string)
max_len = 0
for i in range(1, n + 1):
if string.endswith(string[:i][::-1]):
max_len = i
return string + string[:n - max_len][::-1] | false | lfm2.5-8b-a1b-dspark | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/053 | HumanEval/80 | is_happy |
def is_happy(s):
"""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) => ... |
def is_happy(s):
"""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) => ... | true | lfm2.5-2.6b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/054 | HumanEval/101 | words_string |
def words_string(s):
"""
You will be given a string of words separated by commas or spaces. Your task is
to split the string into words and return an array of the words.
For example:
words_string("Hi, my name is John") == ["Hi", "my", "name", "is", "John"]
words_string("One, two, three, fo... |
def words_string(s):
"""
You will be given a string of words separated by commas or spaces. Your task is
to split the string into words and return an array of the words.
For example:
words_string("Hi, my name is John") == ["Hi", "my", "name", "is", "John"]
words_string("One, two, three, fo... | false | gemma4-e4b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/055 | HumanEval/93 | encode |
def encode(message):
"""
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:
>>>... | def encode(message):
vowels = 'aeiouAEIOU'
result = ''
for char in message:
if char in vowels:
if char.islower():
new_char = chr(ord('a') + (ord(char) - ord('a') + 2) % 26).upper()
else:
new_char = chr(ord('A') + (ord(char) - ord('A') + 2) % 26... | true | ornith-35b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/056 | HumanEval/41 | car_race_collision |
def car_race_collision(n: int):
"""
Imagine a road that's a perfectly straight infinitely long line.
n cars are driving left to right; simultaneously, a different set of n cars
are driving right to left. The two sets of cars start out being very far from
each other. All cars move in the same s... | def car_race_collision(n: int):
return 2 * n - 1 | false | lfm2.5-8b-a1b-dspark | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/057 | HumanEval/115 | max_fill | import math
def max_fill(grid, capacity):
"""
You are given a rectangular grid of wells. Each row represents a single well,
and each 1 in a row represents a single unit of water.
Each well has a corresponding bucket that can be used to extract water from it,
and all buckets have the same capacity.... | import math
def max_fill(grid, capacity):
"""
You are given a rectangular grid of wells. Each row represents a single well,
and each 1 in a row represents a single unit of water.
Each well has a corresponding bucket that can be used to extract water from it,
and all buckets have the same capacity.... | true | minicpm5-2b-q8-bench-rp105 | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/058 | HumanEval/108 | count_nums |
def count_nums(arr):
"""
Write a function count_nums which takes an array of integers and returns
the number of elements which has a sum of digits > 0.
If a number is negative, then its first signed digit will be negative:
e.g. -123 has signed digits -1, 2, and 3.
>>> count_nums([]) == 0
>>... | def count_nums(arr):
def sum_of_digits(n):
if n == 0:
return 0
sign = -1 if n < 0 else 1
n_abs = abs(n)
total = 0
while n_abs > 0:
digit = n_abs % 10
total += sign * digit
n_abs //= 10
return total
count = 0
for... | false | granite4.2-3b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/059 | HumanEval/160 | do_algebra |
def do_algebra(operator, operand):
"""
Given two lists operator, and operand. The first list has basic algebra operations, and
the second list is a list of integers. Use the two given lists to build the algebric
expression and return the evaluation of this expression.
The basic algebra operation... | def do_algebra(operator, operand):
expr = str(operand[0])
for op, val in zip(operator, operand[1:]):
expr += f' {op} {val}'
return eval(expr) | true | lfm2.5-8b-a1b-control | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/060 | HumanEval/145 | order_by_points |
def order_by_points(nums):
"""
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 original list.
For example:
>>> order_by_poi... | def order_by_points(nums):
def digit_sum(n):
return sum(int(d) for d in str(abs(n)))
indexed = [(digit_sum(num), i, num) for i, num in enumerate(nums)]
indexed.sort(key=lambda x: (x[0], x[1]))
return [num for _, _, num in indexed] | false | granite4.2-3b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/061 | HumanEval/12 | longest | from typing import List, Optional
def longest(strings: List[str]) -> Optional[str]:
""" Out of list of strings, return the longest one. Return the first one in case of multiple
strings of the same length. Return None in case the input list is empty.
>>> longest([])
>>> longest(['a', 'b', 'c'])
'a... | from typing import List, Optional
def longest(strings: List[str]) -> Optional[str]:
""" Out of list of strings, return the longest one. Return the first one in case of multiple
strings of the same length. Return None in case the input list is empty.
>>> longest([])
>>> longest(['a', 'b', 'c'])
'a... | true | qwen3.8-35b-a3b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/062 | HumanEval/83 | starts_one_ends |
def starts_one_ends(n):
"""
Given a positive integer n, return the count of the numbers of n-digit
positive integers that start or end with 1.
"""
| def starts_one_ends(n):
if n == 1:
return 1
return 2 * (10 ** (n - 1)) - 1 | false | qwen3.8-27b-mtp-nothink | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/063 | HumanEval/126 | is_sorted |
def is_sorted(lst):
'''
Given a list of numbers, return whether or not they are sorted
in ascending order. If list has more than 1 duplicate of the same
number, return False. Assume no negative numbers and only integers.
Examples
is_sorted([5]) ➞ True
is_sorted([1, 2, 3, 4, 5]) ➞ True
... |
def is_sorted(lst):
'''
Given a list of numbers, return whether or not they are sorted
in ascending order. If list has more than 1 duplicate of the same
number, return False. Assume no negative numbers and only integers.
Examples
is_sorted([5]) ➞ True
is_sorted([1, 2, 3, 4, 5]) ➞ True
... | true | lfm2.5-2.6b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/064 | HumanEval/142 | sum_squares |
def sum_squares(lst):
""""
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 multiple of 3. The function will not
change the e... | def sum_squares(lst):
total = 0
for index, value in enumerate(lst):
if index % 3 == 0:
total += value ** 2
elif index % 4 == 0 and index % 3 != 0:
total += value ** 3
return total | false | lfm2.5-1.2b-instruct | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/065 | HumanEval/156 | int_to_mini_roman |
def int_to_mini_roman(number):
"""
Given a positive integer, obtain its roman numeral equivalent as a string,
and return it in lowercase.
Restrictions: 1 <= num <= 1000
Examples:
>>> int_to_mini_roman(19) == 'xix'
>>> int_to_mini_roman(152) == 'clii'
>>> int_to_mini_roman(426) == 'cdxx... | def int_to_mini_roman(number):
mapping = {
1000: 'm', 900: 'cm', 500: 'd', 400: 'cd', 100: 'c', 90: 'xc', 50: 'l', 40: 'xl', 10: 'x', 9: 'ix', 5: 'v', 4: 'iv', 1: 'i'
}
result = ""
for value in sorted(mapping.keys(), reverse=True):
while number >= value:
result += mapping[val... | true | gemma4-e4b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/066 | HumanEval/97 | multiply |
def multiply(a, b):
"""Complete the function that takes two integers and returns
the product of their unit digits.
Assume the input is always valid.
Examples:
multiply(148, 412) should return 16.
multiply(19, 28) should return 72.
multiply(2020, 1851) should return 0.
multiply(14,-15) ... |
def multiply(a, b):
"""Complete the function that takes two integers and returns
the product of their unit digits.
Assume the input is always valid.
Examples:
multiply(148, 412) should return 16.
multiply(19, 28) should return 72.
multiply(2020, 1851) should return 0.
multiply(14,-15) ... | false | gemma4-e4b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/067 | HumanEval/59 | largest_prime_factor |
def largest_prime_factor(n: int):
"""Return the largest prime factor of n. Assume n > 1 and is not a prime.
>>> largest_prime_factor(13195)
29
>>> largest_prime_factor(2048)
2
"""
| def largest_prime_factor(n: int):
# Initialize the largest factor found so far
max_factor = None
# Check divisibility by 2 first to handle even numbers
while n % 2 == 0:
max_factor = 2
n //= 2
# Now check odd factors starting from 3
factor = 3
while factor * factor ... | true | lfm2.5-2.6b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/068 | HumanEval/101 | words_string |
def words_string(s):
"""
You will be given a string of words separated by commas or spaces. Your task is
to split the string into words and return an array of the words.
For example:
words_string("Hi, my name is John") == ["Hi", "my", "name", "is", "John"]
words_string("One, two, three, fo... | def words_string(s):
import re
return re.split(r'[,\s]+', s) | false | lfm2.5-8b-a1b-control | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/069 | HumanEval/77 | iscube |
def iscube(a):
'''
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) ==> ... |
def iscube(a):
'''
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 | gemma4-e2b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/070 | HumanEval/130 | tri |
def tri(n):
"""Everyone knows Fibonacci sequence, it was studied deeply by mathematicians in
the last couple centuries. However, what people don't know is Tribonacci sequence.
Tribonacci sequence is defined by the recurrence:
tri(1) = 3
tri(n) = 1 + n / 2, if n is even.
tri(n) = tri(n - 1) + ... |
def tri(n):
"""Everyone knows Fibonacci sequence, it was studied deeply by mathematicians in
the last couple centuries. However, what people don't know is Tribonacci sequence.
Tribonacci sequence is defined by the recurrence:
tri(1) = 3
tri(n) = 1 + n / 2, if n is even.
tri(n) = tri(n - 1) + ... | false | gemma4-e4b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/071 | HumanEval/114 | minSubArraySum |
def minSubArraySum(nums):
"""
Given an array of integers nums, find the minimum sum of any non-empty sub-array
of nums.
Example
minSubArraySum([2, 3, 4, 1, 2, 4]) == 1
minSubArraySum([-1, -2, -3]) == -6
"""
| def minSubArraySum(nums):
current_min = nums[0]
global_min = nums[0]
for num in nums[1:]:
current_min = min(num, current_min + num)
global_min = min(global_min, current_min)
return global_min | true | lfm2.5-1.2b-instruct | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/072 | HumanEval/26 | remove_duplicates | from typing import List
def remove_duplicates(numbers: List[int]) -> List[int]:
""" From a list of integers, remove all elements that occur more than once.
Keep order of elements left the same as in the input.
>>> remove_duplicates([1, 2, 3, 2, 4])
[1, 3, 4]
"""
| from typing import List
def remove_duplicates(numbers: List[int]) -> List[int]:
counts = Counter(numbers)
return [x for x in numbers if counts[x] == 1] | false | lfm2.5-8b-a1b-control | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/073 | HumanEval/108 | count_nums |
def count_nums(arr):
"""
Write a function count_nums which takes an array of integers and returns
the number of elements which has a sum of digits > 0.
If a number is negative, then its first signed digit will be negative:
e.g. -123 has signed digits -1, 2, and 3.
>>> count_nums([]) == 0
>>... | def count_nums(arr):
def digit_sum(n):
total = 0
sign = 1 if n >= 0 else -1
m = abs(n)
s = str(m)
for i, ch in enumerate(s):
d = int(ch)
if i == 0:
total += sign * d
else:
total += d
return total
... | true | lfm2.5-8b-a1b-control | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/074 | HumanEval/19 | sort_numbers | from typing import List
def sort_numbers(numbers: str) -> str:
""" 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 largest
>... | from typing import List
def sort_numbers(numbers: str) -> str:
return ' '.join(str(int(word)) for word in sorted(numbers.split())) | false | lfm2.5-8b-a1b-control | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/075 | HumanEval/100 | make_a_pile |
def make_a_pile(n):
"""
Given a positive integer n, you have to make a pile of n levels of stones.
The first level has n stones.
The number of stones in the next level is:
- the next odd number if n is odd.
- the next even number if n is even.
Return the number of stones in each lev... |
def make_a_pile(n):
"""
Given a positive integer n, you have to make a pile of n levels of stones.
The first level has n stones.
The number of stones in the next level is:
- the next odd number if n is odd.
- the next even number if n is even.
Return the number of stones in each lev... | true | gemma4-e4b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/076 | HumanEval/163 | generate_integers |
def generate_integers(a, b):
"""
Given two positive integers a and b, return the even digits between a
and b, in ascending order.
For example:
generate_integers(2, 8) => [2, 4, 6, 8]
generate_integers(8, 2) => [2, 4, 6, 8]
generate_integers(10, 14) => []
"""
|
def generate_integers(a, b):
"""
Given two positive integers a and b, return the even digits between a
and b, in ascending order.
For example:
generate_integers(2, 8) => [2, 4, 6, 8]
generate_integers(8, 2) => [2, 4, 6, 8]
generate_integers(10, 14) => []
"""
lo = min(a,b)
hi = ... | false | minicpm5-2b-q8-bench-rp120 | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/077 | HumanEval/162 | string_to_md5 |
def string_to_md5(text):
"""
Given a string 'text', return its md5 hash equivalent string.
If 'text' is an empty string, return None.
>>> string_to_md5('Hello world') == '3e25960a79dbc69b674cd4ec67a72c62'
"""
| def string_to_md5(text):
"""
Given a string 'text', return its md5 hash equivalent string.
If 'text' is an empty string, return None.
>>> string_to_md5('Hello world') == '3e25960a79dbc69b674cd4ec67a72c62'
"""
if not text:
return None
import hashlib
return hashlib.md5(text.encode... | true | ornith-35b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/078 | HumanEval/141 | file_name_check |
def file_name_check(file_name):
"""Create a function which takes a string representing a file's name, and returns
'Yes' if the the file's name is valid, and returns 'No' otherwise.
A file's name is considered to be valid if and only if all the following conditions
are met:
- There should not be mo... | def file_name_check(file_name):
if file_name.count('.') != 1:
return 'No'
name, ext = file_name.split('.')
if ext not in ['txt', 'exe', 'dll']:
return 'No'
if not name:
return 'No'
if not ('a' <= name[0] <= 'z' or 'A' <= name[0] <= 'Z'):
return 'No... | false | qwen3.8-27b-q4-low | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/079 | HumanEval/140 | fix_spaces |
def fix_spaces(text):
"""
Given a string text, replace all spaces in it with underscores,
and if a string has more than 2 consecutive spaces,
then replace all consecutive spaces with -
fix_spaces("Example") == "Example"
fix_spaces("Example 1") == "Example_1"
fix_spaces(" Example 2")... |
def fix_spaces(text):
"""
Given a string text, replace all spaces in it with underscores,
and if a string has more than 2 consecutive spaces,
then replace all consecutive spaces with -
fix_spaces("Example") == "Example"
fix_spaces("Example 1") == "Example_1"
fix_spaces(" Example 2")... | true | gemma4-e4b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/080 | HumanEval/0 | has_close_elements | from typing import List
def has_close_elements(numbers: List[float], threshold: float) -> bool:
""" Check if in given list of numbers, are any two numbers closer to each other than
given threshold.
>>> has_close_elements([1.0, 2.0, 3.0], 0.5)
False
>>> has_close_elements([1.0, 2.8, 3.0, 4.0, 5.0, ... | from typing import List
def has_close_elements(numbers: List[float], threshold: float) -> bool:
numbers.sort()
for i in range(len(numbers) - 1):
if numbers[i + 1] - numbers[i] <= threshold:
return True
return False | false | granite4.2-3b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/081 | HumanEval/65 | circular_shift |
def circular_shift(x, shift):
"""Circular shift the digits of the integer x, shift the digits right by shift
and return the result as a string.
If shift > number of digits, return digits reversed.
>>> circular_shift(12, 1)
"21"
>>> circular_shift(12, 2)
"12"
"""
| def circular_shift(x, shift):
s = str(x)
if shift > len(s):
return s[::-1]
return s[-shift:] + s[:-shift] if shift else s | true | qwen3.6-35b-a3b-bench | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/082 | HumanEval/127 | intersection |
def intersection(interval1, interval2):
"""You are given two intervals,
where each interval is a pair of integers. For example, interval = (start, end) = (1, 2).
The given intervals are closed which means that the interval (start, end)
includes both start and end.
For each given interval, it is ass... |
def intersection(interval1, interval2):
"""You are given two intervals,
where each interval is a pair of integers. For example, interval = (start, end) = (1, 2).
The given intervals are closed which means that the interval (start, end)
includes both start and end.
For each given interval, it is ass... | false | gemma4-e4b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/083 | HumanEval/51 | remove_vowels |
def remove_vowels(text):
"""
remove_vowels is a function that takes string and returns string without vowels.
>>> remove_vowels('')
''
>>> remove_vowels("abcdef\nghijklm")
'bcdf\nghjklm'
>>> remove_vowels('abcdef')
'bcdf'
>>> remove_vowels('aaaaa')
''
>>> remove_vowels('aaB... | def remove_vowels(text):
vowels = 'aeiouAEIOU'
return ''.join(char for char in text if char not in vowels) | true | lfm2.5-1.2b-instruct | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/084 | HumanEval/25 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" 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 to the produc... | from typing import List
def factorize(n: int) -> List[int]:
""" 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 to the produc... | false | muse-glimmer-30b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/085 | HumanEval/54 | same_chars |
def same_chars(s0: str, s1: str):
"""
Check if two words have the same characters.
>>> same_chars('eabcdzzzz', 'dddzzzzzzzddeddabc')
True
>>> same_chars('abcd', 'dddddddabc')
True
>>> same_chars('dddddddabc', 'abcd')
True
>>> same_chars('eabcd', 'dddddddabc')
False
>>> same... | def same_chars(s0: str, s1: str):
"""Check if two words have the same characters."""
return set(s0) == set(s1) | true | minicpm5-2b-q8-bench-rp110 | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/086 | HumanEval/41 | car_race_collision |
def car_race_collision(n: int):
"""
Imagine a road that's a perfectly straight infinitely long line.
n cars are driving left to right; simultaneously, a different set of n cars
are driving right to left. The two sets of cars start out being very far from
each other. All cars move in the same s... | def car_race_collision(n: int) -> int:
return n * (n - 1) // 2 | false | lfm2.5-2.6b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/087 | HumanEval/144 | simplify |
def simplify(x, n):
"""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 the following format,
<numerator>/<denominator> where ... | def simplify(x, n):
from math import gcd
def parse_fraction(frac_str):
num_str, den_str = frac_str.split('/')
return int(num_str), int(den_str)
num_x, den_x = parse_fraction(x)
num_n, den_n = parse_fraction(n)
# Calculate the product of the fractions: (num_x/den_x) * (num_n/den_n)... | true | gemma4-e4b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/088 | HumanEval/129 | minPath |
def minPath(grid, k):
"""
Given a grid with N rows and N columns (N >= 2) and a positive integer k,
each cell of the grid contains a value. Every integer in the range [1, N * N]
inclusive appears exactly once on the cells of the grid.
You have to find the minimum path of length k in the grid. You... | def minPath(grid, k):
n = len(grid)
# Precompute all cells as (value, row, col) for quick lookup
cells = [(grid[r][c], r, c) for r in range(n) for c in range(n)]
# Map from value to (row, col)
val_to_pos = {v: (r, c) for v, r, c in cells}
# Directions: up, down, left, right
dirs = [(-1, 0),... | false | granite4.2-3b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/089 | HumanEval/19 | sort_numbers | from typing import List
def sort_numbers(numbers: str) -> str:
""" 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 largest
>... | from typing import List
def sort_numbers(numbers: str) -> str:
words = numbers.split()
mapping = {
'zero': 0,
'one': 1,
'two': 2,
'three': 3,
'four': 4,
'five': 5,
'six': 6,
'seven': 7,
'eight': 8,
'nine': 9,
}
sorted_words... | true | granite4.2-3b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/090 | HumanEval/38 | decode_cyclic |
def encode_cyclic(s: str):
"""
returns encoded string by cycling groups of three characters.
"""
# split string to groups. Each of length 3.
groups = [s[(3 * i):min((3 * i + 3), len(s))] for i in range((len(s) + 2) // 3)]
# cycle elements in each group. Unless group has fewer elements than 3.
... | def decode_cyclic(s: str):
"""
takes as input string encoded with encode_cyclic function. Returns decoded string.
"""
if not s:
return ""
decoded_chars = []
# The encoded string is formed by concatenating cyclically shifted groups of 3.
# We need to reverse the process.
... | false | gemma4-e2b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/091 | HumanEval/41 | car_race_collision |
def car_race_collision(n: int):
"""
Imagine a road that's a perfectly straight infinitely long line.
n cars are driving left to right; simultaneously, a different set of n cars
are driving right to left. The two sets of cars start out being very far from
each other. All cars move in the same s... | def car_race_collision(n: int):
"""..."""
return n * n | true | minicpm5-2b-q4-bench-rp | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/092 | HumanEval/141 | file_name_check |
def file_name_check(file_name):
"""Create a function which takes a string representing a file's name, and returns
'Yes' if the the file's name is valid, and returns 'No' otherwise.
A file's name is considered to be valid if and only if all the following conditions
are met:
- There should not be mo... | def file_name_check(file_name):
if file_name.count('.') != 1:
return 'No'
name, ext = file_name.split('.')
if not name or not ('a' <= name[0] <= 'z' or 'A' <= name[0] <= 'Z'):
return 'No'
if ext not in ['txt', 'exe', 'dll']:
return 'No'
if sum(1 for c in file_name if c.isdigi... | false | bonsai2-27b-pq2-np4 | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/093 | HumanEval/109 | move_one_ball |
def move_one_ball(arr):
"""We have an array 'arr' of N integers arr[1], arr[2], ..., arr[N].The
numbers in the array will be randomly ordered. Your task is to determine if
it is possible to get an array sorted in non-decreasing order by performing
the following operation on the given array:
Yo... |
def move_one_ball(arr):
"""We have an array 'arr' of N integers arr[1], arr[2], ..., arr[N].The
numbers in the array will be randomly ordered. Your task is to determine if
it is possible to get an array sorted in non-decreasing order by performing
the following operation on the given array:
Yo... | true | gemma4-e2b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/094 | HumanEval/144 | simplify |
def simplify(x, n):
"""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 the following format,
<numerator>/<denominator> where ... | def simplify(x, n):
def parse_fraction(fraction_str):
parts = fraction_str.split('/')
numerator = int(parts[0])
denominator = int(parts[1])
return numerator, denominator
num_x, den_x = parse_fraction(x)
num_n, den_n = parse_fraction(n)
# Calculate x * n = (num_x / den_x... | false | gemma4-e2b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/095 | HumanEval/146 | specialFilter |
def specialFilter(nums):
"""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:
specialFilter([15, -73, 14, -15]) => 1
specialFilter(... | def specialFilter(nums):
count = 0
for num in nums:
if num > 10:
s = str(abs(num))
first_digit = int(s[0])
last_digit = int(s[-1])
def is_odd(digit):
return digit % 2 != 0
if is_odd(first_digit) and is_... | true | gemma4-e4b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/096 | HumanEval/81 | numerical_letter_grade |
def numerical_letter_grade(grades):
"""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 a... | def numerical_letter_grade(grades):
result = []
for g in grades:
if g >= 4.0:
result.append('A+')
elif g > 3.7:
result.append('A')
elif g > 3.3:
result.append('A-')
elif g > 3.0:
result.append('B+')
elif g > 2.7:
... | false | lfm2.5-8b-a1b-control | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/097 | HumanEval/121 | solution |
def solution(lst):
"""Given a non-empty list of integers, return the sum of all of the odd elements that are in even positions.
Examples
solution([5, 8, 7, 1]) ==> 12
solution([3, 3, 3, 3, 3]) ==> 9
solution([30, 13, 24, 321]) ==>0
"""
| def solution(lst):
total = 0
for i in range(0, len(lst), 2):
if lst[i] % 2 == 1:
total += lst[i]
return total | true | granite4.2-3b | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/098 | HumanEval/132 | is_nested |
def is_nested(string):
'''
Create a function that takes a string as input which contains only square brackets.
The function should return True if and only if there is a valid subsequence of brackets
where at least one bracket in the subsequence is nested.
is_nested('[[]]') ➞ True
is_nested('[... | def is_nested(string):
open_indices = [i for i, ch in enumerate(string) if ch == '[']
if len(open_indices) < 2:
return False
second_open_idx = open_indices[1]
closes_after = sum(1 for idx in range(second_open_idx + 1, len(string)) if string[idx] == ']')
return closes_after >= 2 | false | minicpm5-2b-q8-bench-rp115 | v1 | evalplus==0.3.1 base+plus, fast_check |
code-verifier/099 | HumanEval/90 | next_smallest |
def next_smallest(lst):
"""
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([]) == None
... |
def next_smallest(lst):
"""
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([]) == None
... | true | gemma4-e4b | v1 | evalplus==0.3.1 base+plus, fast_check |
HumanEval+ Verifier
Does this solution pass its tests? 500 model-written solutions to HumanEval+ problems, each labelled by running it against the full HumanEval+ test suite. 250 pass and 250 fail.
It measures the verifier in an agent loop: a model that reads a problem and a candidate solution and decides whether to accept it, without running it.
Fields
| Field | Description |
|---|---|
id |
Row id, code-verifier/000 to code-verifier/499 |
task_id |
HumanEval+ problem, e.g. HumanEval/144 |
entry_point |
Function under test |
prompt |
The problem: signature and docstring |
solution |
The full program that was executed |
passes |
Label. true if it passed the full HumanEval+ test suite |
model |
The model that wrote the solution |
version |
Dataset version (v1) |
evaluator |
Evaluator that produced the label |
How it was built
- Solutions come from BenchKit HumanEval+ runs of 31 open models in 15 families (Gemma 4, Granite 4.2, LFM2.5, Qwen 3.6/3.8, MiniCPM 5 and others). Identical programs are kept once, credited to one of the models that wrote them.
- Every label comes from executing the program with
evalplus==0.3.1, never from a stored score. A failure that passes under generous time limits failed only on speed and was dropped. So was code that does not compile. - Each model family contributes as many passing rows as failing ones, and passing rows come from the same problems as failing ones where possible. That way neither the problem nor the coding style gives the label away.
- Subtle failures were preferred over obvious ones when choosing failing rows.
- Rows alternate fail and pass, so any contiguous slice is balanced.
The build script, build_code_verifier.py, is in this
repo. It runs from a BenchKit
checkout, which also ships this dataset as the code-verifier benchmark.
Usage
from datasets import load_dataset
ds = load_dataset("DogukanUrker/humaneval-plus-verifier", split="test")
row = ds[0]
question = f"{row['prompt']}\n\nCandidate solution:\n{row['solution']}"
Report accuracy alongside per-class accuracy on passing and failing rows, since a verifier that always says "yes" scores 50%.
License and credits
Released under Apache-2.0. The problems and tests are from HumanEval+ / EvalPlus (Apache-2.0), which extends OpenAI's HumanEval (MIT). The solutions were generated by the models named in each row.
- Downloads last month
- 37