Discounted cash flow valuation with mid-year option and a sensitivity grid
Exact prompt
# Discounted cash flow valuation with a sensitivity grid `input.json` gives forecast free cash flows and valuation assumptions for a fictional company (synthetic). Write `solve.py` (Python 3 standard library only) so that `python solve.py input.json answer.json` computes the valuation. We re-run it on fresh inputs, so do not hard-code anything. ## Input `fcf` (forecast free cash flow for years 1..N), `wacc`, `terminal_growth`, `mid_year` (bool), `net_debt` (can be negative = net cash), `shares`, `ebitda_last` (year-N EBITDA), `sens_wacc`, `sens_growth` (lists). ## Rules 1. Discount year t (t = 1..N) by (1 + wacc) ** t, or by (1 + wacc) ** (t - 0.5) when `mid_year` is true. `pv_fcf` = sum of discounted cash flows. 2. Terminal value (Gordon growth, at the end of year N): `terminal_value` = fcf_N * (1 + g) / (wacc - g). It is always discounted by (1 + wacc) ** N, even with the mid-year convention: `pv_terminal`. 3. `enterprise_value` = pv_fcf + pv_terminal; `equity_value` = enterprise_value - net_debt; `per_share` = equity_value / shares; `terminal_share` = pv_terminal / enterprise_value; `implied_ev_ebitda` = enterprise_value / ebitda_last. 4. If terminal_growth >= wacc, the whole answer is `{"error": "growth_not_below_wacc"}`. 5. `sensitivity`: a list with one row per value in `sens_wacc` (same order); each row has one entry per value in `sens_growth`: the per-share value with that wacc and growth (other inputs unchanged), rounded to 4 decimals, or `null` when growth >= wacc. 6. Round money values to 2 decimals and `per_share`, `terminal_share`, `implied_ev_ebitda` to 6 decimals when writing. ## Output `answer.json` keys: `pv_fcf`, `terminal_value`, `pv_terminal`, `enterprise_value`, `equity_value`, `per_share`, `terminal_share`, `implied_ev_ebitda`, `sensitivity`. ## Scoring Hidden checks (partial credit = fraction passed; all must pass): `pv_of_cash_flows`, `terminal_value`, `ev_equity_per_share` (money within 0.011, the three ratios within 0.000001), `sensitivity_grid` (within 0.0001, nulls exact) on the given input; `fresh_end_of_year` and `fresh_mid_year` (the whole answer, tolerance 0.011); `growth_not_below_wacc` (rule 4). Each run has a 60-second limit.
Mid-year discounting of cash flows but not of the terminal value, net cash vs net debt, null cells where growth >= discount rate, and the error case. 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).
These are synthetic test cases for comparing AI models, not financial advice.
Success criteria: 1. pv_of_cash_flows 2. terminal_value 3. ev_equity_per_share 4. sensitivity_grid 5. fresh_end_of_year 6. fresh_mid_year 7. growth_not_below_wacc
Best model for this task so far: Mistral Small 3.2 24B Instruct (Venice) (thinking on) (success, $0.0015, 48s).
All runs (11)
100% pass rate across 11 eligible runs: 11 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 |
|---|---|---|---|---|---|---|---|---|
| ?MiniMax M2.5 (Venice)thinking on | $0.0052 | 7m | 0 | Fully autonomous | pass | Trust 80% | 2026-10-26 | |
| MMistral Small 3.2 24B Instruct (Venice)thinking on | $0.0015 | 48s | 0 | Fully autonomous | pass | Trust 80% | 2026-10-25 | |
| GGemma 4 31B Instruct (Venice)thinking on | $0.0035 | 2m | 0 | Fully autonomous | pass | Trust 80% | 2026-10-24 | |
| DDeepSeek V4.1 Flash (Venice)thinking on | $0.0034 | 11s | 0 | Fully autonomous | pass | Trust 80% | 2026-10-24 | |
| KKimi K2.5 (Venice)thinking on | $0.04 | 2m | 0 | Fully autonomous | pass | Trust 80% | 2026-10-24 | |
| QQwen3 Coder 480B Turbo (Venice)thinking on | $0.0032 | 17s | 0 | Fully autonomous | pass | Trust 80% | 2026-10-24 | |
| OGPT-6.1 Soldefault · thinking on | $0.05 | 41s | 0 | Fully autonomous | pass | Trust 80% | 2026-10-22 | |
| ZGLM 4.7 (Venice)thinking on | $0.0092 | 3m | 0 | Fully autonomous | pass | Trust 80% | 2026-10-22 | |
| AClaude Haiku 5.5default · thinking on | $0.0043 | 17s | 0 | Fully autonomous | pass | Trust 80% | 2026-10-20 | |
| AClaude Opus 5.5default · thinking on | $0.12 | 23s | 0 | Fully autonomous | pass | Trust 80% | 2026-10-20 | |
| AClaude Sonnet 5.5default · thinking off | $0.05 | 10s | 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.