FAILURE MAP
← Case archive

FA-68546 / Toll and parking fee computation / Open access

Cordon congestion charge: Saturday is charged · case 01

Cordon congestion charge returns a wrong result when saturday is charged.

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

ROOT CAUSE

Only day index 6 is exempt, so Saturday crossings are charged.

VERIFIED REPAIR

Restore the weekend exemption rule so that the step reads `d % 7 >= 5`.

Unsuccessful approach: Treating day 0 as Sunday exempts Monday and charges Saturday.

Case contract

Input {crossings: [[day, minute]] unordered, peak: [[start, end)] windows, peak_fee, offpeak_fee, daily_cap, weekend_free, zero_emission, grace}. Zero-emission vehicles pay 0. Days with day % 7 in {5, 6} are free when weekend_free. Within a day, a crossing no more than grace minutes after the last charged crossing is free (the grace anchor is the charged crossing). Each charged crossing pays the peak fee inside a window else off-peak; each day's sum is capped at daily_cap.

Why this case matters

Fee engines bill customers in integer cents; a wrong boundary, rounding stage or cap scope silently over- or under-charges.

1 / The failure

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

N = 1
observations = []
def solve(x):
    if x['zero_emission']:
        return 0
    byday = {}
    for d, m in sorted(x['crossings']):
        byday.setdefault(d, []).append(m)
    total = 0
    for d, ms in byday.items():
        if x['weekend_free'] and d % 7 > 5:
            continue
        last = None
        day_sum = 0
        for m in ms:
            if last is not None and m - last <= x['grace']:
                continue
            last = m
            peak = any(s <= m < e for s, e in x['peak'])
            day_sum += x['peak_fee'] if peak else x['offpeak_fee']
        total += min(day_sum, x['daily_cap'])
    return total
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[({'crossings': [[7, 1011], [2, 457], [5, 795], [8, 472], [5, 720], [4, 569], [0, 734], [8, 1142]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 1000, 'offpeak_fee': 200, 'daily_cap': 2000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 4400), ({'crossings': [[7, 315], [4, 625], [7, 300], [6, 1179], [0, 470], [3, 1200], [7, 408], [9, 859]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 300, 'daily_cap': 1500, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 2700), ({'crossings': [[1, 1264], [8, 433], [8, 428], [7, 372], [6, 974], [3, 363], [0, 1276], [9, 442]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 1000, 'offpeak_fee': 250, 'daily_cap': 3000, 'weekend_free': False, 'zero_emission': False, 'grace': 10}, 4000), ({'crossings': [[2, 620], [4, 1014], [8, 1202], [5, 705]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 300, 'daily_cap': 3000, 'weekend_free': True, 'zero_emission': False, 'grace': 15}, 1500), ({'crossings': [[6, 500], [0, 500], [5, 500]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 900), ({'crossings': [[1, 500], [1, 508], [1, 516], [1, 530]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 2700), ({'crossings': [[3, 715], [8, 886], [5, 1195], [7, 1063], [5, 1183], [5, 1173], [6, 1131], [3, 1187]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 300, 'daily_cap': 3000, 'weekend_free': False, 'zero_emission': True, 'grace': 15}, 0), ({'crossings': [[2, 600], [2, 420], [2, 1140]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 1400)], [({'crossings': [[2, 600], [2, 420], [2, 1140]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 1400), ({'crossings': [[1, 500], [1, 508], [1, 516], [1, 530]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 2700), ({'crossings': [[7, 1100], [7, 1151], [7, 1110], [4, 492], [8, 1149], [9, 300], [7, 1105]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 1000, 'offpeak_fee': 250, 'daily_cap': 2000, 'weekend_free': False, 'zero_emission': False, 'grace': 15}, 2750), ({'crossings': [[2, 590], [0, 765], [6, 889], [0, 775], [8, 1250], [5, 861], [2, 345], [4, 936], [8, 801]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 2000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 2150), ({'crossings': [[2, 1117], [4, 851], [3, 589], [8, 775], [6, 600], [0, 1194], [2, 1107], [6, 384]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 300, 'daily_cap': 1500, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 2700), ({'crossings': [[6, 500], [0, 500], [5, 500]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 900), ({'crossings': [[9, 748], [0, 1184], [1, 874], [7, 1258], [6, 703], [7, 1268], [6, 939], [6, 799]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 1000, 'offpeak_fee': 200, 'daily_cap': 3000, 'weekend_free': True, 'zero_emission': False, 'grace': 15}, 800), ({'crossings': [[5, 786]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 300, 'daily_cap': 2000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 0)], [({'crossings': [[1, 500], [1, 508], [1, 516], [1, 530]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 2700), ({'crossings': [[2, 600], [2, 420], [2, 1140]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 1400), ({'crossings': [[3, 754], [3, 759], [0, 309], [2, 1116], [9, 1181], [5, 1282], [3, 734], [7, 419], [8, 971], [7, 931]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 1000, 'offpeak_fee': 200, 'daily_cap': 2000, 'weekend_free': True, 'zero_emission': False, 'grace': 15}, 3200), ({'crossings': [[0, 576], [0, 566]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 1000, 'offpeak_fee': 250, 'daily_cap': 2000, 'weekend_free': False, 'zero_emission': False, 'grace': 10}, 1000), ({'crossings': [[0, 1137], [0, 1132], [0, 1127], [5, 1045], [3, 734]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 1000, 'offpeak_fee': 300, 'daily_cap': 1500, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 1300), ({'crossings': [[2, 449], [2, 645]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 1000, 'offpeak_fee': 300, 'daily_cap': 3000, 'weekend_free': True, 'zero_emission': True, 'grace': 10}, 0), ({'crossings': [[5, 1131], [9, 680], [4, 409], [6, 1038], [9, 350], [6, 1048], [1, 697], [2, 718], [0, 372]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 3000, 'weekend_free': True, 'zero_emission': False, 'grace': 15}, 1500), ({'crossings': [[6, 500], [0, 500], [5, 500]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 900)], [({'crossings': [[0, 938], [5, 366], [3, 483], [5, 1185], [9, 605], [5, 356], [7, 1233], [0, 756]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 200, 'daily_cap': 3000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 1700), ({'crossings': [[9, 806], [9, 791]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 3000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 500), ({'crossings': [[6, 665], [6, 653]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 200, 'daily_cap': 1500, 'weekend_free': True, 'zero_emission': False, 'grace': 15}, 0), ({'crossings': [[6, 1222], [4, 460], [2, 1209], [5, 936], [3, 638], [2, 940], [2, 524], [2, 648]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 200, 'daily_cap': 3000, 'weekend_free': True, 'zero_emission': False, 'grace': 15}, 2600), ({'crossings': [[7, 446], [9, 991]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 1000, 'offpeak_fee': 300, 'daily_cap': 3000, 'weekend_free': True, 'zero_emission': False, 'grace': 15}, 2000), ({'crossings': [[1, 500], [1, 508], [1, 516], [1, 530]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 2700), ({'crossings': [[6, 500], [0, 500], [5, 500]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 900), ({'crossings': [[2, 600], [2, 420], [2, 1140]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 1400)], [({'crossings': [[1, 547], [1, 869], [7, 1218], [2, 625], [9, 660], [2, 929], [1, 881], [6, 885]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 200, 'daily_cap': 1500, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 2100), ({'crossings': [[4, 934], [2, 398], [7, 1029], [4, 924], [0, 1175], [4, 939], [2, 362]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 200, 'daily_cap': 3000, 'weekend_free': True, 'zero_emission': True, 'grace': 10}, 0), ({'crossings': [[9, 1270], [5, 335], [0, 685], [0, 1088], [9, 1258]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 300, 'daily_cap': 3000, 'weekend_free': True, 'zero_emission': False, 'grace': 15}, 1500), ({'crossings': [[7, 916], [7, 402], [1, 613], [6, 519], [1, 623], [1, 628], [0, 750], [5, 734]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 3000, 'weekend_free': False, 'zero_emission': False, 'grace': 15}, 2150), ({'crossings': [[2, 600], [2, 420], [2, 1140]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 1400), ({'crossings': [[0, 320], [5, 385], [2, 1238], [0, 315]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 300, 'daily_cap': 1500, 'weekend_free': True, 'zero_emission': False, 'grace': 15}, 600), ({'crossings': [[6, 500], [0, 500], [5, 500]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 900), ({'crossings': [[1, 500], [1, 508], [1, 516], [1, 530]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 2700)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check('fee oracle' + ' %d' % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
fee oracle 048004400Failed
fee oracle 127002700Passed
fee oracle 240004000Passed
fee oracle 318001500Failed
fee oracle 41800900Failed
fee oracle 527002700Passed
fee oracle 600Passed
fee oracle 714001400Passed

SHA-256 / 859f8442e13179039fd3080f25b249e24878714b7ad80a410b7f1d44694102b1

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(x):
    if x['zero_emission']:
        return 0
    byday = {}
    for d, m in sorted(x['crossings']):
        byday.setdefault(d, []).append(m)
    total = 0
    for d, ms in byday.items():
        if x['weekend_free'] and d % 7 in (0, 6):
            continue
        last = None
        day_sum = 0
        for m in ms:
            if last is not None and m - last <= x['grace']:
                continue
            last = m
            peak = any(s <= m < e for s, e in x['peak'])
            day_sum += x['peak_fee'] if peak else x['offpeak_fee']
        total += min(day_sum, x['daily_cap'])
    return total
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[({'crossings': [[7, 1011], [2, 457], [5, 795], [8, 472], [5, 720], [4, 569], [0, 734], [8, 1142]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 1000, 'offpeak_fee': 200, 'daily_cap': 2000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 4400), ({'crossings': [[7, 315], [4, 625], [7, 300], [6, 1179], [0, 470], [3, 1200], [7, 408], [9, 859]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 300, 'daily_cap': 1500, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 2700), ({'crossings': [[1, 1264], [8, 433], [8, 428], [7, 372], [6, 974], [3, 363], [0, 1276], [9, 442]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 1000, 'offpeak_fee': 250, 'daily_cap': 3000, 'weekend_free': False, 'zero_emission': False, 'grace': 10}, 4000), ({'crossings': [[2, 620], [4, 1014], [8, 1202], [5, 705]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 300, 'daily_cap': 3000, 'weekend_free': True, 'zero_emission': False, 'grace': 15}, 1500), ({'crossings': [[6, 500], [0, 500], [5, 500]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 900), ({'crossings': [[1, 500], [1, 508], [1, 516], [1, 530]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 2700), ({'crossings': [[3, 715], [8, 886], [5, 1195], [7, 1063], [5, 1183], [5, 1173], [6, 1131], [3, 1187]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 300, 'daily_cap': 3000, 'weekend_free': False, 'zero_emission': True, 'grace': 15}, 0), ({'crossings': [[2, 600], [2, 420], [2, 1140]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 1400)], [({'crossings': [[2, 600], [2, 420], [2, 1140]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 1400), ({'crossings': [[1, 500], [1, 508], [1, 516], [1, 530]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 2700), ({'crossings': [[7, 1100], [7, 1151], [7, 1110], [4, 492], [8, 1149], [9, 300], [7, 1105]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 1000, 'offpeak_fee': 250, 'daily_cap': 2000, 'weekend_free': False, 'zero_emission': False, 'grace': 15}, 2750), ({'crossings': [[2, 590], [0, 765], [6, 889], [0, 775], [8, 1250], [5, 861], [2, 345], [4, 936], [8, 801]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 2000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 2150), ({'crossings': [[2, 1117], [4, 851], [3, 589], [8, 775], [6, 600], [0, 1194], [2, 1107], [6, 384]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 300, 'daily_cap': 1500, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 2700), ({'crossings': [[6, 500], [0, 500], [5, 500]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 900), ({'crossings': [[9, 748], [0, 1184], [1, 874], [7, 1258], [6, 703], [7, 1268], [6, 939], [6, 799]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 1000, 'offpeak_fee': 200, 'daily_cap': 3000, 'weekend_free': True, 'zero_emission': False, 'grace': 15}, 800), ({'crossings': [[5, 786]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 300, 'daily_cap': 2000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 0)], [({'crossings': [[1, 500], [1, 508], [1, 516], [1, 530]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 2700), ({'crossings': [[2, 600], [2, 420], [2, 1140]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 1400), ({'crossings': [[3, 754], [3, 759], [0, 309], [2, 1116], [9, 1181], [5, 1282], [3, 734], [7, 419], [8, 971], [7, 931]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 1000, 'offpeak_fee': 200, 'daily_cap': 2000, 'weekend_free': True, 'zero_emission': False, 'grace': 15}, 3200), ({'crossings': [[0, 576], [0, 566]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 1000, 'offpeak_fee': 250, 'daily_cap': 2000, 'weekend_free': False, 'zero_emission': False, 'grace': 10}, 1000), ({'crossings': [[0, 1137], [0, 1132], [0, 1127], [5, 1045], [3, 734]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 1000, 'offpeak_fee': 300, 'daily_cap': 1500, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 1300), ({'crossings': [[2, 449], [2, 645]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 1000, 'offpeak_fee': 300, 'daily_cap': 3000, 'weekend_free': True, 'zero_emission': True, 'grace': 10}, 0), ({'crossings': [[5, 1131], [9, 680], [4, 409], [6, 1038], [9, 350], [6, 1048], [1, 697], [2, 718], [0, 372]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 3000, 'weekend_free': True, 'zero_emission': False, 'grace': 15}, 1500), ({'crossings': [[6, 500], [0, 500], [5, 500]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 900)], [({'crossings': [[0, 938], [5, 366], [3, 483], [5, 1185], [9, 605], [5, 356], [7, 1233], [0, 756]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 200, 'daily_cap': 3000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 1700), ({'crossings': [[9, 806], [9, 791]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 3000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 500), ({'crossings': [[6, 665], [6, 653]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 200, 'daily_cap': 1500, 'weekend_free': True, 'zero_emission': False, 'grace': 15}, 0), ({'crossings': [[6, 1222], [4, 460], [2, 1209], [5, 936], [3, 638], [2, 940], [2, 524], [2, 648]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 200, 'daily_cap': 3000, 'weekend_free': True, 'zero_emission': False, 'grace': 15}, 2600), ({'crossings': [[7, 446], [9, 991]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 1000, 'offpeak_fee': 300, 'daily_cap': 3000, 'weekend_free': True, 'zero_emission': False, 'grace': 15}, 2000), ({'crossings': [[1, 500], [1, 508], [1, 516], [1, 530]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 2700), ({'crossings': [[6, 500], [0, 500], [5, 500]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 900), ({'crossings': [[2, 600], [2, 420], [2, 1140]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 1400)], [({'crossings': [[1, 547], [1, 869], [7, 1218], [2, 625], [9, 660], [2, 929], [1, 881], [6, 885]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 200, 'daily_cap': 1500, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 2100), ({'crossings': [[4, 934], [2, 398], [7, 1029], [4, 924], [0, 1175], [4, 939], [2, 362]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 200, 'daily_cap': 3000, 'weekend_free': True, 'zero_emission': True, 'grace': 10}, 0), ({'crossings': [[9, 1270], [5, 335], [0, 685], [0, 1088], [9, 1258]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 300, 'daily_cap': 3000, 'weekend_free': True, 'zero_emission': False, 'grace': 15}, 1500), ({'crossings': [[7, 916], [7, 402], [1, 613], [6, 519], [1, 623], [1, 628], [0, 750], [5, 734]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 3000, 'weekend_free': False, 'zero_emission': False, 'grace': 15}, 2150), ({'crossings': [[2, 600], [2, 420], [2, 1140]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 1400), ({'crossings': [[0, 320], [5, 385], [2, 1238], [0, 315]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 300, 'daily_cap': 1500, 'weekend_free': True, 'zero_emission': False, 'grace': 15}, 600), ({'crossings': [[6, 500], [0, 500], [5, 500]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 900), ({'crossings': [[1, 500], [1, 508], [1, 516], [1, 530]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 2700)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check('fee oracle' + ' %d' % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
fee oracle 036004400Failed
fee oracle 19002700Failed
fee oracle 240004000Passed
fee oracle 318001500Failed
fee oracle 4900900Passed
fee oracle 527002700Passed
fee oracle 600Passed
fee oracle 714001400Passed

SHA-256 / 0abe223c18792fdf62b2a91d794e28f2a2e6e9fdd75bbc3e6de1a14b368865d6

3 / The verified repair

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

N = 1
observations = []
def solve(x):
    if x['zero_emission']:
        return 0
    byday = {}
    for d, m in sorted(x['crossings']):
        byday.setdefault(d, []).append(m)
    total = 0
    for d, ms in byday.items():
        if x['weekend_free'] and d % 7 >= 5:
            continue
        last = None
        day_sum = 0
        for m in ms:
            if last is not None and m - last <= x['grace']:
                continue
            last = m
            peak = any(s <= m < e for s, e in x['peak'])
            day_sum += x['peak_fee'] if peak else x['offpeak_fee']
        total += min(day_sum, x['daily_cap'])
    return total
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[({'crossings': [[7, 1011], [2, 457], [5, 795], [8, 472], [5, 720], [4, 569], [0, 734], [8, 1142]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 1000, 'offpeak_fee': 200, 'daily_cap': 2000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 4400), ({'crossings': [[7, 315], [4, 625], [7, 300], [6, 1179], [0, 470], [3, 1200], [7, 408], [9, 859]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 300, 'daily_cap': 1500, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 2700), ({'crossings': [[1, 1264], [8, 433], [8, 428], [7, 372], [6, 974], [3, 363], [0, 1276], [9, 442]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 1000, 'offpeak_fee': 250, 'daily_cap': 3000, 'weekend_free': False, 'zero_emission': False, 'grace': 10}, 4000), ({'crossings': [[2, 620], [4, 1014], [8, 1202], [5, 705]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 300, 'daily_cap': 3000, 'weekend_free': True, 'zero_emission': False, 'grace': 15}, 1500), ({'crossings': [[6, 500], [0, 500], [5, 500]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 900), ({'crossings': [[1, 500], [1, 508], [1, 516], [1, 530]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 2700), ({'crossings': [[3, 715], [8, 886], [5, 1195], [7, 1063], [5, 1183], [5, 1173], [6, 1131], [3, 1187]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 300, 'daily_cap': 3000, 'weekend_free': False, 'zero_emission': True, 'grace': 15}, 0), ({'crossings': [[2, 600], [2, 420], [2, 1140]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 1400)], [({'crossings': [[2, 600], [2, 420], [2, 1140]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 1400), ({'crossings': [[1, 500], [1, 508], [1, 516], [1, 530]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 2700), ({'crossings': [[7, 1100], [7, 1151], [7, 1110], [4, 492], [8, 1149], [9, 300], [7, 1105]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 1000, 'offpeak_fee': 250, 'daily_cap': 2000, 'weekend_free': False, 'zero_emission': False, 'grace': 15}, 2750), ({'crossings': [[2, 590], [0, 765], [6, 889], [0, 775], [8, 1250], [5, 861], [2, 345], [4, 936], [8, 801]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 2000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 2150), ({'crossings': [[2, 1117], [4, 851], [3, 589], [8, 775], [6, 600], [0, 1194], [2, 1107], [6, 384]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 300, 'daily_cap': 1500, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 2700), ({'crossings': [[6, 500], [0, 500], [5, 500]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 900), ({'crossings': [[9, 748], [0, 1184], [1, 874], [7, 1258], [6, 703], [7, 1268], [6, 939], [6, 799]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 1000, 'offpeak_fee': 200, 'daily_cap': 3000, 'weekend_free': True, 'zero_emission': False, 'grace': 15}, 800), ({'crossings': [[5, 786]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 300, 'daily_cap': 2000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 0)], [({'crossings': [[1, 500], [1, 508], [1, 516], [1, 530]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 2700), ({'crossings': [[2, 600], [2, 420], [2, 1140]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 1400), ({'crossings': [[3, 754], [3, 759], [0, 309], [2, 1116], [9, 1181], [5, 1282], [3, 734], [7, 419], [8, 971], [7, 931]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 1000, 'offpeak_fee': 200, 'daily_cap': 2000, 'weekend_free': True, 'zero_emission': False, 'grace': 15}, 3200), ({'crossings': [[0, 576], [0, 566]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 1000, 'offpeak_fee': 250, 'daily_cap': 2000, 'weekend_free': False, 'zero_emission': False, 'grace': 10}, 1000), ({'crossings': [[0, 1137], [0, 1132], [0, 1127], [5, 1045], [3, 734]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 1000, 'offpeak_fee': 300, 'daily_cap': 1500, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 1300), ({'crossings': [[2, 449], [2, 645]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 1000, 'offpeak_fee': 300, 'daily_cap': 3000, 'weekend_free': True, 'zero_emission': True, 'grace': 10}, 0), ({'crossings': [[5, 1131], [9, 680], [4, 409], [6, 1038], [9, 350], [6, 1048], [1, 697], [2, 718], [0, 372]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 3000, 'weekend_free': True, 'zero_emission': False, 'grace': 15}, 1500), ({'crossings': [[6, 500], [0, 500], [5, 500]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 900)], [({'crossings': [[0, 938], [5, 366], [3, 483], [5, 1185], [9, 605], [5, 356], [7, 1233], [0, 756]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 200, 'daily_cap': 3000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 1700), ({'crossings': [[9, 806], [9, 791]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 3000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 500), ({'crossings': [[6, 665], [6, 653]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 200, 'daily_cap': 1500, 'weekend_free': True, 'zero_emission': False, 'grace': 15}, 0), ({'crossings': [[6, 1222], [4, 460], [2, 1209], [5, 936], [3, 638], [2, 940], [2, 524], [2, 648]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 200, 'daily_cap': 3000, 'weekend_free': True, 'zero_emission': False, 'grace': 15}, 2600), ({'crossings': [[7, 446], [9, 991]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 1000, 'offpeak_fee': 300, 'daily_cap': 3000, 'weekend_free': True, 'zero_emission': False, 'grace': 15}, 2000), ({'crossings': [[1, 500], [1, 508], [1, 516], [1, 530]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 2700), ({'crossings': [[6, 500], [0, 500], [5, 500]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 900), ({'crossings': [[2, 600], [2, 420], [2, 1140]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 1400)], [({'crossings': [[1, 547], [1, 869], [7, 1218], [2, 625], [9, 660], [2, 929], [1, 881], [6, 885]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 200, 'daily_cap': 1500, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 2100), ({'crossings': [[4, 934], [2, 398], [7, 1029], [4, 924], [0, 1175], [4, 939], [2, 362]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 200, 'daily_cap': 3000, 'weekend_free': True, 'zero_emission': True, 'grace': 10}, 0), ({'crossings': [[9, 1270], [5, 335], [0, 685], [0, 1088], [9, 1258]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 300, 'daily_cap': 3000, 'weekend_free': True, 'zero_emission': False, 'grace': 15}, 1500), ({'crossings': [[7, 916], [7, 402], [1, 613], [6, 519], [1, 623], [1, 628], [0, 750], [5, 734]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 3000, 'weekend_free': False, 'zero_emission': False, 'grace': 15}, 2150), ({'crossings': [[2, 600], [2, 420], [2, 1140]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 1400), ({'crossings': [[0, 320], [5, 385], [2, 1238], [0, 315]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 300, 'daily_cap': 1500, 'weekend_free': True, 'zero_emission': False, 'grace': 15}, 600), ({'crossings': [[6, 500], [0, 500], [5, 500]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 900), ({'crossings': [[1, 500], [1, 508], [1, 516], [1, 530]], 'peak': [[420, 600], [960, 1140]], 'peak_fee': 900, 'offpeak_fee': 250, 'daily_cap': 5000, 'weekend_free': True, 'zero_emission': False, 'grace': 10}, 2700)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check('fee oracle' + ' %d' % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
fee oracle 044004400Passed
fee oracle 127002700Passed
fee oracle 240004000Passed
fee oracle 315001500Passed
fee oracle 4900900Passed
fee oracle 527002700Passed
fee oracle 600Passed
fee oracle 714001400Passed

SHA-256 / ab04d040c84839e4fec6104d0c803dd4797685214a34da0f163561dfa6a8c68d

Verification & scope

A deterministic, bounded toy model with a stipulated contract; it makes no claim of conformance to any agency manual or standard. 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:48:03.185221+00:00.

Case digest / f8597d9cf996d755cb831b54fc4df54825ee58513b8cabcd138d58da3c762b10