Dataset Viewer
Auto-converted to Parquet Duplicate
task_id
stringlengths
8
10
code
stringlengths
263
3.91k
entry_point
stringlengths
1
24
test
stringlengths
1.48k
19.6k
inputs
listlengths
2
26
outputs
listlengths
0
26
DREval/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, ...
has_close_elements
null
[ "([1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.3,)", "([1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.05,)", "([1.0, 2.0, 5.9, 4.0, 5.0], 0.95,)", "([1.0, 2.0, 5.9, 4.0, 5.0], 0.8,)", "([1.0, 2.0, 3.0, 4.0, 5.0, 2.0], 0.1,)", "([1.1, 2.2, 3.1, 4.1, 5.1], 1.0,)", "([1.1, 2.2, 3.1, 4.1, 5.1], 0.5,)" ]
[ "True", "False", "True", "False", "True", "True", "False" ]
DREval/1
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...
separate_paren_groups
null
[ "('(()()) ((())) () ((())()())',)", "('() (()) ((())) (((())))',)", "('(()(())((())))',)", "('( ) (( )) (( )( ))',)" ]
[ "['(()())', '((()))', '()', '((())()())']", "['()', '(())', '((()))', '(((())))']", "['(()(())((())))']", "['()', '(())', '(()())']" ]
DREval/2
from typing import List def below_zero(operations: List[int]) -> bool: """ 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 Tru...
below_zero
null
[ "([],)", "([1, 2, -3, 1, 2, -3],)", "([1, 2, -4, 5, 6],)", "([1, -1, 2, -2, 5, -5, 4, -4],)", "([1, -1, 2, -2, 5, -5, 4, -5],)", "([1, -2, 2, -2, 5, -5, 4, -4],)" ]
[ "False", "False", "True", "False", "True", "True" ]
DREval/3
from typing import List def intersperse(numbers: List[int], delimeter: int) -> List[int]: """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' >>> intersperse([], 4) [] >>> intersperse([1, 2, 3], 4) [1, 4, 2, 4, 3] """ if not numbers: retur...
intersperse
null
[ "([], 7,)", "([5, 6, 3, 2], 8,)", "([2, 2, 2], 2,)" ]
[ "[]", "[5, 8, 6, 8, 3, 8, 2]", "[2, 2, 2, 2, 2]" ]
DREval/4
from typing import List def parse_nested_parens(paren_string: str) -> List[int]: """ 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 n...
parse_nested_parens
null
[ "('(()()) ((())) () ((())()())',)", "('() (()) ((())) (((())))',)", "('(()(())((())))',)" ]
[ "[2, 3, 1, 3]", "[1, 2, 3, 4]", "[4]" ]
DREval/5
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) ...
sum_product
null
[ "([],)", "([1, 1, 1],)", "([100, 0],)", "([3, 5, 7],)", "([10],)" ]
[ "(0, 1)", "(3, 1)", "(100, 0)", "(3 + 5 + 7, 3 * 5 * 7)", "(10, 10)" ]
DREval/6
from typing import List, Tuple def rolling_max(numbers: List[int]) -> List[int]: """ 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] """ running_max = None resul...
rolling_max
null
[ "([],)", "([1, 2, 3, 4],)", "([4, 3, 2, 1],)", "([3, 2, 3, 100, 3],)" ]
[ "[]", "[1, 2, 3, 4]", "[4, 4, 4, 4]", "[3, 3, 3, 100, 100]" ]
DREval/7
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...
make_palindrome
null
[ "('',)", "('x',)", "('xyz',)", "('xyx',)", "('jerry',)" ]
[ "''", "'x'", "'xyzyx'", "'xyx'", "'jerryrrej'" ]
DREval/8
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...
longest
null
[ "([],)", "(['x', 'y', 'z'],)", "(['x', 'yyy', 'zzzz', 'www', 'kkkk', 'abc'],)" ]
[ "None", "'x'", "'zzzz'" ]
DREval/9
from typing import List def all_prefixes(string: str) -> List[str]: """ Return list of all prefixes from shortest to longest of the input string >>> all_prefixes('abc') ['a', 'ab', 'abc'] """ result = [] for i in range(len(string)): result.append(string[:i+1]) return result
all_prefixes
null
[ "('',)", "('asdfgh',)", "('WWW',)" ]
[ "[]", "['a', 'as', 'asd', 'asdf', 'asdfg', 'asdfgh']", "['W', 'WW', 'WWW']" ]
DREval/10
def how_many_times(string: str, substring: str) -> int: """ Find how many times a given substring can be found in the original string. Count overlaping cases. >>> how_many_times('', 'a') 0 >>> how_many_times('aaa', 'a') 3 >>> how_many_times('aaaa', 'aa') 3 """ times = 0 for i ...
how_many_times
null
[ "('', 'x',)", "('xyxyxyx', 'x',)", "('cacacacac', 'cac',)", "('john doe', 'john',)" ]
[ "0", "4", "4", "1" ]
DREval/11
from typing import List, Tuple def find_closest_elements(numbers: List[float]) -> Tuple[float, float]: """ 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). >>> find_closest_elements([...
find_closest_elements
null
[ "([1.0, 2.0, 3.9, 4.0, 5.0, 2.2],)", "([1.0, 2.0, 5.9, 4.0, 5.0],)", "([1.0, 2.0, 3.0, 4.0, 5.0, 2.2],)", "([1.0, 2.0, 3.0, 4.0, 5.0, 2.0],)", "([1.1, 2.2, 3.1, 4.1, 5.1],)" ]
[ "(3.9, 4.0)", "(5.0, 5.9)", "(2.0, 2.2)", "(2.0, 2.0)", "(2.2, 3.1)" ]
DREval/12
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...
factorize
null
[ "(2,)", "(4,)", "(8,)", "(3 * 19,)", "(3 * 19 * 3 * 19,)", "(3 * 19 * 3 * 19 * 3 * 19,)", "(3 * 19 * 19 * 19,)", "(3 * 2 * 3,)" ]
[ "[2]", "[2, 2]", "[2, 2, 2]", "[3, 19]", "[3, 3, 19, 19]", "[3, 3, 3, 19, 19, 19]", "[3, 19, 19, 19]", "[2, 3, 3]" ]
DREval/13
def max_element(l: list): """Return maximum element in the list. >>> max_element([1, 2, 3]) 3 >>> max_element([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) 123 """ m = l[0] for e in l: if e > m: m = e return m
max_element
null
[ "([1, 2, 3],)", "([5, 3, -5, 2, -3, 3, 9, 0, 124, 1, -10],)" ]
[ "3", "124" ]
DREval/14
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 """ ns = [] for i in range(n): if i % 11 == 0 or i % 13 == 0: ns.app...
fizz_buzz
null
[ "(50,)", "(78,)", "(79,)", "(100,)", "(200,)", "(4000,)" ]
[ "0", "2", "3", "3", "6", "192" ]
DREval/15
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]) ...
sort_even
null
[ "([1, 2, 3],)", "([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10],)", "([5, 8, -12, 4, 23, 2, 3, 11, 12, -10],)" ]
[ "[1, 2, 3]", "[-10, 3, -5, 2, -3, 3, 5, 0, 9, 1, 123]", "[-12, 8, 3, 4, 5, 2, 12, 11, 23, -10]" ]
DREval/16
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: ...
prime_fib
null
[ "(1,)", "(2,)", "(3,)", "(4,)", "(5,)", "(6,)", "(7,)", "(8,)", "(9,)", "(10,)" ]
[ "2", "3", "5", "13", "89", "233", "1597", "28657", "514229", "433494437" ]
DREval/17
def change_base(x: int, base: int): """Change numerical base of input number x to base. return string representation after the conversion. base numbers are less than 10. >>> change_base(8, 3) '22' >>> change_base(8, 2) '1000' >>> change_base(7, 2) '111' """ ret = "" whi...
change_base
null
[ "(8, 3,)", "(9, 3,)", "(234, 2,)", "(16, 2,)", "(8, 2,)", "(7, 2,)" ]
[ "'22'", "'100'", "'11101010'", "'10000'", "'1000'", "'111'" ]
DREval/18
def fib4(n: int): """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-4). Please write a function to efficiently compute the n-th el...
fib4
null
[ "(5,)", "(8,)", "(10,)", "(12,)" ]
[ "4", "28", "104", "386" ]
DREval/19
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 """ l = sorted(l) if len(l) % 2 == 1: return l[len(l) // 2] else: return (l[len(l) // 2 - 1] + l[len(l) // 2]) / 2.0
median
null
[ "([3, 1, 2, 4, 5],)", "([-10, 4, 6, 1000, 10, 20],)", "([5],)", "([6, 5],)", "([8, 1, 3, 9, 9, 2, 7],)" ]
[ "3", "8.0", "5", "5.5", "7" ]
DREval/20
def modp(n: int, p: int): """Return 2^n modulo p (be aware of numerics). >>> modp(3, 5) 3 >>> modp(1101, 101) 2 >>> modp(0, 101) 1 >>> modp(3, 11) 8 >>> modp(100, 101) 1 """ ret = 1 for i in range(n): ret = (2 * ret) % p return ret
modp
null
[ "(3, 5,)", "(1101, 101,)", "(0, 101,)", "(3, 11,)", "(100, 101,)", "(30, 5,)", "(31, 5,)" ]
[ "3", "2", "1", "8", "1", "4", "3" ]
DREval/21
def correct_bracketing(brackets: str): """ brackets is a string of "<" and ">". return True if every opening bracket has a corresponding closing bracket. >>> correct_bracketing("<") False >>> correct_bracketing("<>") True >>> correct_bracketing("<<><>>") True >>> correct_bracketin...
correct_bracketing
null
[ "('<>',)", "('<<><>>',)", "('<><><<><>><>',)", "('<><><<<><><>><>><<><><<>>>',)", "('<<<><>>>>',)", "('><<>',)", "('<',)", "('<<<<',)", "('>',)", "('<<>',)", "('<><><<><>><>><<>',)", "('<><><<><>><>>><>',)" ]
[ "True", "True", "True", "True", "False", "False", "False", "False", "False", "False", "False", "False" ]
DREval/22
def common(l1: list, l2: list): """Return sorted unique common elements for two lists. >>> common([1, 4, 3, 34, 653, 2, 5], [5, 7, 1, 5, 9, 653, 121]) [1, 5, 653] >>> common([5, 3, 2, 8], [3, 2]) [2, 3] """ ret = set() for e1 in l1: for e2 in l2: if e1 == e2: ...
common
null
[ "([1, 4, 3, 34, 653, 2, 5], [5, 7, 1, 5, 9, 653, 121],)", "([5, 3, 2, 8], [3, 2],)", "([4, 3, 2, 8], [3, 2, 4],)", "([4, 3, 2, 8], [],)" ]
[ "[1, 5, 653]", "[2, 3]", "[2, 3, 4]", "[]" ]
DREval/23
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 is_prime(k): if k < 2: return False for i in range(2, k - 1): if k...
largest_prime_factor
null
[ "(15,)", "(27,)", "(63,)", "(330,)", "(13195,)" ]
[ "5", "3", "7", "11", "29" ]
DREval/24
def correct_bracketing(brackets: str): """ brackets is a string of "(" and ")". return True if every opening bracket has a corresponding closing bracket. >>> correct_bracketing("(") False >>> correct_bracketing("()") True >>> correct_bracketing("(()())") True >>> correct_bracketin...
correct_bracketing
null
[ "('()',)", "('(()())',)", "('()()(()())()',)", "('()()((()()())())(()()(()))',)", "('((()())))',)", "(')(()',)", "('(',)", "('((((',)", "(')',)", "('(()',)", "('()()(()())())(()',)", "('()()(()())()))()',)" ]
[ "True", "True", "True", "True", "False", "False", "False", "False", "False", "False", "False", "False" ]
DREval/25
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...
vowels_count
null
[ "('abcde',)", "('Alone',)", "('key',)", "('bye',)", "('keY',)", "('bYe',)", "('ACEDY',)" ]
[ "2", "3", "2", "1", "2", "1", "3" ]
DREval/26
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) if sh...
circular_shift
null
[ "(100, 2,)", "(12, 2,)", "(97, 8,)", "(12, 1,)", "(11, 101,)" ]
[ "'001'", "'12'", "'79'", "'21'", "'11'" ]
DREval/27
def fruit_distribution(s,n): """ 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 total number of the oranges and apples a...
fruit_distribution
null
[ "('5 apples and 6 oranges', 19,)", "('5 apples and 6 oranges', 21,)", "('0 apples and 1 oranges', 3,)", "('1 apples and 0 oranges', 3,)", "('2 apples and 3 oranges', 100,)", "('2 apples and 3 oranges', 5,)", "('1 apples and 100 oranges', 120,)" ]
[ "8", "10", "2", "2", "95", "0", "19" ]
DREval/28
def pluck(arr): """ "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 with the same smallest even value are found return the no...
pluck
null
[ "([4, 2, 3],)", "([1, 2, 3],)", "([],)", "([5, 0, 3, 0, 4, 2],)", "([1, 2, 3, 0, 5, 3],)", "([5, 4, 8, 4, 8],)", "([7, 6, 7, 1],)", "([7, 9, 7, 1],)" ]
[ "[2, 1]", "[2, 1]", "[]", "[0, 1]", "[0, 3]", "[4, 1]", "[6, 1]", "[]" ]
DREval/29
def search(lst): ''' 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 number of times it appears in the list. If no such a va...
search
null
[ "([5, 5, 5, 5, 1],)", "([4, 1, 4, 1, 4, 4],)", "([3, 3],)", "([8, 8, 8, 8, 8, 8, 8, 8],)", "([2, 3, 3, 2, 2],)", "([2, 7, 8, 8, 4, 8, 7, 3, 9, 6, 5, 10, 4, 3, 6, 7, 1, 7, 4, 10, 8, 1],)", "([3, 2, 8, 2],)", "([6, 7, 1, 8, 8, 10, 5, 8, 5, 3, 10],)", "([8, 8, 3, 6, 5, 6, 4],)", "([6, 9, 6, 7, 1, 4, ...
[ "1", "4", "-1", "8", "2", "1", "2", "1", "-1", "1", "1", "5", "1", "4", "2", "1", "4", "4", "2", "-1", "-1", "2", "1", "1", "-1" ]
DREval/30
def strange_sort_list(lst): ''' Given list of integers, return list in strange order. Strange sorting, is when you start with the minimum value, then maximum of the remaining integers, then minimum and so on. Examples: strange_sort_list([1, 2, 3, 4]) == [1, 4, 2, 3] strange_sort_list([5, 5...
strange_sort_list
null
[ "([1, 2, 3, 4],)", "([5, 6, 7, 8, 9],)", "([1, 2, 3, 4, 5],)", "([5, 6, 7, 8, 9, 1],)", "([5, 5, 5, 5],)", "([],)", "([1, 2, 3, 4, 5, 6, 7, 8],)", "([0, 2, 2, 2, 5, 5, -5, -5],)", "([111111],)" ]
[ "[1, 4, 2, 3]", "[5, 9, 6, 8, 7]", "[1, 5, 2, 4, 3]", "[1, 9, 5, 8, 6, 7]", "[5, 5, 5, 5]", "[]", "[1, 8, 2, 7, 3, 6, 4, 5]", "[-5, 5, -5, 5, 0, 2, 2, 2]", "[111111]" ]
DREval/31
def will_it_fly(q,w): ''' 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. Example: will_it_fly([1, 2], 5) ➞ False ...
will_it_fly
null
[ "([3, 2, 3], 9,)", "([1, 2], 5,)", "([3], 5,)", "([3, 2, 3], 1,)", "([1, 2, 3], 6,)", "([5], 5,)" ]
[ "True", "False", "True", "False", "False", "True" ]
DREval/32
def smallest_change(arr): """ 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 change one element to any other element. For...
smallest_change
null
[ "([1, 2, 3, 5, 4, 7, 9, 6],)", "([1, 2, 3, 4, 3, 2, 2],)", "([1, 4, 2],)", "([1, 4, 4, 2],)", "([1, 2, 3, 2, 1],)", "([3, 1, 1, 3],)", "([1],)", "([0, 1],)" ]
[ "4", "1", "1", "1", "0", "0", "0", "1" ]
DREval/33
def total_match(lst1, lst2): ''' 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 list. Examples total_match([], [])...
total_match
null
[ "([], [],)", "(['hi', 'admin'], ['hi', 'hi'],)", "(['hi', 'admin'], ['hi', 'hi', 'admin', 'project'],)", "(['4'], ['1', '2', '3', '4', '5'],)", "(['hi', 'admin'], ['hI', 'Hi'],)", "(['hi', 'admin'], ['hI', 'hi', 'hi'],)", "(['hi', 'admin'], ['hI', 'hi', 'hii'],)", "([], ['this'],)", "(['this'], [],)...
[ "[]", "['hi', 'hi']", "['hi', 'admin']", "['4']", "['hI', 'Hi']", "['hI', 'hi', 'hi']", "['hi', 'admin']", "[]", "[]" ]
DREval/34
def is_simple_power(x, n): """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_...
is_simple_power
null
[ "(16, 2,)", "(143214, 16,)", "(4, 2,)", "(9, 3,)", "(16, 4,)", "(24, 2,)", "(128, 4,)", "(12, 6,)", "(1, 1,)", "(1, 12,)" ]
[ "True", "False", "True", "True", "True", "False", "False", "False", "True", "True" ]
DREval/35
def hex_key(num): """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). Hexadecima...
hex_key
null
[ "('AB',)", "('1077E',)", "('ABED1A33',)", "('2020',)", "('123456789ABCDEF0',)", "('112233445566778899AABBCCDDEEFF00',)", "([],)" ]
[ "1", "2", "4", "2", "6", "12", "0" ]
DREval/36
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...
numerical_letter_grade
null
[ "([4.0, 3, 1.7, 2, 3.5],)", "([1.2],)", "([0.5],)", "([0.0],)", "([1, 0.3, 1.5, 2.8, 3.3],)", "([0, 0.7],)" ]
[ "['A+', 'B', 'C-', 'C', 'A-']", "['D+']", "['D-']", "['E']", "['D', 'D-', 'C-', 'B', 'B+']", "['E', 'D-']" ]
DREval/37
def prime_length(string): """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 """ l =...
prime_length
null
[ "('Hello',)", "('abcdcba',)", "('kittens',)", "('orange',)", "('wow',)", "('world',)", "('MadaM',)", "('Wow',)", "('',)", "('HI',)", "('go',)", "('gogo',)", "('aaaaaaaaaaaaaaa',)", "('Madam',)", "('M',)", "('0',)" ]
[ "True", "True", "True", "False", "True", "True", "True", "True", "False", "True", "True", "False", "False", "True", "False", "False" ]
DREval/38
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' ...
encrypt
null
[ "('hi',)", "('asdfghjkl',)", "('gf',)", "('et',)", "('faewfawefaewg',)", "('hellomyfriend',)", "('dxzdlmnilfuhmilufhlihufnmlimnufhlimnufhfucufh',)", "('a',)" ]
[ "'lm'", "'ewhjklnop'", "'kj'", "'ix'", "'jeiajeaijeiak'", "'lippsqcjvmirh'", "'hbdhpqrmpjylqmpyjlpmlyjrqpmqryjlpmqryjljygyjl'", "'e'" ]
DREval/39
def skjkasdkd(lst): """You are given a list of integers. You need to find the largest prime value and return the sum of its digits. Examples: For lst = [0,3,2,1,3,5,7,4,5,5,5,2,181,32,4,32,3,2,32,324,4,3] the output should be 10 For lst = [1,0,1,8,2,4597,2,1,3,40,1,2,1,2,4,2,5,1] the output shoul...
skjkasdkd
null
[ "([0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3],)", "([1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1],)", "([1, 3, 1, 32, 5107, 34, 83278, 109, 163, 23, 2323, 32, 30, 1, 9, 3],)", "([0, 724, 32, 71, 99, 32, 6, 0, 5, 91, 83, 0, 5, 6],)", "([0, 81, 12, 3, 1, 21],)", "(...
[ "10", "25", "13", "11", "3", "7", "19", "19", "10" ]
DREval/40
def count_up_to(n): """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]...
count_up_to
null
[ "(5,)", "(6,)", "(7,)", "(10,)", "(0,)", "(22,)", "(1,)", "(18,)", "(47,)", "(101,)" ]
[ "[2, 3]", "[2, 3, 5]", "[2, 3, 5]", "[2, 3, 5, 7]", "[]", "[2, 3, 5, 7, 11, 13, 17, 19]", "[]", "[2, 3, 5, 7, 11, 13, 17]", "[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43]", "[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]" ]
DREval/41
def count_upper(s): """ Given a string s, count the number of uppercase vowels in even indices. For example: count_upper('aBCdEf') returns 1 count_upper('abcdefg') returns 0 count_upper('dBBE') returns 0 """ count = 0 for i in range(0,len(s),2): if s[i] in "AEIOU": ...
count_upper
null
[ "('aBCdEf',)", "('abcdefg',)", "('dBBE',)", "('B',)", "('U',)", "('',)", "('EEEE',)" ]
[ "1", "0", "0", "0", "1", "0", "2" ]
DREval/42
def closest_integer(value): ''' 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 ...
closest_integer
null
[ "('10',)", "('14.5',)", "('-15.5',)", "('15.3',)", "('0',)" ]
[ "10", "15", "-16", "15", "0" ]
DREval/43
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...
words_string
null
[ "('Hi, my name is John',)", "('One, two, three, four, five, six',)", "('Hi, my name',)", "('One,, two, three, four, five, six,',)", "('',)", "('ahmed , gamal',)" ]
[ "['Hi', 'my', 'name', 'is', 'John']", "['One', 'two', 'three', 'four', 'five', 'six']", "['Hi', 'my', 'name']", "['One', 'two', 'three', 'four', 'five', 'six']", "[]", "['ahmed', 'gamal']" ]
DREval/44
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)...
rounded_avg
null
[ "(1, 5,)", "(7, 13,)", "(964, 977,)", "(996, 997,)", "(560, 851,)", "(185, 546,)", "(362, 496,)", "(350, 902,)", "(197, 233,)", "(7, 5,)", "(5, 1,)", "(5, 5,)" ]
[ "'0b11'", "'0b1010'", "'0b1111001010'", "'0b1111100100'", "'0b1011000010'", "'0b101101110'", "'0b110101101'", "'0b1001110010'", "'0b11010111'", "-1", "-1", "'0b101'" ]
DREval/45
def unique_digits(x): """Given a list of positive integers x. return a sorted list of all elements that hasn't any even digit. Note: Returned list should be sorted in increasing order. For example: >>> unique_digits([15, 33, 1422, 1]) [1, 15, 33] >>> unique_digits([152, 323, 1422, 10...
unique_digits
null
[ "([15, 33, 1422, 1],)", "([152, 323, 1422, 10],)", "([12345, 2033, 111, 151],)", "([135, 103, 31],)" ]
[ "[1, 15, 33]", "[]", "[111, 151]", "[31, 135]" ]
DREval/46
def by_length(arr): """ Given an array of integers, sort the integers that are between 1 and 9 inclusive, reverse the resulting array, and then replace each digit by its corresponding name from "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine". For example: arr = [2, 1, ...
by_length
null
[ "([2, 1, 1, 4, 5, 8, 2, 3],)", "([],)", "([1, -1, 55],)", "([1, -1, 3, 2],)", "([9, 4, 8],)" ]
[ "['Eight', 'Five', 'Four', 'Three', 'Two', 'Two', 'One', 'One']", "[]", "['One']", "['Three', 'Two', 'One']", "['Nine', 'Eight', 'Four']" ]
DREval/47
def f(n): """ Implement the function f that takes n as a parameter, and returns a list of size n, such that the value of the element at index i is the factorial of i if i is even or the sum of numbers from 1 to i otherwise. i starts from 1. the factorial of i is the multiplication of the numbers fr...
f
null
[ "(5,)", "(7,)", "(1,)", "(3,)" ]
[ "[1, 2, 6, 24, 15]", "[1, 2, 6, 24, 15, 720, 28]", "[1]", "[1, 2, 6]" ]
DREval/48
def even_odd_palindrome(n): """ Given a positive integer n, return a tuple that has the number of even and odd integer palindromes that fall within the range(1, n), inclusive. Example 1: Input: 3 Output: (1, 2) Explanation: Integer palindrome are 1, 2, 3. one of them i...
even_odd_palindrome
null
[ "(123,)", "(12,)", "(3,)", "(63,)", "(25,)", "(19,)", "(9,)", "(1,)" ]
[ "(8, 13)", "(4, 6)", "(1, 2)", "(6, 8)", "(5, 6)", "(4, 6)", "(4, 5)", "(0, 1)" ]
DREval/49
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 >>...
count_nums
null
[ "([],)", "([-1, -2, 0],)", "([1, 1, 2, -2, 3, 4, 5],)", "([1, 6, 9, -6, 0, 1, 5],)", "([1, 100, 98, -7, 1, -1],)", "([12, 23, 34, -45, -56, 0],)", "([-0, 1 ** 0],)", "([1],)" ]
[ "0", "0", "6", "5", "4", "5", "1", "1" ]
DREval/50
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...
move_one_ball
null
[ "([3, 4, 5, 1, 2],)", "([3, 5, 10, 1, 2],)", "([4, 3, 1, 2],)", "([3, 5, 4, 1, 2],)", "([],)" ]
[ "True", "True", "False", "False", "True" ]
DREval/51
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...
exchange
null
[ "([1, 2, 3, 4], [1, 2, 3, 4],)", "([1, 2, 3, 4], [1, 5, 3, 4],)", "([1, 2, 3, 4], [2, 1, 4, 3],)", "([5, 7, 3], [2, 6, 4],)", "([5, 7, 3], [2, 6, 3],)", "([3, 2, 6, 1, 8, 9], [3, 5, 5, 1, 1, 1],)", "([100, 200], [200, 200],)" ]
[ "'YES'", "'NO'", "'YES'", "'YES'", "'NO'", "'NO'", "'YES'" ]
DREval/52
def histogram(test): """Given a string representing a space separated lowercase letters, return a dictionary of the letter with the most repetition and containing the corresponding count. If several letters have the same occurrence, return all of them. Example: histogram('a b c') == {'a': 1, '...
histogram
null
[ "('a b b a',)", "('a b c a b',)", "('a b c d g',)", "('r t g',)", "('b b b b a',)", "('r t g',)", "('',)", "('a',)" ]
[ "{'a': 2, 'b': 2}", "{'a': 2, 'b': 2}", "{'a': 1, 'b': 1, 'c': 1, 'd': 1, 'g': 1}", "{'r': 1, 't': 1, 'g': 1}", "{'b': 4}", "{'r': 1, 't': 1, 'g': 1}", "{}", "{'a': 1}" ]
DREval/53
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. ...
odd_count
null
[ "(['1234567'],)", "(['3', '11111111'],)", "(['271', '137', '314'],)" ]
[ "['the number of odd elements 4n the str4ng 4 of the 4nput.']", "['the number of odd elements 1n the str1ng 1 of the 1nput.', 'the number of odd elements 8n the str8ng 8 of the 8nput.']", "['the number of odd elements 2n the str2ng 2 of the 2nput.', 'the number of odd elements 3n the str3ng 3 of the 3nput.', 't...
DREval/54
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 """ max_sum = 0 s = 0 for num in nums: s += -num if (s < 0):...
minSubArraySum
null
[ "([2, 3, 4, 1, 2, 4],)", "([-1, -2, -3],)", "([-1, -2, -3, 2, -10],)", "([-9999999999999999],)", "([0, 10, 20, 1000000],)", "([-1, -2, -3, 10, -5],)", "([100, -1, -2, -3, 10, -5],)", "([10, 11, 13, 8, 3, 4],)", "([100, -33, 32, -1, 0, -2],)", "([-10],)", "([7],)", "([1, -1],)" ]
[ "1", "-6", "-14", "-9999999999999999", "0", "-6", "-6", "3", "-33", "-10", "7", "-1" ]
DREval/55
def select_words(s, n): """Given a string s and a natural number n, you have been tasked to implement a function that returns a list of all words from string s that contain exactly n consonants, in order these words appear in the string s. If the string s is empty then the function should return an e...
select_words
null
[ "('Mary had a little lamb', 4,)", "('Mary had a little lamb', 3,)", "('simple white space', 2,)", "('Hello world', 4,)", "('Uncle sam', 3,)", "('', 4,)", "('a b c d e f', 1,)" ]
[ "['little']", "['Mary', 'lamb']", "[]", "['world']", "['Uncle']", "[]", "['b', 'c', 'd', 'f']" ]
DREval/56
def match_parens(lst): ''' You are given a list of two strings, both strings consist of open parentheses '(' or close parentheses ')' only. Your job is to check if it is possible to concatenate the two strings in some order, that the resulting string will be good. A string S is considered to be...
match_parens
null
[ "(['()(', ')'],)", "([')', ')'],)", "(['(()(())', '())())'],)", "([')())', '(()()('],)", "(['(())))', '(()())(('],)", "(['()', '())'],)", "(['(()(', '()))()'],)", "(['((((', '((())'],)", "([')(()', '(()('],)", "([')(', ')('],)", "(['(', ')'],)", "([')', '('],)" ]
[ "'Yes'", "'No'", "'No'", "'Yes'", "'Yes'", "'No'", "'Yes'", "'No'", "'No'", "'No'", "'Yes'", "'Yes'" ]
DREval/57
def get_odd_collatz(n): """ Given a positive integer n, return a sorted list that has the odd numbers in collatz sequence. The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined as follows: start with any positive integer n. Then each term is obtained from the prev...
get_odd_collatz
null
[ "(14,)", "(5,)", "(12,)", "(1,)" ]
[ "[1, 5, 7, 11, 13, 17]", "[1, 5]", "[1, 3, 5]", "[1]" ]
DREval/58
def valid_date(date): """You have to write a function which validates a given date string and returns True if the date is valid otherwise False. The date is valid if all of the following rules are satisfied: 1. The date string is not empty. 2. The number of days is not less than 1 or higher than 31...
valid_date
null
[ "('03-11-2000',)", "('15-01-2012',)", "('04-0-2040',)", "('06-04-2020',)", "('01-01-2007',)", "('03-32-2011',)", "('',)", "('04-31-3000',)", "('06-06-2005',)", "('21-31-2000',)", "('04-12-2003',)", "('04122003',)", "('20030412',)", "('2003-04',)", "('2003-04-12',)", "('04-2003',)" ]
[ "True", "False", "False", "True", "True", "False", "False", "False", "True", "False", "True", "False", "False", "False", "False", "False" ]
DREval/59
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 ...
is_sorted
null
[ "([5],)", "([1, 2, 3, 4, 5],)", "([1, 3, 2, 4, 5],)", "([1, 2, 3, 4, 5, 6],)", "([1, 2, 3, 4, 5, 6, 7],)", "([1, 3, 2, 4, 5, 6, 7],)", "([],)", "([1],)", "([3, 2, 1],)", "([1, 2, 2, 2, 3, 4],)", "([1, 2, 3, 3, 3, 4],)", "([1, 2, 2, 3, 3, 4],)", "([1, 2, 3, 4],)" ]
[ "True", "True", "False", "True", "True", "False", "True", "True", "False", "False", "False", "True", "True" ]
DREval/60
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...
intersection
null
[ "((1, 2), (2, 3),)", "((-1, 1), (0, 4),)", "((-3, -1), (-5, 5),)", "((-2, 2), (-4, 0),)", "((-11, 2), (-1, -1),)", "((1, 2), (3, 5),)", "((1, 2), (1, 2),)", "((-2, -2), (-3, -2),)" ]
[ "'NO'", "'NO'", "'YES'", "'YES'", "'NO'", "'NO'", "'NO'", "'NO'" ]
DREval/61
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...
minPath
null
[ "([[1, 2, 3], [4, 5, 6], [7, 8, 9]], 3,)", "([[5, 9, 3], [4, 1, 6], [7, 8, 2]], 1,)", "([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]], 4,)", "([[6, 4, 13, 10], [5, 7, 12, 1], [3, 16, 11, 15], [8, 14, 9, 2]], 7,)", "([[8, 14, 9, 2], [6, 4, 13, 15], [5, 7, 1, 12], [3, 10, 11, 16]], 5,)", "...
[ "[1, 2, 1]", "[1]", "[1, 2, 1, 2]", "[1, 10, 1, 10, 1, 10, 1]", "[1, 7, 1, 7, 1]", "[1, 6, 1, 6, 1, 6, 1, 6, 1]", "[1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6]", "[1, 3, 1, 3, 1, 3, 1, 3]", "[1, 5, 1, 5, 1, 5, 1, 5]", "[1, 2, 1, 2, 1, 2, 1, 2, 1, 2]", "[1, 3, 1, 3, 1, 3, 1, 3, 1, 3]" ]
DREval/62
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) + ...
tri
null
[ "(3,)", "(4,)", "(5,)", "(6,)", "(7,)", "(8,)", "(9,)", "(20,)", "(0,)", "(1,)" ]
[ "[1, 3, 2.0, 8.0]", "[1, 3, 2.0, 8.0, 3.0]", "[1, 3, 2.0, 8.0, 3.0, 15.0]", "[1, 3, 2.0, 8.0, 3.0, 15.0, 4.0]", "[1, 3, 2.0, 8.0, 3.0, 15.0, 4.0, 24.0]", "[1, 3, 2.0, 8.0, 3.0, 15.0, 4.0, 24.0, 5.0]", "[1, 3, 2.0, 8.0, 3.0, 15.0, 4.0, 24.0, 5.0, 35.0]", "[1, 3, 2.0, 8.0, 3.0, 15.0, 4.0, 24.0, 5.0, 35....
DREval/63
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 """ product = 1 odd_count = 0 for digit in str(n): int_digit = int(digit) if int_di...
digits
null
[ "(5,)", "(54,)", "(120,)", "(5014,)", "(98765,)", "(5576543,)", "(2468,)" ]
[ "5", "5", "1", "5", "315", "2625", "0" ]
DREval/64
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('[...
is_nested
null
[ "('[[]]',)", "('[]]]]]]][[[[[]',)", "('[][]',)", "('[]',)", "('[[[[]]]]',)", "('[]]]]]]]]]]',)", "('[][][[]]',)", "('[[]',)", "('[]]',)", "('[[]][[',)", "('[[][]]',)", "('',)", "('[[[[[[[[',)", "(']]]]]]]]',)" ]
[ "True", "False", "False", "False", "True", "False", "True", "False", "False", "True", "True", "False", "False", "False" ]
DREval/65
def sum_squares(lst): """You are given a list of numbers. You need to return the sum of squared numbers in the given list, round each element in the list to the upper int(Ceiling) first. Examples: For lst = [1,2,3] the output should be 14 For lst = [1,4,9] the output should be 98 For lst =...
sum_squares
null
[ "([1, 2, 3],)", "([1.0, 2, 3],)", "([1, 3, 5, 7],)", "([1.4, 4.2, 0],)", "([-2.4, 1, 1],)", "([100, 1, 15, 2],)", "([10000, 10000],)", "([-1.4, 4.6, 6.3],)", "([-1.4, 17.9, 18.9, 19.9],)", "([0],)", "([-1],)", "([-1, 1, 0],)" ]
[ "14", "14", "84", "29", "6", "10230", "200000000", "75", "1086", "0", "1", "2" ]
DREval/66
def can_arrange(arr): """Create a function which returns the largest index of an element which is not greater than or equal to the element immediately preceding it. If no such element exists then return -1. The given array will not contain duplicate values. Examples: can_arrange([1,2,4,3,5]) =...
can_arrange
null
[ "([1, 2, 4, 3, 5],)", "([1, 2, 4, 5],)", "([1, 4, 2, 5, 6, 7, 8, 9, 10],)", "([4, 8, 5, 7, 3],)", "([],)" ]
[ "3", "-1", "2", "4", "-1" ]
DREval/67
def compare_one(a, b): """ Create a function that takes integers, floats, or strings representing real numbers, and returns the larger variable in its given variable type. Return None if the values are equal. Note: If a real number is represented as a string, the floating point might be . or , ...
compare_one
null
[ "(1, 2,)", "(1, 2.5,)", "(2, 3,)", "(5, 6,)", "(1, '2,3',)", "('5,1', '6',)", "('1', '2',)", "('1', 1,)" ]
[ "2", "2.5", "3", "6", "'2,3'", "'6'", "'2'", "None" ]
DREval/68
def special_factorial(n): """The Brazilian factorial is defined as: brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1! where n > 0 For example: >>> special_factorial(4) 288 The function will receive an integer as input and should return the special factorial of this integer. ...
special_factorial
null
[ "(4,)", "(5,)", "(7,)", "(1,)" ]
[ "288", "34560", "125411328000", "1" ]
DREval/69
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")...
fix_spaces
null
[ "('Example',)", "('Mudasir Hanif ',)", "('Yellow Yellow Dirty Fellow',)", "('Exa mple',)", "(' Exa 1 2 2 mple',)" ]
[ "'Example'", "'Mudasir_Hanif_'", "'Yellow_Yellow__Dirty__Fellow'", "'Exa-mple'", "'-Exa_1_2_2_mple'" ]
DREval/70
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...
file_name_check
null
[ "('example.txt',)", "('1example.dll',)", "('s1sdf3.asd',)", "('K.dll',)", "('MY16FILE3.exe',)", "('His12FILE94.exe',)", "('_Y.txt',)", "('?aREYA.exe',)", "('/this_is_valid.dll',)", "('this_is_valid.wow',)", "('this_is_valid.txt',)", "('this_is_valid.txtexe',)", "('#this2_i4s_5valid.ten',)", ...
[ "'Yes'", "'No'", "'No'", "'Yes'", "'Yes'", "'No'", "'No'", "'No'", "'No'", "'No'", "'Yes'", "'No'", "'No'", "'No'", "'No'", "'No'", "'Yes'", "'Yes'", "'Yes'", "'No'", "'No'", "'No'", "'No'", "'No'", "'No'", "'No'" ]
DREval/71
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...
sum_squares
null
[ "([1, 2, 3],)", "([1, 4, 9],)", "([],)", "([1, 1, 1, 1, 1, 1, 1, 1, 1],)", "([-1, -1, -1, -1, -1, -1, -1, -1, -1],)", "([0],)", "([-1, -5, 2, -1, -5],)", "([-56, -99, 1, 0, -2],)", "([-1, 0, 0, 0, 0, 0, 0, 0, -1],)", "([-16, -9, -2, 36, 36, 26, -20, 25, -40, 20, -4, 12, -26, 35, 37],)", "([-1, -...
[ "6", "14", "0", "9", "-3", "0", "-126", "3030", "0", "-14196", "-1448" ]
DREval/72
def words_in_sentence(sentence): """ 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, the order of the words in the new stri...
words_in_sentence
null
[ "('This is a test',)", "('lets go for swimming',)", "('there is no place available here',)", "('Hi I am Hussein',)", "('go for it',)", "('here',)", "('here is',)" ]
[ "'is'", "'go for'", "'there is no place'", "'Hi am Hussein'", "'go for it'", "''", "'is'" ]
DREval/73
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 ...
simplify
null
[ "('1/5', '5/1',)", "('1/6', '2/1',)", "('5/1', '3/1',)", "('7/10', '10/2',)", "('2/10', '50/10',)", "('7/2', '4/2',)", "('11/6', '6/1',)", "('2/3', '5/2',)", "('5/2', '3/5',)", "('2/4', '8/4',)", "('2/4', '4/2',)", "('1/5', '5/1',)", "('1/5', '1/5',)" ]
[ "True", "False", "True", "False", "True", "True", "True", "False", "False", "True", "True", "True", "False" ]
DREval/74
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...
order_by_points
null
[ "([1, 11, -1, -11, -12],)", "([1234, 423, 463, 145, 2, 423, 423, 53, 6, 37, 3457, 3, 56, 0, 46],)", "([],)", "([1, -11, -32, 43, 54, -98, 2, -3],)", "([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],)", "([0, 6, 6, -76, -21, 23, 4],)" ]
[ "[-1, -11, 1, -12, 11]", "[0, 2, 3, 6, 53, 423, 423, 423, 1234, 145, 37, 46, 56, 463, 3457]", "[]", "[-3, -32, -98, -11, 1, 2, 43, 54]", "[1, 10, 2, 11, 3, 4, 5, 6, 7, 8, 9]", "[-76, -21, 0, 4, 23, 6, 6]" ]
DREval/75
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(...
specialFilter
null
[ "([5, -2, 1, -5],)", "([15, -73, 14, -15],)", "([33, -2, -3, 45, 21, 109],)", "([43, -12, 93, 125, 121, 109],)", "([71, -2, -33, 75, 21, 19],)", "([1],)", "([],)" ]
[ "0", "1", "2", "4", "3", "0", "0" ]
DREval/76
def get_max_triples(n): """ 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 a[i] + a[j] + a[k] is a multiple of 3. ...
get_max_triples
null
[ "(5,)", "(6,)", "(10,)" ]
[ "1", "4", "36" ]
DREval/77
def bf(planet1, planet2): ''' 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 and planet2. The function should return a ...
bf
null
[ "('Jupiter', 'Neptune',)", "('Earth', 'Mercury',)", "('Mercury', 'Uranus',)", "('Neptune', 'Venus',)", "('Earth', 'Earth',)", "('Mars', 'Earth',)", "('Jupiter', 'Makemake',)" ]
[ "('Saturn', 'Uranus')", "('Venus',)", "('Venus', 'Earth', 'Mars', 'Jupiter', 'Saturn')", "('Earth', 'Mars', 'Jupiter', 'Saturn', 'Uranus')", "()", "()", "()" ]
DREval/78
def sorted_list_sum(lst): """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 of numbers, and it may contain duplicates. T...
sorted_list_sum
null
[ "(['aa', 'a', 'aaa'],)", "(['school', 'AI', 'asdf', 'b'],)", "(['d', 'b', 'c', 'a'],)", "(['d', 'dcba', 'abcd', 'a'],)", "(['AI', 'ai', 'au'],)", "(['a', 'b', 'b', 'c', 'c', 'a'],)", "(['aaaa', 'bbbb', 'dd', 'cc'],)" ]
[ "['aa']", "['AI', 'asdf', 'school']", "[]", "['abcd', 'dcba']", "['AI', 'ai', 'au']", "[]", "['cc', 'dd', 'aaaa', 'bbbb']" ]
DREval/79
def Strongest_Extension(class_name, extensions): """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 uppercase letters in the extens...
Strongest_Extension
null
[ "('Watashi', ['tEN', 'niNE', 'eIGHt8OKe'],)", "('Boku123', ['nani', 'NazeDa', 'YEs.WeCaNe', '32145tggg'],)", "('__YESIMHERE', ['t', 'eMptY', 'nothing', 'zeR00', 'NuLl__', '123NoooneB321'],)", "('K', ['Ta', 'TAR', 't234An', 'cosSo'],)", "('__HAHA', ['Tab', '123', '781345', '-_-'],)", "('YameRore', ['HhAas'...
[ "'Watashi.eIGHt8OKe'", "'Boku123.YEs.WeCaNe'", "'__YESIMHERE.NuLl__'", "'K.TAR'", "'__HAHA.123'", "'YameRore.okIWILL123'", "'finNNalLLly.WoW'", "'_.Bb'", "'Sp.671235'" ]
DREval/80
def cycpattern_check(a , b): """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 cycpattern_check("abcd","abd") => False cycpattern_check("hello","ell") => True cycpattern_check("whassup","psus") => False cycpattern_check("ab...
cycpattern_check
null
[ "('xyzw', 'xyw',)", "('yello', 'ell',)", "('whattup', 'ptut',)", "('efef', 'fee',)", "('abab', 'aabb',)", "('winemtt', 'tinem',)" ]
[ "False", "True", "False", "True", "False", "True" ]
DREval/81
def even_odd_count(num): """Given an integer. return a tuple that has the number of even and odd digits respectively. Example: even_odd_count(-12) ==> (1, 1) even_odd_count(123) ==> (1, 2) """ even_count = 0 odd_count = 0 for i in str(abs(num)): if int(i)%2==0: ...
even_odd_count
null
[ "(7,)", "(-78,)", "(3452,)", "(346211,)", "(-345821,)", "(-2,)", "(-45347,)", "(0,)" ]
[ "(0, 1)", "(1, 1)", "(2, 2)", "(3, 3)", "(3, 3)", "(1, 0)", "(2, 3)", "(1, 0)" ]
DREval/82
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...
int_to_mini_roman
null
[ "(19,)", "(152,)", "(251,)", "(426,)", "(500,)", "(1,)", "(4,)", "(43,)", "(90,)", "(94,)", "(532,)", "(900,)", "(994,)", "(1000,)" ]
[ "'xix'", "'clii'", "'ccli'", "'cdxxvi'", "'d'", "'i'", "'iv'", "'xliii'", "'xc'", "'xciv'", "'dxxxii'", "'cm'", "'cmxciv'", "'m'" ]
DREval/83
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...
do_algebra
null
[ "(['**', '*', '+'], [2, 3, 4, 5],)", "(['+', '*', '-'], [2, 3, 4, 5],)", "(['//', '*'], [7, 3, 4],)" ]
[ "37", "9", "8" ]
DREval/84
def solve(s): """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 resulted string. Examples solve("1234") = "4321" solve("...
solve
null
[ "('AsDf',)", "('1234',)", "('ab',)", "('#a@C',)", "('#AsdfW^45',)", "('#6@2',)", "('#$a^D',)", "('#ccc',)" ]
[ "'aSdF'", "'4321'", "'AB'", "'#A@c'", "'#aSDFw^45'", "'2@6#'", "'#$A^d'", "'#CCC'" ]
DREval/85
import math class AreaCalculator: def __init__(self, radius): self.radius = radius def calculate_circle_area(self): return math.pi * self.radius ** 2 def calculate_sphere_area(self): return 4 * math.pi * self.radius ** 2 def calculate_cylinder_area(self, height): re...
AreaCalculator
import unittest class AreaCalculatorTestCalculateCircleArea(unittest.TestCase): def test_calculate_circle_area(self): areaCalculator = AreaCalculator(2) self.assertAlmostEqual(12.56, areaCalculator.calculate_circle_area(), delta=0.01) def test_calculate_circle_area_2(self): areaCalculat...
[ "areaCalculator = AreaCalculator(2)\nassertAlmostEqual(12.56, areaCalculator.calculate_circle_area(), delta=0.01)\n", "areaCalculator = AreaCalculator(2)\nassertAlmostEqual(50.27, areaCalculator.calculate_sphere_area(), delta=0.01)\n", "areaCalculator = AreaCalculator(2)\nassertAlmostEqual(50.27, areaCalculator...
[]
DREval/86
class ArgumentParser: def __init__(self): self.arguments = {} self.required = set() self.types = {} def parse_arguments(self, command_string): args = command_string.split()[1:] for i in range(len(args)): arg = args[i] if arg.startswith('--'): ...
ArgumentParser
import unittest class ArgumentParserTestParseArguments(unittest.TestCase): def setUp(self): self.parser = ArgumentParser() # key value arguments def test_parse_arguments_1(self): command_str = "script --name=John --age=25" self.parser.add_argument("name") self.parser.add_a...
[ "command_str = \"script --name=John --age=25\"\nself.parser.add_argument(\"name\")\nself.parser.add_argument(\"age\", arg_type=int)\nresult, missing_args = self.parser.parse_arguments(command_str)\nassertTrue(result)\nassertIsNone(missing_args)\nassertEqual(self.parser.get_argument(\"name\"), \"John\")\nassertEqual...
[]
DREval/87
import itertools class ArrangementCalculator: def __init__(self, datas): self.datas = datas @staticmethod def count(n, m=None): if m is None or n == m: return ArrangementCalculator.factorial(n) else: return ArrangementCalculator.factorial(n) // ArrangementC...
ArrangementCalculator
import unittest class ArrangementCalculatorTestCount(unittest.TestCase): def test_count_1(self): res = ArrangementCalculator.count(5, 3) self.assertEqual(res, 60) def test_count_2(self): res = ArrangementCalculator.count(4, 3) self.assertEqual(res, 24) def test_count_3(se...
[ "res = ArrangementCalculator.count(5, 3)\nassertEqual(res, 60)\n", "res = ArrangementCalculator.count_all(4)\nassertEqual(res, 64)\n", "ac = ArrangementCalculator([1, 2, 3, 4])\nres = ac.select(2)\nexpected = [[1, 2], [1, 3], [1, 4], [2, 1], [2, 3], [2, 4], [3, 1], [3, 2], [3, 4], [4, 1], [4, 2], [4, 3]]\nasser...
[]
DREval/88
class AssessmentSystem: def __init__(self): self.students = {} def add_student(self, name, grade, major): self.students[name] = {'name': name, 'grade': grade, 'major': major, 'courses': {}} def add_course_score(self, name, course, score): if name in self.students: self....
AssessmentSystem
import unittest class AssessmentSystemTestAddStudent(unittest.TestCase): def test_add_student(self): assessment_system = AssessmentSystem() assessment_system.add_student("Alice", 3, "Mathematics") self.assertEqual(assessment_system.students["Alice"], {'name': 'Alice...
[ "assessment_system = AssessmentSystem()\nassessment_system.add_student(\"Alice\", 3, \"Mathematics\")\nassertEqual(assessment_system.students[\"Alice\"],\n{'name': 'Alice', 'grade': 3, 'major': 'Mathematics', 'courses': {}})\n", "assessment_system = AssessmentSystem()\nassessment_system.students = {\"Alice\": {'n...
[]
DREval/89
class AutomaticGuitarSimulator: def __init__(self, text) -> None: self.play_text = text def interpret(self, display=False): if len(self.play_text) == 0: return else: play_list = [] play_segs = self.play_text.split(" ") for play_seg in play...
AutomaticGuitarSimulator
import unittest class AutomaticGuitarSimulatorTestInterpret(unittest.TestCase): def test_interpret_1(self): context = AutomaticGuitarSimulator("C53231323") play_list = context.interpret() self.assertEqual(play_list, [{'Chord': 'C', 'Tune': '53231323'}]) def test_interpret_2(self): ...
[ "context = AutomaticGuitarSimulator(\"C53231323\")\nplay_list = context.interpret()\nassertEqual(play_list, [{'Chord': 'C', 'Tune': '53231323'}])\n", "context = AutomaticGuitarSimulator(\"C53231323 Em43231323\")\nplay_list = context.interpret()\nstr = context.display(play_list[0]['Chord'], play_list[0]['Tune'])\n...
[]
DREval/90
class AvgPartition: def __init__(self, lst, limit): self.lst = lst self.limit = limit def setNum(self): size = len(self.lst) // self.limit remainder = len(self.lst) % self.limit return size, remainder def get(self, index): size, remainder = self.set...
AvgPartition
import unittest class AvgPartitionTestSetNum(unittest.TestCase): def test_setNum(self): a = AvgPartition([1, 2, 3, 4], 2) self.assertEqual(a.setNum(), (2, 0)) def test_setNum_2(self): a = AvgPartition([1, 2, 3, 4, 5], 2) self.assertEqual(a.setNum(), (2, 1)) def test_setNum...
[ "a = AvgPartition([1, 2, 3, 4], 2)\nassertEqual(a.setNum(), (2, 0))\n", "a = AvgPartition([1, 2, 3, 4], 2)\nassertEqual(a.get(0), [1, 2])\n", "a = AvgPartition([1, 2, 3, 4], 2)\nassertEqual(a.setNum(), (2, 0))\nassertEqual(a.get(0), [1, 2])\n" ]
[]
DREval/91
class BalancedBrackets: def __init__(self, expr): self.stack = [] self.left_brackets = ["(", "{", "["] self.right_brackets = [")", "}", "]"] self.expr = expr def clear_expr(self): self.expr = ''.join(c for c in self.expr if (c in self.left_brackets or c in self.right_bra...
BalancedBrackets
import unittest class BalancedBracketsTestClearExpr(unittest.TestCase): def test_clear_expr(self): b = BalancedBrackets("a(b)c") b.clear_expr() self.assertEqual(b.expr, "()") def test_clear_expr_2(self): b = BalancedBrackets("a(b){c}") b.clear_expr() self.asser...
[ "b = BalancedBrackets(\"a(b)c\")\nb.clear_expr()\nassertEqual(b.expr, \"()\")\n", "b = BalancedBrackets(\"a(b)c\")\nassertEqual(b.check_balanced_brackets(), True)\n", "b = BalancedBrackets(\"a(b)c\")\nb.clear_expr()\nassertEqual(b.expr, \"()\")\nassertEqual(b.check_balanced_brackets(), True)\n" ]
[]
DREval/92
class BankAccount: def __init__(self, balance=0): self.balance = balance def deposit(self, amount): if amount < 0: raise ValueError("Invalid amount") self.balance += amount return self.balance def withdraw(self, amount): if amount < 0: raise ...
BankAccount
import unittest class BankAccountTestDeposit(unittest.TestCase): def test_deposit(self): account1 = BankAccount() ret = account1.deposit(1000) self.assertEqual(ret, 1000) def test_deposit_2(self): account1 = BankAccount() account1.deposit(1000) ret = account1.d...
[ "account1 = BankAccount()\nret = account1.deposit(1000)\nassertEqual(ret, 1000)\n", "account1 = BankAccount()\naccount1.balance = 1000\nret = account1.withdraw(200)\nassertEqual(ret, 800)\n", "account1 = BankAccount()\nassertEqual(account1.view_balance(), 0)\n", "account1 = BankAccount()\naccount2 = BankAccou...
[]
DREval/93
class BigNumCalculator: @staticmethod def add(num1, num2): max_length = max(len(num1), len(num2)) num1 = num1.zfill(max_length) num2 = num2.zfill(max_length) carry = 0 result = [] for i in range(max_length - 1, -1, -1): digit_sum = int(num1[i]) + int(...
BigNumCalculator
import unittest class BigNumCalculatorTestAdd(unittest.TestCase): def test_add(self): bigNum = BigNumCalculator() self.assertEqual(bigNum.add("12345678901234567890", "98765432109876543210"), "111111111011111111100") def test_add_2(self): bigNum = BigNumCalculator() self.assertE...
[ "bigNum = BigNumCalculator()\nassertEqual(bigNum.add(\"12345678901234567890\", \"98765432109876543210\"), \"111111111011111111100\")\n", "bigNum = BigNumCalculator()\nassertEqual(bigNum.subtract(\"12345678901234567890\", \"98765432109876543210\"), \"-86419753208641975320\")\n", "bigNum = BigNumCalculator()\nass...
[]
DREval/94
class BinaryDataProcessor: def __init__(self, binary_string): self.binary_string = binary_string self.clean_non_binary_chars() def clean_non_binary_chars(self): self.binary_string = ''.join(filter(lambda x: x in '01', self.binary_string)) def calculate_binary_info(self): ze...
BinaryDataProcessor
import unittest class BinaryDataProcessorTestCleanNonBinaryChars(unittest.TestCase): def test_clean_non_binary_chars(self): bdp = BinaryDataProcessor("01101000daf3e4r01100101011011000110110001101111") self.assertEqual(bdp.binary_string, "0110100001100101011011000110110001101111") def test_clea...
[ "bdp = BinaryDataProcessor(\"01101000daf3e4r01100101011011000110110001101111\")\nassertEqual(bdp.binary_string, \"0110100001100101011011000110110001101111\")\n", "bdp = BinaryDataProcessor(\"0110100001100101011011000110110001101111\")\nassertEqual(bdp.calculate_binary_info(), {'Zeroes': 0.475, 'Ones': 0.525, 'Bit...
[]
DREval/95
class BitStatusUtil: @staticmethod def add(states, stat): BitStatusUtil.check([states, stat]) return states | stat @staticmethod def has(states, stat): BitStatusUtil.check([states, stat]) return (states & stat) == stat @staticmethod def remove(states, stat): ...
BitStatusUtil
import unittest class BitStatusUtilTestAdd(unittest.TestCase): def test_add(self): bit_status_util = BitStatusUtil() self.assertEqual(bit_status_util.add(2, 4), 6) def test_add_2(self): bit_status_util = BitStatusUtil() self.assertEqual(bit_status_util.add(2, 0), 2) def t...
[ "bit_status_util = BitStatusUtil()\nassertEqual(bit_status_util.add(2, 4), 6)\n", "bit_status_util = BitStatusUtil()\nassertTrue(bit_status_util.has(6, 2))\n", "bit_status_util = BitStatusUtil()\nassertEqual(bit_status_util.remove(6, 2), 4)\n", "bit_status_util = BitStatusUtil()\nbit_status_util.check([2])\n"...
[]
DREval/96
class BookManagement: def __init__(self): self.inventory = {} def add_book(self, title, quantity=1): if title in self.inventory: self.inventory[title] += quantity else: self.inventory[title] = quantity def remove_book(self, title, quantity): if title...
BookManagement
import unittest class BookManagementTestAddBook(unittest.TestCase): def test_add_book_1(self): bookManagement = BookManagement() bookManagement.add_book("book1") self.assertEqual({"book1": 1}, bookManagement.inventory) def test_add_book_2(self): bookManagement = BookManagement...
[ "bookManagement = BookManagement()\nbookManagement.add_book(\"book1\")\nassertEqual({\"book1\": 1}, bookManagement.inventory)\n", "self.bookManagement.remove_book(\"book1\", 2)\nassertEqual(self.bookManagement.inventory, {\"book2\": 1})\n", "bookManagement = BookManagement()\nbookManagement.add_book(\"book1\", ...
[]
End of preview. Expand in Data Studio

REval: Reasoning Runtime Behavior of a Program with LLM

Disclaimer: We are not the authors of the REval benchmark. This upload is a convenience repackaging of the original dataset with precomputed execution traces, variable states, and ground truth answers to make the benchmark easier to use programmatically. The original benchmark was created by Junkai Chen et al. and is available at github.com/r-eval/REval. Please cite the original paper if you use this data.

REval is a benchmark for evaluating Large Language Models' ability to reason about the runtime behavior of Python programs.

Reasoning Runtime Behavior of a Program with LLM: How Far Are We? Junkai Chen, Zhiyuan Pan, Xing Hu, Zhenhao Li, Ge Li, Xin Xia ICSE 2025 Paper | GitHub

Dataset Summary

Problems 154 (85 HumanEval + 69 ClassEval)
Test-case executions 694 (with full execution traces)
Reasoning tasks Coverage, Path, State, Output, Consistency
Ground truth Line coverage, execution traces, variable states at every step
License MIT

Reasoning Tasks

  1. Coverage -- Predict whether a specific line of code is executed for a given input
  2. Path -- Determine the next line that will be executed after a given line
  3. State -- Infer variable values at specific execution points
  4. Output -- Complete test code based on expected execution behavior
  5. Consistency -- Combined score measuring consistency across all four tasks

Configurations

Config Records Description
problems (default) 154 Problem definitions: code, inputs, expected outputs
tasks 154 Task specifications: which lines/variables to query per input
executions 694 Execution traces and line coverage per (problem, input) pair
states 694 Variable states at each executed line

Usage

from datasets import load_dataset

# Load problem definitions (default config)
problems = load_dataset("r-eval/REval", "problems", split="test")
print(f"{len(problems)} problems")
print(problems[0]["task_id"])  # "DREval/0"
print(problems[0]["entry_point"])  # "has_close_elements"

# Load execution traces
executions = load_dataset("r-eval/REval", "executions", split="test")
print(executions[0]["trace"])  # [11, 12, 13, 12, 13, 14, 15, ...]
print(executions[0]["coverage"])  # [11, 12, 13, 14, 15, 16]

# Load variable states (states field is a JSON string -- parse it)
import json
states = load_dataset("r-eval/REval", "states", split="test")
state_list = json.loads(states[0]["states"])
# Each state: {"lineno": 0, "locals": {"var": {"__type__": "int", "__value__": 1}}}

# Load task specifications (tasks field is a JSON string)
tasks = load_dataset("r-eval/REval", "tasks", split="test")
task_list = json.loads(tasks[0]["tasks"])
# Each task: {"input_idx": 0, "task": [{"lineno": 17, "var": "distance"}, ...], "output_pred": "..."}

Data Fields

problems config

Field Type Description
task_id string Unique identifier, e.g. "DREval/0"
code string Complete Python source code (signature + docstring + solution)
entry_point string Function or class name
test string or null Unittest code for ClassEval problems; null for HumanEval
inputs list[string] Test inputs as Python expressions
outputs list[string] Expected outputs as strings

Problem types:

  • HumanEval (idx 0--84): Standalone functions. test is null, outputs is non-empty.
  • ClassEval (idx 85--153): OOP classes. test contains unittest code, outputs is empty.

tasks config

Field Type Description
task_id string Unique identifier
idx int Problem index
tasks string (JSON) JSON-encoded list of per-input task definitions

Each entry in the parsed tasks list contains:

  • input_idx (int): Index into the problem's inputs/outputs arrays
  • task (list[object]): Variable queries -- each has lineno (1-indexed) and var (variable name)
  • output_pred (string): Output prediction template (e.g. "assert func(args) == ??")

executions config

Field Type Description
task_id string Problem identifier
idx int Problem index
input_idx int Which test input was used
problem_type string "humaneval" or "classeval"
input string The specific input expression
expected_output string Expected output
actual_output string Actual output from execution
status string "ok" or "error"
trace list[int] 0-indexed line execution sequence
coverage list[int] Sorted unique executed lines (0-indexed)
num_states int Number of state snapshots captured
code_hash string SHA-256 of the source code
error string or null Error message if status="error", null otherwise

states config

Field Type Description
task_id string Problem identifier
idx int Problem index
input_idx int Which test input was used
states string (JSON) JSON-encoded list of state objects

Each state object in the parsed list:

  • lineno (int): 0-indexed line number
  • locals (dict): Variable name to typed value envelope ({"__type__": "int", "__value__": 42})
  • return (optional): Return value in the same envelope format
  • exception (optional): Exception info if one was raised

Supported value types in envelopes: int, float, bool, str, NoneType, list, tuple, set, dict, Nil (uninitialized), numpy.ndarray, datetime.datetime, and custom objects. Special float values: "nan", "inf", "-inf".

Line Number Conventions

  • executions config (trace, coverage): 0-indexed line numbers
  • states config (lineno): 0-indexed line numbers
  • tasks config (lineno in task queries): 1-indexed line numbers (for use in prompts)

Known Issues

  • Problems DREval/117 and DREval/149 import gensim (not included in dependencies). Their ground truth records have status="error" with empty traces.
  • Arrows to the next executed lines for ClassEval do not take into account test code.

Citation

If you use this dataset, please cite:

@inproceedings{chen2025reval,
  title     = {Reasoning Runtime Behavior of a Program with LLM: How Far Are We?},
  author    = {Junkai Chen and Zhiyuan Pan and Xing Hu and Zhenhao Li and Ge Li and Xin Xia},
  booktitle = {Proceedings of the 47th IEEE/ACM International Conference on Software Engineering (ICSE)},
  year      = {2025},
  doi       = {10.1109/ICSE55347.2025.00087}
}

Source

Downloads last month
48

Space using JetBrains-Research/REval 1