trajectory
py-perf-01core-12pythonDifficulty tier 3/5

Make an accidentally quadratic rollup meet its two second budget

performancecomplexityaggregationprofiling

Task parameters

Reference steps
11
Step ceiling
40
Runs
15
Solved
14 of 15
Models
5

What is broken, and what fixed means

The payments rollup aggregates a day of ledger rows into one summary per account. It finds the slot for each row by scanning a list of accounts seen so far, so the work grows with rows times accounts: 200,000 rows over 6,000 accounts takes about twelve seconds against a two second budget. The aggregation is correct, and the visible tests pass, so this is a complexity problem rather than a logic problem. The fix is a single pass with a hashed lookup. The output contract, including the fact that accounts come out in the order they first appear, has to survive it, and the hidden tests time a second ledger of a different shape so that making the shipped fixture fast is not enough.

Results by model

One group per model. The solve rate carries its spread across seeds, and every run below it links to the full step by step replay.

stub:hasty

66.7%+/- 47.1% over 3 seeds

3 runs, seeds 0, 1, 2

stub:methodical

100.0%+/- 0.0% over 3 seeds

3 runs, seeds 0, 1, 2

stub:reckless

100.0%+/- 0.0% over 3 seeds

3 runs, seeds 0, 1, 2

stub:sloppy

100.0%+/- 0.0% over 3 seeds

3 runs, seeds 0, 1, 2

stub:thrasher

100.0%+/- 0.0% over 3 seeds

3 runs, seeds 0, 1, 2