id stringlengths 27 27 | text stringlengths 141 4.44k | family stringclasses 1
value | kind stringclasses 6
values | label stringclasses 366
values | source stringclasses 3
values | stratum stringclasses 489
values | gold stringlengths 28 355 | presentation stringclasses 3
values | group_id stringlengths 20 90 | n_tokens int64 45 1.32k |
|---|---|---|---|---|---|---|---|---|---|---|
code_trace-00025af27ead9e7d | Give the exact value returned by `validate_daily_totals([1, 2, 9], 10)`. The code:
```python
def validate_daily_totals(daily: list[int], cap: int) -> list[str]:
"""Return one message for each minimal stretch of days whose total exceeds cap."""
if not daily:
raise ValueError("empty series")
if any(c... | code_trace | final_output | list | ol5 | sliding_window | {"ret": "['days 2-3: total 11 exceeds cap 10']", "ret_type": "list"} | plain | ol5:56c29a8ec8d49438 | 429 |
code_trace-0008ca40fb58fe91 | Q: What would `type(find_chess_club_majority(['A', 'A', 'B'], minimum_count=2)).__name__` evaluate to?
```python
def find_chess_club_majority(votes, minimum_count=1):
candidate = None
balance = 0
for vote in votes:
if balance == 0:
candidate = vote
balance += 1 if vote == candid... | code_trace | return_type | str | r3vc | lists | {"ret_type": "str", "ret": "'A'"} | qa | r3vc:vcode4-ebeaa95b740e245a | 148 |
code_trace-000c819e6dfaedff | Determine the result of `identity(2, 3)`.
```python
import math
from dataclasses import dataclass
@dataclass(frozen=True)
class Matrix:
rows: int
cols: int
data: tuple[tuple[float, ...], ...]
def __post_init__(self) -> None:
if type(self.rows) is not int or type(self.cols) is not int:
... | code_trace | final_output | Matrix | synth | 03-algorithms.numeric.qr-decomposition | {"ret": "Matrix(rows=2, cols=3, data=((1.0, 0.0, 0.0), (0.0, 1.0, 0.0)))", "ret_type": "Matrix"} | plain | synth:03-algorithms.numeric.qr-decomposition/focused-sample | 331 |
code_trace-000c8d1a06d194b5 | Here is a Python function with a marked line.
```python
def eligible_pairs(incomes: list[int], awards: list[int], cap: int) -> int:
"""Count income-award pairs whose sum stays within the cap."""
if incomes != sorted(incomes) or awards != sorted(awards):
raise ValueError("both lists must be sorted ascen... | code_trace | var_at_line | k2 | ol5 | two_pointer | {"line": 13, "var": "j", "hit": 2, "value": "0", "hits_total": 2} | plain | ol5:d6d408a014fa01e0 | 199 |
code_trace-0010a3d61a5f386e | <|start|><|user|>
Does `squared_norm((Fraction(-69760802, 268435456), Fraction(-156178445, 268435456), Fraction(-12455044, 67108864)))` raise an exception? If it does, name the exception class; if not, give the return value. The code:
```python
from __future__ import annotations
from collections.abc import Sequence
f... | code_trace | exception | none | synth | 03-algorithms.numeric.successive-overrelaxation | {"raises": null, "ret": "Fraction(31740326114972205, 72057594037927936)"} | chat | synth:03-algorithms.numeric.successive-overrelaxation/focused-sample | 210 |
code_trace-0013296e8a1ee97d | <|start|><|user|>
What is the outcome of evaluating `kth_smallest([119, 253, 168, 87, 197, 253, 64], 2)`? (Name the exception class if one is raised, else the returned value.)
```python
from collections.abc import Iterator
def below_pivot(values: list[int], pivot: int) -> Iterator[int]:
"""Yield the values that ... | code_trace | exception | none | ol5 | kth_smallest | {"raises": null, "ret": "87", "mutated_line": 15, "mutant": false} | chat | ol5:81ebac90d3503fc4 | 312 |
code_trace-0016918c6a3ce89a | After 2 complete passes through the body of the `for` loop marked `# [loop]` in `pressed_count(['123', '13', '2', ''])` (just before pass 3), what is `counts`?
```python
from collections.abc import Iterable, Iterator
VALVE_1 = 1
VALVE_2 = 2
VALVE_3 = 4
def valve_masks(spec: str) -> Iterator[int]:
"""Yield ... | code_trace | loop_state | N2 | ol5 | bitset | {"loop_line": 30, "after_passes": 2, "values": {"counts": "[3, 2]"}} | plain | ol5:9826d3898e4b1b87 | 299 |
code_trace-00186a75a4776d48 | [Task]
Here are worked examples of this kind of question.
Example 1:
```python
def invoice_overtime_pay(hours_and_rates: list[tuple[float, float]], overtime_threshold: float = 40) -> list[tuple[float, float]]:
"""Calculate regular and overtime pay for each invoice entry."""
payments = []
for hours, rate i... | code_trace | exception | none | synth | 01-foundations.representation.signed-integers | {"raises": null, "ret": "5"} | qa | synth:01-foundations.representation.signed-integers/focused-sample | 865 |
code_trace-0019d724f04fea66 | Predict the output of `repr(rank_book_club_votes(['Dune', 'Dune', 'Emm ']))`.
```python
def rank_book_club_votes(votes: list[str], include_zero: bool = False) -> dict[str, int]:
"""Count book-club votes and place the alphabetically first winner first. Raises ValueError if no votes are supplied or any vote is not a... | code_trace | final_output | dict | r3vc | dicts | {"ret": "{'Dune': 2, 'Emm ': 1}", "ret_type": "dict"} | plain | r3vc:vcode4-984082b5a6988903 | 289 |
code_trace-001a0e4d02a0905b | <|start|><|user|>
Examples:
Example 1:
```python
def fitness_running_totals(values: list[int], reset_value: int = 0) -> list[int]:
"""Return cumulative fitness totals, restarting whenever the reset value occurs."""
totals = []
running_total = 0
for value in values:
if value == reset_value:
... | code_trace | final_output | int | synth | 01-foundations.representation.floating-point | {"ret": "166", "ret_type": "int"} | chat | synth:01-foundations.representation.floating-point/focused-sample | 277 |
code_trace-00200145ae978309 | Consider this code. Pay attention to the line with the marker comment.
```python
from bisect import bisect_left
from dataclasses import dataclass
SEP = " | "
@dataclass(slots=True)
class HypoRecord:
"""One testable claim with an evidence weight."""
code: str
claim: str
weight: int
@dataclass(slo... | code_trace | var_at_line | k1 | ol5 | binary_search | {"line": 31, "var": "line", "hit": 1, "value": "'H-01 | soil warms late || 5 '", "hits_total": 1} | plain | ol5:50e9c09e46953659 | 494 |
code_trace-002003ed5df5310f | In `find_all('no deadlines here', ' ')`, the `while` loop marked `# [loop]` runs several times. Give `positions` at the start of pass 2 of its body, i.e. after 1 completed pass. The code:
```python
def find_all(text: str, needle: str) -> list[int]:
"""Return ascending start indexes of all overlapping occurrences o... | code_trace | loop_state | N1 | ol5 | string_matching | {"loop_line": 7, "after_passes": 1, "values": {"positions": "[2]"}} | plain | ol5:c092e3eaf620ebf7 | 197 |
code_trace-00205becde99989e | What is the return value of `order_steps({'door': {'frame'}, 'frame': {'base'}, 'roof': {'frame'}})`?
```python
from graphlib import TopologicalSorter
type Steps = dict[str, set[str]]
def order_steps(steps: Steps) -> list[str]:
"""Return the parts in an order where each part follows its supports."""
sorter... | code_trace | final_output | list | ol5 | graphlib | {"ret": "['base', 'frame', 'door', 'roof']", "ret_type": "list"} | plain | ol5:31362071c650ead5 | 144 |
code_trace-002344bca4f86026 | [Task]
After 1 complete pass through the body of the `for` loop marked `# marked loop` in `dispatch([GreaseJob(part='b', viscosity=2.0)], 2)` (just before pass 2), what is `served`?
```python
from collections import deque
from dataclasses import dataclass
@dataclass(slots=True)
class GreaseJob:
"""One lubricatio... | code_trace | loop_state | N1 | ol5 | queue_fifo | {"loop_line": 19, "after_passes": 1, "values": {"served": "['b']"}} | qa | ol5:ce5da0c13ce7c59a | 229 |
code_trace-002680ba704ca02a | Query: You are given the following code.
```python
def _integer(value: object, low: int, high: int) -> int:
if type(value) is not int:
raise TypeError("an exact built-in int is required")
if not low <= value <= high:
raise ValueError("integer outside declared range")
return value
def _pat... | code_trace | exception | none | synth | 01-foundations.representation.floating-point | {"raises": null, "ret": "18437736874454810698"} | qa | synth:01-foundations.representation.floating-point/focused-sample | 182 |
code_trace-0029221be0da2f80 | Instruction: Here is some Python code.
```python
from collections import deque
from dataclasses import dataclass
@dataclass(slots=True, frozen=True)
class Batch:
"""One ultramarine batch with a blue share in percent."""
name: str
blue_share: int | float
def normalize(batch: Batch) -> Batch:
"""Ret... | code_trace | final_output | list | ol5 | queue_fifo | {"ret": "[Batch(name='a', blue_share=30.0)]", "ret_type": "list"} | qa | ol5:39a1ce0677b38431 | 606 |
code_trace-002a638b449a9966 | Instruction: You are given the following code.
```python
import re
from dataclasses import dataclass
from enum import StrEnum
class Kind(StrEnum):
"""Kinds of token in the caracal expression language."""
NUMBER = "number"
NAME = "name"
OP = "op"
LPAREN = "lparen"
RPAREN = "rparen"
@datacla... | code_trace | loop_state | N3 | ol5 | tokenizer | {"loop_line": 39, "after_passes": 3, "values": {"tokens": "[Token(kind=<Kind.NAME: 'name'>, text='y', pos=2)]"}} | qa | ol5:8a3ffaf1f83cf6a6 | 475 |
code_trace-002fdf7e0b180081 | What does `twice_area([(Fraction(0, 1), Fraction(0, 1)), (Fraction(2, 1), Fraction(0, 1)), (Fraction(2, 7), Fraction(2, 1)), (Fraction(0, 1), Fraction(2, 1))])` return? Give the value as a Python literal. The code:
```python
from collections.abc import Sequence
from fractions import Fraction
Point = tuple[Fraction, ... | code_trace | final_output | Fraction | synth | 03-algorithms.geometry.polygon-triangulation | {"ret": "Fraction(32, 7)", "ret_type": "Fraction"} | plain | synth:03-algorithms.geometry.polygon-triangulation/focused-sample | 583 |
code_trace-00306b6fc2b370ae | <|start|><|user|>
Consider this code. Pay attention to the line with the marker comment.
```python
from __future__ import annotations
from fractions import Fraction
Polynomial = tuple[Fraction, ...]
def trim(values: list[Fraction]) -> Polynomial:
while values and values[-1] == 0:
values.pop()
retu... | code_trace | var_at_line | k3 | synth | 03-algorithms.group-theory.character-table-consistency | {"line": 25, "var": "i", "hit": 3, "value": "0", "hits_total": 4} | chat | synth:03-algorithms.group-theory.character-table-consistency/focused-sample | 345 |
code_trace-0033e6145b462c0b | <|start|><|user|>
What kind of object comes back from `acceptable((), 1.1230339887498949e-10)`? Give its type name.
```python
from math import hypot
Vector = tuple[float, ...]
def norm(values):
return hypot(*values)
def acceptable(residual, threshold):
return norm(residual) <= threshold
```<|eot|>
<|assi... | code_trace | return_type | bool | synth | 03-algorithms.numeric.biconjugate-gradient-stabilized | {"ret_type": "bool", "ret": "True"} | chat | synth:03-algorithms.numeric.biconjugate-gradient-stabilized/focused-sample | 104 |
code_trace-003d1562efaa55fd | Below is a short piece of Python.
```python
BUDGET = 1_000_000_000
def integer(value: object, low: int, high: int) -> int:
if type(value) is not int:
raise TypeError("exact built-in int required")
if not low <= value <= high:
raise ValueError("integer outside domain")
return value
def s... | code_trace | exception | ValueError | synth | 01-foundations.mathematics.number-theory | {"raises": "ValueError", "line": 8} | plain | synth:01-foundations.mathematics.number-theory/focused-sample | 283 |
code_trace-003d9cf5f4a5d962 | Determine the result of `solve(((0.0, 2.0), (2.0, 0.0)), (-0.25, 1.0))`.
```python
import math
Vector = tuple[float, ...]
Matrix = tuple[Vector, ...]
def solve(a: Matrix, b: Vector) -> Vector:
"""Scaled elimination with partial pivoting; never form an inverse."""
scale = max(abs(v) for row in a for v in ... | code_trace | final_output | tuple | synth | 03-algorithms.optimization.newton-optimization | {"ret": "(0.5, -0.125)", "ret_type": "tuple"} | plain | synth:03-algorithms.optimization.newton-optimization/focused-sample | 728 |
code_trace-004b5e281be83939 | <|start|><|user|>
Calling `validate_tailoring([{'key': [97], 'elements': [(0, 1)]}])`: exception or normal return? Say which exception class, or what it returns. The code:
```python
import unicodedata
UNICODE_VERSION = "16.0.0"
class InvalidArgument(ValueError):
"""An argument has the wrong Python kind."""
c... | code_trace | exception | InvalidParameter | synth | 03-algorithms.strings.unicode-collation | {"raises": "InvalidParameter", "mutated_line": 65, "mutant": false} | chat | synth:03-algorithms.strings.unicode-collation/focused-sample | 849 |
code_trace-004e9a1c9939ae29 | <|start|><|user|>
Examples:
Example 1:
```python
def fitness_adjacent_effort_products(efforts: list[int | float]) -> int | float:
"""Sum products of adjacent fitness-tracker measurements. Raises ValueError if any measurement is not a number."""
for effort in efforts:
if not isinstance(effort, (int, fl... | code_trace | final_output | list | ol5 | counter | {"ret": "[('b', 2), ('a', 1)]", "ret_type": "list"} | chat | ol5:bb9f08ab9c8c7028 | 409 |
code_trace-004f142604de2251 | How many calls to `finite` does `diagnostics([[1e-308]], [1e+308], [0.5])` make (directly or indirectly)?
```python
from __future__ import annotations
import math
from collections.abc import Sequence
from dataclasses import dataclass
from fractions import Fraction
Matrix = Sequence[Sequence[float]]
Vector = Seque... | code_trace | call_count | c3 | synth | 03-algorithms.numeric.symmetric-overrelaxation | {"function": "finite", "calls": 3} | plain | synth:03-algorithms.numeric.symmetric-overrelaxation/focused-sample | 792 |
code_trace-004f20df6163871e | <|start|><|user|>
Read the Python code below; one line carries a marker comment.
```python
from dataclasses import dataclass
@dataclass(slots=True)
class Circuit:
"""One branch circuit on a panel schedule."""
circuit_id: str
gauge: int
amps: int
_AMPACITY: dict[int, int] = {14: 15, 12: 20, 10: 30,... | code_trace | var_at_line | k2 | ol5 | bucket_sort | {"line": 22, "var": "circuit", "hit": 2, "value": "Circuit(circuit_id='', gauge=8, amps=1)", "hits_total": 2} | chat | ol5:719682c96cf03a4d | 475 |
code_trace-0051418ee0206db1 | Trace the code below by hand.
```python
import heapq
from dataclasses import dataclass
@dataclass(frozen=True)
class Section:
"""One part of a quarterly report and the sections it builds on."""
name: str
needs: tuple[str, ...]
def order_sections(sections: list[Section]) -> list[str]:
"""Return eve... | code_trace | var_at_line | k2 | ol5 | topological_sort | {"line": 21, "var": "remaining", "hit": 2, "value": "{'solo': 1}", "hits_total": 2} | plain | ol5:68f23081847b481d | 367 |
code_trace-00553b489cf1fd1a | Question: Look at this Python snippet.
```python
import math
class NumericalError(ArithmeticError):
"""A required floating intermediate cannot be retained."""
def _finite(value: float) -> float:
if not math.isfinite(value):
raise NumericalError("nonfinite floating intermediate")
return value
... | code_trace | final_output | float | synth | 03-algorithms.quantitative-finance.discount-compounding | {"ret": "-1.0", "ret_type": "float"} | qa | synth:03-algorithms.quantitative-finance.discount-compounding/focused-sample | 169 |
code_trace-005585470a0cddf0 | Task: You are given the following code.
```python
from enum import StrEnum
class Kind(StrEnum):
Argument = "Argument"
Capacity = "Capacity"
Empty = "Empty"
Truncated = "Truncated"
Malformed = "Malformed"
Unsupported = "Unsupported"
ValueRange = "ValueRange"
Trailing = "Trailing"
cla... | code_trace | call_count | c3 | synth | 04-formats.database-pages.sqlite-pointer-map | {"function": "require", "calls": 3} | qa | synth:04-formats.database-pages.sqlite-pointer-map/focused-sample | 447 |
code_trace-00598b3f2bf2639f | Examine this code carefully.
```python
from collections.abc import Sequence
def _sort_count(values: list[int]) -> tuple[list[int], int]:
"""Sort a copy of values ascending and count inversions at the same time."""
if len(values) <= 1:
return [*values], 0
middle = len(values) // 2
left, left_c... | code_trace | call_count | c3 | ol5 | custom_merge_sort | {"function": "_sort_count", "calls": 3} | plain | ol5:3181839998d53069 | 364 |
code_trace-005a82580e6e062f | <|start|><|user|>
Here is some Python code.
```python
from dataclasses import dataclass
@dataclass(slots=True)
class Advance:
"""A granted step increase."""
ident: str
steps: int
@dataclass(slots=True)
class Deferral:
"""A postponed step increase."""
ident: str
months: int
@dataclass(sl... | code_trace | final_output | str | ol5 | match_statement | {"ret": "'x suspend: audit\\nx suspend: audit\\nyyyy defer 2 months'", "ret_type": "str"} | chat | ol5:08876f200f803c0b | 422 |
code_trace-005c2bc5778b9270 | <|start|><|user|>
`static_route({'': {'a'}, 'c': {'b'}})` returns what? Write it the way Python's repr() would.
```python
import graphlib
def static_route(deps: dict[str, set[str]]) -> list[str]:
"""Order waypoints so each one comes after all of its predecessors."""
return list(graphlib.TopologicalSorter(dep... | code_trace | final_output | list | ol5 | graphlib | {"ret": "['a', 'b', '', 'c']", "ret_type": "list"} | chat | ol5:edac372d97656abb | 122 |
code_trace-005d6b640ac2fbc8 | Trace `park_checksum(DayPass(code='code-42', party_size=12))`. What is `total` after the body of the `for` loop marked `# (L)` has finished 1 full pass (that is, just before pass 2 starts)?
```python
from dataclasses import dataclass
from typing import Protocol
class Reservation(Protocol):
"""Anything with a res... | code_trace | loop_state | N1 | ol5 | checksum | {"loop_line": 43, "after_passes": 1, "values": {"total": "8"}} | plain | ol5:89ebc98066382020 | 445 |
code_trace-005f9d8b56113670 | <|start|><|user|>
Predict the outcome of `soak_instruction(EpiphyteCare(keeper={'soak_minutes': 25}, species={}, defaults={'syad_tsim': 3, 'night_drop_c': 6}))`: either the exception class it raises or the value it returns. The code:
```python
from collections import ChainMap
from dataclasses import dataclass, field
... | code_trace | exception | KeyError | ol5 | chainmap | {"raises": "KeyError", "line": 25} | chat | ol5:ee8559cb566c0070 | 389 |
code_trace-0060c4ea6b359f0b | Task: Read the Python code below.
```python
from __future__ import annotations
from math import sqrt
Vector = tuple[float, ...]
def dot(a: Vector, b: Vector) -> float:
return sum(x * y for x, y in zip(a, b, strict=True))
def norm(a: Vector) -> float:
return sqrt(dot(a, a))
```
Give the exact value retu... | code_trace | final_output | float | synth | 03-algorithms.optimization.sequential-quadratic-programming | {"ret": "1.0", "ret_type": "float"} | qa | synth:03-algorithms.optimization.sequential-quadratic-programming/focused-sample | 133 |
code_trace-0061a1d077dac1e8 | Loop tracing exercise.
```python
from dataclasses import dataclass
@dataclass(slots=True)
class StallEvent:
"""One recorded change to a stall's stock."""
kind: str
item: str
qty: int
def replay(events: list[StallEvent]) -> dict[str, int]:
"""Rebuild stock by applying events in order, validatin... | code_trace | loop_state | N1 | ol5 | event_sourcing | {"loop_line": 16, "after_passes": 1, "values": {"stock": "{'plums': 3}"}} | plain | ol5:241188b5715af20e | 386 |
code_trace-00668d3805950c29 | <|start|><|user|>
Trace the loop in the code below by hand.
```python
from dataclasses import dataclass
from math import isqrt
@dataclass
class Budget:
"""One unit pays for a divisor check, rho step, or modular test."""
remaining: int
def __post_init__(self) -> None:
if type(self.remaining) is ... | code_trace | loop_state | n5 | synth | 03-algorithms.numeric.integer-factorization | {"loop_line": 36, "iterations": 5} | chat | synth:03-algorithms.numeric.integer-factorization/focused-sample | 361 |
code_trace-0067a9dfb423434f | When `linear(7, 0, None)` is evaluated, how many times is the function `integer` called?
```python
from dataclasses import dataclass
BUDGET = 1_000_000_000
def integer(value: object, low: int, high: int) -> int:
if type(value) is not int:
raise TypeError("exact built-in int required")
if not low <=... | code_trace | call_count | c3 | synth | 01-foundations.mathematics.number-theory | {"function": "integer", "calls": 3} | plain | synth:01-foundations.mathematics.number-theory/focused-sample | 429 |
code_trace-00695133f8368925 | Consider the call `same_key(31, -7)`. What value does `a` hold immediately before the marked line (`# (target)`) executes for the first time?
```python
from __future__ import annotations
import math
from typing import cast
class Undefined:
"""Distinct from null (Python None)."""
class Unsupported(ValueError):... | code_trace | var_at_line | k1 | synth | 09-application-foundations.javascript.collections-iteration | {"line": 29, "var": "a", "hit": 1, "value": "31.0", "hits_total": 1} | plain | synth:09-application-foundations.javascript.collections-iteration/focused-sample | 340 |
code_trace-00700a8bfa15aab3 | Here are worked examples of this kind of question.
Example 1:
```python
def most_common_museum_ticket_by_group(records, ):
"""Return the most common ticket value for each museum desk group."""
counts_by_group = {}
for group, value in records:
counts = counts_by_group.setdefault(group, {})
... | code_trace | exception | none | synth | 02-data-structures.sequences.dual-array-deque | {"raises": null, "ret": "0"} | plain | synth:02-data-structures.sequences.dual-array-deque/focused-sample | 481 |
code_trace-0070998e165cc4a0 | Here is some Python code.
```python
class RingError(Exception):
"""The message is a stable outcome label, never a formatted user value."""
def integer(value: object, low: int, high: int) -> int:
if type(value) is not int or not low <= value <= high:
raise RingError("invalid argument")
return valu... | code_trace | final_output | int | synth | 02-data-structures.sequences.ring-buffer | {"ret": "0", "ret_type": "int"} | plain | synth:02-data-structures.sequences.ring-buffer/focused-sample | 107 |
code_trace-0070fa737cedc491 | What is the return value of `payload(44)`?
```python
from enum import Enum
class Error(Enum):
Argument = "Argument"
ValueRange = "ValueRange"
Index = "Index"
Capacity = "Capacity"
Empty = "Empty"
StaleView = "StaleView"
Closed = "Closed"
EpochOverflow = "EpochOverflow"
CounterOver... | code_trace | final_output | int | synth | 02-data-structures.sequences.dynamic-array | {"ret": "44", "ret_type": "int"} | plain | synth:02-data-structures.sequences.dynamic-array/focused-sample | 250 |
code_trace-0071f7a0ea82ca45 | Instruction: You are given the following code.
```python
from collections import deque
def shortest_links(graph, start, goal):
if start == goal:
return 0
seen = {start}
queue = deque([(start, 0)])
while queue:
node, depth = queue.popleft()
for neighbour in graph.get(node, []):... | code_trace | return_type | int | ol5 | bfs | {"ret_type": "int", "ret": "0"} | qa | ol5:83a3f1e4e38dd30d | 174 |
code_trace-00789770bc038530 | <|start|><|user|>
Here is a Python function with a marked line.
```python
type Claim = tuple[str, int]
def validate_claims(claims: list[Claim]) -> None:
"""Raise ValueError on a negative kilocalorie value or an empty statement."""
for name, kcal in claims:
if kcal < 0:
raise ValueError(f"... | code_trace | var_at_line | k1 | ol5 | backtracking | {"line": 40, "var": "best", "hit": 1, "value": "[]", "hits_total": 1} | chat | ol5:9b9d71066b662508 | 390 |
code_trace-007c5b3ec7084e81 | Task: Loop tracing exercise.
```python
from __future__ import annotations
from collections.abc import Iterable
Field = tuple[int, ...]
def trim(a: Iterable[int], p: int) -> Field:
v = [c % p for c in a]
while len(v) > 1 and v[-1] == 0:
v.pop()
return tuple(v or [0])
def fdiv(a: Field, b: Fie... | code_trace | loop_state | N1 | synth | 03-algorithms.numeric.polynomial-factorization | {"loop_line": 21, "after_passes": 1, "values": {"q": "[0, 0, 2]", "r": "[1, 0, 1]"}} | qa | synth:03-algorithms.numeric.polynomial-factorization/focused-sample | 367 |
code_trace-007d34dff991c9d5 | <|start|><|user|>
Give the type name of the return value of `count_kinds([(0, 'boss', 'employee'), (1, 'kid', 'deependent'), (2, 'grand', 'dependent')])`. The code:
```python
from collections.abc import Iterable
def count_kinds(nodes):
counts = {}
for _, _, kind in nodes:
counts[kind] = counts.get(ki... | code_trace | return_type | dict | ol5 | tree_recursive | {"ret_type": "dict", "ret": "{'employee': 1, 'deependent': 1, 'dependent': 1}"} | chat | ol5:72f0374259283865 | 120 |
code_trace-0083d74bcd607264 | <|start|><|user|>
Below is some Python code to trace.
```python
from dataclasses import dataclass
class UnresolvedError(ValueError):
"""A declared resource limit prevents an exact conclusion."""
def integer(value: int) -> None:
if type(value) is not int:
raise ValueError("exact integer required")
... | code_trace | var_at_line | k4 | synth | 03-algorithms.number-fields.quadratic-orders | {"line": 49, "var": "divisor", "hit": 4, "value": "5", "hits_total": 7} | chat | synth:03-algorithms.number-fields.quadratic-orders/focused-sample | 553 |
code_trace-00849c8d4c2824c4 | In the call `harvest_report([('a', 0, 4), ('', 0, 4), ('c', 4, 2)], 2)`, give the repr of `free` at the point where the marked line (`# (target)`) is reached for the third time, before that line runs.
```python
import heapq
from collections.abc import Iterator
type Task = tuple[str, int, int]
def slot_assignments(... | code_trace | var_at_line | k3 | ol5 | scheduling_greedy | {"line": 25, "var": "free", "hit": 3, "value": "[(4, 1)]", "hits_total": 3} | plain | ol5:a8aa34c8da67efd5 | 523 |
code_trace-0085a26bce72ac3e | [Task]
Pause `transformed_log(Fraction(-7, 14), 26)` just as the line with the comment `# <- HERE` is about to execute for the fourth time. What is `power` then?
```python
import math
from dataclasses import dataclass
from fractions import Fraction
class BudgetExceeded(RuntimeError):
"""The requested certificate... | code_trace | var_at_line | k4 | synth | 03-algorithms.numeric.elementary-small-corrections | {"line": 69, "var": "power", "hit": 4, "value": "Fraction(-1, 2187)", "hits_total": 26} | qa | synth:03-algorithms.numeric.elementary-small-corrections/focused-sample | 676 |
code_trace-0086059fcb30d78c | Q: Trace this code by hand; do not guess.
```python
def interpolate_campsite_rate(x0, y0, x1, y1, x, allow_extrapolation=False):
if x0 == x1:
raise ValueError("x-coordinates must be distinct")
if not allow_extrapolation and not min(x0, x1) <= x <= max(x0, x1):
raise ValueError("x is outside the... | code_trace | return_type | float | r3vc | math | {"ret_type": "float", "ret": "20.0"} | qa | r3vc:vcode4-1b2d459db46cf8ed | 174 |
code_trace-0086e615f5b65c58 | <|start|><|user|>
Give the exact value returned by `cheapest_permit_unit_rate([('A ', 250, 5), ('B', 300, 6)])`.
```python
def cheapest_permit_unit_rate(offers):
"""Return the name of the permit offer with the lowest price per unit, using cents."""
if not offers:
raise ValueError("offers must not be em... | code_trace | final_output | str | r3vc | money_units | {"ret": "'A '", "ret_type": "str"} | chat | r3vc:vcode4-e23fb4abcc219df4 | 147 |
code_trace-00897aac78e328e9 | Consider this code and the loop tagged with a comment.
```python
from collections.abc import Sequence
from dataclasses import dataclass
@dataclass(slots=True)
class Atom:
"""One fluorine atom node carrying an isotope mass number."""
mass: int
next: Atom | None = None
def _append(head: Atom | None, mas... | code_trace | loop_state | N2 | ol5 | linked_list | {"loop_line": 39, "after_passes": 2, "values": {"head": "Atom(mass=18, next=Atom(mass=19, next=None))"}} | plain | ol5:09f17b67bd8cca74 | 384 |
code_trace-0089832955b4b033 | <|start|><|user|>
In the call `square_roots(1, 61)`, give the repr of `divisor` at the point where the marked line (`# [X]`) is reached for the second time, before that line runs.
```python
from dataclasses import dataclass
class ResourceLimit(RuntimeError):
"""The requested proof or computation exceeded its wor... | code_trace | var_at_line | k2 | synth | 03-algorithms.numeric.modular-square-roots | {"line": 44, "var": "divisor", "hit": 2, "value": "5", "hits_total": 3} | chat | synth:03-algorithms.numeric.modular-square-roots/focused-sample | 756 |
code_trace-008dea6df2ba6f0e | Trace this code by hand; do not guess.
```python
from fractions import Fraction
Poly = tuple[Fraction, ...]
def evaluate(p: Poly, x: Fraction) -> Fraction:
total = Fraction(0)
for coefficient in reversed(p):
total = total * x + coefficient
return total
```
What does `evaluate((Fraction(7, 1), ... | code_trace | final_output | Fraction | synth | 03-algorithms.certified-analysis.sturm-root-counting | {"ret": "Fraction(142, 1)", "ret_type": "Fraction"} | plain | synth:03-algorithms.certified-analysis.sturm-root-counting/focused-sample | 122 |
code_trace-0092ca4bad0c8a00 | Study how the marked loop below updates its variables.
```python
from dataclasses import dataclass
@dataclass(slots=True)
class TierNode:
"""One tier of a residential rate schedule."""
price_per_kwh: float
link: TierNode | None = None
def build_schedule(prices: list[float]) -> TierNode | None:
"""... | code_trace | loop_state | N1 | ol5 | linked_list | {"loop_line": 16, "after_passes": 1, "values": {"tail": "TierNode(price_per_kwh=2.5, link=None)"}} | plain | ol5:8f3df95a0a278e23 | 230 |
code_trace-00933054a82e7a32 | Request: What is the value of the local variable `value` right before the second execution of the line marked `# <- A`, during the call `sum_warehouse_values_by_category([('tools', 1), ('tools', 3)])`?
```python
def sum_warehouse_values_by_category(entries: list[tuple[str, int | float]]) -> dict[str, int | float]:
... | code_trace | var_at_line | k2 | r3vc | dicts | {"line": 7, "var": "value", "hit": 2, "value": "3", "hits_total": 2} | qa | r3vc:vcode4-1c36cd32e38d8c1a | 197 |
code_trace-0095e5c938ef4603 | Here is a Python function with a marked line.
```python
from dataclasses import dataclass
@dataclass(slots=True, frozen=True)
class LineItem:
"""One ledger line with a label and a signed amount in cents."""
label: str
amount_cents: int
def next_larger_index(items: list[LineItem]) -> list[int | None]:
... | code_trace | var_at_line | k3 | ol5 | monotonic_stack | {"line": 21, "var": "position", "hit": 3, "value": "0", "hits_total": 3} | plain | ol5:0beec7226881d1ec | 292 |
code_trace-009836e41eaf43fc | Instruction: Work through the code below step by step in your head.
```python
def tax_due(wages: float, brackets: list[tuple[float, float]]) -> float:
"""Return tax on wages, charged band by band, rounded to two decimals."""
if wages < 0:
raise ValueError("wages must not be negative")
match bracket... | code_trace | final_output | float | ol5 | match_sequences | {"ret": "0.5", "ret_type": "float", "mutated_line": 16, "mutant": false} | qa | ol5:75d314592de6c529 | 256 |
code_trace-009a6d24353fdfed | Q: Compute `integer(9, 1, 4611686018427387903, 'Argument')` by tracing the code.
```python
from __future__ import annotations
class TreeError(Exception):
"""Stable error category and optional failing batch instruction index."""
def __init__(self, code: str, index: int | None = None):
self.code = cod... | code_trace | final_output | int | synth | 02-data-structures.trees.kd-tree | {"ret": "9", "ret_type": "int"} | qa | synth:02-data-structures.trees.kd-tree/focused-sample | 181 |
code_trace-009f6e0480b29052 | Work through the code below step by step in your head.
```python
from fractions import Fraction
def rational(x: float) -> Fraction:
return Fraction.from_float(x)
```
Determine the result of `rational(1.000000000015522)`.
Following the execution:
- `return Fraction.from_float(x)` -> returns Fraction(45035996274... | code_trace | final_output | Fraction | synth | 03-algorithms.numeric.numerical-integration | {"ret": "Fraction(4503599627440401, 4503599627370496)", "ret_type": "Fraction"} | plain | synth:03-algorithms.numeric.numerical-integration/focused-sample | 161 |
code_trace-009f7deec3401b8f | Query: Count the calls to `order` that happen while `enumerate_exponent(14)` runs.
```python
from dataclasses import dataclass
from math import gcd, lcm
class ResourceExhausted(RuntimeError):
"""The requested calculation has no result within the supplied work budget."""
def integer(value: int, minimum: int, na... | code_trace | call_count | c6 | synth | 03-algorithms.numeric.carmichael-function | {"function": "order", "calls": 6} | qa | synth:03-algorithms.numeric.carmichael-function/focused-sample | 468 |
code_trace-00a499033171f5f6 | <|start|><|user|>
What is the value of the local variable `duration` right before the fourth execution of the line marked `# <- A`, during the call `buzz_sequence([(0, None), (10, None), (20, 'xx'), (30, None)])`? The code:
```python
type Pulse = tuple[int, str]
def make_pulse(duration: int, pattern: str | None = No... | code_trace | var_at_line | k4 | ol5 | sentinel_defaults | {"line": 21, "var": "duration", "hit": 4, "value": "30", "hits_total": 4} | chat | ol5:da52dc2b97db33db | 330 |
code_trace-00aac1e6c14f332e | What is the return value of `bakery_order_histogram(['bun', 'roll', 'roll', 'bun'])`? The code:
```python
def bakery_order_histogram(orders: list[str]) -> dict[str, int]:
"""Count each bakery order item while preserving first-seen order. Non-string or blank entries raise TypeError or ValueError, respectively."""
... | code_trace | final_output | dict | r3vc | dicts | {"ret": "{'bun': 2, 'roll': 2}", "ret_type": "dict"} | plain | r3vc:vcode4-f631d2565563d8a2 | 185 |
code_trace-00aaf9cae59fff7e | <|start|><|user|>
Here are worked examples of this kind of question.
Example 1:
```python
def _count_sort(order: list[int], keys: list[int], maximum: int) -> list[int]:
counts = [0] * (maximum + 1)
for position in order:
counts[keys[position]] += 1 # marker
cursor = 0
for key, count in enumer... | code_trace | var_at_line | k2 | r3vc | math | {"line": 8, "var": "digit", "hit": 2, "value": "4", "hits_total": 2} | chat | r3vc:vcode4-bc1cad0313823cf5 | 408 |
code_trace-00adb26a5dd772fd | <|start|><|system|>
You are a precise assistant for text and documents.<|eot|>
<|user|>
Consider the following Python code.
```python
class CycleError(Exception):
"""The code attribute is the contract's typed error category."""
def __init__(self, code: str):
self.code = code
super().__init__(c... | code_trace | exception | none | synth | 02-data-structures.sequences.circular-linked-list | {"raises": null, "ret": "0"} | chat | synth:02-data-structures.sequences.circular-linked-list/focused-sample | 273 |
code_trace-00b1869aba94924a | Q: In `degree_bound(4)`, the `while` loop marked `# <- loop` runs several times. Give `degree` at the start of pass 2 of its body, i.e. after 1 completed pass.
```python
from __future__ import annotations
def integer(value: object, low: int, high: int) -> int:
if type(value) is not int or not low <= value <= hig... | code_trace | loop_state | N1 | synth | 02-data-structures.graphs-heaps.fibonacci-heap | {"loop_line": 16, "after_passes": 1, "values": {"degree": "1"}} | qa | synth:02-data-structures.graphs-heaps.fibonacci-heap/focused-sample | 209 |
code_trace-00b304a69c54bea5 | [Task]
You are given the following code.
```python
def primes_upto(limit: int) -> list[int]:
"""Return every prime number from 2 through limit, in increasing order."""
if limit < 2:
return []
flags = [True] * (limit + 1)
flags[0] = False
flags[1] = False
n = 2
while n * n <= limit:
... | code_trace | loop_state | N2 | ol5 | primes_sieve | {"loop_line": 31, "after_passes": 2, "values": {"shares": "{1: 15, 2: 115}"}} | qa | ol5:2fed01ff4b6f7766 | 400 |
code_trace-00b6c582fa45afab | <|start|><|user|>
Give the exact value returned by `calculate_billing_overlap_minutes(9, 40, 25, 60)`.
```python
def calculate_billing_overlap_minutes(start_a: int, end_a: int, start_b: int, end_b: int, billing_increment: int = 1) -> int:
"""Calculate the overlap of two billing ranges in rounded-up minutes.
Ra... | code_trace | final_output | int | r3vc | dates | {"ret": "15", "ret_type": "int"} | chat | r3vc:vcode4-4661c5181da2f11b | 240 |
code_trace-00bb9650f196b1f6 | Question: Solved examples first, then your task.
Example 1:
```python
def split_batch(weights: list[float]) -> tuple[float, list[float]]:
"""Split a calabura batch into the banner fruit and the remaining berries."""
first, *rest = weights
return first, rest
def count_sellable(batch: list[float], *, min_... | code_trace | final_output | dict | ol5 | stable_sort | {"ret": "{'A': 2, 'C': 1}", "ret_type": "dict"} | qa | ol5:5a6f92405a37a806 | 473 |
code_trace-00bbc8f7fce1591a | Below is some Python code to trace.
```python
def is_echo(word: str) -> bool:
"""Report whether word, lowercased and reduced to alphanumerics, is an echo."""
letters = [ch.lower() for ch in word if ch.isalnum()]
lo, hi = 0, len(letters) - 1
while lo < hi:
if letters[lo] != letters[hi]:
... | code_trace | var_at_line | k3 | ol5 | palindromes | {"line": 8, "var": "hi", "hit": 3, "value": "4", "hits_total": 3} | plain | ol5:6a173bd33dfc5349 | 198 |
code_trace-00bc66f0ef250e1a | Request: Consider the call `_verify([0, 0, 2], [0, 0, 0], 0, {'windows': 1, 'hash_hits': 0, 'spurious': 0, 'verify_comparisons': 0})`. What value does `j` hold immediately before the marked line (`# [X]`) executes for the third time?
```python
from typing import TypedDict
MAX_COUNT = (1 << 53) - 1
class CountOverf... | code_trace | var_at_line | k3 | synth | 03-algorithms.strings.rabin-karp | {"line": 37, "var": "j", "hit": 3, "value": "2", "hits_total": 3} | qa | synth:03-algorithms.strings.rabin-karp/focused-sample | 465 |
code_trace-00bdafbdae821dc7 | Task: Look at the following Python snippet, in which one line is tagged with a comment.
```python
def total_leaf(parts: dict[str, float]) -> float:
"""Return the total leaf amount, rejecting negative parts."""
total = 0.0
for name, amount in parts.items():
if amount < 0:
raise ValueErro... | code_trace | var_at_line | k2 | ol5 | parametrized_cases | {"line": 28, "var": "got", "hit": 2, "value": "'pure '", "hits_total": 2} | qa | ol5:107242ab108f7a49 | 358 |
code_trace-00bec6f861867142 | Work through the code below step by step in your head.
```python
from dataclasses import dataclass
@dataclass(slots=True)
class DayPlan:
"""A parsed chore schedule: task durations and a per-day hour limit."""
chores: list[int]
limit: int
def min_days(plan: DayPlan) -> int | None:
"""Return the few... | code_trace | final_output | NoneType | ol5 | backtracking | {"ret": "None", "ret_type": "NoneType"} | plain | ol5:6f1a41602b909fdc | 403 |
code_trace-00beebd6de4740f9 | Query: Here is some Python code.
```python
import calendar
from datetime import date
def bank_statement_mondays(year, month):
"""Return every Monday in the specified month as a date.
Raise ValueError if the year or month is invalid.
"""
weeks = calendar.monthcalendar(year, month)
return [date(yea... | code_trace | final_output | list | r3vc | dates | {"ret": "[datetime.date(2023, 9, 4), datetime.date(2023, 9, 11), datetime.date(2023, 9, 18), datetime.date(2023, 9, 25)]", "ret_type": "list"} | qa | r3vc:vcode4-00e96aa6bee047d4 | 485 |
code_trace-00bf98483f8e4ec4 | Instruction: Here is some Python code.
```python
Permutation = tuple[int, ...]
def natural(value: int, name: str) -> None:
if type(value) is not int or value < 0:
raise ValueError(f"{name} must be a nonnegative integer")
def permutation(images: Permutation, n: int) -> Permutation:
natural(n, "degre... | code_trace | exception | ValueError | synth | 03-algorithms.group-theory.orbits-stabilizers | {"raises": "ValueError", "line": 14} | qa | synth:03-algorithms.group-theory.orbits-stabilizers/focused-sample | 252 |
code_trace-00c4341448ca889f | Question: Examples:
Example 1:
```python
from collections.abc import Iterator
type PaneTree = str | int | list["PaneTree"]
def unit_leaves(layout: PaneTree) -> Iterator[str | int]:
"""Yield each pane label and spacer width, depth-first from left to right."""
if isinstance(layout, (str, int)):
yiel... | code_trace | call_count | c3 | synth | 03-algorithms.numeric.modular-square-roots | {"function": "integer", "calls": 3} | qa | synth:03-algorithms.numeric.modular-square-roots/focused-sample | 876 |
code_trace-00c5dc87a6059865 | Question: When `square_root(373)` runs, execution reaches the line marked `# <-- here` one or more times. Just before that line runs for the sixth time, what is the value of `state`?
```python
from dataclasses import dataclass
from math import isqrt
class ArithmeticLimit(ArithmeticError):
"""A stored or intermed... | code_trace | var_at_line | k6 | synth | 03-algorithms.numeric.continued-fractions | {"line": 61, "var": "state", "hit": 6, "value": "(19, 1, 38)", "hits_total": 6} | qa | synth:03-algorithms.numeric.continued-fractions/focused-sample | 729 |
code_trace-00cf52a9e801ed05 | Trace the loop in the code below by hand.
```python
from __future__ import annotations
from dataclasses import dataclass
LIMIT = 32
class ResourceLimitError(ValueError):
"""The declared finite-set budget is exceeded."""
def size_checked(value: int) -> int:
if type(value) is not int:
raise TypeEr... | code_trace | loop_state | N1 | synth | 01-foundations.mathematics.functions-and-orders | {"loop_line": 47, "after_passes": 1, "values": {"transitive": "False"}} | plain | synth:01-foundations.mathematics.functions-and-orders/focused-sample | 550 |
code_trace-00cfbbc64e3d5907 | <|start|><|user|>
Compute `midpoint(0.296875, 1.0)` by tracing the code.
```python
def midpoint(a: float, b: float) -> float:
return a / 2 + b / 2 if a < 0 < b else a + (b - a) / 2
```<|eot|>
<|assistant|>
Step by step:
- `return a / 2 + b / 2 if a < 0 < b else a + (b - a) / 2` -> returns 0.6484375
Answer: 0.6484... | code_trace | final_output | float | synth | 03-algorithms.numeric.root-finding | {"ret": "0.6484375", "ret_type": "float"} | chat | synth:03-algorithms.numeric.root-finding/focused-sample | 134 |
code_trace-00d514e9d220e39a | Which type does `window_labels(['only'], 10)` return? Give `type(...).__name__`. The code:
```python
from dataclasses import dataclass
@dataclass(slots=True)
class Page[T]:
"""One page of records with its 1-based page number."""
items: list[T]
number: int
def paginate[T](items, page_size, *, offset=0)... | code_trace | return_type | list | ol5 | pagination | {"ret_type": "list", "ret": "['page 1: 1 claims']"} | plain | ol5:89de7645f2ba4e68 | 242 |
code_trace-00d606dc70e26c44 | <|start|><|user|>
`age_range_bucket(11)` returns what? Write it the way Python's repr() would.
```python
def age_range_bucket(age):
"""Classify an age into a broad life-stage range."""
if age < 0:
raise ValueError("age must not be negative")
if age < 13:
return "child"
if age < 20:
... | code_trace | final_output | str | r3vc | cleaning | {"ret": "'child'", "ret_type": "str"} | chat | r3vc:vcode4-96f9a3881148d636 | 128 |
code_trace-00db3e6f50e87964 | Query: The following Python code is self-contained.
```python
from __future__ import annotations
from fractions import Fraction
Polynomial = tuple[Fraction, ...]
def equations(a: Polynomial, m: int, n: int) -> tuple[list[list[Fraction]], Polynomial]:
matrix = [
[a[k - j] if k >= j else Fraction(0) for... | code_trace | final_output | tuple | synth | 03-algorithms.approximation.pade-approximation | {"ret": "([], ())", "ret_type": "tuple"} | qa | synth:03-algorithms.approximation.pade-approximation/focused-sample | 195 |
code_trace-00e384219484730f | <|start|><|system|>
You are a helpful assistant.<|eot|>
<|user|>
Pause `merged_plan([(0, 5), (7, 4)], 5, 7)` just as the line with the comment `# (*)` is about to execute for the second time. What is `lo` then?
```python
from collections.abc import Iterator
type Interval = tuple[int, int]
def _merged_spans(existin... | code_trace | var_at_line | k2 | ol5 | interval_list | {"line": 21, "var": "lo", "hit": 2, "value": "7", "hits_total": 2} | chat | ol5:a8929789e95dc27d | 336 |
code_trace-00e8131347172dc8 | <|start|><|system|>
You are a careful assistant. Follow the user's instructions exactly.<|eot|>
<|user|>
Trace this code by hand; do not guess.
```python
LIMIT = 64
def _natural(value: int) -> None:
if type(value) is not int or value < 0:
raise ValueError("expected a nonnegative integer")
def _series(v... | code_trace | final_output | tuple | synth | 01-foundations.mathematics.generating-functions | {"ret": "(0, 0, 2, -3)", "ret_type": "tuple"} | chat | synth:01-foundations.mathematics.generating-functions/focused-sample | 360 |
code_trace-00e912e48836523b | Calling `checked(4)`: exception or normal return? Say which exception class, or what it returns.
```python
MIN64 = -(1 << 63)
MAX64 = (1 << 63) - 1
def checked(value: int) -> int:
if not MIN64 <= value <= MAX64:
raise OverflowError("signed 64-bit intermediate overflow")
return value
```
No excepti... | code_trace | exception | none | synth | 01-foundations.mathematics.recurrences | {"raises": null, "ret": "4"} | plain | synth:01-foundations.mathematics.recurrences/focused-sample | 104 |
code_trace-00eb2db1ca5cfb45 | <|start|><|system|>
You are a careful assistant. Follow the user's instructions exactly.<|eot|>
<|user|>
Trace the code below by hand.
```python
from dataclasses import dataclass
from math import isqrt
class ResourceLimit(RuntimeError):
"""A configured work or integer-size budget was exhausted."""
@dataclass(f... | code_trace | var_at_line | k4 | synth | 03-algorithms.numeric.pell-equations | {"line": 45, "var": "x", "hit": 4, "value": "11", "hits_total": 4} | chat | synth:03-algorithms.numeric.pell-equations/focused-sample | 517 |
code_trace-00eb872d47e53546 | Compute `polynomial([-7])` by tracing the code.
```python
from fractions import Fraction as Q
Poly = tuple[Q, ...]
def polynomial(values) -> Poly:
values = tuple(values)
if any(not isinstance(v, (int, Q)) or isinstance(v, bool) for v in values):
raise ValueError("coefficients must be exact integers... | code_trace | final_output | tuple | synth | 03-algorithms.certified-analysis.polynomial-extrema | {"ret": "(Fraction(0, 1),)", "ret_type": "tuple", "mutated_line": 11, "mutant": true} | plain | synth:03-algorithms.certified-analysis.polynomial-extrema/focused-sample | 147 |
code_trace-00ee1d5c2f791e5b | <|start|><|user|>
Examine this function; a comment marks the line of interest.
```python
import re
def count_filing_citations_by_reporter(citations: list[str], reporters: list[str] | None = None) -> dict[str, int]:
"""Count citations by reporter, optionally limiting which reporters are included."""
counts = ... | code_trace | var_at_line | k3 | r3vc | legal_citations | {"line": 11, "var": "reporter", "hit": 3, "value": "'F.3d'", "hits_total": 3} | chat | r3vc:vcode4-8cdabff1ff73523c | 298 |
code_trace-00ee5d871898c3e6 | Trace this code by hand; do not guess.
```python
from __future__ import annotations
from dataclasses import dataclass
@dataclass(frozen=True)
class Payload:
key: int
priority: int
left: Payload | None = None
right: Payload | None = None
count: int = 1
height: int = 1
def count(node: Payloa... | code_trace | final_output | int | synth | 02-data-structures.trees.y-fast-trie | {"ret": "0", "ret_type": "int"} | plain | synth:02-data-structures.trees.y-fast-trie/focused-sample | 284 |
code_trace-00f12453b55e0a85 | Pause `plan_batch([5, 6], 4)` just as the line with the comment `# <-- here` is about to execute for the second time. What is `value` then? The code:
```python
def _longest_within(times: list[int], budget: int) -> tuple[int, int]:
"""Return (start, length) of the longest window whose total is at most budget."""
... | code_trace | var_at_line | k2 | ol5 | sliding_window | {"line": 7, "var": "value", "hit": 2, "value": "6", "hits_total": 2} | plain | ol5:a04b10f95ac15e9e | 322 |
code_trace-00f1aec290c40202 | Does `_advance(NFA(edges=(((-1, 1),), ()), start=0, accept=1), {6}, 5)` raise an exception? If it does, name the exception class; if not, give the return value. The code:
```python
from dataclasses import dataclass
Edge = tuple[int | None, int]
@dataclass(frozen=True)
class NFA:
"""Immutable compiled record; c... | code_trace | exception | IndexError | synth | 03-algorithms.strings.thompson-nfa | {"raises": "IndexError", "line": 40} | plain | synth:03-algorithms.strings.thompson-nfa/focused-sample | 355 |
code_trace-00f3f837d5ce26d3 | Task: You are given the following code.
```python
class FenwickError(Exception):
"""Contract error with a stable typed cause."""
class InvalidState(FenwickError):
pass
def exact(value: int) -> int:
if not -(1 << 63) <= value < (1 << 63):
raise InvalidState("cell arithmetic exceeds signed 64 bit... | code_trace | exception | none | synth | 02-data-structures.trees.fenwick-tree | {"raises": null, "ret": "-10"} | qa | synth:02-data-structures.trees.fenwick-tree/focused-sample | 129 |
code_trace-00f540247d7fb75b | Which type does `first_at_least([2, 1, 3], 5)` return? Give `type(...).__name__`.
```python
def _boundary(prices, wallet):
lo, hi = 0, len(prices)
while lo < hi:
mid = (lo + hi) // 2
if prices[mid] < wallet:
lo = mid + 1
else:
hi = mid
return lo
def first_a... | code_trace | return_type | NoneType | ol5 | binary_search | {"ret_type": "NoneType", "ret": "None"} | plain | ol5:6f0aad4a7eda36d2 | 145 |
code_trace-00f8cce08ff90c53 | Trace `prefix([-1], [-3], 22)` and count how often `next_exact` is called.
```python
from collections.abc import Sequence
MIN64 = -(1 << 63)
MAX64 = (1 << 63) - 1
def integer(value: int, low: int, high: int) -> int:
"""Reject bool as well as values outside an inclusive integer domain."""
if type(value) i... | code_trace | call_count | c9 | synth | 01-foundations.mathematics.recurrences | {"function": "next_exact", "calls": 21} | plain | synth:01-foundations.mathematics.recurrences/focused-sample | 485 |
code_trace-00f9ddf191e6b4db | Evaluate `partition_camping_guests_by_parity([0, 10])`. Answer with the repr of the result.
```python
def partition_camping_guests_by_parity(guest_numbers):
"""Partition reservation numbers into even and odd groups while preserving their order. Raises TypeError if an item is not an integer and ValueError if an ite... | code_trace | final_output | tuple | r3vc | lists | {"ret": "([0, 10], [])", "ret_type": "tuple"} | plain | r3vc:vcode4-0f9ce03f4ffedf0a | 189 |
code_trace-00fe423427e50aa3 | <|start|><|user|>
Examine this function; a comment marks the line of interest.
```python
def compare(left: bytes, right: bytes) -> int:
"""Unsigned lexicographic comparison, including equal prefixes."""
for index in range(min(len(left), len(right))):
if left[index] != right[index]:
return -... | code_trace | var_at_line | k2 | synth | 02-data-structures.maps.set | {"line": 12, "var": "middle", "hit": 2, "value": "2", "hits_total": 2} | chat | synth:02-data-structures.maps.set/focused-sample | 306 |
code_trace-0101c6513ca04c53 | <|start|><|user|>
Suppose execution is paused just before the line marked `# <-- here` runs for the second time in `coerce_appointment_amounts({'De': '4', 'ilE': 'oops'})`. What does `converted` contain?
```python
import math
def coerce_appointment_amounts(appointments: dict[str, str]) -> tuple[dict[str, int | float... | code_trace | var_at_line | k2 | r3vc | cleaning | {"line": 15, "var": "converted", "hit": 2, "value": "{'De': 4}", "hits_total": 2} | chat | r3vc:vcode4-60b037aee2bd4dc0 | 309 |
code_trace-0106eb626d9555ef | Q: Here is some Python code.
```python
from dataclasses import dataclass
from fractions import Fraction
Point = tuple[Fraction, Fraction]
class ResourceLimit(ArithmeticError):
"""A coefficient would exceed the chosen bit budget."""
@dataclass(frozen=True)
class Budget:
bits: int = 16384
def __post_i... | code_trace | final_output | tuple | synth | 03-algorithms.geometry.orientation-predicate | {"ret": "(Fraction(11, 5), Fraction(-4, 1))", "ret_type": "tuple"} | qa | synth:03-algorithms.geometry.orientation-predicate/focused-sample | 684 |
code_trace-010b83b59cf6109f | <|start|><|user|>
Consider the following Python code.
```python
from __future__ import annotations
LIMIT = 4096
class ResourceLimitError(ValueError):
"""The requested traversal exceeds the declared educational budget."""
def nonnegative(value: int) -> int:
if type(value) is not int:
raise TypeErr... | code_trace | final_output | int | synth | 01-foundations.mathematics.binomial-coefficients | {"ret": "0", "ret_type": "int"} | chat | synth:01-foundations.mathematics.binomial-coefficients/focused-sample | 385 |
code_trace-01174e408cb29984 | What does `window_maxes([5.0, 1.0, 1.0, 0.0, 1.0], 3)` return? Give the value as a Python literal.
```python
def window_maxes(readings: list[float], k: int) -> list[float]:
"""Return the maximum of each window of k consecutive readings."""
class _Ring:
"""Fixed-capacity ring buffer of floats with a wr... | code_trace | final_output | list | ol5 | ring_buffer | {"ret": "[5.0, 1.0, 1.0]", "ret_type": "list"} | plain | ol5:f2054fe9d8a321bc | 358 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.