FAILURE MAP
← Case archive

FA-63206 / Insurance premium rating / Open access

Premium tax, surcharge and stamping fee allocation: Billed total is recomputed from unrounded items · case 01

The invoice total does not equal the sum of its itemised lines.

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

ROOT CAUSE

The total rounds the exact sum rather than adding the rounded items.

VERIFIED REPAIR

Total the rounded line items.

Unsuccessful approach: Applying all rates to one base misstates both lines and total.

Case contract

Input premium (may be negative for return premium), policy_fee, inspection_fee, tax, surcharge, stamping (per mille). Tax applies to premium+policy fee; surcharge to premium only; stamping to premium+both fees. Each item is rounded half away from zero separately; return [tax, surcharge, stamping, total billed].

Why this case matters

Tax and fee bases differ item by item, and each item is filed and remitted separately.

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):
    p=x['premium']; pf=x['policy_fee']; inf=x['inspection_fee']
    def r(v): return math.floor(v+Fraction(1,2)) if v>=0 else -math.floor(-v+Fraction(1,2))
    tax=r(Fraction((p+pf)*x['tax'],1000))
    sur=r(Fraction(p*x['surcharge'],1000))
    stamp=r(Fraction((p+pf+inf)*x['stamping'],1000))
    return [tax,sur,stamp,r(p+pf+inf+Fraction((p+pf)*x['tax'],1000)+Fraction(p*x['surcharge'],1000)+Fraction((p+pf+inf)*x['stamping'],1000))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['new business 0', {'premium': 412845, 'policy_fee': 2500, 'inspection_fee': 7500, 'tax': 50, 'surcharge': 3, 'stamping': 2}, [20767, 1239, 846, 445697]], ['new business 1', {'premium': 206492, 'policy_fee': 2500, 'inspection_fee': 15000, 'tax': 36, 'surcharge': 7, 'stamping': 2}, [7524, 1445, 448, 233409]], ['new business 2', {'premium': 248678, 'policy_fee': 5000, 'inspection_fee': 15000, 'tax': 50, 'surcharge': 3, 'stamping': 1}, [12684, 746, 269, 282377]], ['new business 3', {'premium': 180805, 'policy_fee': 2500, 'inspection_fee': 7500, 'tax': 50, 'surcharge': 3, 'stamping': 2}, [9165, 542, 382, 200894]], ['new business 4', {'premium': 81321, 'policy_fee': 2500, 'inspection_fee': 15000, 'tax': 36, 'surcharge': 7, 'stamping': 2}, [3018, 569, 198, 102606]], ['return premium tie', {'premium': -12500, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 5, 'surcharge': 3, 'stamping': 1}, [-63, -38, -13, -12614]], ['return premium odd tie', {'premium': -112500, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 1, 'surcharge': 1, 'stamping': 1}, [-113, -113, -113, -112839]], ['no fees', {'premium': 296266, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 36, 'surcharge': 3, 'stamping': 1}, [10666, 889, 296, 308117]]], [['new business 0', {'premium': 63014, 'policy_fee': 5000, 'inspection_fee': 7500, 'tax': 36, 'surcharge': 7, 'stamping': 2}, [2449, 441, 151, 78555]], ['new business 1', {'premium': 135696, 'policy_fee': 2500, 'inspection_fee': 15000, 'tax': 50, 'surcharge': 7, 'stamping': 1}, [6910, 950, 153, 161209]], ['new business 2', {'premium': 152271, 'policy_fee': 2500, 'inspection_fee': 7500, 'tax': 49, 'surcharge': 7, 'stamping': 1}, [7584, 1066, 162, 171083]], ['new business 3', {'premium': 393593, 'policy_fee': 5000, 'inspection_fee': 7500, 'tax': 49, 'surcharge': 7, 'stamping': 2}, [19531, 2755, 812, 429191]], ['new business 4', {'premium': 347134, 'policy_fee': 5000, 'inspection_fee': 15000, 'tax': 36, 'surcharge': 3, 'stamping': 1}, [12677, 1041, 367, 381219]], ['return premium tie', {'premium': -37500, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 5, 'surcharge': 3, 'stamping': 1}, [-188, -113, -38, -37839]], ['return premium odd tie', {'premium': -137500, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 1, 'surcharge': 1, 'stamping': 1}, [-138, -138, -138, -137914]], ['no fees', {'premium': 313133, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 50, 'surcharge': 3, 'stamping': 2}, [15657, 939, 626, 330355]]], [['new business 0', {'premium': 464734, 'policy_fee': 5000, 'inspection_fee': 15000, 'tax': 36, 'surcharge': 3, 'stamping': 1}, [16910, 1394, 485, 503523]], ['new business 1', {'premium': 379927, 'policy_fee': 2500, 'inspection_fee': 7500, 'tax': 49, 'surcharge': 7, 'stamping': 2}, [18739, 2659, 780, 412105]], ['new business 2', {'premium': 142805, 'policy_fee': 2500, 'inspection_fee': 7500, 'tax': 36, 'surcharge': 7, 'stamping': 1}, [5231, 1000, 153, 159189]], ['new business 3', {'premium': 172357, 'policy_fee': 2500, 'inspection_fee': 7500, 'tax': 36, 'surcharge': 7, 'stamping': 2}, [6295, 1206, 365, 190223]], ['new business 4', {'premium': 145157, 'policy_fee': 2500, 'inspection_fee': 15000, 'tax': 49, 'surcharge': 7, 'stamping': 2}, [7235, 1016, 325, 171233]], ['return premium tie', {'premium': -62500, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 5, 'surcharge': 3, 'stamping': 1}, [-313, -188, -63, -63064]], ['return premium odd tie', {'premium': -162500, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 1, 'surcharge': 1, 'stamping': 1}, [-163, -163, -163, -162989]], ['no fees', {'premium': 383065, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 36, 'surcharge': 7, 'stamping': 1}, [13790, 2681, 383, 399919]]], [['new business 0', {'premium': 410101, 'policy_fee': 5000, 'inspection_fee': 15000, 'tax': 50, 'surcharge': 7, 'stamping': 1}, [20755, 2871, 430, 454157]], ['new business 1', {'premium': 268176, 'policy_fee': 2500, 'inspection_fee': 15000, 'tax': 50, 'surcharge': 7, 'stamping': 1}, [13534, 1877, 286, 301373]], ['new business 2', {'premium': 321115, 'policy_fee': 2500, 'inspection_fee': 15000, 'tax': 50, 'surcharge': 7, 'stamping': 1}, [16181, 2248, 339, 357383]], ['new business 3', {'premium': 50665, 'policy_fee': 2500, 'inspection_fee': 7500, 'tax': 36, 'surcharge': 7, 'stamping': 1}, [1914, 355, 61, 62995]], ['new business 4', {'premium': 490929, 'policy_fee': 5000, 'inspection_fee': 7500, 'tax': 49, 'surcharge': 3, 'stamping': 1}, [24301, 1473, 503, 529706]], ['return premium tie', {'premium': -87500, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 5, 'surcharge': 3, 'stamping': 1}, [-438, -263, -88, -88289]], ['return premium odd tie', {'premium': -187500, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 1, 'surcharge': 1, 'stamping': 1}, [-188, -188, -188, -188064]], ['no fees', {'premium': 176432, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 50, 'surcharge': 7, 'stamping': 1}, [8822, 1235, 176, 186665]]], [['new business 0', {'premium': 318606, 'policy_fee': 2500, 'inspection_fee': 15000, 'tax': 49, 'surcharge': 7, 'stamping': 2}, [15734, 2230, 672, 354742]], ['new business 1', {'premium': 169116, 'policy_fee': 2500, 'inspection_fee': 15000, 'tax': 50, 'surcharge': 3, 'stamping': 1}, [8581, 507, 187, 195891]], ['new business 2', {'premium': 235982, 'policy_fee': 2500, 'inspection_fee': 7500, 'tax': 50, 'surcharge': 7, 'stamping': 2}, [11924, 1652, 492, 260050]], ['new business 3', {'premium': 143193, 'policy_fee': 2500, 'inspection_fee': 7500, 'tax': 49, 'surcharge': 3, 'stamping': 2}, [7139, 430, 306, 161068]], ['new business 4', {'premium': 241775, 'policy_fee': 2500, 'inspection_fee': 15000, 'tax': 50, 'surcharge': 7, 'stamping': 1}, [12214, 1692, 259, 273440]], ['return premium tie', {'premium': -112500, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 5, 'surcharge': 3, 'stamping': 1}, [-563, -338, -113, -113514]], ['return premium odd tie', {'premium': -212500, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 1, 'surcharge': 1, 'stamping': 1}, [-213, -213, -213, -213139]], ['no fees', {'premium': 300225, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 49, 'surcharge': 7, 'stamping': 1}, [14711, 2102, 300, 317338]]]]
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
new business 0[20767, 1239, 846, 445696][20767, 1239, 846, 445697]Failed
new business 1[7524, 1445, 448, 233409][7524, 1445, 448, 233409]Passed
new business 2[12684, 746, 269, 282377][12684, 746, 269, 282377]Passed
new business 3[9165, 542, 382, 200894][9165, 542, 382, 200894]Passed
new business 4[3018, 569, 198, 102605][3018, 569, 198, 102606]Failed
return premium tie[-63, -38, -13, -12613][-63, -38, -13, -12614]Failed
return premium odd tie[-113, -113, -113, -112838][-113, -113, -113, -112839]Failed
no fees[10666, 889, 296, 308117][10666, 889, 296, 308117]Passed

SHA-256 / 58531e4505260831a7ff5dc6419717d409c94c9ca00a4245618656144b4d1675

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):
    p=x['premium']; pf=x['policy_fee']; inf=x['inspection_fee']
    def r(v): return math.floor(v+Fraction(1,2)) if v>=0 else -math.floor(-v+Fraction(1,2))
    tax=r(Fraction((p+pf)*x['tax'],1000))
    sur=r(Fraction(p*x['surcharge'],1000))
    stamp=r(Fraction((p+pf+inf)*x['stamping'],1000))
    return [tax,sur,stamp,r((p+pf+inf)*(1+Fraction(x['tax']+x['surcharge']+x['stamping'],1000)))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['new business 0', {'premium': 412845, 'policy_fee': 2500, 'inspection_fee': 7500, 'tax': 50, 'surcharge': 3, 'stamping': 2}, [20767, 1239, 846, 445697]], ['new business 1', {'premium': 206492, 'policy_fee': 2500, 'inspection_fee': 15000, 'tax': 36, 'surcharge': 7, 'stamping': 2}, [7524, 1445, 448, 233409]], ['new business 2', {'premium': 248678, 'policy_fee': 5000, 'inspection_fee': 15000, 'tax': 50, 'surcharge': 3, 'stamping': 1}, [12684, 746, 269, 282377]], ['new business 3', {'premium': 180805, 'policy_fee': 2500, 'inspection_fee': 7500, 'tax': 50, 'surcharge': 3, 'stamping': 2}, [9165, 542, 382, 200894]], ['new business 4', {'premium': 81321, 'policy_fee': 2500, 'inspection_fee': 15000, 'tax': 36, 'surcharge': 7, 'stamping': 2}, [3018, 569, 198, 102606]], ['return premium tie', {'premium': -12500, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 5, 'surcharge': 3, 'stamping': 1}, [-63, -38, -13, -12614]], ['return premium odd tie', {'premium': -112500, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 1, 'surcharge': 1, 'stamping': 1}, [-113, -113, -113, -112839]], ['no fees', {'premium': 296266, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 36, 'surcharge': 3, 'stamping': 1}, [10666, 889, 296, 308117]]], [['new business 0', {'premium': 63014, 'policy_fee': 5000, 'inspection_fee': 7500, 'tax': 36, 'surcharge': 7, 'stamping': 2}, [2449, 441, 151, 78555]], ['new business 1', {'premium': 135696, 'policy_fee': 2500, 'inspection_fee': 15000, 'tax': 50, 'surcharge': 7, 'stamping': 1}, [6910, 950, 153, 161209]], ['new business 2', {'premium': 152271, 'policy_fee': 2500, 'inspection_fee': 7500, 'tax': 49, 'surcharge': 7, 'stamping': 1}, [7584, 1066, 162, 171083]], ['new business 3', {'premium': 393593, 'policy_fee': 5000, 'inspection_fee': 7500, 'tax': 49, 'surcharge': 7, 'stamping': 2}, [19531, 2755, 812, 429191]], ['new business 4', {'premium': 347134, 'policy_fee': 5000, 'inspection_fee': 15000, 'tax': 36, 'surcharge': 3, 'stamping': 1}, [12677, 1041, 367, 381219]], ['return premium tie', {'premium': -37500, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 5, 'surcharge': 3, 'stamping': 1}, [-188, -113, -38, -37839]], ['return premium odd tie', {'premium': -137500, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 1, 'surcharge': 1, 'stamping': 1}, [-138, -138, -138, -137914]], ['no fees', {'premium': 313133, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 50, 'surcharge': 3, 'stamping': 2}, [15657, 939, 626, 330355]]], [['new business 0', {'premium': 464734, 'policy_fee': 5000, 'inspection_fee': 15000, 'tax': 36, 'surcharge': 3, 'stamping': 1}, [16910, 1394, 485, 503523]], ['new business 1', {'premium': 379927, 'policy_fee': 2500, 'inspection_fee': 7500, 'tax': 49, 'surcharge': 7, 'stamping': 2}, [18739, 2659, 780, 412105]], ['new business 2', {'premium': 142805, 'policy_fee': 2500, 'inspection_fee': 7500, 'tax': 36, 'surcharge': 7, 'stamping': 1}, [5231, 1000, 153, 159189]], ['new business 3', {'premium': 172357, 'policy_fee': 2500, 'inspection_fee': 7500, 'tax': 36, 'surcharge': 7, 'stamping': 2}, [6295, 1206, 365, 190223]], ['new business 4', {'premium': 145157, 'policy_fee': 2500, 'inspection_fee': 15000, 'tax': 49, 'surcharge': 7, 'stamping': 2}, [7235, 1016, 325, 171233]], ['return premium tie', {'premium': -62500, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 5, 'surcharge': 3, 'stamping': 1}, [-313, -188, -63, -63064]], ['return premium odd tie', {'premium': -162500, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 1, 'surcharge': 1, 'stamping': 1}, [-163, -163, -163, -162989]], ['no fees', {'premium': 383065, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 36, 'surcharge': 7, 'stamping': 1}, [13790, 2681, 383, 399919]]], [['new business 0', {'premium': 410101, 'policy_fee': 5000, 'inspection_fee': 15000, 'tax': 50, 'surcharge': 7, 'stamping': 1}, [20755, 2871, 430, 454157]], ['new business 1', {'premium': 268176, 'policy_fee': 2500, 'inspection_fee': 15000, 'tax': 50, 'surcharge': 7, 'stamping': 1}, [13534, 1877, 286, 301373]], ['new business 2', {'premium': 321115, 'policy_fee': 2500, 'inspection_fee': 15000, 'tax': 50, 'surcharge': 7, 'stamping': 1}, [16181, 2248, 339, 357383]], ['new business 3', {'premium': 50665, 'policy_fee': 2500, 'inspection_fee': 7500, 'tax': 36, 'surcharge': 7, 'stamping': 1}, [1914, 355, 61, 62995]], ['new business 4', {'premium': 490929, 'policy_fee': 5000, 'inspection_fee': 7500, 'tax': 49, 'surcharge': 3, 'stamping': 1}, [24301, 1473, 503, 529706]], ['return premium tie', {'premium': -87500, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 5, 'surcharge': 3, 'stamping': 1}, [-438, -263, -88, -88289]], ['return premium odd tie', {'premium': -187500, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 1, 'surcharge': 1, 'stamping': 1}, [-188, -188, -188, -188064]], ['no fees', {'premium': 176432, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 50, 'surcharge': 7, 'stamping': 1}, [8822, 1235, 176, 186665]]], [['new business 0', {'premium': 318606, 'policy_fee': 2500, 'inspection_fee': 15000, 'tax': 49, 'surcharge': 7, 'stamping': 2}, [15734, 2230, 672, 354742]], ['new business 1', {'premium': 169116, 'policy_fee': 2500, 'inspection_fee': 15000, 'tax': 50, 'surcharge': 3, 'stamping': 1}, [8581, 507, 187, 195891]], ['new business 2', {'premium': 235982, 'policy_fee': 2500, 'inspection_fee': 7500, 'tax': 50, 'surcharge': 7, 'stamping': 2}, [11924, 1652, 492, 260050]], ['new business 3', {'premium': 143193, 'policy_fee': 2500, 'inspection_fee': 7500, 'tax': 49, 'surcharge': 3, 'stamping': 2}, [7139, 430, 306, 161068]], ['new business 4', {'premium': 241775, 'policy_fee': 2500, 'inspection_fee': 15000, 'tax': 50, 'surcharge': 7, 'stamping': 1}, [12214, 1692, 259, 273440]], ['return premium tie', {'premium': -112500, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 5, 'surcharge': 3, 'stamping': 1}, [-563, -338, -113, -113514]], ['return premium odd tie', {'premium': -212500, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 1, 'surcharge': 1, 'stamping': 1}, [-213, -213, -213, -213139]], ['no fees', {'premium': 300225, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 49, 'surcharge': 7, 'stamping': 1}, [14711, 2102, 300, 317338]]]]
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
new business 0[20767, 1239, 846, 446101][20767, 1239, 846, 445697]Failed
new business 1[7524, 1445, 448, 234072][7524, 1445, 448, 233409]Failed
new business 2[12684, 746, 269, 283187][12684, 746, 269, 282377]Failed
new business 3[9165, 542, 382, 201299][9165, 542, 382, 200894]Failed
new business 4[3018, 569, 198, 103268][3018, 569, 198, 102606]Failed
return premium tie[-63, -38, -13, -12613][-63, -38, -13, -12614]Failed
return premium odd tie[-113, -113, -113, -112838][-113, -113, -113, -112839]Failed
no fees[10666, 889, 296, 308117][10666, 889, 296, 308117]Passed

SHA-256 / 128ec48ca31b76947ddfbf439c72809e505421c11f8d7eb804cf3a19559acf6a

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):
    p=x['premium']; pf=x['policy_fee']; inf=x['inspection_fee']
    def r(v): return math.floor(v+Fraction(1,2)) if v>=0 else -math.floor(-v+Fraction(1,2))
    tax=r(Fraction((p+pf)*x['tax'],1000))
    sur=r(Fraction(p*x['surcharge'],1000))
    stamp=r(Fraction((p+pf+inf)*x['stamping'],1000))
    return [tax,sur,stamp,p+pf+inf+tax+sur+stamp]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['new business 0', {'premium': 412845, 'policy_fee': 2500, 'inspection_fee': 7500, 'tax': 50, 'surcharge': 3, 'stamping': 2}, [20767, 1239, 846, 445697]], ['new business 1', {'premium': 206492, 'policy_fee': 2500, 'inspection_fee': 15000, 'tax': 36, 'surcharge': 7, 'stamping': 2}, [7524, 1445, 448, 233409]], ['new business 2', {'premium': 248678, 'policy_fee': 5000, 'inspection_fee': 15000, 'tax': 50, 'surcharge': 3, 'stamping': 1}, [12684, 746, 269, 282377]], ['new business 3', {'premium': 180805, 'policy_fee': 2500, 'inspection_fee': 7500, 'tax': 50, 'surcharge': 3, 'stamping': 2}, [9165, 542, 382, 200894]], ['new business 4', {'premium': 81321, 'policy_fee': 2500, 'inspection_fee': 15000, 'tax': 36, 'surcharge': 7, 'stamping': 2}, [3018, 569, 198, 102606]], ['return premium tie', {'premium': -12500, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 5, 'surcharge': 3, 'stamping': 1}, [-63, -38, -13, -12614]], ['return premium odd tie', {'premium': -112500, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 1, 'surcharge': 1, 'stamping': 1}, [-113, -113, -113, -112839]], ['no fees', {'premium': 296266, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 36, 'surcharge': 3, 'stamping': 1}, [10666, 889, 296, 308117]]], [['new business 0', {'premium': 63014, 'policy_fee': 5000, 'inspection_fee': 7500, 'tax': 36, 'surcharge': 7, 'stamping': 2}, [2449, 441, 151, 78555]], ['new business 1', {'premium': 135696, 'policy_fee': 2500, 'inspection_fee': 15000, 'tax': 50, 'surcharge': 7, 'stamping': 1}, [6910, 950, 153, 161209]], ['new business 2', {'premium': 152271, 'policy_fee': 2500, 'inspection_fee': 7500, 'tax': 49, 'surcharge': 7, 'stamping': 1}, [7584, 1066, 162, 171083]], ['new business 3', {'premium': 393593, 'policy_fee': 5000, 'inspection_fee': 7500, 'tax': 49, 'surcharge': 7, 'stamping': 2}, [19531, 2755, 812, 429191]], ['new business 4', {'premium': 347134, 'policy_fee': 5000, 'inspection_fee': 15000, 'tax': 36, 'surcharge': 3, 'stamping': 1}, [12677, 1041, 367, 381219]], ['return premium tie', {'premium': -37500, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 5, 'surcharge': 3, 'stamping': 1}, [-188, -113, -38, -37839]], ['return premium odd tie', {'premium': -137500, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 1, 'surcharge': 1, 'stamping': 1}, [-138, -138, -138, -137914]], ['no fees', {'premium': 313133, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 50, 'surcharge': 3, 'stamping': 2}, [15657, 939, 626, 330355]]], [['new business 0', {'premium': 464734, 'policy_fee': 5000, 'inspection_fee': 15000, 'tax': 36, 'surcharge': 3, 'stamping': 1}, [16910, 1394, 485, 503523]], ['new business 1', {'premium': 379927, 'policy_fee': 2500, 'inspection_fee': 7500, 'tax': 49, 'surcharge': 7, 'stamping': 2}, [18739, 2659, 780, 412105]], ['new business 2', {'premium': 142805, 'policy_fee': 2500, 'inspection_fee': 7500, 'tax': 36, 'surcharge': 7, 'stamping': 1}, [5231, 1000, 153, 159189]], ['new business 3', {'premium': 172357, 'policy_fee': 2500, 'inspection_fee': 7500, 'tax': 36, 'surcharge': 7, 'stamping': 2}, [6295, 1206, 365, 190223]], ['new business 4', {'premium': 145157, 'policy_fee': 2500, 'inspection_fee': 15000, 'tax': 49, 'surcharge': 7, 'stamping': 2}, [7235, 1016, 325, 171233]], ['return premium tie', {'premium': -62500, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 5, 'surcharge': 3, 'stamping': 1}, [-313, -188, -63, -63064]], ['return premium odd tie', {'premium': -162500, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 1, 'surcharge': 1, 'stamping': 1}, [-163, -163, -163, -162989]], ['no fees', {'premium': 383065, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 36, 'surcharge': 7, 'stamping': 1}, [13790, 2681, 383, 399919]]], [['new business 0', {'premium': 410101, 'policy_fee': 5000, 'inspection_fee': 15000, 'tax': 50, 'surcharge': 7, 'stamping': 1}, [20755, 2871, 430, 454157]], ['new business 1', {'premium': 268176, 'policy_fee': 2500, 'inspection_fee': 15000, 'tax': 50, 'surcharge': 7, 'stamping': 1}, [13534, 1877, 286, 301373]], ['new business 2', {'premium': 321115, 'policy_fee': 2500, 'inspection_fee': 15000, 'tax': 50, 'surcharge': 7, 'stamping': 1}, [16181, 2248, 339, 357383]], ['new business 3', {'premium': 50665, 'policy_fee': 2500, 'inspection_fee': 7500, 'tax': 36, 'surcharge': 7, 'stamping': 1}, [1914, 355, 61, 62995]], ['new business 4', {'premium': 490929, 'policy_fee': 5000, 'inspection_fee': 7500, 'tax': 49, 'surcharge': 3, 'stamping': 1}, [24301, 1473, 503, 529706]], ['return premium tie', {'premium': -87500, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 5, 'surcharge': 3, 'stamping': 1}, [-438, -263, -88, -88289]], ['return premium odd tie', {'premium': -187500, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 1, 'surcharge': 1, 'stamping': 1}, [-188, -188, -188, -188064]], ['no fees', {'premium': 176432, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 50, 'surcharge': 7, 'stamping': 1}, [8822, 1235, 176, 186665]]], [['new business 0', {'premium': 318606, 'policy_fee': 2500, 'inspection_fee': 15000, 'tax': 49, 'surcharge': 7, 'stamping': 2}, [15734, 2230, 672, 354742]], ['new business 1', {'premium': 169116, 'policy_fee': 2500, 'inspection_fee': 15000, 'tax': 50, 'surcharge': 3, 'stamping': 1}, [8581, 507, 187, 195891]], ['new business 2', {'premium': 235982, 'policy_fee': 2500, 'inspection_fee': 7500, 'tax': 50, 'surcharge': 7, 'stamping': 2}, [11924, 1652, 492, 260050]], ['new business 3', {'premium': 143193, 'policy_fee': 2500, 'inspection_fee': 7500, 'tax': 49, 'surcharge': 3, 'stamping': 2}, [7139, 430, 306, 161068]], ['new business 4', {'premium': 241775, 'policy_fee': 2500, 'inspection_fee': 15000, 'tax': 50, 'surcharge': 7, 'stamping': 1}, [12214, 1692, 259, 273440]], ['return premium tie', {'premium': -112500, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 5, 'surcharge': 3, 'stamping': 1}, [-563, -338, -113, -113514]], ['return premium odd tie', {'premium': -212500, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 1, 'surcharge': 1, 'stamping': 1}, [-213, -213, -213, -213139]], ['no fees', {'premium': 300225, 'policy_fee': 0, 'inspection_fee': 0, 'tax': 49, 'surcharge': 7, 'stamping': 1}, [14711, 2102, 300, 317338]]]]
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
new business 0[20767, 1239, 846, 445697][20767, 1239, 846, 445697]Passed
new business 1[7524, 1445, 448, 233409][7524, 1445, 448, 233409]Passed
new business 2[12684, 746, 269, 282377][12684, 746, 269, 282377]Passed
new business 3[9165, 542, 382, 200894][9165, 542, 382, 200894]Passed
new business 4[3018, 569, 198, 102606][3018, 569, 198, 102606]Passed
return premium tie[-63, -38, -13, -12614][-63, -38, -13, -12614]Passed
return premium odd tie[-113, -113, -113, -112839][-113, -113, -113, -112839]Passed
no fees[10666, 889, 296, 308117][10666, 889, 296, 308117]Passed

SHA-256 / 2fbef268ab74eb453b992a17803c4fc668579d35685548c5be9f8862958205ad

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:12.188812+00:00.

Case digest / 91363f6eca6faee4d965299466df62a02c1f4785ba035c8c37de9eee1e5dc63d