{"abstract":"The fixed payment after the graduated years leaves most of the balance unpaid at maturity.","category":"Loan amortization schedules","checks":7,"contract":"x = {'principal', 'rate_bp', 'months', 'initial_payment', 'step_bp', 'steps'}. Month m (1-based) is in year t = (m-1)//12. For t < steps+1 the year payment starts at initial_payment and each new year multiplies the previous year payment by (10000+step_bp)/10000, rounded half-up. At the start of year steps+1 (if the loan runs that long) the payment is re-leveled on the balance over the remaining months (exact annuity, half-up) and stays fixed. Interest round_half_up(balance*bp/120000); balance += interest - payment (it may grow). Return {'year_payments', 'peak_balance', 'end_balance'}.","evaluation_group":"w2-loan-amortization-schedules-graduated-payment-steps","failed_approach":"n - m months omits the current month and overpays.","family":"w2-loan-amortization-schedules-graduated-payment-steps-re-level-term","id":"FA-58826","implementations":{"attempt":{"sha256":"172ea4670a6306ad4e6334ae47327901fd6c29517e18c6a9225a0f4f8c0e2169","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(x):\n    def rnd(n, d):\n        q, r = divmod(n, d)\n        return q + (1 if 2 * r >= d else 0)\n    def level(P, n):\n        if n <= 0 or P <= 0:\n            return 0\n        if bp == 0:\n            exact = Fraction(P, n)\n        else:\n            r = Fraction(bp, 120000)\n            exact = P * r / (1 - (1 + r) ** -n)\n        return math.floor(exact + Fraction(1, 2))\n    bp = x['rate_bp']\n    n = x['months']\n    bal = x['principal']\n    pay = x['initial_payment']\n    years = [pay]\n    peak = bal\n    for m in range(1, n + 1):\n        t = (m - 1) // 12\n        if m > 1 and (m - 1) % 12 == 0:\n            if t <= x['steps']:\n                pay = rnd(pay * (10000 + x['step_bp']), 10000)\n            elif t == x['steps'] + 1:\n                pay = level(bal, n - m)\n            years.append(pay)\n        interest = rnd(bal * bp, 120000)\n        bal += interest - pay\n        peak = max(peak, bal)\n    return {'year_payments': years, 'peak_balance': peak, 'end_balance': bal}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression: re-level term', {'principal': 250000, 'rate_bp': 900, 'months': 36, 'initial_payment': 8000, 'step_bp': 250, 'steps': 0}, {'year_payments': [8000, 7921, 7921], 'peak_balance': 250000, 'end_balance': 9}], ['control 1', {'principal': 250000, 'rate_bp': 600, 'months': 24, 'initial_payment': 3000, 'step_bp': 250, 'steps': 3}, {'year_payments': [3000, 3075], 'peak_balance': 250000, 'end_balance': 204568}], ['control 2', {'principal': 250000, 'rate_bp': 1200, 'months': 60, 'initial_payment': 20000, 'step_bp': 250, 'steps': 1}, {'year_payments': [20000, 20500, 0, 0, 0], 'peak_balance': 250000, 'end_balance': -326758}], ['control 3', {'principal': 1000000, 'rate_bp': 600, 'months': 36, 'initial_payment': 20000, 'step_bp': 750, 'steps': 2}, {'year_payments': [20000, 21500, 23113], 'peak_balance': 1000000, 'end_balance': 351915}], ['control 4', {'principal': 100000, 'rate_bp': 900, 'months': 24, 'initial_payment': 8000, 'step_bp': 250, 'steps': 2}, {'year_payments': [8000, 8200], 'peak_balance': 100000, 'end_balance': -92367}], ['control 5', {'principal': 100000, 'rate_bp': 900, 'months': 36, 'initial_payment': 500, 'step_bp': 250, 'steps': 2}, {'year_payments': [500, 513, 526], 'peak_balance': 109781, 'end_balance': 109781}], ['control 6', {'principal': 100000, 'rate_bp': 900, 'months': 60, 'initial_payment': 20000, 'step_bp': 750, 'steps': 2}, {'year_payments': [20000, 21500, 23113, 0, 0], 'peak_balance': 100000, 'end_balance': -899279}]], [['regression: re-level term', {'principal': 1000000, 'rate_bp': 600, 'months': 60, 'initial_payment': 500, 'step_bp': 250, 'steps': 2}, {'year_payments': [500, 513, 526, 52144, 52144], 'peak_balance': 1176523, 'end_balance': 4}], ['control 1', {'principal': 250000, 'rate_bp': 1200, 'months': 24, 'initial_payment': 3000, 'step_bp': 250, 'steps': 2}, {'year_payments': [3000, 3075], 'peak_balance': 250000, 'end_balance': 235565}], ['control 2', {'principal': 250000, 'rate_bp': 600, 'months': 24, 'initial_payment': 3000, 'step_bp': 1000, 'steps': 1}, {'year_payments': [3000, 3300], 'peak_balance': 250000, 'end_balance': 201795}], ['control 3', {'principal': 100000, 'rate_bp': 900, 'months': 24, 'initial_payment': 500, 'step_bp': 1000, 'steps': 3}, {'year_payments': [500, 550], 'peak_balance': 105921, 'end_balance': 105921}], ['control 4', {'principal': 1000000, 'rate_bp': 900, 'months': 36, 'initial_payment': 3000, 'step_bp': 1000, 'steps': 3}, {'year_payments': [3000, 3300, 3630], 'peak_balance': 1173203, 'end_balance': 1173203}], ['control 5', {'principal': 100000, 'rate_bp': 600, 'months': 36, 'initial_payment': 8000, 'step_bp': 1000, 'steps': 1}, {'year_payments': [8000, 8800, 0], 'peak_balance': 100000, 'end_balance': -106813}], ['control 6', {'principal': 1000000, 'rate_bp': 600, 'months': 24, 'initial_payment': 3000, 'step_bp': 750, 'steps': 3}, {'year_payments': [3000, 3225], 'peak_balance': 1048088, 'end_balance': 1048088}]], [['regression: re-level term', {'principal': 1000000, 'rate_bp': 900, 'months': 36, 'initial_payment': 3000, 'step_bp': 750, 'steps': 1}, {'year_payments': [3000, 3225, 97511], 'peak_balance': 1115035, 'end_balance': 6}], ['control 1', {'principal': 250000, 'rate_bp': 900, 'months': 24, 'initial_payment': 3000, 'step_bp': 750, 'steps': 1}, {'year_payments': [3000, 3225], 'peak_balance': 250000, 'end_balance': 217726}], ['control 2', {'principal': 250000, 'rate_bp': 900, 'months': 24, 'initial_payment': 3000, 'step_bp': 750, 'steps': 2}, {'year_payments': [3000, 3225], 'peak_balance': 250000, 'end_balance': 217726}], ['control 3', {'principal': 250000, 'rate_bp': 900, 'months': 24, 'initial_payment': 8000, 'step_bp': 750, 'steps': 1}, {'year_payments': [8000, 8600], 'peak_balance': 250000, 'end_balance': 82092}], ['control 4', {'principal': 1000000, 'rate_bp': 900, 'months': 36, 'initial_payment': 500, 'step_bp': 750, 'steps': 2}, {'year_payments': [500, 538, 578], 'peak_balance': 1286575, 'end_balance': 1286575}], ['control 5', {'principal': 100000, 'rate_bp': 900, 'months': 36, 'initial_payment': 500, 'step_bp': 750, 'steps': 2}, {'year_payments': [500, 538, 578], 'peak_balance': 108792, 'end_balance': 108792}], ['control 6', {'principal': 100000, 'rate_bp': 1200, 'months': 60, 'initial_payment': 20000, 'step_bp': 1000, 'steps': 1}, {'year_payments': [20000, 22000, 0, 0, 0], 'peak_balance': 100000, 'end_balance': -626476}]], [['regression: re-level term', {'principal': 1000000, 'rate_bp': 900, 'months': 36, 'initial_payment': 8000, 'step_bp': 250, 'steps': 1}, {'year_payments': [8000, 8200, 86087], 'peak_balance': 1000000, 'end_balance': 5}], ['control 1', {'principal': 100000, 'rate_bp': 900, 'months': 24, 'initial_payment': 20000, 'step_bp': 750, 'steps': 3}, {'year_payments': [20000, 21500], 'peak_balance': 100000, 'end_balance': -422889}], ['control 2', {'principal': 100000, 'rate_bp': 1200, 'months': 36, 'initial_payment': 3000, 'step_bp': 1000, 'steps': 2}, {'year_payments': [3000, 3300, 3630], 'peak_balance': 100000, 'end_balance': 1568}], ['control 3', {'principal': 100000, 'rate_bp': 600, 'months': 36, 'initial_payment': 500, 'step_bp': 1000, 'steps': 3}, {'year_payments': [500, 550, 605], 'peak_balance': 100000, 'end_balance': 98050}], ['control 4', {'principal': 250000, 'rate_bp': 900, 'months': 36, 'initial_payment': 20000, 'step_bp': 750, 'steps': 1}, {'year_payments': [20000, 21500, 0], 'peak_balance': 250000, 'end_balance': -266261}], ['control 5', {'principal': 100000, 'rate_bp': 1200, 'months': 24, 'initial_payment': 500, 'step_bp': 750, 'steps': 3}, {'year_payments': [500, 538], 'peak_balance': 113004, 'end_balance': 113004}], ['control 6', {'principal': 100000, 'rate_bp': 600, 'months': 36, 'initial_payment': 8000, 'step_bp': 1000, 'steps': 2}, {'year_payments': [8000, 8800, 9680], 'peak_balance': 100000, 'end_balance': -226221}]], [['regression: re-level term', {'principal': 1000000, 'rate_bp': 600, 'months': 60, 'initial_payment': 20000, 'step_bp': 750, 'steps': 1}, {'year_payments': [20000, 21500, 18254, 18254, 18254], 'peak_balance': 1000000, 'end_balance': -11}], ['control 1', {'principal': 100000, 'rate_bp': 1200, 'months': 36, 'initial_payment': 500, 'step_bp': 250, 'steps': 2}, {'year_payments': [500, 513, 526], 'peak_balance': 121021, 'end_balance': 121021}], ['control 2', {'principal': 250000, 'rate_bp': 1200, 'months': 24, 'initial_payment': 3000, 'step_bp': 250, 'steps': 1}, {'year_payments': [3000, 3075], 'peak_balance': 250000, 'end_balance': 235565}], ['control 3', {'principal': 100000, 'rate_bp': 600, 'months': 36, 'initial_payment': 20000, 'step_bp': 750, 'steps': 3}, {'year_payments': [20000, 21500, 23113], 'peak_balance': 100000, 'end_balance': -725097}], ['control 4', {'principal': 100000, 'rate_bp': 1200, 'months': 36, 'initial_payment': 3000, 'step_bp': 1000, 'steps': 3}, {'year_payments': [3000, 3300, 3630], 'peak_balance': 100000, 'end_balance': 1568}], ['control 5', {'principal': 100000, 'rate_bp': 1200, 'months': 60, 'initial_payment': 8000, 'step_bp': 750, 'steps': 2}, {'year_payments': [8000, 8600, 9245, 0, 0], 'peak_balance': 100000, 'end_balance': -286836}], ['control 6', {'principal': 250000, 'rate_bp': 600, 'months': 36, 'initial_payment': 20000, 'step_bp': 250, 'steps': 1}, {'year_payments': [20000, 20500, 0], 'peak_balance': 250000, 'end_balance': -247387}]]]\nfor label, args, expected in fixtures[N-1]:\n    try:\n        actual = solve(args)\n    except Exception as exc:\n        actual = 'raised ' + type(exc).__name__\n    check(label, actual, expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"c6e8d5a8d3fd20bed751c9a07824c04ee2a93ab32e7fd688cc14c32e5e7af5c0","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(x):\n    def rnd(n, d):\n        q, r = divmod(n, d)\n        return q + (1 if 2 * r >= d else 0)\n    def level(P, n):\n        if n <= 0 or P <= 0:\n            return 0\n        if bp == 0:\n            exact = Fraction(P, n)\n        else:\n            r = Fraction(bp, 120000)\n            exact = P * r / (1 - (1 + r) ** -n)\n        return math.floor(exact + Fraction(1, 2))\n    bp = x['rate_bp']\n    n = x['months']\n    bal = x['principal']\n    pay = x['initial_payment']\n    years = [pay]\n    peak = bal\n    for m in range(1, n + 1):\n        t = (m - 1) // 12\n        if m > 1 and (m - 1) % 12 == 0:\n            if t <= x['steps']:\n                pay = rnd(pay * (10000 + x['step_bp']), 10000)\n            elif t == x['steps'] + 1:\n                pay = level(bal, n)\n            years.append(pay)\n        interest = rnd(bal * bp, 120000)\n        bal += interest - pay\n        peak = max(peak, bal)\n    return {'year_payments': years, 'peak_balance': peak, 'end_balance': bal}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression: re-level term', {'principal': 250000, 'rate_bp': 900, 'months': 36, 'initial_payment': 8000, 'step_bp': 250, 'steps': 0}, {'year_payments': [8000, 7921, 7921], 'peak_balance': 250000, 'end_balance': 9}], ['control 1', {'principal': 250000, 'rate_bp': 600, 'months': 24, 'initial_payment': 3000, 'step_bp': 250, 'steps': 3}, {'year_payments': [3000, 3075], 'peak_balance': 250000, 'end_balance': 204568}], ['control 2', {'principal': 250000, 'rate_bp': 1200, 'months': 60, 'initial_payment': 20000, 'step_bp': 250, 'steps': 1}, {'year_payments': [20000, 20500, 0, 0, 0], 'peak_balance': 250000, 'end_balance': -326758}], ['control 3', {'principal': 1000000, 'rate_bp': 600, 'months': 36, 'initial_payment': 20000, 'step_bp': 750, 'steps': 2}, {'year_payments': [20000, 21500, 23113], 'peak_balance': 1000000, 'end_balance': 351915}], ['control 4', {'principal': 100000, 'rate_bp': 900, 'months': 24, 'initial_payment': 8000, 'step_bp': 250, 'steps': 2}, {'year_payments': [8000, 8200], 'peak_balance': 100000, 'end_balance': -92367}], ['control 5', {'principal': 100000, 'rate_bp': 900, 'months': 36, 'initial_payment': 500, 'step_bp': 250, 'steps': 2}, {'year_payments': [500, 513, 526], 'peak_balance': 109781, 'end_balance': 109781}], ['control 6', {'principal': 100000, 'rate_bp': 900, 'months': 60, 'initial_payment': 20000, 'step_bp': 750, 'steps': 2}, {'year_payments': [20000, 21500, 23113, 0, 0], 'peak_balance': 100000, 'end_balance': -899279}]], [['regression: re-level term', {'principal': 1000000, 'rate_bp': 600, 'months': 60, 'initial_payment': 500, 'step_bp': 250, 'steps': 2}, {'year_payments': [500, 513, 526, 52144, 52144], 'peak_balance': 1176523, 'end_balance': 4}], ['control 1', {'principal': 250000, 'rate_bp': 1200, 'months': 24, 'initial_payment': 3000, 'step_bp': 250, 'steps': 2}, {'year_payments': [3000, 3075], 'peak_balance': 250000, 'end_balance': 235565}], ['control 2', {'principal': 250000, 'rate_bp': 600, 'months': 24, 'initial_payment': 3000, 'step_bp': 1000, 'steps': 1}, {'year_payments': [3000, 3300], 'peak_balance': 250000, 'end_balance': 201795}], ['control 3', {'principal': 100000, 'rate_bp': 900, 'months': 24, 'initial_payment': 500, 'step_bp': 1000, 'steps': 3}, {'year_payments': [500, 550], 'peak_balance': 105921, 'end_balance': 105921}], ['control 4', {'principal': 1000000, 'rate_bp': 900, 'months': 36, 'initial_payment': 3000, 'step_bp': 1000, 'steps': 3}, {'year_payments': [3000, 3300, 3630], 'peak_balance': 1173203, 'end_balance': 1173203}], ['control 5', {'principal': 100000, 'rate_bp': 600, 'months': 36, 'initial_payment': 8000, 'step_bp': 1000, 'steps': 1}, {'year_payments': [8000, 8800, 0], 'peak_balance': 100000, 'end_balance': -106813}], ['control 6', {'principal': 1000000, 'rate_bp': 600, 'months': 24, 'initial_payment': 3000, 'step_bp': 750, 'steps': 3}, {'year_payments': [3000, 3225], 'peak_balance': 1048088, 'end_balance': 1048088}]], [['regression: re-level term', {'principal': 1000000, 'rate_bp': 900, 'months': 36, 'initial_payment': 3000, 'step_bp': 750, 'steps': 1}, {'year_payments': [3000, 3225, 97511], 'peak_balance': 1115035, 'end_balance': 6}], ['control 1', {'principal': 250000, 'rate_bp': 900, 'months': 24, 'initial_payment': 3000, 'step_bp': 750, 'steps': 1}, {'year_payments': [3000, 3225], 'peak_balance': 250000, 'end_balance': 217726}], ['control 2', {'principal': 250000, 'rate_bp': 900, 'months': 24, 'initial_payment': 3000, 'step_bp': 750, 'steps': 2}, {'year_payments': [3000, 3225], 'peak_balance': 250000, 'end_balance': 217726}], ['control 3', {'principal': 250000, 'rate_bp': 900, 'months': 24, 'initial_payment': 8000, 'step_bp': 750, 'steps': 1}, {'year_payments': [8000, 8600], 'peak_balance': 250000, 'end_balance': 82092}], ['control 4', {'principal': 1000000, 'rate_bp': 900, 'months': 36, 'initial_payment': 500, 'step_bp': 750, 'steps': 2}, {'year_payments': [500, 538, 578], 'peak_balance': 1286575, 'end_balance': 1286575}], ['control 5', {'principal': 100000, 'rate_bp': 900, 'months': 36, 'initial_payment': 500, 'step_bp': 750, 'steps': 2}, {'year_payments': [500, 538, 578], 'peak_balance': 108792, 'end_balance': 108792}], ['control 6', {'principal': 100000, 'rate_bp': 1200, 'months': 60, 'initial_payment': 20000, 'step_bp': 1000, 'steps': 1}, {'year_payments': [20000, 22000, 0, 0, 0], 'peak_balance': 100000, 'end_balance': -626476}]], [['regression: re-level term', {'principal': 1000000, 'rate_bp': 900, 'months': 36, 'initial_payment': 8000, 'step_bp': 250, 'steps': 1}, {'year_payments': [8000, 8200, 86087], 'peak_balance': 1000000, 'end_balance': 5}], ['control 1', {'principal': 100000, 'rate_bp': 900, 'months': 24, 'initial_payment': 20000, 'step_bp': 750, 'steps': 3}, {'year_payments': [20000, 21500], 'peak_balance': 100000, 'end_balance': -422889}], ['control 2', {'principal': 100000, 'rate_bp': 1200, 'months': 36, 'initial_payment': 3000, 'step_bp': 1000, 'steps': 2}, {'year_payments': [3000, 3300, 3630], 'peak_balance': 100000, 'end_balance': 1568}], ['control 3', {'principal': 100000, 'rate_bp': 600, 'months': 36, 'initial_payment': 500, 'step_bp': 1000, 'steps': 3}, {'year_payments': [500, 550, 605], 'peak_balance': 100000, 'end_balance': 98050}], ['control 4', {'principal': 250000, 'rate_bp': 900, 'months': 36, 'initial_payment': 20000, 'step_bp': 750, 'steps': 1}, {'year_payments': [20000, 21500, 0], 'peak_balance': 250000, 'end_balance': -266261}], ['control 5', {'principal': 100000, 'rate_bp': 1200, 'months': 24, 'initial_payment': 500, 'step_bp': 750, 'steps': 3}, {'year_payments': [500, 538], 'peak_balance': 113004, 'end_balance': 113004}], ['control 6', {'principal': 100000, 'rate_bp': 600, 'months': 36, 'initial_payment': 8000, 'step_bp': 1000, 'steps': 2}, {'year_payments': [8000, 8800, 9680], 'peak_balance': 100000, 'end_balance': -226221}]], [['regression: re-level term', {'principal': 1000000, 'rate_bp': 600, 'months': 60, 'initial_payment': 20000, 'step_bp': 750, 'steps': 1}, {'year_payments': [20000, 21500, 18254, 18254, 18254], 'peak_balance': 1000000, 'end_balance': -11}], ['control 1', {'principal': 100000, 'rate_bp': 1200, 'months': 36, 'initial_payment': 500, 'step_bp': 250, 'steps': 2}, {'year_payments': [500, 513, 526], 'peak_balance': 121021, 'end_balance': 121021}], ['control 2', {'principal': 250000, 'rate_bp': 1200, 'months': 24, 'initial_payment': 3000, 'step_bp': 250, 'steps': 1}, {'year_payments': [3000, 3075], 'peak_balance': 250000, 'end_balance': 235565}], ['control 3', {'principal': 100000, 'rate_bp': 600, 'months': 36, 'initial_payment': 20000, 'step_bp': 750, 'steps': 3}, {'year_payments': [20000, 21500, 23113], 'peak_balance': 100000, 'end_balance': -725097}], ['control 4', {'principal': 100000, 'rate_bp': 1200, 'months': 36, 'initial_payment': 3000, 'step_bp': 1000, 'steps': 3}, {'year_payments': [3000, 3300, 3630], 'peak_balance': 100000, 'end_balance': 1568}], ['control 5', {'principal': 100000, 'rate_bp': 1200, 'months': 60, 'initial_payment': 8000, 'step_bp': 750, 'steps': 2}, {'year_payments': [8000, 8600, 9245, 0, 0], 'peak_balance': 100000, 'end_balance': -286836}], ['control 6', {'principal': 250000, 'rate_bp': 600, 'months': 36, 'initial_payment': 20000, 'step_bp': 250, 'steps': 1}, {'year_payments': [20000, 20500, 0], 'peak_balance': 250000, 'end_balance': -247387}]]]\nfor label, args, expected in fixtures[N-1]:\n    try:\n        actual = solve(args)\n    except Exception as exc:\n        actual = 'raised ' + type(exc).__name__\n    check(label, actual, expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"fixed":{"sha256":"f3a703faebbf7ddc434dcc228328cbd2b7d9e532cb09422c508a93abda21d36e","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(x):\n    def rnd(n, d):\n        q, r = divmod(n, d)\n        return q + (1 if 2 * r >= d else 0)\n    def level(P, n):\n        if n <= 0 or P <= 0:\n            return 0\n        if bp == 0:\n            exact = Fraction(P, n)\n        else:\n            r = Fraction(bp, 120000)\n            exact = P * r / (1 - (1 + r) ** -n)\n        return math.floor(exact + Fraction(1, 2))\n    bp = x['rate_bp']\n    n = x['months']\n    bal = x['principal']\n    pay = x['initial_payment']\n    years = [pay]\n    peak = bal\n    for m in range(1, n + 1):\n        t = (m - 1) // 12\n        if m > 1 and (m - 1) % 12 == 0:\n            if t <= x['steps']:\n                pay = rnd(pay * (10000 + x['step_bp']), 10000)\n            elif t == x['steps'] + 1:\n                pay = level(bal, n - m + 1)\n            years.append(pay)\n        interest = rnd(bal * bp, 120000)\n        bal += interest - pay\n        peak = max(peak, bal)\n    return {'year_payments': years, 'peak_balance': peak, 'end_balance': bal}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression: re-level term', {'principal': 250000, 'rate_bp': 900, 'months': 36, 'initial_payment': 8000, 'step_bp': 250, 'steps': 0}, {'year_payments': [8000, 7921, 7921], 'peak_balance': 250000, 'end_balance': 9}], ['control 1', {'principal': 250000, 'rate_bp': 600, 'months': 24, 'initial_payment': 3000, 'step_bp': 250, 'steps': 3}, {'year_payments': [3000, 3075], 'peak_balance': 250000, 'end_balance': 204568}], ['control 2', {'principal': 250000, 'rate_bp': 1200, 'months': 60, 'initial_payment': 20000, 'step_bp': 250, 'steps': 1}, {'year_payments': [20000, 20500, 0, 0, 0], 'peak_balance': 250000, 'end_balance': -326758}], ['control 3', {'principal': 1000000, 'rate_bp': 600, 'months': 36, 'initial_payment': 20000, 'step_bp': 750, 'steps': 2}, {'year_payments': [20000, 21500, 23113], 'peak_balance': 1000000, 'end_balance': 351915}], ['control 4', {'principal': 100000, 'rate_bp': 900, 'months': 24, 'initial_payment': 8000, 'step_bp': 250, 'steps': 2}, {'year_payments': [8000, 8200], 'peak_balance': 100000, 'end_balance': -92367}], ['control 5', {'principal': 100000, 'rate_bp': 900, 'months': 36, 'initial_payment': 500, 'step_bp': 250, 'steps': 2}, {'year_payments': [500, 513, 526], 'peak_balance': 109781, 'end_balance': 109781}], ['control 6', {'principal': 100000, 'rate_bp': 900, 'months': 60, 'initial_payment': 20000, 'step_bp': 750, 'steps': 2}, {'year_payments': [20000, 21500, 23113, 0, 0], 'peak_balance': 100000, 'end_balance': -899279}]], [['regression: re-level term', {'principal': 1000000, 'rate_bp': 600, 'months': 60, 'initial_payment': 500, 'step_bp': 250, 'steps': 2}, {'year_payments': [500, 513, 526, 52144, 52144], 'peak_balance': 1176523, 'end_balance': 4}], ['control 1', {'principal': 250000, 'rate_bp': 1200, 'months': 24, 'initial_payment': 3000, 'step_bp': 250, 'steps': 2}, {'year_payments': [3000, 3075], 'peak_balance': 250000, 'end_balance': 235565}], ['control 2', {'principal': 250000, 'rate_bp': 600, 'months': 24, 'initial_payment': 3000, 'step_bp': 1000, 'steps': 1}, {'year_payments': [3000, 3300], 'peak_balance': 250000, 'end_balance': 201795}], ['control 3', {'principal': 100000, 'rate_bp': 900, 'months': 24, 'initial_payment': 500, 'step_bp': 1000, 'steps': 3}, {'year_payments': [500, 550], 'peak_balance': 105921, 'end_balance': 105921}], ['control 4', {'principal': 1000000, 'rate_bp': 900, 'months': 36, 'initial_payment': 3000, 'step_bp': 1000, 'steps': 3}, {'year_payments': [3000, 3300, 3630], 'peak_balance': 1173203, 'end_balance': 1173203}], ['control 5', {'principal': 100000, 'rate_bp': 600, 'months': 36, 'initial_payment': 8000, 'step_bp': 1000, 'steps': 1}, {'year_payments': [8000, 8800, 0], 'peak_balance': 100000, 'end_balance': -106813}], ['control 6', {'principal': 1000000, 'rate_bp': 600, 'months': 24, 'initial_payment': 3000, 'step_bp': 750, 'steps': 3}, {'year_payments': [3000, 3225], 'peak_balance': 1048088, 'end_balance': 1048088}]], [['regression: re-level term', {'principal': 1000000, 'rate_bp': 900, 'months': 36, 'initial_payment': 3000, 'step_bp': 750, 'steps': 1}, {'year_payments': [3000, 3225, 97511], 'peak_balance': 1115035, 'end_balance': 6}], ['control 1', {'principal': 250000, 'rate_bp': 900, 'months': 24, 'initial_payment': 3000, 'step_bp': 750, 'steps': 1}, {'year_payments': [3000, 3225], 'peak_balance': 250000, 'end_balance': 217726}], ['control 2', {'principal': 250000, 'rate_bp': 900, 'months': 24, 'initial_payment': 3000, 'step_bp': 750, 'steps': 2}, {'year_payments': [3000, 3225], 'peak_balance': 250000, 'end_balance': 217726}], ['control 3', {'principal': 250000, 'rate_bp': 900, 'months': 24, 'initial_payment': 8000, 'step_bp': 750, 'steps': 1}, {'year_payments': [8000, 8600], 'peak_balance': 250000, 'end_balance': 82092}], ['control 4', {'principal': 1000000, 'rate_bp': 900, 'months': 36, 'initial_payment': 500, 'step_bp': 750, 'steps': 2}, {'year_payments': [500, 538, 578], 'peak_balance': 1286575, 'end_balance': 1286575}], ['control 5', {'principal': 100000, 'rate_bp': 900, 'months': 36, 'initial_payment': 500, 'step_bp': 750, 'steps': 2}, {'year_payments': [500, 538, 578], 'peak_balance': 108792, 'end_balance': 108792}], ['control 6', {'principal': 100000, 'rate_bp': 1200, 'months': 60, 'initial_payment': 20000, 'step_bp': 1000, 'steps': 1}, {'year_payments': [20000, 22000, 0, 0, 0], 'peak_balance': 100000, 'end_balance': -626476}]], [['regression: re-level term', {'principal': 1000000, 'rate_bp': 900, 'months': 36, 'initial_payment': 8000, 'step_bp': 250, 'steps': 1}, {'year_payments': [8000, 8200, 86087], 'peak_balance': 1000000, 'end_balance': 5}], ['control 1', {'principal': 100000, 'rate_bp': 900, 'months': 24, 'initial_payment': 20000, 'step_bp': 750, 'steps': 3}, {'year_payments': [20000, 21500], 'peak_balance': 100000, 'end_balance': -422889}], ['control 2', {'principal': 100000, 'rate_bp': 1200, 'months': 36, 'initial_payment': 3000, 'step_bp': 1000, 'steps': 2}, {'year_payments': [3000, 3300, 3630], 'peak_balance': 100000, 'end_balance': 1568}], ['control 3', {'principal': 100000, 'rate_bp': 600, 'months': 36, 'initial_payment': 500, 'step_bp': 1000, 'steps': 3}, {'year_payments': [500, 550, 605], 'peak_balance': 100000, 'end_balance': 98050}], ['control 4', {'principal': 250000, 'rate_bp': 900, 'months': 36, 'initial_payment': 20000, 'step_bp': 750, 'steps': 1}, {'year_payments': [20000, 21500, 0], 'peak_balance': 250000, 'end_balance': -266261}], ['control 5', {'principal': 100000, 'rate_bp': 1200, 'months': 24, 'initial_payment': 500, 'step_bp': 750, 'steps': 3}, {'year_payments': [500, 538], 'peak_balance': 113004, 'end_balance': 113004}], ['control 6', {'principal': 100000, 'rate_bp': 600, 'months': 36, 'initial_payment': 8000, 'step_bp': 1000, 'steps': 2}, {'year_payments': [8000, 8800, 9680], 'peak_balance': 100000, 'end_balance': -226221}]], [['regression: re-level term', {'principal': 1000000, 'rate_bp': 600, 'months': 60, 'initial_payment': 20000, 'step_bp': 750, 'steps': 1}, {'year_payments': [20000, 21500, 18254, 18254, 18254], 'peak_balance': 1000000, 'end_balance': -11}], ['control 1', {'principal': 100000, 'rate_bp': 1200, 'months': 36, 'initial_payment': 500, 'step_bp': 250, 'steps': 2}, {'year_payments': [500, 513, 526], 'peak_balance': 121021, 'end_balance': 121021}], ['control 2', {'principal': 250000, 'rate_bp': 1200, 'months': 24, 'initial_payment': 3000, 'step_bp': 250, 'steps': 1}, {'year_payments': [3000, 3075], 'peak_balance': 250000, 'end_balance': 235565}], ['control 3', {'principal': 100000, 'rate_bp': 600, 'months': 36, 'initial_payment': 20000, 'step_bp': 750, 'steps': 3}, {'year_payments': [20000, 21500, 23113], 'peak_balance': 100000, 'end_balance': -725097}], ['control 4', {'principal': 100000, 'rate_bp': 1200, 'months': 36, 'initial_payment': 3000, 'step_bp': 1000, 'steps': 3}, {'year_payments': [3000, 3300, 3630], 'peak_balance': 100000, 'end_balance': 1568}], ['control 5', {'principal': 100000, 'rate_bp': 1200, 'months': 60, 'initial_payment': 8000, 'step_bp': 750, 'steps': 2}, {'year_payments': [8000, 8600, 9245, 0, 0], 'peak_balance': 100000, 'end_balance': -286836}], ['control 6', {'principal': 250000, 'rate_bp': 600, 'months': 36, 'initial_payment': 20000, 'step_bp': 250, 'steps': 1}, {'year_payments': [20000, 20500, 0], 'peak_balance': 250000, 'end_balance': -247387}]]]\nfor label, args, expected in fixtures[N-1]:\n    try:\n        actual = solve(args)\n    except Exception as exc:\n        actual = 'raised ' + type(exc).__name__\n    check(label, actual, expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"A deterministic bounded teaching model with stipulated toy lending rules stated in the contract; money is integer cents and rates are basis points; it makes no claim of conformance to any regulation, servicing standard or product. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-loan-amortization-schedules-graduated-payment-steps-re-level-term","generated_at":"2026-09-29T14:46:30.434564+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Amortization engines drive borrower statements, payoff quotes and investor remittances; a misplaced rounding step, boundary or ordering rule compounds across hundreds of periods.","repair":"Re-level over the n - m + 1 months that remain including the current one.","root_cause":"The re-level uses the full original term.","sha256":"9171224e1e994a20acc61a7af54cb24dd88d42097b89f1dd1ae79ff05e0dfa7a","title":"Graduated payment schedule: re-level term · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":52.381,"exit_code":1,"observations":[{"actual":{"end_balance":-8243,"peak_balance":250000,"year_payments":[8000,8236,8236]},"check":"regression: re-level term","expected":{"end_balance":9,"peak_balance":250000,"year_payments":[8000,7921,7921]},"passed":false},{"actual":{"end_balance":204568,"peak_balance":250000,"year_payments":[3000,3075]},"check":"control 1","expected":{"end_balance":204568,"peak_balance":250000,"year_payments":[3000,3075]},"passed":true},{"actual":{"end_balance":-326758,"peak_balance":250000,"year_payments":[20000,20500,0,0,0]},"check":"control 2","expected":{"end_balance":-326758,"peak_balance":250000,"year_payments":[20000,20500,0,0,0]},"passed":true},{"actual":{"end_balance":351915,"peak_balance":1000000,"year_payments":[20000,21500,23113]},"check":"control 3","expected":{"end_balance":351915,"peak_balance":1000000,"year_payments":[20000,21500,23113]},"passed":true},{"actual":{"end_balance":-92367,"peak_balance":100000,"year_payments":[8000,8200]},"check":"control 4","expected":{"end_balance":-92367,"peak_balance":100000,"year_payments":[8000,8200]},"passed":true},{"actual":{"end_balance":109781,"peak_balance":109781,"year_payments":[500,513,526]},"check":"control 5","expected":{"end_balance":109781,"peak_balance":109781,"year_payments":[500,513,526]},"passed":true},{"actual":{"end_balance":-899279,"peak_balance":100000,"year_payments":[20000,21500,23113,0,0]},"check":"control 6","expected":{"end_balance":-899279,"peak_balance":100000,"year_payments":[20000,21500,23113,0,0]},"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: re-level term\", \"actual\": {\"year_payments\": [8000, 8236, 8236], \"peak_balance\": 250000, \"end_balance\": -8243}, \"expected\": {\"year_payments\": [8000, 7921, 7921], \"peak_balance\": 250000, \"end_balance\": 9}, \"passed\": false}, {\"check\": \"control 1\", \"actual\": {\"year_payments\": [3000, 3075], \"peak_balance\": 250000, \"end_balance\": 204568}, \"expected\": {\"year_payments\": [3000, 3075], \"peak_balance\": 250000, \"end_balance\": 204568}, \"passed\": true}, {\"check\": \"control 2\", \"actual\": {\"year_payments\": [20000, 20500, 0, 0, 0], \"peak_balance\": 250000, \"end_balance\": -326758}, \"expected\": {\"year_payments\": [20000, 20500, 0, 0, 0], \"peak_balance\": 250000, \"end_balance\": -326758}, \"passed\": true}, {\"check\": \"control 3\", \"actual\": {\"year_payments\": [20000, 21500, 23113], \"peak_balance\": 1000000, \"end_balance\": 351915}, \"expected\": {\"year_payments\": [20000, 21500, 23113], \"peak_balance\": 1000000, \"end_balance\": 351915}, \"passed\": true}, {\"check\": \"control 4\", \"actual\": {\"year_payments\": [8000, 8200], \"peak_balance\": 100000, \"end_balance\": -92367}, \"expected\": {\"year_payments\": [8000, 8200], \"peak_balance\": 100000, \"end_balance\": -92367}, \"passed\": true}, {\"check\": \"control 5\", \"actual\": {\"year_payments\": [500, 513, 526], \"peak_balance\": 109781, \"end_balance\": 109781}, \"expected\": {\"year_payments\": [500, 513, 526], \"peak_balance\": 109781, \"end_balance\": 109781}, \"passed\": true}, {\"check\": \"control 6\", \"actual\": {\"year_payments\": [20000, 21500, 23113, 0, 0], \"peak_balance\": 100000, \"end_balance\": -899279}, \"expected\": {\"year_payments\": [20000, 21500, 23113, 0, 0], \"peak_balance\": 100000, \"end_balance\": -899279}, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":44.811,"exit_code":1,"observations":[{"actual":{"end_balance":63045,"peak_balance":250000,"year_payments":[8000,5514,5514]},"check":"regression: re-level term","expected":{"end_balance":9,"peak_balance":250000,"year_payments":[8000,7921,7921]},"passed":false},{"actual":{"end_balance":204568,"peak_balance":250000,"year_payments":[3000,3075]},"check":"control 1","expected":{"end_balance":204568,"peak_balance":250000,"year_payments":[3000,3075]},"passed":true},{"actual":{"end_balance":-326758,"peak_balance":250000,"year_payments":[20000,20500,0,0,0]},"check":"control 2","expected":{"end_balance":-326758,"peak_balance":250000,"year_payments":[20000,20500,0,0,0]},"passed":true},{"actual":{"end_balance":351915,"peak_balance":1000000,"year_payments":[20000,21500,23113]},"check":"control 3","expected":{"end_balance":351915,"peak_balance":1000000,"year_payments":[20000,21500,23113]},"passed":true},{"actual":{"end_balance":-92367,"peak_balance":100000,"year_payments":[8000,8200]},"check":"control 4","expected":{"end_balance":-92367,"peak_balance":100000,"year_payments":[8000,8200]},"passed":true},{"actual":{"end_balance":109781,"peak_balance":109781,"year_payments":[500,513,526]},"check":"control 5","expected":{"end_balance":109781,"peak_balance":109781,"year_payments":[500,513,526]},"passed":true},{"actual":{"end_balance":-899279,"peak_balance":100000,"year_payments":[20000,21500,23113,0,0]},"check":"control 6","expected":{"end_balance":-899279,"peak_balance":100000,"year_payments":[20000,21500,23113,0,0]},"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: re-level term\", \"actual\": {\"year_payments\": [8000, 5514, 5514], \"peak_balance\": 250000, \"end_balance\": 63045}, \"expected\": {\"year_payments\": [8000, 7921, 7921], \"peak_balance\": 250000, \"end_balance\": 9}, \"passed\": false}, {\"check\": \"control 1\", \"actual\": {\"year_payments\": [3000, 3075], \"peak_balance\": 250000, \"end_balance\": 204568}, \"expected\": {\"year_payments\": [3000, 3075], \"peak_balance\": 250000, \"end_balance\": 204568}, \"passed\": true}, {\"check\": \"control 2\", \"actual\": {\"year_payments\": [20000, 20500, 0, 0, 0], \"peak_balance\": 250000, \"end_balance\": -326758}, \"expected\": {\"year_payments\": [20000, 20500, 0, 0, 0], \"peak_balance\": 250000, \"end_balance\": -326758}, \"passed\": true}, {\"check\": \"control 3\", \"actual\": {\"year_payments\": [20000, 21500, 23113], \"peak_balance\": 1000000, \"end_balance\": 351915}, \"expected\": {\"year_payments\": [20000, 21500, 23113], \"peak_balance\": 1000000, \"end_balance\": 351915}, \"passed\": true}, {\"check\": \"control 4\", \"actual\": {\"year_payments\": [8000, 8200], \"peak_balance\": 100000, \"end_balance\": -92367}, \"expected\": {\"year_payments\": [8000, 8200], \"peak_balance\": 100000, \"end_balance\": -92367}, \"passed\": true}, {\"check\": \"control 5\", \"actual\": {\"year_payments\": [500, 513, 526], \"peak_balance\": 109781, \"end_balance\": 109781}, \"expected\": {\"year_payments\": [500, 513, 526], \"peak_balance\": 109781, \"end_balance\": 109781}, \"passed\": true}, {\"check\": \"control 6\", \"actual\": {\"year_payments\": [20000, 21500, 23113, 0, 0], \"peak_balance\": 100000, \"end_balance\": -899279}, \"expected\": {\"year_payments\": [20000, 21500, 23113, 0, 0], \"peak_balance\": 100000, \"end_balance\": -899279}, \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":47.53,"exit_code":0,"observations":[{"actual":{"end_balance":9,"peak_balance":250000,"year_payments":[8000,7921,7921]},"check":"regression: re-level term","expected":{"end_balance":9,"peak_balance":250000,"year_payments":[8000,7921,7921]},"passed":true},{"actual":{"end_balance":204568,"peak_balance":250000,"year_payments":[3000,3075]},"check":"control 1","expected":{"end_balance":204568,"peak_balance":250000,"year_payments":[3000,3075]},"passed":true},{"actual":{"end_balance":-326758,"peak_balance":250000,"year_payments":[20000,20500,0,0,0]},"check":"control 2","expected":{"end_balance":-326758,"peak_balance":250000,"year_payments":[20000,20500,0,0,0]},"passed":true},{"actual":{"end_balance":351915,"peak_balance":1000000,"year_payments":[20000,21500,23113]},"check":"control 3","expected":{"end_balance":351915,"peak_balance":1000000,"year_payments":[20000,21500,23113]},"passed":true},{"actual":{"end_balance":-92367,"peak_balance":100000,"year_payments":[8000,8200]},"check":"control 4","expected":{"end_balance":-92367,"peak_balance":100000,"year_payments":[8000,8200]},"passed":true},{"actual":{"end_balance":109781,"peak_balance":109781,"year_payments":[500,513,526]},"check":"control 5","expected":{"end_balance":109781,"peak_balance":109781,"year_payments":[500,513,526]},"passed":true},{"actual":{"end_balance":-899279,"peak_balance":100000,"year_payments":[20000,21500,23113,0,0]},"check":"control 6","expected":{"end_balance":-899279,"peak_balance":100000,"year_payments":[20000,21500,23113,0,0]},"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: re-level term\", \"actual\": {\"year_payments\": [8000, 7921, 7921], \"peak_balance\": 250000, \"end_balance\": 9}, \"expected\": {\"year_payments\": [8000, 7921, 7921], \"peak_balance\": 250000, \"end_balance\": 9}, \"passed\": true}, {\"check\": \"control 1\", \"actual\": {\"year_payments\": [3000, 3075], \"peak_balance\": 250000, \"end_balance\": 204568}, \"expected\": {\"year_payments\": [3000, 3075], \"peak_balance\": 250000, \"end_balance\": 204568}, \"passed\": true}, {\"check\": \"control 2\", \"actual\": {\"year_payments\": [20000, 20500, 0, 0, 0], \"peak_balance\": 250000, \"end_balance\": -326758}, \"expected\": {\"year_payments\": [20000, 20500, 0, 0, 0], \"peak_balance\": 250000, \"end_balance\": -326758}, \"passed\": true}, {\"check\": \"control 3\", \"actual\": {\"year_payments\": [20000, 21500, 23113], \"peak_balance\": 1000000, \"end_balance\": 351915}, \"expected\": {\"year_payments\": [20000, 21500, 23113], \"peak_balance\": 1000000, \"end_balance\": 351915}, \"passed\": true}, {\"check\": \"control 4\", \"actual\": {\"year_payments\": [8000, 8200], \"peak_balance\": 100000, \"end_balance\": -92367}, \"expected\": {\"year_payments\": [8000, 8200], \"peak_balance\": 100000, \"end_balance\": -92367}, \"passed\": true}, {\"check\": \"control 5\", \"actual\": {\"year_payments\": [500, 513, 526], \"peak_balance\": 109781, \"end_balance\": 109781}, \"expected\": {\"year_payments\": [500, 513, 526], \"peak_balance\": 109781, \"end_balance\": 109781}, \"passed\": true}, {\"check\": \"control 6\", \"actual\": {\"year_payments\": [20000, 21500, 23113, 0, 0], \"peak_balance\": 100000, \"end_balance\": -899279}, \"expected\": {\"year_payments\": [20000, 21500, 23113, 0, 0], \"peak_balance\": 100000, \"end_balance\": -899279}, \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}