Dataset Viewer
Auto-converted to Parquet Duplicate
id
stringlengths
25
40
source
stringclasses
3 values
family
stringclasses
25 values
group
stringclasses
2 values
split
stringclasses
1 value
input
stringlengths
52
800k
answer
stringlengths
1
4.49k
options
listlengths
tier
stringclasses
1 value
label_source
stringclasses
9 values
audit_accuracy
float32
provenance
stringlengths
74
323
record
stringlengths
127
13k
code2.llm:u757c9d0c27f1b6
code2-llm
code2.llm_exercise
code
train
{"title": "Stable Grouped Quantiles", "statement": "Given records as `(key, value)` pairs, group values by key and return each group's lower median, where the lower median is the element at index `(n - 1) // 2` after sorting. Preserve the order in which keys first appear in the input, and return an empty list for empty...
from collections import defaultdict from typing import Hashable, Iterable, TypeVar K = TypeVar("K", bound=Hashable) V = TypeVar("V") def grouped_lower_medians(records: Iterable[tuple[K, V]]) -> list[tuple[K, V]]: """Return each key's lower median value in first-seen key order.""" groups: dict[K, list[V]] = de...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "grouping and aggregating records", "scenario": "a theatre box office", "level": "advanced", "style": "exercise", "unit_id": "u757c9d0c27f1b6"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 0.5, "mutants": 8, "tests": 6}, "topic": "grouping and aggregating records", "difficulty": 5, "check": {}}
code2.llm:ua21e27a76c8217
code2-llm
code2.llm_exercise
code
train
{"title": "Ferry Load Changes", "statement": "A ferry records its passenger load before departure and after each stop. Given those readings in order, return the first finite differences: the change in passenger load between each pair of consecutive readings. Return an empty list when fewer than two readings are provide...
def ferry_load_changes(loads: list[int]) -> list[int]: """Return passenger-load changes between consecutive ferry readings.""" return [loads[i] - loads[i - 1] for i in range(1, len(loads))]
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "finite differences", "scenario": "a ferry service", "level": "intro", "style": "exercise", "unit_id": "ua21e27a76c8217"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 1.0, "mutants": 6, "tests": 6}, "topic": "finite differences", "difficulty": 1, "check": {}}
code2.llm:u0a5bd82bc13e21
code2-llm
code2.llm_exercise
code
train
{"title": "Decay Threshold Time", "statement": "Given a positive initial quantity, a positive target quantity no greater than the initial quantity, and a positive half-life, compute the time needed for radioactive decay to reach the target. Return the time as a float; if the target already equals the initial quantity, ...
import math def decay_time_to_threshold( initial_quantity: float, target_quantity: float, half_life: float ) -> float: """Return the time for a decaying quantity to reach a target.""" if initial_quantity <= 0 or target_quantity <= 0 or half_life <= 0: raise ValueError("quantities and half-life mus...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "radioactive decay and half-life", "scenario": "a museum", "level": "intro", "style": "exercise", "unit_id": "u0a5bd82bc13e21"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 0.625, "mutants": 8, "tests": 6}, "topic": "radioactive decay and half-life", "difficulty": 1, "check": {}}
code2.llm:ue741c82e6b8388
code2-llm
code2.llm_exercise
code
train
{"title": "Courier Parcel Length Codes", "statement": "A courier system stores each parcel's nonnegative length in centimeters as a variable-length integer, using seven payload bits per byte and the high bit as a continuation flag. Define the encoding as little-endian groups: each byte carries the next seven low-order ...
def encode_parcel_length(length_cm: int) -> list[int]: """Encode a nonnegative parcel length using little-endian 7-bit groups.""" if length_cm < 0: raise ValueError("length must be nonnegative") encoded = [] while length_cm >= 0x80: encoded.append((length_cm & 0x7F) | 0x80) leng...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "variable-length integer encoding", "scenario": "a parcel courier", "level": "intermediate", "style": "exercise", "unit_id": "ue741c82e6b8388"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 1.0, "mutants": 8, "tests": 6}, "topic": "variable-length integer encoding", "difficulty": 3, "check": {}}
code2.llm:uf22d485232950d
code2-llm
code2.llm_exercise
code
train
{"title": "Grouped Record Totals", "statement": "Given a sequence of `(label, value)` records, return a dictionary mapping each label to a pair containing its record count and the sum of its values. Preserve labels even when their values are zero, and return an empty dictionary when there are no records.", "func": "agg...
def aggregate_by_label(records: list[tuple[str, int]]) -> dict[str, tuple[int, int]]: """Return the count and value total for each label.""" totals: dict[str, list[int]] = {} for label, value in records: if label not in totals: totals[label] = [0, 0] totals[label][0] += 1 ...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "grouping and aggregating records", "scenario": "a laboratory", "level": "intro", "style": "fix", "unit_id": "uf22d485232950d"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 1.0, "mutants": 8, "tests": 5, "bug_fails_a_test": true, "bug_lines_changed": 1}, "topic": "grouping and aggregating records", "difficulty": 1, "check": {}}
code2.llm:ub9a6448b77ed58
code2-llm
code2.llm_exercise
code
train
{"title": "Bakery Ticket Flattening", "statement": "A bakery stores each production ticket as a nested dictionary, with details such as dough, filling, and oven settings. Create a flat dictionary whose keys are dot-separated paths through nested dictionaries and whose values are the original non-dictionary values; list...
from typing import Any def flatten_bakery_ticket(ticket: dict[str, Any]) -> dict[str, Any]: """Flatten nested bakery ticket dictionaries into dot-separated paths.""" flattened: dict[str, Any] = {} def visit(value: Any, path: str) -> None: if isinstance(value, dict) and value: for key,...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "flattening nested JSON", "scenario": "a bakery", "level": "intro", "style": "exercise", "unit_id": "ub9a6448b77ed58"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 1.0, "mutants": 4, "tests": 6}, "topic": "flattening nested JSON", "difficulty": 1, "check": {}}
code2.llm:u6d939d404e32aa
code2-llm
code2.llm_exercise
code
train
{"title": "Trie Prefix Counts", "statement": "Define a trie as a nested dictionary whose keys are characters and whose terminal word marker is the empty string. Implement a function that builds a trie from a list of words and returns the number of inserted words that start with a given prefix. Count duplicate words sep...
def count_with_prefix(words: list[str], prefix: str) -> int: """Count word entries beginning with prefix using a trie.""" root: dict[str, dict] = {} terminal = "" for word in words: node = root for char in word: node = node.setdefault(char, {}) node[terminal] = node.g...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "a trie of words", "scenario": "a farm", "level": "intro", "style": "exercise", "unit_id": "u6d939d404e32aa"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 1.0, "mutants": 8, "tests": 6}, "topic": "a trie of words", "difficulty": 1, "check": {}}
code2.llm:u2539c64737ea01
code2-llm
code2.llm_exercise
code
train
{"title": "Finite Continued Fraction", "statement": "A finite simple continued fraction is specified by a nonempty sequence of integer coefficients \u001b[0m\u001b[0m, with every coefficient after the first positive. Define its value as the exact rational number represented by \u001b[0m\u001b[0m. Return that value as a...
from fractions import Fraction from collections.abc import Sequence def continued_fraction_value(coefficients: Sequence[int]) -> Fraction: """Evaluate a finite simple continued fraction exactly.""" if not coefficients or any(value <= 0 for value in coefficients[1:]): raise ValueError("need a nonempty ...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "exact fractions and continued fractions", "scenario": "a library", "level": "intro", "style": "exercise", "unit_id": "u2539c64737ea01"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 0.75, "mutants": 8, "tests": 6}, "topic": "exact fractions and continued fractions", "difficulty": 1, "check": {}}
code2.llm:u430971e8e737ab
code2-llm
code2.llm_exercise
code
train
{"title": "Ferry Auxiliary Circuit", "statement": "A ferry’s auxiliary bus supplies several parallel cabin-heater elements, each with its own resistance. Given the bus voltage, the element resistances, and the fuse’s current rating, return the current through each element, the total current, and whether the fuse rating...
def ferry_circuit_report( voltage: float, resistances: list[float], fuse_rating: float ) -> tuple[tuple[float, ...], float, bool]: """Report branch currents, total current, and fuse status for parallel loads.""" if voltage < 0: raise ValueError("voltage must be nonnegative") if fuse_rating <= 0:...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "simple circuits and Ohm's law", "scenario": "a ferry service", "level": "intermediate", "style": "exercise", "unit_id": "u430971e8e737ab"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 0.75, "mutants": 8, "tests": 5}, "topic": "simple circuits and Ohm's law", "difficulty": 3, "check": {}}
code2.llm:u84ec0b83b64551
code2-llm
code2.llm_exercise
code
train
{"title": "Boundary-Normalized Smoothing", "statement": "Given a sequence of numbers, return a smoothed sequence of the same length. At each position, take the weighted average of that value (weight 2) and its immediate neighbors (weight 1 each), omitting neighbors outside the sequence and adjusting the total weight ac...
from collections.abc import Sequence def smooth_values(values: Sequence[float]) -> list[float]: """Smooth values with a boundary-normalized [1, 2, 1] weighted window.""" result: list[float] = [] for i, value in enumerate(values): weighted_sum = 2 * value total_weight = 2 if i > 0: ...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "moving averages and smoothing", "scenario": "a parcel courier", "level": "intro", "style": "exercise", "unit_id": "u84ec0b83b64551"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 1.0, "mutants": 8, "tests": 6}, "topic": "moving averages and smoothing", "difficulty": 1, "check": {}}
code2.llm:u8d64d891a2b76c
code2-llm
code2.llm_exercise
code
train
{"title": "LRU Eviction Trace", "statement": "Given a nonnegative cache capacity and a sequence of integer accesses, return the keys evicted, in eviction order, while processing the sequence with a least-recently-used policy. An access to a cached key makes it the most recently used; a new key evicts the least recently...
from collections import OrderedDict def lru_evictions(capacity: int, accesses: list[int]) -> list[int]: """Return evicted keys in order for the given LRU cache accesses.""" cache: OrderedDict[int, None] = OrderedDict() evicted: list[int] = [] for key in accesses: if key in cache: ...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "an LRU cache", "scenario": "a recipe book", "level": "intro", "style": "exercise", "unit_id": "u8d64d891a2b76c"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 1.0, "mutants": 7, "tests": 6}, "topic": "an LRU cache", "difficulty": 1, "check": {}}
code2.llm:udcced85cc8e923
code2-llm
code2.llm_exercise
code
train
{"title": "Bakery Reserve Growth", "statement": "A bakery deposits money into a reserve for replacing its ovens, earning interest compounded monthly at a nominal annual rate. Define the monthly deposit as occurring at the end of each month, after that month’s interest is added. Return the reserve balance after the give...
def bakery_reserve(initial_balance: float, monthly_deposit: float, annual_rate: float, months: int) -> float: """Return a bakery reserve's balance after monthly compounding and deposits.""" balance = initial_balance monthly_rate = annual_rate / 12 for _ in range(months): balance = balance * (1 +...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "compound interest", "scenario": "a bakery", "level": "intermediate", "style": "exercise", "unit_id": "udcced85cc8e923"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 1.0, "mutants": 8, "tests": 5}, "topic": "compound interest", "difficulty": 3, "check": {}}
code2.llm:u4df130b9c98e1c
code2-llm
code2.llm_exercise
code
train
{"title": "Character-Bigram Jaccard Similarity", "statement": "Compare two strings using the Jaccard similarity of their sets of adjacent two-character substrings, treating uppercase and lowercase characters as distinct. Return the size of the intersection divided by the size of the union. If both strings produce no su...
def bigram_jaccard(first: str, second: str) -> float: """Return the Jaccard similarity of the strings' character bigram sets.""" def bigrams(text: str) -> set[str]: return {text[index:index + 2] for index in range(len(text) - 1)} left = bigrams(first) right = bigrams(second) union = left | ...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "string similarity", "scenario": "a recycling centre", "level": "intro", "style": "fix", "unit_id": "u4df130b9c98e1c"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 1.0, "mutants": 8, "tests": 6, "bug_fails_a_test": true, "bug_lines_changed": 1}, "topic": "string similarity", "difficulty": 1, "check": {}}
code2.llm:u224b6edfac323f
code2-llm
code2.llm_exercise
code
train
{"title": "Greenhouse Potting Queue", "statement": "At a greenhouse potting bench, customers arrive in nondecreasing order of arrival time, and one attendant serves them in arrival order. Given equally sized lists of nonnegative arrival times and service durations in minutes, return each customer’s waiting time; a cust...
def potting_wait_times(arrivals: list[int], service_times: list[int]) -> list[int]: """Return each greenhouse customer's wait in a single-server FIFO queue.""" finished_at = 0 waits = [] for arrival, duration in zip(arrivals, service_times): start = max(arrival, finished_at) waits.append...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "simulating a queue of customers", "scenario": "a greenhouse", "level": "intermediate", "style": "fix", "unit_id": "u224b6edfac323f"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 1.0, "mutants": 8, "tests": 6, "bug_fails_a_test": true, "bug_lines_changed": 1}, "topic": "simulating a queue of customers", "difficulty": 3, "check": {}}
code2.llm:uafe9df7a34bc21
code2-llm
code2.llm_exercise
code
train
{"title": "Bakery Batch Factorizations", "statement": "A bakery receives orders for positive numbers of rolls, and wants to group each order size into prime-sized factors. Implement `factor_bake_orders(order_sizes)`, returning one prime factorization per order in the same order, with each factorization represented as a...
from math import isqrt def factor_bake_orders(order_sizes: list[int]) -> list[list[tuple[int, int]]]: """Return the prime factorizations of positive bakery order sizes.""" if any(size < 1 for size in order_sizes): raise ValueError("order sizes must be positive") limit = max(order_sizes, default=1...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "prime sieves and factorisation", "scenario": "a bakery", "level": "intro", "style": "exercise", "unit_id": "uafe9df7a34bc21"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 1.0, "mutants": 8, "tests": 6}, "topic": "prime sieves and factorisation", "difficulty": 1, "check": {}}
code2.llm:ubdfc87a2ed1fca
code2-llm
code2.llm_exercise
code
train
{"title": "Recipe Ingredient Totals", "statement": "A recipe book maps each recipe to a list of components and the amount of each component it uses; a component may be another recipe or a leaf ingredient. Return the total amount of a requested leaf ingredient needed to make one batch of a named recipe, expanding nested...
from functools import cache def total_ingredient( book: dict[str, list[tuple[str, int]]], recipe: str, ingredient: str ) -> int: """Count a leaf ingredient used in one batch of a recipe.""" @cache def amount(recipe_name: str) -> int: total = 0 for component, quantity in book.get(recipe...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "recursion and memoisation", "scenario": "a recipe book", "level": "intermediate", "style": "exercise", "unit_id": "ubdfc87a2ed1fca"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 1.0, "mutants": 7, "tests": 6}, "topic": "recursion and memoisation", "difficulty": 3, "check": {}}
code2.llm:ud00e706c7c1407
code2-llm
code2.llm_exercise
code
train
{"title": "Forward Difference Table", "statement": "Given a finite list of integers, return its forward-difference table as a list of rows. The first row is the original values; each following row contains the differences between adjacent entries in the previous row, stopping when a row has one entry. Return an empty l...
def forward_difference_table(values: list[int]) -> list[list[int]]: """Return successive forward-difference rows without changing values.""" if not values: return [] table = [values.copy()] while len(table[-1]) > 1: previous = table[-1] table.append([right - left for left, right...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "finite differences", "scenario": "a bicycle shop", "level": "intermediate", "style": "exercise", "unit_id": "ud00e706c7c1407"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 1.0, "mutants": 8, "tests": 6}, "topic": "finite differences", "difficulty": 3, "check": {}}
code2.llm:u7a43e16e24fd1b
code2-llm
code2.llm_exercise
code
train
{"title": "Flattened Game Board Data", "statement": "A game board is stored as a JSON object whose values may contain nested objects, arrays, or scalar values. Create a flat dictionary with dot-separated paths, using array indices as path components, such as `tiles.0.kind`. Preserve empty objects and arrays as values a...
from typing import Any def flatten_board(board: dict[str, Any]) -> dict[str, Any]: """Flatten nested board data into a dictionary of dot-separated paths.""" flattened: dict[str, Any] = {} def visit(value: Any, path: str) -> None: if isinstance(value, dict) and value: for key, child in...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "flattening nested JSON", "scenario": "a game board", "level": "intro", "style": "fix", "unit_id": "u7a43e16e24fd1b"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 1.0, "mutants": 7, "tests": 6, "bug_fails_a_test": true, "bug_lines_changed": 2}, "topic": "flattening nested JSON", "difficulty": 1, "check": {}}
code2.llm:uba922aea00363c
code2-llm
code2.llm_exercise
code
train
{"title": "LRU Access Trace", "statement": "Given a nonnegative cache capacity and a sequence of integer keys, simulate accesses to a least-recently-used cache. Return the number of cache misses and the final keys ordered from most recently used to least recently used. A hit makes that key most recent; a miss inserts t...
from collections import OrderedDict def lru_trace(capacity: int, requests: list[int]) -> tuple[int, list[int]]: """Return the miss count and final cache keys, most recent first.""" cache: OrderedDict[int, None] = OrderedDict() misses = 0 for key in requests: if key in cache: cache...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "an LRU cache", "scenario": "a coffee roaster", "level": "advanced", "style": "fix", "unit_id": "uba922aea00363c"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 1.0, "mutants": 8, "tests": 6, "bug_fails_a_test": true, "bug_lines_changed": 1}, "topic": "an LRU cache", "difficulty": 5, "check": {}}
code2.llm:u6a66e0d432e4ed
code2-llm
code2.llm_exercise
code
train
{"title": "Timetable Region Area", "statement": "A school timetable planner marks a study block whose boundary may be an irregular polygon on the schedule grid. Given the polygon’s corner coordinates in order, return the area it covers in square grid units; the polygon is simple, and its first corner need not be repeat...
def timetable_region_area(vertices: list[tuple[float, float]]) -> float: """Return the area enclosed by an ordered polygon of timetable coordinates.""" if len(vertices) < 3: return 0.0 twice_area = sum( x1 * y2 - x2 * y1 for (x1, y1), (x2, y2) in zip(vertices, vertices[1:] + vertices...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "geometry of polygons", "scenario": "a school timetable", "level": "intermediate", "style": "fix", "unit_id": "u6a66e0d432e4ed"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 0.625, "mutants": 8, "tests": 7, "bug_fails_a_test": true, "bug_lines_changed": 1}, "topic": "geometry of polygons", "difficulty": 3, "check": {}}
code2.llm:u19b6212c54477c
code2-llm
code2.llm_exercise
code
train
{"title": "Gate Assistance Request Totals", "statement": "At an airport gate, each position in a row of service desks has a count of wheelchair-assistance requests. Process events that either replace the count at one position or ask for the total across an inclusive range of positions, returning the totals in query ord...
from typing import Sequence def gate_request_totals( counts: Sequence[int], events: Sequence[tuple[str, int, int]] ) -> list[int]: """Process desk-count updates and inclusive range-sum queries.""" size = 1 while size < len(counts): size *= 2 tree = [0] * (2 * size) for index, value in ...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "a segment tree for range sums", "scenario": "an airport gate", "level": "intermediate", "style": "exercise", "unit_id": "u19b6212c54477c"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 1.0, "mutants": 8, "tests": 6}, "topic": "a segment tree for range sums", "difficulty": 3, "check": {}}
code2.llm:u944d1299710f5e
code2-llm
code2.llm_exercise
code
train
{"title": "Fixed-Width Accumulation Trace", "statement": "Given a starting integer, a sequence of increments, a bit width, and a signedness flag, return the sequence of accumulator values after normalizing the start and after each increment. Unsigned values wrap into the range from zero to one less than the modulus; si...
def wrap_trace(start: int, increments: tuple[int, ...], bits: int, signed: bool = True) -> tuple[int, ...]: """Return the normalized accumulator value at each step, including the start.""" if bits <= 0: raise ValueError("bits must be positive") modulus = 1 << bits sign_boundary = modulus >> 1 ...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "fixed-width integer wraparound", "scenario": "a laboratory", "level": "intermediate", "style": "fix", "unit_id": "u944d1299710f5e"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 0.875, "mutants": 8, "tests": 6, "bug_fails_a_test": true, "bug_lines_changed": 1}, "topic": "fixed-width integer wraparound", "difficulty": 3, "check": {}}
code2.llm:uaaeffced089f28
code2-llm
code2.llm_exercise
code
train
{"title": "Milk-Test Ring Buffer", "statement": "A dairy farm keeps each cow’s latest milk-fat test readings in oldest-to-newest order. Implement `add_milk_reading` to return a new list with the latest reading appended, keeping at most `capacity` readings and dropping the oldest when necessary. Assume `capacity` is pos...
def add_milk_reading(readings: list[float], new_reading: float, capacity: int) -> list[float]: """Append a milk test reading while retaining only the newest readings.""" if capacity <= 0: raise ValueError("capacity must be positive") return (readings + [new_reading])[-capacity:]
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "a ring buffer", "scenario": "a farm", "level": "intro", "style": "fix", "unit_id": "uaaeffced089f28"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 0.667, "mutants": 3, "tests": 6, "bug_fails_a_test": true, "bug_lines_changed": 1}, "topic": "a ring buffer", "difficulty": 1, "check": {}}
code2.llm:u29328a2882ba72
code2-llm
code2.llm_exercise
code
train
{"title": "Payroll Prime-Factor Audit", "statement": "A payroll run records each employee’s payment as a positive number of cents. Return the zero-based index and prime factorization of each payment whose amount has exactly two distinct prime factors; represent each factorization as a tuple of `(prime, exponent)` pairs...
def audit_payroll_amounts(amounts: list[int]) -> list[tuple[int, tuple[tuple[int, int], ...]]]: """Return indices and factorizations of payments with two distinct primes.""" if any(amount < 1 for amount in amounts): raise ValueError("payment amounts must be positive") limit = max(amounts, default=1)...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "prime sieves and factorisation", "scenario": "a payroll run", "level": "advanced", "style": "exercise", "unit_id": "u29328a2882ba72"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 0.875, "mutants": 8, "tests": 6}, "topic": "prime sieves and factorisation", "difficulty": 5, "check": {}}
code2.llm:u1e8b8c83dd3ba4
code2-llm
code2.llm_exercise
code
train
{"title": "Theatre Zone Settlement", "statement": "A theatre box office records ticket counts by seating zone in four sparse dictionaries: advance sales, walk-up sales, complimentary tickets, and voided tickets. Return the net count for each zone after combining the first three dictionaries and subtracting voids; omit ...
def settle_zone_counts( advance: dict[str, int], walk_up: dict[str, int], complimentary: dict[str, int], voided: dict[str, int], ) -> dict[str, int]: """Return nonzero net ticket counts by seating zone.""" totals: dict[str, int] = {} for source in (advance, walk_up, complimentary): f...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "sparse vectors as dicts", "scenario": "a theatre box office", "level": "intermediate", "style": "fix", "unit_id": "u1e8b8c83dd3ba4"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 0.833, "mutants": 6, "tests": 6, "bug_fails_a_test": true, "bug_lines_changed": 1}, "topic": "sparse vectors as dicts", "difficulty": 3, "check": {}}
code2.llm:u79e52a29b0ceb3
code2-llm
code2.llm_exercise
code
train
{"title": "Centered Sparse Correlation", "statement": "Given two sparse vectors represented by dictionaries from coordinate indices to numeric values, compute their Pearson correlation over a specified vector dimension, treating missing coordinates as zero. The dimension must be positive, and every supplied index must ...
from collections.abc import Mapping def centered_sparse_correlation( a: Mapping[int, float], b: Mapping[int, float], dimension: int ) -> float: """Return Pearson correlation of sparse vectors over all coordinates.""" if dimension <= 0: raise ValueError("dimension must be positive") if any(inde...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "sparse vectors as dicts", "scenario": "a music playlist", "level": "advanced", "style": "exercise", "unit_id": "u79e52a29b0ceb3"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 0.875, "mutants": 8, "tests": 6}, "topic": "sparse vectors as dicts", "difficulty": 5, "check": {}}
code2.llm:u785bb660a6e7fa
code2-llm
code2.llm_exercise
code
train
{"title": "Vault Replenishment Shares", "statement": "A small bank has a vault replenishment amount, measured in cents, to divide among service desks in proportion to their cash requests. Return one integer-cent allocation per request, using the largest-remainder method so the allocations sum exactly to the amount; tie...
def allocate_vault_replenishment(amount_cents: int, requests: list[int]) -> list[int]: """Allocate vault replenishment cents in proportion to desk requests.""" if amount_cents < 0 or any(request < 0 for request in requests): raise ValueError("amount and requests must be nonnegative") total = sum(req...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "pro-rata allocation of an amount", "scenario": "a small bank", "level": "intermediate", "style": "fix", "unit_id": "u785bb660a6e7fa"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 0.75, "mutants": 8, "tests": 6, "bug_fails_a_test": true, "bug_lines_changed": 3}, "topic": "pro-rata allocation of an amount", "difficulty": 3, "check": {}}
code2.llm:u765c07b1f084ea
code2-llm
code2.llm_exercise
code
train
{"title": "Roman Numeral Run Compression", "statement": "Given a string of valid Roman numeral symbols, return the length of its longest consecutive run of identical symbols. Treat an empty string as having run length zero, and do not interpret the string as a numeric value.", "func": "longest_symbol_run", "tests": ["a...
def longest_symbol_run(numeral: str) -> int: """Return the longest consecutive run of one symbol in a Roman numeral string.""" if not numeral: return 0 longest = current = 1 for index in range(1, len(numeral)): if numeral[index] == numeral[index - 1]: current += 1 el...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "roman numerals", "scenario": "a farm", "level": "intermediate", "style": "exercise", "unit_id": "u765c07b1f084ea"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 1.0, "mutants": 8, "tests": 6}, "topic": "roman numerals", "difficulty": 3, "check": {}}
code2.llm:u3d176306458329
code2-llm
code2.llm_exercise
code
train
{"title": "Bank Fee Reconciliation", "statement": "A small bank records a fee as an exact fraction of a transaction amount. Given the amount in cents and the fee rate as a numerator and denominator, return the fee rounded to the nearest whole cent, with exact half-cent ties rounded upward. Amounts and the rate componen...
from fractions import Fraction def fee_in_cents(amount_cents: int, rate_numerator: int, rate_denominator: int) -> int: """Return the fee in cents, rounding exact half-cent ties upward.""" fee = Fraction(amount_cents * rate_numerator, rate_denominator) whole, remainder = divmod(fee.numerator, fee.denominat...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "rational arithmetic with Fraction", "scenario": "a small bank", "level": "intro", "style": "exercise", "unit_id": "u3d176306458329"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 1.0, "mutants": 8, "tests": 6}, "topic": "rational arithmetic with Fraction", "difficulty": 1, "check": {}}
code2.llm:u45161fc2371e63
code2-llm
code2.llm_exercise
code
train
{"title": "Integer Base Encoding", "statement": "Given a nonnegative integer and a base from 2 through 36, return its representation as an uppercase string. Use `0` through `9` for digit values 0 through 9, and `A` through `Z` for values 10 through 35. The representation must not have leading zeroes, except that zero i...
def encode_base(n: int, base: int) -> str: """Return the uppercase representation of n in the given base.""" alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" if n < 0: raise ValueError("n must be nonnegative") if not 2 <= base <= 36: raise ValueError("base must be between 2 and 36") ...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "base conversion", "scenario": "an airport gate", "level": "intro", "style": "exercise", "unit_id": "u45161fc2371e63"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 0.875, "mutants": 8, "tests": 6}, "topic": "base conversion", "difficulty": 1, "check": {}}
code2.llm:uf428f957a8e1b5
code2-llm
code2.llm_exercise
code
train
{"title": "Bus Overcrowding Window", "statement": "A bus route records how many passengers board and alight at each stop; passengers alight before new passengers board. Given these records, the bus capacity, and an allowable total of passenger-stop units above capacity, find the longest contiguous segment of stops whos...
def longest_compliant_segment( boardings: list[int], alightings: list[int], capacity: int, overflow_budget: int, ) -> tuple[int, int]: """Return the earliest longest stop segment within the overflow budget.""" overflow: list[int] = [] onboard = 0 for boarded, alighted in zip(boardings, a...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "sliding windows", "scenario": "a city bus network", "level": "advanced", "style": "exercise", "unit_id": "uf428f957a8e1b5"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 1.0, "mutants": 8, "tests": 6}, "topic": "sliding windows", "difficulty": 5, "check": {}}
code2.llm:u0cad815283399d
code2-llm
code2.llm_exercise
code
train
{"title": "Election Tally in Roman Numerals", "statement": "An election clerk wants to display a precinct’s vote count using Roman numerals. Define zero as `N`; for positive counts, use standard subtractive notation, and accept counts from 0 through 3999 inclusive. Return the numeral as a string.", "func": "votes_to_ro...
def votes_to_roman(votes: int) -> str: """Convert a precinct vote count from 0 through 3999 to Roman numerals.""" if not 0 <= votes <= 3999: raise ValueError("votes must be between 0 and 3999") if votes == 0: return "N" values = ( (1000, "M"), (900, "CM"), (500, "D"), (400, "CD"...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "roman numerals", "scenario": "an election count", "level": "intro", "style": "exercise", "unit_id": "u0cad815283399d"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 0.75, "mutants": 8, "tests": 6}, "topic": "roman numerals", "difficulty": 1, "check": {}}
code2.llm:uc2a2c131ed6f4f
code2-llm
code2.llm_exercise
code
train
{"title": "Alternating Fraction Sum", "statement": "Given a list of numerator-denominator pairs with nonzero denominators, interpret each pair as a fraction. Return the exact sum formed by adding fractions at even indices and subtracting fractions at odd indices, starting from index zero. An empty list has sum zero.", ...
from fractions import Fraction def alternating_fraction_sum(pairs: list[tuple[int, int]]) -> Fraction: """Return the exact alternating sum of the supplied fractions.""" total = Fraction(0) for index, (numerator, denominator) in enumerate(pairs): value = Fraction(numerator, denominator) tot...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "rational arithmetic with Fraction", "scenario": "a bicycle shop", "level": "intro", "style": "exercise", "unit_id": "uc2a2c131ed6f4f"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 1.0, "mutants": 8, "tests": 6}, "topic": "rational arithmetic with Fraction", "difficulty": 1, "check": {}}
code2.llm:ubb737b7ae48b17
code2-llm
code2.llm_exercise
code
train
{"title": "Roman-Numeral Election Tally", "statement": "A precinct report is a pair containing a candidate name and that candidate’s vote total written as a canonical Roman numeral from I through MMMCMXCIX. Return all candidates ordered by total votes from greatest to least, breaking ties by candidate name in ascending...
def rank_candidates(reports: list[tuple[str, str]]) -> list[str]: """Order candidates by summed Roman-numeral precinct vote totals.""" values = {"I": 1, "V": 5, "X": 10, "L": 50, "C": 100, "D": 500, "M": 1000} tokens = ((1000, "M"), (900, "CM"), (500, "D"), (400, "CD"), (100, "C"), (90, "XC"),...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "roman numerals", "scenario": "an election count", "level": "advanced", "style": "fix", "unit_id": "ubb737b7ae48b17"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 0.75, "mutants": 8, "tests": 6, "bug_fails_a_test": true, "bug_lines_changed": 1}, "topic": "roman numerals", "difficulty": 5, "check": {}}
code2.llm:ude15f36469344e
code2-llm
code2.llm_exercise
code
train
{"title": "Greenhouse Propagation Bench", "statement": "A greenhouse has a fixed number of bench slots for propagation batches. Each batch is described by the number of slots it needs and the number of seedlings it produces; choose whole batches, using each at most once, to maximize the total seedlings without exceedin...
def max_seedlings(batches: list[tuple[int, int]], bench_slots: int) -> int: """Return the most seedlings obtainable within the bench-slot limit.""" best = [0] * (bench_slots + 1) for slots, seedlings in batches: for used in range(bench_slots, slots - 1, -1): best[used] = max(best[used], ...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "knapsack-style dynamic programming", "scenario": "a greenhouse", "level": "intermediate", "style": "fix", "unit_id": "ude15f36469344e"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 1.0, "mutants": 8, "tests": 6, "bug_fails_a_test": true, "bug_lines_changed": 1}, "topic": "knapsack-style dynamic programming", "difficulty": 3, "check": {}}
code2.llm:uf45ac9662d05ea
code2-llm
code2.llm_exercise
code
train
{"title": "Canonical label normalization", "statement": "Define a canonical label by applying Unicode NFKC normalization, then Unicode case folding, then NFKC normalization again. Replace every Unicode dash-punctuation character with `-`, and replace U+2018, U+2019, and U+02BC with `'`; collapse each run of whitespace ...
import unicodedata def normalize_label(text: str) -> str: """Normalize a label's Unicode form, punctuation, and whitespace.""" folded = unicodedata.normalize("NFKC", text).casefold() folded = unicodedata.normalize("NFKC", folded) pieces = [] for char in folded: if unicodedata.category(char...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "text normalisation", "scenario": "a small bank", "level": "advanced", "style": "exercise", "unit_id": "uf45ac9662d05ea"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 0.75, "mutants": 4, "tests": 6}, "topic": "text normalisation", "difficulty": 5, "check": {}}
code2.llm:uf12fe226fb79d3
code2-llm
code2.llm_exercise
code
train
{"title": "Aliquot Record Validation", "statement": "A laboratory aliquot record contains a `tube_id`, `volume_ml`, and `temperature_c`; it may also contain unrelated fields. Return `True` only when the tube ID is a nonblank string, the volume is a finite number greater than 0 and at most 50 mL, and the temperature is ...
import math def is_valid_aliquot_record(record: dict[str, object]) -> bool: """Check whether an aliquot record has valid identifying and measurement data.""" tube_id = record.get("tube_id") volume = record.get("volume_ml") temperature = record.get("temperature_c") if not isinstance(tube_id, str) ...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "validating records", "scenario": "a laboratory", "level": "intro", "style": "fix", "unit_id": "uf12fe226fb79d3"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 1.0, "mutants": 8, "tests": 7, "bug_fails_a_test": true, "bug_lines_changed": 1}, "topic": "validating records", "difficulty": 1, "check": {}}
code2.llm:u46cbf0188caf55
code2-llm
code2.llm_exercise
code
train
{"title": "Recipe Book Investment Value", "statement": "A publisher models the cash flows for producing and selling a recipe book, with one amount for each month starting at month zero. Implement a function that returns their net present value when the required monthly discount rate may vary from month to month; each r...
def recipe_book_npv(cash_flows: list[float], monthly_rates: list[float]) -> float: """Return NPV for monthly cash flows under a varying discount schedule.""" if len(monthly_rates) != max(0, len(cash_flows) - 1): raise ValueError("rates must cover each month after month zero") if any(rate <= -1 for r...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "net present value", "scenario": "a recipe book", "level": "advanced", "style": "exercise", "unit_id": "u46cbf0188caf55"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 1.0, "mutants": 8, "tests": 6}, "topic": "net present value", "difficulty": 5, "check": {}}
code2.llm:u478673b25e3136
code2-llm
code2.llm_exercise
code
train
{"title": "Overbooked Ferry Crossings", "statement": "A ferry operator exports crossing records as CSV with the columns `crossing_id`, `route`, `seats`, and `bookings`, where the last two fields are integers. Return the IDs of crossings whose bookings exceed their seats, in the order they appear; bookings equal to seat...
import csv import io def find_overbooked_crossings(csv_text: str) -> list[str]: """Return crossing IDs whose bookings exceed their available seats.""" rows = csv.DictReader(io.StringIO(csv_text)) return [ row["crossing_id"] for row in rows if int(row["bookings"]) > int(row["seats"]...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "parsing CSV text", "scenario": "a ferry service", "level": "intermediate", "style": "exercise", "unit_id": "u478673b25e3136"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 1.0, "mutants": 3, "tests": 5}, "topic": "parsing CSV text", "difficulty": 3, "check": {}}
code2.llm:u8abc5af9f7bee6
code2-llm
code2.llm_exercise
code
train
{"title": "Theatre Box Office Ledger", "statement": "A theatre box office records ticket sales, refunds, and card-processing fees as positive amounts in cents. Given an opening balance and a list of these events, return the balance after each event, in order; the opening balance is not included in the result. Assume th...
def box_office_balances(opening_cents: int, events: list[tuple[str, int]]) -> list[int]: """Return the running balance after each box-office ledger event.""" balance = opening_cents balances = [] for kind, amount in events: if kind == "sale": balance += amount elif kind in ("...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "a tiny bank account ledger", "scenario": "a theatre box office", "level": "intermediate", "style": "fix", "unit_id": "u8abc5af9f7bee6"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 1.0, "mutants": 6, "tests": 5, "bug_fails_a_test": true, "bug_lines_changed": 2}, "topic": "a tiny bank account ledger", "difficulty": 3, "check": {}}
code2.llm:u1dea33d1fd9e40
code2-llm
code2.llm_exercise
code
train
{"title": "Playlist Signal Decay", "statement": "An archived playlist bumper starts with a measurable signal strength that halves every fixed number of minutes. Given its initial strength, the elapsed minutes, and the half-life in minutes, return the remaining strength, including when only part of a half-life has passe...
def remaining_playlist_signal(initial_strength: float, elapsed_minutes: float, half_life_minutes: float) -> float: """Return the signal strength remaining after radioactive-style decay.""" return initial_strength * 0.5 ** (elapsed_minutes / half_life_minutes)
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "radioactive decay and half-life", "scenario": "a music playlist", "level": "intro", "style": "fix", "unit_id": "u1dea33d1fd9e40"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 1.0, "mutants": 3, "tests": 6, "bug_fails_a_test": true, "bug_lines_changed": 2}, "topic": "radioactive decay and half-life", "difficulty": 1, "check": {}}
code2.llm:u46844067db2df2
code2-llm
code2.llm_exercise
code
train
{"title": "Postfix Integer Evaluator", "statement": "Given a nonempty list of tokens in postfix order, evaluate an integer expression using the binary operators `+`, `-`, and `*`, plus the unary operator `neg` for negation. Integer literals may be negative, and every expression is guaranteed to have enough operands and...
def evaluate_postfix(tokens: list[str]) -> int: """Evaluate a valid postfix expression with integer operators.""" stack: list[int] = [] for token in tokens: if token == "neg": stack.append(-stack.pop()) elif token in {"+", "-", "*"}: right = stack.pop() le...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "a stack-based expression evaluator", "scenario": "a library", "level": "intro", "style": "exercise", "unit_id": "u46844067db2df2"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 1.0, "mutants": 8, "tests": 7}, "topic": "a stack-based expression evaluator", "difficulty": 1, "check": {}}
code2.llm:u8a79957f312093
code2-llm
code2.llm_exercise
code
train
{"title": "Circular Buffer Snapshot", "statement": "Implement `buffer_snapshot(capacity, values, count)` for a fixed-size ring buffer whose slots initially contain `None`. Insert the values in order, overwriting the oldest slot whenever the buffer is full, then return the buffer’s contents from oldest to newest togethe...
from typing import Sequence def buffer_snapshot(capacity: int, values: Sequence[int], count: int) -> tuple[list[int], int]: """Return retained values oldest-first and the next slot to write.""" if capacity <= 0: raise ValueError("capacity must be positive") if count < 0: raise ValueError("...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "a ring buffer", "scenario": "a school timetable", "level": "intro", "style": "exercise", "unit_id": "u8a79957f312093"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 0.625, "mutants": 8, "tests": 6}, "topic": "a ring buffer", "difficulty": 1, "check": {}}
code2.llm:u30d243dc1bd435
code2-llm
code2.llm_exercise
code
train
{"title": "Call-panel lamp current", "statement": "A hospital ward call panel uses an LED indicator in series with a resistor. Given the supply voltage, the LED’s forward voltage, and the positive resistor value in ohms, return the circuit current in milliamps. If the supply voltage is no greater than the LED’s forward...
def call_panel_current_ma(supply_voltage: float, led_voltage: float, resistor_ohms: float) -> float: """Return the current through a ward call-panel LED, in milliamps.""" if resistor_ohms <= 0: raise ValueError("resistor_ohms must be positive") voltage_across_resistor = max(0.0, supply_voltage - led...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "simple circuits and Ohm's law", "scenario": "a hospital ward", "level": "intro", "style": "fix", "unit_id": "u30d243dc1bd435"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 0.875, "mutants": 8, "tests": 6, "bug_fails_a_test": true, "bug_lines_changed": 1}, "topic": "simple circuits and Ohm's law", "difficulty": 1, "check": {}}
code2.llm:u4fe2b4e7cbba40
code2-llm
code2.llm_exercise
code
train
{"title": "Shortest Open-Cell Route", "statement": "Given a rectangular grid of zeros and ones, find the fewest orthogonal moves from a start coordinate to a target coordinate, moving only through cells containing zero. Return -1 if either endpoint is blocked or no route exists. Coordinates are given as (row, column) p...
from collections import deque def shortest_open_path( grid: list[list[int]], start: tuple[int, int], target: tuple[int, int] ) -> int: """Return the shortest orthogonal path length through zero-valued cells, or -1.""" rows, cols = len(grid), len(grid[0]) sr, sc = start tr, tc = target if grid[...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "breadth-first search on a grid", "scenario": "an airport gate", "level": "intro", "style": "fix", "unit_id": "u4fe2b4e7cbba40"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 0.875, "mutants": 8, "tests": 6, "bug_fails_a_test": true, "bug_lines_changed": 1}, "topic": "breadth-first search on a grid", "difficulty": 1, "check": {}}
code2.llm:u76b7f3981fabf5
code2-llm
code2.llm_exercise
code
train
{"title": "Ski Rental Inventory Update", "statement": "A ski resort tracks rental equipment by item name and quantity in stock. Given the current inventory and a list of signed quantity changes, return an updated dictionary, combining repeated item names and omitting items whose final quantity is zero. Changes are appl...
def update_rental_inventory(inventory: dict[str, int], changes: list[tuple[str, int]]) -> dict[str, int]: """Apply rental-equipment quantity changes and omit items with no stock.""" updated = inventory.copy() for item, change in changes: updated[item] = updated.get(item, 0) + change return {item...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "inventory updates", "scenario": "a ski resort", "level": "intro", "style": "exercise", "unit_id": "u76b7f3981fabf5"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 1.0, "mutants": 6, "tests": 6}, "topic": "inventory updates", "difficulty": 1, "check": {}}
code2.llm:u3b2bdf811c3a56
code2-llm
code2.llm_exercise
code
train
{"title": "Train Call Flag Filter", "statement": "Each train call is packed into an integer: bits 0–10 hold its departure minute, bits 11–14 its platform number, and bits 15–18 four service flags (express, step-free, bicycle, and engineering, from least to most significant). Given a list of calls, a platform mask, and ...
def filter_train_calls( calls: list[int], platform_mask: int, required_flags: int, forbidden_flags: int ) -> list[tuple[int, int]]: """Return valid train calls matching the platform and flag masks.""" results: list[tuple[int, int]] = [] for call in calls: if call < 0 or call >> 19: c...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "bit fields and flags", "scenario": "a train timetable", "level": "advanced", "style": "exercise", "unit_id": "u3b2bdf811c3a56"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 0.875, "mutants": 8, "tests": 7}, "topic": "bit fields and flags", "difficulty": 5, "check": {}}
code2.llm:u96ac050cb77737
code2-llm
code2.llm_exercise
code
train
{"title": "Worksite Payroll Totals", "statement": "A payroll run contains records of `(worksite, hours, hourly_rate_cents)`, where hours are whole numbers and the rate is in cents per hour. Return a dictionary mapping each worksite appearing in the records to its total pay in cents. A worksite with zero total hours sti...
def payroll_totals(records: list[tuple[str, int, int]]) -> dict[str, int]: """Return total pay in cents for each worksite in a payroll run.""" totals: dict[str, int] = {} for worksite, hours, hourly_rate_cents in records: totals[worksite] = totals.get(worksite, 0) + hours * hourly_rate_cents ret...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "grouping and aggregating records", "scenario": "a payroll run", "level": "intro", "style": "exercise", "unit_id": "u96ac050cb77737"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 1.0, "mutants": 4, "tests": 5}, "topic": "grouping and aggregating records", "difficulty": 1, "check": {}}
code2.llm:u859da61e690265
code2-llm
code2.llm_exercise
code
train
{"title": "Distance Between 3D Lines", "statement": "Given two pairs of points in three-dimensional space, treat each pair as defining a line; if a pair contains the same point twice, treat it as a single point instead. Return the minimum Euclidean distance between the resulting lines or points. The function must handl...
from math import sqrt def line_or_point_distance_3d( a: tuple[float, float, float], b: tuple[float, float, float], c: tuple[float, float, float], d: tuple[float, float, float], ) -> float: """Return the minimum distance between two 3D lines or point-degeneracies.""" def subtract(x: tuple[float...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "points, lines and distances", "scenario": "a school timetable", "level": "advanced", "style": "exercise", "unit_id": "u859da61e690265"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 1.0, "mutants": 8, "tests": 6}, "topic": "points, lines and distances", "difficulty": 5, "check": {}}
code2.llm:uccc45cb8d0b35f
code2-llm
code2.llm_exercise
code
train
{"title": "Low-fragmentation party seating", "statement": "A theatre row is represented by an integer bitmask in which bit 0 is the first seat and a set bit means the seat is occupied; rows are listed in box-office order. Choose a row and starting seat for a party that needs a contiguous block of vacant seats, minimizi...
def choose_party_block(occupied_rows: list[int], seat_count: int, party_size: int) -> tuple[int, int] | None: """Choose a fitting party block that leaves the fewest vacant sections.""" full_mask = (1 << seat_count) - 1 party_mask = (1 << party_size) - 1 best: tuple[int, int, int] | None = None for ...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "bit manipulation", "scenario": "a theatre box office", "level": "advanced", "style": "exercise", "unit_id": "uccc45cb8d0b35f"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 0.625, "mutants": 8, "tests": 7}, "topic": "bit manipulation", "difficulty": 5, "check": {}}
code2.llm:u673b5b1fbbe330
code2-llm
code2.llm_exercise
code
train
{"title": "Reachable Timetable Stops", "statement": "A timetable lists pairs of stops connected by a direct train service; treat each service as usable in either direction. Given the stop names, the services, and a starting stop, return the names of all stops reachable from the start, including the start itself, in alp...
def reachable_stops(stops: list[str], services: list[tuple[str, str]], start: str) -> list[str]: """Return stops reachable from start in the undirected timetable graph.""" neighbors = {stop: set() for stop in stops} for first, second in services: neighbors[first].add(second) neighbors[second...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "depth-first search and connected components", "scenario": "a train timetable", "level": "intro", "style": "exercise", "unit_id": "u673b5b1fbbe330"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 1.0, "mutants": 8, "tests": 6}, "topic": "depth-first search and connected components", "difficulty": 1, "check": {}}
code2.llm:u6a8c4b58f24fb2
code2-llm
code2.llm_exercise
code
train
{"title": "Distance to a Line Segment", "statement": "Given a point and the two endpoints of a line segment in the plane, return the shortest Euclidean distance from the point to the segment. The nearest point may lie in the segment’s interior or at an endpoint. If both endpoints are identical, treat the segment as a s...
import math def distance_to_segment( point: tuple[float, float], start: tuple[float, float], end: tuple[float, float], ) -> float: """Return the shortest Euclidean distance from point to a closed segment.""" px, py = point sx, sy = start ex, ey = end dx = ex - sx dy = ey - sy l...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "points, lines and distances", "scenario": "a solar array", "level": "intro", "style": "exercise", "unit_id": "u6a8c4b58f24fb2"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 0.875, "mutants": 8, "tests": 6}, "topic": "points, lines and distances", "difficulty": 1, "check": {}}
code2.llm:u30928c7f221021
code2-llm
code2.llm_exercise
code
train
{"title": "Ward Supply Totals", "statement": "A ward’s restock CSV has a header with `supply` and `units` columns, followed by supply deliveries. Return a dictionary that sums the integer units for each supply name; repeated names are combined, and quoted names may contain commas. The CSV is assumed to have valid heade...
import csv from io import StringIO def ward_supply_totals(csv_text: str) -> dict[str, int]: """Sum delivered units by supply name in a ward's CSV text.""" totals: dict[str, int] = {} reader = csv.DictReader(StringIO(csv_text, newline="")) for row in reader: supply = row["supply"] units ...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "parsing CSV text", "scenario": "a hospital ward", "level": "intro", "style": "fix", "unit_id": "u30928c7f221021"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 1.0, "mutants": 6, "tests": 6, "bug_fails_a_test": true, "bug_lines_changed": 1}, "topic": "parsing CSV text", "difficulty": 1, "check": {}}
code2.llm:u2f3ce5c85a125f
code2-llm
code2.llm_exercise
code
train
{"title": "Garden Plan CRC", "statement": "A garden plan is serialized as bytes, with each byte representing a plot marker or a separator. Implement `garden_crc16` to return its CRC-16/CCITT-FALSE checksum: process bytes from left to right, starting at `0xFFFF`, using polynomial `0x1021`, with no reflection and no fina...
def garden_crc16(plan: bytes) -> int: """Return the CRC-16/CCITT-FALSE checksum of serialized garden-plan bytes.""" crc = 0xFFFF for byte in plan: crc ^= byte << 8 for _ in range(8): if crc & 0x8000: crc = (crc << 1) ^ 0x1021 else: crc ...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "CRC and checksums", "scenario": "a garden plan", "level": "advanced", "style": "exercise", "unit_id": "u2f3ce5c85a125f"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 1.0, "mutants": 8, "tests": 5}, "topic": "CRC and checksums", "difficulty": 5, "check": {}}
code2.llm:uf9b155c42deac7
code2-llm
code2.llm_exercise
code
train
{"title": "Normalized Transposition Similarity", "statement": "Define the similarity of two strings as one minus their optimal-string-alignment distance divided by twice the length of the longer string. In this distance, insertion and deletion cost 1, substitution costs 2, and swapping two adjacent characters costs 1; ...
def transposition_similarity(a: str, b: str) -> float: """Return normalized optimal-string-alignment similarity for two strings.""" m, n = len(a), len(b) if m == 0 and n == 0: return 1.0 distance = [[0] * (n + 1) for _ in range(m + 1)] for i in range(m + 1): distance[i][0] = i f...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "string similarity", "scenario": "a weather station", "level": "advanced", "style": "exercise", "unit_id": "uf9b155c42deac7"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 1.0, "mutants": 8, "tests": 7}, "topic": "string similarity", "difficulty": 5, "check": {}}
code2.llm:udd8280dbe0414d
code2-llm
code2.llm_exercise
code
train
{"title": "Barn Door Latches", "statement": "A farm's door-latch panel stores its status as a nonnegative integer bit field, with bit 0 representing door 1, bit 1 representing door 2, and so on. Return a list of the door numbers whose latch bits are set, in ascending order. If no latch bits are set, return an empty lis...
def latched_barn_doors(mask: int) -> list[int]: """Return the 1-based door numbers whose latch bits are set.""" doors = [] door_number = 1 while mask: if mask & 1: doors.append(door_number) mask >>= 1 door_number += 1 return doors
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "bit fields and flags", "scenario": "a farm", "level": "intro", "style": "exercise", "unit_id": "udd8280dbe0414d"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 1.0, "mutants": 8, "tests": 6}, "topic": "bit fields and flags", "difficulty": 1, "check": {}}
code2.llm:uda8db95f236044
code2-llm
code2.llm_exercise
code
train
{"title": "Recipe Batch Formula Evaluator", "statement": "A recipe book stores ingredient-quantity formulas in postfix notation, where each token is either a nonnegative integer or one of `+`, `-`, and `*`. Implement `evaluate_batch_formula(tokens)` to return the integer result of a valid formula; each operator uses th...
def evaluate_batch_formula(tokens: list[str]) -> int: """Evaluate a valid postfix formula for a recipe batch.""" stack: list[int] = [] operations = { "+": lambda left, right: left + right, "-": lambda left, right: left - right, "*": lambda left, right: left * right, } for tok...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "a stack-based expression evaluator", "scenario": "a recipe book", "level": "intro", "style": "exercise", "unit_id": "uda8db95f236044"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 1.0, "mutants": 8, "tests": 6}, "topic": "a stack-based expression evaluator", "difficulty": 1, "check": {}}
code2.llm:uf8a148d92aef72
code2-llm
code2.llm_exercise
code
train
{"title": "Greenhouse Sensor Flattening", "statement": "A greenhouse logger stores sensor readings in nested dictionaries, with keys representing room, bench, and measurement. Define `flatten_sensor_readings(data)` to return a flat dictionary whose keys are the original key paths joined with dots and whose values are t...
def flatten_sensor_readings(data: dict[str, object]) -> dict[str, object]: """Flatten nested dictionaries using dot-separated key paths.""" flattened: dict[str, object] = {} def visit(value: object, path: str) -> None: if isinstance(value, dict) and value: for key, child in value.items(...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "flattening nested JSON", "scenario": "a greenhouse", "level": "intro", "style": "exercise", "unit_id": "uf8a148d92aef72"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 1.0, "mutants": 3, "tests": 6}, "topic": "flattening nested JSON", "difficulty": 1, "check": {}}
code2.llm:u89bfcbd6c802b2
code2-llm
code2.llm_exercise
code
train
{"title": "Pressure Unit Conversion", "statement": "Convert a pressure value between pascals (`Pa`), kilopascals (`kPa`), bars (`bar`), standard atmospheres (`atm`), and pounds per square inch (`psi`). Return the converted value as a float, and raise `ValueError` if either unit name is unsupported. The conversion must ...
def convert_pressure(value: float, source: str, target: str) -> float: """Convert a pressure value between supported units.""" pascals_per_unit = { "Pa": 1.0, "kPa": 1_000.0, "bar": 100_000.0, "atm": 101_325.0, "psi": 6_894.757293168, } if source not in pascals_pe...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "unit conversion", "scenario": "a laboratory", "level": "intermediate", "style": "exercise", "unit_id": "u89bfcbd6c802b2"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 0.75, "mutants": 4, "tests": 6}, "topic": "unit conversion", "difficulty": 3, "check": {}}
code2.llm:uf28aefdc0352fa
code2-llm
code2.llm_exercise
code
train
{"title": "Roaster Tray Window Weights", "statement": "A coffee roaster records the bean weight, in grams, added during each successive tray fill. Given those weights and a positive window size, return the total weight for every consecutive group of that many fills, in order. Return an empty list when the window is lar...
def tray_window_weights(weights: list[int], window: int) -> list[int]: """Return the total bean weight for each consecutive fill window.""" prefix = [0] for weight in weights: prefix.append(prefix[-1] + weight) return [ prefix[start + window] - prefix[start] for start in range(le...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "prefix sums", "scenario": "a coffee roaster", "level": "intro", "style": "exercise", "unit_id": "uf28aefdc0352fa"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 0.875, "mutants": 8, "tests": 6}, "topic": "prefix sums", "difficulty": 1, "check": {}}
code2.llm:ubf96c69cf77d20
code2-llm
code2.llm_exercise
code
train
{"title": "Airport Gate Transfer Loop", "statement": "An airport records one-way passenger transfers between gates. Given the gate labels and a list of directed transfers, return whether it is possible to follow transfers and eventually return to a gate already visited; every transfer endpoint is included in the gate l...
from collections import deque from typing import Sequence def has_gate_transfer_cycle( gates: Sequence[str], transfers: Sequence[tuple[str, str]] ) -> bool: """Return whether the directed gate-transfer network contains a cycle.""" outgoing = {gate: [] for gate in gates} indegree = {gate: 0 for gate in...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "cycle detection in a directed graph", "scenario": "an airport gate", "level": "intro", "style": "exercise", "unit_id": "ubf96c69cf77d20"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 1.0, "mutants": 8, "tests": 6}, "topic": "cycle detection in a directed graph", "difficulty": 1, "check": {}}
code2.llm:ubf0cb79213d883
code2-llm
code2.llm_exercise
code
train
{"title": "Election Recount Windows", "statement": "During an election count, observers propose time windows for recounting individual ballot boxes, each given as a start and end time. Choose the largest set of non-overlapping windows, treating a window ending at time t as compatible with one starting at t. Return the ...
def select_recount_windows(windows: list[tuple[int, int]]) -> list[int]: """Return indices of a largest compatible set of recount windows.""" ordered = sorted( (end, start, index) for index, (start, end) in enumerate(windows) ) chosen: list[int] = [] last_end: int | None = None f...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "interval scheduling", "scenario": "an election count", "level": "intermediate", "style": "exercise", "unit_id": "ubf0cb79213d883"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 0.667, "mutants": 6, "tests": 6}, "topic": "interval scheduling", "difficulty": 3, "check": {}}
code2.llm:ucda96d13799de2
code2-llm
code2.llm_exercise
code
train
{"title": "Weather Station Huffman Codes", "statement": "A weather station records distinct nonempty sensor symbols with positive occurrence counts. Return a dictionary assigning each symbol its canonical Huffman bit string: build a Huffman tree, then order codes by length and symbol, assigning consecutive binary value...
import heapq from typing import Sequence def weather_huffman_codes(counts: Sequence[tuple[str, int]]) -> dict[str, str]: """Build deterministic canonical Huffman codes for weather symbols.""" if not counts: return {} heap: list[tuple[int, str, int, object]] = [] serial = 0 for symbol, cou...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "Huffman coding", "scenario": "a weather station", "level": "advanced", "style": "exercise", "unit_id": "ucda96d13799de2"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 0.75, "mutants": 8, "tests": 6}, "topic": "Huffman coding", "difficulty": 5, "check": {}}
code2.llm:uc55a658ed8ec39
code2-llm
code2.llm_exercise
code
train
{"title": "Periodic Half-Life Threshold", "statement": "A repeating schedule lists the half-life that applies during each consecutive one-unit phase. Given a positive initial quantity, a target quantity no greater than the initial quantity, and a nonempty schedule of positive half-lives, return the elapsed time when th...
import math from collections.abc import Sequence def periodic_half_life_time( initial: float, target: float, half_lives: Sequence[float] ) -> float: """Return when a repeating half-life schedule reaches the target quantity.""" required = math.log(initial / target) if required == 0: return 0.0 ...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "radioactive decay and half-life", "scenario": "a coffee roaster", "level": "advanced", "style": "fix", "unit_id": "uc55a658ed8ec39"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 0.875, "mutants": 8, "tests": 6, "bug_fails_a_test": true, "bug_lines_changed": 1}, "topic": "radioactive decay and half-life", "difficulty": 5, "check": {}}
code2.llm:u386d8eb6de5906
code2-llm
code2.llm_exercise
code
train
{"title": "Stable Solar Output Windows", "statement": "A solar array records a nonnegative integer output for each panel in sequence. Return the starting indices of all contiguous windows of the requested positive width whose total output is at least `min_energy` and whose highest and lowest readings differ by at most ...
from collections import deque def stable_solar_windows( outputs: list[int], width: int, min_energy: int, max_spread: int ) -> list[int]: """Find qualifying fixed-width windows of solar output readings.""" if width <= 0 or max_spread < 0: raise ValueError("width must be positive and max_spread nonn...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "sliding windows", "scenario": "a solar array", "level": "advanced", "style": "fix", "unit_id": "u386d8eb6de5906"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 0.625, "mutants": 8, "tests": 6, "bug_fails_a_test": true, "bug_lines_changed": 2}, "topic": "sliding windows", "difficulty": 5, "check": {}}
code2.llm:u10f301c64e3cfb
code2-llm
code2.llm_exercise
code
train
{"title": "Game Board Move Log", "statement": "A game board records moves as strings in the form `player:row,column`, where player is a nonempty name and row and column are nonnegative integers. Implement a function that parses a sequence of log lines and returns a dictionary mapping each player to the number of moves ...
from collections.abc import Iterable def count_board_moves(lines: Iterable[str], height: int, width: int) -> dict[str, int]: """Count valid logged moves per player on a rectangular board.""" counts: dict[str, int] = {} if height <= 0 or width <= 0: return counts for line in lines: if ...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "parsing simple logs", "scenario": "a game board", "level": "intermediate", "style": "exercise", "unit_id": "u10f301c64e3cfb"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 1.0, "mutants": 8, "tests": 7}, "topic": "parsing simple logs", "difficulty": 3, "check": {}}
code2.llm:u1cf1f7503a7334
code2-llm
code2.llm_exercise
code
train
{"title": "Weekday Count with Holidays", "statement": "Count weekdays in the inclusive range between two dates, excluding any listed holidays that fall on weekdays within the range. If the dates are reversed, return the negative of the count for the corresponding forward range; a one-day range is valid. Duplicate holid...
from datetime import date from typing import Iterable def count_workdays(start: date, end: date, holidays: Iterable[date] = ()) -> int: """Count weekdays inclusively, excluding in-range weekday holidays.""" sign = 1 if start > end: start, end = end, start sign = -1 days = (end - start...
null
verified
sandbox execution + independent oracle
null
{"generator": {"model": "gpt-6-luna", "service_tier": "flex", "reasoning_effort": "low", "stage": "code2_llm", "prompt_version": "code2-llm-v1"}, "unit": {"topic": "calendar and date arithmetic", "scenario": "a court calendar", "level": "advanced", "style": "exercise", "unit_id": "u1cf1f7503a7334"}}
{"evidence": {"tests_pass": true, "reproducible": true, "mutation_score": 0.875, "mutants": 8, "tests": 7}, "topic": "calendar and date arithmetic", "difficulty": 5, "check": {}}
End of preview. Expand in Data Studio

OpenLemma v0.2: task items

One row per verified item behind openlemma-v0.2-pretrain: input (JSON), answer, tier (verified), label_source (how it was checked), provenance (generator, seed, kernel, or model call), and record (the checker's evidence: oracle agreement, mutation scores, exhaustive-search counts ...).

default

Source Rows Tokens What
code2 167,035 Procedural code v2: 16 surfaces over a 118-kernel library and program synthesizers; every item executed in a locked-down sandbox and checked by an independent oracle.
code2-llm 24,993 gpt-6-luna exercises (statement, solution, tests, explanation), each sandbox-verified: tests pass, they kill most mutants, and a second run reproduces.
formats2 143,296 Formats v2: nested conversion (JSON/YAML/XML/TOML), JSON Schema validation and inference, repair, JSON Patch, JSONPath/SQL queries, CSV edge cases; checked with independent libraries.

value_pool

66,813 CC0 Wikidata records (2025-11 dump; sha256 9755c0013c367de60aa4af360d8d5877153371c555f9beaca0adee14d4a285d4) used as real values in formats v2: input is the label, answer the record as JSON. People are excluded, as entities and as values.

Provenance and verification

Built by OpenLemma (code: MIT) from the plan in docs/FORMATS-CODE-V2-PLAN.md; release notes in docs/RELEASE-V0.2.md. This is a new release beside v0.1, which is unchanged.

  • Generation: deterministic procedural generators (seeded; no randomness at build time) and, for code2-llm only, gpt-6-luna (OpenAI, flex tier, reasoning effort low). No other model wrote any row.
  • Every row is verified (fail-closed: anything unchecked or failing was dropped):
    • code: every program ran in a sandbox (bubblewrap: no network, read-only system, private /tmp, CPU/memory/time limits, an audit hook refusing sockets, subprocesses and writes) and was compared, on the host, with an independent oracle: a brute-force implementation written differently, gcc for C, exhaustive search over a bounded domain, recompiled bytecode, finite differences or exact rationals. Test suites must fail on most single-point mutants;
    • formats: each answer is re-parsed or recomputed with an independent library (json, PyYAML, tomllib, ElementTree, jsonschema, jsonpatch, jsonpath-ng, sqlite3, csv).
  • Negative controls: for a sample of items a wrong answer (a mutant, a flipped verdict, an unfixed bug, a changed value) was run through the same checker; the rejection rates are in manifest.json.
  • Anti-template rules: sentences are composed from many alternatives, code-block and heading styles rotate, and a monitor over the finished text keeps every opening line, label and prose line at or below 1% of documents. Surfaces used by ALEA's evaluations are never emitted.
  • k-shot: formats documents hold 1-3 items (60/30/10%) of one family, with pairwise-distinct answers; labelled items are balanced. Copy-last and majority-label baselines are reported per family.
  • Decontamination: documents were checked against ALEA's evaluation sets (knowledge probe, ICL v1/v2, OOD-ICL, likelihood suite, general-facts probe, judge prompts, structured-formats baseline, chat probe, QA rounds), SHELF validation and test, OpenLemma v0.1's eval release, and this release's held-out items; overlapping documents were removed.

Token counts use the ALEA tokenizer alea-p1-prefix-16k (as in v0.1).

Licence and attribution

CC-BY-4.0. Attribute OpenLemma (https://github.com/mjbommar/openlemma). The value_pool rows and the values inside formats items come from Wikidata (2025-11 dump), which is CC0. No WordNet-derived material is included. gpt-6-luna output is subject to the provider's terms.

Known limitations

  • Kernel-based code surfaces reuse a 118-function library (with renames and varied text); synthesized surfaces and the LLM exercises supply the breadth. 12 kernels are held out for evaluation only.
  • decompile listings are pinned to CPython 3.14; other versions print different bytecode.
  • Decontamination against HumanEval/MBPP/APPS was not run (no local copy); the code is generated, not scraped.
  • Published before any model was trained on it; no claim about downstream gains.

Citation

@misc{openlemma2026,
  title  = {OpenLemma: verified, bottom-up synthetic data for logic, reasoning, algorithms and language},
  author = {Bommarito, Michael J.},
  year   = {2026},
  note   = {Version 0.2: formats v2 and verified code v2},
  url    = {https://github.com/mjbommar/openlemma}
}
Downloads last month
42