Parse a real log format: optional fields, escaped quotes, malformed lines. A model passes this trial only when every test goes green — retries are included in the price, and the clock runs until done.
| Model | Verdict | Tries | Time | Cost to done | Tokens |
|---|---|---|---|---|---|
| gpt-5-mini | GREEN | x1 | 21s | $0.0048 | 1319 |
| claude-haiku-4-5 | GREEN | x2 | 12s | $0.0051 | 1828 |
| gpt-4.1 | GREEN | x1 | 8s | $0.0070 | 577 |
| gpt-5.4 | GREEN | x1 | 7s | $0.0073 | 627 |
| claude-opus-4-8 | GREEN | x1 | 10s | $0.0107 | 909 |
| gpt-5.1 | GREEN | x1 | 12s | $0.0107 | 853 |
| gpt-5.5 | GREEN | x1 | 9s | $0.0135 | 589 |
| gpt-5.2 | GREEN | x1 | 19s | $0.0166 | 1247 |
| claude-sonnet-5 | GREEN | x1 | 12s | $0.0169 | 1358 |
| gpt-5 | GREEN | x1 | 22s | $0.0199 | 1436 |
| claude-sonnet-4-6 | GREEN | x2 | 29s | $0.0286 | 3082 |
| claude-fable-5 | REFUSED | x6 | 28s | $0.0068 | 2186 |
Green row = cheapest to done · blue time = fastest to done. REFUSED = the model declined the task (a failure mode token prices never show). claude-fable-5's line is high-variance: follow-up probes saw it stochastically refuse benign coding prompts it had previously attempted. One trial per model per round; replies capped at 2,048 output tokens uniformly. Costs metered per session by cerver.
Write `solution.py` with a function `parse_log(line: str)` parsing lines like:
2026-07-01T12:03:44Z 200 GET /api/users?id=7 12.4ms ua="Mozilla/5.0"
Return a dict {ts, status:int, method, path, latency_ms:float|None, ua:str|None}
Rules:
- methods other than GET/POST/PUT/DELETE/PATCH → return None
- latency field may be missing entirely → latency_ms None
- ua is optional; it may contain escaped quotes (\") inside → unescape them
- malformed lines (missing ts/status/method/path) → None
Return the COMPLETE `solution.py` in one ```python block, nothing else.
from solution import parse_log
def test_basic():
e = parse_log('2026-07-01T12:03:44Z 200 GET /api/users?id=7 12.4ms ua="Mozilla/5.0"')
assert e == {"ts": "2026-07-01T12:03:44Z", "status": 200, "method": "GET",
"path": "/api/users?id=7", "latency_ms": 12.4, "ua": "Mozilla/5.0"}
def test_unknown_method():
assert parse_log('2026-07-01T12:03:44Z 200 BREW /tea 1ms ua="x"') is None
def test_missing_latency():
e = parse_log('2026-07-01T12:03:44Z 404 POST /x ua="y"')
assert e["latency_ms"] is None and e["status"] == 404
def test_no_ua():
e = parse_log('2026-07-01T12:03:44Z 200 GET /x 3.0ms')
assert e["ua"] is None
def test_escaped_quotes():
e = parse_log('2026-07-01T12:03:44Z 200 GET /x 1ms ua="Mozilla \\"5.0\\" custom"')
assert e["ua"] == 'Mozilla "5.0" custom'
def test_malformed():
assert parse_log('garbage') is None
assert parse_log('2026-07-01T12:03:44Z GET /x') is None