Diverging stacked bar chart with exact SVG geometry
Exact prompt
# Diverging stacked bar chart with exact geometry `input.json`: `categories` (list of names) and `series` (each `{name, color, values}`, one value per category; `null` means 0). Write `solve.py` (Python 3 standard library only); `python solve.py input.json answer.json` must write `answer.json` and a static `chart.svg` in the working directory. Fresh inputs are generated. ## Rules 1. Canvas 720x360. Plot area x0=60, y0=20, width 600, height 300. 2. For each category, `pos` = sum of positive values and `neg` = sum of negative values (null and 0 add nothing). `totals` = [[pos, neg], ...] in category order. 3. Raw domain: lo = min(0, min neg), hi = max(0, max pos). 4. Nice ticks: raw = (hi - lo)/5 (use 1 if hi == lo); mag = 10^floor(log10(raw)); f = raw/mag; m = 1 if f<=1, 2 if f<=2, 2.5 if f<=2.5, 5 if f<=5, otherwise 10; step = m*mag. Axis min = floor(lo/step)*step, axis max = ceil(hi/step)*step (if they are equal, add one step). Round the quotient to 9 decimals before floor/ceil so float noise doesn't add a step. Ticks run from axis min to axis max in steps (each rounded to 10 decimals). `domain` = [axis min, axis max]. 5. Tick label: the smallest d in 0..6 such that step rounded to d decimals equals step; format each tick with d decimals; a label equal to zero prints as `0`. 6. y(v) = y0 + 300*(axis max - v)/(axis max - axis min). 7. Band = 600/number of categories. Bar x = x0 + i*band + 0.15*band; width = 0.7*band. 8. Stacking: series in the given order. Positive values stack **upward from 0** on the positive stack; negative values stack **downward from 0** on a separate negative stack. A value of 0 or null draws no bar. 9. A bar from value bot to top has y = y(top) and height = y(bot) - y(top). Round x, y, width and height to 2 decimals. 10. Bar id `bar-<category index>-<series index>` (0-based), with fill = the series color. ## Outputs - `answer.json`: `{"domain", "ticks", "tick_labels", "totals", "bars": [{"id","x","y","width","height","fill"}, ...]}`, with bars in category order and then series order. - `chart.svg`: root `<svg>`, no scripts, external resources or animation. It contains `<g id="bars">` holding one `<rect id="bar-i-j" x y width height fill>` per bar, with numeric attributes equal to the JSON values (within 0.01). For tick k: `<line id="tick-k">` at y(tick) and `<text id="tick-label-k">` holding the label. Also `<line id="zero-line">` at y(0). ## Scoring Hidden checks (partial credit; all must pass): `stack_totals` (1e-6), `nice_ticks_domain` (exact labels), `bar_geometry_json` (0.011), `chart_svg_static` (parses as static SVG with the required ids and tags), `chart_svg_geometry` (rect attributes and tick-label texts read from the SVG itself), `fresh_run_1`, `fresh_run_2` (domain, labels, bars and SVG geometry on new data). 30-second limit per run.
Fixes the subjective look of a chart to exact numbers. Separate +/- stacks, the 2.5 step, float-noise floors and label decimals are easy to get slightly wrong. Original benchmark task written for usecaserank.com (not based on a specific public post). Headless, offline run on a reproducible fixture. Each run's notes say how its cost was measured (estimates are marked).
Success criteria: 1. stack_totals 2. nice_ticks_domain 3. bar_geometry_json 4. chart_svg_static 5. chart_svg_geometry 6. fresh_run_1 7. fresh_run_2
Best model for this task so far: Claude Haiku 5.5 (effort default (no --effort flag) · thinking on) (success, $0.0075, 30s).
Latest output per model
All runs (4)
100% pass rate across 4 eligible runs: 4 pass, 0 partial, 0 fail. Partial and failed runs are listed below with everything else.ⓘ
| Model | Cost | Time | Step-insⓘ | Autonomy | Outcome | Trustⓘ | Date | Compare |
|---|---|---|---|---|---|---|---|---|
| OGPT-6.1 Soldefault · thinking on | $0.06 | 1m | 0 | Fully autonomous | pass | Trust 80% | 2026-10-22 | |
| AClaude Haiku 5.5default · thinking on | $0.0075 | 30s | 0 | Fully autonomous | pass | Trust 80% | 2026-10-20 | |
| AClaude Opus 5.5default · thinking on | $0.16 | 30s | 0 | Fully autonomous | pass | Trust 80% | 2026-10-20 | |
| AClaude Sonnet 5.5default · thinking on | $0.06 | 14s | 0 | Fully autonomous | pass | Trust 80% | 2026-10-20 |
Embed this result
A live badge for this use case. It links back here and updates as new runs are published.
Get new runs and ranking changes weekly
Which models got better or cheaper on real tasks like this one.