broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    p = x['periods']
    annual = x['wage'] * p + x['other_income']
    base_std = {'single': 860000, 'mfj': 1290000, 'hoh': 860000}[x['status']]
    ded = (base_std // 2 if x['step2'] else base_std) + x['deductions']
    taxable = max(0, annual - ded)
    unit = {'single': 2, 'mfj': 4, 'hoh': 3}[x['status']]
    div = 4 if x['step2'] and x['status'] == 'single' else 2
    bounds = [700000 * unit // div, 3000000 * unit // div, 9000000 * unit // div]
    rates = [10, 12, 22]
    tax = 0
    for i, lo in enumerate(bounds):
        hi = bounds[i + 1] if i + 1 < len(bounds) else taxable
        if taxable > lo:
            tax += (min(taxable, hi) - lo) * rates[i]
    tentative = (tax * 2 + 100 * p) // (200 * p)
    credit_pp = (x['credits'] * 2 + p) // (2 * p)
    wh = max(0, tentative - credit_pp) + x['extra']
    return [tentative, wh]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'wage': 124748, 'periods': 26, 'status': 'mfj', 'step2': True, 'credits': 0, 'other_income': 0, 'deductions': 0, 'extra': 0}, [7302, 7302]), ('regression', {'wage': 69636, 'periods': 24, 'status': 'hoh', 'step2': True, 'credits': 877725, 'other_income': 1721162, 'deductions': 1014955, 'extra': 0}, [5927, 0]), ('partial-repair probe', {'wage': 176, 'periods': 12, 'status': 'mfj', 'step2': True, 'credits': 0, 'other_income': 1390591, 'deductions': 0, 'extra': 0}, [398, 398]), ('partial-repair probe', {'wage': 178354, 'periods': 26, 'status': 'mfj', 'step2': True, 'credits': 0, 'other_income': 0, 'deductions': 112718, 'extra': 0}, [12905, 12905]), ('boundary control', {'wage': 0, 'periods': 26, 'status': 'single', 'step2': False, 'credits': 400000, 'other_income': 0, 'deductions': 0, 'extra': 5000}, [0, 5000]), ('normal control', {'wage': 4942, 'periods': 12, 'status': 'single', 'step2': False, 'credits': 400000, 'other_income': 1831505, 'deductions': 0, 'extra': 8860}, [2757, 8860]), ('normal control', {'wage': 111690, 'periods': 26, 'status': 'mfj', 'step2': False, 'credits': 0, 'other_income': 0, 'deductions': 0, 'extra': 0}, [823, 823]), ('normal control', {'wage': 67447, 'periods': 24, 'status': 'mfj', 'step2': False, 'credits': 400000, 'other_income': 0, 'deductions': 0, 'extra': 2500}, [0, 2500]), ('normal control', {'wage': 1041418, 'periods': 24, 'status': 'hoh', 'step2': False, 'credits': 0, 'other_income': 0, 'deductions': 0, 'extra': 2500}, [156854, 159354])], [('regression', {'wage': 176, 'periods': 12, 'status': 'mfj', 'step2': True, 'credits': 0, 'other_income': 1390591, 'deductions': 0, 'extra': 0}, [398, 398]), ('regression', {'wage': 285367, 'periods': 52, 'status': 'hoh', 'step2': True, 'credits': 0, 'other_income': 0, 'deductions': 1182238, 'extra': 2500}, [41104, 43604]), ('partial-repair probe', {'wage': 178354, 'periods': 26, 'status': 'mfj', 'step2': True, 'credits': 0, 'other_income': 0, 'deductions': 112718, 'extra': 0}, [12905, 12905]), ('partial-repair probe', {'wage': 190399, 'periods': 24, 'status': 'mfj', 'step2': True, 'credits': 200000, 'other_income': 1327070, 'deductions': 0, 'extra': 0}, [20842, 12509]), ('boundary control', {'wage': 0, 'periods': 26, 'status': 'single', 'step2': False, 'credits': 400000, 'other_income': 0, 'deductions': 0, 'extra': 5000}, [0, 5000]), ('normal control', {'wage': 245742, 'periods': 24, 'status': 'single', 'step2': False, 'credits': 0, 'other_income': 0, 'deductions': 0, 'extra': 2500}, [19772, 22272]), ('normal control', {'wage': 196398, 'periods': 12, 'status': 'single', 'step2': False, 'credits': 0, 'other_income': 0, 'deductions': 0, 'extra': 0}, [6640, 6640]), ('normal control', {'wage': 64669, 'periods': 24, 'status': 'single', 'step2': False, 'credits': 0, 'other_income': 0, 'deductions': 0, 'extra': 2500}, [0, 2500]), ('normal control', {'wage': 492438, 'periods': 12, 'status': 'single', 'step2': True, 'credits': 400000, 'other_income': 131536, 'deductions': 0, 'extra': 0}, [59948, 26615])], [('regression', {'wage': 178354, 'periods': 26, 'status': 'mfj', 'step2': True, 'credits': 0, 'other_income': 0, 'deductions': 112718, 'extra': 0}, [12905, 12905]), ('regression', {'wage': 124748, 'periods': 26, 'status': 'mfj', 'step2': True, 'credits': 0, 'other_income': 0, 'deductions': 0, 'extra': 0}, [7302, 7302]), ('partial-repair probe', {'wage': 224276, 'periods': 26, 'status': 'mfj', 'step2': True, 'credits': 400000, 'other_income': 1419837, 'deductions': 0, 'extra': 0}, [25489, 10104]), ('partial-repair probe', {'wage': 876215, 'periods': 26, 'status': 'mfj', 'step2': True, 'credits': 458880, 'other_income': 257651, 'deductions': 0, 'extra': 2500}, [149874, 134725]), ('boundary control', {'wage': 0, 'periods': 26, 'status': 'single', 'step2': False, 'credits': 400000, 'other_income': 0, 'deductions': 0, 'extra': 5000}, [0, 5000]), ('normal control', {'wage': 232685, 'periods': 52, 'status': 'mfj', 'step2': False, 'credits': 200000, 'other_income': 0, 'deductions': 479252, 'extra': 0}, [18839, 14993]), ('normal control', {'wage': 79014, 'periods': 24, 'status': 'mfj', 'step2': False, 'credits': 400000, 'other_income': 1864011, 'deductions': 0, 'extra': 0}, [4460, 0]), ('normal control', {'wage': 322003, 'periods': 12, 'status': 'single', 'step2': False, 'credits': 0, 'other_income': 0, 'deductions': 0, 'extra': 2500}, [19207, 21707]), ('normal control', {'wage': 93316, 'periods': 12, 'status': 'mfj', 'step2': False, 'credits': 200000, 'other_income': 1111591, 'deductions': 0, 'extra': 1563}, [0, 1563])], [('regression', {'wage': 190399, 'periods': 24, 'status': 'mfj', 'step2': True, 'credits': 200000, 'other_income': 1327070, 'deductions': 0, 'extra': 0}, [20842, 12509]), ('regression', {'wage': 90292, 'periods': 52, 'status': 'hoh', 'step2': True, 'credits': 0, 'other_income': 0, 'deductions': 0, 'extra': 2500}, [7968, 10468]), ('partial-repair probe', {'wage': 72508, 'periods': 12, 'status': 'mfj', 'step2': True, 'credits': 0, 'other_income': 629389, 'deductions': 0, 'extra': 3100}, [1287, 4387]), ('partial-repair probe', {'wage': 1074758, 'periods': 52, 'status': 'mfj', 'step2': True, 'credits': 104962, 'other_income': 0, 'deductions': 0, 'extra': 2500}, [213910, 214391]), ('boundary control', {'wage': 0, 'periods': 26, 'status': 'single', 'step2': False, 'credits': 400000, 'other_income': 0, 'deductions': 0, 'extra': 5000}, [0, 5000]), ('normal control', {'wage': 37313, 'periods': 52, 'status': 'mfj', 'step2': False, 'credits': 117737, 'other_income': 1320234, 'deductions': 0, 'extra': 5664}, [1097, 5664]), ('normal control', {'wage': 179669, 'periods': 52, 'status': 'single', 'step2': False, 'credits': 0, 'other_income': 0, 'deductions': 0, 'extra': 0}, [17076, 17076]), ('normal control', {'wage': 170108, 'periods': 12, 'status': 'single', 'step2': True, 'credits': 200000, 'other_income': 167672, 'deductions': 0, 'extra': 0}, [12373, 0]), ('normal control', {'wage': 244499, 'periods': 26, 'status': 'hoh', 'step2': False, 'credits': 305778, 'other_income': 170107, 'deductions': 0, 'extra': 0}, [18656, 6895])], [('regression', {'wage': 224276, 'periods': 26, 'status': 'mfj', 'step2': True, 'credits': 400000, 'other_income': 1419837, 'deductions': 0, 'extra': 0}, [25489, 10104]), ('regression', {'wage': 142479, 'periods': 52, 'status': 'hoh', 'step2': True, 'credits': 551126, 'other_income': 0, 'deductions': 0, 'extra': 3806}, [14670, 7877]), ('partial-repair probe', {'wage': 93176, 'periods': 52, 'status': 'mfj', 'step2': True, 'credits': 200000, 'other_income': 0, 'deductions': 310339, 'extra': 0}, [6476, 2630]), ('partial-repair probe', {'wage': 737849, 'periods': 24, 'status': 'mfj', 'step2': True, 'credits': 400000, 'other_income': 0, 'deductions': 0, 'extra': 3155}, [113498, 99986]), ('boundary control', {'wage': 0, 'periods': 26, 'status': 'single', 'step2': False, 'credits': 400000, 'other_income': 0, 'deductions': 0, 'extra': 5000}, [0, 5000]), ('normal control', {'wage': 250357, 'periods': 52, 'status': 'single', 'step2': False, 'credits': 0, 'other_income': 0, 'deductions': 0, 'extra': 2500}, [31632, 34132]), ('normal control', {'wage': 251742, 'periods': 52, 'status': 'hoh', 'step2': False, 'credits': 0, 'other_income': 0, 'deductions': 392790, 'extra': 0}, [23568, 23568]), ('normal control', {'wage': 290758, 'periods': 26, 'status': 'single', 'step2': False, 'credits': 0, 'other_income': 1100573, 'deductions': 944056, 'extra': 0}, [26644, 26644]), ('normal control', {'wage': 76761, 'periods': 52, 'status': 'hoh', 'step2': False, 'credits': 400000, 'other_income': 0, 'deductions': 0, 'extra': 2500}, [4003, 2500])]]
for i, (label, args, expected) in enumerate(fixtures[N-1]):
    check("%s %d" % (label, i), solve(args), 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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    p = x['periods']
    annual = x['wage'] * p + x['other_income']
    base_std = {'single': 860000, 'mfj': 1290000, 'hoh': 860000}[x['status']]
    ded = (base_std // 2 if x['step2'] else base_std) + x['deductions']
    taxable = max(0, annual - ded)
    unit = {'single': 2, 'mfj': 4, 'hoh': 3}[x['status']]
    div = 4 if x['step2'] and x['status'] != 'mfj' else 2
    bounds = [700000 * unit // div, 3000000 * unit // div, 9000000 * unit // div]
    rates = [10, 12, 22]
    tax = 0
    for i, lo in enumerate(bounds):
        hi = bounds[i + 1] if i + 1 < len(bounds) else taxable
        if taxable > lo:
            tax += (min(taxable, hi) - lo) * rates[i]
    tentative = (tax * 2 + 100 * p) // (200 * p)
    credit_pp = (x['credits'] * 2 + p) // (2 * p)
    wh = max(0, tentative - credit_pp) + x['extra']
    return [tentative, wh]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'wage': 124748, 'periods': 26, 'status': 'mfj', 'step2': True, 'credits': 0, 'other_income': 0, 'deductions': 0, 'extra': 0}, [7302, 7302]), ('regression', {'wage': 69636, 'periods': 24, 'status': 'hoh', 'step2': True, 'credits': 877725, 'other_income': 1721162, 'deductions': 1014955, 'extra': 0}, [5927, 0]), ('partial-repair probe', {'wage': 176, 'periods': 12, 'status': 'mfj', 'step2': True, 'credits': 0, 'other_income': 1390591, 'deductions': 0, 'extra': 0}, [398, 398]), ('partial-repair probe', {'wage': 178354, 'periods': 26, 'status': 'mfj', 'step2': True, 'credits': 0, 'other_income': 0, 'deductions': 112718, 'extra': 0}, [12905, 12905]), ('boundary control', {'wage': 0, 'periods': 26, 'status': 'single', 'step2': False, 'credits': 400000, 'other_income': 0, 'deductions': 0, 'extra': 5000}, [0, 5000]), ('normal control', {'wage': 4942, 'periods': 12, 'status': 'single', 'step2': False, 'credits': 400000, 'other_income': 1831505, 'deductions': 0, 'extra': 8860}, [2757, 8860]), ('normal control', {'wage': 111690, 'periods': 26, 'status': 'mfj', 'step2': False, 'credits': 0, 'other_income': 0, 'deductions': 0, 'extra': 0}, [823, 823]), ('normal control', {'wage': 67447, 'periods': 24, 'status': 'mfj', 'step2': False, 'credits': 400000, 'other_income': 0, 'deductions': 0, 'extra': 2500}, [0, 2500]), ('normal control', {'wage': 1041418, 'periods': 24, 'status': 'hoh', 'step2': False, 'credits': 0, 'other_income': 0, 'deductions': 0, 'extra': 2500}, [156854, 159354])], [('regression', {'wage': 176, 'periods': 12, 'status': 'mfj', 'step2': True, 'credits': 0, 'other_income': 1390591, 'deductions': 0, 'extra': 0}, [398, 398]), ('regression', {'wage': 285367, 'periods': 52, 'status': 'hoh', 'step2': True, 'credits': 0, 'other_income': 0, 'deductions': 1182238, 'extra': 2500}, [41104, 43604]), ('partial-repair probe', {'wage': 178354, 'periods': 26, 'status': 'mfj', 'step2': True, 'credits': 0, 'other_income': 0, 'deductions': 112718, 'extra': 0}, [12905, 12905]), ('partial-repair probe', {'wage': 190399, 'periods': 24, 'status': 'mfj', 'step2': True, 'credits': 200000, 'other_income': 1327070, 'deductions': 0, 'extra': 0}, [20842, 12509]), ('boundary control', {'wage': 0, 'periods': 26, 'status': 'single', 'step2': False, 'credits': 400000, 'other_income': 0, 'deductions': 0, 'extra': 5000}, [0, 5000]), ('normal control', {'wage': 245742, 'periods': 24, 'status': 'single', 'step2': False, 'credits': 0, 'other_income': 0, 'deductions': 0, 'extra': 2500}, [19772, 22272]), ('normal control', {'wage': 196398, 'periods': 12, 'status': 'single', 'step2': False, 'credits': 0, 'other_income': 0, 'deductions': 0, 'extra': 0}, [6640, 6640]), ('normal control', {'wage': 64669, 'periods': 24, 'status': 'single', 'step2': False, 'credits': 0, 'other_income': 0, 'deductions': 0, 'extra': 2500}, [0, 2500]), ('normal control', {'wage': 492438, 'periods': 12, 'status': 'single', 'step2': True, 'credits': 400000, 'other_income': 131536, 'deductions': 0, 'extra': 0}, [59948, 26615])], [('regression', {'wage': 178354, 'periods': 26, 'status': 'mfj', 'step2': True, 'credits': 0, 'other_income': 0, 'deductions': 112718, 'extra': 0}, [12905, 12905]), ('regression', {'wage': 124748, 'periods': 26, 'status': 'mfj', 'step2': True, 'credits': 0, 'other_income': 0, 'deductions': 0, 'extra': 0}, [7302, 7302]), ('partial-repair probe', {'wage': 224276, 'periods': 26, 'status': 'mfj', 'step2': True, 'credits': 400000, 'other_income': 1419837, 'deductions': 0, 'extra': 0}, [25489, 10104]), ('partial-repair probe', {'wage': 876215, 'periods': 26, 'status': 'mfj', 'step2': True, 'credits': 458880, 'other_income': 257651, 'deductions': 0, 'extra': 2500}, [149874, 134725]), ('boundary control', {'wage': 0, 'periods': 26, 'status': 'single', 'step2': False, 'credits': 400000, 'other_income': 0, 'deductions': 0, 'extra': 5000}, [0, 5000]), ('normal control', {'wage': 232685, 'periods': 52, 'status': 'mfj', 'step2': False, 'credits': 200000, 'other_income': 0, 'deductions': 479252, 'extra': 0}, [18839, 14993]), ('normal control', {'wage': 79014, 'periods': 24, 'status': 'mfj', 'step2': False, 'credits': 400000, 'other_income': 1864011, 'deductions': 0, 'extra': 0}, [4460, 0]), ('normal control', {'wage': 322003, 'periods': 12, 'status': 'single', 'step2': False, 'credits': 0, 'other_income': 0, 'deductions': 0, 'extra': 2500}, [19207, 21707]), ('normal control', {'wage': 93316, 'periods': 12, 'status': 'mfj', 'step2': False, 'credits': 200000, 'other_income': 1111591, 'deductions': 0, 'extra': 1563}, [0, 1563])], [('regression', {'wage': 190399, 'periods': 24, 'status': 'mfj', 'step2': True, 'credits': 200000, 'other_income': 1327070, 'deductions': 0, 'extra': 0}, [20842, 12509]), ('regression', {'wage': 90292, 'periods': 52, 'status': 'hoh', 'step2': True, 'credits': 0, 'other_income': 0, 'deductions': 0, 'extra': 2500}, [7968, 10468]), ('partial-repair probe', {'wage': 72508, 'periods': 12, 'status': 'mfj', 'step2': True, 'credits': 0, 'other_income': 629389, 'deductions': 0, 'extra': 3100}, [1287, 4387]), ('partial-repair probe', {'wage': 1074758, 'periods': 52, 'status': 'mfj', 'step2': True, 'credits': 104962, 'other_income': 0, 'deductions': 0, 'extra': 2500}, [213910, 214391]), ('boundary control', {'wage': 0, 'periods': 26, 'status': 'single', 'step2': False, 'credits': 400000, 'other_income': 0, 'deductions': 0, 'extra': 5000}, [0, 5000]), ('normal control', {'wage': 37313, 'periods': 52, 'status': 'mfj', 'step2': False, 'credits': 117737, 'other_income': 1320234, 'deductions': 0, 'extra': 5664}, [1097, 5664]), ('normal control', {'wage': 179669, 'periods': 52, 'status': 'single', 'step2': False, 'credits': 0, 'other_income': 0, 'deductions': 0, 'extra': 0}, [17076, 17076]), ('normal control', {'wage': 170108, 'periods': 12, 'status': 'single', 'step2': True, 'credits': 200000, 'other_income': 167672, 'deductions': 0, 'extra': 0}, [12373, 0]), ('normal control', {'wage': 244499, 'periods': 26, 'status': 'hoh', 'step2': False, 'credits': 305778, 'other_income': 170107, 'deductions': 0, 'extra': 0}, [18656, 6895])], [('regression', {'wage': 224276, 'periods': 26, 'status': 'mfj', 'step2': True, 'credits': 400000, 'other_income': 1419837, 'deductions': 0, 'extra': 0}, [25489, 10104]), ('regression', {'wage': 142479, 'periods': 52, 'status': 'hoh', 'step2': True, 'credits': 551126, 'other_income': 0, 'deductions': 0, 'extra': 3806}, [14670, 7877]), ('partial-repair probe', {'wage': 93176, 'periods': 52, 'status': 'mfj', 'step2': True, 'credits': 200000, 'other_income': 0, 'deductions': 310339, 'extra': 0}, [6476, 2630]), ('partial-repair probe', {'wage': 737849, 'periods': 24, 'status': 'mfj', 'step2': True, 'credits': 400000, 'other_income': 0, 'deductions': 0, 'extra': 3155}, [113498, 99986]), ('boundary control', {'wage': 0, 'periods': 26, 'status': 'single', 'step2': False, 'credits': 400000, 'other_income': 0, 'deductions': 0, 'extra': 5000}, [0, 5000]), ('normal control', {'wage': 250357, 'periods': 52, 'status': 'single', 'step2': False, 'credits': 0, 'other_income': 0, 'deductions': 0, 'extra': 2500}, [31632, 34132]), ('normal control', {'wage': 251742, 'periods': 52, 'status': 'hoh', 'step2': False, 'credits': 0, 'other_income': 0, 'deductions': 392790, 'extra': 0}, [23568, 23568]), ('normal control', {'wage': 290758, 'periods': 26, 'status': 'single', 'step2': False, 'credits': 0, 'other_income': 1100573, 'deductions': 944056, 'extra': 0}, [26644, 26644]), ('normal control', {'wage': 76761, 'periods': 52, 'status': 'hoh', 'step2': False, 'credits': 400000, 'other_income': 0, 'deductions': 0, 'extra': 2500}, [4003, 2500])]]
for i, (label, args, expected) in enumerate(fixtures[N-1]):
    check("%s %d" % (label, i), solve(args), 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)

prompt:
Married and head-of-household employees who check step 2 are under-withheld.

Input {wage, periods, status single|mfj|hoh, step2, credits, other_income, deductions, extra}; annual amounts in cents except wage and extra (per period). Annual = wage*periods + other_income. Deduction = base standard (single 8,600, mfj 12,900, hoh 8,600 dollars; halved when step2) + itemized deductions (never halved). Thresholds 7,000/30,000/90,000 dollars at 10/12/22% scaled by status unit (single 2, mfj 4, hoh 3)/2, or /4 when step2. Tentative per-period = annual tax/periods half-up; credits/periods half-up is subtracted, floored at 0, then extra is added.

split: open-access


meaning: Fixture-count band, not measured model difficulty

deps: stdlib

prompt:
A bonus that crosses the 1M mark is counted twice, once in each tier, over-withholding heavily.

Input [ytd_supplemental, bonus] in cents. Supplemental wages up to a cumulative 1,000,000.00 are withheld at 22%; the part of cumulative supplemental wages above that is withheld at 37%. Withholding = (low*22 + high*37) rounded half-up to the cent once. Return [low, high, withholding].

split: open-access


prompt:
Crossing bonuses are withheld one cent more than the contract amount.

Input [ytd_supplemental, bonus] in cents. Supplemental wages up to a cumulative 1,000,000.00 are withheld at 22%; the part of cumulative supplemental wages above that is withheld at 37%. Withholding = (low*22 + high*37) rounded half-up to the cent once. Return [low, high, withholding].

split: open-access


prompt:
Bonuses approaching the million-dollar mark move to the 37% tier too early.

Input [ytd_supplemental, bonus] in cents. Supplemental wages up to a cumulative 1,000,000.00 are withheld at 22%; the part of cumulative supplemental wages above that is withheld at 37%. Withholding = (low*22 + high*37) rounded half-up to the cent once. Return [low, high, withholding].

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    disposable = x['gross'] - x['taxes'] - x['voluntary']
    disposable = max(0, disposable)
    pct = 50 if x['supports_other_family'] else 60
    if x['arrears_weeks'] > 12:
        pct += 5
    support_cap = disposable * pct // 100
    support = min(x['support_ordered'], support_cap)
    general_cap = min(disposable * 25 // 100, max(0, disposable - 30 * x['min_wage']))
    creditor_room = max(0, general_cap - support)
    creditor = min(x['creditor_ordered'], creditor_room)
    return [disposable, support, creditor]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'gross': 44578, 'taxes': 13638, 'voluntary': 18352, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 12101, 'min_wage': 1000}, [30940, 0, 940]), ('regression', {'gross': 57348, 'taxes': 14511, 'voluntary': 6333, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 37, 'creditor_ordered': 25506, 'min_wage': 1000}, [42837, 0, 10709]), ('partial-repair probe', {'gross': 49885, 'taxes': 7577, 'voluntary': 0, 'support_ordered': 11010, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 76774, 'min_wage': 725}, [42308, 11010, 0]), ('partial-repair probe', {'gross': 148773, 'taxes': 37141, 'voluntary': 0, 'support_ordered': 142131, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 65400, 'min_wage': 1000}, [111632, 55816, 0]), ('additional oracle', {'gross': 60837, 'taxes': 6384, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 8, 'creditor_ordered': 99104, 'min_wage': 725}, [54453, 0, 13613]), ('additional oracle', {'gross': 46826, 'taxes': 741, 'voluntary': 4492, 'support_ordered': 65174, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 1500}, [46085, 27651, 0]), ('additional oracle', {'gross': 17708, 'taxes': 3346, 'voluntary': 3682, 'support_ordered': 144082, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [14362, 7181, 0])], [('regression', {'gross': 57348, 'taxes': 14511, 'voluntary': 6333, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 37, 'creditor_ordered': 25506, 'min_wage': 1000}, [42837, 0, 10709]), ('regression', {'gross': 46826, 'taxes': 741, 'voluntary': 4492, 'support_ordered': 65174, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 1500}, [46085, 27651, 0]), ('partial-repair probe', {'gross': 148773, 'taxes': 37141, 'voluntary': 0, 'support_ordered': 142131, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 65400, 'min_wage': 1000}, [111632, 55816, 0]), ('partial-repair probe', {'gross': 60837, 'taxes': 6384, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 8, 'creditor_ordered': 99104, 'min_wage': 725}, [54453, 0, 13613]), ('additional oracle', {'gross': 49885, 'taxes': 7577, 'voluntary': 0, 'support_ordered': 11010, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 76774, 'min_wage': 725}, [42308, 11010, 0]), ('additional oracle', {'gross': 17708, 'taxes': 3346, 'voluntary': 3682, 'support_ordered': 144082, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [14362, 7181, 0]), ('additional oracle', {'gross': 34053, 'taxes': 8230, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [25823, 0, 0])], [('regression', {'gross': 46826, 'taxes': 741, 'voluntary': 4492, 'support_ordered': 65174, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 1500}, [46085, 27651, 0]), ('regression', {'gross': 17708, 'taxes': 3346, 'voluntary': 3682, 'support_ordered': 144082, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [14362, 7181, 0]), ('partial-repair probe', {'gross': 60837, 'taxes': 6384, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 8, 'creditor_ordered': 99104, 'min_wage': 725}, [54453, 0, 13613]), ('partial-repair probe', {'gross': 34053, 'taxes': 8230, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [25823, 0, 0]), ('additional oracle', {'gross': 57348, 'taxes': 14511, 'voluntary': 6333, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 37, 'creditor_ordered': 25506, 'min_wage': 1000}, [42837, 0, 10709]), ('additional oracle', {'gross': 148773, 'taxes': 37141, 'voluntary': 0, 'support_ordered': 142131, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 65400, 'min_wage': 1000}, [111632, 55816, 0]), ('additional oracle', {'gross': 92812, 'taxes': 14753, 'voluntary': 4255, 'support_ordered': 102328, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1000}, [78059, 39029, 0])], [('regression', {'gross': 17708, 'taxes': 3346, 'voluntary': 3682, 'support_ordered': 144082, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [14362, 7181, 0]), ('regression', {'gross': 92812, 'taxes': 14753, 'voluntary': 4255, 'support_ordered': 102328, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1000}, [78059, 39029, 0]), ('partial-repair probe', {'gross': 34053, 'taxes': 8230, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [25823, 0, 0]), ('partial-repair probe', {'gross': 49631, 'taxes': 10694, 'voluntary': 12100, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 29, 'creditor_ordered': 0, 'min_wage': 1500}, [38937, 0, 0]), ('additional oracle', {'gross': 148773, 'taxes': 37141, 'voluntary': 0, 'support_ordered': 142131, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 65400, 'min_wage': 1000}, [111632, 55816, 0]), ('additional oracle', {'gross': 60837, 'taxes': 6384, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 8, 'creditor_ordered': 99104, 'min_wage': 725}, [54453, 0, 13613]), ('additional oracle', {'gross': 46826, 'taxes': 741, 'voluntary': 4492, 'support_ordered': 65174, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 1500}, [46085, 27651, 0])], [('regression', {'gross': 92812, 'taxes': 14753, 'voluntary': 4255, 'support_ordered': 102328, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1000}, [78059, 39029, 0]), ('regression', {'gross': 49631, 'taxes': 10694, 'voluntary': 12100, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 29, 'creditor_ordered': 0, 'min_wage': 1500}, [38937, 0, 0]), ('partial-repair probe', {'gross': 152311, 'taxes': 3320, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 0, 'min_wage': 725}, [148991, 0, 0]), ('partial-repair probe', {'gross': 27004, 'taxes': 2084, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 8, 'creditor_ordered': 0, 'min_wage': 725}, [24920, 0, 0]), ('additional oracle', {'gross': 60837, 'taxes': 6384, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 8, 'creditor_ordered': 99104, 'min_wage': 725}, [54453, 0, 13613]), ('additional oracle', {'gross': 46826, 'taxes': 741, 'voluntary': 4492, 'support_ordered': 65174, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 1500}, [46085, 27651, 0]), ('additional oracle', {'gross': 17708, 'taxes': 3346, 'voluntary': 3682, 'support_ordered': 144082, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [14362, 7181, 0])]]
for i, (label, args, expected) in enumerate(fixtures[N-1]):
    check("%s %d" % (label, i), solve(args), 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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    disposable = x['gross'] - x['voluntary']
    disposable = max(0, disposable)
    pct = 50 if x['supports_other_family'] else 60
    if x['arrears_weeks'] > 12:
        pct += 5
    support_cap = disposable * pct // 100
    support = min(x['support_ordered'], support_cap)
    general_cap = min(disposable * 25 // 100, max(0, disposable - 30 * x['min_wage']))
    creditor_room = max(0, general_cap - support)
    creditor = min(x['creditor_ordered'], creditor_room)
    return [disposable, support, creditor]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'gross': 44578, 'taxes': 13638, 'voluntary': 18352, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 12101, 'min_wage': 1000}, [30940, 0, 940]), ('regression', {'gross': 57348, 'taxes': 14511, 'voluntary': 6333, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 37, 'creditor_ordered': 25506, 'min_wage': 1000}, [42837, 0, 10709]), ('partial-repair probe', {'gross': 49885, 'taxes': 7577, 'voluntary': 0, 'support_ordered': 11010, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 76774, 'min_wage': 725}, [42308, 11010, 0]), ('partial-repair probe', {'gross': 148773, 'taxes': 37141, 'voluntary': 0, 'support_ordered': 142131, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 65400, 'min_wage': 1000}, [111632, 55816, 0]), ('additional oracle', {'gross': 60837, 'taxes': 6384, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 8, 'creditor_ordered': 99104, 'min_wage': 725}, [54453, 0, 13613]), ('additional oracle', {'gross': 46826, 'taxes': 741, 'voluntary': 4492, 'support_ordered': 65174, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 1500}, [46085, 27651, 0]), ('additional oracle', {'gross': 17708, 'taxes': 3346, 'voluntary': 3682, 'support_ordered': 144082, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [14362, 7181, 0])], [('regression', {'gross': 57348, 'taxes': 14511, 'voluntary': 6333, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 37, 'creditor_ordered': 25506, 'min_wage': 1000}, [42837, 0, 10709]), ('regression', {'gross': 46826, 'taxes': 741, 'voluntary': 4492, 'support_ordered': 65174, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 1500}, [46085, 27651, 0]), ('partial-repair probe', {'gross': 148773, 'taxes': 37141, 'voluntary': 0, 'support_ordered': 142131, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 65400, 'min_wage': 1000}, [111632, 55816, 0]), ('partial-repair probe', {'gross': 60837, 'taxes': 6384, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 8, 'creditor_ordered': 99104, 'min_wage': 725}, [54453, 0, 13613]), ('additional oracle', {'gross': 49885, 'taxes': 7577, 'voluntary': 0, 'support_ordered': 11010, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 76774, 'min_wage': 725}, [42308, 11010, 0]), ('additional oracle', {'gross': 17708, 'taxes': 3346, 'voluntary': 3682, 'support_ordered': 144082, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [14362, 7181, 0]), ('additional oracle', {'gross': 34053, 'taxes': 8230, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [25823, 0, 0])], [('regression', {'gross': 46826, 'taxes': 741, 'voluntary': 4492, 'support_ordered': 65174, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 1500}, [46085, 27651, 0]), ('regression', {'gross': 17708, 'taxes': 3346, 'voluntary': 3682, 'support_ordered': 144082, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [14362, 7181, 0]), ('partial-repair probe', {'gross': 60837, 'taxes': 6384, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 8, 'creditor_ordered': 99104, 'min_wage': 725}, [54453, 0, 13613]), ('partial-repair probe', {'gross': 34053, 'taxes': 8230, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [25823, 0, 0]), ('additional oracle', {'gross': 57348, 'taxes': 14511, 'voluntary': 6333, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 37, 'creditor_ordered': 25506, 'min_wage': 1000}, [42837, 0, 10709]), ('additional oracle', {'gross': 148773, 'taxes': 37141, 'voluntary': 0, 'support_ordered': 142131, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 65400, 'min_wage': 1000}, [111632, 55816, 0]), ('additional oracle', {'gross': 92812, 'taxes': 14753, 'voluntary': 4255, 'support_ordered': 102328, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1000}, [78059, 39029, 0])], [('regression', {'gross': 17708, 'taxes': 3346, 'voluntary': 3682, 'support_ordered': 144082, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [14362, 7181, 0]), ('regression', {'gross': 92812, 'taxes': 14753, 'voluntary': 4255, 'support_ordered': 102328, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1000}, [78059, 39029, 0]), ('partial-repair probe', {'gross': 34053, 'taxes': 8230, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [25823, 0, 0]), ('partial-repair probe', {'gross': 49631, 'taxes': 10694, 'voluntary': 12100, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 29, 'creditor_ordered': 0, 'min_wage': 1500}, [38937, 0, 0]), ('additional oracle', {'gross': 148773, 'taxes': 37141, 'voluntary': 0, 'support_ordered': 142131, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 65400, 'min_wage': 1000}, [111632, 55816, 0]), ('additional oracle', {'gross': 60837, 'taxes': 6384, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 8, 'creditor_ordered': 99104, 'min_wage': 725}, [54453, 0, 13613]), ('additional oracle', {'gross': 46826, 'taxes': 741, 'voluntary': 4492, 'support_ordered': 65174, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 1500}, [46085, 27651, 0])], [('regression', {'gross': 92812, 'taxes': 14753, 'voluntary': 4255, 'support_ordered': 102328, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1000}, [78059, 39029, 0]), ('regression', {'gross': 49631, 'taxes': 10694, 'voluntary': 12100, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 29, 'creditor_ordered': 0, 'min_wage': 1500}, [38937, 0, 0]), ('partial-repair probe', {'gross': 152311, 'taxes': 3320, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 0, 'min_wage': 725}, [148991, 0, 0]), ('partial-repair probe', {'gross': 27004, 'taxes': 2084, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 8, 'creditor_ordered': 0, 'min_wage': 725}, [24920, 0, 0]), ('additional oracle', {'gross': 60837, 'taxes': 6384, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 8, 'creditor_ordered': 99104, 'min_wage': 725}, [54453, 0, 13613]), ('additional oracle', {'gross': 46826, 'taxes': 741, 'voluntary': 4492, 'support_ordered': 65174, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 1500}, [46085, 27651, 0]), ('additional oracle', {'gross': 17708, 'taxes': 3346, 'voluntary': 3682, 'support_ordered': 144082, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [14362, 7181, 0])]]
for i, (label, args, expected) in enumerate(fixtures[N-1]):
    check("%s %d" % (label, i), solve(args), 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)

prompt:
Employees with voluntary benefit deductions have smaller garnishments than the orders permit.

Input weekly {gross, taxes, voluntary, support_ordered, supports_other_family, arrears_weeks, creditor_ordered, min_wage}. Disposable = max(0, gross - taxes); voluntary deductions are not subtracted. Support cap is 60% of disposable (50% if supporting another family), +5 points when arrears exceed 12 weeks, floored to cents. Creditor cap is min(25% of disposable, disposable - 30*min_wage floored at 0) less support already taken, floored at 0. Return [disposable, support, creditor].

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    disposable = x['gross'] - x['taxes']
    disposable = max(0, disposable)
    pct = 60 if x['supports_other_family'] else 50
    if x['arrears_weeks'] > 12:
        pct += 5
    support_cap = disposable * pct // 100
    support = min(x['support_ordered'], support_cap)
    general_cap = min(disposable * 25 // 100, max(0, disposable - 30 * x['min_wage']))
    creditor_room = max(0, general_cap - support)
    creditor = min(x['creditor_ordered'], creditor_room)
    return [disposable, support, creditor]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'gross': 46826, 'taxes': 741, 'voluntary': 4492, 'support_ordered': 65174, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 1500}, [46085, 27651, 0]), ('regression', {'gross': 148773, 'taxes': 37141, 'voluntary': 0, 'support_ordered': 142131, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 65400, 'min_wage': 1000}, [111632, 55816, 0]), ('partial-repair probe', {'gross': 33225, 'taxes': 530, 'voluntary': 0, 'support_ordered': 97991, 'supports_other_family': False, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [32695, 19617, 0]), ('partial-repair probe', {'gross': 44831, 'taxes': 4578, 'voluntary': 17862, 'support_ordered': 124565, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 725}, [40253, 24151, 0]), ('normal control', {'gross': 44578, 'taxes': 13638, 'voluntary': 18352, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 12101, 'min_wage': 1000}, [30940, 0, 940]), ('normal control', {'gross': 49885, 'taxes': 7577, 'voluntary': 0, 'support_ordered': 11010, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 76774, 'min_wage': 725}, [42308, 11010, 0]), ('normal control', {'gross': 57348, 'taxes': 14511, 'voluntary': 6333, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 37, 'creditor_ordered': 25506, 'min_wage': 1000}, [42837, 0, 10709]), ('normal control', {'gross': 60837, 'taxes': 6384, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 8, 'creditor_ordered': 99104, 'min_wage': 725}, [54453, 0, 13613])], [('regression', {'gross': 33225, 'taxes': 530, 'voluntary': 0, 'support_ordered': 97991, 'supports_other_family': False, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [32695, 19617, 0]), ('regression', {'gross': 46826, 'taxes': 741, 'voluntary': 4492, 'support_ordered': 65174, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 1500}, [46085, 27651, 0]), ('partial-repair probe', {'gross': 44831, 'taxes': 4578, 'voluntary': 17862, 'support_ordered': 124565, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 725}, [40253, 24151, 0]), ('partial-repair probe', {'gross': 97698, 'taxes': 10309, 'voluntary': 18929, 'support_ordered': 119941, 'supports_other_family': False, 'arrears_weeks': 16, 'creditor_ordered': 20227, 'min_wage': 1500}, [87389, 56802, 0]), ('normal control', {'gross': 34053, 'taxes': 8230, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [25823, 0, 0]), ('normal control', {'gross': 49631, 'taxes': 10694, 'voluntary': 12100, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 29, 'creditor_ordered': 0, 'min_wage': 1500}, [38937, 0, 0]), ('normal control', {'gross': 152311, 'taxes': 3320, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 0, 'min_wage': 725}, [148991, 0, 0]), ('normal control', {'gross': 27004, 'taxes': 2084, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 8, 'creditor_ordered': 0, 'min_wage': 725}, [24920, 0, 0])], [('regression', {'gross': 44831, 'taxes': 4578, 'voluntary': 17862, 'support_ordered': 124565, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 725}, [40253, 24151, 0]), ('regression', {'gross': 17708, 'taxes': 3346, 'voluntary': 3682, 'support_ordered': 144082, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [14362, 7181, 0]), ('partial-repair probe', {'gross': 36086, 'taxes': 5477, 'voluntary': 0, 'support_ordered': 110046, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 38371, 'min_wage': 725}, [30609, 18365, 0]), ('partial-repair probe', {'gross': 40096, 'taxes': 4629, 'voluntary': 0, 'support_ordered': 113660, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 0, 'min_wage': 1500}, [35467, 23053, 0]), ('normal control', {'gross': 101914, 'taxes': 33517, 'voluntary': 11339, 'support_ordered': 29483, 'supports_other_family': False, 'arrears_weeks': 8, 'creditor_ordered': 0, 'min_wage': 1000}, [68397, 29483, 0]), ('normal control', {'gross': 108575, 'taxes': 133, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 13, 'creditor_ordered': 98815, 'min_wage': 725}, [108442, 0, 27110]), ('normal control', {'gross': 36727, 'taxes': 8624, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 0, 'min_wage': 725}, [28103, 0, 0]), ('normal control', {'gross': 62104, 'taxes': 11775, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1000}, [50329, 0, 0])], [('regression', {'gross': 97698, 'taxes': 10309, 'voluntary': 18929, 'support_ordered': 119941, 'supports_other_family': False, 'arrears_weeks': 16, 'creditor_ordered': 20227, 'min_wage': 1500}, [87389, 56802, 0]), ('regression', {'gross': 92812, 'taxes': 14753, 'voluntary': 4255, 'support_ordered': 102328, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1000}, [78059, 39029, 0]), ('partial-repair probe', {'gross': 184223, 'taxes': 58096, 'voluntary': 13702, 'support_ordered': 115259, 'supports_other_family': False, 'arrears_weeks': 0, 'creditor_ordered': 38756, 'min_wage': 725}, [126127, 75676, 0]), ('partial-repair probe', {'gross': 28444, 'taxes': 5961, 'voluntary': 0, 'support_ordered': 34693, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 72600, 'min_wage': 1000}, [22483, 14613, 0]), ('normal control', {'gross': 190387, 'taxes': 5582, 'voluntary': 18751, 'support_ordered': 13845, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 1000}, [184805, 13845, 0]), ('normal control', {'gross': 47364, 'taxes': 15560, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 93206, 'min_wage': 725}, [31804, 0, 7951]), ('normal control', {'gross': 50694, 'taxes': 14190, 'voluntary': 8627, 'support_ordered': 11691, 'supports_other_family': True, 'arrears_weeks': 13, 'creditor_ordered': 0, 'min_wage': 725}, [36504, 11691, 0]), ('normal control', {'gross': 154270, 'taxes': 17528, 'voluntary': 0, 'support_ordered': 12515, 'supports_other_family': True, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 725}, [136742, 12515, 0])], [('regression', {'gross': 36086, 'taxes': 5477, 'voluntary': 0, 'support_ordered': 110046, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 38371, 'min_wage': 725}, [30609, 18365, 0]), ('regression', {'gross': 33225, 'taxes': 530, 'voluntary': 0, 'support_ordered': 97991, 'supports_other_family': False, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [32695, 19617, 0]), ('partial-repair probe', {'gross': 34472, 'taxes': 898, 'voluntary': 2236, 'support_ordered': 26388, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 87958, 'min_wage': 725}, [33574, 21823, 0]), ('partial-repair probe', {'gross': 80106, 'taxes': 11143, 'voluntary': 2882, 'support_ordered': 50325, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 0, 'min_wage': 1000}, [68963, 44825, 0]), ('normal control', {'gross': 132732, 'taxes': 30387, 'voluntary': 14017, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [102345, 0, 0]), ('normal control', {'gross': 52318, 'taxes': 13495, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 725}, [38823, 0, 0]), ('normal control', {'gross': 41424, 'taxes': 1052, 'voluntary': 0, 'support_ordered': 3123, 'supports_other_family': True, 'arrears_weeks': 13, 'creditor_ordered': 47455, 'min_wage': 725}, [40372, 3123, 6970]), ('normal control', {'gross': 66488, 'taxes': 5345, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1000}, [61143, 0, 0])]]
for i, (label, args, expected) in enumerate(fixtures[N-1]):
    check("%s %d" % (label, i), solve(args), 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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    disposable = x['gross'] - x['taxes']
    disposable = max(0, disposable)
    pct = 50
    if x['arrears_weeks'] > 12:
        pct += 5
    support_cap = disposable * pct // 100
    support = min(x['support_ordered'], support_cap)
    general_cap = min(disposable * 25 // 100, max(0, disposable - 30 * x['min_wage']))
    creditor_room = max(0, general_cap - support)
    creditor = min(x['creditor_ordered'], creditor_room)
    return [disposable, support, creditor]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'gross': 46826, 'taxes': 741, 'voluntary': 4492, 'support_ordered': 65174, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 1500}, [46085, 27651, 0]), ('regression', {'gross': 148773, 'taxes': 37141, 'voluntary': 0, 'support_ordered': 142131, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 65400, 'min_wage': 1000}, [111632, 55816, 0]), ('partial-repair probe', {'gross': 33225, 'taxes': 530, 'voluntary': 0, 'support_ordered': 97991, 'supports_other_family': False, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [32695, 19617, 0]), ('partial-repair probe', {'gross': 44831, 'taxes': 4578, 'voluntary': 17862, 'support_ordered': 124565, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 725}, [40253, 24151, 0]), ('normal control', {'gross': 44578, 'taxes': 13638, 'voluntary': 18352, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 12101, 'min_wage': 1000}, [30940, 0, 940]), ('normal control', {'gross': 49885, 'taxes': 7577, 'voluntary': 0, 'support_ordered': 11010, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 76774, 'min_wage': 725}, [42308, 11010, 0]), ('normal control', {'gross': 57348, 'taxes': 14511, 'voluntary': 6333, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 37, 'creditor_ordered': 25506, 'min_wage': 1000}, [42837, 0, 10709]), ('normal control', {'gross': 60837, 'taxes': 6384, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 8, 'creditor_ordered': 99104, 'min_wage': 725}, [54453, 0, 13613])], [('regression', {'gross': 33225, 'taxes': 530, 'voluntary': 0, 'support_ordered': 97991, 'supports_other_family': False, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [32695, 19617, 0]), ('regression', {'gross': 46826, 'taxes': 741, 'voluntary': 4492, 'support_ordered': 65174, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 1500}, [46085, 27651, 0]), ('partial-repair probe', {'gross': 44831, 'taxes': 4578, 'voluntary': 17862, 'support_ordered': 124565, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 725}, [40253, 24151, 0]), ('partial-repair probe', {'gross': 97698, 'taxes': 10309, 'voluntary': 18929, 'support_ordered': 119941, 'supports_other_family': False, 'arrears_weeks': 16, 'creditor_ordered': 20227, 'min_wage': 1500}, [87389, 56802, 0]), ('normal control', {'gross': 34053, 'taxes': 8230, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [25823, 0, 0]), ('normal control', {'gross': 49631, 'taxes': 10694, 'voluntary': 12100, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 29, 'creditor_ordered': 0, 'min_wage': 1500}, [38937, 0, 0]), ('normal control', {'gross': 152311, 'taxes': 3320, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 0, 'min_wage': 725}, [148991, 0, 0]), ('normal control', {'gross': 27004, 'taxes': 2084, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 8, 'creditor_ordered': 0, 'min_wage': 725}, [24920, 0, 0])], [('regression', {'gross': 44831, 'taxes': 4578, 'voluntary': 17862, 'support_ordered': 124565, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 725}, [40253, 24151, 0]), ('regression', {'gross': 17708, 'taxes': 3346, 'voluntary': 3682, 'support_ordered': 144082, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [14362, 7181, 0]), ('partial-repair probe', {'gross': 36086, 'taxes': 5477, 'voluntary': 0, 'support_ordered': 110046, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 38371, 'min_wage': 725}, [30609, 18365, 0]), ('partial-repair probe', {'gross': 40096, 'taxes': 4629, 'voluntary': 0, 'support_ordered': 113660, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 0, 'min_wage': 1500}, [35467, 23053, 0]), ('normal control', {'gross': 101914, 'taxes': 33517, 'voluntary': 11339, 'support_ordered': 29483, 'supports_other_family': False, 'arrears_weeks': 8, 'creditor_ordered': 0, 'min_wage': 1000}, [68397, 29483, 0]), ('normal control', {'gross': 108575, 'taxes': 133, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 13, 'creditor_ordered': 98815, 'min_wage': 725}, [108442, 0, 27110]), ('normal control', {'gross': 36727, 'taxes': 8624, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 0, 'min_wage': 725}, [28103, 0, 0]), ('normal control', {'gross': 62104, 'taxes': 11775, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1000}, [50329, 0, 0])], [('regression', {'gross': 97698, 'taxes': 10309, 'voluntary': 18929, 'support_ordered': 119941, 'supports_other_family': False, 'arrears_weeks': 16, 'creditor_ordered': 20227, 'min_wage': 1500}, [87389, 56802, 0]), ('regression', {'gross': 92812, 'taxes': 14753, 'voluntary': 4255, 'support_ordered': 102328, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1000}, [78059, 39029, 0]), ('partial-repair probe', {'gross': 184223, 'taxes': 58096, 'voluntary': 13702, 'support_ordered': 115259, 'supports_other_family': False, 'arrears_weeks': 0, 'creditor_ordered': 38756, 'min_wage': 725}, [126127, 75676, 0]), ('partial-repair probe', {'gross': 28444, 'taxes': 5961, 'voluntary': 0, 'support_ordered': 34693, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 72600, 'min_wage': 1000}, [22483, 14613, 0]), ('normal control', {'gross': 190387, 'taxes': 5582, 'voluntary': 18751, 'support_ordered': 13845, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 1000}, [184805, 13845, 0]), ('normal control', {'gross': 47364, 'taxes': 15560, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 93206, 'min_wage': 725}, [31804, 0, 7951]), ('normal control', {'gross': 50694, 'taxes': 14190, 'voluntary': 8627, 'support_ordered': 11691, 'supports_other_family': True, 'arrears_weeks': 13, 'creditor_ordered': 0, 'min_wage': 725}, [36504, 11691, 0]), ('normal control', {'gross': 154270, 'taxes': 17528, 'voluntary': 0, 'support_ordered': 12515, 'supports_other_family': True, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 725}, [136742, 12515, 0])], [('regression', {'gross': 36086, 'taxes': 5477, 'voluntary': 0, 'support_ordered': 110046, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 38371, 'min_wage': 725}, [30609, 18365, 0]), ('regression', {'gross': 33225, 'taxes': 530, 'voluntary': 0, 'support_ordered': 97991, 'supports_other_family': False, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [32695, 19617, 0]), ('partial-repair probe', {'gross': 34472, 'taxes': 898, 'voluntary': 2236, 'support_ordered': 26388, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 87958, 'min_wage': 725}, [33574, 21823, 0]), ('partial-repair probe', {'gross': 80106, 'taxes': 11143, 'voluntary': 2882, 'support_ordered': 50325, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 0, 'min_wage': 1000}, [68963, 44825, 0]), ('normal control', {'gross': 132732, 'taxes': 30387, 'voluntary': 14017, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [102345, 0, 0]), ('normal control', {'gross': 52318, 'taxes': 13495, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 725}, [38823, 0, 0]), ('normal control', {'gross': 41424, 'taxes': 1052, 'voluntary': 0, 'support_ordered': 3123, 'supports_other_family': True, 'arrears_weeks': 13, 'creditor_ordered': 47455, 'min_wage': 725}, [40372, 3123, 6970]), ('normal control', {'gross': 66488, 'taxes': 5345, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1000}, [61143, 0, 0])]]
for i, (label, args, expected) in enumerate(fixtures[N-1]):
    check("%s %d" % (label, i), solve(args), 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)

prompt:
Obligors supporting a second family have more withheld for support than the lower limit allows.

Input weekly {gross, taxes, voluntary, support_ordered, supports_other_family, arrears_weeks, creditor_ordered, min_wage}. Disposable = max(0, gross - taxes); voluntary deductions are not subtracted. Support cap is 60% of disposable (50% if supporting another family), +5 points when arrears exceed 12 weeks, floored to cents. Creditor cap is min(25% of disposable, disposable - 30*min_wage floored at 0) less support already taken, floored at 0. Return [disposable, support, creditor].

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    disposable = x['gross'] - x['taxes']
    disposable = max(0, disposable)
    pct = 50 if x['supports_other_family'] else 60
    if x['arrears_weeks'] >= 12:
        pct += 5
    support_cap = disposable * pct // 100
    support = min(x['support_ordered'], support_cap)
    general_cap = min(disposable * 25 // 100, max(0, disposable - 30 * x['min_wage']))
    creditor_room = max(0, general_cap - support)
    creditor = min(x['creditor_ordered'], creditor_room)
    return [disposable, support, creditor]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'gross': 46826, 'taxes': 741, 'voluntary': 4492, 'support_ordered': 65174, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 1500}, [46085, 27651, 0]), ('regression', {'gross': 44831, 'taxes': 4578, 'voluntary': 17862, 'support_ordered': 124565, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 725}, [40253, 24151, 0]), ('partial-repair probe', {'gross': 97698, 'taxes': 10309, 'voluntary': 18929, 'support_ordered': 119941, 'supports_other_family': False, 'arrears_weeks': 16, 'creditor_ordered': 20227, 'min_wage': 1500}, [87389, 56802, 0]), ('partial-repair probe', {'gross': 43381, 'taxes': 4618, 'voluntary': 0, 'support_ordered': 101047, 'supports_other_family': True, 'arrears_weeks': 27, 'creditor_ordered': 46979, 'min_wage': 1000}, [38763, 21319, 0]), ('normal control', {'gross': 44578, 'taxes': 13638, 'voluntary': 18352, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 12101, 'min_wage': 1000}, [30940, 0, 940]), ('normal control', {'gross': 49885, 'taxes': 7577, 'voluntary': 0, 'support_ordered': 11010, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 76774, 'min_wage': 725}, [42308, 11010, 0]), ('normal control', {'gross': 57348, 'taxes': 14511, 'voluntary': 6333, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 37, 'creditor_ordered': 25506, 'min_wage': 1000}, [42837, 0, 10709]), ('normal control', {'gross': 148773, 'taxes': 37141, 'voluntary': 0, 'support_ordered': 142131, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 65400, 'min_wage': 1000}, [111632, 55816, 0])], [('regression', {'gross': 44831, 'taxes': 4578, 'voluntary': 17862, 'support_ordered': 124565, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 725}, [40253, 24151, 0]), ('regression', {'gross': 41743, 'taxes': 1120, 'voluntary': 0, 'support_ordered': 64278, 'supports_other_family': True, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 725}, [40623, 20311, 0]), ('partial-repair probe', {'gross': 54642, 'taxes': 12825, 'voluntary': 0, 'support_ordered': 119615, 'supports_other_family': True, 'arrears_weeks': 13, 'creditor_ordered': 48348, 'min_wage': 1500}, [41817, 22999, 0]), ('partial-repair probe', {'gross': 40096, 'taxes': 4629, 'voluntary': 0, 'support_ordered': 113660, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 0, 'min_wage': 1500}, [35467, 23053, 0]), ('normal control', {'gross': 60837, 'taxes': 6384, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 8, 'creditor_ordered': 99104, 'min_wage': 725}, [54453, 0, 13613]), ('normal control', {'gross': 17708, 'taxes': 3346, 'voluntary': 3682, 'support_ordered': 144082, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [14362, 7181, 0]), ('normal control', {'gross': 34053, 'taxes': 8230, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [25823, 0, 0]), ('normal control', {'gross': 92812, 'taxes': 14753, 'voluntary': 4255, 'support_ordered': 102328, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1000}, [78059, 39029, 0])], [('regression', {'gross': 41743, 'taxes': 1120, 'voluntary': 0, 'support_ordered': 64278, 'supports_other_family': True, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 725}, [40623, 20311, 0]), ('regression', {'gross': 140899, 'taxes': 22866, 'voluntary': 10207, 'support_ordered': 106762, 'supports_other_family': True, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 725}, [118033, 59016, 0]), ('partial-repair probe', {'gross': 82481, 'taxes': 4673, 'voluntary': 0, 'support_ordered': 137874, 'supports_other_family': True, 'arrears_weeks': 13, 'creditor_ordered': 0, 'min_wage': 1500}, [77808, 42794, 0]), ('partial-repair probe', {'gross': 28444, 'taxes': 5961, 'voluntary': 0, 'support_ordered': 34693, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 72600, 'min_wage': 1000}, [22483, 14613, 0]), ('normal control', {'gross': 49631, 'taxes': 10694, 'voluntary': 12100, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 29, 'creditor_ordered': 0, 'min_wage': 1500}, [38937, 0, 0]), ('normal control', {'gross': 152311, 'taxes': 3320, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 0, 'min_wage': 725}, [148991, 0, 0]), ('normal control', {'gross': 27004, 'taxes': 2084, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 8, 'creditor_ordered': 0, 'min_wage': 725}, [24920, 0, 0]), ('normal control', {'gross': 101914, 'taxes': 33517, 'voluntary': 11339, 'support_ordered': 29483, 'supports_other_family': False, 'arrears_weeks': 8, 'creditor_ordered': 0, 'min_wage': 1000}, [68397, 29483, 0])], [('regression', {'gross': 140899, 'taxes': 22866, 'voluntary': 10207, 'support_ordered': 106762, 'supports_other_family': True, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 725}, [118033, 59016, 0]), ('regression', {'gross': 36086, 'taxes': 5477, 'voluntary': 0, 'support_ordered': 110046, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 38371, 'min_wage': 725}, [30609, 18365, 0]), ('partial-repair probe', {'gross': 34472, 'taxes': 898, 'voluntary': 2236, 'support_ordered': 26388, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 87958, 'min_wage': 725}, [33574, 21823, 0]), ('partial-repair probe', {'gross': 80106, 'taxes': 11143, 'voluntary': 2882, 'support_ordered': 50325, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 0, 'min_wage': 1000}, [68963, 44825, 0]), ('normal control', {'gross': 108575, 'taxes': 133, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 13, 'creditor_ordered': 98815, 'min_wage': 725}, [108442, 0, 27110]), ('normal control', {'gross': 36727, 'taxes': 8624, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 0, 'min_wage': 725}, [28103, 0, 0]), ('normal control', {'gross': 33225, 'taxes': 530, 'voluntary': 0, 'support_ordered': 97991, 'supports_other_family': False, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [32695, 19617, 0]), ('normal control', {'gross': 62104, 'taxes': 11775, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1000}, [50329, 0, 0])], [('regression', {'gross': 36086, 'taxes': 5477, 'voluntary': 0, 'support_ordered': 110046, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 38371, 'min_wage': 725}, [30609, 18365, 0]), ('regression', {'gross': 29102, 'taxes': 7953, 'voluntary': 0, 'support_ordered': 14538, 'supports_other_family': True, 'arrears_weeks': 12, 'creditor_ordered': 57140, 'min_wage': 725}, [21149, 10574, 0]), ('partial-repair probe', {'gross': 37357, 'taxes': 545, 'voluntary': 0, 'support_ordered': 115896, 'supports_other_family': True, 'arrears_weeks': 13, 'creditor_ordered': 0, 'min_wage': 725}, [36812, 20246, 0]), ('partial-repair probe', {'gross': 50473, 'taxes': 5070, 'voluntary': 2790, 'support_ordered': 43874, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 0, 'min_wage': 725}, [45403, 29511, 0]), ('normal control', {'gross': 190387, 'taxes': 5582, 'voluntary': 18751, 'support_ordered': 13845, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 1000}, [184805, 13845, 0]), ('normal control', {'gross': 47364, 'taxes': 15560, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 93206, 'min_wage': 725}, [31804, 0, 7951]), ('normal control', {'gross': 50694, 'taxes': 14190, 'voluntary': 8627, 'support_ordered': 11691, 'supports_other_family': True, 'arrears_weeks': 13, 'creditor_ordered': 0, 'min_wage': 725}, [36504, 11691, 0]), ('normal control', {'gross': 154270, 'taxes': 17528, 'voluntary': 0, 'support_ordered': 12515, 'supports_other_family': True, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 725}, [136742, 12515, 0])]]
for i, (label, args, expected) in enumerate(fixtures[N-1]):
    check("%s %d" % (label, i), solve(args), 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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    disposable = x['gross'] - x['taxes']
    disposable = max(0, disposable)
    pct = 50 if x['supports_other_family'] else 60
    if x['arrears_weeks'] > 12 * 7:
        pct += 5
    support_cap = disposable * pct // 100
    support = min(x['support_ordered'], support_cap)
    general_cap = min(disposable * 25 // 100, max(0, disposable - 30 * x['min_wage']))
    creditor_room = max(0, general_cap - support)
    creditor = min(x['creditor_ordered'], creditor_room)
    return [disposable, support, creditor]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'gross': 46826, 'taxes': 741, 'voluntary': 4492, 'support_ordered': 65174, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 1500}, [46085, 27651, 0]), ('regression', {'gross': 44831, 'taxes': 4578, 'voluntary': 17862, 'support_ordered': 124565, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 725}, [40253, 24151, 0]), ('partial-repair probe', {'gross': 97698, 'taxes': 10309, 'voluntary': 18929, 'support_ordered': 119941, 'supports_other_family': False, 'arrears_weeks': 16, 'creditor_ordered': 20227, 'min_wage': 1500}, [87389, 56802, 0]), ('partial-repair probe', {'gross': 43381, 'taxes': 4618, 'voluntary': 0, 'support_ordered': 101047, 'supports_other_family': True, 'arrears_weeks': 27, 'creditor_ordered': 46979, 'min_wage': 1000}, [38763, 21319, 0]), ('normal control', {'gross': 44578, 'taxes': 13638, 'voluntary': 18352, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 12101, 'min_wage': 1000}, [30940, 0, 940]), ('normal control', {'gross': 49885, 'taxes': 7577, 'voluntary': 0, 'support_ordered': 11010, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 76774, 'min_wage': 725}, [42308, 11010, 0]), ('normal control', {'gross': 57348, 'taxes': 14511, 'voluntary': 6333, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 37, 'creditor_ordered': 25506, 'min_wage': 1000}, [42837, 0, 10709]), ('normal control', {'gross': 148773, 'taxes': 37141, 'voluntary': 0, 'support_ordered': 142131, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 65400, 'min_wage': 1000}, [111632, 55816, 0])], [('regression', {'gross': 44831, 'taxes': 4578, 'voluntary': 17862, 'support_ordered': 124565, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 725}, [40253, 24151, 0]), ('regression', {'gross': 41743, 'taxes': 1120, 'voluntary': 0, 'support_ordered': 64278, 'supports_other_family': True, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 725}, [40623, 20311, 0]), ('partial-repair probe', {'gross': 54642, 'taxes': 12825, 'voluntary': 0, 'support_ordered': 119615, 'supports_other_family': True, 'arrears_weeks': 13, 'creditor_ordered': 48348, 'min_wage': 1500}, [41817, 22999, 0]), ('partial-repair probe', {'gross': 40096, 'taxes': 4629, 'voluntary': 0, 'support_ordered': 113660, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 0, 'min_wage': 1500}, [35467, 23053, 0]), ('normal control', {'gross': 60837, 'taxes': 6384, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 8, 'creditor_ordered': 99104, 'min_wage': 725}, [54453, 0, 13613]), ('normal control', {'gross': 17708, 'taxes': 3346, 'voluntary': 3682, 'support_ordered': 144082, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [14362, 7181, 0]), ('normal control', {'gross': 34053, 'taxes': 8230, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [25823, 0, 0]), ('normal control', {'gross': 92812, 'taxes': 14753, 'voluntary': 4255, 'support_ordered': 102328, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1000}, [78059, 39029, 0])], [('regression', {'gross': 41743, 'taxes': 1120, 'voluntary': 0, 'support_ordered': 64278, 'supports_other_family': True, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 725}, [40623, 20311, 0]), ('regression', {'gross': 140899, 'taxes': 22866, 'voluntary': 10207, 'support_ordered': 106762, 'supports_other_family': True, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 725}, [118033, 59016, 0]), ('partial-repair probe', {'gross': 82481, 'taxes': 4673, 'voluntary': 0, 'support_ordered': 137874, 'supports_other_family': True, 'arrears_weeks': 13, 'creditor_ordered': 0, 'min_wage': 1500}, [77808, 42794, 0]), ('partial-repair probe', {'gross': 28444, 'taxes': 5961, 'voluntary': 0, 'support_ordered': 34693, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 72600, 'min_wage': 1000}, [22483, 14613, 0]), ('normal control', {'gross': 49631, 'taxes': 10694, 'voluntary': 12100, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 29, 'creditor_ordered': 0, 'min_wage': 1500}, [38937, 0, 0]), ('normal control', {'gross': 152311, 'taxes': 3320, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 0, 'min_wage': 725}, [148991, 0, 0]), ('normal control', {'gross': 27004, 'taxes': 2084, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 8, 'creditor_ordered': 0, 'min_wage': 725}, [24920, 0, 0]), ('normal control', {'gross': 101914, 'taxes': 33517, 'voluntary': 11339, 'support_ordered': 29483, 'supports_other_family': False, 'arrears_weeks': 8, 'creditor_ordered': 0, 'min_wage': 1000}, [68397, 29483, 0])], [('regression', {'gross': 140899, 'taxes': 22866, 'voluntary': 10207, 'support_ordered': 106762, 'supports_other_family': True, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 725}, [118033, 59016, 0]), ('regression', {'gross': 36086, 'taxes': 5477, 'voluntary': 0, 'support_ordered': 110046, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 38371, 'min_wage': 725}, [30609, 18365, 0]), ('partial-repair probe', {'gross': 34472, 'taxes': 898, 'voluntary': 2236, 'support_ordered': 26388, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 87958, 'min_wage': 725}, [33574, 21823, 0]), ('partial-repair probe', {'gross': 80106, 'taxes': 11143, 'voluntary': 2882, 'support_ordered': 50325, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 0, 'min_wage': 1000}, [68963, 44825, 0]), ('normal control', {'gross': 108575, 'taxes': 133, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 13, 'creditor_ordered': 98815, 'min_wage': 725}, [108442, 0, 27110]), ('normal control', {'gross': 36727, 'taxes': 8624, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 0, 'min_wage': 725}, [28103, 0, 0]), ('normal control', {'gross': 33225, 'taxes': 530, 'voluntary': 0, 'support_ordered': 97991, 'supports_other_family': False, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [32695, 19617, 0]), ('normal control', {'gross': 62104, 'taxes': 11775, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1000}, [50329, 0, 0])], [('regression', {'gross': 36086, 'taxes': 5477, 'voluntary': 0, 'support_ordered': 110046, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 38371, 'min_wage': 725}, [30609, 18365, 0]), ('regression', {'gross': 29102, 'taxes': 7953, 'voluntary': 0, 'support_ordered': 14538, 'supports_other_family': True, 'arrears_weeks': 12, 'creditor_ordered': 57140, 'min_wage': 725}, [21149, 10574, 0]), ('partial-repair probe', {'gross': 37357, 'taxes': 545, 'voluntary': 0, 'support_ordered': 115896, 'supports_other_family': True, 'arrears_weeks': 13, 'creditor_ordered': 0, 'min_wage': 725}, [36812, 20246, 0]), ('partial-repair probe', {'gross': 50473, 'taxes': 5070, 'voluntary': 2790, 'support_ordered': 43874, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 0, 'min_wage': 725}, [45403, 29511, 0]), ('normal control', {'gross': 190387, 'taxes': 5582, 'voluntary': 18751, 'support_ordered': 13845, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 1000}, [184805, 13845, 0]), ('normal control', {'gross': 47364, 'taxes': 15560, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 93206, 'min_wage': 725}, [31804, 0, 7951]), ('normal control', {'gross': 50694, 'taxes': 14190, 'voluntary': 8627, 'support_ordered': 11691, 'supports_other_family': True, 'arrears_weeks': 13, 'creditor_ordered': 0, 'min_wage': 725}, [36504, 11691, 0]), ('normal control', {'gross': 154270, 'taxes': 17528, 'voluntary': 0, 'support_ordered': 12515, 'supports_other_family': True, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 725}, [136742, 12515, 0])]]
for i, (label, args, expected) in enumerate(fixtures[N-1]):
    check("%s %d" % (label, i), solve(args), 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)

prompt:
An obligor exactly 12 weeks in arrears receives the 5-point increase early.

Input weekly {gross, taxes, voluntary, support_ordered, supports_other_family, arrears_weeks, creditor_ordered, min_wage}. Disposable = max(0, gross - taxes); voluntary deductions are not subtracted. Support cap is 60% of disposable (50% if supporting another family), +5 points when arrears exceed 12 weeks, floored to cents. Creditor cap is min(25% of disposable, disposable - 30*min_wage floored at 0) less support already taken, floored at 0. Return [disposable, support, creditor].

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    disposable = x['gross'] - x['taxes']
    disposable = max(0, disposable)
    pct = 50 if x['supports_other_family'] else 60
    if x['arrears_weeks'] > 12:
        pct += 5
    support_cap = disposable * pct // 100
    support = min(x['support_ordered'], support_cap)
    general_cap = min(disposable * 25 // 100, max(0, x['gross'] - 30 * x['min_wage']))
    creditor_room = max(0, general_cap - support)
    creditor = min(x['creditor_ordered'], creditor_room)
    return [disposable, support, creditor]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'gross': 44578, 'taxes': 13638, 'voluntary': 18352, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 12101, 'min_wage': 1000}, [30940, 0, 940]), ('regression', {'gross': 34057, 'taxes': 7153, 'voluntary': 2558, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 16, 'creditor_ordered': 53546, 'min_wage': 1000}, [26904, 0, 0]), ('partial-repair probe', {'gross': 57348, 'taxes': 14511, 'voluntary': 6333, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 37, 'creditor_ordered': 25506, 'min_wage': 1000}, [42837, 0, 10709]), ('partial-repair probe', {'gross': 47364, 'taxes': 15560, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 93206, 'min_wage': 725}, [31804, 0, 7951]), ('normal control', {'gross': 49885, 'taxes': 7577, 'voluntary': 0, 'support_ordered': 11010, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 76774, 'min_wage': 725}, [42308, 11010, 0]), ('normal control', {'gross': 148773, 'taxes': 37141, 'voluntary': 0, 'support_ordered': 142131, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 65400, 'min_wage': 1000}, [111632, 55816, 0]), ('normal control', {'gross': 60837, 'taxes': 6384, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 8, 'creditor_ordered': 99104, 'min_wage': 725}, [54453, 0, 13613]), ('normal control', {'gross': 46826, 'taxes': 741, 'voluntary': 4492, 'support_ordered': 65174, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 1500}, [46085, 27651, 0])], [('regression', {'gross': 52222, 'taxes': 6001, 'voluntary': 11124, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 13, 'creditor_ordered': 24737, 'min_wage': 1500}, [46221, 0, 1221]), ('regression', {'gross': 34057, 'taxes': 7153, 'voluntary': 2558, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 16, 'creditor_ordered': 53546, 'min_wage': 1000}, [26904, 0, 0]), ('partial-repair probe', {'gross': 47364, 'taxes': 15560, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 93206, 'min_wage': 725}, [31804, 0, 7951]), ('partial-repair probe', {'gross': 39815, 'taxes': 5597, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 13, 'creditor_ordered': 89833, 'min_wage': 725}, [34218, 0, 8554]), ('normal control', {'gross': 17708, 'taxes': 3346, 'voluntary': 3682, 'support_ordered': 144082, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [14362, 7181, 0]), ('normal control', {'gross': 34053, 'taxes': 8230, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [25823, 0, 0]), ('normal control', {'gross': 92812, 'taxes': 14753, 'voluntary': 4255, 'support_ordered': 102328, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1000}, [78059, 39029, 0]), ('normal control', {'gross': 49631, 'taxes': 10694, 'voluntary': 12100, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 29, 'creditor_ordered': 0, 'min_wage': 1500}, [38937, 0, 0])], [('regression', {'gross': 54564, 'taxes': 16255, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 2, 'creditor_ordered': 95266, 'min_wage': 1000}, [38309, 0, 8309]), ('regression', {'gross': 52222, 'taxes': 6001, 'voluntary': 11124, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 13, 'creditor_ordered': 24737, 'min_wage': 1500}, [46221, 0, 1221]), ('partial-repair probe', {'gross': 55563, 'taxes': 12940, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 31836, 'min_wage': 1000}, [42623, 0, 10655]), ('partial-repair probe', {'gross': 43333, 'taxes': 8379, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 26, 'creditor_ordered': 75679, 'min_wage': 725}, [34954, 0, 8738]), ('normal control', {'gross': 152311, 'taxes': 3320, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 0, 'min_wage': 725}, [148991, 0, 0]), ('normal control', {'gross': 27004, 'taxes': 2084, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 8, 'creditor_ordered': 0, 'min_wage': 725}, [24920, 0, 0]), ('normal control', {'gross': 101914, 'taxes': 33517, 'voluntary': 11339, 'support_ordered': 29483, 'supports_other_family': False, 'arrears_weeks': 8, 'creditor_ordered': 0, 'min_wage': 1000}, [68397, 29483, 0]), ('normal control', {'gross': 108575, 'taxes': 133, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 13, 'creditor_ordered': 98815, 'min_wage': 725}, [108442, 0, 27110])], [('regression', {'gross': 78229, 'taxes': 19071, 'voluntary': 18453, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 0, 'creditor_ordered': 77925, 'min_wage': 1500}, [59158, 0, 14158]), ('regression', {'gross': 54564, 'taxes': 16255, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 2, 'creditor_ordered': 95266, 'min_wage': 1000}, [38309, 0, 8309]), ('partial-repair probe', {'gross': 43333, 'taxes': 8379, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 26, 'creditor_ordered': 75679, 'min_wage': 725}, [34954, 0, 8738]), ('partial-repair probe', {'gross': 31147, 'taxes': 519, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 13, 'creditor_ordered': 74886, 'min_wage': 1000}, [30628, 0, 628]), ('normal control', {'gross': 36727, 'taxes': 8624, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 0, 'min_wage': 725}, [28103, 0, 0]), ('normal control', {'gross': 33225, 'taxes': 530, 'voluntary': 0, 'support_ordered': 97991, 'supports_other_family': False, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [32695, 19617, 0]), ('normal control', {'gross': 44831, 'taxes': 4578, 'voluntary': 17862, 'support_ordered': 124565, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 725}, [40253, 24151, 0]), ('normal control', {'gross': 62104, 'taxes': 11775, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1000}, [50329, 0, 0])], [('regression', {'gross': 31147, 'taxes': 519, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 13, 'creditor_ordered': 74886, 'min_wage': 1000}, [30628, 0, 628]), ('regression', {'gross': 78229, 'taxes': 19071, 'voluntary': 18453, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 0, 'creditor_ordered': 77925, 'min_wage': 1500}, [59158, 0, 14158]), ('partial-repair probe', {'gross': 34618, 'taxes': 2923, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 0, 'creditor_ordered': 79265, 'min_wage': 725}, [31695, 0, 7923]), ('partial-repair probe', {'gross': 29406, 'taxes': 4534, 'voluntary': 12701, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 13, 'creditor_ordered': 32946, 'min_wage': 725}, [24872, 0, 3122]), ('normal control', {'gross': 41743, 'taxes': 1120, 'voluntary': 0, 'support_ordered': 64278, 'supports_other_family': True, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 725}, [40623, 20311, 0]), ('normal control', {'gross': 140899, 'taxes': 22866, 'voluntary': 10207, 'support_ordered': 106762, 'supports_other_family': True, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 725}, [118033, 59016, 0]), ('normal control', {'gross': 190387, 'taxes': 5582, 'voluntary': 18751, 'support_ordered': 13845, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 1000}, [184805, 13845, 0]), ('normal control', {'gross': 50694, 'taxes': 14190, 'voluntary': 8627, 'support_ordered': 11691, 'supports_other_family': True, 'arrears_weeks': 13, 'creditor_ordered': 0, 'min_wage': 725}, [36504, 11691, 0])]]
for i, (label, args, expected) in enumerate(fixtures[N-1]):
    check("%s %d" % (label, i), solve(args), 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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    disposable = x['gross'] - x['taxes']
    disposable = max(0, disposable)
    pct = 50 if x['supports_other_family'] else 60
    if x['arrears_weeks'] > 12:
        pct += 5
    support_cap = disposable * pct // 100
    support = min(x['support_ordered'], support_cap)
    general_cap = min(disposable * 25 // 100, max(0, disposable - 30 * x['min_wage'] - x['taxes']))
    creditor_room = max(0, general_cap - support)
    creditor = min(x['creditor_ordered'], creditor_room)
    return [disposable, support, creditor]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'gross': 44578, 'taxes': 13638, 'voluntary': 18352, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 12101, 'min_wage': 1000}, [30940, 0, 940]), ('regression', {'gross': 34057, 'taxes': 7153, 'voluntary': 2558, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 16, 'creditor_ordered': 53546, 'min_wage': 1000}, [26904, 0, 0]), ('partial-repair probe', {'gross': 57348, 'taxes': 14511, 'voluntary': 6333, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 37, 'creditor_ordered': 25506, 'min_wage': 1000}, [42837, 0, 10709]), ('partial-repair probe', {'gross': 47364, 'taxes': 15560, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 93206, 'min_wage': 725}, [31804, 0, 7951]), ('normal control', {'gross': 49885, 'taxes': 7577, 'voluntary': 0, 'support_ordered': 11010, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 76774, 'min_wage': 725}, [42308, 11010, 0]), ('normal control', {'gross': 148773, 'taxes': 37141, 'voluntary': 0, 'support_ordered': 142131, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 65400, 'min_wage': 1000}, [111632, 55816, 0]), ('normal control', {'gross': 60837, 'taxes': 6384, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 8, 'creditor_ordered': 99104, 'min_wage': 725}, [54453, 0, 13613]), ('normal control', {'gross': 46826, 'taxes': 741, 'voluntary': 4492, 'support_ordered': 65174, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 1500}, [46085, 27651, 0])], [('regression', {'gross': 52222, 'taxes': 6001, 'voluntary': 11124, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 13, 'creditor_ordered': 24737, 'min_wage': 1500}, [46221, 0, 1221]), ('regression', {'gross': 34057, 'taxes': 7153, 'voluntary': 2558, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 16, 'creditor_ordered': 53546, 'min_wage': 1000}, [26904, 0, 0]), ('partial-repair probe', {'gross': 47364, 'taxes': 15560, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 93206, 'min_wage': 725}, [31804, 0, 7951]), ('partial-repair probe', {'gross': 39815, 'taxes': 5597, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 13, 'creditor_ordered': 89833, 'min_wage': 725}, [34218, 0, 8554]), ('normal control', {'gross': 17708, 'taxes': 3346, 'voluntary': 3682, 'support_ordered': 144082, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [14362, 7181, 0]), ('normal control', {'gross': 34053, 'taxes': 8230, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [25823, 0, 0]), ('normal control', {'gross': 92812, 'taxes': 14753, 'voluntary': 4255, 'support_ordered': 102328, 'supports_other_family': True, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1000}, [78059, 39029, 0]), ('normal control', {'gross': 49631, 'taxes': 10694, 'voluntary': 12100, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 29, 'creditor_ordered': 0, 'min_wage': 1500}, [38937, 0, 0])], [('regression', {'gross': 54564, 'taxes': 16255, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 2, 'creditor_ordered': 95266, 'min_wage': 1000}, [38309, 0, 8309]), ('regression', {'gross': 52222, 'taxes': 6001, 'voluntary': 11124, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 13, 'creditor_ordered': 24737, 'min_wage': 1500}, [46221, 0, 1221]), ('partial-repair probe', {'gross': 55563, 'taxes': 12940, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 31836, 'min_wage': 1000}, [42623, 0, 10655]), ('partial-repair probe', {'gross': 43333, 'taxes': 8379, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 26, 'creditor_ordered': 75679, 'min_wage': 725}, [34954, 0, 8738]), ('normal control', {'gross': 152311, 'taxes': 3320, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 0, 'min_wage': 725}, [148991, 0, 0]), ('normal control', {'gross': 27004, 'taxes': 2084, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 8, 'creditor_ordered': 0, 'min_wage': 725}, [24920, 0, 0]), ('normal control', {'gross': 101914, 'taxes': 33517, 'voluntary': 11339, 'support_ordered': 29483, 'supports_other_family': False, 'arrears_weeks': 8, 'creditor_ordered': 0, 'min_wage': 1000}, [68397, 29483, 0]), ('normal control', {'gross': 108575, 'taxes': 133, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 13, 'creditor_ordered': 98815, 'min_wage': 725}, [108442, 0, 27110])], [('regression', {'gross': 78229, 'taxes': 19071, 'voluntary': 18453, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 0, 'creditor_ordered': 77925, 'min_wage': 1500}, [59158, 0, 14158]), ('regression', {'gross': 54564, 'taxes': 16255, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 2, 'creditor_ordered': 95266, 'min_wage': 1000}, [38309, 0, 8309]), ('partial-repair probe', {'gross': 43333, 'taxes': 8379, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 26, 'creditor_ordered': 75679, 'min_wage': 725}, [34954, 0, 8738]), ('partial-repair probe', {'gross': 31147, 'taxes': 519, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 13, 'creditor_ordered': 74886, 'min_wage': 1000}, [30628, 0, 628]), ('normal control', {'gross': 36727, 'taxes': 8624, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 13, 'creditor_ordered': 0, 'min_wage': 725}, [28103, 0, 0]), ('normal control', {'gross': 33225, 'taxes': 530, 'voluntary': 0, 'support_ordered': 97991, 'supports_other_family': False, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1500}, [32695, 19617, 0]), ('normal control', {'gross': 44831, 'taxes': 4578, 'voluntary': 17862, 'support_ordered': 124565, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 725}, [40253, 24151, 0]), ('normal control', {'gross': 62104, 'taxes': 11775, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 0, 'creditor_ordered': 0, 'min_wage': 1000}, [50329, 0, 0])], [('regression', {'gross': 31147, 'taxes': 519, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 13, 'creditor_ordered': 74886, 'min_wage': 1000}, [30628, 0, 628]), ('regression', {'gross': 78229, 'taxes': 19071, 'voluntary': 18453, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 0, 'creditor_ordered': 77925, 'min_wage': 1500}, [59158, 0, 14158]), ('partial-repair probe', {'gross': 34618, 'taxes': 2923, 'voluntary': 0, 'support_ordered': 0, 'supports_other_family': False, 'arrears_weeks': 0, 'creditor_ordered': 79265, 'min_wage': 725}, [31695, 0, 7923]), ('partial-repair probe', {'gross': 29406, 'taxes': 4534, 'voluntary': 12701, 'support_ordered': 0, 'supports_other_family': True, 'arrears_weeks': 13, 'creditor_ordered': 32946, 'min_wage': 725}, [24872, 0, 3122]), ('normal control', {'gross': 41743, 'taxes': 1120, 'voluntary': 0, 'support_ordered': 64278, 'supports_other_family': True, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 725}, [40623, 20311, 0]), ('normal control', {'gross': 140899, 'taxes': 22866, 'voluntary': 10207, 'support_ordered': 106762, 'supports_other_family': True, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 725}, [118033, 59016, 0]), ('normal control', {'gross': 190387, 'taxes': 5582, 'voluntary': 18751, 'support_ordered': 13845, 'supports_other_family': False, 'arrears_weeks': 12, 'creditor_ordered': 0, 'min_wage': 1000}, [184805, 13845, 0]), ('normal control', {'gross': 50694, 'taxes': 14190, 'voluntary': 8627, 'support_ordered': 11691, 'supports_other_family': True, 'arrears_weeks': 13, 'creditor_ordered': 0, 'min_wage': 725}, [36504, 11691, 0])]]
for i, (label, args, expected) in enumerate(fixtures[N-1]):
    check("%s %d" % (label, i), solve(args), 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)

prompt:
Low-wage employees are garnished below the protected thirty-times-minimum-wage floor.

Input weekly {gross, taxes, voluntary, support_ordered, supports_other_family, arrears_weeks, creditor_ordered, min_wage}. Disposable = max(0, gross - taxes); voluntary deductions are not subtracted. Support cap is 60% of disposable (50% if supporting another family), +5 points when arrears exceed 12 weeks, floored to cents. Creditor cap is min(25% of disposable, disposable - 30*min_wage floored at 0) less support already taken, floored at 0. Return [disposable, support, creditor].

split: open-access