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

N = 1
observations = []
def solve(x):
    periods = {'weekly': 52, 'biweekly': 26, 'semimonthly': 24, 'monthly': 12}[x['freq']]
    std = {'single': 1460000, 'mfj': 2920000, 'hoh': 2190000}[x['status']]
    annual = std + 505000 * x['dependents']
    exempt = annual // 52 * {52: 1, 26: 2, 24: 2, 12: 4}[periods]
    take_home = x['gross'] - x['taxes'] - x['pre_levy_ded']
    levy = max(0, take_home - exempt)
    return [exempt, levy]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'gross': 367596, 'taxes': 19999, 'pre_levy_ded': 20821, 'post_levy_ded': 35382, 'status': 'mfj', 'dependents': 5, 'freq': 'monthly'}, [453750, 0]), ('regression', {'gross': 314207, 'taxes': 9435, 'pre_levy_ded': 16283, 'post_levy_ded': 19170, 'status': 'hoh', 'dependents': 0, 'freq': 'semimonthly'}, [91250, 197239]), ('partial-repair probe', {'gross': 375806, 'taxes': 85086, 'pre_levy_ded': 17388, 'post_levy_ded': 18649, 'status': 'mfj', 'dependents': 1, 'freq': 'semimonthly'}, [142708, 130624]), ('partial-repair probe', {'gross': 662079, 'taxes': 145163, 'pre_levy_ded': 13433, 'post_levy_ded': 24210, 'status': 'mfj', 'dependents': 4, 'freq': 'monthly'}, [411667, 91816]), ('normal control', {'gross': 85343, 'taxes': 8434, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'single', 'dependents': 1, 'freq': 'weekly'}, [37788, 39121]), ('normal control', {'gross': 563938, 'taxes': 31966, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'hoh', 'dependents': 3, 'freq': 'weekly'}, [71250, 460722]), ('normal control', {'gross': 725985, 'taxes': 84896, 'pre_levy_ded': 30943, 'post_levy_ded': 0, 'status': 'single', 'dependents': 4, 'freq': 'weekly'}, [66923, 543223]), ('normal control', {'gross': 779132, 'taxes': 128015, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'single', 'dependents': 1, 'freq': 'weekly'}, [37788, 613329])], [('regression', {'gross': 314207, 'taxes': 9435, 'pre_levy_ded': 16283, 'post_levy_ded': 19170, 'status': 'hoh', 'dependents': 0, 'freq': 'semimonthly'}, [91250, 197239]), ('regression', {'gross': 375806, 'taxes': 85086, 'pre_levy_ded': 17388, 'post_levy_ded': 18649, 'status': 'mfj', 'dependents': 1, 'freq': 'semimonthly'}, [142708, 130624]), ('partial-repair probe', {'gross': 662079, 'taxes': 145163, 'pre_levy_ded': 13433, 'post_levy_ded': 24210, 'status': 'mfj', 'dependents': 4, 'freq': 'monthly'}, [411667, 91816]), ('partial-repair probe', {'gross': 776186, 'taxes': 132647, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'single', 'dependents': 1, 'freq': 'semimonthly'}, [81875, 561664]), ('normal control', {'gross': 561044, 'taxes': 73700, 'pre_levy_ded': 46955, 'post_levy_ded': 0, 'status': 'mfj', 'dependents': 1, 'freq': 'weekly'}, [65865, 374524]), ('normal control', {'gross': 457089, 'taxes': 16572, 'pre_levy_ded': 0, 'post_levy_ded': 36321, 'status': 'mfj', 'dependents': 3, 'freq': 'weekly'}, [85288, 355229]), ('normal control', {'gross': 483360, 'taxes': 31636, 'pre_levy_ded': 19968, 'post_levy_ded': 0, 'status': 'single', 'dependents': 2, 'freq': 'biweekly'}, [95000, 336756]), ('normal control', {'gross': 322291, 'taxes': 48648, 'pre_levy_ded': 2314, 'post_levy_ded': 38453, 'status': 'single', 'dependents': 2, 'freq': 'biweekly'}, [95000, 176329])], [('regression', {'gross': 375806, 'taxes': 85086, 'pre_levy_ded': 17388, 'post_levy_ded': 18649, 'status': 'mfj', 'dependents': 1, 'freq': 'semimonthly'}, [142708, 130624]), ('regression', {'gross': 662079, 'taxes': 145163, 'pre_levy_ded': 13433, 'post_levy_ded': 24210, 'status': 'mfj', 'dependents': 4, 'freq': 'monthly'}, [411667, 91816]), ('partial-repair probe', {'gross': 776186, 'taxes': 132647, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'single', 'dependents': 1, 'freq': 'semimonthly'}, [81875, 561664]), ('partial-repair probe', {'gross': 479258, 'taxes': 23759, 'pre_levy_ded': 40016, 'post_levy_ded': 17364, 'status': 'mfj', 'dependents': 2, 'freq': 'weekly'}, [75577, 339906]), ('normal control', {'gross': 292245, 'taxes': 28483, 'pre_levy_ded': 0, 'post_levy_ded': 44551, 'status': 'hoh', 'dependents': 5, 'freq': 'weekly'}, [90673, 173089]), ('normal control', {'gross': 498978, 'taxes': 56799, 'pre_levy_ded': 38573, 'post_levy_ded': 19078, 'status': 'hoh', 'dependents': 3, 'freq': 'biweekly'}, [142500, 261106]), ('normal control', {'gross': 135890, 'taxes': 7806, 'pre_levy_ded': 22489, 'post_levy_ded': 0, 'status': 'hoh', 'dependents': 5, 'freq': 'biweekly'}, [181346, 0]), ('normal control', {'gross': 660334, 'taxes': 22679, 'pre_levy_ded': 11619, 'post_levy_ded': 0, 'status': 'hoh', 'dependents': 3, 'freq': 'weekly'}, [71250, 554786])], [('regression', {'gross': 662079, 'taxes': 145163, 'pre_levy_ded': 13433, 'post_levy_ded': 24210, 'status': 'mfj', 'dependents': 4, 'freq': 'monthly'}, [411667, 91816]), ('regression', {'gross': 776186, 'taxes': 132647, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'single', 'dependents': 1, 'freq': 'semimonthly'}, [81875, 561664]), ('partial-repair probe', {'gross': 138753, 'taxes': 7542, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'single', 'dependents': 0, 'freq': 'weekly'}, [28077, 103134]), ('partial-repair probe', {'gross': 558221, 'taxes': 118600, 'pre_levy_ded': 0, 'post_levy_ded': 47539, 'status': 'hoh', 'dependents': 2, 'freq': 'biweekly'}, [123077, 316544]), ('normal control', {'gross': 78319, 'taxes': 7904, 'pre_levy_ded': 47033, 'post_levy_ded': 0, 'status': 'hoh', 'dependents': 5, 'freq': 'weekly'}, [90673, 0]), ('normal control', {'gross': 489973, 'taxes': 77825, 'pre_levy_ded': 1438, 'post_levy_ded': 0, 'status': 'hoh', 'dependents': 3, 'freq': 'biweekly'}, [142500, 268210]), ('normal control', {'gross': 771109, 'taxes': 88550, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'mfj', 'dependents': 4, 'freq': 'biweekly'}, [190000, 492559]), ('normal control', {'gross': 555233, 'taxes': 30018, 'pre_levy_ded': 24468, 'post_levy_ded': 0, 'status': 'hoh', 'dependents': 5, 'freq': 'biweekly'}, [181346, 319401])], [('regression', {'gross': 776186, 'taxes': 132647, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'single', 'dependents': 1, 'freq': 'semimonthly'}, [81875, 561664]), ('regression', {'gross': 479258, 'taxes': 23759, 'pre_levy_ded': 40016, 'post_levy_ded': 17364, 'status': 'mfj', 'dependents': 2, 'freq': 'weekly'}, [75577, 339906]), ('partial-repair probe', {'gross': 531960, 'taxes': 121383, 'pre_levy_ded': 0, 'post_levy_ded': 49273, 'status': 'mfj', 'dependents': 2, 'freq': 'monthly'}, [327500, 83077]), ('partial-repair probe', {'gross': 714333, 'taxes': 49017, 'pre_levy_ded': 0, 'post_levy_ded': 19873, 'status': 'single', 'dependents': 0, 'freq': 'monthly'}, [121667, 543649]), ('normal control', {'gross': 170013, 'taxes': 32585, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'hoh', 'dependents': 5, 'freq': 'biweekly'}, [181346, 0]), ('normal control', {'gross': 446675, 'taxes': 105666, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'single', 'dependents': 4, 'freq': 'weekly'}, [66923, 274086]), ('normal control', {'gross': 379980, 'taxes': 42083, 'pre_levy_ded': 23968, 'post_levy_ded': 48603, 'status': 'single', 'dependents': 2, 'freq': 'weekly'}, [47500, 266429]), ('normal control', {'gross': 290615, 'taxes': 49794, 'pre_levy_ded': 9951, 'post_levy_ded': 46367, 'status': 'hoh', 'dependents': 3, 'freq': 'weekly'}, [71250, 159620])]]
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):
    periods = {'weekly': 52, 'biweekly': 26, 'semimonthly': 24, 'monthly': 12}[x['freq']]
    std = {'single': 1460000, 'mfj': 2920000, 'hoh': 2190000}[x['status']]
    annual = std + 505000 * x['dependents']
    exempt = annual // 52 * 52 // periods
    take_home = x['gross'] - x['taxes'] - x['pre_levy_ded']
    levy = max(0, take_home - exempt)
    return [exempt, levy]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'gross': 367596, 'taxes': 19999, 'pre_levy_ded': 20821, 'post_levy_ded': 35382, 'status': 'mfj', 'dependents': 5, 'freq': 'monthly'}, [453750, 0]), ('regression', {'gross': 314207, 'taxes': 9435, 'pre_levy_ded': 16283, 'post_levy_ded': 19170, 'status': 'hoh', 'dependents': 0, 'freq': 'semimonthly'}, [91250, 197239]), ('partial-repair probe', {'gross': 375806, 'taxes': 85086, 'pre_levy_ded': 17388, 'post_levy_ded': 18649, 'status': 'mfj', 'dependents': 1, 'freq': 'semimonthly'}, [142708, 130624]), ('partial-repair probe', {'gross': 662079, 'taxes': 145163, 'pre_levy_ded': 13433, 'post_levy_ded': 24210, 'status': 'mfj', 'dependents': 4, 'freq': 'monthly'}, [411667, 91816]), ('normal control', {'gross': 85343, 'taxes': 8434, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'single', 'dependents': 1, 'freq': 'weekly'}, [37788, 39121]), ('normal control', {'gross': 563938, 'taxes': 31966, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'hoh', 'dependents': 3, 'freq': 'weekly'}, [71250, 460722]), ('normal control', {'gross': 725985, 'taxes': 84896, 'pre_levy_ded': 30943, 'post_levy_ded': 0, 'status': 'single', 'dependents': 4, 'freq': 'weekly'}, [66923, 543223]), ('normal control', {'gross': 779132, 'taxes': 128015, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'single', 'dependents': 1, 'freq': 'weekly'}, [37788, 613329])], [('regression', {'gross': 314207, 'taxes': 9435, 'pre_levy_ded': 16283, 'post_levy_ded': 19170, 'status': 'hoh', 'dependents': 0, 'freq': 'semimonthly'}, [91250, 197239]), ('regression', {'gross': 375806, 'taxes': 85086, 'pre_levy_ded': 17388, 'post_levy_ded': 18649, 'status': 'mfj', 'dependents': 1, 'freq': 'semimonthly'}, [142708, 130624]), ('partial-repair probe', {'gross': 662079, 'taxes': 145163, 'pre_levy_ded': 13433, 'post_levy_ded': 24210, 'status': 'mfj', 'dependents': 4, 'freq': 'monthly'}, [411667, 91816]), ('partial-repair probe', {'gross': 776186, 'taxes': 132647, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'single', 'dependents': 1, 'freq': 'semimonthly'}, [81875, 561664]), ('normal control', {'gross': 561044, 'taxes': 73700, 'pre_levy_ded': 46955, 'post_levy_ded': 0, 'status': 'mfj', 'dependents': 1, 'freq': 'weekly'}, [65865, 374524]), ('normal control', {'gross': 457089, 'taxes': 16572, 'pre_levy_ded': 0, 'post_levy_ded': 36321, 'status': 'mfj', 'dependents': 3, 'freq': 'weekly'}, [85288, 355229]), ('normal control', {'gross': 483360, 'taxes': 31636, 'pre_levy_ded': 19968, 'post_levy_ded': 0, 'status': 'single', 'dependents': 2, 'freq': 'biweekly'}, [95000, 336756]), ('normal control', {'gross': 322291, 'taxes': 48648, 'pre_levy_ded': 2314, 'post_levy_ded': 38453, 'status': 'single', 'dependents': 2, 'freq': 'biweekly'}, [95000, 176329])], [('regression', {'gross': 375806, 'taxes': 85086, 'pre_levy_ded': 17388, 'post_levy_ded': 18649, 'status': 'mfj', 'dependents': 1, 'freq': 'semimonthly'}, [142708, 130624]), ('regression', {'gross': 662079, 'taxes': 145163, 'pre_levy_ded': 13433, 'post_levy_ded': 24210, 'status': 'mfj', 'dependents': 4, 'freq': 'monthly'}, [411667, 91816]), ('partial-repair probe', {'gross': 776186, 'taxes': 132647, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'single', 'dependents': 1, 'freq': 'semimonthly'}, [81875, 561664]), ('partial-repair probe', {'gross': 479258, 'taxes': 23759, 'pre_levy_ded': 40016, 'post_levy_ded': 17364, 'status': 'mfj', 'dependents': 2, 'freq': 'weekly'}, [75577, 339906]), ('normal control', {'gross': 292245, 'taxes': 28483, 'pre_levy_ded': 0, 'post_levy_ded': 44551, 'status': 'hoh', 'dependents': 5, 'freq': 'weekly'}, [90673, 173089]), ('normal control', {'gross': 498978, 'taxes': 56799, 'pre_levy_ded': 38573, 'post_levy_ded': 19078, 'status': 'hoh', 'dependents': 3, 'freq': 'biweekly'}, [142500, 261106]), ('normal control', {'gross': 135890, 'taxes': 7806, 'pre_levy_ded': 22489, 'post_levy_ded': 0, 'status': 'hoh', 'dependents': 5, 'freq': 'biweekly'}, [181346, 0]), ('normal control', {'gross': 660334, 'taxes': 22679, 'pre_levy_ded': 11619, 'post_levy_ded': 0, 'status': 'hoh', 'dependents': 3, 'freq': 'weekly'}, [71250, 554786])], [('regression', {'gross': 662079, 'taxes': 145163, 'pre_levy_ded': 13433, 'post_levy_ded': 24210, 'status': 'mfj', 'dependents': 4, 'freq': 'monthly'}, [411667, 91816]), ('regression', {'gross': 776186, 'taxes': 132647, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'single', 'dependents': 1, 'freq': 'semimonthly'}, [81875, 561664]), ('partial-repair probe', {'gross': 138753, 'taxes': 7542, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'single', 'dependents': 0, 'freq': 'weekly'}, [28077, 103134]), ('partial-repair probe', {'gross': 558221, 'taxes': 118600, 'pre_levy_ded': 0, 'post_levy_ded': 47539, 'status': 'hoh', 'dependents': 2, 'freq': 'biweekly'}, [123077, 316544]), ('normal control', {'gross': 78319, 'taxes': 7904, 'pre_levy_ded': 47033, 'post_levy_ded': 0, 'status': 'hoh', 'dependents': 5, 'freq': 'weekly'}, [90673, 0]), ('normal control', {'gross': 489973, 'taxes': 77825, 'pre_levy_ded': 1438, 'post_levy_ded': 0, 'status': 'hoh', 'dependents': 3, 'freq': 'biweekly'}, [142500, 268210]), ('normal control', {'gross': 771109, 'taxes': 88550, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'mfj', 'dependents': 4, 'freq': 'biweekly'}, [190000, 492559]), ('normal control', {'gross': 555233, 'taxes': 30018, 'pre_levy_ded': 24468, 'post_levy_ded': 0, 'status': 'hoh', 'dependents': 5, 'freq': 'biweekly'}, [181346, 319401])], [('regression', {'gross': 776186, 'taxes': 132647, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'single', 'dependents': 1, 'freq': 'semimonthly'}, [81875, 561664]), ('regression', {'gross': 479258, 'taxes': 23759, 'pre_levy_ded': 40016, 'post_levy_ded': 17364, 'status': 'mfj', 'dependents': 2, 'freq': 'weekly'}, [75577, 339906]), ('partial-repair probe', {'gross': 531960, 'taxes': 121383, 'pre_levy_ded': 0, 'post_levy_ded': 49273, 'status': 'mfj', 'dependents': 2, 'freq': 'monthly'}, [327500, 83077]), ('partial-repair probe', {'gross': 714333, 'taxes': 49017, 'pre_levy_ded': 0, 'post_levy_ded': 19873, 'status': 'single', 'dependents': 0, 'freq': 'monthly'}, [121667, 543649]), ('normal control', {'gross': 170013, 'taxes': 32585, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'hoh', 'dependents': 5, 'freq': 'biweekly'}, [181346, 0]), ('normal control', {'gross': 446675, 'taxes': 105666, 'pre_levy_ded': 0, 'post_levy_ded': 0, 'status': 'single', 'dependents': 4, 'freq': 'weekly'}, [66923, 274086]), ('normal control', {'gross': 379980, 'taxes': 42083, 'pre_levy_ded': 23968, 'post_levy_ded': 48603, 'status': 'single', 'dependents': 2, 'freq': 'weekly'}, [47500, 266429]), ('normal control', {'gross': 290615, 'taxes': 49794, 'pre_levy_ded': 9951, 'post_levy_ded': 46367, 'status': 'hoh', 'dependents': 3, 'freq': 'weekly'}, [71250, 159620])]]
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:
Semimonthly and monthly employees receive a smaller exempt amount than their annual figure implies.

Input {gross, taxes, pre_levy_ded, post_levy_ded, status, dependents, freq}. Annual exempt = standard amount (single 14,600, mfj 29,200, hoh 21,900 dollars) + 5,050.00 per dependent (the taxpayer is not a dependent); per-period exempt = annual/periods half-up (weekly 52, biweekly 26, semimonthly 24, monthly 12). Take-home counts only deductions in place before the levy. Levy = max(0, take-home - exempt). Return [exempt, levy].

split: open-access


meaning: Fixture-count band, not measured model difficulty

deps: stdlib

prompt:
Anyone working the last day of the week gets seventh-day premium pay.

Input seven daily hour counts (workweek order). If all seven days are worked, day 7 hours are 1.5x up to 8 and double beyond 8. Other days: first 8 regular, 8-12 at 1.5x, over 12 double; regular hours beyond a weekly total of 40 regular hours become 1.5x. Return [regular, overtime, double].

split: open-access


prompt:
Very long days count hours past twelve as both overtime and double time.

Input seven daily hour counts (workweek order). If all seven days are worked, day 7 hours are 1.5x up to 8 and double beyond 8. Other days: first 8 regular, 8-12 at 1.5x, over 12 double; regular hours beyond a weekly total of 40 regular hours become 1.5x. Return [regular, overtime, double].

split: open-access


prompt:
Employees with daily overtime early in the week hit weekly overtime too soon.

Input seven daily hour counts (workweek order). If all seven days are worked, day 7 hours are 1.5x up to 8 and double beyond 8. Other days: first 8 regular, 8-12 at 1.5x, over 12 double; regular hours beyond a weekly total of 40 regular hours become 1.5x. Return [regular, overtime, double].

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import datetime
N = 1
observations = []
def solve(x):
    d = datetime.date(*x['pay_date'])
    if x['accumulated'] > 10000000:
        nd = d + datetime.timedelta(days=1)
        while nd.weekday() >= 5:
            nd += datetime.timedelta(days=1)
        return ['next-day', nd.isoformat()]
    if x['lookback_total'] <= 5000000:
        y, m = (d.year + 1, 1) if d.month == 12 else (d.year, d.month + 1)
        return ['monthly', datetime.date(y, m, 15).isoformat()]
    wd = d.weekday()
    if wd in (2, 3, 4):
        delta = (2 - wd) % 7 or 7
    else:
        delta = (4 - wd) % 7
    return ['semiweekly', (d + datetime.timedelta(days=delta)).isoformat()]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'pay_date': [2026, 1, 10], 'lookback_total': 8559426, 'accumulated': 10000000}, ['next-day', '2026-01-12']), ('regression', {'pay_date': [2025, 7, 6], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-07-07']), ('partial-repair probe', {'pay_date': [2026, 1, 1], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2026-01-02']), ('partial-repair probe', {'pay_date': [2025, 7, 12], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-07-14']), ('normal control', {'pay_date': [2025, 7, 24], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2025-08-15']), ('normal control', {'pay_date': [2025, 7, 23], 'lookback_total': 4030366, 'accumulated': 7676976}, ['monthly', '2025-08-15']), ('normal control', {'pay_date': [2025, 11, 30], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2025-12-15']), ('normal control', {'pay_date': [2025, 10, 17], 'lookback_total': 5000001, 'accumulated': 9999999}, ['semiweekly', '2025-10-22'])], [('regression', {'pay_date': [2025, 7, 6], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-07-07']), ('regression', {'pay_date': [2026, 1, 1], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2026-01-02']), ('partial-repair probe', {'pay_date': [2025, 7, 12], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-07-14']), ('partial-repair probe', {'pay_date': [2025, 8, 20], 'lookback_total': 15073801, 'accumulated': 1953477}, ['semiweekly', '2025-08-27']), ('normal control', {'pay_date': [2025, 3, 12], 'lookback_total': 5000000, 'accumulated': 5561044}, ['monthly', '2025-04-15']), ('normal control', {'pay_date': [2026, 1, 15], 'lookback_total': 5000001, 'accumulated': 128367}, ['semiweekly', '2026-01-21']), ('normal control', {'pay_date': [2024, 12, 14], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2025-01-15']), ('normal control', {'pay_date': [2025, 4, 9], 'lookback_total': 5000000, 'accumulated': 17594}, ['monthly', '2025-05-15'])], [('regression', {'pay_date': [2026, 1, 1], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2026-01-02']), ('regression', {'pay_date': [2025, 7, 12], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-07-14']), ('partial-repair probe', {'pay_date': [2025, 8, 20], 'lookback_total': 15073801, 'accumulated': 1953477}, ['semiweekly', '2025-08-27']), ('partial-repair probe', {'pay_date': [2024, 12, 27], 'lookback_total': 14968828, 'accumulated': 48129}, ['semiweekly', '2025-01-01']), ('normal control', {'pay_date': [2025, 1, 28], 'lookback_total': 5000001, 'accumulated': 2892395}, ['semiweekly', '2025-01-31']), ('normal control', {'pay_date': [2026, 1, 11], 'lookback_total': 5000000, 'accumulated': 106033}, ['monthly', '2026-02-15']), ('normal control', {'pay_date': [2025, 1, 9], 'lookback_total': 5000001, 'accumulated': 9999999}, ['semiweekly', '2025-01-15']), ('normal control', {'pay_date': [2025, 12, 21], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2026-01-15'])], [('regression', {'pay_date': [2025, 7, 12], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-07-14']), ('regression', {'pay_date': [2025, 2, 13], 'lookback_total': 2864521, 'accumulated': 10000000}, ['next-day', '2025-02-14']), ('partial-repair probe', {'pay_date': [2024, 12, 22], 'lookback_total': 5000001, 'accumulated': 10000000}, ['next-day', '2024-12-23']), ('partial-repair probe', {'pay_date': [2025, 1, 28], 'lookback_total': 14733386, 'accumulated': 9999999}, ['semiweekly', '2025-01-31']), ('normal control', {'pay_date': [2024, 12, 8], 'lookback_total': 7946403, 'accumulated': 200852}, ['semiweekly', '2024-12-13']), ('normal control', {'pay_date': [2025, 9, 18], 'lookback_total': 5000001, 'accumulated': 171509}, ['semiweekly', '2025-09-24']), ('normal control', {'pay_date': [2025, 7, 15], 'lookback_total': 7386577, 'accumulated': 7242712}, ['semiweekly', '2025-07-18']), ('normal control', {'pay_date': [2025, 6, 8], 'lookback_total': 5000001, 'accumulated': 136142}, ['semiweekly', '2025-06-13'])], [('regression', {'pay_date': [2025, 2, 13], 'lookback_total': 2864521, 'accumulated': 10000000}, ['next-day', '2025-02-14']), ('regression', {'pay_date': [2024, 12, 22], 'lookback_total': 5000001, 'accumulated': 10000000}, ['next-day', '2024-12-23']), ('partial-repair probe', {'pay_date': [2025, 1, 28], 'lookback_total': 14733386, 'accumulated': 9999999}, ['semiweekly', '2025-01-31']), ('partial-repair probe', {'pay_date': [2025, 12, 8], 'lookback_total': 5000001, 'accumulated': 10000000}, ['next-day', '2025-12-09']), ('normal control', {'pay_date': [2025, 2, 28], 'lookback_total': 5934057, 'accumulated': 9999999}, ['semiweekly', '2025-03-05']), ('normal control', {'pay_date': [2025, 10, 25], 'lookback_total': 5000001, 'accumulated': 9999999}, ['semiweekly', '2025-10-31']), ('normal control', {'pay_date': [2024, 12, 12], 'lookback_total': 5000001, 'accumulated': 126127}, ['semiweekly', '2024-12-18']), ('normal control', {'pay_date': [2025, 7, 2], 'lookback_total': 5000000, 'accumulated': 9342050}, ['monthly', '2025-08-15'])]]
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
import datetime
N = 1
observations = []
def solve(x):
    d = datetime.date(*x['pay_date'])
    if x['lookback_total'] >= 10000000:
        nd = d + datetime.timedelta(days=1)
        while nd.weekday() >= 5:
            nd += datetime.timedelta(days=1)
        return ['next-day', nd.isoformat()]
    if x['lookback_total'] <= 5000000:
        y, m = (d.year + 1, 1) if d.month == 12 else (d.year, d.month + 1)
        return ['monthly', datetime.date(y, m, 15).isoformat()]
    wd = d.weekday()
    if wd in (2, 3, 4):
        delta = (2 - wd) % 7 or 7
    else:
        delta = (4 - wd) % 7
    return ['semiweekly', (d + datetime.timedelta(days=delta)).isoformat()]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'pay_date': [2026, 1, 10], 'lookback_total': 8559426, 'accumulated': 10000000}, ['next-day', '2026-01-12']), ('regression', {'pay_date': [2025, 7, 6], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-07-07']), ('partial-repair probe', {'pay_date': [2026, 1, 1], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2026-01-02']), ('partial-repair probe', {'pay_date': [2025, 7, 12], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-07-14']), ('normal control', {'pay_date': [2025, 7, 24], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2025-08-15']), ('normal control', {'pay_date': [2025, 7, 23], 'lookback_total': 4030366, 'accumulated': 7676976}, ['monthly', '2025-08-15']), ('normal control', {'pay_date': [2025, 11, 30], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2025-12-15']), ('normal control', {'pay_date': [2025, 10, 17], 'lookback_total': 5000001, 'accumulated': 9999999}, ['semiweekly', '2025-10-22'])], [('regression', {'pay_date': [2025, 7, 6], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-07-07']), ('regression', {'pay_date': [2026, 1, 1], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2026-01-02']), ('partial-repair probe', {'pay_date': [2025, 7, 12], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-07-14']), ('partial-repair probe', {'pay_date': [2025, 8, 20], 'lookback_total': 15073801, 'accumulated': 1953477}, ['semiweekly', '2025-08-27']), ('normal control', {'pay_date': [2025, 3, 12], 'lookback_total': 5000000, 'accumulated': 5561044}, ['monthly', '2025-04-15']), ('normal control', {'pay_date': [2026, 1, 15], 'lookback_total': 5000001, 'accumulated': 128367}, ['semiweekly', '2026-01-21']), ('normal control', {'pay_date': [2024, 12, 14], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2025-01-15']), ('normal control', {'pay_date': [2025, 4, 9], 'lookback_total': 5000000, 'accumulated': 17594}, ['monthly', '2025-05-15'])], [('regression', {'pay_date': [2026, 1, 1], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2026-01-02']), ('regression', {'pay_date': [2025, 7, 12], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-07-14']), ('partial-repair probe', {'pay_date': [2025, 8, 20], 'lookback_total': 15073801, 'accumulated': 1953477}, ['semiweekly', '2025-08-27']), ('partial-repair probe', {'pay_date': [2024, 12, 27], 'lookback_total': 14968828, 'accumulated': 48129}, ['semiweekly', '2025-01-01']), ('normal control', {'pay_date': [2025, 1, 28], 'lookback_total': 5000001, 'accumulated': 2892395}, ['semiweekly', '2025-01-31']), ('normal control', {'pay_date': [2026, 1, 11], 'lookback_total': 5000000, 'accumulated': 106033}, ['monthly', '2026-02-15']), ('normal control', {'pay_date': [2025, 1, 9], 'lookback_total': 5000001, 'accumulated': 9999999}, ['semiweekly', '2025-01-15']), ('normal control', {'pay_date': [2025, 12, 21], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2026-01-15'])], [('regression', {'pay_date': [2025, 7, 12], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-07-14']), ('regression', {'pay_date': [2025, 2, 13], 'lookback_total': 2864521, 'accumulated': 10000000}, ['next-day', '2025-02-14']), ('partial-repair probe', {'pay_date': [2024, 12, 22], 'lookback_total': 5000001, 'accumulated': 10000000}, ['next-day', '2024-12-23']), ('partial-repair probe', {'pay_date': [2025, 1, 28], 'lookback_total': 14733386, 'accumulated': 9999999}, ['semiweekly', '2025-01-31']), ('normal control', {'pay_date': [2024, 12, 8], 'lookback_total': 7946403, 'accumulated': 200852}, ['semiweekly', '2024-12-13']), ('normal control', {'pay_date': [2025, 9, 18], 'lookback_total': 5000001, 'accumulated': 171509}, ['semiweekly', '2025-09-24']), ('normal control', {'pay_date': [2025, 7, 15], 'lookback_total': 7386577, 'accumulated': 7242712}, ['semiweekly', '2025-07-18']), ('normal control', {'pay_date': [2025, 6, 8], 'lookback_total': 5000001, 'accumulated': 136142}, ['semiweekly', '2025-06-13'])], [('regression', {'pay_date': [2025, 2, 13], 'lookback_total': 2864521, 'accumulated': 10000000}, ['next-day', '2025-02-14']), ('regression', {'pay_date': [2024, 12, 22], 'lookback_total': 5000001, 'accumulated': 10000000}, ['next-day', '2024-12-23']), ('partial-repair probe', {'pay_date': [2025, 1, 28], 'lookback_total': 14733386, 'accumulated': 9999999}, ['semiweekly', '2025-01-31']), ('partial-repair probe', {'pay_date': [2025, 12, 8], 'lookback_total': 5000001, 'accumulated': 10000000}, ['next-day', '2025-12-09']), ('normal control', {'pay_date': [2025, 2, 28], 'lookback_total': 5934057, 'accumulated': 9999999}, ['semiweekly', '2025-03-05']), ('normal control', {'pay_date': [2025, 10, 25], 'lookback_total': 5000001, 'accumulated': 9999999}, ['semiweekly', '2025-10-31']), ('normal control', {'pay_date': [2024, 12, 12], 'lookback_total': 5000001, 'accumulated': 126127}, ['semiweekly', '2024-12-18']), ('normal control', {'pay_date': [2025, 7, 2], 'lookback_total': 5000000, 'accumulated': 9342050}, ['monthly', '2025-08-15'])]]
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:
Employers accumulating exactly 100,000 miss the next-day deposit.

Input {pay_date, lookback_total, accumulated}. If accumulated liability is 100,000.00 or more, deposit the next weekday after pay date. Else if lookback liability is 50,000.00 or less, deposit monthly by the 15th of the following month. Else semiweekly: Wed/Thu/Fri paydays deposit the following Wednesday; Sat-Tue paydays the following Friday. Return [schedule, ISO due date].

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import datetime
N = 1
observations = []
def solve(x):
    d = datetime.date(*x['pay_date'])
    if x['accumulated'] >= 10000000:
        nd = d + datetime.timedelta(days=1)
        while nd.weekday() > 5:
            nd += datetime.timedelta(days=1)
        return ['next-day', nd.isoformat()]
    if x['lookback_total'] <= 5000000:
        y, m = (d.year + 1, 1) if d.month == 12 else (d.year, d.month + 1)
        return ['monthly', datetime.date(y, m, 15).isoformat()]
    wd = d.weekday()
    if wd in (2, 3, 4):
        delta = (2 - wd) % 7 or 7
    else:
        delta = (4 - wd) % 7
    return ['semiweekly', (d + datetime.timedelta(days=delta)).isoformat()]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'pay_date': [2025, 11, 21], 'lookback_total': 130512, 'accumulated': 10000000}, ['next-day', '2025-11-24']), ('regression', {'pay_date': [2024, 11, 22], 'lookback_total': 5000001, 'accumulated': 10000000}, ['next-day', '2024-11-25']), ('partial-repair probe', {'pay_date': [2025, 10, 17], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-10-20']), ('partial-repair probe', {'pay_date': [2025, 12, 5], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-12-08']), ('normal control', {'pay_date': [2025, 7, 24], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2025-08-15']), ('normal control', {'pay_date': [2025, 7, 23], 'lookback_total': 4030366, 'accumulated': 7676976}, ['monthly', '2025-08-15']), ('normal control', {'pay_date': [2026, 1, 10], 'lookback_total': 8559426, 'accumulated': 10000000}, ['next-day', '2026-01-12']), ('normal control', {'pay_date': [2025, 11, 30], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2025-12-15'])], [('regression', {'pay_date': [2024, 11, 22], 'lookback_total': 5000001, 'accumulated': 10000000}, ['next-day', '2024-11-25']), ('regression', {'pay_date': [2025, 10, 17], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-10-20']), ('partial-repair probe', {'pay_date': [2025, 12, 5], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-12-08']), ('partial-repair probe', {'pay_date': [2025, 5, 30], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-06-02']), ('normal control', {'pay_date': [2025, 10, 17], 'lookback_total': 5000001, 'accumulated': 9999999}, ['semiweekly', '2025-10-22']), ('normal control', {'pay_date': [2025, 3, 12], 'lookback_total': 5000000, 'accumulated': 5561044}, ['monthly', '2025-04-15']), ('normal control', {'pay_date': [2025, 7, 6], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-07-07']), ('normal control', {'pay_date': [2026, 1, 1], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2026-01-02'])], [('regression', {'pay_date': [2025, 10, 17], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-10-20']), ('regression', {'pay_date': [2025, 12, 5], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-12-08']), ('partial-repair probe', {'pay_date': [2025, 5, 30], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-06-02']), ('partial-repair probe', {'pay_date': [2025, 5, 9], 'lookback_total': 7093041, 'accumulated': 10000000}, ['next-day', '2025-05-12']), ('normal control', {'pay_date': [2025, 7, 12], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-07-14']), ('normal control', {'pay_date': [2026, 1, 15], 'lookback_total': 5000001, 'accumulated': 128367}, ['semiweekly', '2026-01-21']), ('normal control', {'pay_date': [2025, 8, 20], 'lookback_total': 15073801, 'accumulated': 1953477}, ['semiweekly', '2025-08-27']), ('normal control', {'pay_date': [2024, 12, 14], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2025-01-15'])], [('regression', {'pay_date': [2025, 12, 5], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-12-08']), ('regression', {'pay_date': [2025, 5, 30], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-06-02']), ('partial-repair probe', {'pay_date': [2025, 8, 1], 'lookback_total': 1498430, 'accumulated': 10000000}, ['next-day', '2025-08-04']), ('partial-repair probe', {'pay_date': [2025, 1, 17], 'lookback_total': 5000001, 'accumulated': 10000000}, ['next-day', '2025-01-20']), ('normal control', {'pay_date': [2025, 4, 9], 'lookback_total': 5000000, 'accumulated': 17594}, ['monthly', '2025-05-15']), ('normal control', {'pay_date': [2025, 1, 28], 'lookback_total': 5000001, 'accumulated': 2892395}, ['semiweekly', '2025-01-31']), ('normal control', {'pay_date': [2026, 1, 11], 'lookback_total': 5000000, 'accumulated': 106033}, ['monthly', '2026-02-15']), ('normal control', {'pay_date': [2025, 1, 9], 'lookback_total': 5000001, 'accumulated': 9999999}, ['semiweekly', '2025-01-15'])], [('regression', {'pay_date': [2025, 5, 30], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-06-02']), ('regression', {'pay_date': [2025, 5, 9], 'lookback_total': 7093041, 'accumulated': 10000000}, ['next-day', '2025-05-12']), ('partial-repair probe', {'pay_date': [2025, 8, 1], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-08-04']), ('partial-repair probe', {'pay_date': [2025, 6, 6], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-06-09']), ('normal control', {'pay_date': [2025, 12, 21], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2026-01-15']), ('normal control', {'pay_date': [2024, 12, 8], 'lookback_total': 7946403, 'accumulated': 200852}, ['semiweekly', '2024-12-13']), ('normal control', {'pay_date': [2025, 9, 18], 'lookback_total': 5000001, 'accumulated': 171509}, ['semiweekly', '2025-09-24']), ('normal control', {'pay_date': [2024, 12, 27], 'lookback_total': 14968828, 'accumulated': 48129}, ['semiweekly', '2025-01-01'])]]
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
import datetime
N = 1
observations = []
def solve(x):
    d = datetime.date(*x['pay_date'])
    if x['accumulated'] >= 10000000:
        nd = d + datetime.timedelta(days=1)
        if nd.weekday() >= 5:
            nd += datetime.timedelta(days=1)
        return ['next-day', nd.isoformat()]
    if x['lookback_total'] <= 5000000:
        y, m = (d.year + 1, 1) if d.month == 12 else (d.year, d.month + 1)
        return ['monthly', datetime.date(y, m, 15).isoformat()]
    wd = d.weekday()
    if wd in (2, 3, 4):
        delta = (2 - wd) % 7 or 7
    else:
        delta = (4 - wd) % 7
    return ['semiweekly', (d + datetime.timedelta(days=delta)).isoformat()]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'pay_date': [2025, 11, 21], 'lookback_total': 130512, 'accumulated': 10000000}, ['next-day', '2025-11-24']), ('regression', {'pay_date': [2024, 11, 22], 'lookback_total': 5000001, 'accumulated': 10000000}, ['next-day', '2024-11-25']), ('partial-repair probe', {'pay_date': [2025, 10, 17], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-10-20']), ('partial-repair probe', {'pay_date': [2025, 12, 5], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-12-08']), ('normal control', {'pay_date': [2025, 7, 24], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2025-08-15']), ('normal control', {'pay_date': [2025, 7, 23], 'lookback_total': 4030366, 'accumulated': 7676976}, ['monthly', '2025-08-15']), ('normal control', {'pay_date': [2026, 1, 10], 'lookback_total': 8559426, 'accumulated': 10000000}, ['next-day', '2026-01-12']), ('normal control', {'pay_date': [2025, 11, 30], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2025-12-15'])], [('regression', {'pay_date': [2024, 11, 22], 'lookback_total': 5000001, 'accumulated': 10000000}, ['next-day', '2024-11-25']), ('regression', {'pay_date': [2025, 10, 17], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-10-20']), ('partial-repair probe', {'pay_date': [2025, 12, 5], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-12-08']), ('partial-repair probe', {'pay_date': [2025, 5, 30], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-06-02']), ('normal control', {'pay_date': [2025, 10, 17], 'lookback_total': 5000001, 'accumulated': 9999999}, ['semiweekly', '2025-10-22']), ('normal control', {'pay_date': [2025, 3, 12], 'lookback_total': 5000000, 'accumulated': 5561044}, ['monthly', '2025-04-15']), ('normal control', {'pay_date': [2025, 7, 6], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-07-07']), ('normal control', {'pay_date': [2026, 1, 1], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2026-01-02'])], [('regression', {'pay_date': [2025, 10, 17], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-10-20']), ('regression', {'pay_date': [2025, 12, 5], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-12-08']), ('partial-repair probe', {'pay_date': [2025, 5, 30], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-06-02']), ('partial-repair probe', {'pay_date': [2025, 5, 9], 'lookback_total': 7093041, 'accumulated': 10000000}, ['next-day', '2025-05-12']), ('normal control', {'pay_date': [2025, 7, 12], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-07-14']), ('normal control', {'pay_date': [2026, 1, 15], 'lookback_total': 5000001, 'accumulated': 128367}, ['semiweekly', '2026-01-21']), ('normal control', {'pay_date': [2025, 8, 20], 'lookback_total': 15073801, 'accumulated': 1953477}, ['semiweekly', '2025-08-27']), ('normal control', {'pay_date': [2024, 12, 14], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2025-01-15'])], [('regression', {'pay_date': [2025, 12, 5], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-12-08']), ('regression', {'pay_date': [2025, 5, 30], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-06-02']), ('partial-repair probe', {'pay_date': [2025, 8, 1], 'lookback_total': 1498430, 'accumulated': 10000000}, ['next-day', '2025-08-04']), ('partial-repair probe', {'pay_date': [2025, 1, 17], 'lookback_total': 5000001, 'accumulated': 10000000}, ['next-day', '2025-01-20']), ('normal control', {'pay_date': [2025, 4, 9], 'lookback_total': 5000000, 'accumulated': 17594}, ['monthly', '2025-05-15']), ('normal control', {'pay_date': [2025, 1, 28], 'lookback_total': 5000001, 'accumulated': 2892395}, ['semiweekly', '2025-01-31']), ('normal control', {'pay_date': [2026, 1, 11], 'lookback_total': 5000000, 'accumulated': 106033}, ['monthly', '2026-02-15']), ('normal control', {'pay_date': [2025, 1, 9], 'lookback_total': 5000001, 'accumulated': 9999999}, ['semiweekly', '2025-01-15'])], [('regression', {'pay_date': [2025, 5, 30], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-06-02']), ('regression', {'pay_date': [2025, 5, 9], 'lookback_total': 7093041, 'accumulated': 10000000}, ['next-day', '2025-05-12']), ('partial-repair probe', {'pay_date': [2025, 8, 1], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-08-04']), ('partial-repair probe', {'pay_date': [2025, 6, 6], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-06-09']), ('normal control', {'pay_date': [2025, 12, 21], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2026-01-15']), ('normal control', {'pay_date': [2024, 12, 8], 'lookback_total': 7946403, 'accumulated': 200852}, ['semiweekly', '2024-12-13']), ('normal control', {'pay_date': [2025, 9, 18], 'lookback_total': 5000001, 'accumulated': 171509}, ['semiweekly', '2025-09-24']), ('normal control', {'pay_date': [2024, 12, 27], 'lookback_total': 14968828, 'accumulated': 48129}, ['semiweekly', '2025-01-01'])]]
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:
Friday payday next-day deposits come due on Saturday.

Input {pay_date, lookback_total, accumulated}. If accumulated liability is 100,000.00 or more, deposit the next weekday after pay date. Else if lookback liability is 50,000.00 or less, deposit monthly by the 15th of the following month. Else semiweekly: Wed/Thu/Fri paydays deposit the following Wednesday; Sat-Tue paydays the following Friday. Return [schedule, ISO due date].

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import datetime
N = 1
observations = []
def solve(x):
    d = datetime.date(*x['pay_date'])
    if x['accumulated'] >= 10000000:
        nd = d + datetime.timedelta(days=1)
        while nd.weekday() >= 5:
            nd += datetime.timedelta(days=1)
        return ['next-day', nd.isoformat()]
    if x['lookback_total'] < 5000000:
        y, m = (d.year + 1, 1) if d.month == 12 else (d.year, d.month + 1)
        return ['monthly', datetime.date(y, m, 15).isoformat()]
    wd = d.weekday()
    if wd in (2, 3, 4):
        delta = (2 - wd) % 7 or 7
    else:
        delta = (4 - wd) % 7
    return ['semiweekly', (d + datetime.timedelta(days=delta)).isoformat()]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'pay_date': [2025, 7, 24], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2025-08-15']), ('regression', {'pay_date': [2025, 11, 30], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2025-12-15']), ('partial-repair probe', {'pay_date': [2025, 7, 23], 'lookback_total': 4030366, 'accumulated': 7676976}, ['monthly', '2025-08-15']), ('partial-repair probe', {'pay_date': [2025, 3, 12], 'lookback_total': 5000000, 'accumulated': 5561044}, ['monthly', '2025-04-15']), ('normal control', {'pay_date': [2026, 1, 10], 'lookback_total': 8559426, 'accumulated': 10000000}, ['next-day', '2026-01-12']), ('normal control', {'pay_date': [2025, 10, 17], 'lookback_total': 5000001, 'accumulated': 9999999}, ['semiweekly', '2025-10-22']), ('normal control', {'pay_date': [2025, 7, 6], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-07-07']), ('normal control', {'pay_date': [2026, 1, 1], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2026-01-02'])], [('regression', {'pay_date': [2025, 11, 30], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2025-12-15']), ('regression', {'pay_date': [2025, 3, 12], 'lookback_total': 5000000, 'accumulated': 5561044}, ['monthly', '2025-04-15']), ('partial-repair probe', {'pay_date': [2026, 1, 15], 'lookback_total': 5000001, 'accumulated': 128367}, ['semiweekly', '2026-01-21']), ('partial-repair probe', {'pay_date': [2025, 8, 20], 'lookback_total': 15073801, 'accumulated': 1953477}, ['semiweekly', '2025-08-27']), ('normal control', {'pay_date': [2025, 7, 12], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-07-14']), ('normal control', {'pay_date': [2025, 1, 9], 'lookback_total': 5000001, 'accumulated': 9999999}, ['semiweekly', '2025-01-15']), ('normal control', {'pay_date': [2025, 7, 15], 'lookback_total': 7386577, 'accumulated': 7242712}, ['semiweekly', '2025-07-18']), ('normal control', {'pay_date': [2025, 2, 13], 'lookback_total': 2864521, 'accumulated': 10000000}, ['next-day', '2025-02-14'])], [('regression', {'pay_date': [2025, 3, 12], 'lookback_total': 5000000, 'accumulated': 5561044}, ['monthly', '2025-04-15']), ('regression', {'pay_date': [2024, 12, 14], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2025-01-15']), ('partial-repair probe', {'pay_date': [2026, 1, 15], 'lookback_total': 5000001, 'accumulated': 128367}, ['semiweekly', '2026-01-21']), ('partial-repair probe', {'pay_date': [2025, 8, 20], 'lookback_total': 15073801, 'accumulated': 1953477}, ['semiweekly', '2025-08-27']), ('normal control', {'pay_date': [2024, 12, 22], 'lookback_total': 5000001, 'accumulated': 10000000}, ['next-day', '2024-12-23']), ('normal control', {'pay_date': [2025, 2, 28], 'lookback_total': 5934057, 'accumulated': 9999999}, ['semiweekly', '2025-03-05']), ('normal control', {'pay_date': [2025, 1, 28], 'lookback_total': 14733386, 'accumulated': 9999999}, ['semiweekly', '2025-01-31']), ('normal control', {'pay_date': [2025, 10, 25], 'lookback_total': 5000001, 'accumulated': 9999999}, ['semiweekly', '2025-10-31'])], [('regression', {'pay_date': [2024, 12, 14], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2025-01-15']), ('regression', {'pay_date': [2025, 4, 9], 'lookback_total': 5000000, 'accumulated': 17594}, ['monthly', '2025-05-15']), ('partial-repair probe', {'pay_date': [2025, 1, 28], 'lookback_total': 5000001, 'accumulated': 2892395}, ['semiweekly', '2025-01-31']), ('partial-repair probe', {'pay_date': [2025, 12, 21], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2026-01-15']), ('normal control', {'pay_date': [2025, 12, 8], 'lookback_total': 5000001, 'accumulated': 10000000}, ['next-day', '2025-12-09']), ('normal control', {'pay_date': [2026, 1, 21], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2026-01-22']), ('normal control', {'pay_date': [2025, 11, 21], 'lookback_total': 130512, 'accumulated': 10000000}, ['next-day', '2025-11-24']), ('normal control', {'pay_date': [2025, 11, 22], 'lookback_total': 19257323, 'accumulated': 9999999}, ['semiweekly', '2025-11-28'])], [('regression', {'pay_date': [2025, 12, 21], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2026-01-15']), ('regression', {'pay_date': [2025, 4, 9], 'lookback_total': 5000000, 'accumulated': 17594}, ['monthly', '2025-05-15']), ('partial-repair probe', {'pay_date': [2024, 12, 8], 'lookback_total': 7946403, 'accumulated': 200852}, ['semiweekly', '2024-12-13']), ('partial-repair probe', {'pay_date': [2025, 9, 18], 'lookback_total': 5000001, 'accumulated': 171509}, ['semiweekly', '2025-09-24']), ('normal control', {'pay_date': [2024, 11, 22], 'lookback_total': 5000001, 'accumulated': 10000000}, ['next-day', '2024-11-25']), ('normal control', {'pay_date': [2025, 4, 26], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-04-28']), ('normal control', {'pay_date': [2025, 10, 18], 'lookback_total': 17305535, 'accumulated': 10000000}, ['next-day', '2025-10-20']), ('normal control', {'pay_date': [2025, 4, 28], 'lookback_total': 5000001, 'accumulated': 9999999}, ['semiweekly', '2025-05-02'])]]
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
import datetime
N = 1
observations = []
def solve(x):
    d = datetime.date(*x['pay_date'])
    if x['accumulated'] >= 10000000:
        nd = d + datetime.timedelta(days=1)
        while nd.weekday() >= 5:
            nd += datetime.timedelta(days=1)
        return ['next-day', nd.isoformat()]
    if x['accumulated'] <= 5000000:
        y, m = (d.year + 1, 1) if d.month == 12 else (d.year, d.month + 1)
        return ['monthly', datetime.date(y, m, 15).isoformat()]
    wd = d.weekday()
    if wd in (2, 3, 4):
        delta = (2 - wd) % 7 or 7
    else:
        delta = (4 - wd) % 7
    return ['semiweekly', (d + datetime.timedelta(days=delta)).isoformat()]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'pay_date': [2025, 7, 24], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2025-08-15']), ('regression', {'pay_date': [2025, 11, 30], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2025-12-15']), ('partial-repair probe', {'pay_date': [2025, 7, 23], 'lookback_total': 4030366, 'accumulated': 7676976}, ['monthly', '2025-08-15']), ('partial-repair probe', {'pay_date': [2025, 3, 12], 'lookback_total': 5000000, 'accumulated': 5561044}, ['monthly', '2025-04-15']), ('normal control', {'pay_date': [2026, 1, 10], 'lookback_total': 8559426, 'accumulated': 10000000}, ['next-day', '2026-01-12']), ('normal control', {'pay_date': [2025, 10, 17], 'lookback_total': 5000001, 'accumulated': 9999999}, ['semiweekly', '2025-10-22']), ('normal control', {'pay_date': [2025, 7, 6], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-07-07']), ('normal control', {'pay_date': [2026, 1, 1], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2026-01-02'])], [('regression', {'pay_date': [2025, 11, 30], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2025-12-15']), ('regression', {'pay_date': [2025, 3, 12], 'lookback_total': 5000000, 'accumulated': 5561044}, ['monthly', '2025-04-15']), ('partial-repair probe', {'pay_date': [2026, 1, 15], 'lookback_total': 5000001, 'accumulated': 128367}, ['semiweekly', '2026-01-21']), ('partial-repair probe', {'pay_date': [2025, 8, 20], 'lookback_total': 15073801, 'accumulated': 1953477}, ['semiweekly', '2025-08-27']), ('normal control', {'pay_date': [2025, 7, 12], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-07-14']), ('normal control', {'pay_date': [2025, 1, 9], 'lookback_total': 5000001, 'accumulated': 9999999}, ['semiweekly', '2025-01-15']), ('normal control', {'pay_date': [2025, 7, 15], 'lookback_total': 7386577, 'accumulated': 7242712}, ['semiweekly', '2025-07-18']), ('normal control', {'pay_date': [2025, 2, 13], 'lookback_total': 2864521, 'accumulated': 10000000}, ['next-day', '2025-02-14'])], [('regression', {'pay_date': [2025, 3, 12], 'lookback_total': 5000000, 'accumulated': 5561044}, ['monthly', '2025-04-15']), ('regression', {'pay_date': [2024, 12, 14], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2025-01-15']), ('partial-repair probe', {'pay_date': [2026, 1, 15], 'lookback_total': 5000001, 'accumulated': 128367}, ['semiweekly', '2026-01-21']), ('partial-repair probe', {'pay_date': [2025, 8, 20], 'lookback_total': 15073801, 'accumulated': 1953477}, ['semiweekly', '2025-08-27']), ('normal control', {'pay_date': [2024, 12, 22], 'lookback_total': 5000001, 'accumulated': 10000000}, ['next-day', '2024-12-23']), ('normal control', {'pay_date': [2025, 2, 28], 'lookback_total': 5934057, 'accumulated': 9999999}, ['semiweekly', '2025-03-05']), ('normal control', {'pay_date': [2025, 1, 28], 'lookback_total': 14733386, 'accumulated': 9999999}, ['semiweekly', '2025-01-31']), ('normal control', {'pay_date': [2025, 10, 25], 'lookback_total': 5000001, 'accumulated': 9999999}, ['semiweekly', '2025-10-31'])], [('regression', {'pay_date': [2024, 12, 14], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2025-01-15']), ('regression', {'pay_date': [2025, 4, 9], 'lookback_total': 5000000, 'accumulated': 17594}, ['monthly', '2025-05-15']), ('partial-repair probe', {'pay_date': [2025, 1, 28], 'lookback_total': 5000001, 'accumulated': 2892395}, ['semiweekly', '2025-01-31']), ('partial-repair probe', {'pay_date': [2025, 12, 21], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2026-01-15']), ('normal control', {'pay_date': [2025, 12, 8], 'lookback_total': 5000001, 'accumulated': 10000000}, ['next-day', '2025-12-09']), ('normal control', {'pay_date': [2026, 1, 21], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2026-01-22']), ('normal control', {'pay_date': [2025, 11, 21], 'lookback_total': 130512, 'accumulated': 10000000}, ['next-day', '2025-11-24']), ('normal control', {'pay_date': [2025, 11, 22], 'lookback_total': 19257323, 'accumulated': 9999999}, ['semiweekly', '2025-11-28'])], [('regression', {'pay_date': [2025, 12, 21], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2026-01-15']), ('regression', {'pay_date': [2025, 4, 9], 'lookback_total': 5000000, 'accumulated': 17594}, ['monthly', '2025-05-15']), ('partial-repair probe', {'pay_date': [2024, 12, 8], 'lookback_total': 7946403, 'accumulated': 200852}, ['semiweekly', '2024-12-13']), ('partial-repair probe', {'pay_date': [2025, 9, 18], 'lookback_total': 5000001, 'accumulated': 171509}, ['semiweekly', '2025-09-24']), ('normal control', {'pay_date': [2024, 11, 22], 'lookback_total': 5000001, 'accumulated': 10000000}, ['next-day', '2024-11-25']), ('normal control', {'pay_date': [2025, 4, 26], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-04-28']), ('normal control', {'pay_date': [2025, 10, 18], 'lookback_total': 17305535, 'accumulated': 10000000}, ['next-day', '2025-10-20']), ('normal control', {'pay_date': [2025, 4, 28], 'lookback_total': 5000001, 'accumulated': 9999999}, ['semiweekly', '2025-05-02'])]]
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:
Employers with exactly 50,000 of lookback liability are put on the semiweekly schedule.

Input {pay_date, lookback_total, accumulated}. If accumulated liability is 100,000.00 or more, deposit the next weekday after pay date. Else if lookback liability is 50,000.00 or less, deposit monthly by the 15th of the following month. Else semiweekly: Wed/Thu/Fri paydays deposit the following Wednesday; Sat-Tue paydays the following Friday. Return [schedule, ISO due date].

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import datetime
N = 1
observations = []
def solve(x):
    d = datetime.date(*x['pay_date'])
    if x['accumulated'] >= 10000000:
        nd = d + datetime.timedelta(days=1)
        while nd.weekday() >= 5:
            nd += datetime.timedelta(days=1)
        return ['next-day', nd.isoformat()]
    if x['lookback_total'] <= 5000000:
        y, m = (d.year, d.month % 12 + 1)
        return ['monthly', datetime.date(y, m, 15).isoformat()]
    wd = d.weekday()
    if wd in (2, 3, 4):
        delta = (2 - wd) % 7 or 7
    else:
        delta = (4 - wd) % 7
    return ['semiweekly', (d + datetime.timedelta(days=delta)).isoformat()]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'pay_date': [2024, 12, 14], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2025-01-15']), ('regression', {'pay_date': [2025, 12, 21], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2026-01-15']), ('partial-repair probe', {'pay_date': [2025, 12, 19], 'lookback_total': 5000000, 'accumulated': 7856645}, ['monthly', '2026-01-15']), ('partial-repair probe', {'pay_date': [2024, 12, 2], 'lookback_total': 5000000, 'accumulated': 127118}, ['monthly', '2025-01-15']), ('normal control', {'pay_date': [2025, 7, 24], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2025-08-15']), ('normal control', {'pay_date': [2025, 7, 23], 'lookback_total': 4030366, 'accumulated': 7676976}, ['monthly', '2025-08-15']), ('normal control', {'pay_date': [2026, 1, 10], 'lookback_total': 8559426, 'accumulated': 10000000}, ['next-day', '2026-01-12']), ('normal control', {'pay_date': [2025, 11, 30], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2025-12-15'])], [('regression', {'pay_date': [2025, 12, 21], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2026-01-15']), ('regression', {'pay_date': [2025, 12, 19], 'lookback_total': 5000000, 'accumulated': 7856645}, ['monthly', '2026-01-15']), ('partial-repair probe', {'pay_date': [2024, 12, 2], 'lookback_total': 5000000, 'accumulated': 127118}, ['monthly', '2025-01-15']), ('partial-repair probe', {'pay_date': [2025, 12, 14], 'lookback_total': 5000000, 'accumulated': 73540}, ['monthly', '2026-01-15']), ('normal control', {'pay_date': [2025, 10, 17], 'lookback_total': 5000001, 'accumulated': 9999999}, ['semiweekly', '2025-10-22']), ('normal control', {'pay_date': [2025, 3, 12], 'lookback_total': 5000000, 'accumulated': 5561044}, ['monthly', '2025-04-15']), ('normal control', {'pay_date': [2025, 7, 6], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-07-07']), ('normal control', {'pay_date': [2026, 1, 1], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2026-01-02'])], [('regression', {'pay_date': [2025, 12, 19], 'lookback_total': 5000000, 'accumulated': 7856645}, ['monthly', '2026-01-15']), ('regression', {'pay_date': [2024, 12, 2], 'lookback_total': 5000000, 'accumulated': 127118}, ['monthly', '2025-01-15']), ('partial-repair probe', {'pay_date': [2025, 12, 14], 'lookback_total': 5000000, 'accumulated': 73540}, ['monthly', '2026-01-15']), ('partial-repair probe', {'pay_date': [2024, 12, 17], 'lookback_total': 5000000, 'accumulated': 3795275}, ['monthly', '2025-01-15']), ('normal control', {'pay_date': [2025, 7, 12], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-07-14']), ('normal control', {'pay_date': [2026, 1, 15], 'lookback_total': 5000001, 'accumulated': 128367}, ['semiweekly', '2026-01-21']), ('normal control', {'pay_date': [2025, 8, 20], 'lookback_total': 15073801, 'accumulated': 1953477}, ['semiweekly', '2025-08-27']), ('normal control', {'pay_date': [2025, 4, 9], 'lookback_total': 5000000, 'accumulated': 17594}, ['monthly', '2025-05-15'])], [('regression', {'pay_date': [2024, 12, 2], 'lookback_total': 5000000, 'accumulated': 127118}, ['monthly', '2025-01-15']), ('regression', {'pay_date': [2025, 12, 14], 'lookback_total': 5000000, 'accumulated': 73540}, ['monthly', '2026-01-15']), ('partial-repair probe', {'pay_date': [2025, 12, 7], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2026-01-15']), ('partial-repair probe', {'pay_date': [2025, 12, 18], 'lookback_total': 5000000, 'accumulated': 29188}, ['monthly', '2026-01-15']), ('normal control', {'pay_date': [2025, 1, 28], 'lookback_total': 5000001, 'accumulated': 2892395}, ['semiweekly', '2025-01-31']), ('normal control', {'pay_date': [2026, 1, 11], 'lookback_total': 5000000, 'accumulated': 106033}, ['monthly', '2026-02-15']), ('normal control', {'pay_date': [2025, 1, 9], 'lookback_total': 5000001, 'accumulated': 9999999}, ['semiweekly', '2025-01-15']), ('normal control', {'pay_date': [2024, 12, 8], 'lookback_total': 7946403, 'accumulated': 200852}, ['semiweekly', '2024-12-13'])], [('regression', {'pay_date': [2025, 12, 14], 'lookback_total': 5000000, 'accumulated': 73540}, ['monthly', '2026-01-15']), ('regression', {'pay_date': [2024, 12, 17], 'lookback_total': 5000000, 'accumulated': 3795275}, ['monthly', '2025-01-15']), ('partial-repair probe', {'pay_date': [2024, 12, 31], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2025-01-15']), ('partial-repair probe', {'pay_date': [2024, 12, 13], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2025-01-15']), ('normal control', {'pay_date': [2025, 9, 18], 'lookback_total': 5000001, 'accumulated': 171509}, ['semiweekly', '2025-09-24']), ('normal control', {'pay_date': [2024, 12, 27], 'lookback_total': 14968828, 'accumulated': 48129}, ['semiweekly', '2025-01-01']), ('normal control', {'pay_date': [2025, 7, 15], 'lookback_total': 7386577, 'accumulated': 7242712}, ['semiweekly', '2025-07-18']), ('normal control', {'pay_date': [2025, 6, 8], 'lookback_total': 5000001, 'accumulated': 136142}, ['semiweekly', '2025-06-13'])]]
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
import datetime
N = 1
observations = []
def solve(x):
    d = datetime.date(*x['pay_date'])
    if x['accumulated'] >= 10000000:
        nd = d + datetime.timedelta(days=1)
        while nd.weekday() >= 5:
            nd += datetime.timedelta(days=1)
        return ['next-day', nd.isoformat()]
    if x['lookback_total'] <= 5000000:
        y, m = (d.year, 1) if d.month == 12 else (d.year, d.month + 1)
        return ['monthly', datetime.date(y, m, 15).isoformat()]
    wd = d.weekday()
    if wd in (2, 3, 4):
        delta = (2 - wd) % 7 or 7
    else:
        delta = (4 - wd) % 7
    return ['semiweekly', (d + datetime.timedelta(days=delta)).isoformat()]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'pay_date': [2024, 12, 14], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2025-01-15']), ('regression', {'pay_date': [2025, 12, 21], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2026-01-15']), ('partial-repair probe', {'pay_date': [2025, 12, 19], 'lookback_total': 5000000, 'accumulated': 7856645}, ['monthly', '2026-01-15']), ('partial-repair probe', {'pay_date': [2024, 12, 2], 'lookback_total': 5000000, 'accumulated': 127118}, ['monthly', '2025-01-15']), ('normal control', {'pay_date': [2025, 7, 24], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2025-08-15']), ('normal control', {'pay_date': [2025, 7, 23], 'lookback_total': 4030366, 'accumulated': 7676976}, ['monthly', '2025-08-15']), ('normal control', {'pay_date': [2026, 1, 10], 'lookback_total': 8559426, 'accumulated': 10000000}, ['next-day', '2026-01-12']), ('normal control', {'pay_date': [2025, 11, 30], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2025-12-15'])], [('regression', {'pay_date': [2025, 12, 21], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2026-01-15']), ('regression', {'pay_date': [2025, 12, 19], 'lookback_total': 5000000, 'accumulated': 7856645}, ['monthly', '2026-01-15']), ('partial-repair probe', {'pay_date': [2024, 12, 2], 'lookback_total': 5000000, 'accumulated': 127118}, ['monthly', '2025-01-15']), ('partial-repair probe', {'pay_date': [2025, 12, 14], 'lookback_total': 5000000, 'accumulated': 73540}, ['monthly', '2026-01-15']), ('normal control', {'pay_date': [2025, 10, 17], 'lookback_total': 5000001, 'accumulated': 9999999}, ['semiweekly', '2025-10-22']), ('normal control', {'pay_date': [2025, 3, 12], 'lookback_total': 5000000, 'accumulated': 5561044}, ['monthly', '2025-04-15']), ('normal control', {'pay_date': [2025, 7, 6], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-07-07']), ('normal control', {'pay_date': [2026, 1, 1], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2026-01-02'])], [('regression', {'pay_date': [2025, 12, 19], 'lookback_total': 5000000, 'accumulated': 7856645}, ['monthly', '2026-01-15']), ('regression', {'pay_date': [2024, 12, 2], 'lookback_total': 5000000, 'accumulated': 127118}, ['monthly', '2025-01-15']), ('partial-repair probe', {'pay_date': [2025, 12, 14], 'lookback_total': 5000000, 'accumulated': 73540}, ['monthly', '2026-01-15']), ('partial-repair probe', {'pay_date': [2024, 12, 17], 'lookback_total': 5000000, 'accumulated': 3795275}, ['monthly', '2025-01-15']), ('normal control', {'pay_date': [2025, 7, 12], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-07-14']), ('normal control', {'pay_date': [2026, 1, 15], 'lookback_total': 5000001, 'accumulated': 128367}, ['semiweekly', '2026-01-21']), ('normal control', {'pay_date': [2025, 8, 20], 'lookback_total': 15073801, 'accumulated': 1953477}, ['semiweekly', '2025-08-27']), ('normal control', {'pay_date': [2025, 4, 9], 'lookback_total': 5000000, 'accumulated': 17594}, ['monthly', '2025-05-15'])], [('regression', {'pay_date': [2024, 12, 2], 'lookback_total': 5000000, 'accumulated': 127118}, ['monthly', '2025-01-15']), ('regression', {'pay_date': [2025, 12, 14], 'lookback_total': 5000000, 'accumulated': 73540}, ['monthly', '2026-01-15']), ('partial-repair probe', {'pay_date': [2025, 12, 7], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2026-01-15']), ('partial-repair probe', {'pay_date': [2025, 12, 18], 'lookback_total': 5000000, 'accumulated': 29188}, ['monthly', '2026-01-15']), ('normal control', {'pay_date': [2025, 1, 28], 'lookback_total': 5000001, 'accumulated': 2892395}, ['semiweekly', '2025-01-31']), ('normal control', {'pay_date': [2026, 1, 11], 'lookback_total': 5000000, 'accumulated': 106033}, ['monthly', '2026-02-15']), ('normal control', {'pay_date': [2025, 1, 9], 'lookback_total': 5000001, 'accumulated': 9999999}, ['semiweekly', '2025-01-15']), ('normal control', {'pay_date': [2024, 12, 8], 'lookback_total': 7946403, 'accumulated': 200852}, ['semiweekly', '2024-12-13'])], [('regression', {'pay_date': [2025, 12, 14], 'lookback_total': 5000000, 'accumulated': 73540}, ['monthly', '2026-01-15']), ('regression', {'pay_date': [2024, 12, 17], 'lookback_total': 5000000, 'accumulated': 3795275}, ['monthly', '2025-01-15']), ('partial-repair probe', {'pay_date': [2024, 12, 31], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2025-01-15']), ('partial-repair probe', {'pay_date': [2024, 12, 13], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2025-01-15']), ('normal control', {'pay_date': [2025, 9, 18], 'lookback_total': 5000001, 'accumulated': 171509}, ['semiweekly', '2025-09-24']), ('normal control', {'pay_date': [2024, 12, 27], 'lookback_total': 14968828, 'accumulated': 48129}, ['semiweekly', '2025-01-01']), ('normal control', {'pay_date': [2025, 7, 15], 'lookback_total': 7386577, 'accumulated': 7242712}, ['semiweekly', '2025-07-18']), ('normal control', {'pay_date': [2025, 6, 8], 'lookback_total': 5000001, 'accumulated': 136142}, ['semiweekly', '2025-06-13'])]]
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:
December monthly deposits are dated January of the same year.

Input {pay_date, lookback_total, accumulated}. If accumulated liability is 100,000.00 or more, deposit the next weekday after pay date. Else if lookback liability is 50,000.00 or less, deposit monthly by the 15th of the following month. Else semiweekly: Wed/Thu/Fri paydays deposit the following Wednesday; Sat-Tue paydays the following Friday. Return [schedule, ISO due date].

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import datetime
N = 1
observations = []
def solve(x):
    d = datetime.date(*x['pay_date'])
    if x['accumulated'] >= 10000000:
        nd = d + datetime.timedelta(days=1)
        while nd.weekday() >= 5:
            nd += datetime.timedelta(days=1)
        return ['next-day', nd.isoformat()]
    if x['lookback_total'] <= 5000000:
        y, m = (d.year + 1, 1) if d.month == 12 else (d.year, d.month + 1)
        return ['monthly', datetime.date(y, m, 15).isoformat()]
    wd = d.weekday()
    if wd in (2, 3, 4):
        delta = (2 - wd) % 7
    else:
        delta = (4 - wd) % 7
    return ['semiweekly', (d + datetime.timedelta(days=delta)).isoformat()]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'pay_date': [2025, 8, 20], 'lookback_total': 15073801, 'accumulated': 1953477}, ['semiweekly', '2025-08-27']), ('regression', {'pay_date': [2025, 4, 9], 'lookback_total': 12054037, 'accumulated': 2326539}, ['semiweekly', '2025-04-16']), ('partial-repair probe', {'pay_date': [2025, 10, 17], 'lookback_total': 5000001, 'accumulated': 9999999}, ['semiweekly', '2025-10-22']), ('partial-repair probe', {'pay_date': [2026, 1, 15], 'lookback_total': 5000001, 'accumulated': 128367}, ['semiweekly', '2026-01-21']), ('normal control', {'pay_date': [2025, 7, 24], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2025-08-15']), ('normal control', {'pay_date': [2025, 7, 23], 'lookback_total': 4030366, 'accumulated': 7676976}, ['monthly', '2025-08-15']), ('normal control', {'pay_date': [2026, 1, 10], 'lookback_total': 8559426, 'accumulated': 10000000}, ['next-day', '2026-01-12']), ('normal control', {'pay_date': [2025, 11, 30], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2025-12-15'])], [('regression', {'pay_date': [2025, 4, 9], 'lookback_total': 12054037, 'accumulated': 2326539}, ['semiweekly', '2025-04-16']), ('regression', {'pay_date': [2025, 4, 2], 'lookback_total': 15830756, 'accumulated': 9999999}, ['semiweekly', '2025-04-09']), ('partial-repair probe', {'pay_date': [2025, 1, 9], 'lookback_total': 5000001, 'accumulated': 9999999}, ['semiweekly', '2025-01-15']), ('partial-repair probe', {'pay_date': [2025, 9, 18], 'lookback_total': 5000001, 'accumulated': 171509}, ['semiweekly', '2025-09-24']), ('normal control', {'pay_date': [2025, 3, 12], 'lookback_total': 5000000, 'accumulated': 5561044}, ['monthly', '2025-04-15']), ('normal control', {'pay_date': [2025, 7, 6], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-07-07']), ('normal control', {'pay_date': [2026, 1, 1], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2026-01-02']), ('normal control', {'pay_date': [2025, 7, 12], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-07-14'])], [('regression', {'pay_date': [2025, 4, 2], 'lookback_total': 15830756, 'accumulated': 9999999}, ['semiweekly', '2025-04-09']), ('regression', {'pay_date': [2025, 5, 7], 'lookback_total': 5000001, 'accumulated': 9999999}, ['semiweekly', '2025-05-14']), ('partial-repair probe', {'pay_date': [2024, 12, 27], 'lookback_total': 14968828, 'accumulated': 48129}, ['semiweekly', '2025-01-01']), ('partial-repair probe', {'pay_date': [2025, 2, 28], 'lookback_total': 5934057, 'accumulated': 9999999}, ['semiweekly', '2025-03-05']), ('normal control', {'pay_date': [2024, 12, 14], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2025-01-15']), ('normal control', {'pay_date': [2025, 4, 9], 'lookback_total': 5000000, 'accumulated': 17594}, ['monthly', '2025-05-15']), ('normal control', {'pay_date': [2025, 1, 28], 'lookback_total': 5000001, 'accumulated': 2892395}, ['semiweekly', '2025-01-31']), ('normal control', {'pay_date': [2026, 1, 11], 'lookback_total': 5000000, 'accumulated': 106033}, ['monthly', '2026-02-15'])], [('regression', {'pay_date': [2025, 5, 7], 'lookback_total': 5000001, 'accumulated': 9999999}, ['semiweekly', '2025-05-14']), ('regression', {'pay_date': [2025, 6, 18], 'lookback_total': 5000001, 'accumulated': 9999999}, ['semiweekly', '2025-06-25']), ('partial-repair probe', {'pay_date': [2024, 12, 12], 'lookback_total': 5000001, 'accumulated': 126127}, ['semiweekly', '2024-12-18']), ('partial-repair probe', {'pay_date': [2025, 5, 9], 'lookback_total': 14538348, 'accumulated': 95659}, ['semiweekly', '2025-05-14']), ('normal control', {'pay_date': [2025, 12, 21], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2026-01-15']), ('normal control', {'pay_date': [2024, 12, 8], 'lookback_total': 7946403, 'accumulated': 200852}, ['semiweekly', '2024-12-13']), ('normal control', {'pay_date': [2025, 7, 15], 'lookback_total': 7386577, 'accumulated': 7242712}, ['semiweekly', '2025-07-18']), ('normal control', {'pay_date': [2025, 6, 8], 'lookback_total': 5000001, 'accumulated': 136142}, ['semiweekly', '2025-06-13'])], [('regression', {'pay_date': [2025, 6, 18], 'lookback_total': 5000001, 'accumulated': 9999999}, ['semiweekly', '2025-06-25']), ('regression', {'pay_date': [2025, 4, 23], 'lookback_total': 5000001, 'accumulated': 9999999}, ['semiweekly', '2025-04-30']), ('partial-repair probe', {'pay_date': [2025, 4, 24], 'lookback_total': 5000001, 'accumulated': 59984}, ['semiweekly', '2025-04-30']), ('partial-repair probe', {'pay_date': [2026, 2, 5], 'lookback_total': 13040571, 'accumulated': 9999999}, ['semiweekly', '2026-02-11']), ('normal control', {'pay_date': [2025, 2, 13], 'lookback_total': 2864521, 'accumulated': 10000000}, ['next-day', '2025-02-14']), ('normal control', {'pay_date': [2024, 12, 22], 'lookback_total': 5000001, 'accumulated': 10000000}, ['next-day', '2024-12-23']), ('normal control', {'pay_date': [2025, 1, 28], 'lookback_total': 14733386, 'accumulated': 9999999}, ['semiweekly', '2025-01-31']), ('normal control', {'pay_date': [2025, 10, 25], 'lookback_total': 5000001, 'accumulated': 9999999}, ['semiweekly', '2025-10-31'])]]
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
import datetime
N = 1
observations = []
def solve(x):
    d = datetime.date(*x['pay_date'])
    if x['accumulated'] >= 10000000:
        nd = d + datetime.timedelta(days=1)
        while nd.weekday() >= 5:
            nd += datetime.timedelta(days=1)
        return ['next-day', nd.isoformat()]
    if x['lookback_total'] <= 5000000:
        y, m = (d.year + 1, 1) if d.month == 12 else (d.year, d.month + 1)
        return ['monthly', datetime.date(y, m, 15).isoformat()]
    wd = d.weekday()
    if wd in (2, 3, 4):
        delta = (2 - wd) % 7 + 7
    else:
        delta = (4 - wd) % 7
    return ['semiweekly', (d + datetime.timedelta(days=delta)).isoformat()]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'pay_date': [2025, 8, 20], 'lookback_total': 15073801, 'accumulated': 1953477}, ['semiweekly', '2025-08-27']), ('regression', {'pay_date': [2025, 4, 9], 'lookback_total': 12054037, 'accumulated': 2326539}, ['semiweekly', '2025-04-16']), ('partial-repair probe', {'pay_date': [2025, 10, 17], 'lookback_total': 5000001, 'accumulated': 9999999}, ['semiweekly', '2025-10-22']), ('partial-repair probe', {'pay_date': [2026, 1, 15], 'lookback_total': 5000001, 'accumulated': 128367}, ['semiweekly', '2026-01-21']), ('normal control', {'pay_date': [2025, 7, 24], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2025-08-15']), ('normal control', {'pay_date': [2025, 7, 23], 'lookback_total': 4030366, 'accumulated': 7676976}, ['monthly', '2025-08-15']), ('normal control', {'pay_date': [2026, 1, 10], 'lookback_total': 8559426, 'accumulated': 10000000}, ['next-day', '2026-01-12']), ('normal control', {'pay_date': [2025, 11, 30], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2025-12-15'])], [('regression', {'pay_date': [2025, 4, 9], 'lookback_total': 12054037, 'accumulated': 2326539}, ['semiweekly', '2025-04-16']), ('regression', {'pay_date': [2025, 4, 2], 'lookback_total': 15830756, 'accumulated': 9999999}, ['semiweekly', '2025-04-09']), ('partial-repair probe', {'pay_date': [2025, 1, 9], 'lookback_total': 5000001, 'accumulated': 9999999}, ['semiweekly', '2025-01-15']), ('partial-repair probe', {'pay_date': [2025, 9, 18], 'lookback_total': 5000001, 'accumulated': 171509}, ['semiweekly', '2025-09-24']), ('normal control', {'pay_date': [2025, 3, 12], 'lookback_total': 5000000, 'accumulated': 5561044}, ['monthly', '2025-04-15']), ('normal control', {'pay_date': [2025, 7, 6], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-07-07']), ('normal control', {'pay_date': [2026, 1, 1], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2026-01-02']), ('normal control', {'pay_date': [2025, 7, 12], 'lookback_total': 5000000, 'accumulated': 10000000}, ['next-day', '2025-07-14'])], [('regression', {'pay_date': [2025, 4, 2], 'lookback_total': 15830756, 'accumulated': 9999999}, ['semiweekly', '2025-04-09']), ('regression', {'pay_date': [2025, 5, 7], 'lookback_total': 5000001, 'accumulated': 9999999}, ['semiweekly', '2025-05-14']), ('partial-repair probe', {'pay_date': [2024, 12, 27], 'lookback_total': 14968828, 'accumulated': 48129}, ['semiweekly', '2025-01-01']), ('partial-repair probe', {'pay_date': [2025, 2, 28], 'lookback_total': 5934057, 'accumulated': 9999999}, ['semiweekly', '2025-03-05']), ('normal control', {'pay_date': [2024, 12, 14], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2025-01-15']), ('normal control', {'pay_date': [2025, 4, 9], 'lookback_total': 5000000, 'accumulated': 17594}, ['monthly', '2025-05-15']), ('normal control', {'pay_date': [2025, 1, 28], 'lookback_total': 5000001, 'accumulated': 2892395}, ['semiweekly', '2025-01-31']), ('normal control', {'pay_date': [2026, 1, 11], 'lookback_total': 5000000, 'accumulated': 106033}, ['monthly', '2026-02-15'])], [('regression', {'pay_date': [2025, 5, 7], 'lookback_total': 5000001, 'accumulated': 9999999}, ['semiweekly', '2025-05-14']), ('regression', {'pay_date': [2025, 6, 18], 'lookback_total': 5000001, 'accumulated': 9999999}, ['semiweekly', '2025-06-25']), ('partial-repair probe', {'pay_date': [2024, 12, 12], 'lookback_total': 5000001, 'accumulated': 126127}, ['semiweekly', '2024-12-18']), ('partial-repair probe', {'pay_date': [2025, 5, 9], 'lookback_total': 14538348, 'accumulated': 95659}, ['semiweekly', '2025-05-14']), ('normal control', {'pay_date': [2025, 12, 21], 'lookback_total': 5000000, 'accumulated': 9999999}, ['monthly', '2026-01-15']), ('normal control', {'pay_date': [2024, 12, 8], 'lookback_total': 7946403, 'accumulated': 200852}, ['semiweekly', '2024-12-13']), ('normal control', {'pay_date': [2025, 7, 15], 'lookback_total': 7386577, 'accumulated': 7242712}, ['semiweekly', '2025-07-18']), ('normal control', {'pay_date': [2025, 6, 8], 'lookback_total': 5000001, 'accumulated': 136142}, ['semiweekly', '2025-06-13'])], [('regression', {'pay_date': [2025, 6, 18], 'lookback_total': 5000001, 'accumulated': 9999999}, ['semiweekly', '2025-06-25']), ('regression', {'pay_date': [2025, 4, 23], 'lookback_total': 5000001, 'accumulated': 9999999}, ['semiweekly', '2025-04-30']), ('partial-repair probe', {'pay_date': [2025, 4, 24], 'lookback_total': 5000001, 'accumulated': 59984}, ['semiweekly', '2025-04-30']), ('partial-repair probe', {'pay_date': [2026, 2, 5], 'lookback_total': 13040571, 'accumulated': 9999999}, ['semiweekly', '2026-02-11']), ('normal control', {'pay_date': [2025, 2, 13], 'lookback_total': 2864521, 'accumulated': 10000000}, ['next-day', '2025-02-14']), ('normal control', {'pay_date': [2024, 12, 22], 'lookback_total': 5000001, 'accumulated': 10000000}, ['next-day', '2024-12-23']), ('normal control', {'pay_date': [2025, 1, 28], 'lookback_total': 14733386, 'accumulated': 9999999}, ['semiweekly', '2025-01-31']), ('normal control', {'pay_date': [2025, 10, 25], 'lookback_total': 5000001, 'accumulated': 9999999}, ['semiweekly', '2025-10-31'])]]
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:
Wednesday paydays show the deposit due the same day.

Input {pay_date, lookback_total, accumulated}. If accumulated liability is 100,000.00 or more, deposit the next weekday after pay date. Else if lookback liability is 50,000.00 or less, deposit monthly by the 15th of the following month. Else semiweekly: Wed/Thu/Fri paydays deposit the following Wednesday; Sat-Tue paydays the following Friday. Return [schedule, ISO due date].

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
import math
N = 1
observations = []
def solve(x):
    target = Fraction(x['receipts'] * 8, 100)
    reported = sum(e[2] for e in x['staff'])
    short = target - reported
    if short <= 0:
        return {}
    hours_total = sum(e[1] for e in x['staff'])
    deficits = {}
    for name, hrs, rep in x['staff']:
        share = target * hrs / hours_total
        if rep < share:
            deficits[name] = share - rep
    dsum = sum(deficits.values())
    out = {}
    for name, d in deficits.items():
        out[name] = math.floor(d + Fraction(1, 2))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'receipts': 377533, 'staff': [['ben', 14, 0], ['eli', 20, 18063], ['dee', 33, 0]]}, {'ben': 3616, 'dee': 8524}), ('regression', {'receipts': 1565828, 'staff': [['eli', 40, 65745], ['cy', 29, 58626]]}, {'eli': 895}), ('partial-repair probe', {'receipts': 1926229, 'staff': [['dee', 20, 0], ['eli', 23, 0], ['ben', 15, 23516], ['ana', 9, 0]]}, {'dee': 45999, 'eli': 52899, 'ben': 10984, 'ana': 20700}), ('partial-repair probe', {'receipts': 580998, 'staff': [['ana', 8, 0], ['ben', 25, 18228]]}, {'ana': 11268, 'ben': 16984}), ('normal control', {'receipts': 296732, 'staff': [['cy', 31, 25635], ['ben', 23, 0], ['ana', 23, 0]]}, {}), ('normal control', {'receipts': 550244, 'staff': [['cy', 19, 57024]]}, {}), ('normal control', {'receipts': 831709, 'staff': [['eli', 25, 0], ['dee', 27, 33872], ['cy', 8, 38931], ['ben', 2, 0]]}, {}), ('normal control', {'receipts': 1484874, 'staff': [['cy', 38, 0], ['dee', 4, 11025], ['eli', 23, 61900], ['ana', 1, 55590]]}, {})], [('regression', {'receipts': 860512, 'staff': [['ben', 24, 0], ['cy', 32, 35203], ['dee', 34, 0]]}, {'ben': 13919, 'dee': 19719}), ('regression', {'receipts': 2631747, 'staff': [['eli', 6, 73067], ['ana', 26, 49452], ['cy', 10, 52106]]}, {'ana': 35915}), ('partial-repair probe', {'receipts': 2678857, 'staff': [['ana', 8, 35721], ['ben', 20, 0]]}, {'ana': 25510, 'ben': 153078}), ('partial-repair probe', {'receipts': 213918, 'staff': [['ben', 40, 0], ['dee', 37, 0]]}, {'ben': 8890, 'dee': 8223}), ('normal control', {'receipts': 414394, 'staff': [['ben', 30, 72971], ['dee', 11, 50779], ['cy', 12, 57744], ['ana', 33, 0], ['eli', 37, 0]]}, {}), ('normal control', {'receipts': 15877, 'staff': [['dee', 2, 0], ['ben', 29, 36864], ['cy', 36, 367]]}, {}), ('normal control', {'receipts': 1019554, 'staff': [['dee', 11, 0]]}, {'dee': 81564}), ('normal control', {'receipts': 325470, 'staff': [['ana', 24, 0], ['dee', 18, 39572]]}, {})], [('regression', {'receipts': 1413750, 'staff': [['cy', 38, 0], ['ben', 3, 12688], ['dee', 7, 0], ['eli', 19, 4470], ['ana', 16, 16347]]}, {'cy': 46731, 'dee': 8608, 'eli': 19332, 'ana': 4923}), ('regression', {'receipts': 377533, 'staff': [['ben', 14, 0], ['eli', 20, 18063], ['dee', 33, 0]]}, {'ben': 3616, 'dee': 8524}), ('partial-repair probe', {'receipts': 789350, 'staff': [['dee', 24, 0], ['ben', 32, 0], ['cy', 33, 0], ['ana', 25, 0]]}, {'dee': 13294, 'ben': 17726, 'cy': 18280, 'ana': 13848}), ('partial-repair probe', {'receipts': 2458851, 'staff': [['cy', 31, 15683], ['ben', 27, 76376]]}, {'cy': 89454, 'ben': 15195}), ('normal control', {'receipts': 1844273, 'staff': [['ben', 6, 9908], ['cy', 2, 35253], ['dee', 0, 47647], ['eli', 24, 54448], ['ana', 19, 60962]]}, {}), ('normal control', {'receipts': 985969, 'staff': [['dee', 16, 0]]}, {'dee': 78878}), ('normal control', {'receipts': 2260421, 'staff': [['cy', 25, 0]]}, {'cy': 180834}), ('normal control', {'receipts': 305915, 'staff': [['ben', 17, 0], ['cy', 35, 49832], ['dee', 14, 0]]}, {})], [('regression', {'receipts': 1211299, 'staff': [['dee', 24, 0], ['cy', 25, 0], ['ana', 31, 56167], ['ben', 39, 0]]}, {'dee': 11110, 'cy': 11573, 'ben': 18054}), ('regression', {'receipts': 2589131, 'staff': [['cy', 0, 9383], ['ana', 9, 74166], ['dee', 1, 54844]]}, {'ana': 68737}), ('partial-repair probe', {'receipts': 2458851, 'staff': [['cy', 31, 15683], ['ben', 27, 76376]]}, {'cy': 89454, 'ben': 15195}), ('partial-repair probe', {'receipts': 1043666, 'staff': [['dee', 21, 0], ['eli', 31, 46444]]}, {'dee': 33718, 'eli': 3331}), ('normal control', {'receipts': 97470, 'staff': [['ana', 8, 0], ['eli', 19, 14113], ['dee', 6, 49117], ['ben', 0, 0], ['cy', 33, 9103]]}, {}), ('normal control', {'receipts': 1562647, 'staff': [['dee', 25, 0], ['ana', 2, 45159], ['ben', 28, 79991], ['eli', 7, 0], ['cy', 29, 0]]}, {}), ('normal control', {'receipts': 498706, 'staff': [['dee', 17, 44639], ['ana', 25, 0], ['cy', 9, 0]]}, {}), ('normal control', {'receipts': 937562, 'staff': [['eli', 3, 44205], ['ana', 5, 63945], ['dee', 2, 72206], ['cy', 27, 6437]]}, {})], [('regression', {'receipts': 936885, 'staff': [['ben', 3, 24165], ['dee', 13, 0], ['cy', 5, 0]]}, {'dee': 36679, 'cy': 14107}), ('regression', {'receipts': 2640630, 'staff': [['eli', 21, 16955], ['dee', 0, 76011]]}, {'eli': 118284}), ('partial-repair probe', {'receipts': 2921186, 'staff': [['cy', 25, 21684], ['dee', 15, 2874], ['eli', 3, 0], ['ana', 20, 0]]}, {'cy': 71052, 'dee': 52768, 'eli': 11128, 'ana': 74189}), ('partial-repair probe', {'receipts': 588846, 'staff': [['ana', 19, 0], ['cy', 28, 19233], ['eli', 8, 0]]}, {'ana': 16274, 'cy': 4749, 'eli': 6852}), ('normal control', {'receipts': 404460, 'staff': [['ben', 32, 0], ['cy', 0, 0]]}, {'ben': 32357}), ('normal control', {'receipts': 2072929, 'staff': [['dee', 16, 65338]]}, {'dee': 100496}), ('normal control', {'receipts': 2549094, 'staff': [['ben', 25, 0]]}, {'ben': 203928}), ('normal control', {'receipts': 207036, 'staff': [['ben', 34, 0], ['ana', 23, 0], ['dee', 36, 46201], ['cy', 28, 10127], ['eli', 18, 74356]]}, {})]]
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
from fractions import Fraction
import math
N = 1
observations = []
def solve(x):
    target = Fraction(x['receipts'] * 8, 100)
    reported = sum(e[2] for e in x['staff'])
    short = target - reported
    if short <= 0:
        return {}
    hours_total = sum(e[1] for e in x['staff'])
    deficits = {}
    for name, hrs, rep in x['staff']:
        share = target * hrs / hours_total
        if rep < share:
            deficits[name] = share - rep
    dsum = sum(deficits.values())
    out = {}
    for name, d in deficits.items():
        out[name] = math.floor(short / len(deficits) + Fraction(1, 2))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'receipts': 377533, 'staff': [['ben', 14, 0], ['eli', 20, 18063], ['dee', 33, 0]]}, {'ben': 3616, 'dee': 8524}), ('regression', {'receipts': 1565828, 'staff': [['eli', 40, 65745], ['cy', 29, 58626]]}, {'eli': 895}), ('partial-repair probe', {'receipts': 1926229, 'staff': [['dee', 20, 0], ['eli', 23, 0], ['ben', 15, 23516], ['ana', 9, 0]]}, {'dee': 45999, 'eli': 52899, 'ben': 10984, 'ana': 20700}), ('partial-repair probe', {'receipts': 580998, 'staff': [['ana', 8, 0], ['ben', 25, 18228]]}, {'ana': 11268, 'ben': 16984}), ('normal control', {'receipts': 296732, 'staff': [['cy', 31, 25635], ['ben', 23, 0], ['ana', 23, 0]]}, {}), ('normal control', {'receipts': 550244, 'staff': [['cy', 19, 57024]]}, {}), ('normal control', {'receipts': 831709, 'staff': [['eli', 25, 0], ['dee', 27, 33872], ['cy', 8, 38931], ['ben', 2, 0]]}, {}), ('normal control', {'receipts': 1484874, 'staff': [['cy', 38, 0], ['dee', 4, 11025], ['eli', 23, 61900], ['ana', 1, 55590]]}, {})], [('regression', {'receipts': 860512, 'staff': [['ben', 24, 0], ['cy', 32, 35203], ['dee', 34, 0]]}, {'ben': 13919, 'dee': 19719}), ('regression', {'receipts': 2631747, 'staff': [['eli', 6, 73067], ['ana', 26, 49452], ['cy', 10, 52106]]}, {'ana': 35915}), ('partial-repair probe', {'receipts': 2678857, 'staff': [['ana', 8, 35721], ['ben', 20, 0]]}, {'ana': 25510, 'ben': 153078}), ('partial-repair probe', {'receipts': 213918, 'staff': [['ben', 40, 0], ['dee', 37, 0]]}, {'ben': 8890, 'dee': 8223}), ('normal control', {'receipts': 414394, 'staff': [['ben', 30, 72971], ['dee', 11, 50779], ['cy', 12, 57744], ['ana', 33, 0], ['eli', 37, 0]]}, {}), ('normal control', {'receipts': 15877, 'staff': [['dee', 2, 0], ['ben', 29, 36864], ['cy', 36, 367]]}, {}), ('normal control', {'receipts': 1019554, 'staff': [['dee', 11, 0]]}, {'dee': 81564}), ('normal control', {'receipts': 325470, 'staff': [['ana', 24, 0], ['dee', 18, 39572]]}, {})], [('regression', {'receipts': 1413750, 'staff': [['cy', 38, 0], ['ben', 3, 12688], ['dee', 7, 0], ['eli', 19, 4470], ['ana', 16, 16347]]}, {'cy': 46731, 'dee': 8608, 'eli': 19332, 'ana': 4923}), ('regression', {'receipts': 377533, 'staff': [['ben', 14, 0], ['eli', 20, 18063], ['dee', 33, 0]]}, {'ben': 3616, 'dee': 8524}), ('partial-repair probe', {'receipts': 789350, 'staff': [['dee', 24, 0], ['ben', 32, 0], ['cy', 33, 0], ['ana', 25, 0]]}, {'dee': 13294, 'ben': 17726, 'cy': 18280, 'ana': 13848}), ('partial-repair probe', {'receipts': 2458851, 'staff': [['cy', 31, 15683], ['ben', 27, 76376]]}, {'cy': 89454, 'ben': 15195}), ('normal control', {'receipts': 1844273, 'staff': [['ben', 6, 9908], ['cy', 2, 35253], ['dee', 0, 47647], ['eli', 24, 54448], ['ana', 19, 60962]]}, {}), ('normal control', {'receipts': 985969, 'staff': [['dee', 16, 0]]}, {'dee': 78878}), ('normal control', {'receipts': 2260421, 'staff': [['cy', 25, 0]]}, {'cy': 180834}), ('normal control', {'receipts': 305915, 'staff': [['ben', 17, 0], ['cy', 35, 49832], ['dee', 14, 0]]}, {})], [('regression', {'receipts': 1211299, 'staff': [['dee', 24, 0], ['cy', 25, 0], ['ana', 31, 56167], ['ben', 39, 0]]}, {'dee': 11110, 'cy': 11573, 'ben': 18054}), ('regression', {'receipts': 2589131, 'staff': [['cy', 0, 9383], ['ana', 9, 74166], ['dee', 1, 54844]]}, {'ana': 68737}), ('partial-repair probe', {'receipts': 2458851, 'staff': [['cy', 31, 15683], ['ben', 27, 76376]]}, {'cy': 89454, 'ben': 15195}), ('partial-repair probe', {'receipts': 1043666, 'staff': [['dee', 21, 0], ['eli', 31, 46444]]}, {'dee': 33718, 'eli': 3331}), ('normal control', {'receipts': 97470, 'staff': [['ana', 8, 0], ['eli', 19, 14113], ['dee', 6, 49117], ['ben', 0, 0], ['cy', 33, 9103]]}, {}), ('normal control', {'receipts': 1562647, 'staff': [['dee', 25, 0], ['ana', 2, 45159], ['ben', 28, 79991], ['eli', 7, 0], ['cy', 29, 0]]}, {}), ('normal control', {'receipts': 498706, 'staff': [['dee', 17, 44639], ['ana', 25, 0], ['cy', 9, 0]]}, {}), ('normal control', {'receipts': 937562, 'staff': [['eli', 3, 44205], ['ana', 5, 63945], ['dee', 2, 72206], ['cy', 27, 6437]]}, {})], [('regression', {'receipts': 936885, 'staff': [['ben', 3, 24165], ['dee', 13, 0], ['cy', 5, 0]]}, {'dee': 36679, 'cy': 14107}), ('regression', {'receipts': 2640630, 'staff': [['eli', 21, 16955], ['dee', 0, 76011]]}, {'eli': 118284}), ('partial-repair probe', {'receipts': 2921186, 'staff': [['cy', 25, 21684], ['dee', 15, 2874], ['eli', 3, 0], ['ana', 20, 0]]}, {'cy': 71052, 'dee': 52768, 'eli': 11128, 'ana': 74189}), ('partial-repair probe', {'receipts': 588846, 'staff': [['ana', 19, 0], ['cy', 28, 19233], ['eli', 8, 0]]}, {'ana': 16274, 'cy': 4749, 'eli': 6852}), ('normal control', {'receipts': 404460, 'staff': [['ben', 32, 0], ['cy', 0, 0]]}, {'ben': 32357}), ('normal control', {'receipts': 2072929, 'staff': [['dee', 16, 65338]]}, {'dee': 100496}), ('normal control', {'receipts': 2549094, 'staff': [['ben', 25, 0]]}, {'ben': 203928}), ('normal control', {'receipts': 207036, 'staff': [['ben', 34, 0], ['ana', 23, 0], ['dee', 36, 46201], ['cy', 28, 10127], ['eli', 18, 74356]]}, {})]]
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:
Allocated tips add up to more than the establishment shortfall.

Input {receipts, staff: [[name, hours, reported_tips]]} with positive total hours. Target = 8% of receipts. Shortfall = target - total reported; none -> {}. Each employee's share = target*hours/total_hours; employees reporting less than their share get deficit = share - reported. Shortfall is allocated in proportion to deficits, each rounded half-up. Return {name: cents}.

split: open-access