[{"id":"invoice","title":"Invoice reconciliation","prompt":"Compute these synthetic invoices. Each line is [quantity, unit price]. For EACH invoice: sum lines, apply discount to merchandise, round discounted merchandise to cents HALF UP; add shipping; compute tax on that sum and round tax to cents HALF UP; add that tax. Refunds are subtracted from the final billed amount and are not taxed again. Return ONLY JSON with keys billed (invoice ID to two-decimal string), net_by_customer (customer to two-decimal string), grand_net (two-decimal string). Input: [{\"id\": \"I1\", \"customer\": \"Ada\", \"lines\": [[3, \"19.95\"], [2, \"7.40\"]], \"discount\": \"0.075\", \"shipping\": \"4.95\", \"tax\": \"0.21\", \"refund\": \"12.34\"}, {\"id\": \"I2\", \"customer\": \"Ben\", \"lines\": [[7, \"3.33\"], [1, \"49.99\"]], \"discount\": \"0.125\", \"shipping\": \"0.00\", \"tax\": \"0.10\", \"refund\": \"0.00\"}, {\"id\": \"I3\", \"customer\": \"Ada\", \"lines\": [[4, \"12.49\"], [5, \"0.99\"]], \"discount\": \"0.05\", \"shipping\": \"6.50\", \"tax\": \"0.21\", \"refund\": \"18.75\"}, {\"id\": \"I4\", \"customer\": \"Cy\", \"lines\": [[2, \"88.88\"], [3, \"6.67\"]], \"discount\": \"0.15\", \"shipping\": \"9.99\", \"tax\": \"0.075\", \"refund\": \"25.00\"}] IMPORTANT: billed is the invoice total BEFORE subtracting any refund. net_by_customer and grand_net are AFTER subtracting refunds.","kind":"json","expected":{"billed":{"I1":"89.54","I2":"70.55","I3":"70.98","I4":"191.45"},"net_by_customer":{"Ada":"129.43","Ben":"70.55","Cy":"166.45"},"grand_net":"366.43"}},{"id":"schedule","title":"Resource-constrained scheduling","prompt":"Schedule six non-preemptive jobs on TWO identical machines. Integer start times >=0, intervals [start,end), at most two simultaneous jobs. Durations {\"A\": 3, \"B\": 2, \"C\": 4, \"D\": 2, \"E\": 3, \"F\": 1}. Dependencies {\"A\": [], \"B\": [], \"C\": [\"A\"], \"D\": [\"A\"], \"E\": [\"B\", \"C\"], \"F\": [\"D\", \"E\"]}. A dependency must finish before its successor starts. B cannot start before time 1; D must finish by time 7. Minimize makespan. Among all optimal schedules choose the lexicographically smallest start-time vector (A,B,C,D,E,F). Return ONLY JSON {\"makespan\":integer,\"starts\":{\"A\":integer,\"B\":integer,\"C\":integer,\"D\":integer,\"E\":integer,\"F\":integer}}.","kind":"json","expected":{"makespan":11,"starts":{"A":0,"B":1,"C":3,"D":3,"E":7,"F":10}}},{"id":"intervals","title":"Python interval aggregation","prompt":"Write Python function active_minutes(records). Each record is a dict with user (string), start (integer), end (integer). For each user return the total length of the UNION of their half-open intervals [start,end). Include users with only zero-length intervals, with value 0. Negative timestamps are valid. If ANY record has end < start, raise ValueError. Accept a one-pass iterable, do not mutate records or their dictionaries, and return a dict inserted in alphabetical user order. Use only Python builtins, no imports. Return only the function code, optionally in one python fence. No examples or prose.","kind":"intervals","expected":null},{"id":"batches","title":"Python dependency batching","prompt":"Write Python function dependency_batches(graph). graph maps string node names to lists of prerequisite node names. Names appearing only as prerequisites are also nodes. Repeated prerequisite names count once. Return a list of batches: every batch contains ALL currently available nodes, sorted alphabetically; a node is available only when all its prerequisites were in EARLIER batches. Return [] for an empty graph. Raise ValueError for any cycle (including self-cycles), even if some acyclic nodes could run first. Do not mutate the input graph or its lists. Use only Python builtins, no imports. Return only the function code, optionally in one python fence. No examples or prose.","kind":"batches","expected":null},{"id":"sql","title":"SQL aggregation without double-counting","prompt":"Write one SQLite SELECT query (WITH is allowed). Schema: customers(id INTEGER PRIMARY KEY, name TEXT); orders(id INTEGER PRIMARY KEY, customer_id INTEGER, status TEXT); items(order_id INTEGER, sku TEXT, qty INTEGER, unit_cents INTEGER); refunds(id INTEGER PRIMARY KEY, order_id INTEGER, amount_cents INTEGER, status TEXT). For EVERY customer including customers with no paid orders, return columns customer_id, paid_order_count, net_cents. A paid order has status exactly paid. Gross is SUM(qty*unit_cents) from its items, or 0 with no items. Subtract refunds with status exactly settled for paid orders only. Refunds may exceed gross; do not clamp. Include paid orders with no items, and do not double count when an order has multiple items and multiple refunds. Results ordered by customer_id ascending. Return only SQL, optionally in one sql fence.","kind":"sql","expected":null},{"id":"cache","title":"LRU and TTL state simulation","prompt":"Simulate an initially empty LRU cache of capacity 3 with TTL=4. Before EVERY event remove all entries whose expiry <= current t. put inserts/overwrites value and sets expiry=t+4, making key most recently used; if a NEW entry would exceed capacity, evict the least recently used remaining key. Successful get makes key most recently used but DOES NOT extend expiry; missing get returns null. Process equal-time events in listed order. Return ONLY JSON with read_results (one value or null per get, in order), final_lru_to_mru (remaining keys oldest to newest), hits, misses. Events: [{\"t\": 0, \"op\": \"put\", \"key\": \"A\", \"value\": 10}, {\"t\": 1, \"op\": \"put\", \"key\": \"B\", \"value\": 20}, {\"t\": 2, \"op\": \"get\", \"key\": \"A\"}, {\"t\": 3, \"op\": \"put\", \"key\": \"C\", \"value\": 30}, {\"t\": 3, \"op\": \"put\", \"key\": \"D\", \"value\": 40}, {\"t\": 4, \"op\": \"get\", \"key\": \"A\"}, {\"t\": 4, \"op\": \"get\", \"key\": \"C\"}, {\"t\": 5, \"op\": \"put\", \"key\": \"C\", \"value\": 31}, {\"t\": 6, \"op\": \"put\", \"key\": \"E\", \"value\": 50}, {\"t\": 7, \"op\": \"get\", \"key\": \"D\"}, {\"t\": 7, \"op\": \"put\", \"key\": \"F\", \"value\": 60}, {\"t\": 8, \"op\": \"get\", \"key\": \"C\"}, {\"t\": 9, \"op\": \"get\", \"key\": \"C\"}, {\"t\": 9, \"op\": \"put\", \"key\": \"G\", \"value\": 70}, {\"t\": 10, \"op\": \"get\", \"key\": \"E\"}, {\"t\": 10, \"op\": \"put\", \"key\": \"F\", \"value\": 61}, {\"t\": 11, \"op\": \"put\", \"key\": \"H\", \"value\": 80}, {\"t\": 12, \"op\": \"get\", \"key\": \"G\"}]","kind":"json","expected":{"read_results":[10,null,30,null,31,null,null,70],"final_lru_to_mru":["F","H","G"],"hits":4,"misses":4}},{"id":"extract","title":"Revision-aware structured extraction","prompt":"Extract final facts from this synthetic dispatch log. Later explicit corrections supersede earlier claims. An estimate is not an actual event. Convert actual departure timestamps to UTC. A cancellation followed by explicit reinstatement restores the shipment. Missing actual timestamps must be null. Output ONLY a JSON array sorted by ID; each element has EXACT keys id, status, units, departed_utc, evidence. evidence is an array of the minimal log IDs supporting those final fields, sorted numerically by log ID. Use ISO timestamps YYYY-MM-DDTHH:MM:SSZ.\n[L1] Shipment S-17: planned 12 units; dispatch estimated for 2026-05-04 at 23:40 +02:00.\n[L2] Shipment S-18: planned 8 units.\n[L3] S-17 actually departed at 2026-05-05 00:10 +02:00, carrying 12 units.\n[L4] S-18 cancelled; no departure occurred.\n[L5] Correction to L3: S-17 carried 10 units, not 12; departure time is unchanged.\n[L6] Shipment S-19: 5 units planned; actual departure 2026-05-04 23:50 -03:00.\n[L7] S-18 reinstated as planned, 9 units, estimated departure 2026-05-06 09:00 UTC. No actual departure yet.\n[L8] S-20 is cancelled, 0 units, no departure.\nUse status departed, planned, or cancelled.","kind":"json","expected":[{"id":"S-17","status":"departed","units":10,"departed_utc":"2026-05-04T22:10:00Z","evidence":["L3","L5"]},{"id":"S-18","status":"planned","units":9,"departed_utc":null,"evidence":["L7"]},{"id":"S-19","status":"departed","units":5,"departed_utc":"2026-05-05T02:50:00Z","evidence":["L6"]},{"id":"S-20","status":"cancelled","units":0,"departed_utc":null,"evidence":["L8"]}]},{"id":"policy","title":"Policy application and missing information","prompt":"Use ONLY the policy and six cases below. Every duration is in minutes. A trial user is never eligible. Otherwise, a paid incident qualifies iff measured downtime EXCLUDING scheduled maintenance is strictly greater than 30 AND a claim was filed within 48 hours inclusive. Tier gold gets 20% credit, tier silver gets 10%, applied to the fee; exact tier names matter. Unknown facts must remain unknown. A case known ineligible gets credit 0 even if other inputs are unknown. A paid case with unknown eligibility gets eligible null and credit null. An eligible case with an unknown tier gets credit null. Do not infer a timezone, tier or filing time. Return ONLY JSON mapping each case ID to {\"eligible\":true/false/null,\"credit\":number/null}.\nA: paid, gold, fee 120, total downtime 55, scheduled maintenance 25, filed after 12 hours.\nB: paid, silver, fee 85, total downtime 80, scheduled maintenance 15, filed after exactly 48 hours.\nC: trial, gold, fee 100, total downtime 100, scheduled maintenance unknown, filing time unknown.\nD: paid, gold, fee 200, total downtime 60, scheduled maintenance 5, filing time unknown.\nE: paid, tier unknown, fee 90, total downtime 40, scheduled maintenance 0, filed after 24 hours.\nF: paid, silver, fee 150, total downtime 90, scheduled maintenance 0, filed after 48 hours and 1 minute.","kind":"json","expected":{"A":{"eligible":false,"credit":0},"B":{"eligible":true,"credit":8.5},"C":{"eligible":false,"credit":0},"D":{"eligible":null,"credit":null},"E":{"eligible":true,"credit":null},"F":{"eligible":false,"credit":0}}}]
