Skip to content

Loan servicing with daily accrual, 30/360 quirks, dues crediting and a payment waterfall

Exact prompt

# Loan servicing: daily accrual and payment waterfall `input.json` (synthetic) gives a `loan` (`principal`, `start_date`, `annual_rate`, `day_count` "ACT/365" or "30/360", `installment`, `due_day`, `grace_days`, `late_fee`), `payments`, `rate_changes`, `fees` (each with ISO `date`), and `end_date`. Write `solve.py` (Python 3 standard library only); `python solve.py input.json answer.json`. Fresh inputs are generated (both day counts, with and without payoff). One early mistake changes every later number, so follow the order exactly. ## Rules 1. Use exact decimals (`decimal.Decimal` built from the JSON numbers' string form). "Round" = half up. 2. Simulate each day d from the day after `start_date` through `end_date` inclusive. Within a day, in this order: (a) rate changes dated d take effect; (b) interest accrues; (c) fees dated d are added; (d) if d is a due date, a due is created; (e) payments dated d are applied, in input order; (f) late-fee checks; (g) if d is a due date, a statement is written. 3. Accrual (only while not paid off), added to `accrued` (unrounded): - ACT/365: round(principal * rate / 365, 8 decimals) every day. - 30/360: round(principal * rate / 360 * n, 8 decimals) where n = 1 for a normal day, **0 on the 31st**, and on the last day of February n = 30 - day + 1 (Feb 28 = 3, leap Feb 29 = 2). 4. Due date each month: day `due_day`, or the month's last day if shorter. No due is created on `start_date`'s day itself or after payoff. Due amount = min(installment, principal + accrued rounded **down** to cents + outstanding fees). 5. A payment first **credits dues**: open dues dated on or before the payment date, oldest first, each up to its remaining unpaid amount. Independently, the whole payment goes through the **waterfall**: outstanding fees oldest first, then interest = min(rest, accrued rounded down to cents), then principal; anything left is `refunded`. Interest paid reduces `accrued` exactly (sub-cent fractions stay). 6. When principal reaches 0: `payoff_date` = that date, accrued is set to 0, and accrual stops. 7. Late fee: on the day due date + `grace_days`, after payments, if that due is still not fully credited, add a fee of `late_fee` (kind "late") once for that due and mark it late. 8. Statement on each due date (rule 4's days, including after payoff): `{"date", "principal", "accrued_interest" (rounded to cents), "fees_outstanding", "rate"}`. ## answer.json `{"statements": [...], "payoff_date": date or null, "final": {"principal", "accrued_interest", "fees_outstanding"}, "totals": {"interest_paid", "fees_paid", "principal_paid", "refunded", "late_fees" (count)}, "dues": [{"date", "due", "paid", "late"}, ...]}` (money as JSON numbers). ## Scoring Hidden checks (partial credit; all must pass; money within 0.001): `first_3_statements`, `all_statements`, `dues_and_late_flags`, `totals`, `final_and_payoff` on the given input; `fresh_run_1`, `fresh_run_2`, `fresh_payoff_30_360`, `fresh_payoff_act365` (whole answer) on fresh inputs. 30-second limit per run.

Eight-decimal daily accrual vs cent rounding, the 30/360 day-31 and end-of-February rules, the within-day event order, dues crediting separate from the waterfall, interest paid in whole cents only, and payoff. 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. first_3_statements 2. all_statements 3. dues_and_late_flags 4. totals 5. final_and_payoff 6. fresh_run_1 7. fresh_run_2 8. fresh_payoff_30_360 9. fresh_payoff_act365

Best model for this task so far: Claude Haiku 5.5 (effort default (no --effort flag) · thinking on) (success, $0.01, 1m).

Run this on another 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.ⓘ

Runs for this use case
ModelCostTimeStep-insⓘAutonomyOutcomeTrustⓘDateCompare
OGPT-6.1 Soldefault · thinking on$0.061m0Fully autonomouspassTrust 80%2026-10-22
AClaude Haiku 5.5default · thinking on$0.011m0Fully autonomouspassTrust 80%2026-10-20
AClaude Opus 5.5default · thinking on$0.2247s0Fully autonomouspassTrust 80%2026-10-20
AClaude Sonnet 5.5default · thinking on$0.0827s0Fully autonomouspassTrust 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.

UseCaseRank badge for Loan servicing with daily accrual, 30/360 quirks, dues crediting and a payment waterfall

Get new runs and ranking changes weekly

Which models got better or cheaper on real tasks like this one.