Dataset Viewer
Auto-converted to Parquet Duplicate
id
stringlengths
32
32
text
stringlengths
421
9.88k
family
stringclasses
1 value
kind
stringclasses
4 values
label
stringclasses
15 values
source
stringclasses
3 values
stratum
stringclasses
350 values
gold
stringlengths
92
1.29k
presentation
stringclasses
3 values
group_id
stringlengths
20
99
n_tokens
int64
138
3.07k
code_comprehend-000264523de977fc
Question: The module below currently passes all of its tests. ``` 1: import math 2: from collections.abc import Sequence 3: 4: Sample = int | float 5: MAX_FRAMES = 1 << 20 6: MAX_SAMPLES = 8 * MAX_FRAMES 7: 8: 9: class PcmError(ValueError): 10: """A code with only the coordinates present for this particul...
code_comprehend
failing_test
1
synth
synth:05-processing.audio.sample-frame-layout
{"failing": ["check_2"], "shown": ["check_1", "check_2", "check_3", "check_4"], "edit": {"line": 68, "before": " return [plane[frame] for frame in range(count) for plane in planes]", "after": " return [plane[count] for frame in range(count) for plane in planes]", "fn": "interleave", "op": "var", "unique": true}, ...
qa
synth:05-processing.audio.sample-frame-layout/focused-sample:interleave
1,031
code_comprehend-000357037f7b5cf7
### Task Code review: the tests define the expected behavior. ``` 1: from collections.abc import Iterator 2: from contextlib import contextmanager 3: from dataclasses import dataclass, field 4: from enum import Enum 5: 6: 7: class Tilt(Enum): 8: """The direction a drainboard leans toward the sink.""" 9: 1...
code_comprehend
spot_bug
no_bug
ol5
ol5:contextlib
{"bug_line": null, "fix": null, "buggy": null, "tests_orig": ["test_cleared_on_exception", "test_dispatch_right", "test_drainboard_defaults", "test_draining_loads_then_clears_and_tilts"]}
qa
ol5:f80b18ce8bf89f86
729
code_comprehend-00069fb67fd3237e
Review this code. The tests below describe the intended behavior; at most one line is wrong. ``` 1: import calendar 2: 3: from datetime import date 4: 5: 6: def calculate_claim_age(claim_date: date, as_of: date | None = None) -> tuple[int, int, int]: 7: """Calculate a claim's age in whole years, months, and...
code_comprehend
spot_bug
bug
r3vc
r3vc:legal_dates
{"bug_line": 15, "fix": " anniversary = date(claim_date.year + years, month, day)", "buggy": " anniversary = date(claim_date.year + years, month, as_of)", "tests_orig": ["test_1", "test_4", "test_5", "test_6"]}
plain
r3vc:vcode4-cba0283e31f7c044
875
code_comprehend-0009b31045cb6059
### Task You are reviewing a one-line change to this Python code. ```python def format_lab_sample_durations(durations: list[int | None]) -> list[str]: """Format each available lab sample duration as hours and minutes.""" formatted = [] for seconds in durations: if seconds is None: conti...
code_comprehend
failing_test
3+
r3vc
r3vc:dates
{"failing": ["test_b", "test_c", "test_e", "test_g"], "shown": ["test_a", "test_b", "test_c", "test_d", "test_e", "test_f", "test_g"], "edit": {"line": 13, "before": " if minutes == 60:", "after": " if minutes != 60:", "fn": "format_lab_sample_durations", "op": "cmp", "unique": true}, "tests_orig": ["test...
qa
r3vc:vcode4-0bcdbe13851d4c88
891
code_comprehend-000ed5cddb798690
<|start|><|user|> The following code is unchanged so far. ``` 1: from __future__ import annotations 2: import math 3: 4: 5: class ADError(ValueError): 6: """Invalid shape, domain, graph, arithmetic, or resource request.""" 7: 8: 9: def finite(value: float) -> float: 10: if isinstance(value, bool) or n...
code_comprehend
edit_output
unchanged
synth
synth:03-algorithms.autodiff.hessian-vector-products
{"expr": "finite(1.0)", "orig": "1.0", "new": "1.0", "edit": {"line": 16, "before": " if not math.isfinite(result):", "after": " if not math.isfinite(value):", "fn": "finite", "op": "var", "unique": true}}
chat
synth:03-algorithms.autodiff.hessian-vector-products/focused-sample:finite
290
code_comprehend-001619c074512de8
Instruction: What happens to a call's result when one line changes? The code: ```python def newsletter_adjacent_subscriber_products(counts: list[str]) -> int: """Sum the products of adjacent subscriber counts after trimming whitespace. Args: counts: Numeric subscriber counts represented as strings. ...
code_comprehend
edit_output
changed
r3vc
r3vc:lists
{"expr": "newsletter_adjacent_subscriber_products(['-2', '3', '-4'])", "orig": "-18", "new": "0", "edit": {"line": 11, "before": " return sum(left * right for left, right in zip(numbers, numbers[1:]))", "after": " return sum(left + right for left, right in zip(numbers, numbers[1:]))", "fn": "newsletter_adjacent_s...
qa
r3vc:vcode4-8182d9e2a88ec511
288
code_comprehend-001621413fbb21d9
Question: Your job: decide which tests would fail after a one-line edit. Code first. ``` 1: import re 2: 3: 4: def split_tax_worksheet_clauses(sentence: str, keep_empty: bool = False) -> list[str]: 5: """Split a tax worksheet sentence at commas and semicolons. 6: Raises TypeError if sentence is not a str...
code_comprehend
failing_test
1
r3vc
r3vc:strings
{"failing": ["test_4"], "shown": ["test_1", "test_2", "test_3", "test_4", "test_5"], "edit": {"line": 11, "before": " return clauses if keep_empty else [part for part in clauses if part]", "after": " return sentence if keep_empty else [part for part in clauses if part]", "fn": "split_tax_worksheet_clauses", "op":...
qa
r3vc:vcode4-1885c502a65e9b93
424
code_comprehend-001ad3a722dc423f
### Task Example: Your job: decide which tests would fail after a one-line edit. Code first. ```python def chess_club_budget_remaining(category_budgets: dict[str, float], expenses: dict[str, float], reverse: bool = False) -> list[tuple[str, float]]: """Return the chess club's remaining budget per category in sort...
code_comprehend
failing_test
2
synth
synth:02-data-structures.maps.counting-bloom-filter
{"failing": ["test_a", "test_d"], "shown": ["test_a", "test_b", "test_c", "test_d"], "edit": {"line": 5, "before": " if ledger[middle][0] < key:", "after": " if ledger[middle][0] > key:", "fn": "lower_bound", "op": "cmp", "unique": true}, "tests_orig": ["test_6", "test_1", "test_2", "test_5"]}
qa
synth:02-data-structures.maps.counting-bloom-filter/focused-sample:lower_bound
1,149
code_comprehend-001af1ae926c446f
<|start|><|user|> Read the specification, then the code. Task description: Please build a small payment queue for covered services under a care plan. Define a protocol `CoveredPaymentQueue` with methods `add(self, claim_id: str, amount_cents: int) -> None` and `take(self) -> tuple[str, int] | None`. Provide two class...
code_comprehend
spot_bug
no_bug
ol5
ol5:heap
{"bug_line": null, "fix": null, "buggy": null, "tests_orig": ["test_equal_amounts_use_smaller_claim_id", "test_smallest_take_empty", "test_smallest_order", "test_largest_order", "test_settle_empties_queue"]}
chat
ol5:60cbdf614ac332e9
1,260
code_comprehend-00256804094a8f71
<|start|><|user|> This code ships with a few unit tests, shown after it. ```python from collections.abc import Generator from contextlib import ExitStack, contextmanager from dataclasses import dataclass from typing import TypeAlias, cast ByteInput: TypeAlias = bytes | bytearray | memoryview class Error(ValueError)...
code_comprehend
failing_test
3+
synth
synth:04-formats.network-wire.ipv4-header
{"failing": ["test_case_2", "test_case_3", "test_case_4"], "shown": ["test_case_1", "test_case_2", "test_case_3", "test_case_4"], "edit": {"line": 34, "before": " if issubclass(type(value), bytes):", "after": " if not issubclass(type(value), bytes):", "fn": "_view", "op": "add_not", "unique": true}, "tests_orig":...
chat
synth:04-formats.network-wire.ipv4-header/focused-sample:format_ipv4
1,063
code_comprehend-002912bf4cf21d21
Query: The code below may have a one-line bug. The tests show the intended behavior. ``` 1 def format_moving_item_ranges(item_numbers: list[int]) -> str: 2 """Compress moving item numbers into comma-separated consecutive ranges. 3 4 Args: 5 item_numbers: Integer item numbers to sort, deduplica...
code_comprehend
spot_bug
bug
r3vc
r3vc:lists
{"bug_line": 20, "fix": " start = number", "buggy": " start = numbers", "tests_orig": ["test_3", "test_4", "test_6", "test_7", "test_8"]}
qa
r3vc:vcode4-4bc3fe9dc55f6f86
559
code_comprehend-002ee26a5fecbf51
This code ships with a few unit tests, shown after it. ``` 1 | """An aligned report of abrasive sheets in stock.""" 2 | 3 | MIN_GRIT = 12 4 | MAX_GRIT = 3000 5 | 6 | 7 | class Sheet: 8 | """One abrasive sheet whose numbers are validated on assignment.""" 9 | 10 | __slots__ = ("_grit", "_length_mm", "_...
code_comprehend
failing_test
3+
ol5
ol5:properties
{"failing": ["test_bad_length_on_assignment", "test_report_layout", "test_sheet_accepts_grit_edges"], "shown": ["test_bad_length_on_assignment", "test_report_layout", "test_sheet_rejects_grit_out_of_range", "test_sheet_accepts_grit_edges"], "edit": {"line": 38, "before": " if value <= 0:", "after": " if v...
plain
ol5:66e929d8b56089bf
1,183
code_comprehend-00319b5d18d7cf7b
Here is a function and the tests it is supposed to pass. Is there a bug? ``` 1: from datetime import date 2: 3: import calendar 4: 5: 6: def calculate_claim_age(claim_date: date, as_of: date = date(2024, 1, 1)) -> tuple[int, int, int]: 7: """Return a claim's elapsed age as full years, months, and days.""" ...
code_comprehend
spot_bug
no_bug
r3vc
r3vc:legal_dates
{"bug_line": null, "fix": null, "buggy": null, "tests_orig": ["test_1", "test_3", "test_5", "test_6"]}
plain
r3vc:vcode4-adbb23519380c92d
652
code_comprehend-00379b1cda0ce314
Task: Check the code against its tests; there may be one wrong line. ``` 1: def add_minutes_to_billing_time(time_text, minutes): 2: """Add minutes to a billing record time in HH:MM format. Raises ValueError when the time is malformed or outside the 24-hour clock.""" 3: if len(time_text) != 5 or time_text[2] !=...
code_comprehend
spot_bug
bug
r3vc
r3vc:dates
{"bug_line": 8, "fix": " total = (hour * 60 + minute + minutes) % (24 * 60)", "buggy": " total = (hour * 59 + minute + minutes) % (24 * 60)", "tests_orig": ["test_4", "test_5", "test_6"]}
qa
r3vc:vcode4-f3c56a7704e845f2
434
code_comprehend-003a0ebed73305bb
Instruction: Check this implementation against its specification. Spec: The risk desk keeps quarterly snapshots of counterparty financial standing, each snapshot mapping a company name to its letter grade. Build a class `StandingDiff` with `__init__(self, before: dict[str, str], after: dict[str, str]) -> None` and th...
code_comprehend
spot_bug
bug
ol5
ol5:diff_lists
{"bug_line": 25, "fix": " return sorted(self._after.keys() - self._before.keys())", "buggy": " return sorted(self._after.keys() + self._before.keys())", "tests_orig": ["test_changed_lists_both_grades", "test_unchanged_excluded", "test_changed_sorted_by_company"]}
qa
ol5:eb776b9d69ac5f8a
1,008
code_comprehend-003bb8ad336e2f3b
<|start|><|user|> Find the bug, if there is one. What the code should do: We measure scratch hardness with a sclerometer, and each reading is a float. Please write a module `sclero.py` with two public functions. First, `kth_smallest(readings: list[float], k: int, *, copy: bool = True) -> float` returns the k-th small...
code_comprehend
spot_bug
bug
ol5
ol5:kth_smallest
{"bug_line": 34, "fix": " hi = p - 1", "buggy": " hi = p + 1", "tests_orig": ["test_copy_flag_preserves_input", "test_median_odd", "test_kth_smallest_basic", "test_kth_smallest_copy_true_leaves_input_unchanged", "test_median_hardness_even_count"]}
chat
ol5:7dc8d1c09176ffdb
1,262
code_comprehend-0044f09d592568b5
Your job: decide which tests would fail after a one-line edit. Code first. ```python """Overpayment offset arithmetic with exact decimal rounding.""" from decimal import ROUND_FLOOR, ROUND_HALF_UP, Decimal, InvalidOperation _CENT = Decimal("0.01") _MODES = {"half_up": ROUND_HALF_UP, "floor": ROUND_FLOOR} def month...
code_comprehend
failing_test
1
ol5
ol5:decimal
{"failing": ["test_3"], "shown": ["test_1", "test_2", "test_3", "test_4", "test_5", "test_6"], "edit": {"line": 25, "before": " raise ValueError(msg) from exc", "after": " raise ValueError(owed) from exc", "fn": "monthly_offset", "op": "var", "unique": true}, "tests_orig": ["test_invalid_mode_raises", "te...
plain
ol5:cf2d860a604f0903
669
code_comprehend-004bcdf08ce1ef43
<|start|><|user|> Which line belongs in the gap? First, the code: ```python def box_office_overlap_minutes(first: tuple[int, int], second: tuple[int, int]) -> int: """Return the shared duration of two theatre box-office time ranges in minutes. Raises ValueError if either range is not a pair of nonnegative integer ...
code_comprehend
fill_line
B
r3vc
r3vc:dates
{"letter": "B", "line": 6, "options": ["if interval[0] < 0 or interval[1] <= interval[0]:", "if interval[0] < 0 or interval[1] < interval[0]:", "if interval[0] < 0 or interval[1] > interval[0]:"], "checks": [["box_office_overlap_minutes((60, 120), (90, 150))", "30"], ["box_office_overlap_minutes((0, 10), (10, 20))", "0...
chat
r3vc:vcode4-962d75955c1b6371
461
code_comprehend-0055500ba8567a2c
Instruction: Below is some Python code. ``` 1 | import re 2 | 3 | 4 | def find_docket_parenthetical_year(docket_text: str) -> int: 5 | """Find the first four-digit year inside a parenthetical in a court docket. Raises ValueError if no such year is present.""" 6 | match = re.search(r"\([^()]*?\b(\d{4})\b[^()]*\...
code_comprehend
edit_output
raises
r3vc
r3vc:legal_citations
{"expr": "find_docket_parenthetical_year('(2020)')", "orig": "2020", "new": "raises ValueError", "edit": {"line": 7, "before": " if match is None:", "after": " if match is not None:", "fn": "find_docket_parenthetical_year", "op": "cmp", "unique": true}}
qa
r3vc:vcode4-c5ef9fa241fbe0da
248
code_comprehend-005819e33f8d2f2d
### Task Check the code against its tests; there may be one wrong line. ``` 1 def bucket_print_quantities(quantities, limits, labels): 2 """Group print quantities into labelled ranges defined by exclusive upper limits.""" 3 if len(labels) == len(limits) + 1: 4 raise ValueError("labels must have...
code_comprehend
spot_bug
bug
r3vc
r3vc:lists
{"bug_line": 3, "fix": " if len(labels) != len(limits) + 1:", "buggy": " if len(labels) == len(limits) + 1:", "tests_orig": ["test_1", "test_2", "test_3", "test_5", "test_8"]}
qa
r3vc:vcode4-da41fa2cfc1895bf
576
code_comprehend-005d4a4f37d6470d
Request: Someone deleted one line from this module. ```python import graphlib from collections.abc import Iterator def iter_trait_order(prerequisites: dict[str, list[str]]) -> Iterator[tuple[str, int]]: """Yield each duckbill trait with the layer it can be checked in.""" known = set(prerequisites) for tr...
code_comprehend
fill_line
B
ol5
ol5:graphlib
{"letter": "B", "line": 19, "options": ["for trait in known:", "for trait in ready:", "for trait in layer:"], "checks": [["summarize_order({})", "[]"], ["summarize_order({'bill width': [], 'lamellae count': [], 'filter rate': ['bill width']})", "['0: bill width', '0: lamellae count', '1: filter rate']"], ["summarize_or...
qa
ol5:1087ca91349a43f9
477
code_comprehend-005ee1216f1c2ec5
Query: Here is a solved example first. Below is a Python module, its tests, and a one-line edit. Work out which tests fail once the edit is applied. ``` 1 | def gradebook_pascal_row(row_index): 2 | """Return a row of Pascal's triangle for a classroom gradebook. 3 | A negative row index raises ValueError. ...
code_comprehend
failing_test
none
synth
synth:03-algorithms.numeric.prime-enumeration
{"failing": [], "shown": ["test_1", "test_2", "test_3", "test_4", "test_5"], "edit": {"line": 17, "before": " if value > MAX_BOUND:", "after": " if value >= MAX_BOUND:", "fn": "_bound", "op": "cmp", "unique": true}, "tests_orig": ["test_3", "test_2", "test_5", "test_4", "test_1"]}
qa
synth:03-algorithms.numeric.prime-enumeration/focused-sample:is_prime_trial
1,006
code_comprehend-0061a82294d3e2fa
<|start|><|system|> You are a helpful assistant.<|eot|> <|user|> Example: Take a look at this function. ```python from enum import Enum, auto from itertools import permutations class Room(Enum): """Timetable rooms, each charging its own penalty per lesson.""" HALL = auto() LAB = auto() GYM = auto()...
code_comprehend
edit_output
unchanged
ol5
ol5:generator_pipeline
{"expr": "validate_ledger(['bolt,4.50', 'nut,0.20'])", "orig": "[]", "new": "[]", "edit": {"line": 6, "before": " for number, line in enumerate(lines, start=1):", "after": " for number, line in enumerate(lines, start=2):", "fn": "_numbered", "op": "const", "unique": true}}
chat
ol5:dc67c2e5b794d7fc
1,592
code_comprehend-006404689acbc37e
Which tests break after a small change? Here is the code. ```python def dedupe_food_bank_records(records: list[dict], field: str, default: object = None) -> list[dict]: """Keep the first food-bank record for each field value, using a default when the field is missing.""" seen = set() unique = [] for re...
code_comprehend
failing_test
pass
r3vc
r3vc:lists
{"failing": [], "shown": ["test_a", "test_b", "test_c", "test_d"], "edit": {"line": 6, "before": " value = record.get(field, default)", "after": " value = record.get(field, field)", "fn": "dedupe_food_bank_records", "op": "var", "unique": true}, "tests_orig": ["test_6", "test_4", "test_2", "test_5"], "ask...
plain
r3vc:vcode4-d36434cee99dde82
388
code_comprehend-00677410489bbfb8
<|start|><|user|> A teammate wrote this function. The tests after it state what it must do. ``` 1 from dataclasses import dataclass 2 3 type Matrix = list[list[float]] 4 5 6 @dataclass(slots=True) 7 class PmpuVent: 8 """Quarterly nonepoxide organic HAP emissions of one process vent, one row per quarte...
code_comprehend
spot_bug
bug
ol5
ol5:matrix_ops
{"bug_line": 33, "fix": " return sum(sum(e * w for e, w in zip(row, weights, strict=True)) for row in vent.emissions)", "buggy": " return sum(sum(e + w for e, w in zip(row, weights, strict=True)) for row in vent.emissions)", "tests_orig": ["test_add_elementwise", "test_group_load_scalar", "test_group_load_wrong_w...
chat
ol5:f83db3d67e07f4e5
993
code_comprehend-006de9bcacf2d9d5
This code ships with a few unit tests, shown after it. ```python def changed_contract_clause_keys(original_clauses: dict[str, str], revised_clauses: dict[str, str]) -> list[str]: """Return clause keys added, removed, or changed between two contract versions.""" changed = [] for key, original_value in origi...
code_comprehend
failing_test
2
r3vc
r3vc:dicts
{"failing": ["test_case_1", "test_case_2"], "shown": ["test_case_1", "test_case_2", "test_case_3", "test_case_4"], "edit": {"line": 8, "before": " if key not in original_clauses:", "after": " if key not in original_value:", "fn": "changed_contract_clause_keys", "op": "var", "unique": true}, "tests_orig": ...
plain
r3vc:vcode4-d911fa7b043e8e41
392
code_comprehend-006f2e63bb392be5
Check the code against its tests; there may be one wrong line. ``` 1: from datetime import date 2: 3: 4: def bus_schedule_iso_week_number(service_date: date) -> int: 5: """Return the ISO week number for a bus service date.""" 6: iso_parts = service_date.isocalendar() 7: week_lookup = dict(zip(("year", "wee...
code_comprehend
spot_bug
no_bug
r3vc
r3vc:dates
{"bug_line": null, "fix": null, "buggy": null, "tests_orig": ["test_1", "test_4", "test_5"]}
plain
r3vc:vcode4-a1b3c5990506c6df
302
code_comprehend-007004b597325600
### Task Which tests break after a small change? Here is the code. ```python def summarize_missing_permit_values(rows): """Count missing values in each permit-record column.""" counts = {} for row in rows: for column, value in row.items(): if column not in counts: counts...
code_comprehend
failing_test
fail
r3vc
r3vc:cleaning
{"failing": ["test_2", "test_3", "test_4"], "shown": ["test_1", "test_2", "test_3", "test_4", "test_5"], "edit": {"line": 6, "before": " if column not in counts:", "after": " if rows not in counts:", "fn": "summarize_missing_permit_values", "op": "var", "unique": true}, "tests_orig": ["test_2", "t...
qa
r3vc:vcode4-8af32f6aea81da19
316
code_comprehend-007668b192d97581
<|start|><|user|> The following implementation is missing a single line. ```python _RATES: dict[str, float] = {"wash": 1.0, "rinse": 0.6, "dry": 1.4} type BatchRecord = dict[str, str | float] def litres_of(record: BatchRecord) -> float: """Validate one solvent batch record and return its volume in litres.""" ...
code_comprehend
fill_line
C
ol5
ol5:match_mapping
{"letter": "C", "line": 32, "options": ["return litres_of(record) * rate_of(record)", "return litres_of(record) + rate_of(record)", "return litres_of(record) // rate_of(record)"], "checks": [["cost_of({'kind': 'rinse', 'litres': 10.0})", "16.0"], ["cost_of({'kind': 'dry', 'litres': 10.0})", "7.0"], ["batch_cost([])", "...
chat
ol5:f3976ed65bb7bbc2
803
code_comprehend-00790466df9192cc
A colleague wants to change one line of the following module. ```python MAX_N = 10_000 def index(value: int, name: str) -> None: if type(value) is not int: raise TypeError(f"{name} must be an integer, excluding bool") def domain(n: int) -> None: index(n, "n") if n < 0: raise ValueError(...
code_comprehend
failing_test
1
synth
synth:03-algorithms.combinatorics.factorials-binomial
{"failing": ["test_2"], "shown": ["test_1", "test_2", "test_3", "test_4"], "edit": {"line": 19, "before": " row = [1]", "after": " row = [0]", "fn": "pascal_row", "op": "const", "unique": true}, "tests_orig": ["test_2", "test_1", "test_8", "test_4"]}
plain
synth:03-algorithms.combinatorics.factorials-binomial/focused-sample:pascal_row
382
code_comprehend-007a9ea905b9249e
Query: Below is some Python code. ```python """A prefix trie over fire-safety lodging rate codes.""" from dataclasses import dataclass, field @dataclass(slots=True) class Node: """One trie node: an optional rate for a code ending here, plus children.""" rate: int | None = None children: dict[str, Node]...
code_comprehend
edit_output
raises
ol5
ol5:trie
{"expr": "build_schedule([('lodging', 120)])", "orig": "Node(rate=None, children={'lodging': Node(rate=120, children={})})", "new": "raises AttributeError", "edit": {"line": 28, "before": " add_code(root, code, nightly)", "after": " add_code(code, code, nightly)", "fn": "build_schedule", "op": "var", "uni...
qa
ol5:1e0b70c7da7a585f
648
code_comprehend-007b8a0963888e1a
Below is a Python module, its tests, and a one-line edit. Work out which tests fail once the edit is applied. ```python import re def mask_gate_board_numbers(board_text: str, token: str) -> tuple[str, int]: """Replace digit sequences on an airport gate board with a placeholder token. Raises TypeError if either a...
code_comprehend
failing_test
3+
r3vc
r3vc:strings
{"failing": ["test_1", "test_3", "test_4"], "shown": ["test_1", "test_2", "test_3", "test_4"], "edit": {"line": 8, "before": " masked, count = re.subn(r\"\\d+\", lambda match: token, board_text)", "after": " masked, count = re.subn(r\"\\d+\", lambda match: board_text, board_text)", "fn": "mask_gate_board_numbers"...
plain
r3vc:vcode4-0fa31ae21096bea7
447
code_comprehend-007cbfda5e68664d
### Task Fill in the missing line. The code: ```python from dataclasses import dataclass class ArithmeticLimit(ArithmeticError): """A stored or intermediate integer exceeds the selected magnitude width.""" class ResourceLimit(RuntimeError): """The computation needs more terms than the selected budget.""" ...
code_comprehend
fill_line
A
synth
synth:03-algorithms.numeric.continued-fractions
{"letter": "A", "line": 45, "options": ["ap, aq = a * p1, a + q1", "ap, aq = a * p1, a // q1", "ap, aq = a * p1, a * q1"], "checks": [["convergents((5,))", "((5, 6),)"], ["convergents((8,))", "((8, 9),)"], ["convergents((10,))", "((10, 11),)"], ["convergents((40,))", "((40, 41),)"], ["convergents((-8,))", "((-8, -7),)"...
qa
synth:03-algorithms.numeric.continued-fractions/focused-sample:convergents
792
code_comprehend-007d68ba23baea6c
Fill in the missing line. The code: ```python PRIMES = (5, 17, 257, 65537) KINDS = ("permutation", "all-affine") def integer(value: int, low: int, high: int, name: str) -> None: if type(value) is not int or not low <= value <= high: raise ValueError(f"{name} must be an integer in [{low},{high}]") def d...
code_comprehend
fill_line
B
synth
synth:02-data-structures.maps.universal-hashing
{"letter": "B", "line": 27, "options": ["return (a // key + b) % p", "return (a + key + b) % p", "return (a * key + b) % p"], "checks": [["field('permutation', 5, 1, 0, 1)", "2"], ["field('permutation', 17, 7, 3, 16)", "9"], ["field('permutation', 5, 1, 1, 1)", "3"], ["field('permutation', 5, 1, 1, 2)", "4"]], "target_...
plain
synth:02-data-structures.maps.universal-hashing/focused-sample:field
531
code_comprehend-0088439a8d17fc14
<|start|><|user|> The code below may have a one-line bug. The tests show the intended behavior. ``` 1 | from collections.abc import Sequence 2 | from math import isfinite 3 | 4 | 5 | def checked( 6 | a: Sequence[Sequence[float]], b: Sequence[float], x: Sequence[float] 7 | ) -> tuple[tuple[tuple[float, ...],...
code_comprehend
spot_bug
bug
synth
synth:03-algorithms.numeric.jacobi-iteration
{"bug_line": 38, "fix": " if not all(map(isfinite, new)):", "buggy": " if not all(map(isfinite, a)):", "tests_orig": ["test_1", "test_2", "test_4"]}
chat
synth:03-algorithms.numeric.jacobi-iteration/focused-sample:sweep
930
code_comprehend-00891a932f5e9d2e
<|start|><|user|> Your job: decide which tests would fail after a one-line edit. Code first. ```python MAX_N = 1_000_000 class ResourceLimitError(ValueError): """The requested exact calculation exceeds this educational workload.""" def integer(value: int, name: str, minimum: int, maximum: int) -> None: """...
code_comprehend
failing_test
none
synth
synth:03-algorithms.numeric.divisor-power-sums
{"failing": [], "shown": ["test_a", "test_b", "test_c", "test_d"], "edit": {"line": 26, "before": " factors[candidate] = factors.get(candidate, 0) + 1", "after": " factors[candidate] = factors.get(remaining, 0) + 1", "fn": "factor", "op": "var", "unique": true}, "tests_orig": ["test_2", "test_6", ...
chat
synth:03-algorithms.numeric.divisor-power-sums/focused-sample:factor
494
code_comprehend-008ae7a777013b80
Given the module that follows, reason about how one edit changes a result. ```python from __future__ import annotations from fractions import Fraction from math import factorial, isfinite from typing import Literal Number = Fraction | float Mode = Literal["exact", "float"] MAX_BITS = 4096 class SplineError(ValueErr...
code_comprehend
edit_output
unchanged
synth
synth:03-algorithms.approximation.cubic-splines
{"expr": "convert(7, 'exact')", "orig": "Fraction(7, 1)", "new": "Fraction(7, 1)", "edit": {"line": 33, "before": " if type(value) not in (int, float) and not isinstance(value, Fraction):", "after": " if type(value) not in (int, float) and not isinstance(mode, Fraction):", "fn": "convert", "op": "var", "unique": ...
plain
synth:03-algorithms.approximation.cubic-splines/focused-sample:convert
482
code_comprehend-008beea8fdf70084
<|start|><|user|> Example: Here is a function and the tests it is supposed to pass. Is there a bug? ``` 1 | def truncate_hardware_text_at_word(text: str, max_length: int, ellipsis: str = "…") -> str: 2 | """Truncate text at a word boundary and append an ellipsis.""" 3 | if max_length < 0: 4 | rais...
code_comprehend
spot_bug
bug
ol5
ol5:sparse_vector
{"bug_line": 21, "fix": " return {i: value * factor for i, value in vec.items() if value * factor != 0.0}", "buggy": " return {i: value + factor for i, value in vec.items() if value * factor != 0.0}", "tests_orig": ["test_scale_drops_zeros", "test_add_sums_shared_indices_and_keeps_union", "test_scale_multiplies_a...
chat
ol5:f075e32d181495ed
1,383
code_comprehend-008fede49369c75f
The module below currently passes all of its tests. ``` 1 | def classify_era(year: int) -> str: 2 | """Return the era label used by the archive for a work's year.""" 3 | if year < 1500: 4 | return "ancient" 5 | if year < 1800: 6 | return "classical" 7 | if year < 1900: 8 | ...
code_comprehend
failing_test
3+
ol5
ol5:parametrized_cases
{"failing": ["test_a", "test_b", "test_c", "test_d"], "shown": ["test_a", "test_b", "test_c", "test_d"], "edit": {"line": 23, "before": " if title in self._years:", "after": " if title not in self._years:", "fn": "WorksLedger.add_work", "op": "cmp", "unique": true}, "tests_orig": ["test_duplicate_add_rais...
plain
ol5:35f1085e3755532d
1,042
code_comprehend-00932d6460e11fb3
Is this implementation correct? Task description: We keep steel poles on site and need a tiny calibration module named `poles.py`. Write a dataclass `Pole` with slots and two float fields `length_m` and `diameter_cm`, a function `capacity(pole: Pole) -> float`, and a function `calibration_failures(cases: list[tuple[P...
code_comprehend
spot_bug
no_bug
ol5
ol5:parametrized_cases
{"bug_line": null, "fix": null, "buggy": null, "tests_orig": ["test_default_table_has_no_failures", "test_capacity_is_rounded_to_two_decimals"]}
plain
ol5:0725c7b9999101b0
913
code_comprehend-0096a47ec70c8a0c
Instruction: You are reviewing a one-line change to this Python code. ``` 1: def split_dental_patient_name(full_name: str, suffixes: tuple[str, ...] = ('Jr.', 'Sr.', 'II', 'III', 'IV')) -> tuple[str, str, str, str]: 2: """Split a patient's full name into given, middle, family, and suffix parts. 3: 4: Args:...
code_comprehend
failing_test
1
r3vc
r3vc:cleaning
{"failing": ["test_3"], "shown": ["test_1", "test_2", "test_3", "test_4", "test_5", "test_6"], "edit": {"line": 18, "before": " if tokens and any(tokens[-1].rstrip('.').casefold() == item.rstrip('.').casefold() for item in suffixes):", "after": " if tokens and any(tokens[-1].lstrip('.').casefold() == item.rstrip(...
qa
r3vc:vcode4-d0afb02698787a59
976
code_comprehend-00983ef1cc3a10e3
Read the code and its tests, then predict the effect of an edit on the test results. ```python class Lightship: """A moored vessel that marks a channel with a fixed light.""" def __init__( self, name: str, *, lamps: int = 2, candela: float = 5000.0, fog_signal: ...
code_comprehend
failing_test
1
ol5
ol5:keyword_only
{"failing": ["test_toggle_light_flips_and_returns_state"], "shown": ["test_fog_signal_tail", "test_toggle_light_flips_and_returns_state", "test_lamp_floor", "test_fog_signal_appends_suffix", "test_candela_floor_in_constructor"], "edit": {"line": 22, "before": " self._fog_signal = fog_signal", "after": " s...
plain
ol5:5834d58f89660ffc
850
code_comprehend-009a4c8581417d75
[Task] Below is some Python code. ``` 1: """Trait masks for cynara plants, stored as plain ints.""" 2: 3: _TRAITS: tuple[str, ...] = ("spiny", "purple", "round", "tall", "wide") 4: _BIT: dict[str, int] = {name: 1 << index for index, name in enumerate(_TRAITS)} 5: 6: 7: def trait_mask(names: list[str]) -> int: ...
code_comprehend
edit_output
unchanged
ol5
ol5:bitset
{"expr": "trait_names(22)", "orig": "['purple', 'round', 'wide']", "new": "['purple', 'round', 'wide']", "edit": {"line": 10, "before": " for name in names:", "after": " for name in mask:", "fn": "trait_mask", "op": "var", "unique": true}}
qa
ol5:5a7266dff2458fc6
406
code_comprehend-009b6538ce4f7822
<|start|><|user|> Here is a Python function and a call with its current result. Predict the result after a one-line change. ```python import math def food_bank_supply_cycle_lcm(limit: int) -> int: """Return the least common multiple of the positive integers from 1 through limit.""" if limit < 1: rais...
code_comprehend
edit_output
changed
r3vc
r3vc:math
{"expr": "food_bank_supply_cycle_lcm(1)", "orig": "1", "new": "0", "edit": {"line": 8, "before": " result = 1", "after": " result = 0", "fn": "food_bank_supply_cycle_lcm", "op": "const", "unique": true}}
chat
r3vc:vcode4-834b7922c85ac829
216
code_comprehend-009d83457aa4ee6c
Look at this implementation and the tests that cover it. ``` 1: from fractions import Fraction 2: 3: MAX_BITS = 256 4: 5: 6: class ResourceLimitError(ValueError): 7: """The requested exact computation exceeds the educational budget.""" 8: 9: 10: def canonical(values: tuple[Fraction, ...]) -> tuple[Fractio...
code_comprehend
failing_test
2
synth
synth:03-algorithms.approximation.chebyshev-polynomials
{"failing": ["test_3", "test_4"], "shown": ["test_1", "test_2", "test_3", "test_4"], "edit": {"line": 18, "before": " while end > 1 and values[end - 1] == 0:", "after": " while end <= 1 and values[end - 1] == 0:", "fn": "canonical", "op": "cmp", "unique": true}, "tests_orig": ["test_3", "test_4", "test_2", "test_...
plain
synth:03-algorithms.approximation.chebyshev-polynomials/focused-sample:canonical
578
code_comprehend-00a2f761fefa522a
Task: A colleague wants to change one line of the following module. ``` 1 | from dataclasses import dataclass 2 | from typing import Literal 3 | 4 | type PassageMode = Literal["air", "light"] 5 | 6 | 7 | @dataclass(slots=True) 8 | class Aperture: 9 | """A gap in a solid boundary, measured in metres.""" 10...
code_comprehend
failing_test
3+
ol5
ol5:overload_literal
{"failing": ["test_total_passage_sums", "test_light_passage_uses_low_factor", "test_passage_light_factor"], "shown": ["test_negative_height_rejected", "test_aperture_rejects_negative_height", "test_total_passage_empty", "test_total_passage_sums", "test_light_passage_uses_low_factor", "test_air_passage_uses_high_factor"...
qa
ol5:9d0836e298375efb
836
code_comprehend-00aa2291fe508af3
<|start|><|user|> This code ships with a few unit tests, shown after it. ```python def museum_ticket_interest_schedule(principal: float, annual_rate: float, periods: int, periods_per_year: int = 1) -> list[float]: """Return the balance after each period of simple interest. The annual rate is a decimal, and ea...
code_comprehend
failing_test
pass
r3vc
r3vc:money_units
{"failing": [], "shown": ["check_1", "check_2", "check_3", "check_4", "check_5", "check_6"], "edit": {"line": 10, "before": " period_interest = principal * annual_rate / periods_per_year", "after": " period_interest = principal * annual_rate // periods_per_year", "fn": "museum_ticket_interest_schedule", "op": "ar...
chat
r3vc:vcode4-fd4f7dad107c7428
602
code_comprehend-00ad625f39ea2a27
Query: Complete the code: exactly one line is missing. ```python def lowest_lab_sample_unit_price(samples: list[tuple[str, float, float]]) -> tuple[str, float]: """Find the lab sample with the lowest price per unit. Args: samples: Records of sample name, quantity, and total price. Returns: ...
code_comprehend
fill_line
B
r3vc
r3vc:money_units
{"letter": "B", "line": 20, "options": ["return quantity, best_unit_price", "return best_name, best_unit_price", "return best_unit_price, best_unit_price"], "checks": [["lowest_lab_sample_unit_price([('water', 2, 6), ('soil', 3, 6)])", "('soil', 2.0)"], ["lowest_lab_sample_unit_price([('single', 1, 5)])", "('single', 5...
qa
r3vc:vcode4-6137ca0b8faa5b11
502
code_comprehend-00b0bb93f7d17050
Question: This code is incomplete by one line. ```python from collections.abc import Iterable from enum import Enum from itertools import accumulate class Speed(Enum): """Beater speed settings and their crank turns per minute.""" SLOW = 20 MEDIUM = 45 FAST = 80 def _rate(speed: Speed) -> int: ...
code_comprehend
fill_line
A
ol5
ol5:prefix_sums
{"letter": "A", "line": 42, "options": ["before = prefix[start - 1] if start >= 0 else 0", "before = prefix[start - 1] if start > 0 else 0", "before = prefix[start - 1] if start < 0 else 0", "before = prefix[start - 1] if start <= 0 else 0"], "checks": [["turns_between([160, 240, 480], 2, 2)", "0"], ["turns_between([20...
qa
ol5:77e4577794914e91
592
code_comprehend-00b4e4e545fd2a56
Which line belongs in the gap? First, the code: ```python def build_gradebook(students, grades, default_grade="N/A"): """Pair student names with grades, using a default when a grade is missing.""" gradebook = {} ... # <- fill in this line if index < len(grades): gradebook[student] = gr...
code_comprehend
fill_line
A
r3vc
r3vc:lists
{"letter": "A", "line": 4, "options": ["for index, student in enumerate(students):", "for index, student in enumerate(gradebook):", "for index, student in enumerate(grades):"], "checks": [["build_gradebook([], [])", "{}"], ["build_gradebook(['Alice'], [100])", "{'Alice': 100}"], ["build_gradebook(['Alice', 'Bob'], [90]...
plain
r3vc:vcode4-ddd514101e8a4d1c
294
code_comprehend-00b5438094c3d4c9
[Task] You are reviewing a one-line change to this Python code. ``` 1 """One-pass statistics over a lather bubble log.""" 2 3 from collections.abc import Iterable, Iterator 4 from pathlib import Path 5 6 7 def bubble_sizes(log: Path) -> Iterator[int]: 8 """Yield each lather bubble width in micrometres...
code_comprehend
failing_test
3+
ol5
ol5:reservoir_free_stats
{"failing": ["test_bubble_sizes_preserves_order", "test_non_positive_line_raises", "test_bubble_sizes_bad_line"], "shown": ["test_empty_stream_raises", "test_bubble_sizes_preserves_order", "test_non_positive_line_raises", "test_lather_stats_empty", "test_bubble_sizes_bad_line", "test_lather_stats_single_value"], "edit"...
qa
ol5:9734503a796b3eac
1,176
code_comprehend-00b705d12c6d25c7
Example: This code should pass the tests shown after it. It may contain a one-line bug. ``` 1: def duplicate_manifest_tracking_keys(manifest: dict[str, str], min_keys: int = 2) -> dict[str, list[str]]: 2: """Find tracking values associated with at least the requested number of manifest keys. 3: 4: Args: ...
code_comprehend
spot_bug
no_bug
r3vc
r3vc:dates
{"bug_line": null, "fix": null, "buggy": null, "tests_orig": ["test_3", "test_4", "test_5", "test_6", "test_7"]}
plain
r3vc:vcode4-db3dca97046347a4
1,125
code_comprehend-00bf4db8b2d20823
Take a look at this function. ```python def newsletter_adjacent_subscriber_products(counts: list[str]) -> int: """Sum the products of adjacent subscriber counts after trimming whitespace. Args: counts: Numeric subscriber counts represented as strings. Returns: The sum of products for all ...
code_comprehend
edit_output
raises
r3vc
r3vc:lists
{"expr": "newsletter_adjacent_subscriber_products(['7'])", "orig": "0", "new": "raises NameError", "edit": {"line": 11, "before": " return sum(left * right for left, right in zip(numbers, numbers[1:]))", "after": " return sum(left * right for left, right in zip(count, numbers[1:]))", "fn": "newsletter_adjacent_su...
plain
r3vc:vcode4-8182d9e2a88ec511
271
code_comprehend-00c9449d6dc64299
A line is missing from the function below. ```python """Walk a tree of martensite laths.""" from dataclasses import dataclass, field @dataclass(slots=True) class Lath: """A martensite subunit and the subunits nested inside it.""" name: str children: list[Lath] = field(default_factory=list) def depth_...
code_comprehend
fill_line
A
ol5
ol5:tree_recursive
{"letter": "A", "line": 18, "options": ["return 1 + max(depth_of(child) for child in node.children)", "return 0 + max(depth_of(child) for child in node.children)", "return 2 + max(depth_of(child) for child in node.children)"], "checks": [["depth_of(Lath(name='plate', children=[]))", "1"], ["depth_of(Lath(name='leaf', c...
plain
ol5:f417f9e1dbb000ce
448
code_comprehend-00d46a18de014c6c
Check this implementation against its specification. Specification: For a records-office audit we must decide which record series to keep when the archive shelf space is tight. Define a dataclass `Record` (fields `code: str`, `volume: int`, `score: int`, slots) and a function `select(records: list[Record], capacity: ...
code_comprehend
spot_bug
bug
ol5
ol5:dp_knapsack
{"bug_line": 25, "fix": " table[i][space] = best", "buggy": " table[i][space] = count", "tests_orig": ["test_best_combination_is_selected", "test_everything_fits_when_capacity_is_large", "test_select_rejects_negative_volume"]}
plain
ol5:00560eb641fadf48
837
code_comprehend-00d78fc8e8444051
<|start|><|user|> Given the module that follows, reason about how one edit changes a result. ```python def diff_tax_price_lists(old_prices: list[float], new_prices: list[float]) -> list[float]: """Calculate item-by-item price changes for a tax worksheet. Raises ValueError if the lists have different lengths or con...
code_comprehend
edit_output
raises
r3vc
r3vc:dicts
{"expr": "diff_tax_price_lists([0], [0])", "orig": "[0]", "new": "raises ValueError", "edit": {"line": 9, "before": " if isinstance(new, bool) or not isinstance(new, (int, float)):", "after": " if isinstance(new, bool) or isinstance(new, (int, float)):", "fn": "diff_tax_price_lists", "op": "drop_not", "un...
chat
r3vc:vcode4-f866b1dce12515aa
393
code_comprehend-00d8fcff3dd9ee37
Request: Your job: decide which tests would fail after a one-line edit. Code first. ```python """Validated chair records for a small furniture workshop.""" from dataclasses import dataclass @dataclass class Chair: """A seat described by material, leg count and weight in kilograms.""" material: str legs...
code_comprehend
failing_test
none
ol5
ol5:input_validation
{"failing": [], "shown": ["test_bad_weight_raises_value_error", "test_load_rating", "test_low_legs_raises_value_error", "test_bool_legs_raises_type_error"], "edit": {"line": 21, "before": " if self.weight_kg <= 0:", "after": " if self.weight_kg <= 1:", "fn": "Chair.__post_init__", "op": "const", "unique":...
qa
ol5:c0c78a8ead213654
648
code_comprehend-00dc1d81423e98ae
Check the code against its tests; there may be one wrong line. ``` 1 | from bisect import bisect_left, bisect_right 2 | from enum import IntEnum 3 | 4 | 5 | class Level(IntEnum): 6 | """Approval tiers, ordered from least to most senior.""" 7 | 8 | CLERK = 1 9 | SUPERVISOR = 2 10 | DIRECTOR = 3...
code_comprehend
spot_bug
bug
ol5
ol5:binary_search
{"bug_line": 35, "fix": " return self._levels[i - 1]", "buggy": " return self._levels[i + 1]", "tests_orig": ["test_exact_match_routes_to_threshold", "test_floor_for_unknown_tier_rejected", "test_floor_for_returns_least_amount_for_level", "test_add_rejects_less_senior_tier_after_existing_threshold"]}
plain
ol5:f2976bb9f4f55384
1,022
code_comprehend-00e0705b1946002b
### Task Here is a Python function and a call with its current result. Predict the result after a one-line change. ```python def calculate_hardware_cart_tax(items: list[tuple[str, float]], tax_rate: float = 0.08) -> dict[str, float]: """Calculate the subtotal, sales tax, and total for a hardware cart. Args: ...
code_comprehend
edit_output
unchanged
r3vc
r3vc:money_units
{"expr": "calculate_hardware_cart_tax([('bolt', 1.0)])", "orig": "{'subtotal': 1.0, 'tax': 0.08, 'total': 1.08}", "new": "{'subtotal': 1.0, 'tax': 0.08, 'total': 1.08}", "edit": {"line": 15, "before": " if price < 0:", "after": " if price <= 0:", "fn": "calculate_hardware_cart_tax", "op": "cmp", "unique":...
qa
r3vc:vcode4-1a6e19291bc812c2
497
code_comprehend-00e1c2990b59da1d
<|start|><|user|> Look at this implementation and the tests that cover it. ``` 1 | from dataclasses import dataclass, replace 2 | from typing import Protocol, Self 3 | 4 | 5 | class Directive(Protocol): 6 | """A leadership item that can produce a revised copy.""" 7 | 8 | label: str 9 | priority: i...
code_comprehend
failing_test
3+
ol5
ol5:dataclass_replace
{"failing": ["test_note_is_added", "test_none_note_keeps_notes", "test_both_satisfy_protocol"], "shown": ["test_note_is_added", "test_note_appended", "test_original_unchanged", "test_none_note_keeps_notes", "test_both_satisfy_protocol", "test_priority_out_of_range_raises"], "edit": {"line": 45, "before": " notes...
chat
ol5:0ce5958745a1ca74
1,164
code_comprehend-00e76f191ec4aef1
This code should pass the tests shown after it. It may contain a one-line bug. ``` 1: from __future__ import annotations 2: from dataclasses import dataclass 3: 4: 5: class Malformed(ValueError): 6: """The input has no interpretation under this contract.""" 7: 8: 9: class ResourceLimit(RuntimeError): 10: ...
code_comprehend
spot_bug
no_bug
synth
synth:03-algorithms.finite-fields.binary-tensor-decompositions
{"bug_line": null, "fix": null, "buggy": null, "tests_orig": ["test_3", "test_4", "test_5"]}
plain
synth:03-algorithms.finite-fields.binary-tensor-decompositions/focused-sample:convolution
1,093
code_comprehend-00ebb6a5f05df2cb
### Task Your job: decide which tests would fail after a one-line edit. Code first. ```python def gate_board_convert_distance(value: float, from_unit: str, to_unit: str) -> float: """Convert a gate-board distance between supported units. Raises ValueError if either unit is unsupported.""" meters_per_unit = {"m...
code_comprehend
failing_test
1
r3vc
r3vc:money_units
{"failing": ["check_2"], "shown": ["check_1", "check_2", "check_3", "check_4"], "edit": {"line": 8, "before": " if converted == int(converted):", "after": " if converted != int(converted):", "fn": "gate_board_convert_distance", "op": "cmp", "unique": true}, "tests_orig": ["test_2", "test_1", "test_6", "test_5"]}
qa
r3vc:vcode4-86f29d8f837d2a6a
568
code_comprehend-00ed488fc419e494
<|start|><|user|> The code below may have a one-line bug. The tests show the intended behavior. ``` 1 | import re 2 | 3 | 4 | def parse_federal_rule_citation(citation: str, citation_prefix: str = 'Fed. R. Civ. P.') -> tuple[str, tuple[str, ...]]: 5 | """Parse a rule citation into its rule number and subdivisi...
code_comprehend
spot_bug
bug
r3vc
r3vc:legal_citations
{"bug_line": 7, "fix": " if not match or match.group(1) != citation_prefix:", "buggy": " if not match or match.group(0) != citation_prefix:", "tests_orig": ["test_1", "test_4", "test_6"]}
chat
r3vc:vcode4-c75263b9d449c980
411
code_comprehend-00f772f471de086a
A colleague wants to change one line of the following module. ``` 1: from datetime import datetime 2: 3: 4: def effective_date_to_iso(date_text): 5: """Convert a recognized Effective Date string to ISO date format.""" 6: formats = ("%Y-%m-%d", "%m/%d/%Y", "%B %d, %Y", "%b %d, %Y") 7: for date_format...
code_comprehend
failing_test
pass
r3vc
r3vc:legal_dates
{"failing": ["test_1", "test_3", "test_4"], "shown": ["test_1", "test_2", "test_3", "test_4"], "edit": {"line": 7, "before": " for date_format in formats:", "after": " for date_format in date_text:", "fn": "effective_date_to_iso", "op": "var", "unique": true}, "tests_orig": ["test_2", "test_5", "test_4", "test_3"...
plain
r3vc:vcode4-717d3ff2fc5b3893
420
End of preview. Expand in Data Studio

ALEA code_comprehend

Execution-verified Python code-comprehension tasks built from the ALEA Institute's own synthetic code. Each document shows real, runnable code and asks a question whose answer was obtained by running that code in a sandbox. The set was built for midtraining a small language model. It teaches reasoning about what code does when one line changes, rather than writing code.

Tasks

kind question answer
failing_test A module, 4 to 8 short tests and a one-line edit (shown as a diff, a line-number change or a prose edit). Which tests fail after the edit? A single-test variant asks whether one named test still passes. test names in listing order, or none / yes / no
edit_output A module, a call and its current result, and a one-line edit. What does the call return after the edit? the Python repr of the value, or raises <Exception>
fill_line Code with one line removed, a few tests, and 3 or 4 candidate lines. Which candidate makes every test pass? a letter
spot_bug A specification (a natural-language request, or the docstring plus tests), numbered code that may contain a one-line bug, and tests. Which line is wrong and what should it be? line N: <corrected line> or no bug

About 28% of rows are worked: they give a short, step-by-step account before a final Answer: line. Every value stated in a worked row comes from the execution record. This includes how often the edited line ran, which way a condition went, the values a variable took, and what a call returned before and after the edit. Many worked rows have a direct-answer twin elsewhere in the set. About 7% of rows start with one or two solved demonstrations taken from other code units, and a demonstration's answer never equals the target's answer. Rows come in three presentations: plain instruction, a Q/A frame, or a chat turn. The instruction always comes before the code.

How the gold was produced

  • Code. The code comes from three ALEA synthetic pools:
    • verified OpenLemma v0.5 code records, each a module with two independent test suites, written by GLM-5.3-Flash, DeepSeek-V4.1-Flash and Qwen3.8 and verified by execution;
    • functions from ALEA's verified-code set (R3), written by gpt-6-luna;
    • functions sliced from the ALEA synthetic-code corpus, written by OpenAI Codex agents, each re-executed alone and checked to give results identical to the full module.
  • Mutations. Edits are single-line, single-node changes made in the code's own formatting:
    • comparison or arithmetic operator swaps;
    • off-by-one constants that already occur in the module;
    • boolean flips and and / or swaps;
    • adding or removing a negation;
    • min / max-style call swaps;
    • a wrong variable from the same function;
    • slice bounds.
  • Execution. All execution ran inside a bubblewrap sandbox: no network, a read-only interpreter, a fresh temporary directory, memory, CPU and time limits, and an audit hook that refuses subprocesses and sockets. Every case ran under two hash seeds, and anything whose result differed between them was dropped. Answers containing memory addresses, very long float reprs, sets of strings or timing were dropped.
  • failing_test. The original code passes every shown test, and the failing set is the observed set.
  • fill_line. Exactly one option passes every shown test (expected values are compared with == semantics, and only values that can be written in a test are used). Most rows ask for the original line. About 18% are twins with the same code and options whose tests come from executing a comparison, constant or arithmetic alternative; each fill_line row says that the tests, not the names or docstrings, define correctness.
  • spot_bug. Each buggy version fails at least one shown test. Every unit also has a clean twin, the same unit with no bug, which passes all of them. The tests are introduced neutrally ("The tests describe the intended behavior"), never as already passing.
  • Worked traces. When the edited line itself raises, the worked text says so instead of reporting a condition value. Variable values are listed as the sequence of changes (runs that leave a value unchanged are not repeated), and the text says so.
  • Shown tests. Duplicate tests and tests with constant-true assertions are not shown.
  • Independent re-execution. Every training row was rebuilt from its code and answer and re-run in a fresh sandbox; 16,852 of 16,855 agreed and the 3 others were removed. After the last template changes, all 13,990 failing_test, spot_bug and edit_output rows were re-run again and all agreed.
  • LLM use in this build. A language model wrote no row text and no answers. For the R3 verified-code functions, which had no stored tests, gpt-6-luna (OpenAI, flex tier) proposed only input call expressions such as f([1, 2], 3). Every expected value was then produced by executing the function in the sandbox. Calls were parsed, restricted to literal arguments, and kept only when they ran deterministically.

Cue controls

Baselines were measured with a 5-fold, code-unit-grouped logistic regression on cue-only inputs. All of them are within about 5 points of the prior:

  • failing_test, edit plus test name per test: +3.8 points;
  • failing_test, position only: +0;
  • edit_output, "unchanged" predicted from the question alone: +1.6;
  • fill_line, options only: +1.9 (character and word n-grams), after an out-of-fold adversarial filter that removed fill_line units whose answer the options-only model could pick;
  • spot_bug, telling the mutated line from the original line: -0.1;
  • spot_bug, ranking the bug line among the unit's mutable lines from line text alone: +2.9.

Several measures went into this:

  • answer letters, bug-line positions and the number of failing tests are balanced;
  • "none", "unchanged" and "no bug" answers make up 18 to 39% of their kinds;
  • test names are neutral (test_1, check_a, ...) in about half of the rows that come from suites with descriptive names;
  • three kinds of mutation were excluded from spot_bug because their direction gives them away: removing a negation, adding a negation, and flipping += / -=;
  • spot_bug pairs whose mutation an out-of-fold classifier could recognise, and fill_line units whose correct option an options-only classifier could pick, were dropped as whole groups.

Counts (encoded training rows)

rows sw32k tokens
total 15,419 10.81M
OpenLemma v0.5 code 6,163 (40.0%) 5.41M
R3 verified functions 6,011 (39.0%) 3.09M
synthetic-code snippets 3,245 (21.0%) 2.31M

By kind: spot_bug 4,804 (no bug 1,875), failing_test 4,632, edit_output 4,305, fill_line 1,678. The rows come from 4,344 distinct code units in 350 strata (skills / categories / topics), and no stratum exceeds 5%. Two pools exceed 30% (at most 40%) because the synthetic-code pool is small. Rows are a mean of 701 tokens long, with a maximum of 3,074. A held-out probe split of about 1.5% of code units is kept separately and is not part of the training rows.

Decontamination

Rows were screened against ALEA evaluation references and sibling families' held-out sets at the 8- and 13-gram level. Rows that shared a 13-gram with OpenLemma's held-out evaluation code were removed, apart from widely shared idioms. Any code unit whose id or normalised code matched that evaluation set had already been excluded before generation.

Review

We read 32 rows ourselves and re-executed every training row independently in the sandbox. Two blind reviews followed:

  • Blind review 1 (60 rows): 1 HARD, a false premise (a spot_bug prompt said the tests already pass on code that fails one). It was fixed for every row. Its style notes on unnatural fill_line tests led to restricting and filtering that kind.
  • Blind review 2 (60 new rows; the reviewer executed all 60, and every answer was correct): 1 HARD, a worked trace that collapsed repeated values into a misleading sequence. The trace wording was fixed for every row. Minor style notes (duplicate or filler tests, an unsuitable system line, two lead-in phrasings) were also addressed.

License

CC BY 4.0. The code is synthetic and was written for ALEA. Any names that appear in it are invented.

Downloads last month
45

Collection including alea-institute/alea-code-comprehend