FAILURE MAP
← Case archive

FA-95741 / Shipping rate zone lookup / Open access

Region matrix: same ZIP3 not local · case 01

Deliveries within the same ZIP3 are rated as regional zone 2.

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

ROOT CAUSE

The same-ZIP3 local zone rule is missing.

VERIFIED REPAIR

Return zone 1 whenever origin and destination share a ZIP3, before region lookup.

Unsuccessful approach: Checking locality only inside the same-region branch fails for ZIP3s outside the region table.

Case contract

origin and dest are five-digit ZIP strings. Same ZIP3 -> zone 1. regions [[lo3, hi3, region]] inclusive. Unknown region -> "NO_ZONE". Same region -> zone 2. Otherwise the matrix [[region_a, region_b, zone]] lists each pair once and applies in both directions; unlisted pair -> "NO_ZONE".

Why this case matters

Regional carriers rate by origin and destination region matrices.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(origin, dest, regions, matrix):
    def region(z3):
        for lo, hi, r in regions:
            if lo <= z3 <= hi:
                return r
        return None
    o = int(origin[:3])
    d = int(dest[:3])
    ro, rd = region(o), region(d)
    if ro is None or rd is None:
        return 'NO_ZONE'
    if ro == rd:
        return 2
    for a, b, zone in matrix:
        if (a, b) == (ro, rd) or (a, b) == (rd, ro):
            return zone
    return 'NO_ZONE'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['same zip3', ['10001', '10099', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['generated mix 19', ['96001', '96001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['same region', ['10001', '19999', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 2], ['reverse pair', ['30001', '10001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 4], ['reverse listing', ['80001', '60001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 5], ['local outside regions', ['96001', '96002', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['listed pair', ['10001', '30001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 4], ['generated mix 6', ['20001', '20001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1]], [['generated mix 54', ['01001', '01001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['local outside regions', ['96001', '96002', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['reverse pair', ['30001', '10001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 4], ['reverse listing', ['80001', '60001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 5], ['same zip3', ['10001', '10099', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['listed pair', ['10001', '30001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 4], ['generated mix 9', ['60001', '39999', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 'NO_ZONE'], ['generated mix 17', ['19999', '79901', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 'NO_ZONE']], [['generated mix 6', ['20001', '20001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['generated mix 19', ['96001', '96001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['unlisted pair', ['10001', '60001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 'NO_ZONE'], ['same zip3', ['10001', '10099', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['listed pair', ['10001', '30001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 4], ['region edges', ['19901', '20001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 4], ['generated mix 21', ['20001', '10001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 4], ['generated mix 29', ['40001', '96001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 'NO_ZONE']], [['generated mix 58', ['01001', '01001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['local outside regions', ['96001', '96002', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['listed pair', ['10001', '30001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 4], ['region edges', ['19901', '20001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 4], ['unlisted pair', ['10001', '60001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 'NO_ZONE'], ['same region', ['10001', '19999', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 2], ['generated mix 31', ['59901', '20001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 4], ['generated mix 39', ['60001', '79901', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 2]], [['generated mix 24', ['39999', '39999', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['generated mix 19', ['96001', '96001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['region edges', ['19901', '20001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 4], ['unlisted pair', ['10001', '60001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 'NO_ZONE'], ['same zip3', ['10001', '10099', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['listed pair', ['10001', '30001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 4], ['generated mix 43', ['80001', '96001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 'NO_ZONE'], ['generated mix 51', ['10001', '20001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 4]]]
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
same zip321Failed
generated mix 19NO_ZONE1Failed
same region22Passed
reverse pair44Passed
reverse listing55Passed
local outside regionsNO_ZONE1Failed
listed pair44Passed
generated mix 621Failed

SHA-256 / a965e35146dcbcdcdce0b73c693f6c1b8c4326d00dce69a440c64a2df7702670

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(origin, dest, regions, matrix):
    def region(z3):
        for lo, hi, r in regions:
            if lo <= z3 <= hi:
                return r
        return None
    o = int(origin[:3])
    d = int(dest[:3])
    ro, rd = region(o), region(d)
    if ro is None or rd is None:
        return 'NO_ZONE'
    if ro == rd:
        return 1 if o == d else 2
    for a, b, zone in matrix:
        if (a, b) == (ro, rd) or (a, b) == (rd, ro):
            return zone
    return 'NO_ZONE'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['same zip3', ['10001', '10099', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['generated mix 19', ['96001', '96001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['same region', ['10001', '19999', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 2], ['reverse pair', ['30001', '10001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 4], ['reverse listing', ['80001', '60001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 5], ['local outside regions', ['96001', '96002', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['listed pair', ['10001', '30001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 4], ['generated mix 6', ['20001', '20001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1]], [['generated mix 54', ['01001', '01001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['local outside regions', ['96001', '96002', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['reverse pair', ['30001', '10001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 4], ['reverse listing', ['80001', '60001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 5], ['same zip3', ['10001', '10099', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['listed pair', ['10001', '30001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 4], ['generated mix 9', ['60001', '39999', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 'NO_ZONE'], ['generated mix 17', ['19999', '79901', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 'NO_ZONE']], [['generated mix 6', ['20001', '20001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['generated mix 19', ['96001', '96001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['unlisted pair', ['10001', '60001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 'NO_ZONE'], ['same zip3', ['10001', '10099', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['listed pair', ['10001', '30001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 4], ['region edges', ['19901', '20001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 4], ['generated mix 21', ['20001', '10001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 4], ['generated mix 29', ['40001', '96001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 'NO_ZONE']], [['generated mix 58', ['01001', '01001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['local outside regions', ['96001', '96002', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['listed pair', ['10001', '30001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 4], ['region edges', ['19901', '20001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 4], ['unlisted pair', ['10001', '60001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 'NO_ZONE'], ['same region', ['10001', '19999', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 2], ['generated mix 31', ['59901', '20001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 4], ['generated mix 39', ['60001', '79901', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 2]], [['generated mix 24', ['39999', '39999', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['generated mix 19', ['96001', '96001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['region edges', ['19901', '20001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 4], ['unlisted pair', ['10001', '60001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 'NO_ZONE'], ['same zip3', ['10001', '10099', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['listed pair', ['10001', '30001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 4], ['generated mix 43', ['80001', '96001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 'NO_ZONE'], ['generated mix 51', ['10001', '20001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 4]]]
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
same zip311Passed
generated mix 19NO_ZONE1Failed
same region22Passed
reverse pair44Passed
reverse listing55Passed
local outside regionsNO_ZONE1Failed
listed pair44Passed
generated mix 611Passed

SHA-256 / 64d2ff1a30c04990b02cd385e40f57b174e1b05f64cab9c29392700bbcce4c34

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(origin, dest, regions, matrix):
    def region(z3):
        for lo, hi, r in regions:
            if lo <= z3 <= hi:
                return r
        return None
    o = int(origin[:3])
    d = int(dest[:3])
    if o == d:
        return 1
    ro, rd = region(o), region(d)
    if ro is None or rd is None:
        return 'NO_ZONE'
    if ro == rd:
        return 2
    for a, b, zone in matrix:
        if (a, b) == (ro, rd) or (a, b) == (rd, ro):
            return zone
    return 'NO_ZONE'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['same zip3', ['10001', '10099', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['generated mix 19', ['96001', '96001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['same region', ['10001', '19999', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 2], ['reverse pair', ['30001', '10001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 4], ['reverse listing', ['80001', '60001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 5], ['local outside regions', ['96001', '96002', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['listed pair', ['10001', '30001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 4], ['generated mix 6', ['20001', '20001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1]], [['generated mix 54', ['01001', '01001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['local outside regions', ['96001', '96002', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['reverse pair', ['30001', '10001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 4], ['reverse listing', ['80001', '60001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 5], ['same zip3', ['10001', '10099', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['listed pair', ['10001', '30001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 4], ['generated mix 9', ['60001', '39999', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 'NO_ZONE'], ['generated mix 17', ['19999', '79901', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 'NO_ZONE']], [['generated mix 6', ['20001', '20001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['generated mix 19', ['96001', '96001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['unlisted pair', ['10001', '60001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 'NO_ZONE'], ['same zip3', ['10001', '10099', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['listed pair', ['10001', '30001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 4], ['region edges', ['19901', '20001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 4], ['generated mix 21', ['20001', '10001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 4], ['generated mix 29', ['40001', '96001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 'NO_ZONE']], [['generated mix 58', ['01001', '01001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['local outside regions', ['96001', '96002', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['listed pair', ['10001', '30001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 4], ['region edges', ['19901', '20001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 4], ['unlisted pair', ['10001', '60001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 'NO_ZONE'], ['same region', ['10001', '19999', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 2], ['generated mix 31', ['59901', '20001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 4], ['generated mix 39', ['60001', '79901', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 2]], [['generated mix 24', ['39999', '39999', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['generated mix 19', ['96001', '96001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['region edges', ['19901', '20001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 4], ['unlisted pair', ['10001', '60001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 'NO_ZONE'], ['same zip3', ['10001', '10099', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 1], ['listed pair', ['10001', '30001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 4], ['generated mix 43', ['80001', '96001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 'NO_ZONE'], ['generated mix 51', ['10001', '20001', [[0, 199, 'NE'], [200, 399, 'SE'], [400, 599, 'MW'], [600, 799, 'SC'], [800, 899, 'W']], [['NE', 'SE', 4], ['NE', 'MW', 5], ['NE', 'W', 8], ['SE', 'MW', 4], ['MW', 'W', 6], ['SE', 'W', 7], ['SC', 'W', 5]]], 4]]]
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
same zip311Passed
generated mix 1911Passed
same region22Passed
reverse pair44Passed
reverse listing55Passed
local outside regions11Passed
listed pair44Passed
generated mix 611Passed

SHA-256 / ddca83549fc9468b9e50d68e6bb2d6caa69ab2a8f8f1d3cdebeb6b7abd305dc2

Verification & scope

Stipulated regions and matrix. 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:52:16.434366+00:00.

Case digest / ee98b08536b318bed62d442c077149cf768f24fedc6350f5ef4dcdaea2a5bedd