Skip to content
mager-bench1.3

1.2 · Three everyday programs

The original 36 checks are frozen. Version 1.3 keeps these tasks and adds dependency-graph planning and budgeted scheduling. Their overall scores are separate.

Explore the current suite

What we ask it to build

12 checks per program

Split a bill

Ada paid $42.00, split between Ada (1 share), Bo (1 share).

Expected result

Bo pays Ada $21.00.

Input

{
  "people": [
    "Ada",
    "Bo"
  ],
  "expenses": [
    {
      "paidBy": "Ada",
      "cents": 4200,
      "shares": [
        {
          "person": "Ada",
          "weight": 1
        },
        {
          "person": "Bo",
          "weight": 1
        }
      ]
    }
  ]
}

Exact expected output

{
  "balances": [
    2100,
    -2100
  ],
  "transfers": [
    {
      "to": "Ada",
      "cents": 2100,
      "from": "Bo"
    }
  ]
}

These are the published test cases, not a model’s answers. Saved attempts show what the model actually returned.

Read the exact prompt
Write a synchronous JavaScript function solve(input). Return only JavaScript, without Markdown or exports. Standard ECMAScript only: no filesystem, network, packages, Node globals, timers, or async. Inputs are valid under the contract. Return a JSON-serializable value. Do not mutate built-ins. Each case runs in a fresh QuickJS context with 16 MiB memory and a 100 ms CPU limit. All arithmetic inputs and results fit safe integers. We compare JSON structurally, ignoring object key order but preserving array order. Implement the full contract, not just an example.

Input: {people: string[], expenses: {paidBy: string, cents: integer, shares: {person: string, weight: positive integer}[]}[]}. People are unique and ordered. All names occur in people. Each expense has unique share recipients, at least one. cents can be negative (a refund) or zero. For each expense, allocate abs(cents) proportional to the weights: floor each exact share, then distribute remaining cents by descending fractional remainder, ties by people order (not shares order). Apply the sign of cents after allocation. Each person's balance = amount paid minus allocated shares; positive means they receive money. Return {balances: integer[], transfers: {from: string, to: string, cents: positive integer}[]}. balances follows people order including zeros. Settle debtors and creditors in people order: transfer min(debt, credit), advance whichever reaches zero, until settled. Do not optimize transaction count or sort by amount.

Original v1.2 data