FAILURE MAP
← Case archive

FA-62861 / Insurance premium rating / Open access

Personal auto multiplicative rating: Minimum premium is enforced before the multi-car discount · case 01

A discounted small policy is charged less than the 30000-cent minimum premium.

Verified by executionVariant 1 · 15 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The minimum is applied to the pre-discount premium and the discount is taken afterwards.

VERIFIED REPAIR

Apply the discount and rounding first, then enforce the minimum on the discounted premium.

Unsuccessful approach: Rounding before the discount still discounts after the minimum and also truncates the discounted value.

Case contract

Input dict base, territory (A/B/C factors 1.00/1.15/1.30, else 'invalid territory'), age (<16 'invalid age'; 16-24 factor 1.50; 25-64 1.00; 65+ 1.20), symbol s with factor 1+0.05*(s-1), cars (>=2 gives 10% discount), fee. Rated premium = base*factors*discount rounded half-up to a cent once, then a 30000-cent minimum, then the fee is added.

Why this case matters

Premium rating engines apply ordered tabular rules where one misplaced boundary or step silently misprices policies.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(x):
    T={'A':Fraction(1),'B':Fraction(115,100),'C':Fraction(130,100)}
    if x['territory'] not in T: return 'invalid territory'
    age=x['age']
    if age<16: return 'invalid age'
    if age<25: af=Fraction(150,100)
    elif age<65: af=Fraction(1)
    else: af=Fraction(120,100)
    sf=1+Fraction(5,100)*(x['symbol']-1)
    disc=Fraction(90,100) if x['cars']>=2 else Fraction(1)
    rated=x['base']*T[x['territory']]*af*sf
    rated=max(rated,30000)
    rated=rated*disc
    rated=int(rated+Fraction(1,2))
    return rated+x['fee']
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['youthful band ends at 24', {'base': 54520, 'territory': 'B', 'age': 24, 'symbol': 10, 'cars': 1, 'fee': 0}, 136368], ['age 25 leaves youthful band', {'base': 48271, 'territory': 'A', 'age': 25, 'symbol': 2, 'cars': 1, 'fee': 1500}, 52185], ['senior boundary 65', {'base': 31490, 'territory': 'A', 'age': 65, 'symbol': 8, 'cars': 2, 'fee': 0}, 45912], ['two cars earn multi-car discount', {'base': 53546, 'territory': 'A', 'age': 55, 'symbol': 8, 'cars': 2, 'fee': 0}, 65058], ['single car control', {'base': 41604, 'territory': 'A', 'age': 56, 'symbol': 9, 'cars': 1, 'fee': 0}, 58246], ['discounted policy below minimum', {'base': 30977, 'territory': 'A', 'age': 39, 'symbol': 1, 'cars': 3, 'fee': 0}, 30000], ['unknown territory rejected', {'base': 78746, 'territory': 'Z', 'age': 40, 'symbol': 10, 'cars': 1, 'fee': 0}, 'invalid territory'], ['under-age applicant rejected', {'base': 84653, 'territory': 'C', 'age': 15, 'symbol': 2, 'cars': 1, 'fee': 2500}, 'invalid age'], ['random rating 0', {'base': 34126, 'territory': 'C', 'age': 33, 'symbol': 6, 'cars': 3, 'fee': 0}, 49909], ['random rating 1', {'base': 62350, 'territory': 'A', 'age': 16, 'symbol': 1, 'cars': 3, 'fee': 1500}, 85673], ['random rating 2', {'base': 95267, 'territory': 'A', 'age': 16, 'symbol': 6, 'cars': 2, 'fee': 2500}, 163263], ['random rating 3', {'base': 65141, 'territory': 'A', 'age': 16, 'symbol': 5, 'cars': 2, 'fee': 1500}, 107028], ['top symbol relativity', {'base': 50001, 'territory': 'B', 'age': 40, 'symbol': 10, 'cars': 1, 'fee': 2500}, 85877], ['half-cent rounds up', {'base': 60003, 'territory': 'B', 'age': 40, 'symbol': 1, 'cars': 1, 'fee': 2500}, 71503], ['sub-half cent rounds down', {'base': 40011, 'territory': 'B', 'age': 40, 'symbol': 1, 'cars': 1, 'fee': 2500}, 48513]], [['youthful band ends at 24', {'base': 65596, 'territory': 'B', 'age': 24, 'symbol': 4, 'cars': 1, 'fee': 1500}, 131626], ['age 25 leaves youthful band', {'base': 53332, 'territory': 'C', 'age': 25, 'symbol': 6, 'cars': 1, 'fee': 1500}, 88165], ['senior boundary 65', {'base': 72267, 'territory': 'B', 'age': 65, 'symbol': 9, 'cars': 2, 'fee': 0}, 125658], ['two cars earn multi-car discount', {'base': 46182, 'territory': 'A', 'age': 53, 'symbol': 1, 'cars': 2, 'fee': 2500}, 44064], ['single car control', {'base': 42325, 'territory': 'C', 'age': 57, 'symbol': 4, 'cars': 1, 'fee': 2500}, 65776], ['discounted policy below minimum', {'base': 31359, 'territory': 'A', 'age': 40, 'symbol': 1, 'cars': 3, 'fee': 1500}, 31500], ['unknown territory rejected', {'base': 70758, 'territory': 'Z', 'age': 40, 'symbol': 3, 'cars': 1, 'fee': 0}, 'invalid territory'], ['under-age applicant rejected', {'base': 74254, 'territory': 'B', 'age': 15, 'symbol': 2, 'cars': 1, 'fee': 0}, 'invalid age'], ['random rating 0', {'base': 35490, 'territory': 'C', 'age': 47, 'symbol': 10, 'cars': 1, 'fee': 0}, 66899], ['random rating 1', {'base': 93585, 'territory': 'B', 'age': 47, 'symbol': 2, 'cars': 1, 'fee': 0}, 113004], ['random rating 2', {'base': 54005, 'territory': 'C', 'age': 47, 'symbol': 8, 'cars': 1, 'fee': 0}, 94779], ['random rating 3', {'base': 35309, 'territory': 'C', 'age': 20, 'symbol': 6, 'cars': 2, 'fee': 1500}, 78959], ['top symbol relativity', {'base': 50002, 'territory': 'B', 'age': 40, 'symbol': 10, 'cars': 1, 'fee': 1500}, 84878], ['half-cent rounds up', {'base': 60007, 'territory': 'B', 'age': 40, 'symbol': 1, 'cars': 1, 'fee': 0}, 69008], ['sub-half cent rounds down', {'base': 40031, 'territory': 'B', 'age': 40, 'symbol': 1, 'cars': 1, 'fee': 0}, 46036]], [['youthful band ends at 24', {'base': 33706, 'territory': 'B', 'age': 24, 'symbol': 1, 'cars': 1, 'fee': 1500}, 59643], ['age 25 leaves youthful band', {'base': 47580, 'territory': 'C', 'age': 25, 'symbol': 4, 'cars': 1, 'fee': 1500}, 72632], ['senior boundary 65', {'base': 45782, 'territory': 'A', 'age': 65, 'symbol': 7, 'cars': 2, 'fee': 1500}, 65778], ['two cars earn multi-car discount', {'base': 69933, 'territory': 'C', 'age': 45, 'symbol': 3, 'cars': 2, 'fee': 2500}, 92504], ['single car control', {'base': 81532, 'territory': 'A', 'age': 57, 'symbol': 10, 'cars': 1, 'fee': 1500}, 119721], ['discounted policy below minimum', {'base': 31838, 'territory': 'A', 'age': 49, 'symbol': 1, 'cars': 3, 'fee': 1500}, 31500], ['unknown territory rejected', {'base': 23484, 'territory': 'Z', 'age': 40, 'symbol': 5, 'cars': 1, 'fee': 0}, 'invalid territory'], ['under-age applicant rejected', {'base': 20672, 'territory': 'A', 'age': 15, 'symbol': 8, 'cars': 1, 'fee': 1500}, 'invalid age'], ['random rating 0', {'base': 54283, 'territory': 'B', 'age': 16, 'symbol': 7, 'cars': 2, 'fee': 0}, 109557], ['random rating 1', {'base': 85283, 'territory': 'B', 'age': 33, 'symbol': 7, 'cars': 3, 'fee': 1500}, 116248], ['random rating 2', {'base': 97243, 'territory': 'A', 'age': 47, 'symbol': 10, 'cars': 2, 'fee': 1500}, 128402], ['random rating 3', {'base': 47342, 'territory': 'B', 'age': 70, 'symbol': 9, 'cars': 3, 'fee': 1500}, 83818], ['top symbol relativity', {'base': 50003, 'territory': 'B', 'age': 40, 'symbol': 10, 'cars': 1, 'fee': 2500}, 85880], ['half-cent rounds up', {'base': 60011, 'territory': 'B', 'age': 40, 'symbol': 1, 'cars': 1, 'fee': 0}, 69013], ['sub-half cent rounds down', {'base': 40051, 'territory': 'B', 'age': 40, 'symbol': 1, 'cars': 1, 'fee': 0}, 46059]], [['youthful band ends at 24', {'base': 49705, 'territory': 'B', 'age': 24, 'symbol': 10, 'cars': 1, 'fee': 0}, 124325], ['age 25 leaves youthful band', {'base': 77136, 'territory': 'B', 'age': 25, 'symbol': 9, 'cars': 1, 'fee': 2500}, 126689], ['senior boundary 65', {'base': 48566, 'territory': 'C', 'age': 65, 'symbol': 7, 'cars': 1, 'fee': 2500}, 100992], ['two cars earn multi-car discount', {'base': 86089, 'territory': 'C', 'age': 58, 'symbol': 4, 'cars': 2, 'fee': 2500}, 118333], ['single car control', {'base': 65782, 'territory': 'C', 'age': 60, 'symbol': 5, 'cars': 1, 'fee': 0}, 102620], ['discounted policy below minimum', {'base': 30193, 'territory': 'A', 'age': 34, 'symbol': 1, 'cars': 3, 'fee': 2500}, 32500], ['unknown territory rejected', {'base': 37853, 'territory': 'Z', 'age': 40, 'symbol': 5, 'cars': 1, 'fee': 2500}, 'invalid territory'], ['under-age applicant rejected', {'base': 85063, 'territory': 'C', 'age': 15, 'symbol': 9, 'cars': 1, 'fee': 1500}, 'invalid age'], ['random rating 0', {'base': 81605, 'territory': 'C', 'age': 70, 'symbol': 3, 'cars': 1, 'fee': 2500}, 142534], ['random rating 1', {'base': 50741, 'territory': 'C', 'age': 16, 'symbol': 9, 'cars': 1, 'fee': 0}, 138523], ['random rating 2', {'base': 88025, 'territory': 'B', 'age': 33, 'symbol': 5, 'cars': 1, 'fee': 0}, 121475], ['random rating 3', {'base': 60769, 'territory': 'C', 'age': 47, 'symbol': 8, 'cars': 3, 'fee': 1500}, 97485], ['top symbol relativity', {'base': 50004, 'territory': 'B', 'age': 40, 'symbol': 10, 'cars': 1, 'fee': 2500}, 85882], ['half-cent rounds up', {'base': 60015, 'territory': 'B', 'age': 40, 'symbol': 1, 'cars': 1, 'fee': 0}, 69017], ['sub-half cent rounds down', {'base': 40071, 'territory': 'B', 'age': 40, 'symbol': 1, 'cars': 1, 'fee': 2500}, 48582]], [['youthful band ends at 24', {'base': 83462, 'territory': 'C', 'age': 24, 'symbol': 4, 'cars': 1, 'fee': 0}, 187164], ['age 25 leaves youthful band', {'base': 23842, 'territory': 'A', 'age': 25, 'symbol': 10, 'cars': 1, 'fee': 2500}, 37071], ['senior boundary 65', {'base': 43695, 'territory': 'C', 'age': 65, 'symbol': 10, 'cars': 2, 'fee': 1500}, 90454], ['two cars earn multi-car discount', {'base': 87356, 'territory': 'A', 'age': 42, 'symbol': 8, 'cars': 2, 'fee': 2500}, 108638], ['single car control', {'base': 73244, 'territory': 'B', 'age': 41, 'symbol': 8, 'cars': 1, 'fee': 0}, 113711], ['discounted policy below minimum', {'base': 30044, 'territory': 'A', 'age': 31, 'symbol': 1, 'cars': 3, 'fee': 0}, 30000], ['unknown territory rejected', {'base': 50727, 'territory': 'Z', 'age': 40, 'symbol': 6, 'cars': 1, 'fee': 0}, 'invalid territory'], ['under-age applicant rejected', {'base': 35931, 'territory': 'A', 'age': 15, 'symbol': 3, 'cars': 1, 'fee': 1500}, 'invalid age'], ['random rating 0', {'base': 90411, 'territory': 'C', 'age': 70, 'symbol': 10, 'cars': 3, 'fee': 2500}, 186559], ['random rating 1', {'base': 60039, 'territory': 'C', 'age': 33, 'symbol': 10, 'cars': 2, 'fee': 2500}, 104356], ['random rating 2', {'base': 58926, 'territory': 'A', 'age': 47, 'symbol': 9, 'cars': 2, 'fee': 1500}, 75747], ['random rating 3', {'base': 56741, 'territory': 'B', 'age': 16, 'symbol': 6, 'cars': 1, 'fee': 2500}, 124848], ['top symbol relativity', {'base': 50005, 'territory': 'B', 'age': 40, 'symbol': 10, 'cars': 1, 'fee': 2500}, 85883], ['half-cent rounds up', {'base': 60019, 'territory': 'B', 'age': 40, 'symbol': 1, 'cars': 1, 'fee': 0}, 69022], ['sub-half cent rounds down', {'base': 40091, 'territory': 'B', 'age': 40, 'symbol': 1, 'cars': 1, 'fee': 2500}, 48605]]]
for label, args, expected in fixtures[N-1]:
    check(label, 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)
Boundary fixtureActualExpectedOutcome
youthful band ends at 24136368136368Passed
age 25 leaves youthful band5218552185Passed
senior boundary 654591245912Passed
two cars earn multi-car discount6505865058Passed
single car control5824658246Passed
discounted policy below minimum2787930000Failed
unknown territory rejectedinvalid territoryinvalid territoryPassed
under-age applicant rejectedinvalid ageinvalid agePassed
random rating 04990949909Passed
random rating 18567385673Passed
random rating 2163263163263Passed
random rating 3107028107028Passed
top symbol relativity8587785877Passed
half-cent rounds up7150371503Passed
sub-half cent rounds down4851348513Passed

SHA-256 / 009a42fa52aa78a0f1ff718a7538379f54fca3f4e579b4d94d258eb42428b0cf

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(x):
    T={'A':Fraction(1),'B':Fraction(115,100),'C':Fraction(130,100)}
    if x['territory'] not in T: return 'invalid territory'
    age=x['age']
    if age<16: return 'invalid age'
    if age<25: af=Fraction(150,100)
    elif age<65: af=Fraction(1)
    else: af=Fraction(120,100)
    sf=1+Fraction(5,100)*(x['symbol']-1)
    disc=Fraction(90,100) if x['cars']>=2 else Fraction(1)
    rated=x['base']*T[x['territory']]*af*sf
    rated=int(rated+Fraction(1,2))
    rated=max(rated,30000)
    rated=int(rated*disc)
    return rated+x['fee']
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['youthful band ends at 24', {'base': 54520, 'territory': 'B', 'age': 24, 'symbol': 10, 'cars': 1, 'fee': 0}, 136368], ['age 25 leaves youthful band', {'base': 48271, 'territory': 'A', 'age': 25, 'symbol': 2, 'cars': 1, 'fee': 1500}, 52185], ['senior boundary 65', {'base': 31490, 'territory': 'A', 'age': 65, 'symbol': 8, 'cars': 2, 'fee': 0}, 45912], ['two cars earn multi-car discount', {'base': 53546, 'territory': 'A', 'age': 55, 'symbol': 8, 'cars': 2, 'fee': 0}, 65058], ['single car control', {'base': 41604, 'territory': 'A', 'age': 56, 'symbol': 9, 'cars': 1, 'fee': 0}, 58246], ['discounted policy below minimum', {'base': 30977, 'territory': 'A', 'age': 39, 'symbol': 1, 'cars': 3, 'fee': 0}, 30000], ['unknown territory rejected', {'base': 78746, 'territory': 'Z', 'age': 40, 'symbol': 10, 'cars': 1, 'fee': 0}, 'invalid territory'], ['under-age applicant rejected', {'base': 84653, 'territory': 'C', 'age': 15, 'symbol': 2, 'cars': 1, 'fee': 2500}, 'invalid age'], ['random rating 0', {'base': 34126, 'territory': 'C', 'age': 33, 'symbol': 6, 'cars': 3, 'fee': 0}, 49909], ['random rating 1', {'base': 62350, 'territory': 'A', 'age': 16, 'symbol': 1, 'cars': 3, 'fee': 1500}, 85673], ['random rating 2', {'base': 95267, 'territory': 'A', 'age': 16, 'symbol': 6, 'cars': 2, 'fee': 2500}, 163263], ['random rating 3', {'base': 65141, 'territory': 'A', 'age': 16, 'symbol': 5, 'cars': 2, 'fee': 1500}, 107028], ['top symbol relativity', {'base': 50001, 'territory': 'B', 'age': 40, 'symbol': 10, 'cars': 1, 'fee': 2500}, 85877], ['half-cent rounds up', {'base': 60003, 'territory': 'B', 'age': 40, 'symbol': 1, 'cars': 1, 'fee': 2500}, 71503], ['sub-half cent rounds down', {'base': 40011, 'territory': 'B', 'age': 40, 'symbol': 1, 'cars': 1, 'fee': 2500}, 48513]], [['youthful band ends at 24', {'base': 65596, 'territory': 'B', 'age': 24, 'symbol': 4, 'cars': 1, 'fee': 1500}, 131626], ['age 25 leaves youthful band', {'base': 53332, 'territory': 'C', 'age': 25, 'symbol': 6, 'cars': 1, 'fee': 1500}, 88165], ['senior boundary 65', {'base': 72267, 'territory': 'B', 'age': 65, 'symbol': 9, 'cars': 2, 'fee': 0}, 125658], ['two cars earn multi-car discount', {'base': 46182, 'territory': 'A', 'age': 53, 'symbol': 1, 'cars': 2, 'fee': 2500}, 44064], ['single car control', {'base': 42325, 'territory': 'C', 'age': 57, 'symbol': 4, 'cars': 1, 'fee': 2500}, 65776], ['discounted policy below minimum', {'base': 31359, 'territory': 'A', 'age': 40, 'symbol': 1, 'cars': 3, 'fee': 1500}, 31500], ['unknown territory rejected', {'base': 70758, 'territory': 'Z', 'age': 40, 'symbol': 3, 'cars': 1, 'fee': 0}, 'invalid territory'], ['under-age applicant rejected', {'base': 74254, 'territory': 'B', 'age': 15, 'symbol': 2, 'cars': 1, 'fee': 0}, 'invalid age'], ['random rating 0', {'base': 35490, 'territory': 'C', 'age': 47, 'symbol': 10, 'cars': 1, 'fee': 0}, 66899], ['random rating 1', {'base': 93585, 'territory': 'B', 'age': 47, 'symbol': 2, 'cars': 1, 'fee': 0}, 113004], ['random rating 2', {'base': 54005, 'territory': 'C', 'age': 47, 'symbol': 8, 'cars': 1, 'fee': 0}, 94779], ['random rating 3', {'base': 35309, 'territory': 'C', 'age': 20, 'symbol': 6, 'cars': 2, 'fee': 1500}, 78959], ['top symbol relativity', {'base': 50002, 'territory': 'B', 'age': 40, 'symbol': 10, 'cars': 1, 'fee': 1500}, 84878], ['half-cent rounds up', {'base': 60007, 'territory': 'B', 'age': 40, 'symbol': 1, 'cars': 1, 'fee': 0}, 69008], ['sub-half cent rounds down', {'base': 40031, 'territory': 'B', 'age': 40, 'symbol': 1, 'cars': 1, 'fee': 0}, 46036]], [['youthful band ends at 24', {'base': 33706, 'territory': 'B', 'age': 24, 'symbol': 1, 'cars': 1, 'fee': 1500}, 59643], ['age 25 leaves youthful band', {'base': 47580, 'territory': 'C', 'age': 25, 'symbol': 4, 'cars': 1, 'fee': 1500}, 72632], ['senior boundary 65', {'base': 45782, 'territory': 'A', 'age': 65, 'symbol': 7, 'cars': 2, 'fee': 1500}, 65778], ['two cars earn multi-car discount', {'base': 69933, 'territory': 'C', 'age': 45, 'symbol': 3, 'cars': 2, 'fee': 2500}, 92504], ['single car control', {'base': 81532, 'territory': 'A', 'age': 57, 'symbol': 10, 'cars': 1, 'fee': 1500}, 119721], ['discounted policy below minimum', {'base': 31838, 'territory': 'A', 'age': 49, 'symbol': 1, 'cars': 3, 'fee': 1500}, 31500], ['unknown territory rejected', {'base': 23484, 'territory': 'Z', 'age': 40, 'symbol': 5, 'cars': 1, 'fee': 0}, 'invalid territory'], ['under-age applicant rejected', {'base': 20672, 'territory': 'A', 'age': 15, 'symbol': 8, 'cars': 1, 'fee': 1500}, 'invalid age'], ['random rating 0', {'base': 54283, 'territory': 'B', 'age': 16, 'symbol': 7, 'cars': 2, 'fee': 0}, 109557], ['random rating 1', {'base': 85283, 'territory': 'B', 'age': 33, 'symbol': 7, 'cars': 3, 'fee': 1500}, 116248], ['random rating 2', {'base': 97243, 'territory': 'A', 'age': 47, 'symbol': 10, 'cars': 2, 'fee': 1500}, 128402], ['random rating 3', {'base': 47342, 'territory': 'B', 'age': 70, 'symbol': 9, 'cars': 3, 'fee': 1500}, 83818], ['top symbol relativity', {'base': 50003, 'territory': 'B', 'age': 40, 'symbol': 10, 'cars': 1, 'fee': 2500}, 85880], ['half-cent rounds up', {'base': 60011, 'territory': 'B', 'age': 40, 'symbol': 1, 'cars': 1, 'fee': 0}, 69013], ['sub-half cent rounds down', {'base': 40051, 'territory': 'B', 'age': 40, 'symbol': 1, 'cars': 1, 'fee': 0}, 46059]], [['youthful band ends at 24', {'base': 49705, 'territory': 'B', 'age': 24, 'symbol': 10, 'cars': 1, 'fee': 0}, 124325], ['age 25 leaves youthful band', {'base': 77136, 'territory': 'B', 'age': 25, 'symbol': 9, 'cars': 1, 'fee': 2500}, 126689], ['senior boundary 65', {'base': 48566, 'territory': 'C', 'age': 65, 'symbol': 7, 'cars': 1, 'fee': 2500}, 100992], ['two cars earn multi-car discount', {'base': 86089, 'territory': 'C', 'age': 58, 'symbol': 4, 'cars': 2, 'fee': 2500}, 118333], ['single car control', {'base': 65782, 'territory': 'C', 'age': 60, 'symbol': 5, 'cars': 1, 'fee': 0}, 102620], ['discounted policy below minimum', {'base': 30193, 'territory': 'A', 'age': 34, 'symbol': 1, 'cars': 3, 'fee': 2500}, 32500], ['unknown territory rejected', {'base': 37853, 'territory': 'Z', 'age': 40, 'symbol': 5, 'cars': 1, 'fee': 2500}, 'invalid territory'], ['under-age applicant rejected', {'base': 85063, 'territory': 'C', 'age': 15, 'symbol': 9, 'cars': 1, 'fee': 1500}, 'invalid age'], ['random rating 0', {'base': 81605, 'territory': 'C', 'age': 70, 'symbol': 3, 'cars': 1, 'fee': 2500}, 142534], ['random rating 1', {'base': 50741, 'territory': 'C', 'age': 16, 'symbol': 9, 'cars': 1, 'fee': 0}, 138523], ['random rating 2', {'base': 88025, 'territory': 'B', 'age': 33, 'symbol': 5, 'cars': 1, 'fee': 0}, 121475], ['random rating 3', {'base': 60769, 'territory': 'C', 'age': 47, 'symbol': 8, 'cars': 3, 'fee': 1500}, 97485], ['top symbol relativity', {'base': 50004, 'territory': 'B', 'age': 40, 'symbol': 10, 'cars': 1, 'fee': 2500}, 85882], ['half-cent rounds up', {'base': 60015, 'territory': 'B', 'age': 40, 'symbol': 1, 'cars': 1, 'fee': 0}, 69017], ['sub-half cent rounds down', {'base': 40071, 'territory': 'B', 'age': 40, 'symbol': 1, 'cars': 1, 'fee': 2500}, 48582]], [['youthful band ends at 24', {'base': 83462, 'territory': 'C', 'age': 24, 'symbol': 4, 'cars': 1, 'fee': 0}, 187164], ['age 25 leaves youthful band', {'base': 23842, 'territory': 'A', 'age': 25, 'symbol': 10, 'cars': 1, 'fee': 2500}, 37071], ['senior boundary 65', {'base': 43695, 'territory': 'C', 'age': 65, 'symbol': 10, 'cars': 2, 'fee': 1500}, 90454], ['two cars earn multi-car discount', {'base': 87356, 'territory': 'A', 'age': 42, 'symbol': 8, 'cars': 2, 'fee': 2500}, 108638], ['single car control', {'base': 73244, 'territory': 'B', 'age': 41, 'symbol': 8, 'cars': 1, 'fee': 0}, 113711], ['discounted policy below minimum', {'base': 30044, 'territory': 'A', 'age': 31, 'symbol': 1, 'cars': 3, 'fee': 0}, 30000], ['unknown territory rejected', {'base': 50727, 'territory': 'Z', 'age': 40, 'symbol': 6, 'cars': 1, 'fee': 0}, 'invalid territory'], ['under-age applicant rejected', {'base': 35931, 'territory': 'A', 'age': 15, 'symbol': 3, 'cars': 1, 'fee': 1500}, 'invalid age'], ['random rating 0', {'base': 90411, 'territory': 'C', 'age': 70, 'symbol': 10, 'cars': 3, 'fee': 2500}, 186559], ['random rating 1', {'base': 60039, 'territory': 'C', 'age': 33, 'symbol': 10, 'cars': 2, 'fee': 2500}, 104356], ['random rating 2', {'base': 58926, 'territory': 'A', 'age': 47, 'symbol': 9, 'cars': 2, 'fee': 1500}, 75747], ['random rating 3', {'base': 56741, 'territory': 'B', 'age': 16, 'symbol': 6, 'cars': 1, 'fee': 2500}, 124848], ['top symbol relativity', {'base': 50005, 'territory': 'B', 'age': 40, 'symbol': 10, 'cars': 1, 'fee': 2500}, 85883], ['half-cent rounds up', {'base': 60019, 'territory': 'B', 'age': 40, 'symbol': 1, 'cars': 1, 'fee': 0}, 69022], ['sub-half cent rounds down', {'base': 40091, 'territory': 'B', 'age': 40, 'symbol': 1, 'cars': 1, 'fee': 2500}, 48605]]]
for label, args, expected in fixtures[N-1]:
    check(label, 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)
Boundary fixtureActualExpectedOutcome
youthful band ends at 24136368136368Passed
age 25 leaves youthful band5218552185Passed
senior boundary 654591245912Passed
two cars earn multi-car discount6505865058Passed
single car control5824658246Passed
discounted policy below minimum2787930000Failed
unknown territory rejectedinvalid territoryinvalid territoryPassed
under-age applicant rejectedinvalid ageinvalid agePassed
random rating 04990949909Passed
random rating 18567285673Failed
random rating 2163263163263Passed
random rating 3107028107028Passed
top symbol relativity8587785877Passed
half-cent rounds up7150371503Passed
sub-half cent rounds down4851348513Passed

SHA-256 / ffc9538a3fa1629bc326b6d9e922e3243448be1e544d8faccbe76cc879b7b01b

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(x):
    T={'A':Fraction(1),'B':Fraction(115,100),'C':Fraction(130,100)}
    if x['territory'] not in T: return 'invalid territory'
    age=x['age']
    if age<16: return 'invalid age'
    if age<25: af=Fraction(150,100)
    elif age<65: af=Fraction(1)
    else: af=Fraction(120,100)
    sf=1+Fraction(5,100)*(x['symbol']-1)
    disc=Fraction(90,100) if x['cars']>=2 else Fraction(1)
    rated=x['base']*T[x['territory']]*af*sf
    rated=rated*disc
    rated=int(rated+Fraction(1,2))
    rated=max(rated,30000)
    return rated+x['fee']
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['youthful band ends at 24', {'base': 54520, 'territory': 'B', 'age': 24, 'symbol': 10, 'cars': 1, 'fee': 0}, 136368], ['age 25 leaves youthful band', {'base': 48271, 'territory': 'A', 'age': 25, 'symbol': 2, 'cars': 1, 'fee': 1500}, 52185], ['senior boundary 65', {'base': 31490, 'territory': 'A', 'age': 65, 'symbol': 8, 'cars': 2, 'fee': 0}, 45912], ['two cars earn multi-car discount', {'base': 53546, 'territory': 'A', 'age': 55, 'symbol': 8, 'cars': 2, 'fee': 0}, 65058], ['single car control', {'base': 41604, 'territory': 'A', 'age': 56, 'symbol': 9, 'cars': 1, 'fee': 0}, 58246], ['discounted policy below minimum', {'base': 30977, 'territory': 'A', 'age': 39, 'symbol': 1, 'cars': 3, 'fee': 0}, 30000], ['unknown territory rejected', {'base': 78746, 'territory': 'Z', 'age': 40, 'symbol': 10, 'cars': 1, 'fee': 0}, 'invalid territory'], ['under-age applicant rejected', {'base': 84653, 'territory': 'C', 'age': 15, 'symbol': 2, 'cars': 1, 'fee': 2500}, 'invalid age'], ['random rating 0', {'base': 34126, 'territory': 'C', 'age': 33, 'symbol': 6, 'cars': 3, 'fee': 0}, 49909], ['random rating 1', {'base': 62350, 'territory': 'A', 'age': 16, 'symbol': 1, 'cars': 3, 'fee': 1500}, 85673], ['random rating 2', {'base': 95267, 'territory': 'A', 'age': 16, 'symbol': 6, 'cars': 2, 'fee': 2500}, 163263], ['random rating 3', {'base': 65141, 'territory': 'A', 'age': 16, 'symbol': 5, 'cars': 2, 'fee': 1500}, 107028], ['top symbol relativity', {'base': 50001, 'territory': 'B', 'age': 40, 'symbol': 10, 'cars': 1, 'fee': 2500}, 85877], ['half-cent rounds up', {'base': 60003, 'territory': 'B', 'age': 40, 'symbol': 1, 'cars': 1, 'fee': 2500}, 71503], ['sub-half cent rounds down', {'base': 40011, 'territory': 'B', 'age': 40, 'symbol': 1, 'cars': 1, 'fee': 2500}, 48513]], [['youthful band ends at 24', {'base': 65596, 'territory': 'B', 'age': 24, 'symbol': 4, 'cars': 1, 'fee': 1500}, 131626], ['age 25 leaves youthful band', {'base': 53332, 'territory': 'C', 'age': 25, 'symbol': 6, 'cars': 1, 'fee': 1500}, 88165], ['senior boundary 65', {'base': 72267, 'territory': 'B', 'age': 65, 'symbol': 9, 'cars': 2, 'fee': 0}, 125658], ['two cars earn multi-car discount', {'base': 46182, 'territory': 'A', 'age': 53, 'symbol': 1, 'cars': 2, 'fee': 2500}, 44064], ['single car control', {'base': 42325, 'territory': 'C', 'age': 57, 'symbol': 4, 'cars': 1, 'fee': 2500}, 65776], ['discounted policy below minimum', {'base': 31359, 'territory': 'A', 'age': 40, 'symbol': 1, 'cars': 3, 'fee': 1500}, 31500], ['unknown territory rejected', {'base': 70758, 'territory': 'Z', 'age': 40, 'symbol': 3, 'cars': 1, 'fee': 0}, 'invalid territory'], ['under-age applicant rejected', {'base': 74254, 'territory': 'B', 'age': 15, 'symbol': 2, 'cars': 1, 'fee': 0}, 'invalid age'], ['random rating 0', {'base': 35490, 'territory': 'C', 'age': 47, 'symbol': 10, 'cars': 1, 'fee': 0}, 66899], ['random rating 1', {'base': 93585, 'territory': 'B', 'age': 47, 'symbol': 2, 'cars': 1, 'fee': 0}, 113004], ['random rating 2', {'base': 54005, 'territory': 'C', 'age': 47, 'symbol': 8, 'cars': 1, 'fee': 0}, 94779], ['random rating 3', {'base': 35309, 'territory': 'C', 'age': 20, 'symbol': 6, 'cars': 2, 'fee': 1500}, 78959], ['top symbol relativity', {'base': 50002, 'territory': 'B', 'age': 40, 'symbol': 10, 'cars': 1, 'fee': 1500}, 84878], ['half-cent rounds up', {'base': 60007, 'territory': 'B', 'age': 40, 'symbol': 1, 'cars': 1, 'fee': 0}, 69008], ['sub-half cent rounds down', {'base': 40031, 'territory': 'B', 'age': 40, 'symbol': 1, 'cars': 1, 'fee': 0}, 46036]], [['youthful band ends at 24', {'base': 33706, 'territory': 'B', 'age': 24, 'symbol': 1, 'cars': 1, 'fee': 1500}, 59643], ['age 25 leaves youthful band', {'base': 47580, 'territory': 'C', 'age': 25, 'symbol': 4, 'cars': 1, 'fee': 1500}, 72632], ['senior boundary 65', {'base': 45782, 'territory': 'A', 'age': 65, 'symbol': 7, 'cars': 2, 'fee': 1500}, 65778], ['two cars earn multi-car discount', {'base': 69933, 'territory': 'C', 'age': 45, 'symbol': 3, 'cars': 2, 'fee': 2500}, 92504], ['single car control', {'base': 81532, 'territory': 'A', 'age': 57, 'symbol': 10, 'cars': 1, 'fee': 1500}, 119721], ['discounted policy below minimum', {'base': 31838, 'territory': 'A', 'age': 49, 'symbol': 1, 'cars': 3, 'fee': 1500}, 31500], ['unknown territory rejected', {'base': 23484, 'territory': 'Z', 'age': 40, 'symbol': 5, 'cars': 1, 'fee': 0}, 'invalid territory'], ['under-age applicant rejected', {'base': 20672, 'territory': 'A', 'age': 15, 'symbol': 8, 'cars': 1, 'fee': 1500}, 'invalid age'], ['random rating 0', {'base': 54283, 'territory': 'B', 'age': 16, 'symbol': 7, 'cars': 2, 'fee': 0}, 109557], ['random rating 1', {'base': 85283, 'territory': 'B', 'age': 33, 'symbol': 7, 'cars': 3, 'fee': 1500}, 116248], ['random rating 2', {'base': 97243, 'territory': 'A', 'age': 47, 'symbol': 10, 'cars': 2, 'fee': 1500}, 128402], ['random rating 3', {'base': 47342, 'territory': 'B', 'age': 70, 'symbol': 9, 'cars': 3, 'fee': 1500}, 83818], ['top symbol relativity', {'base': 50003, 'territory': 'B', 'age': 40, 'symbol': 10, 'cars': 1, 'fee': 2500}, 85880], ['half-cent rounds up', {'base': 60011, 'territory': 'B', 'age': 40, 'symbol': 1, 'cars': 1, 'fee': 0}, 69013], ['sub-half cent rounds down', {'base': 40051, 'territory': 'B', 'age': 40, 'symbol': 1, 'cars': 1, 'fee': 0}, 46059]], [['youthful band ends at 24', {'base': 49705, 'territory': 'B', 'age': 24, 'symbol': 10, 'cars': 1, 'fee': 0}, 124325], ['age 25 leaves youthful band', {'base': 77136, 'territory': 'B', 'age': 25, 'symbol': 9, 'cars': 1, 'fee': 2500}, 126689], ['senior boundary 65', {'base': 48566, 'territory': 'C', 'age': 65, 'symbol': 7, 'cars': 1, 'fee': 2500}, 100992], ['two cars earn multi-car discount', {'base': 86089, 'territory': 'C', 'age': 58, 'symbol': 4, 'cars': 2, 'fee': 2500}, 118333], ['single car control', {'base': 65782, 'territory': 'C', 'age': 60, 'symbol': 5, 'cars': 1, 'fee': 0}, 102620], ['discounted policy below minimum', {'base': 30193, 'territory': 'A', 'age': 34, 'symbol': 1, 'cars': 3, 'fee': 2500}, 32500], ['unknown territory rejected', {'base': 37853, 'territory': 'Z', 'age': 40, 'symbol': 5, 'cars': 1, 'fee': 2500}, 'invalid territory'], ['under-age applicant rejected', {'base': 85063, 'territory': 'C', 'age': 15, 'symbol': 9, 'cars': 1, 'fee': 1500}, 'invalid age'], ['random rating 0', {'base': 81605, 'territory': 'C', 'age': 70, 'symbol': 3, 'cars': 1, 'fee': 2500}, 142534], ['random rating 1', {'base': 50741, 'territory': 'C', 'age': 16, 'symbol': 9, 'cars': 1, 'fee': 0}, 138523], ['random rating 2', {'base': 88025, 'territory': 'B', 'age': 33, 'symbol': 5, 'cars': 1, 'fee': 0}, 121475], ['random rating 3', {'base': 60769, 'territory': 'C', 'age': 47, 'symbol': 8, 'cars': 3, 'fee': 1500}, 97485], ['top symbol relativity', {'base': 50004, 'territory': 'B', 'age': 40, 'symbol': 10, 'cars': 1, 'fee': 2500}, 85882], ['half-cent rounds up', {'base': 60015, 'territory': 'B', 'age': 40, 'symbol': 1, 'cars': 1, 'fee': 0}, 69017], ['sub-half cent rounds down', {'base': 40071, 'territory': 'B', 'age': 40, 'symbol': 1, 'cars': 1, 'fee': 2500}, 48582]], [['youthful band ends at 24', {'base': 83462, 'territory': 'C', 'age': 24, 'symbol': 4, 'cars': 1, 'fee': 0}, 187164], ['age 25 leaves youthful band', {'base': 23842, 'territory': 'A', 'age': 25, 'symbol': 10, 'cars': 1, 'fee': 2500}, 37071], ['senior boundary 65', {'base': 43695, 'territory': 'C', 'age': 65, 'symbol': 10, 'cars': 2, 'fee': 1500}, 90454], ['two cars earn multi-car discount', {'base': 87356, 'territory': 'A', 'age': 42, 'symbol': 8, 'cars': 2, 'fee': 2500}, 108638], ['single car control', {'base': 73244, 'territory': 'B', 'age': 41, 'symbol': 8, 'cars': 1, 'fee': 0}, 113711], ['discounted policy below minimum', {'base': 30044, 'territory': 'A', 'age': 31, 'symbol': 1, 'cars': 3, 'fee': 0}, 30000], ['unknown territory rejected', {'base': 50727, 'territory': 'Z', 'age': 40, 'symbol': 6, 'cars': 1, 'fee': 0}, 'invalid territory'], ['under-age applicant rejected', {'base': 35931, 'territory': 'A', 'age': 15, 'symbol': 3, 'cars': 1, 'fee': 1500}, 'invalid age'], ['random rating 0', {'base': 90411, 'territory': 'C', 'age': 70, 'symbol': 10, 'cars': 3, 'fee': 2500}, 186559], ['random rating 1', {'base': 60039, 'territory': 'C', 'age': 33, 'symbol': 10, 'cars': 2, 'fee': 2500}, 104356], ['random rating 2', {'base': 58926, 'territory': 'A', 'age': 47, 'symbol': 9, 'cars': 2, 'fee': 1500}, 75747], ['random rating 3', {'base': 56741, 'territory': 'B', 'age': 16, 'symbol': 6, 'cars': 1, 'fee': 2500}, 124848], ['top symbol relativity', {'base': 50005, 'territory': 'B', 'age': 40, 'symbol': 10, 'cars': 1, 'fee': 2500}, 85883], ['half-cent rounds up', {'base': 60019, 'territory': 'B', 'age': 40, 'symbol': 1, 'cars': 1, 'fee': 0}, 69022], ['sub-half cent rounds down', {'base': 40091, 'territory': 'B', 'age': 40, 'symbol': 1, 'cars': 1, 'fee': 2500}, 48605]]]
for label, args, expected in fixtures[N-1]:
    check(label, 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)
Boundary fixtureActualExpectedOutcome
youthful band ends at 24136368136368Passed
age 25 leaves youthful band5218552185Passed
senior boundary 654591245912Passed
two cars earn multi-car discount6505865058Passed
single car control5824658246Passed
discounted policy below minimum3000030000Passed
unknown territory rejectedinvalid territoryinvalid territoryPassed
under-age applicant rejectedinvalid ageinvalid agePassed
random rating 04990949909Passed
random rating 18567385673Passed
random rating 2163263163263Passed
random rating 3107028107028Passed
top symbol relativity8587785877Passed
half-cent rounds up7150371503Passed
sub-half cent rounds down4851348513Passed

SHA-256 / b4b5f98603af34056fc5f928b0387d6ea336bc6494c930b76e129db98fd012b8

Verification & scope

A deterministic bounded teaching model of a stipulated toy rating contract. Amounts are integer cents and factors exact rationals; it makes no claim of conformance with any filed rating plan, bureau manual or jurisdiction. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:47:08.759766+00:00.

Case digest / 697f84aae54b01e5543fac9081333083849514ca622dec710f7c539694ffa2c6