FA-58296 / Double-entry ledger accounting / Open access
Payroll journal entry: employer match composition · case 01
Employer payroll tax expense includes employee income tax withholding.
ROOT CAUSE
Income tax is included in the employer match.
VERIFIED REPAIR
Match only social and medicare tax.
Unsuccessful approach: Matching only social tax omits the employer medicare share.
Case contract
x = {'gross': [[employee, cents]] (an employee may appear twice), 'ytd': prior year-to-date gross, 'wage_base', 'ss_bp', 'med_bp', 'itax_bp', 'benefit': {employee: pre-tax deduction per paycheck}}. Per paycheck: social wages = min(gross, max(0, wage_base - ytd)), ytd then increases by gross; social tax = round(social wages * ss_bp / 10000), medicare = round(gross * med_bp / 10000) (no cap), income tax = round((gross - benefit) * itax_bp / 10000), all half-up; net = gross - social - medicare - income tax - benefit. The employer matches social and medicare. Return {'wage_expense', 'tax_expense', 'cash', 'withholding', 'benefits'} where withholding holds employee and employer taxes.
Why this case matters
Ledger software must keep debits equal to credits and apply normal-balance, period and cutoff rules exactly; small sign or boundary slips silently misstate financial statements.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
def rnd(n, d):
q, r = divmod(n, d)
return q + (1 if 2 * r >= d else 0)
ytd = dict(x['ytd'])
wage = tax_exp = cash = withholding = benefits = 0
for emp, g in x['gross']:
ben = x['benefit'].get(emp, 0)
social = min(g, max(0, x['wage_base'] - ytd.get(emp, 0)))
ytd[emp] = ytd.get(emp, 0) + g
ss = rnd(social * x['ss_bp'], 10000)
med = rnd(g * x['med_bp'], 10000)
itax = rnd((g - ben) * x['itax_bp'], 10000)
employer = ss + med + itax
wage += g
tax_exp += employer
cash += g - ss - med - itax - ben
withholding += ss + med + itax + employer
benefits += ben
return {'wage_expense': wage, 'tax_expense': tax_exp, 'cash': cash, 'withholding': withholding, 'benefits': benefits}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: employer match composition', {'gross': [['di', 1234], ['cy', 50000], ['bob', 50000], ['di', 80000]], 'ytd': {'di': 15000000, 'cy': 16800000, 'bob': 16800000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 2200, 'benefit': {'di': 12345, 'cy': 0, 'bob': 5000}}, {'wage_expense': 181234, 'tax_expense': 13865, 'cash': 104339, 'withholding': 61070, 'benefits': 29690}], ['sample 1', {'gross': [['bob', 100000]], 'ytd': {'bob': 16800000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1200, 'benefit': {'bob': 5000}}, {'wage_expense': 100000, 'tax_expense': 5170, 'cash': 78430, 'withholding': 21740, 'benefits': 5000}], ['sample 2', {'gross': [['bob', 100000], ['ann', 250000], ['bob', 80000]], 'ytd': {'bob': 0, 'ann': 15000000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 2200, 'benefit': {'bob': 5000, 'ann': 0}}, {'wage_expense': 430000, 'tax_expense': 32895, 'cash': 294705, 'withholding': 158190, 'benefits': 10000}], ['sample 3', {'gross': [['di', 50000], ['ann', 50000], ['cy', 1234]], 'ytd': {'di': 16800000, 'ann': 16800000, 'cy': 0}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'di': 12345, 'ann': 0, 'cy': 5000}}, {'wage_expense': 101234, 'tax_expense': 7745, 'cash': 67755, 'withholding': 23879, 'benefits': 17345}], ['sample 4', {'gross': [['ann', 333333], ['di', 100000], ['bob', 1234]], 'ytd': {'ann': 0, 'di': 17000000, 'bob': 16800000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'ann': 12345, 'di': 5000, 'bob': 5000}}, {'wage_expense': 434567, 'tax_expense': 27045, 'cash': 343955, 'withholding': 95312, 'benefits': 22345}], ['sample 5', {'gross': [['ann', 50000], ['cy', 1234], ['di', 1234], ['ann', 200000]], 'ytd': {'ann': 0, 'cy': 17000000, 'di': 16800000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'ann': 0, 'cy': 5000, 'di': 5000}}, {'wage_expense': 252468, 'tax_expense': 19238, 'cash': 198984, 'withholding': 62722, 'benefits': 10000}], ['sample 6', {'gross': [['bob', 1234], ['cy', 333333], ['bob', 80000]], 'ytd': {'bob': 0, 'cy': 15000000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'bob': 12345, 'cy': 0}}, {'wage_expense': 414567, 'tax_expense': 31715, 'cash': 319174, 'withholding': 102418, 'benefits': 24690}]], [['regression: employer match composition', {'gross': [['ann', 1234], ['bob', 100000], ['di', 50000], ['ann', 80000]], 'ytd': {'ann': 15000000, 'bob': 0, 'di': 17000000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 2200, 'benefit': {'ann': 0, 'bob': 12345, 'di': 12345}}, {'wage_expense': 231234, 'tax_expense': 14590, 'cash': 146515, 'withholding': 74619, 'benefits': 24690}], ['sample 1', {'gross': [['cy', 50000], ['ann', 50000], ['di', 333333]], 'ytd': {'cy': 16700000, 'ann': 15000000, 'di': 0}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'cy': 0, 'ann': 12345, 'di': 12345}}, {'wage_expense': 433333, 'tax_expense': 33150, 'cash': 334628, 'withholding': 107165, 'benefits': 24690}], ['sample 2', {'gross': [['bob', 100000], ['ann', 250000]], 'ytd': {'bob': 15000000, 'ann': 15000000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'bob': 12345, 'ann': 5000}}, {'wage_expense': 350000, 'tax_expense': 26775, 'cash': 272614, 'withholding': 86816, 'benefits': 17345}], ['sample 3', {'gross': [['di', 100000], ['cy', 50000]], 'ytd': {'di': 16800000, 'cy': 16800000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 2200, 'benefit': {'di': 12345, 'cy': 5000}}, {'wage_expense': 150000, 'tax_expense': 8995, 'cash': 94476, 'withholding': 47174, 'benefits': 17345}], ['sample 4', {'gross': [['ann', 1234], ['bob', 1234], ['cy', 1234], ['ann', 80000]], 'ytd': {'ann': 0, 'bob': 16800000, 'cy': 17000000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1200, 'benefit': {'ann': 12345, 'bob': 0, 'cy': 5000}}, {'wage_expense': 83702, 'tax_expense': 6328, 'cash': 41202, 'withholding': 19138, 'benefits': 29690}], ['sample 5', {'gross': [['cy', 333333], ['ann', 333333]], 'ytd': {'cy': 0, 'ann': 16700000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 2200, 'benefit': {'cy': 12345, 'ann': 5000}}, {'wage_expense': 666666, 'tax_expense': 40253, 'cash': 466218, 'withholding': 223356, 'benefits': 17345}], ['sample 6', {'gross': [['bob', 50000], ['bob', 80000]], 'ytd': {'bob': 15000000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 2200, 'benefit': {'bob': 0}}, {'wage_expense': 130000, 'tax_expense': 9945, 'cash': 91455, 'withholding': 48490, 'benefits': 0}]], [['regression: employer match composition', {'gross': [['ann', 250000], ['di', 333333], ['ann', 200000]], 'ytd': {'ann': 17000000, 'di': 15000000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'ann': 5000, 'di': 12345}}, {'wage_expense': 783333, 'tax_expense': 32025, 'cash': 652864, 'withholding': 140149, 'benefits': 22345}], ['sample 1', {'gross': [['ann', 50000], ['cy', 50000], ['bob', 100000]], 'ytd': {'ann': 0, 'cy': 0, 'bob': 0}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1200, 'benefit': {'ann': 5000, 'cy': 5000, 'bob': 5000}}, {'wage_expense': 200000, 'tax_expense': 15300, 'cash': 147500, 'withholding': 52800, 'benefits': 15000}], ['sample 2', {'gross': [['ann', 333333]], 'ytd': {'ann': 17000000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'ann': 12345}}, {'wage_expense': 333333, 'tax_expense': 4833, 'cash': 284056, 'withholding': 41765, 'benefits': 12345}], ['sample 3', {'gross': [['di', 250000], ['ann', 250000], ['di', 200000]], 'ytd': {'di': 16800000, 'ann': 0}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1200, 'benefit': {'di': 12345, 'ann': 5000}}, {'wage_expense': 700000, 'tax_expense': 29370, 'cash': 560502, 'withholding': 139178, 'benefits': 29690}], ['sample 4', {'gross': [['di', 50000], ['cy', 50000]], 'ytd': {'di': 16800000, 'cy': 0}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1200, 'benefit': {'di': 5000, 'cy': 5000}}, {'wage_expense': 100000, 'tax_expense': 7650, 'cash': 71550, 'withholding': 26100, 'benefits': 10000}], ['sample 5', {'gross': [['di', 250000], ['bob', 100000], ['cy', 1234], ['di', 200000]], 'ytd': {'di': 17000000, 'bob': 15000000, 'cy': 0}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 2200, 'benefit': {'di': 0, 'bob': 12345, 'cy': 5000}}, {'wage_expense': 551234, 'tax_expense': 14270, 'cash': 402164, 'withholding': 145995, 'benefits': 17345}], ['sample 6', {'gross': [['cy', 250000]], 'ytd': {'cy': 0}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1200, 'benefit': {'cy': 0}}, {'wage_expense': 250000, 'tax_expense': 19125, 'cash': 200875, 'withholding': 68250, 'benefits': 0}]], [['regression: employer match composition', {'gross': [['bob', 100000]], 'ytd': {'bob': 15000000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'bob': 5000}}, {'wage_expense': 100000, 'tax_expense': 7650, 'cash': 77850, 'withholding': 24800, 'benefits': 5000}], ['sample 1', {'gross': [['ann', 100000], ['bob', 100000], ['cy', 250000]], 'ytd': {'ann': 16700000, 'bob': 17000000, 'cy': 16700000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 2200, 'benefit': {'ann': 12345, 'bob': 5000, 'cy': 0}}, {'wage_expense': 450000, 'tax_expense': 22645, 'cash': 314826, 'withholding': 140474, 'benefits': 17345}], ['sample 2', {'gross': [['bob', 1234], ['cy', 100000], ['ann', 100000], ['bob', 80000]], 'ytd': {'bob': 16800000, 'cy': 0, 'ann': 17000000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1200, 'benefit': {'bob': 0, 'cy': 12345, 'ann': 5000}}, {'wage_expense': 281234, 'tax_expense': 13998, 'cash': 218224, 'withholding': 59663, 'benefits': 17345}], ['sample 3', {'gross': [['cy', 100000]], 'ytd': {'cy': 0}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'cy': 5000}}, {'wage_expense': 100000, 'tax_expense': 7650, 'cash': 77850, 'withholding': 24800, 'benefits': 5000}], ['sample 4', {'gross': [['di', 100000], ['bob', 333333]], 'ytd': {'di': 0, 'bob': 16700000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'di': 0, 'bob': 12345}}, {'wage_expense': 433333, 'tax_expense': 22403, 'cash': 356486, 'withholding': 86905, 'benefits': 12345}], ['sample 5', {'gross': [['bob', 333333], ['di', 250000], ['ann', 50000], ['bob', 80000]], 'ytd': {'bob': 0, 'di': 16700000, 'ann': 16700000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'bob': 12345, 'di': 0, 'ann': 5000}}, {'wage_expense': 713333, 'tax_expense': 48990, 'cash': 566288, 'withholding': 166345, 'benefits': 29690}], ['sample 6', {'gross': [['bob', 333333]], 'ytd': {'bob': 16700000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 2200, 'benefit': {'bob': 5000}}, {'wage_expense': 333333, 'tax_expense': 14753, 'cash': 241347, 'withholding': 101739, 'benefits': 5000}]], [['regression: employer match composition', {'gross': [['ann', 333333], ['bob', 250000], ['cy', 1234]], 'ytd': {'ann': 0, 'bob': 16700000, 'cy': 16800000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 2200, 'benefit': {'ann': 5000, 'bob': 12345, 'cy': 0}}, {'wage_expense': 584567, 'tax_expense': 39140, 'cash': 403294, 'withholding': 203068, 'benefits': 17345}], ['sample 1', {'gross': [['di', 1234], ['bob', 333333], ['di', 80000]], 'ytd': {'di': 15000000, 'bob': 0}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 2200, 'benefit': {'di': 0, 'bob': 0}}, {'wage_expense': 414567, 'tax_expense': 31715, 'cash': 291648, 'withholding': 154634, 'benefits': 0}], ['sample 2', {'gross': [['di', 250000], ['di', 80000]], 'ytd': {'di': 0}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1200, 'benefit': {'di': 5000}}, {'wage_expense': 330000, 'tax_expense': 25245, 'cash': 256355, 'withholding': 88890, 'benefits': 10000}], ['sample 3', {'gross': [['di', 333333], ['bob', 100000], ['ann', 250000], ['di', 200000]], 'ytd': {'di': 17000000, 'bob': 17000000, 'ann': 16700000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'di': 5000, 'bob': 12345, 'ann': 12345}}, {'wage_expense': 883333, 'tax_expense': 22728, 'cash': 741050, 'withholding': 130321, 'benefits': 34690}], ['sample 4', {'gross': [['bob', 50000], ['bob', 200000]], 'ytd': {'bob': 16800000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'bob': 5000}}, {'wage_expense': 250000, 'tax_expense': 7345, 'cash': 208655, 'withholding': 38690, 'benefits': 10000}], ['sample 5', {'gross': [['bob', 100000], ['cy', 50000], ['ann', 100000]], 'ytd': {'bob': 15000000, 'cy': 16700000, 'ann': 16800000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'bob': 0, 'cy': 5000, 'ann': 12345}}, {'wage_expense': 250000, 'tax_expense': 16645, 'cash': 192744, 'withholding': 56556, 'benefits': 17345}], ['sample 6', {'gross': [['di', 1234]], 'ytd': {'di': 0}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1200, 'benefit': {'di': 5000}}, {'wage_expense': 1234, 'tax_expense': 95, 'cash': -3409, 'withholding': -262, 'benefits': 5000}]]]
for label, args, expected in fixtures[N-1]:
try:
actual = solve(args)
except Exception as exc:
actual = 'raised ' + type(exc).__name__
check(label, actual, expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: employer match composition | {'benefits': 29690, 'cash': 104339, 'tax_expense': 47205, 'wage_expense': 181234, 'withholding': 94410} | {'benefits': 29690, 'cash': 104339, 'tax_expense': 13865, 'wage_expense': 181234, 'withholding': 61070} | Failed |
| sample 1 | {'benefits': 5000, 'cash': 78430, 'tax_expense': 16570, 'wage_expense': 100000, 'withholding': 33140} | {'benefits': 5000, 'cash': 78430, 'tax_expense': 5170, 'wage_expense': 100000, 'withholding': 21740} | Failed |
| sample 2 | {'benefits': 10000, 'cash': 294705, 'tax_expense': 125295, 'wage_expense': 430000, 'withholding': 250590} | {'benefits': 10000, 'cash': 294705, 'tax_expense': 32895, 'wage_expense': 430000, 'withholding': 158190} | Failed |
| sample 3 | {'benefits': 17345, 'cash': 67755, 'tax_expense': 16134, 'wage_expense': 101234, 'withholding': 32268} | {'benefits': 17345, 'cash': 67755, 'tax_expense': 7745, 'wage_expense': 101234, 'withholding': 23879} | Failed |
| sample 4 | {'benefits': 22345, 'cash': 343955, 'tax_expense': 68267, 'wage_expense': 434567, 'withholding': 136534} | {'benefits': 22345, 'cash': 343955, 'tax_expense': 27045, 'wage_expense': 434567, 'withholding': 95312} | Failed |
| sample 5 | {'benefits': 10000, 'cash': 198984, 'tax_expense': 43484, 'wage_expense': 252468, 'withholding': 86968} | {'benefits': 10000, 'cash': 198984, 'tax_expense': 19238, 'wage_expense': 252468, 'withholding': 62722} | Failed |
| sample 6 | {'benefits': 24690, 'cash': 319174, 'tax_expense': 70703, 'wage_expense': 414567, 'withholding': 141406} | {'benefits': 24690, 'cash': 319174, 'tax_expense': 31715, 'wage_expense': 414567, 'withholding': 102418} | Failed |
SHA-256 / 43c79de19568332f5a5c538dffb8cbd49f07e5a7f5994d608c784988bf9658c9
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
def rnd(n, d):
q, r = divmod(n, d)
return q + (1 if 2 * r >= d else 0)
ytd = dict(x['ytd'])
wage = tax_exp = cash = withholding = benefits = 0
for emp, g in x['gross']:
ben = x['benefit'].get(emp, 0)
social = min(g, max(0, x['wage_base'] - ytd.get(emp, 0)))
ytd[emp] = ytd.get(emp, 0) + g
ss = rnd(social * x['ss_bp'], 10000)
med = rnd(g * x['med_bp'], 10000)
itax = rnd((g - ben) * x['itax_bp'], 10000)
employer = ss
wage += g
tax_exp += employer
cash += g - ss - med - itax - ben
withholding += ss + med + itax + employer
benefits += ben
return {'wage_expense': wage, 'tax_expense': tax_exp, 'cash': cash, 'withholding': withholding, 'benefits': benefits}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: employer match composition', {'gross': [['di', 1234], ['cy', 50000], ['bob', 50000], ['di', 80000]], 'ytd': {'di': 15000000, 'cy': 16800000, 'bob': 16800000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 2200, 'benefit': {'di': 12345, 'cy': 0, 'bob': 5000}}, {'wage_expense': 181234, 'tax_expense': 13865, 'cash': 104339, 'withholding': 61070, 'benefits': 29690}], ['sample 1', {'gross': [['bob', 100000]], 'ytd': {'bob': 16800000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1200, 'benefit': {'bob': 5000}}, {'wage_expense': 100000, 'tax_expense': 5170, 'cash': 78430, 'withholding': 21740, 'benefits': 5000}], ['sample 2', {'gross': [['bob', 100000], ['ann', 250000], ['bob', 80000]], 'ytd': {'bob': 0, 'ann': 15000000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 2200, 'benefit': {'bob': 5000, 'ann': 0}}, {'wage_expense': 430000, 'tax_expense': 32895, 'cash': 294705, 'withholding': 158190, 'benefits': 10000}], ['sample 3', {'gross': [['di', 50000], ['ann', 50000], ['cy', 1234]], 'ytd': {'di': 16800000, 'ann': 16800000, 'cy': 0}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'di': 12345, 'ann': 0, 'cy': 5000}}, {'wage_expense': 101234, 'tax_expense': 7745, 'cash': 67755, 'withholding': 23879, 'benefits': 17345}], ['sample 4', {'gross': [['ann', 333333], ['di', 100000], ['bob', 1234]], 'ytd': {'ann': 0, 'di': 17000000, 'bob': 16800000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'ann': 12345, 'di': 5000, 'bob': 5000}}, {'wage_expense': 434567, 'tax_expense': 27045, 'cash': 343955, 'withholding': 95312, 'benefits': 22345}], ['sample 5', {'gross': [['ann', 50000], ['cy', 1234], ['di', 1234], ['ann', 200000]], 'ytd': {'ann': 0, 'cy': 17000000, 'di': 16800000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'ann': 0, 'cy': 5000, 'di': 5000}}, {'wage_expense': 252468, 'tax_expense': 19238, 'cash': 198984, 'withholding': 62722, 'benefits': 10000}], ['sample 6', {'gross': [['bob', 1234], ['cy', 333333], ['bob', 80000]], 'ytd': {'bob': 0, 'cy': 15000000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'bob': 12345, 'cy': 0}}, {'wage_expense': 414567, 'tax_expense': 31715, 'cash': 319174, 'withholding': 102418, 'benefits': 24690}]], [['regression: employer match composition', {'gross': [['ann', 1234], ['bob', 100000], ['di', 50000], ['ann', 80000]], 'ytd': {'ann': 15000000, 'bob': 0, 'di': 17000000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 2200, 'benefit': {'ann': 0, 'bob': 12345, 'di': 12345}}, {'wage_expense': 231234, 'tax_expense': 14590, 'cash': 146515, 'withholding': 74619, 'benefits': 24690}], ['sample 1', {'gross': [['cy', 50000], ['ann', 50000], ['di', 333333]], 'ytd': {'cy': 16700000, 'ann': 15000000, 'di': 0}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'cy': 0, 'ann': 12345, 'di': 12345}}, {'wage_expense': 433333, 'tax_expense': 33150, 'cash': 334628, 'withholding': 107165, 'benefits': 24690}], ['sample 2', {'gross': [['bob', 100000], ['ann', 250000]], 'ytd': {'bob': 15000000, 'ann': 15000000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'bob': 12345, 'ann': 5000}}, {'wage_expense': 350000, 'tax_expense': 26775, 'cash': 272614, 'withholding': 86816, 'benefits': 17345}], ['sample 3', {'gross': [['di', 100000], ['cy', 50000]], 'ytd': {'di': 16800000, 'cy': 16800000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 2200, 'benefit': {'di': 12345, 'cy': 5000}}, {'wage_expense': 150000, 'tax_expense': 8995, 'cash': 94476, 'withholding': 47174, 'benefits': 17345}], ['sample 4', {'gross': [['ann', 1234], ['bob', 1234], ['cy', 1234], ['ann', 80000]], 'ytd': {'ann': 0, 'bob': 16800000, 'cy': 17000000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1200, 'benefit': {'ann': 12345, 'bob': 0, 'cy': 5000}}, {'wage_expense': 83702, 'tax_expense': 6328, 'cash': 41202, 'withholding': 19138, 'benefits': 29690}], ['sample 5', {'gross': [['cy', 333333], ['ann', 333333]], 'ytd': {'cy': 0, 'ann': 16700000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 2200, 'benefit': {'cy': 12345, 'ann': 5000}}, {'wage_expense': 666666, 'tax_expense': 40253, 'cash': 466218, 'withholding': 223356, 'benefits': 17345}], ['sample 6', {'gross': [['bob', 50000], ['bob', 80000]], 'ytd': {'bob': 15000000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 2200, 'benefit': {'bob': 0}}, {'wage_expense': 130000, 'tax_expense': 9945, 'cash': 91455, 'withholding': 48490, 'benefits': 0}]], [['regression: employer match composition', {'gross': [['ann', 250000], ['di', 333333], ['ann', 200000]], 'ytd': {'ann': 17000000, 'di': 15000000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'ann': 5000, 'di': 12345}}, {'wage_expense': 783333, 'tax_expense': 32025, 'cash': 652864, 'withholding': 140149, 'benefits': 22345}], ['sample 1', {'gross': [['ann', 50000], ['cy', 50000], ['bob', 100000]], 'ytd': {'ann': 0, 'cy': 0, 'bob': 0}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1200, 'benefit': {'ann': 5000, 'cy': 5000, 'bob': 5000}}, {'wage_expense': 200000, 'tax_expense': 15300, 'cash': 147500, 'withholding': 52800, 'benefits': 15000}], ['sample 2', {'gross': [['ann', 333333]], 'ytd': {'ann': 17000000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'ann': 12345}}, {'wage_expense': 333333, 'tax_expense': 4833, 'cash': 284056, 'withholding': 41765, 'benefits': 12345}], ['sample 3', {'gross': [['di', 250000], ['ann', 250000], ['di', 200000]], 'ytd': {'di': 16800000, 'ann': 0}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1200, 'benefit': {'di': 12345, 'ann': 5000}}, {'wage_expense': 700000, 'tax_expense': 29370, 'cash': 560502, 'withholding': 139178, 'benefits': 29690}], ['sample 4', {'gross': [['di', 50000], ['cy', 50000]], 'ytd': {'di': 16800000, 'cy': 0}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1200, 'benefit': {'di': 5000, 'cy': 5000}}, {'wage_expense': 100000, 'tax_expense': 7650, 'cash': 71550, 'withholding': 26100, 'benefits': 10000}], ['sample 5', {'gross': [['di', 250000], ['bob', 100000], ['cy', 1234], ['di', 200000]], 'ytd': {'di': 17000000, 'bob': 15000000, 'cy': 0}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 2200, 'benefit': {'di': 0, 'bob': 12345, 'cy': 5000}}, {'wage_expense': 551234, 'tax_expense': 14270, 'cash': 402164, 'withholding': 145995, 'benefits': 17345}], ['sample 6', {'gross': [['cy', 250000]], 'ytd': {'cy': 0}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1200, 'benefit': {'cy': 0}}, {'wage_expense': 250000, 'tax_expense': 19125, 'cash': 200875, 'withholding': 68250, 'benefits': 0}]], [['regression: employer match composition', {'gross': [['bob', 100000]], 'ytd': {'bob': 15000000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'bob': 5000}}, {'wage_expense': 100000, 'tax_expense': 7650, 'cash': 77850, 'withholding': 24800, 'benefits': 5000}], ['sample 1', {'gross': [['ann', 100000], ['bob', 100000], ['cy', 250000]], 'ytd': {'ann': 16700000, 'bob': 17000000, 'cy': 16700000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 2200, 'benefit': {'ann': 12345, 'bob': 5000, 'cy': 0}}, {'wage_expense': 450000, 'tax_expense': 22645, 'cash': 314826, 'withholding': 140474, 'benefits': 17345}], ['sample 2', {'gross': [['bob', 1234], ['cy', 100000], ['ann', 100000], ['bob', 80000]], 'ytd': {'bob': 16800000, 'cy': 0, 'ann': 17000000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1200, 'benefit': {'bob': 0, 'cy': 12345, 'ann': 5000}}, {'wage_expense': 281234, 'tax_expense': 13998, 'cash': 218224, 'withholding': 59663, 'benefits': 17345}], ['sample 3', {'gross': [['cy', 100000]], 'ytd': {'cy': 0}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'cy': 5000}}, {'wage_expense': 100000, 'tax_expense': 7650, 'cash': 77850, 'withholding': 24800, 'benefits': 5000}], ['sample 4', {'gross': [['di', 100000], ['bob', 333333]], 'ytd': {'di': 0, 'bob': 16700000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'di': 0, 'bob': 12345}}, {'wage_expense': 433333, 'tax_expense': 22403, 'cash': 356486, 'withholding': 86905, 'benefits': 12345}], ['sample 5', {'gross': [['bob', 333333], ['di', 250000], ['ann', 50000], ['bob', 80000]], 'ytd': {'bob': 0, 'di': 16700000, 'ann': 16700000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'bob': 12345, 'di': 0, 'ann': 5000}}, {'wage_expense': 713333, 'tax_expense': 48990, 'cash': 566288, 'withholding': 166345, 'benefits': 29690}], ['sample 6', {'gross': [['bob', 333333]], 'ytd': {'bob': 16700000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 2200, 'benefit': {'bob': 5000}}, {'wage_expense': 333333, 'tax_expense': 14753, 'cash': 241347, 'withholding': 101739, 'benefits': 5000}]], [['regression: employer match composition', {'gross': [['ann', 333333], ['bob', 250000], ['cy', 1234]], 'ytd': {'ann': 0, 'bob': 16700000, 'cy': 16800000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 2200, 'benefit': {'ann': 5000, 'bob': 12345, 'cy': 0}}, {'wage_expense': 584567, 'tax_expense': 39140, 'cash': 403294, 'withholding': 203068, 'benefits': 17345}], ['sample 1', {'gross': [['di', 1234], ['bob', 333333], ['di', 80000]], 'ytd': {'di': 15000000, 'bob': 0}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 2200, 'benefit': {'di': 0, 'bob': 0}}, {'wage_expense': 414567, 'tax_expense': 31715, 'cash': 291648, 'withholding': 154634, 'benefits': 0}], ['sample 2', {'gross': [['di', 250000], ['di', 80000]], 'ytd': {'di': 0}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1200, 'benefit': {'di': 5000}}, {'wage_expense': 330000, 'tax_expense': 25245, 'cash': 256355, 'withholding': 88890, 'benefits': 10000}], ['sample 3', {'gross': [['di', 333333], ['bob', 100000], ['ann', 250000], ['di', 200000]], 'ytd': {'di': 17000000, 'bob': 17000000, 'ann': 16700000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'di': 5000, 'bob': 12345, 'ann': 12345}}, {'wage_expense': 883333, 'tax_expense': 22728, 'cash': 741050, 'withholding': 130321, 'benefits': 34690}], ['sample 4', {'gross': [['bob', 50000], ['bob', 200000]], 'ytd': {'bob': 16800000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'bob': 5000}}, {'wage_expense': 250000, 'tax_expense': 7345, 'cash': 208655, 'withholding': 38690, 'benefits': 10000}], ['sample 5', {'gross': [['bob', 100000], ['cy', 50000], ['ann', 100000]], 'ytd': {'bob': 15000000, 'cy': 16700000, 'ann': 16800000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'bob': 0, 'cy': 5000, 'ann': 12345}}, {'wage_expense': 250000, 'tax_expense': 16645, 'cash': 192744, 'withholding': 56556, 'benefits': 17345}], ['sample 6', {'gross': [['di', 1234]], 'ytd': {'di': 0}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1200, 'benefit': {'di': 5000}}, {'wage_expense': 1234, 'tax_expense': 95, 'cash': -3409, 'withholding': -262, 'benefits': 5000}]]]
for label, args, expected in fixtures[N-1]:
try:
actual = solve(args)
except Exception as exc:
actual = 'raised ' + type(exc).__name__
check(label, actual, expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: employer match composition | {'benefits': 29690, 'cash': 104339, 'tax_expense': 11237, 'wage_expense': 181234, 'withholding': 58442} | {'benefits': 29690, 'cash': 104339, 'tax_expense': 13865, 'wage_expense': 181234, 'withholding': 61070} | Failed |
| sample 1 | {'benefits': 5000, 'cash': 78430, 'tax_expense': 3720, 'wage_expense': 100000, 'withholding': 20290} | {'benefits': 5000, 'cash': 78430, 'tax_expense': 5170, 'wage_expense': 100000, 'withholding': 21740} | Failed |
| sample 2 | {'benefits': 10000, 'cash': 294705, 'tax_expense': 26660, 'wage_expense': 430000, 'withholding': 151955} | {'benefits': 10000, 'cash': 294705, 'tax_expense': 32895, 'wage_expense': 430000, 'withholding': 158190} | Failed |
| sample 3 | {'benefits': 17345, 'cash': 67755, 'tax_expense': 6277, 'wage_expense': 101234, 'withholding': 22411} | {'benefits': 17345, 'cash': 67755, 'tax_expense': 7745, 'wage_expense': 101234, 'withholding': 23879} | Failed |
| sample 4 | {'benefits': 22345, 'cash': 343955, 'tax_expense': 20744, 'wage_expense': 434567, 'withholding': 89011} | {'benefits': 22345, 'cash': 343955, 'tax_expense': 27045, 'wage_expense': 434567, 'withholding': 95312} | Failed |
| sample 5 | {'benefits': 10000, 'cash': 198984, 'tax_expense': 15577, 'wage_expense': 252468, 'withholding': 59061} | {'benefits': 10000, 'cash': 198984, 'tax_expense': 19238, 'wage_expense': 252468, 'withholding': 62722} | Failed |
| sample 6 | {'benefits': 24690, 'cash': 319174, 'tax_expense': 25704, 'wage_expense': 414567, 'withholding': 96407} | {'benefits': 24690, 'cash': 319174, 'tax_expense': 31715, 'wage_expense': 414567, 'withholding': 102418} | Failed |
SHA-256 / c6193478f920ef7440652e6a3465dd8fefb0bbbeddba1e0a8773e983b82c3777
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
def rnd(n, d):
q, r = divmod(n, d)
return q + (1 if 2 * r >= d else 0)
ytd = dict(x['ytd'])
wage = tax_exp = cash = withholding = benefits = 0
for emp, g in x['gross']:
ben = x['benefit'].get(emp, 0)
social = min(g, max(0, x['wage_base'] - ytd.get(emp, 0)))
ytd[emp] = ytd.get(emp, 0) + g
ss = rnd(social * x['ss_bp'], 10000)
med = rnd(g * x['med_bp'], 10000)
itax = rnd((g - ben) * x['itax_bp'], 10000)
employer = ss + med
wage += g
tax_exp += employer
cash += g - ss - med - itax - ben
withholding += ss + med + itax + employer
benefits += ben
return {'wage_expense': wage, 'tax_expense': tax_exp, 'cash': cash, 'withholding': withholding, 'benefits': benefits}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: employer match composition', {'gross': [['di', 1234], ['cy', 50000], ['bob', 50000], ['di', 80000]], 'ytd': {'di': 15000000, 'cy': 16800000, 'bob': 16800000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 2200, 'benefit': {'di': 12345, 'cy': 0, 'bob': 5000}}, {'wage_expense': 181234, 'tax_expense': 13865, 'cash': 104339, 'withholding': 61070, 'benefits': 29690}], ['sample 1', {'gross': [['bob', 100000]], 'ytd': {'bob': 16800000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1200, 'benefit': {'bob': 5000}}, {'wage_expense': 100000, 'tax_expense': 5170, 'cash': 78430, 'withholding': 21740, 'benefits': 5000}], ['sample 2', {'gross': [['bob', 100000], ['ann', 250000], ['bob', 80000]], 'ytd': {'bob': 0, 'ann': 15000000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 2200, 'benefit': {'bob': 5000, 'ann': 0}}, {'wage_expense': 430000, 'tax_expense': 32895, 'cash': 294705, 'withholding': 158190, 'benefits': 10000}], ['sample 3', {'gross': [['di', 50000], ['ann', 50000], ['cy', 1234]], 'ytd': {'di': 16800000, 'ann': 16800000, 'cy': 0}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'di': 12345, 'ann': 0, 'cy': 5000}}, {'wage_expense': 101234, 'tax_expense': 7745, 'cash': 67755, 'withholding': 23879, 'benefits': 17345}], ['sample 4', {'gross': [['ann', 333333], ['di', 100000], ['bob', 1234]], 'ytd': {'ann': 0, 'di': 17000000, 'bob': 16800000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'ann': 12345, 'di': 5000, 'bob': 5000}}, {'wage_expense': 434567, 'tax_expense': 27045, 'cash': 343955, 'withholding': 95312, 'benefits': 22345}], ['sample 5', {'gross': [['ann', 50000], ['cy', 1234], ['di', 1234], ['ann', 200000]], 'ytd': {'ann': 0, 'cy': 17000000, 'di': 16800000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'ann': 0, 'cy': 5000, 'di': 5000}}, {'wage_expense': 252468, 'tax_expense': 19238, 'cash': 198984, 'withholding': 62722, 'benefits': 10000}], ['sample 6', {'gross': [['bob', 1234], ['cy', 333333], ['bob', 80000]], 'ytd': {'bob': 0, 'cy': 15000000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'bob': 12345, 'cy': 0}}, {'wage_expense': 414567, 'tax_expense': 31715, 'cash': 319174, 'withholding': 102418, 'benefits': 24690}]], [['regression: employer match composition', {'gross': [['ann', 1234], ['bob', 100000], ['di', 50000], ['ann', 80000]], 'ytd': {'ann': 15000000, 'bob': 0, 'di': 17000000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 2200, 'benefit': {'ann': 0, 'bob': 12345, 'di': 12345}}, {'wage_expense': 231234, 'tax_expense': 14590, 'cash': 146515, 'withholding': 74619, 'benefits': 24690}], ['sample 1', {'gross': [['cy', 50000], ['ann', 50000], ['di', 333333]], 'ytd': {'cy': 16700000, 'ann': 15000000, 'di': 0}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'cy': 0, 'ann': 12345, 'di': 12345}}, {'wage_expense': 433333, 'tax_expense': 33150, 'cash': 334628, 'withholding': 107165, 'benefits': 24690}], ['sample 2', {'gross': [['bob', 100000], ['ann', 250000]], 'ytd': {'bob': 15000000, 'ann': 15000000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'bob': 12345, 'ann': 5000}}, {'wage_expense': 350000, 'tax_expense': 26775, 'cash': 272614, 'withholding': 86816, 'benefits': 17345}], ['sample 3', {'gross': [['di', 100000], ['cy', 50000]], 'ytd': {'di': 16800000, 'cy': 16800000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 2200, 'benefit': {'di': 12345, 'cy': 5000}}, {'wage_expense': 150000, 'tax_expense': 8995, 'cash': 94476, 'withholding': 47174, 'benefits': 17345}], ['sample 4', {'gross': [['ann', 1234], ['bob', 1234], ['cy', 1234], ['ann', 80000]], 'ytd': {'ann': 0, 'bob': 16800000, 'cy': 17000000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1200, 'benefit': {'ann': 12345, 'bob': 0, 'cy': 5000}}, {'wage_expense': 83702, 'tax_expense': 6328, 'cash': 41202, 'withholding': 19138, 'benefits': 29690}], ['sample 5', {'gross': [['cy', 333333], ['ann', 333333]], 'ytd': {'cy': 0, 'ann': 16700000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 2200, 'benefit': {'cy': 12345, 'ann': 5000}}, {'wage_expense': 666666, 'tax_expense': 40253, 'cash': 466218, 'withholding': 223356, 'benefits': 17345}], ['sample 6', {'gross': [['bob', 50000], ['bob', 80000]], 'ytd': {'bob': 15000000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 2200, 'benefit': {'bob': 0}}, {'wage_expense': 130000, 'tax_expense': 9945, 'cash': 91455, 'withholding': 48490, 'benefits': 0}]], [['regression: employer match composition', {'gross': [['ann', 250000], ['di', 333333], ['ann', 200000]], 'ytd': {'ann': 17000000, 'di': 15000000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'ann': 5000, 'di': 12345}}, {'wage_expense': 783333, 'tax_expense': 32025, 'cash': 652864, 'withholding': 140149, 'benefits': 22345}], ['sample 1', {'gross': [['ann', 50000], ['cy', 50000], ['bob', 100000]], 'ytd': {'ann': 0, 'cy': 0, 'bob': 0}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1200, 'benefit': {'ann': 5000, 'cy': 5000, 'bob': 5000}}, {'wage_expense': 200000, 'tax_expense': 15300, 'cash': 147500, 'withholding': 52800, 'benefits': 15000}], ['sample 2', {'gross': [['ann', 333333]], 'ytd': {'ann': 17000000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'ann': 12345}}, {'wage_expense': 333333, 'tax_expense': 4833, 'cash': 284056, 'withholding': 41765, 'benefits': 12345}], ['sample 3', {'gross': [['di', 250000], ['ann', 250000], ['di', 200000]], 'ytd': {'di': 16800000, 'ann': 0}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1200, 'benefit': {'di': 12345, 'ann': 5000}}, {'wage_expense': 700000, 'tax_expense': 29370, 'cash': 560502, 'withholding': 139178, 'benefits': 29690}], ['sample 4', {'gross': [['di', 50000], ['cy', 50000]], 'ytd': {'di': 16800000, 'cy': 0}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1200, 'benefit': {'di': 5000, 'cy': 5000}}, {'wage_expense': 100000, 'tax_expense': 7650, 'cash': 71550, 'withholding': 26100, 'benefits': 10000}], ['sample 5', {'gross': [['di', 250000], ['bob', 100000], ['cy', 1234], ['di', 200000]], 'ytd': {'di': 17000000, 'bob': 15000000, 'cy': 0}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 2200, 'benefit': {'di': 0, 'bob': 12345, 'cy': 5000}}, {'wage_expense': 551234, 'tax_expense': 14270, 'cash': 402164, 'withholding': 145995, 'benefits': 17345}], ['sample 6', {'gross': [['cy', 250000]], 'ytd': {'cy': 0}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1200, 'benefit': {'cy': 0}}, {'wage_expense': 250000, 'tax_expense': 19125, 'cash': 200875, 'withholding': 68250, 'benefits': 0}]], [['regression: employer match composition', {'gross': [['bob', 100000]], 'ytd': {'bob': 15000000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'bob': 5000}}, {'wage_expense': 100000, 'tax_expense': 7650, 'cash': 77850, 'withholding': 24800, 'benefits': 5000}], ['sample 1', {'gross': [['ann', 100000], ['bob', 100000], ['cy', 250000]], 'ytd': {'ann': 16700000, 'bob': 17000000, 'cy': 16700000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 2200, 'benefit': {'ann': 12345, 'bob': 5000, 'cy': 0}}, {'wage_expense': 450000, 'tax_expense': 22645, 'cash': 314826, 'withholding': 140474, 'benefits': 17345}], ['sample 2', {'gross': [['bob', 1234], ['cy', 100000], ['ann', 100000], ['bob', 80000]], 'ytd': {'bob': 16800000, 'cy': 0, 'ann': 17000000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1200, 'benefit': {'bob': 0, 'cy': 12345, 'ann': 5000}}, {'wage_expense': 281234, 'tax_expense': 13998, 'cash': 218224, 'withholding': 59663, 'benefits': 17345}], ['sample 3', {'gross': [['cy', 100000]], 'ytd': {'cy': 0}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'cy': 5000}}, {'wage_expense': 100000, 'tax_expense': 7650, 'cash': 77850, 'withholding': 24800, 'benefits': 5000}], ['sample 4', {'gross': [['di', 100000], ['bob', 333333]], 'ytd': {'di': 0, 'bob': 16700000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'di': 0, 'bob': 12345}}, {'wage_expense': 433333, 'tax_expense': 22403, 'cash': 356486, 'withholding': 86905, 'benefits': 12345}], ['sample 5', {'gross': [['bob', 333333], ['di', 250000], ['ann', 50000], ['bob', 80000]], 'ytd': {'bob': 0, 'di': 16700000, 'ann': 16700000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'bob': 12345, 'di': 0, 'ann': 5000}}, {'wage_expense': 713333, 'tax_expense': 48990, 'cash': 566288, 'withholding': 166345, 'benefits': 29690}], ['sample 6', {'gross': [['bob', 333333]], 'ytd': {'bob': 16700000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 2200, 'benefit': {'bob': 5000}}, {'wage_expense': 333333, 'tax_expense': 14753, 'cash': 241347, 'withholding': 101739, 'benefits': 5000}]], [['regression: employer match composition', {'gross': [['ann', 333333], ['bob', 250000], ['cy', 1234]], 'ytd': {'ann': 0, 'bob': 16700000, 'cy': 16800000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 2200, 'benefit': {'ann': 5000, 'bob': 12345, 'cy': 0}}, {'wage_expense': 584567, 'tax_expense': 39140, 'cash': 403294, 'withholding': 203068, 'benefits': 17345}], ['sample 1', {'gross': [['di', 1234], ['bob', 333333], ['di', 80000]], 'ytd': {'di': 15000000, 'bob': 0}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 2200, 'benefit': {'di': 0, 'bob': 0}}, {'wage_expense': 414567, 'tax_expense': 31715, 'cash': 291648, 'withholding': 154634, 'benefits': 0}], ['sample 2', {'gross': [['di', 250000], ['di', 80000]], 'ytd': {'di': 0}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1200, 'benefit': {'di': 5000}}, {'wage_expense': 330000, 'tax_expense': 25245, 'cash': 256355, 'withholding': 88890, 'benefits': 10000}], ['sample 3', {'gross': [['di', 333333], ['bob', 100000], ['ann', 250000], ['di', 200000]], 'ytd': {'di': 17000000, 'bob': 17000000, 'ann': 16700000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'di': 5000, 'bob': 12345, 'ann': 12345}}, {'wage_expense': 883333, 'tax_expense': 22728, 'cash': 741050, 'withholding': 130321, 'benefits': 34690}], ['sample 4', {'gross': [['bob', 50000], ['bob', 200000]], 'ytd': {'bob': 16800000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'bob': 5000}}, {'wage_expense': 250000, 'tax_expense': 7345, 'cash': 208655, 'withholding': 38690, 'benefits': 10000}], ['sample 5', {'gross': [['bob', 100000], ['cy', 50000], ['ann', 100000]], 'ytd': {'bob': 15000000, 'cy': 16700000, 'ann': 16800000}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1000, 'benefit': {'bob': 0, 'cy': 5000, 'ann': 12345}}, {'wage_expense': 250000, 'tax_expense': 16645, 'cash': 192744, 'withholding': 56556, 'benefits': 17345}], ['sample 6', {'gross': [['di', 1234]], 'ytd': {'di': 0}, 'wage_base': 16860000, 'ss_bp': 620, 'med_bp': 145, 'itax_bp': 1200, 'benefit': {'di': 5000}}, {'wage_expense': 1234, 'tax_expense': 95, 'cash': -3409, 'withholding': -262, 'benefits': 5000}]]]
for label, args, expected in fixtures[N-1]:
try:
actual = solve(args)
except Exception as exc:
actual = 'raised ' + type(exc).__name__
check(label, actual, expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: employer match composition | {'benefits': 29690, 'cash': 104339, 'tax_expense': 13865, 'wage_expense': 181234, 'withholding': 61070} | {'benefits': 29690, 'cash': 104339, 'tax_expense': 13865, 'wage_expense': 181234, 'withholding': 61070} | Passed |
| sample 1 | {'benefits': 5000, 'cash': 78430, 'tax_expense': 5170, 'wage_expense': 100000, 'withholding': 21740} | {'benefits': 5000, 'cash': 78430, 'tax_expense': 5170, 'wage_expense': 100000, 'withholding': 21740} | Passed |
| sample 2 | {'benefits': 10000, 'cash': 294705, 'tax_expense': 32895, 'wage_expense': 430000, 'withholding': 158190} | {'benefits': 10000, 'cash': 294705, 'tax_expense': 32895, 'wage_expense': 430000, 'withholding': 158190} | Passed |
| sample 3 | {'benefits': 17345, 'cash': 67755, 'tax_expense': 7745, 'wage_expense': 101234, 'withholding': 23879} | {'benefits': 17345, 'cash': 67755, 'tax_expense': 7745, 'wage_expense': 101234, 'withholding': 23879} | Passed |
| sample 4 | {'benefits': 22345, 'cash': 343955, 'tax_expense': 27045, 'wage_expense': 434567, 'withholding': 95312} | {'benefits': 22345, 'cash': 343955, 'tax_expense': 27045, 'wage_expense': 434567, 'withholding': 95312} | Passed |
| sample 5 | {'benefits': 10000, 'cash': 198984, 'tax_expense': 19238, 'wage_expense': 252468, 'withholding': 62722} | {'benefits': 10000, 'cash': 198984, 'tax_expense': 19238, 'wage_expense': 252468, 'withholding': 62722} | Passed |
| sample 6 | {'benefits': 24690, 'cash': 319174, 'tax_expense': 31715, 'wage_expense': 414567, 'withholding': 102418} | {'benefits': 24690, 'cash': 319174, 'tax_expense': 31715, 'wage_expense': 414567, 'withholding': 102418} | Passed |
SHA-256 / fdae88e87e7893c3c351a490ac578840b9e826bc04de4dc34ca3aaa740a76b98
Verification & scope
A deterministic bounded teaching model with stipulated toy bookkeeping rules stated in the contract; amounts are integer cents; it makes no claim of conformance to any accounting standard or product. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:46:25.345475+00:00.
Case digest / 57cb1df04a74595138f0f903d6b2761073a9a292f41fa6d4e1a7c920333e9ecb