id stringlengths 22 22 | text stringlengths 134 7.81k | sub stringclasses 12
values | fmt stringclasses 2
values | variant stringclasses 2
values | n_steps int64 1 10 | teacher stringclasses 4
values | skill stringclasses 232
values | n_tokens int64 36 2.64k | item_uid stringlengths 16 16 |
|---|---|---|---|---|---|---|---|---|---|
ol5-08420f0e4e08554e-1 | <|start|><|user|>
Skill check: Track down and fix the error in the Python below and give the corrected code. The test that breaks - `assert ions_per_unit(Alkali.SODA_LYE) == 1`
```python
from dataclasses import dataclass
from enum import Enum, unique
@unique
class Alkali(Enum):
"""Alkalis with the hydroxide ions... | code_bugfix | chat | worked | 1 | glm-5.3-flash | tree_recursive | 1,092 | 08420f0e4e08554e |
ol5-08420f0e4e08554e-2 | Task: Update the following module.
```python
from typing import List, Union
class Alkali(object):
"""Alkali kinds as plain class attributes."""
def __init__(self, label, ions):
self.label = label
self.ions = ions
Alkali.SODA_LYE = Alkali("sodium hydroxide", 1)
Alkali.CAUSTIC_POTASH = Alkal... | code_refactor | plain | worked | 1 | glm-5.3-flash | tree_recursive | 1,014 | 08420f0e4e08554e |
ol5-0853ff0a303a09c5-0 | Practice: Create a typed solution plus tests for the request below.
For a review queue of notices of exemption filed under 49 CFR 1182.9, I want the dockets split by review tier and read back tier by tier. Write a frozen dataclass `ExemptionNotice` with the fields `docket: str`, `tier: str` and `pages: int`, plus `def... | code_impl_tests | plain | worked | 1 | ds-v4.1-flash | bucket_sort | 1,185 | 0853ff0a303a09c5 |
ol5-0853ff0a303a09c5-2 | Add a test suite for this code.
```python
from dataclasses import dataclass
@dataclass(frozen=True, slots=True)
class ExemptionNotice:
"""A filed notice of exemption with a docket code, a tier and a page count."""
docket: str
tier: str
pages: int
def bucket_by_tier(notices: list[ExemptionNotice]) ... | code_tests | plain | answer_only | 1 | ds-v4.1-flash | bucket_sort | 950 | 0853ff0a303a09c5 |
ol5-08876f200f803c0b-0 | Activity: Implement idiomatic Python for the following request.
Our personnel office keeps service-step adjustment records and wants a plain aligned text report. Define the slots dataclasses `Advance(ident: str, steps: int)`, `Deferral(ident: str, months: int)` and `Suspension(ident: str, reason: str)`, the alias `typ... | code_impl | plain | worked | 1 | glm-5.3-flash | match_statement | 848 | 08876f200f803c0b |
ol5-08876f200f803c0b-1 | Correct the module below. This assertion fails - `test_report_alignment_and_order()`
```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."""
i... | code_bugfix | plain | worked | 1 | glm-5.3-flash | match_statement | 977 | 08876f200f803c0b |
ol5-08876f200f803c0b-2 | Convert the legacy code below in idiomatic Python 3.14, keeping its behaviour.
```python
class Advance(object):
def __init__(self, ident, steps):
self.ident = ident
self.steps = steps
class Deferral(object):
def __init__(self, ident, months):
self.ident = ident
self.months = m... | code_refactor | plain | worked | 1 | glm-5.3-flash | match_statement | 1,025 | 08876f200f803c0b |
ol5-08a4a39e4437f1e2-0 | Answer the short problem below.
The Director will rank each application using five criteria, and each criterion may earn at most 20 points. No application can earn points beyond the stated maximum on any criterion. What is the greatest total score one application can receive?
<|think|>
1. Greatest total score: 5 × 20... | math_wp | plain | worked | 1 | glm-5.3-flash | counting_principle | 78 | 08a4a39e4437f1e2 |
ol5-08c11f95df6b142c-0 | Answer the question below. Show the working.
A nursery grows two privet hedge cultivars in beds whose areas are in the ratio 3:4. Fertilizer for all the beds costs $84 in total, shared in the same ratio. How many dollars go to the beds of the first cultivar?
<|think|>
1. Share of the first cultivar: 84 × 3 ÷ 7 = 36
<... | math_wp | plain | worked | 1 | glm-5.3-flash | ratio_share | 94 | 08c11f95df6b142c |
ol5-08c11f95df6b142c-1 | Solve the problem that follows.
A nursery grows two privet hedge cultivars in beds whose areas are in the ratio 3:4. Fertilizer for all the beds costs $84 in total, shared in the same ratio. How many dollars go to the beds of the first cultivar?
Answer: $36 | math_wp | plain | answer_only | 1 | glm-5.3-flash | ratio_share | 70 | 08c11f95df6b142c |
ol5-08e63d6f3a86363c-0 | Under 24 CFR 232.510, a lender charges a commitment fee of 0.75% of a loan commitment. For a commitment of $240,000, how much is the commitment fee?
<|think|>
1. Commitment fee: 240000 × 0.0075 = 1800
<|/think|>
Answer: $1,800.00 | math_wp | plain | worked | 1 | ds-v4.1-flash | unit_conversion | 71 | 08e63d6f3a86363c |
ol5-08e63d6f3a86363c-1 | Under 24 CFR 232.510, a lender charges a commitment fee of 0.75% of a loan commitment. For a commitment of $240,000, how much is the commitment fee?
Answer: $1,800.00 | math_wp | plain | answer_only | 1 | ds-v4.1-flash | unit_conversion | 50 | 08e63d6f3a86363c |
ol5-096a2b4ceee408fb-1 | Modernise this older-style Python in idiomatic Python 3.14, keeping its behaviour.
```python
from typing import Dict, List
def canonical_key(word: str) -> str:
"""Return the letters of word, lowercased and sorted, as the group key."""
return "".join(sorted(word.casefold()))
class SeveranceIndex:
"""Pla... | code_refactor | plain | worked | 1 | glm-5.3-flash | anagram_groups | 766 | 096a2b4ceee408fb |
ol5-099f38760e6486af-1 | <|start|><|system|>
You are a puzzle helper.<|eot|>
<|user|>
Self-test: Fix the Python below. The check that does not hold = `assert tally_uses(records) == {"cutting": 2, "general grinding": 1}`
```python
"""Grading of carborundum abrasive records for coarse grinding work."""
from collections.abc import Iterator
typ... | code_bugfix | chat | worked | 1 | glm-5.3-flash | match_mapping | 845 | 099f38760e6486af |
ol5-099f38760e6486af-2 | Rewrite the following module.
```python
"""Grading of carborundum abrasive records for coarse grinding work."""
from typing import Dict, Iterator, List, Tuple
Record = Dict[str, object]
_COARSE_BELOW = 120
def coarse_records(records):
"""Yield (grit, application) pairs for coarse records, in input order."""
... | code_refactor | plain | worked | 1 | glm-5.3-flash | match_mapping | 762 | 099f38760e6486af |
ol5-099f38760e6486af-3 | Add full type annotations to the code below so that ty accepts it.
```python
"""Grading of carborundum abrasive records for coarse grinding work."""
from collections.abc import Iterator
type Record = dict[str, str | int]
_COARSE_BELOW = 120
def coarse_records(records):
"""Yield (grit, application) pairs for co... | code_types | plain | worked | 1 | glm-5.3-flash | match_mapping | 726 | 099f38760e6486af |
ol5-099f38760e6486af-4 | Produce tests for the module that follows.
```python
"""Grading of carborundum abrasive records for coarse grinding work."""
from collections.abc import Iterator
type Record = dict[str, str | int]
_COARSE_BELOW = 120
def coarse_records(records: list[Record]) -> Iterator[tuple[int, str]]:
"""Yield (grit, appli... | code_tests | plain | answer_only | 1 | glm-5.3-flash | match_mapping | 926 | 099f38760e6486af |
ol5-09b5d6b7e7911309-0 | Put together a typed Python module for the task below.
Our costume loft tags each formal garment with a sequence of piece labels in assembly order, for example `["bodice", "skirt", "sash", "sash"]`. Write a generator `garment_pieces(codes: list[list[str]]) -> Iterator[tuple[str, int]]` that yields one `(kind, count)` ... | code_impl | plain | worked | 1 | glm-5.3-flash | match_sequences | 652 | 09b5d6b7e7911309 |
ol5-09b5d6b7e7911309-2 | Annotate the code below so that ty accepts it.
```python
from collections.abc import Iterator
def garment_pieces(codes):
"""Yield one (kind, piece count) pair per garment code."""
for code in codes:
match code:
case ["bodice", "skirt", *trims]:
yield ("gown", 2 + len(trims... | code_types | plain | worked | 1 | glm-5.3-flash | match_sequences | 597 | 09b5d6b7e7911309 |
ol5-09ccaf3df9095359-0 | Code up the Python that the specification below describes.
I'm building a tiny simulator for a virus lab that keeps cultures alive by name and lets the operator take back mistakes. Write a `Lineage` class (`__init__(self, name: str) -> None`) holding a current name, an undo stack and a redo stack, plus a function `ste... | code_impl | plain | worked | 1 | glm-5.3-flash | undo_stack | 786 | 09ccaf3df9095359 |
ol5-0a17391432f6d48f-0 | Draft the specification below in Python 3.14. Show your steps.
Our materials clerk keeps facing orders (the visible exterior layer on a building) as CSV text, and I need the metres per material tallied. Write one top-level function `facing_totals(text: str) -> dict[str, int]` in `solution.py` that reads the text with ... | code_impl | plain | worked | 1 | glm-5.3-flash | csv_text | 594 | 0a17391432f6d48f |
ol5-0a17391432f6d48f-1 | Clean up the module below.
```python
"""Tally facing-material metres from CSV text."""
import csv
import io
def facing_totals(text):
"""Sum metres per facing material from two-field CSV rows."""
totals = {}
rows = list(csv.reader(io.StringIO(text)))
position = 0
while position < len(rows):
... | code_refactor | plain | worked | 1 | glm-5.3-flash | csv_text | 627 | 0a17391432f6d48f |
ol5-0a17391432f6d48f-2 | Annotate every function below.
```python
"""Tally facing-material metres from CSV text."""
import csv
import io
def facing_totals(text):
"""Sum metres per facing material from two-field CSV rows."""
totals = {}
for row in csv.reader(io.StringIO(text)):
if len(row) != 2:
msg = f"row {... | code_types | plain | worked | 1 | glm-5.3-flash | csv_text | 587 | 0a17391432f6d48f |
ol5-0a9cdc722615efd1-0 | Develop a Python solution to the task that follows.
For our nonshared tutoring programme every student gets an individual timetable, so I need a tiny planner module. Write a slots dataclass `TutorPlan` with fields `student: str`, `core_slot: str` and `extra_slots: tuple[str, ...]`, a function `split_slots(slots: list[... | code_impl | plain | worked | 1 | glm-5.3-flash | star_unpacking | 678 | 0a9cdc722615efd1 |
ol5-0a9cdc722615efd1-1 | Exercise: Produce the Python that the specification below describes.
For our nonshared tutoring programme every student gets an individual timetable, so I need a tiny planner module. Write a slots dataclass `TutorPlan` with fields `student: str`, `core_slot: str` and `extra_slots: tuple[str, ...]`, a function `split_s... | code_impl | plain | answer_only | 1 | glm-5.3-flash | star_unpacking | 583 | 0a9cdc722615efd1 |
ol5-0a9cdc722615efd1-2 | Mini-problem: Type-annotate the code below for a strict type checker.
```python
from dataclasses import dataclass
@dataclass(slots=True)
class TutorPlan:
"""An individual (nonshared) tutoring plan for one student."""
student: str
core_slot: str
extra_slots: tuple[str, ...]
def split_slots(slots):
... | code_types | plain | worked | 1 | glm-5.3-flash | star_unpacking | 680 | 0a9cdc722615efd1 |
ol5-0a9cdc722615efd1-3 | Activity: Create test functions that cover the rules of the module below.
```python
from dataclasses import dataclass
@dataclass(slots=True)
class TutorPlan:
"""An individual (nonshared) tutoring plan for one student."""
student: str
core_slot: str
extra_slots: tuple[str, ...]
def split_slots(slot... | code_tests | plain | answer_only | 1 | glm-5.3-flash | star_unpacking | 808 | 0a9cdc722615efd1 |
ol5-0aabbff984a071d6-0 | Give the printed output of this program.
```python
from graphlib import TopologicalSorter
plan: dict[str, set[str]] = {
"season the lemonwood": set(),
"cut the blanks": {"season the lemonwood"},
"carve the spoons": {"cut the blanks"},
"oil the spoons": {"carve the spoons"},
}
def order(chart: dict[s... | code_trace | plain | worked | 1 | glm-5.3-flash | graphlib | 283 | 0aabbff984a071d6 |
ol5-0ab980ce86cfef25-0 | What does the following code output?
```python
from collections.abc import Iterable
Vector = dict[str, int]
def dot(a: Vector, b: Vector) -> int:
"""Dot product over sparse coordinate maps."""
return sum(v * b.get(k, 0) for k, v in a.items())
def add(a: Vector, b: Vector) -> Vector:
"""Add two sparse ... | code_trace | plain | worked | 1 | glm-5.3-flash | sparse_vector | 494 | 0ab980ce86cfef25 |
ol5-0af6bd2dc6ccf0c8-1 | Problem: Debug the module below. Failing test = `assert watch.calls == 3 + 2 + 1 + 2`
```python
from abc import ABC, abstractmethod
class CrakeWatch(ABC):
"""Tracks field observations of one crake over a morning."""
def __init__(self) -> None:
self.encounters = 0
self.flights = 0
sel... | code_bugfix | plain | worked | 1 | glm-5.3-flash | abc_interface | 953 | 0af6bd2dc6ccf0c8 |
ol5-0b3988c2d775c05d-0 | <|start|><|user|>
Produce the following task in modern Python. Show your steps.
I am cataloguing drill-core samples from an ilmenite deposit and need a hit counter. Write a class `AssayLedger` with `__init__(self) -> None`, `add(self, sample: str) -> None` which appends one assay string to an internal list, `count_hit... | code_impl | chat | worked | 1 | glm-5.3-flash | string_matching | 656 | 0b3988c2d775c05d |
ol5-0b3988c2d775c05d-1 | Find and fix the bug in this code, which fails one of its tests. Failing assertion: `assert ledger.count_hits("Ti") == 5`
```python
class AssayLedger:
"""Collects ilmenite assay strings and counts overlapping marker hits."""
def __init__(self) -> None:
self._samples: list[str] = []
def add(self, ... | code_bugfix | plain | worked | 1 | glm-5.3-flash | string_matching | 708 | 0b3988c2d775c05d |
ol5-0b3988c2d775c05d-2 | Work it out: Modernise the following module without changing what it does.
```python
from typing import List
class AssayLedger(object):
"""Collects ilmenite assay strings and counts overlapping marker hits."""
def __init__(self):
self._samples = [] # type: List[str]
def add(self, sample):
... | code_refactor | plain | worked | 1 | glm-5.3-flash | string_matching | 719 | 0b3988c2d775c05d |
ol5-0b3988c2d775c05d-3 | Add test functions that cover the rules of the module below.
```python
class AssayLedger:
"""Collects ilmenite assay strings and counts overlapping marker hits."""
def __init__(self) -> None:
self._samples: list[str] = []
def add(self, sample: str) -> None:
"""Append one assay string to t... | code_tests | plain | answer_only | 1 | glm-5.3-flash | string_matching | 698 | 0b3988c2d775c05d |
ol5-0b4b5691f0d9edcf-0 | <|start|><|user|>
Five neighbors mailed gifts to the Robert S. Kerr Center to help with habitat conservation work. The gifts were $12, $20, $15, $28, and $25. What was the mean gift?<|eot|>
<|assistant|>
<|think|>
1. Sum of the gifts: 12 + 20 + 15 + 28 + 25 = 100
2. Mean gift: 100 ÷ 5 = 20
<|/think|>
Answer: $20.00<|eo... | math_wp | chat | worked | 1 | glm-5.3-flash | mean_median_mode | 104 | 0b4b5691f0d9edcf |
ol5-0bdb801a4a37b991-0 | Put together the following task in modern Python.
Our payroll team routes each record through a small approval pipeline, and the routing logic must live in one dispatch table. Write `PayEvent` and `PayState` enums plus a function `advance(state: PayState, event: PayEvent) -> PayState`. The legal moves are: DRAFT takes... | code_impl | plain | worked | 1 | glm-5.3-flash | state_machine | 760 | 0bdb801a4a37b991 |
ol5-0bdb801a4a37b991-1 | <|start|><|user|>
Put together typed test functions for the code below.
```python
"""Move payroll records through an approval pipeline."""
from enum import Enum, auto
class PayEvent(Enum):
"""Actions an operator may apply to a payroll record."""
SUBMIT = auto()
APPROVE = auto()
REJECT = auto()
... | code_tests | chat | answer_only | 1 | glm-5.3-flash | state_machine | 1,025 | 0bdb801a4a37b991 |
ol5-0bf5bae6c3c444af-0 | <|start|><|user|>
Write down what the following code prints after tracing it.
```python
"""Compute mixing timestamps for an eggbeater batch log."""
from datetime import UTC, datetime, timedelta
def main() -> None:
"""Stamp a start time and two beat stages in UTC."""
start: datetime = datetime(2026, 5, 1, 8,... | code_trace | chat | worked | 1 | glm-5.3-flash | datetime | 359 | 0bf5bae6c3c444af |
ol5-0bf5bae6c3c444af-1 | <|start|><|user|>
What exactly does the following code print?
```python
"""Compute mixing timestamps for an eggbeater batch log."""
from datetime import UTC, datetime, timedelta
def main() -> None:
"""Stamp a start time and two beat stages in UTC."""
start: datetime = datetime(2026, 5, 1, 8, 30, tzinfo=UTC)... | code_trace | chat | answer_only | 1 | glm-5.3-flash | datetime | 290 | 0bf5bae6c3c444af |
ol5-0bfe09e29281719b-0 | <|start|><|system|>
Be brief and correct.<|eot|>
<|user|>
Solve the question below with a short Python program.
A supplier issued a credit memo for $480. After a dispute, the memo was reduced to $408. By what percent did the memo's value decrease?<|eot|>
<|assistant|>
<|think|>
1. Decrease as a percent: (480 − 408) ÷ ... | math_prog | chat | worked | 1 | glm-5.3-flash | percent_change | 174 | 0bfe09e29281719b |
ol5-0bfe7e1fc0a7eeae-0 | Put together what the task below asks for. Work it step by step.
I need a small scheduler for vessel inspections tied to notices of claim of maritime lien. Write a `Notice` dataclass with `vessel: str`, `start_day: int`, `end_day: int`, and a function `select_patrol(notices: list[Notice]) -> list[Notice]` that picks t... | code_impl | plain | worked | 1 | glm-5.3-flash | greedy_intervals | 726 | 0bfe7e1fc0a7eeae |
ol5-0bfe7e1fc0a7eeae-1 | Draft a Python solution to the task that follows.
I need a small scheduler for vessel inspections tied to notices of claim of maritime lien. Write a `Notice` dataclass with `vessel: str`, `start_day: int`, `end_day: int`, and a function `select_patrol(notices: list[Notice]) -> list[Notice]` that picks the maximum numb... | code_impl | plain | answer_only | 1 | glm-5.3-flash | greedy_intervals | 630 | 0bfe7e1fc0a7eeae |
ol5-0bfe7e1fc0a7eeae-2 | <|start|><|system|>
You are an assistant for a small office.<|eot|>
<|user|>
Find and fix the bug in the following module so that every test passes. Broken test line - `assert len(plan_patrol(notices)) == 2`
```python
from dataclasses import dataclass
@dataclass(slots=True)
class Notice:
"""A notice of claim of ... | code_bugfix | chat | worked | 1 | glm-5.3-flash | greedy_intervals | 899 | 0bfe7e1fc0a7eeae |
ol5-0bfe7e1fc0a7eeae-3 | <|start|><|user|>
Problem: Add full type annotations to the module below.
```python
from dataclasses import dataclass
@dataclass(slots=True)
class Notice:
"""A notice of claim of maritime lien with its patrol window."""
vessel: str
start_day: int
end_day: int
def validate(notices):
"""Raise Va... | code_types | chat | worked | 1 | glm-5.3-flash | greedy_intervals | 836 | 0bfe7e1fc0a7eeae |
ol5-0bfe7e1fc0a7eeae-4 | <|start|><|system|>
You check calculations for an accounting team.<|eot|>
<|user|>
Check: Produce tests that check the behaviour of the module below.
```python
from dataclasses import dataclass
@dataclass(slots=True)
class Notice:
"""A notice of claim of maritime lien with its patrol window."""
vessel: str
... | code_tests | chat | answer_only | 1 | glm-5.3-flash | greedy_intervals | 1,002 | 0bfe7e1fc0a7eeae |
ol5-0c10e5ef43b34a69-0 | Program the behaviour specified below in Python.
For a chemistry flashcard app we need a tiny shape checker for tokenised formulas. Write one top-level function `describe_chain(tokens: tuple[str, ...]) -> str` (small private helpers are fine) that inspects the sequence of element tokens and returns a short description... | code_impl | plain | worked | 1 | glm-5.3-flash | match_sequences | 416 | 0c10e5ef43b34a69 |
ol5-0c10e5ef43b34a69-1 | Spot and correct the mistake in the function below, which fails one of its tests. Failing assertion: `assert describe_chain(("K", "Mn", "O", "O")) == ("chain of 4 tokens led by K and ending at O")`
```python
def describe_chain(tokens: tuple[str, ...]) -> str:
"""Summarise a tokenised chemical sequence by its shape... | code_bugfix | plain | worked | 1 | glm-5.3-flash | match_sequences | 560 | 0c10e5ef43b34a69 |
ol5-0c10e5ef43b34a69-2 | Refactor the code below.
```python
def describe_chain(tokens):
# type: (tuple) -> str
if len(tokens) == 0:
raise ValueError("token sequence must not be empty")
elif len(tokens) == 1:
return "lone element %s" % (tokens[0],)
elif len(tokens) == 2:
return "binary pair %s-%s" % (tok... | code_refactor | plain | worked | 1 | glm-5.3-flash | match_sequences | 439 | 0c10e5ef43b34a69 |
ol5-0c10e5ef43b34a69-3 | Puzzle: Create typed test functions for the code below.
```python
def describe_chain(tokens: tuple[str, ...]) -> str:
"""Summarise a tokenised chemical sequence by its shape."""
match tokens:
case (only,):
return f"lone element {only}"
case (head, second):
return f"binar... | code_tests | plain | answer_only | 1 | glm-5.3-flash | match_sequences | 472 | 0c10e5ef43b34a69 |
ol5-0c797ecdf67dddd4-0 | Write the following task in modern Python.
For a veterans' benefits office, monthly Dependency and Indemnity Compensation rates for a surviving spouse come in tiers. Write a module with a module-level `type` alias `type Tier = str`, a dict `RATES: dict[Tier, int]` holding at least three invented tiers, and three funct... | code_impl | plain | worked | 1 | glm-5.3-flash | counter | 733 | 0c797ecdf67dddd4 |
ol5-0c797ecdf67dddd4-1 | Your turn: Find and fix the bug in the module below and give the corrected code. The failing assertion = `assert top_tiers(["b", "a", "c"]) == [("a", 1), ("b", 1)]`
```python
"""Monthly surviving-spouse compensation rates and claim tallies."""
from collections import Counter
type Tier = str
RATES: dict[Tier, int] = ... | code_bugfix | plain | worked | 1 | glm-5.3-flash | counter | 958 | 0c797ecdf67dddd4 |
ol5-0c797ecdf67dddd4-2 | Problem: Rewrite the code below.
```python
"""Monthly surviving-spouse compensation rates and claim tallies."""
from collections import Counter
from typing import Dict, List, Tuple
RATES = {} # type: Dict[str, int]
RATES["basic"] = 1650
RATES["with_one_child"] = 1920
RATES["with_two_children"] = 2180
RATES["aid_and... | code_refactor | plain | worked | 1 | glm-5.3-flash | counter | 839 | 0c797ecdf67dddd4 |
ol5-0c797ecdf67dddd4-3 | Add type hints to the following module.
```python
"""Monthly surviving-spouse compensation rates and claim tallies."""
from collections import Counter
type Tier = str
RATES: dict[Tier, int] = {
"basic": 1650,
"with_one_child": 1920,
"with_two_children": 2180,
"aid_and_attendance": 2410,
}
def month... | code_types | plain | worked | 1 | glm-5.3-flash | counter | 822 | 0c797ecdf67dddd4 |
ol5-0c985a083c51d9f1-0 | Produce a Python solution to the task that follows. Show the working.
We are labelling an optical bench for a collimation experiment: two elements belong to the same aligned beam group when they touch a common beam label, and this relation chains transitively, so I need connected components. In `solution.py` define a ... | code_impl | plain | worked | 1 | glm-5.3-flash | connected_components | 886 | 0c985a083c51d9f1 |
ol5-0c985a083c51d9f1-1 | Problem: Write the module that the specification below describes.
We are labelling an optical bench for a collimation experiment: two elements belong to the same aligned beam group when they touch a common beam label, and this relation chains transitively, so I need connected components. In `solution.py` define a `Pro... | code_impl | plain | answer_only | 1 | glm-5.3-flash | connected_components | 809 | 0c985a083c51d9f1 |
ol5-0c985a083c51d9f1-2 | <|start|><|system|>
Be brief and correct.<|eot|>
<|user|>
Rewrite the legacy code below into modern, typed Python.
```python
"""Group optical bench elements into collimated beam components."""
from typing import Dict, List, Protocol
class Element(Protocol):
"""An optical element touching one or more beam labels.... | code_refactor | chat | worked | 1 | glm-5.3-flash | connected_components | 1,352 | 0c985a083c51d9f1 |
ol5-0c985a083c51d9f1-3 | Draft a plain-assert test module for the code below.
```python
"""Group optical bench elements into collimated beam components."""
from typing import Protocol
class Element(Protocol):
"""An optical element touching one or more beam labels."""
@property
def element_id(self) -> str: ...
@property
... | code_tests | plain | answer_only | 1 | glm-5.3-flash | connected_components | 1,139 | 0c985a083c51d9f1 |
ol5-0cb97a6c30fbdf8e-0 | Build the module that the specification below describes.
Write `CostKind`, an `Enum` with members `MATERIAL`, `LABOR`, `TRAVEL`; `CostLine`, a slots dataclass with fields `label: str`, `kind: CostKind`, `amount: float`; and `cost_report(lines: list[CostLine], *, include_travel: bool = False) -> tuple[str, list[str]]`.... | code_impl | plain | worked | 1 | glm-5.3-flash | star_unpacking | 710 | 0cb97a6c30fbdf8e |
ol5-0cb97a6c30fbdf8e-1 | Drill: Draft the behaviour specified below in Python.
Write `CostKind`, an `Enum` with members `MATERIAL`, `LABOR`, `TRAVEL`; `CostLine`, a slots dataclass with fields `label: str`, `kind: CostKind`, `amount: float`; and `cost_report(lines: list[CostLine], *, include_travel: bool = False) -> tuple[str, list[str]]`. Th... | code_impl | plain | answer_only | 1 | glm-5.3-flash | star_unpacking | 645 | 0cb97a6c30fbdf8e |
ol5-0cb97a6c30fbdf8e-2 | Add full type annotations to the module below for a strict type checker.
```python
from dataclasses import dataclass
from enum import Enum, auto
class CostKind(Enum):
"""Kinds of cost lines on a transportation cost report."""
MATERIAL = auto()
LABOR = auto()
TRAVEL = auto()
@dataclass(slots=True)
... | code_types | plain | worked | 1 | glm-5.3-flash | star_unpacking | 735 | 0cb97a6c30fbdf8e |
ol5-0d879af73fceae58-0 | Produce a typed Python module for the task below.
We are calibrating a dynamometer bench. Write a module with a Protocol `ForceSensor` declaring `async def read_force(self) -> float`. Implement two classes that satisfy it: `LoadCell(newtons: float)` which reports its newtons directly, and `HydraulicArm(torque: float, ... | code_impl | plain | worked | 1 | glm-5.3-flash | async_basics | 848 | 0d879af73fceae58 |
ol5-0d879af73fceae58-1 | Clean up the following module to current Python idioms.
```python
import asyncio
from typing import List, Protocol
class ForceSensor(Protocol):
async def read_force(self):
...
class LoadCell(object):
def __init__(self, newtons):
self._newtons = newtons
async def read_force(self):
... | code_refactor | plain | worked | 1 | glm-5.3-flash | async_basics | 922 | 0d879af73fceae58 |
ol5-0d879af73fceae58-2 | <|start|><|user|>
Add parameter and return types to the module below for a strict type checker.
```python
"""Dynamometer bench: concurrent force readings from mixed sensors."""
import asyncio
from typing import Protocol
class ForceSensor(Protocol):
"""Anything that can report a force in newtons."""
async d... | code_types | chat | worked | 1 | glm-5.3-flash | async_basics | 1,160 | 0d879af73fceae58 |
ol5-0d879af73fceae58-3 | Draft a test suite for this code.
```python
"""Dynamometer bench: concurrent force readings from mixed sensors."""
import asyncio
from typing import Protocol
class ForceSensor(Protocol):
"""Anything that can report a force in newtons."""
async def read_force(self) -> float: ...
class LoadCell:
"""A s... | code_tests | plain | answer_only | 1 | glm-5.3-flash | async_basics | 974 | 0d879af73fceae58 |
ol5-0d8dc42a5f035676-0 | Your turn: Produce the Python that the specification below describes.
A marina records nightly water-meter snapshots as dicts from slip id to liters used. Write three pure helpers — `added_units(old: dict[str, float], new: dict[str, float]) -> set[str]`, `removed_units(old, new) -> set[str]` and `changed_units(old, ne... | code_impl | plain | worked | 1 | glm-5.3-flash | diff_lists | 775 | 0d8dc42a5f035676 |
ol5-0d8dc42a5f035676-1 | Locate and repair the fault in the following module so that every test passes. The test that breaks = `assert changed_units(old, new) == {"a1"}`
```python
def added_units(old: dict[str, float], new: dict[str, float]) -> set[str]:
"""Return slip ids that appear only in the newer snapshot."""
return new.keys() -... | code_bugfix | plain | worked | 1 | glm-5.3-flash | diff_lists | 952 | 0d8dc42a5f035676 |
ol5-0d8dc42a5f035676-2 | <|start|><|user|>
Clean up the legacy code below without changing what it does.
```python
from typing import Dict, Set
def added_units(old, new):
# type: (Dict[str, float], Dict[str, float]) -> Set[str]
result = set([])
for key in new.keys():
if key not in old:
result.add(key)
ret... | code_refactor | chat | worked | 1 | glm-5.3-flash | diff_lists | 877 | 0d8dc42a5f035676 |
ol5-0dc92b44a6ac28c1-0 | <|start|><|user|>
Review: Write down the exact output of the program below.
```python
from fractions import Fraction
def hem_drop(total: Fraction, panels: int) -> Fraction:
"""Return each panel's share of the coattail drop as an exact fraction."""
if panels <= 0:
raise ValueError("panels must be posi... | code_trace | chat | worked | 1 | glm-5.3-flash | fractions | 248 | 0dc92b44a6ac28c1 |
ol5-0e622062903d0c70-0 | <|start|><|user|>
Figure out the question below. Show your steps.
Lena took her bicycle to a shop for a wheel rebuild. After the work, her repair bill rose from $40 to $52. By what percent did the bill increase?<|eot|>
<|assistant|>
<|think|>
1. Percent increase: (52 − 40) ÷ 40 × 100 = 30
<|/think|>
Answer: 30%<|eot|>... | math_wp | chat | worked | 1 | glm-5.3-flash | percent_change | 92 | 0e622062903d0c70 |
ol5-0e8acf6b3f6fd880-0 | Exercise: Draft the following task in modern Python. Include the working.
A museum wants to stage showpieces on plinths so that each visible piece stands higher than the one before it, reading left to right. Write a `Protocol` named `HeightSource` with a single method `heights(self) -> Sequence[int]`, two small classe... | code_impl | plain | worked | 1 | glm-5.3-flash | dp_lis | 794 | 0e8acf6b3f6fd880 |
ol5-0e8acf6b3f6fd880-1 | <|start|><|user|>
Practice item: Locate and repair the fault in the function below, which fails one of its tests. The check that fails - `test_case_stack_uses_height_column()`
```python
"""Longest strictly increasing chain of showpiece display heights."""
import bisect
from collections.abc import Sequence
from typing... | code_bugfix | chat | worked | 1 | glm-5.3-flash | dp_lis | 1,046 | 0e8acf6b3f6fd880 |
ol5-0e8acf6b3f6fd880-2 | Puzzle: Update the module below in idiomatic Python 3.14, keeping its behaviour.
```python
"""Longest strictly increasing chain of showpiece display heights."""
import bisect
from typing import List, Protocol, Sequence, Tuple
class HeightSource(Protocol):
"""Anything that can list display heights in viewing ord... | code_refactor | plain | worked | 1 | glm-5.3-flash | dp_lis | 1,045 | 0e8acf6b3f6fd880 |
ol5-0ec5382e48f22282-0 | Create the specification below and a plain-assert test module.
I keep paper records for our international service provider filings and want tiny value objects to organise them. Write a frozen, ordered, slotted dataclass `Quarter` with fields `year: int` and `index: int`, plus two functions: `next_quarter(current: Quar... | code_impl_tests | plain | worked | 1 | glm-5.3-flash | dataclass_frozen | 1,011 | 0ec5382e48f22282 |
ol5-0ec5382e48f22282-1 | <|start|><|user|>
Locate and repair the fault in this code. The check that fails = `test_fee_table()`
```python
"""Filing quarters and paper-copy fees for international service filings."""
from dataclasses import dataclass
@dataclass(frozen=True, order=True, slots=True)
class Quarter:
"""A filing quarter, order... | code_bugfix | chat | worked | 1 | glm-5.3-flash | dataclass_frozen | 716 | 0ec5382e48f22282 |
ol5-0ec5382e48f22282-2 | Add parameter and return types to the following module using modern typing syntax.
```python
"""Filing quarters and paper-copy fees for international service filings."""
from dataclasses import dataclass
@dataclass(frozen=True, order=True, slots=True)
class Quarter:
"""A filing quarter, ordered first by year an... | code_types | plain | worked | 1 | glm-5.3-flash | dataclass_frozen | 679 | 0ec5382e48f22282 |
ol5-0edc56c5bc81b2d9-0 | What does the following code print?
```python
def to_base(n: int, base: int) -> str:
"""Render n in the given base using digits and letters."""
digits = "0123456789abcdef"
out = ""
while n:
out = digits[n % base] + out
n //= base
return out or "0"
marks = 45
print(to_base(marks, 2... | code_trace | plain | worked | 1 | glm-5.3-flash | base_conversion | 186 | 0edc56c5bc81b2d9 |
ol5-0f05c2934094fa33-0 | <|start|><|user|>
Program a typed Python module for the task below.
Our volunteer group logs sparrow sightings per garden, and each garden log is a list that may nest further lists (street, block, district). Please write `flatten_nest_counts(records: list[NestItem]) -> Iterator[int]`, a recursive generator that yields... | code_impl | chat | worked | 1 | glm-5.3-flash | flatten | 482 | 0f05c2934094fa33 |
ol5-0f05c2934094fa33-1 | Example: Create a typed Python module for the task below.
Our volunteer group logs sparrow sightings per garden, and each garden log is a list that may nest further lists (street, block, district). Please write `flatten_nest_counts(records: list[NestItem]) -> Iterator[int]`, a recursive generator that yields every int... | code_impl | plain | answer_only | 1 | glm-5.3-flash | flatten | 401 | 0f05c2934094fa33 |
ol5-0f05c2934094fa33-2 | Bring up to date the legacy code below without changing what it does.
```python
"""Flatten nested sparrow count records."""
from typing import Iterator, List, Union
NestItem = Union[int, List["NestItem"]]
def flatten_nest_counts(records):
# type: (List[NestItem]) -> Iterator[int]
"""Yield every sparrow cou... | code_refactor | plain | worked | 1 | glm-5.3-flash | flatten | 582 | 0f05c2934094fa33 |
ol5-0f0ad1aea9918ce0-0 | Answer the question below using a few lines of Python.
Three reviewing teams at a records office share a monthly budget of $720 for handling correction and amendment filings. The teams receive shares of 2, 3, and 4 of the budget. How many dollars does the middle share receive?
<|think|>
1. Middle share: 720 × 3 ÷ 9 =... | math_prog | plain | worked | 1 | glm-5.3-flash | apportionment | 124 | 0f0ad1aea9918ce0 |
ol5-0f0ad1aea9918ce0-1 | Three reviewing teams at a records office share a monthly budget of $720 for handling correction and amendment filings. The teams receive shares of 2, 3, and 4 of the budget. How many dollars does the middle share receive?
Answer: $240 | math_wp | plain | answer_only | 1 | glm-5.3-flash | apportionment | 54 | 0f0ad1aea9918ce0 |
ol5-0f0f772575de968a-0 | Challenge: Develop a typed solution plus tests for the request below.
Our rusk crates are weighed in ascending order and we need two crates whose weights together hit a shipping target exactly. Write one top-level function `rusk_pair(weights: list[int], target: int) -> tuple[int, int] | None` (small helpers are allowe... | code_impl_tests | plain | worked | 1 | glm-5.3-flash | two_pointer | 838 | 0f0f772575de968a |
ol5-0f0f772575de968a-1 | Develop clean, typed Python for the request below.
Our rusk crates are weighed in ascending order and we need two crates whose weights together hit a shipping target exactly. Write one top-level function `rusk_pair(weights: list[int], target: int) -> tuple[int, int] | None` (small helpers are allowed). `weights` is so... | code_impl | plain | answer_only | 1 | glm-5.3-flash | two_pointer | 398 | 0f0f772575de968a |
ol5-0f0f772575de968a-2 | Refactor the module below without changing what it does.
```python
from typing import List, Optional, Tuple
def rusk_pair(weights, target):
"""Return indices of two sorted-list rusks whose weights sum to target."""
if len(weights) < 2:
raise ValueError("need at least two weights")
left = 0
ri... | code_refactor | plain | worked | 1 | glm-5.3-flash | two_pointer | 419 | 0f0f772575de968a |
ol5-0f0f772575de968a-3 | <|start|><|user|>
Add type hints to this code.
```python
def rusk_pair(weights, target):
"""Return indices of two sorted-list rusks whose weights sum to target."""
if len(weights) < 2:
msg = "need at least two weights"
raise ValueError(msg)
left, right = (0, len(weights) - 1)
while left... | code_types | chat | worked | 1 | glm-5.3-flash | two_pointer | 422 | 0f0f772575de968a |
ol5-0f0f772575de968a-4 | Draft checks for every behaviour of the code below.
```python
def rusk_pair(weights: list[int], target: int) -> tuple[int, int] | None:
"""Return indices of two sorted-list rusks whose weights sum to target."""
if len(weights) < 2:
msg = "need at least two weights"
raise ValueError(msg)
lef... | code_tests | plain | answer_only | 1 | glm-5.3-flash | two_pointer | 611 | 0f0f772575de968a |
ol5-0f18d439f1c63757-0 | <|start|><|user|>
Deep Blue Textiles ships 300 yards of polyester fabric to a garment shop. The shop pays 45 days past the due date. The contract sets a late fee of 75 cents for each day an order is late. What late fee does the shop owe?<|eot|>
<|assistant|>
<|think|>
1. Late fee for 45 days: 45 × 0.75 = 33.75
<|/think... | math_wp | chat | worked | 1 | glm-5.3-flash | late_fee | 95 | 0f18d439f1c63757 |
ol5-0f18d439f1c63757-1 | <|start|><|user|>
Deep Blue Textiles ships 300 yards of polyester fabric to a garment shop. The shop pays 45 days past the due date. The contract sets a late fee of 75 cents for each day an order is late. What late fee does the shop owe?<|eot|>
<|assistant|>
Answer: $33.75<|eot|>
<|end|> | math_wp | chat | answer_only | 1 | glm-5.3-flash | late_fee | 72 | 0f18d439f1c63757 |
ol5-0f57d7f476921cfb-0 | Write the behaviour specified below in Python.
Our weatherization office files quarterly summaries under the energy rules at 10 CFR 440.25, and I need a small helper for them. Write a class `SavingsReport` constructed as `SavingsReport(savings_mmbtu: list[float])`, holding verified energy savings in MMBtu for a batch ... | code_impl | plain | worked | 1 | glm-5.3-flash | statistics_module | 573 | 0f57d7f476921cfb |
ol5-0fc10dfa5c38cfba-0 | Draft the following task in modern Python. Work it step by step.
For an application intake desk I want a small class that records applications arriving in two forms. Write `PaperForm` with field `form_number: str` and `ElectronicForm` with field `tracking_id: int`, both immutable records. Then write `class Application... | code_impl | plain | worked | 1 | glm-5.3-flash | type_narrowing | 713 | 0fc10dfa5c38cfba |
ol5-0fc10dfa5c38cfba-1 | <|start|><|user|>
Find and fix the bug in the code below. Broken test line: `raise AssertionError("non-positive tracking_id must raise ValueError")`
```python
"""Intake for applications that arrive on paper or electronically."""
from dataclasses import dataclass
@dataclass(frozen=True)
class PaperForm:
"""A pap... | code_bugfix | chat | worked | 1 | glm-5.3-flash | type_narrowing | 911 | 0fc10dfa5c38cfba |
ol5-0fc10dfa5c38cfba-2 | Modernise this older-style Python into modern, typed Python.
```python
"""Intake for applications that arrive on paper or electronically."""
from typing import List, Union
class PaperForm(object):
"""A paper application identified by its printed number."""
def __init__(self, form_number):
self.form... | code_refactor | plain | worked | 1 | glm-5.3-flash | type_narrowing | 885 | 0fc10dfa5c38cfba |
ol5-0fc294f312e43014-0 | What exactly does this program output?
```python
from dataclasses import dataclass, field
@dataclass(slots=True)
class Poriferan:
"""A sponge-like filter feeder with a pore count and flow rate."""
name: str
pores: list[int] = field(default_factory=lambda: [40, 55, 60])
flow_per_pore: float = 0.5
... | code_trace | plain | worked | 1 | glm-5.3-flash | dataclass | 349 | 0fc294f312e43014 |
ol5-10003c4aa794d0a4-0 | <|start|><|user|>
Predict the printed output of this program.
```python
def prune(canework: int, *, cuts: int = 3, seal: bool = True) -> str:
"""Describe one pruning pass on a rosebush with keyword-only options."""
seal_note = "sealed" if seal else "unsealed"
return f"{cuts} cuts on {canework} canes, {seal... | code_trace | chat | worked | 1 | glm-5.3-flash | keyword_only | 222 | 10003c4aa794d0a4 |
ol5-10215be01f2ec7c6-0 | Figure out the following problem.
Every match in a single-elimination bracket eliminates exactly one entrant. A chess tournament opens with 128 entrants and continues until one champion remains. How many matches does the bracket need in total?
<|think|>
1. Matches needed: 128 − 1 = 127
<|/think|>
Answer: 127 | math_wp | plain | worked | 1 | glm-5.3-flash | proportion | 84 | 10215be01f2ec7c6 |
ol5-102f75bbf11007ef-0 | A new offshore extraction facility must report its yearly output in two categories, flared gas and delivered gas, in a ratio of 3 to 5. The total reported output is 48,000 barrels. How many barrels are in the delivered-gas category?
<|think|>
1. Delivered share: 48000 × 5 ÷ 8 = 30000
<|/think|>
Answer: 30000 barrels | math_wp | plain | worked | 1 | glm-5.3-flash | ratio_share | 90 | 102f75bbf11007ef |
ol5-102f75bbf11007ef-1 | A new offshore extraction facility must report its yearly output in two categories, flared gas and delivered gas, in a ratio of 3 to 5. The total reported output is 48,000 barrels. How many barrels are in the delivered-gas category?
Answer: 30000 barrels | math_wp | plain | answer_only | 1 | glm-5.3-flash | ratio_share | 67 | 102f75bbf11007ef |
ol5-107833e34e9564a3-0 | Task: State what the script below prints.
```python
import heapq
type Job = tuple[int, str]
def order(jobs: list[Job]) -> list[str]:
"""Return job names by rank, ties keeping insertion order."""
heap: list[tuple[int, int, str]] = []
for seq, (rank, name) in enumerate(jobs):
heap.append((rank, se... | code_trace | plain | worked | 1 | glm-5.3-flash | priority_queue_ties | 329 | 107833e34e9564a3 |
ol5-107fcc0d08f70ab4-0 | An education appropriation of $12,000 buys a records scanner with a salvage value of $2,400 and a useful life of 8 years. Under the applicable spending rules, its value declines by the same amount each year. By how many dollars does the scanner's value drop per year?
<|think|>
1. Yearly depreciation: (12000 − 2400) ÷ ... | math_wp | plain | worked | 1 | glm-5.3-flash | depreciation | 96 | 107fcc0d08f70ab4 |
ol5-108423f6d79c906c-0 | <|start|><|user|>
Program the module that the specification below describes.
A nursery records spirea rows on planting sheets as semicolon-separated entries like `"Goldflame;height:0.9;bloom:june;color:pink"`. Write `parse_row(entry: str) -> SpireaRow`, which must process the semicolon-separated pieces in first-in fir... | code_impl | chat | worked | 1 | glm-5.3-flash | queue_fifo | 817 | 108423f6d79c906c |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.