FAILURE MAP
← Case archive

FA-66546 / Airline fare rule evaluation / Open access

Equal-price fares tie-broken by filing order · case 01

Two fares with the same price produce the one filed first rather than the higher class.

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

ROOT CAUSE

Sorting by amount alone keeps filing order for ties.

THE FAILURE

Sorting by amount alone keeps filing order for ties.

Unsuccessful approach: Reversing the hierarchy prefers the more restrictive class.

Case contract

Input {'fares':[[basis, amount, rbd, min AP days, 'OW'|'RT']],'trip','ap_days','rbd_open'}. A fare applies if its AP requirement <= ap_days and its booking class is open. OW trips use OW fares only; RT trips use an RT fare or two of the same OW fare. Pick the lowest total; ties prefer the booking class earlier in 'YBMHQVLKTN'. Return [[bases], total] or 'NO_FARE'.

Why this case matters

Fare shopping filters by rule applicability and inventory, compares round-trip fares against doubled one-way fares, and needs a deterministic tie rule.

1 / The failure

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

N = 1
observations = []
def solve(x):
    ap = x['ap_days']
    open_ = set(x['rbd_open'])
    order = 'YBMHQVLKTN'
    ok = [f for f in x['fares'] if f[3] <= ap and f[2] in open_]
    opts = []
    for basis, amt, rbd, minap, kind in ok:
        if x['trip'] == 'OW' and kind == 'OW':
            opts.append((amt, order.index(rbd), [basis]))
        if x['trip'] == 'RT' and kind == 'RT':
            opts.append((amt, order.index(rbd), [basis]))
        if x['trip'] == 'RT' and kind == 'OW':
            opts.append((2 * amt, order.index(rbd), [basis, basis]))
    if not opts: return 'NO_FARE'
    opts.sort(key=lambda o: o[0])
    return [opts[0][2], opts[0][0]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['RT beats doubled OW', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'RT', 'ap_days': 15, 'rbd_open': ['Y', 'B', 'M', 'H', 'Q', 'V', 'L', 'K', 'T']}, [['VOW7', 'VOW7'], 640]], ['doubled OW beats RT', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'RT', 'ap_days': 7, 'rbd_open': ['Y', 'B', 'M', 'V', 'H']}, [['VOW7', 'VOW7'], 640]], ['exactly AP days', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 7, 'rbd_open': ['Y', 'B', 'V', 'H']}, [['VOW7'], 320]], ['one day short of AP', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 6, 'rbd_open': ['Y', 'B', 'V', 'H']}, [['HOW3'], 390]], ['closed cheap class', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 11, 'rbd_open': ['Y', 'B', 'H']}, [['HOW3'], 390]], ['price tie between classes', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'RT', 'ap_days': 30, 'rbd_open': ['Y', 'B', 'M', 'K', 'L']}, [['LRT21'], 640]], ['nothing sellable', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 1, 'rbd_open': ['Q', 'L', 'K']}, 'NO_FARE'], ['OW trip ignores RT fares', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 21, 'rbd_open': ['Y', 'Q', 'L', 'K']}, [['YOW'], 900]], ['sampled case 1', {'fares': [['BOW0', 1090, 'B', 3, 'OW'], ['TRT1', 1190, 'T', 7, 'RT'], ['TRT2', 570, 'T', 0, 'RT'], ['MOW3', 1370, 'M', 3, 'OW']], 'trip': 'RT', 'ap_days': 0, 'rbd_open': ['B', 'H', 'K', 'L', 'M', 'N', 'T', 'Y']}, [['TRT2'], 570]], ['sampled case 2', {'fares': [['TRT0', 970, 'T', 0, 'RT'], ['TOW1', 780, 'T', 3, 'OW'], ['LRT2', 800, 'L', 7, 'RT'], ['VRT3', 1290, 'V', 14, 'RT'], ['BOW4', 1450, 'B', 21, 'OW']], 'trip': 'OW', 'ap_days': 30, 'rbd_open': ['Y']}, 'NO_FARE'], ['sampled case 3', {'fares': [['KRT0', 550, 'K', 3, 'RT'], ['HRT1', 1290, 'H', 3, 'RT'], ['TOW2', 1300, 'T', 7, 'OW'], ['MOW3', 480, 'M', 21, 'OW']], 'trip': 'OW', 'ap_days': 7, 'rbd_open': ['B', 'H', 'M', 'T', 'Y']}, [['TOW2'], 1300]], ['regression: equal-price tie break', {'fares': [['VOW0', 200, 'V', 3, 'OW'], ['BOW1', 200, 'B', 0, 'OW']], 'trip': 'OW', 'ap_days': 14, 'rbd_open': ['B', 'H', 'K', 'L', 'M', 'N', 'Q', 'T', 'V', 'Y']}, [['BOW1'], 200]]], [['RT beats doubled OW', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'RT', 'ap_days': 16, 'rbd_open': ['Y', 'B', 'M', 'H', 'Q', 'V', 'L', 'K', 'T']}, [['VOW7', 'VOW7'], 640]], ['doubled OW beats RT', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'RT', 'ap_days': 7, 'rbd_open': ['Y', 'B', 'M', 'V', 'H']}, [['VOW7', 'VOW7'], 640]], ['exactly AP days', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 7, 'rbd_open': ['Y', 'B', 'V', 'H']}, [['VOW7'], 320]], ['one day short of AP', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 6, 'rbd_open': ['Y', 'B', 'V', 'H']}, [['HOW3'], 390]], ['closed cheap class', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 12, 'rbd_open': ['Y', 'B', 'H']}, [['HOW3'], 390]], ['price tie between classes', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'RT', 'ap_days': 30, 'rbd_open': ['Y', 'B', 'M', 'K', 'L']}, [['LRT21'], 640]], ['nothing sellable', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 1, 'rbd_open': ['Q', 'L', 'K']}, 'NO_FARE'], ['OW trip ignores RT fares', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 21, 'rbd_open': ['Y', 'Q', 'L', 'K']}, [['YOW'], 900]], ['sampled case 1', {'fares': [['NOW0', 1290, 'N', 0, 'OW'], ['YRT1', 1250, 'Y', 0, 'RT'], ['LOW2', 190, 'L', 7, 'OW']], 'trip': 'OW', 'ap_days': 7, 'rbd_open': ['K', 'T']}, 'NO_FARE'], ['sampled case 2', {'fares': [['TRT0', 1050, 'T', 3, 'RT'], ['KOW1', 890, 'K', 21, 'OW'], ['TOW2', 1070, 'T', 3, 'OW'], ['HOW3', 880, 'H', 14, 'OW'], ['VOW4', 480, 'V', 0, 'OW']], 'trip': 'RT', 'ap_days': 3, 'rbd_open': ['B', 'H', 'K', 'L', 'N', 'Q', 'V', 'Y']}, [['VOW4', 'VOW4'], 960]], ['sampled case 3', {'fares': [['QOW0', 1370, 'Q', 14, 'OW'], ['HRT1', 320, 'H', 3, 'RT'], ['BOW2', 860, 'B', 21, 'OW'], ['LRT3', 1490, 'L', 3, 'RT'], ['LOW4', 1320, 'L', 0, 'OW']], 'trip': 'RT', 'ap_days': 3, 'rbd_open': ['H', 'K', 'L', 'M', 'N', 'Q', 'T', 'V', 'Y']}, [['HRT1'], 320]], ['regression: equal-price tie break', {'fares': [['QRT0', 1300, 'Q', 3, 'RT'], ['HOW1', 650, 'H', 0, 'OW'], ['KOW2', 1130, 'K', 3, 'OW'], ['YOW3', 1010, 'Y', 7, 'OW'], ['YOW4', 1000, 'Y', 7, 'OW']], 'trip': 'RT', 'ap_days': 14, 'rbd_open': ['B', 'H', 'K', 'L', 'M', 'Q', 'T', 'V', 'Y']}, [['HOW1', 'HOW1'], 1300]]], [['RT beats doubled OW', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'RT', 'ap_days': 17, 'rbd_open': ['Y', 'B', 'M', 'H', 'Q', 'V', 'L', 'K', 'T']}, [['VOW7', 'VOW7'], 640]], ['doubled OW beats RT', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'RT', 'ap_days': 7, 'rbd_open': ['Y', 'B', 'M', 'V', 'H']}, [['VOW7', 'VOW7'], 640]], ['exactly AP days', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 7, 'rbd_open': ['Y', 'B', 'V', 'H']}, [['VOW7'], 320]], ['one day short of AP', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 6, 'rbd_open': ['Y', 'B', 'V', 'H']}, [['HOW3'], 390]], ['closed cheap class', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 13, 'rbd_open': ['Y', 'B', 'H']}, [['HOW3'], 390]], ['price tie between classes', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'RT', 'ap_days': 30, 'rbd_open': ['Y', 'B', 'M', 'K', 'L']}, [['LRT21'], 640]], ['nothing sellable', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 1, 'rbd_open': ['Q', 'L', 'K']}, 'NO_FARE'], ['OW trip ignores RT fares', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 21, 'rbd_open': ['Y', 'Q', 'L', 'K']}, [['YOW'], 900]], ['sampled case 1', {'fares': [['KOW0', 1090, 'K', 21, 'OW'], ['YRT1', 1120, 'Y', 14, 'RT'], ['YOW2', 200, 'Y', 14, 'OW'], ['TOW3', 770, 'T', 3, 'OW'], ['QRT4', 600, 'Q', 3, 'RT'], ['MOW5', 360, 'M', 0, 'OW']], 'trip': 'RT', 'ap_days': 7, 'rbd_open': ['K', 'L', 'M', 'Q', 'T']}, [['QRT4'], 600]], ['sampled case 2', {'fares': [['QOW0', 280, 'Q', 21, 'OW'], ['TRT1', 1200, 'T', 3, 'RT'], ['MOW2', 110, 'M', 14, 'OW']], 'trip': 'RT', 'ap_days': 7, 'rbd_open': ['H']}, 'NO_FARE'], ['sampled case 3', {'fares': [['YRT0', 1040, 'Y', 0, 'RT'], ['HRT1', 1310, 'H', 14, 'RT'], ['QRT2', 450, 'Q', 3, 'RT'], ['BOW3', 1430, 'B', 0, 'OW'], ['BRT4', 760, 'B', 3, 'RT']], 'trip': 'OW', 'ap_days': 14, 'rbd_open': ['B', 'H', 'M', 'V', 'Y']}, [['BOW3'], 1430]], ['regression: equal-price tie break', {'fares': [['MOW0', 160, 'M', 7, 'OW'], ['BOW1', 160, 'B', 21, 'OW'], ['VOW2', 120, 'V', 21, 'OW'], ['TOW3', 1310, 'T', 14, 'OW']], 'trip': 'RT', 'ap_days': 21, 'rbd_open': ['B', 'K', 'L', 'M', 'Q', 'T', 'Y']}, [['BOW1', 'BOW1'], 320]]], [['RT beats doubled OW', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'RT', 'ap_days': 18, 'rbd_open': ['Y', 'B', 'M', 'H', 'Q', 'V', 'L', 'K', 'T']}, [['VOW7', 'VOW7'], 640]], ['doubled OW beats RT', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'RT', 'ap_days': 7, 'rbd_open': ['Y', 'B', 'M', 'V', 'H']}, [['VOW7', 'VOW7'], 640]], ['exactly AP days', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 7, 'rbd_open': ['Y', 'B', 'V', 'H']}, [['VOW7'], 320]], ['one day short of AP', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 6, 'rbd_open': ['Y', 'B', 'V', 'H']}, [['HOW3'], 390]], ['closed cheap class', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 14, 'rbd_open': ['Y', 'B', 'H']}, [['HOW3'], 390]], ['price tie between classes', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'RT', 'ap_days': 30, 'rbd_open': ['Y', 'B', 'M', 'K', 'L']}, [['LRT21'], 640]], ['nothing sellable', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 1, 'rbd_open': ['Q', 'L', 'K']}, 'NO_FARE'], ['OW trip ignores RT fares', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 21, 'rbd_open': ['Y', 'Q', 'L', 'K']}, [['YOW'], 900]], ['sampled case 1', {'fares': [['NRT0', 450, 'N', 21, 'RT'], ['KOW1', 1370, 'K', 21, 'OW'], ['KOW2', 1250, 'K', 21, 'OW'], ['LOW3', 610, 'L', 0, 'OW'], ['NOW4', 1400, 'N', 7, 'OW']], 'trip': 'RT', 'ap_days': 10, 'rbd_open': ['B', 'M', 'N', 'Q', 'V', 'Y']}, [['NOW4', 'NOW4'], 2800]], ['sampled case 2', {'fares': [['BRT0', 1180, 'B', 0, 'RT'], ['LOW1', 850, 'L', 7, 'OW'], ['MRT2', 120, 'M', 3, 'RT']], 'trip': 'RT', 'ap_days': 3, 'rbd_open': ['H', 'M', 'N', 'V', 'Y']}, [['MRT2'], 120]], ['sampled case 3', {'fares': [['NOW0', 1490, 'N', 7, 'OW'], ['QRT1', 590, 'Q', 7, 'RT'], ['KOW2', 580, 'K', 14, 'OW']], 'trip': 'OW', 'ap_days': 3, 'rbd_open': ['H', 'L', 'M', 'N', 'Q', 'T', 'V', 'Y']}, 'NO_FARE'], ['regression: equal-price tie break', {'fares': [['KRT0', 1140, 'K', 14, 'RT'], ['MRT1', 220, 'M', 21, 'RT'], ['BOW2', 790, 'B', 14, 'OW'], ['QRT3', 790, 'Q', 0, 'RT'], ['MRT4', 790, 'M', 0, 'RT']], 'trip': 'RT', 'ap_days': 3, 'rbd_open': ['B', 'H', 'K', 'L', 'M', 'N', 'Q', 'T', 'V', 'Y']}, [['MRT4'], 790]]], [['RT beats doubled OW', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'RT', 'ap_days': 19, 'rbd_open': ['Y', 'B', 'M', 'H', 'Q', 'V', 'L', 'K', 'T']}, [['VOW7', 'VOW7'], 640]], ['doubled OW beats RT', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'RT', 'ap_days': 7, 'rbd_open': ['Y', 'B', 'M', 'V', 'H']}, [['VOW7', 'VOW7'], 640]], ['exactly AP days', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 7, 'rbd_open': ['Y', 'B', 'V', 'H']}, [['VOW7'], 320]], ['one day short of AP', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 6, 'rbd_open': ['Y', 'B', 'V', 'H']}, [['HOW3'], 390]], ['closed cheap class', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 15, 'rbd_open': ['Y', 'B', 'H']}, [['HOW3'], 390]], ['price tie between classes', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'RT', 'ap_days': 30, 'rbd_open': ['Y', 'B', 'M', 'K', 'L']}, [['LRT21'], 640]], ['nothing sellable', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 1, 'rbd_open': ['Q', 'L', 'K']}, 'NO_FARE'], ['OW trip ignores RT fares', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 21, 'rbd_open': ['Y', 'Q', 'L', 'K']}, [['YOW'], 900]], ['sampled case 1', {'fares': [['KOW0', 390, 'K', 3, 'OW'], ['QOW1', 520, 'Q', 3, 'OW'], ['HRT2', 930, 'H', 0, 'RT'], ['YOW3', 280, 'Y', 14, 'OW']], 'trip': 'RT', 'ap_days': 7, 'rbd_open': ['Q', 'T']}, [['QOW1', 'QOW1'], 1040]], ['sampled case 2', {'fares': [['HOW0', 550, 'H', 14, 'OW'], ['TOW1', 1070, 'T', 3, 'OW'], ['MRT2', 770, 'M', 0, 'RT'], ['BRT3', 290, 'B', 14, 'RT']], 'trip': 'OW', 'ap_days': 10, 'rbd_open': ['B']}, 'NO_FARE'], ['sampled case 3', {'fares': [['KOW0', 800, 'K', 21, 'OW'], ['NOW1', 1390, 'N', 21, 'OW'], ['VOW2', 780, 'V', 21, 'OW'], ['YOW3', 200, 'Y', 0, 'OW']], 'trip': 'RT', 'ap_days': 3, 'rbd_open': ['H', 'L', 'Q', 'V', 'Y']}, [['YOW3', 'YOW3'], 400]], ['regression: equal-price tie break', {'fares': [['VRT0', 1460, 'V', 3, 'RT'], ['BRT1', 160, 'B', 14, 'RT'], ['KOW2', 330, 'K', 7, 'OW'], ['BRT3', 1460, 'B', 0, 'RT'], ['TRT4', 1130, 'T', 7, 'RT'], ['LRT5', 990, 'L', 14, 'RT'], ['QOW6', 190, 'Q', 14, 'OW']], 'trip': 'RT', 'ap_days': 7, 'rbd_open': ['B', 'L', 'M', 'N', 'V', 'Y']}, [['BRT3'], 1460]]]]
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
RT beats doubled OW[['VOW7', 'VOW7'], 640][['VOW7', 'VOW7'], 640]Passed
doubled OW beats RT[['VOW7', 'VOW7'], 640][['VOW7', 'VOW7'], 640]Passed
exactly AP days[['VOW7'], 320][['VOW7'], 320]Passed
one day short of AP[['HOW3'], 390][['HOW3'], 390]Passed
closed cheap class[['HOW3'], 390][['HOW3'], 390]Passed
price tie between classes[['LRT21'], 640][['LRT21'], 640]Passed
nothing sellableNO_FARENO_FAREPassed
OW trip ignores RT fares[['YOW'], 900][['YOW'], 900]Passed
sampled case 1[['TRT2'], 570][['TRT2'], 570]Passed
sampled case 2NO_FARENO_FAREPassed
sampled case 3[['TOW2'], 1300][['TOW2'], 1300]Passed
regression: equal-price tie break[['VOW0'], 200][['BOW1'], 200]Failed

SHA-256 / 533d97ca4f8c362723fdfebcb8d3ee0f1dbe082632c9facbc75419c5dbb09ad0

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(x):
    ap = x['ap_days']
    open_ = set(x['rbd_open'])
    order = 'YBMHQVLKTN'
    ok = [f for f in x['fares'] if f[3] <= ap and f[2] in open_]
    opts = []
    for basis, amt, rbd, minap, kind in ok:
        if x['trip'] == 'OW' and kind == 'OW':
            opts.append((amt, order.index(rbd), [basis]))
        if x['trip'] == 'RT' and kind == 'RT':
            opts.append((amt, order.index(rbd), [basis]))
        if x['trip'] == 'RT' and kind == 'OW':
            opts.append((2 * amt, order.index(rbd), [basis, basis]))
    if not opts: return 'NO_FARE'
    opts.sort(key=lambda o: (o[0], -o[1]))
    return [opts[0][2], opts[0][0]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['RT beats doubled OW', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'RT', 'ap_days': 15, 'rbd_open': ['Y', 'B', 'M', 'H', 'Q', 'V', 'L', 'K', 'T']}, [['VOW7', 'VOW7'], 640]], ['doubled OW beats RT', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'RT', 'ap_days': 7, 'rbd_open': ['Y', 'B', 'M', 'V', 'H']}, [['VOW7', 'VOW7'], 640]], ['exactly AP days', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 7, 'rbd_open': ['Y', 'B', 'V', 'H']}, [['VOW7'], 320]], ['one day short of AP', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 6, 'rbd_open': ['Y', 'B', 'V', 'H']}, [['HOW3'], 390]], ['closed cheap class', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 11, 'rbd_open': ['Y', 'B', 'H']}, [['HOW3'], 390]], ['price tie between classes', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'RT', 'ap_days': 30, 'rbd_open': ['Y', 'B', 'M', 'K', 'L']}, [['LRT21'], 640]], ['nothing sellable', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 1, 'rbd_open': ['Q', 'L', 'K']}, 'NO_FARE'], ['OW trip ignores RT fares', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 21, 'rbd_open': ['Y', 'Q', 'L', 'K']}, [['YOW'], 900]], ['sampled case 1', {'fares': [['BOW0', 1090, 'B', 3, 'OW'], ['TRT1', 1190, 'T', 7, 'RT'], ['TRT2', 570, 'T', 0, 'RT'], ['MOW3', 1370, 'M', 3, 'OW']], 'trip': 'RT', 'ap_days': 0, 'rbd_open': ['B', 'H', 'K', 'L', 'M', 'N', 'T', 'Y']}, [['TRT2'], 570]], ['sampled case 2', {'fares': [['TRT0', 970, 'T', 0, 'RT'], ['TOW1', 780, 'T', 3, 'OW'], ['LRT2', 800, 'L', 7, 'RT'], ['VRT3', 1290, 'V', 14, 'RT'], ['BOW4', 1450, 'B', 21, 'OW']], 'trip': 'OW', 'ap_days': 30, 'rbd_open': ['Y']}, 'NO_FARE'], ['sampled case 3', {'fares': [['KRT0', 550, 'K', 3, 'RT'], ['HRT1', 1290, 'H', 3, 'RT'], ['TOW2', 1300, 'T', 7, 'OW'], ['MOW3', 480, 'M', 21, 'OW']], 'trip': 'OW', 'ap_days': 7, 'rbd_open': ['B', 'H', 'M', 'T', 'Y']}, [['TOW2'], 1300]], ['regression: equal-price tie break', {'fares': [['VOW0', 200, 'V', 3, 'OW'], ['BOW1', 200, 'B', 0, 'OW']], 'trip': 'OW', 'ap_days': 14, 'rbd_open': ['B', 'H', 'K', 'L', 'M', 'N', 'Q', 'T', 'V', 'Y']}, [['BOW1'], 200]]], [['RT beats doubled OW', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'RT', 'ap_days': 16, 'rbd_open': ['Y', 'B', 'M', 'H', 'Q', 'V', 'L', 'K', 'T']}, [['VOW7', 'VOW7'], 640]], ['doubled OW beats RT', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'RT', 'ap_days': 7, 'rbd_open': ['Y', 'B', 'M', 'V', 'H']}, [['VOW7', 'VOW7'], 640]], ['exactly AP days', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 7, 'rbd_open': ['Y', 'B', 'V', 'H']}, [['VOW7'], 320]], ['one day short of AP', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 6, 'rbd_open': ['Y', 'B', 'V', 'H']}, [['HOW3'], 390]], ['closed cheap class', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 12, 'rbd_open': ['Y', 'B', 'H']}, [['HOW3'], 390]], ['price tie between classes', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'RT', 'ap_days': 30, 'rbd_open': ['Y', 'B', 'M', 'K', 'L']}, [['LRT21'], 640]], ['nothing sellable', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 1, 'rbd_open': ['Q', 'L', 'K']}, 'NO_FARE'], ['OW trip ignores RT fares', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 21, 'rbd_open': ['Y', 'Q', 'L', 'K']}, [['YOW'], 900]], ['sampled case 1', {'fares': [['NOW0', 1290, 'N', 0, 'OW'], ['YRT1', 1250, 'Y', 0, 'RT'], ['LOW2', 190, 'L', 7, 'OW']], 'trip': 'OW', 'ap_days': 7, 'rbd_open': ['K', 'T']}, 'NO_FARE'], ['sampled case 2', {'fares': [['TRT0', 1050, 'T', 3, 'RT'], ['KOW1', 890, 'K', 21, 'OW'], ['TOW2', 1070, 'T', 3, 'OW'], ['HOW3', 880, 'H', 14, 'OW'], ['VOW4', 480, 'V', 0, 'OW']], 'trip': 'RT', 'ap_days': 3, 'rbd_open': ['B', 'H', 'K', 'L', 'N', 'Q', 'V', 'Y']}, [['VOW4', 'VOW4'], 960]], ['sampled case 3', {'fares': [['QOW0', 1370, 'Q', 14, 'OW'], ['HRT1', 320, 'H', 3, 'RT'], ['BOW2', 860, 'B', 21, 'OW'], ['LRT3', 1490, 'L', 3, 'RT'], ['LOW4', 1320, 'L', 0, 'OW']], 'trip': 'RT', 'ap_days': 3, 'rbd_open': ['H', 'K', 'L', 'M', 'N', 'Q', 'T', 'V', 'Y']}, [['HRT1'], 320]], ['regression: equal-price tie break', {'fares': [['QRT0', 1300, 'Q', 3, 'RT'], ['HOW1', 650, 'H', 0, 'OW'], ['KOW2', 1130, 'K', 3, 'OW'], ['YOW3', 1010, 'Y', 7, 'OW'], ['YOW4', 1000, 'Y', 7, 'OW']], 'trip': 'RT', 'ap_days': 14, 'rbd_open': ['B', 'H', 'K', 'L', 'M', 'Q', 'T', 'V', 'Y']}, [['HOW1', 'HOW1'], 1300]]], [['RT beats doubled OW', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'RT', 'ap_days': 17, 'rbd_open': ['Y', 'B', 'M', 'H', 'Q', 'V', 'L', 'K', 'T']}, [['VOW7', 'VOW7'], 640]], ['doubled OW beats RT', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'RT', 'ap_days': 7, 'rbd_open': ['Y', 'B', 'M', 'V', 'H']}, [['VOW7', 'VOW7'], 640]], ['exactly AP days', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 7, 'rbd_open': ['Y', 'B', 'V', 'H']}, [['VOW7'], 320]], ['one day short of AP', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 6, 'rbd_open': ['Y', 'B', 'V', 'H']}, [['HOW3'], 390]], ['closed cheap class', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 13, 'rbd_open': ['Y', 'B', 'H']}, [['HOW3'], 390]], ['price tie between classes', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'RT', 'ap_days': 30, 'rbd_open': ['Y', 'B', 'M', 'K', 'L']}, [['LRT21'], 640]], ['nothing sellable', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 1, 'rbd_open': ['Q', 'L', 'K']}, 'NO_FARE'], ['OW trip ignores RT fares', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 21, 'rbd_open': ['Y', 'Q', 'L', 'K']}, [['YOW'], 900]], ['sampled case 1', {'fares': [['KOW0', 1090, 'K', 21, 'OW'], ['YRT1', 1120, 'Y', 14, 'RT'], ['YOW2', 200, 'Y', 14, 'OW'], ['TOW3', 770, 'T', 3, 'OW'], ['QRT4', 600, 'Q', 3, 'RT'], ['MOW5', 360, 'M', 0, 'OW']], 'trip': 'RT', 'ap_days': 7, 'rbd_open': ['K', 'L', 'M', 'Q', 'T']}, [['QRT4'], 600]], ['sampled case 2', {'fares': [['QOW0', 280, 'Q', 21, 'OW'], ['TRT1', 1200, 'T', 3, 'RT'], ['MOW2', 110, 'M', 14, 'OW']], 'trip': 'RT', 'ap_days': 7, 'rbd_open': ['H']}, 'NO_FARE'], ['sampled case 3', {'fares': [['YRT0', 1040, 'Y', 0, 'RT'], ['HRT1', 1310, 'H', 14, 'RT'], ['QRT2', 450, 'Q', 3, 'RT'], ['BOW3', 1430, 'B', 0, 'OW'], ['BRT4', 760, 'B', 3, 'RT']], 'trip': 'OW', 'ap_days': 14, 'rbd_open': ['B', 'H', 'M', 'V', 'Y']}, [['BOW3'], 1430]], ['regression: equal-price tie break', {'fares': [['MOW0', 160, 'M', 7, 'OW'], ['BOW1', 160, 'B', 21, 'OW'], ['VOW2', 120, 'V', 21, 'OW'], ['TOW3', 1310, 'T', 14, 'OW']], 'trip': 'RT', 'ap_days': 21, 'rbd_open': ['B', 'K', 'L', 'M', 'Q', 'T', 'Y']}, [['BOW1', 'BOW1'], 320]]], [['RT beats doubled OW', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'RT', 'ap_days': 18, 'rbd_open': ['Y', 'B', 'M', 'H', 'Q', 'V', 'L', 'K', 'T']}, [['VOW7', 'VOW7'], 640]], ['doubled OW beats RT', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'RT', 'ap_days': 7, 'rbd_open': ['Y', 'B', 'M', 'V', 'H']}, [['VOW7', 'VOW7'], 640]], ['exactly AP days', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 7, 'rbd_open': ['Y', 'B', 'V', 'H']}, [['VOW7'], 320]], ['one day short of AP', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 6, 'rbd_open': ['Y', 'B', 'V', 'H']}, [['HOW3'], 390]], ['closed cheap class', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 14, 'rbd_open': ['Y', 'B', 'H']}, [['HOW3'], 390]], ['price tie between classes', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'RT', 'ap_days': 30, 'rbd_open': ['Y', 'B', 'M', 'K', 'L']}, [['LRT21'], 640]], ['nothing sellable', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 1, 'rbd_open': ['Q', 'L', 'K']}, 'NO_FARE'], ['OW trip ignores RT fares', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 21, 'rbd_open': ['Y', 'Q', 'L', 'K']}, [['YOW'], 900]], ['sampled case 1', {'fares': [['NRT0', 450, 'N', 21, 'RT'], ['KOW1', 1370, 'K', 21, 'OW'], ['KOW2', 1250, 'K', 21, 'OW'], ['LOW3', 610, 'L', 0, 'OW'], ['NOW4', 1400, 'N', 7, 'OW']], 'trip': 'RT', 'ap_days': 10, 'rbd_open': ['B', 'M', 'N', 'Q', 'V', 'Y']}, [['NOW4', 'NOW4'], 2800]], ['sampled case 2', {'fares': [['BRT0', 1180, 'B', 0, 'RT'], ['LOW1', 850, 'L', 7, 'OW'], ['MRT2', 120, 'M', 3, 'RT']], 'trip': 'RT', 'ap_days': 3, 'rbd_open': ['H', 'M', 'N', 'V', 'Y']}, [['MRT2'], 120]], ['sampled case 3', {'fares': [['NOW0', 1490, 'N', 7, 'OW'], ['QRT1', 590, 'Q', 7, 'RT'], ['KOW2', 580, 'K', 14, 'OW']], 'trip': 'OW', 'ap_days': 3, 'rbd_open': ['H', 'L', 'M', 'N', 'Q', 'T', 'V', 'Y']}, 'NO_FARE'], ['regression: equal-price tie break', {'fares': [['KRT0', 1140, 'K', 14, 'RT'], ['MRT1', 220, 'M', 21, 'RT'], ['BOW2', 790, 'B', 14, 'OW'], ['QRT3', 790, 'Q', 0, 'RT'], ['MRT4', 790, 'M', 0, 'RT']], 'trip': 'RT', 'ap_days': 3, 'rbd_open': ['B', 'H', 'K', 'L', 'M', 'N', 'Q', 'T', 'V', 'Y']}, [['MRT4'], 790]]], [['RT beats doubled OW', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'RT', 'ap_days': 19, 'rbd_open': ['Y', 'B', 'M', 'H', 'Q', 'V', 'L', 'K', 'T']}, [['VOW7', 'VOW7'], 640]], ['doubled OW beats RT', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'RT', 'ap_days': 7, 'rbd_open': ['Y', 'B', 'M', 'V', 'H']}, [['VOW7', 'VOW7'], 640]], ['exactly AP days', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 7, 'rbd_open': ['Y', 'B', 'V', 'H']}, [['VOW7'], 320]], ['one day short of AP', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 6, 'rbd_open': ['Y', 'B', 'V', 'H']}, [['HOW3'], 390]], ['closed cheap class', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 15, 'rbd_open': ['Y', 'B', 'H']}, [['HOW3'], 390]], ['price tie between classes', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'RT', 'ap_days': 30, 'rbd_open': ['Y', 'B', 'M', 'K', 'L']}, [['LRT21'], 640]], ['nothing sellable', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 1, 'rbd_open': ['Q', 'L', 'K']}, 'NO_FARE'], ['OW trip ignores RT fares', {'fares': [['YOW', 900, 'Y', 0, 'OW'], ['BOW', 610, 'B', 0, 'OW'], ['QRT14', 780, 'Q', 14, 'RT'], ['MRT', 1150, 'M', 0, 'RT'], ['VOW7', 320, 'V', 7, 'OW'], ['LRT21', 640, 'L', 21, 'RT'], ['HOW3', 390, 'H', 3, 'OW'], ['KRT7', 640, 'K', 7, 'RT']], 'trip': 'OW', 'ap_days': 21, 'rbd_open': ['Y', 'Q', 'L', 'K']}, [['YOW'], 900]], ['sampled case 1', {'fares': [['KOW0', 390, 'K', 3, 'OW'], ['QOW1', 520, 'Q', 3, 'OW'], ['HRT2', 930, 'H', 0, 'RT'], ['YOW3', 280, 'Y', 14, 'OW']], 'trip': 'RT', 'ap_days': 7, 'rbd_open': ['Q', 'T']}, [['QOW1', 'QOW1'], 1040]], ['sampled case 2', {'fares': [['HOW0', 550, 'H', 14, 'OW'], ['TOW1', 1070, 'T', 3, 'OW'], ['MRT2', 770, 'M', 0, 'RT'], ['BRT3', 290, 'B', 14, 'RT']], 'trip': 'OW', 'ap_days': 10, 'rbd_open': ['B']}, 'NO_FARE'], ['sampled case 3', {'fares': [['KOW0', 800, 'K', 21, 'OW'], ['NOW1', 1390, 'N', 21, 'OW'], ['VOW2', 780, 'V', 21, 'OW'], ['YOW3', 200, 'Y', 0, 'OW']], 'trip': 'RT', 'ap_days': 3, 'rbd_open': ['H', 'L', 'Q', 'V', 'Y']}, [['YOW3', 'YOW3'], 400]], ['regression: equal-price tie break', {'fares': [['VRT0', 1460, 'V', 3, 'RT'], ['BRT1', 160, 'B', 14, 'RT'], ['KOW2', 330, 'K', 7, 'OW'], ['BRT3', 1460, 'B', 0, 'RT'], ['TRT4', 1130, 'T', 7, 'RT'], ['LRT5', 990, 'L', 14, 'RT'], ['QOW6', 190, 'Q', 14, 'OW']], 'trip': 'RT', 'ap_days': 7, 'rbd_open': ['B', 'L', 'M', 'N', 'V', 'Y']}, [['BRT3'], 1460]]]]
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
RT beats doubled OW[['KRT7'], 640][['VOW7', 'VOW7'], 640]Failed
doubled OW beats RT[['VOW7', 'VOW7'], 640][['VOW7', 'VOW7'], 640]Passed
exactly AP days[['VOW7'], 320][['VOW7'], 320]Passed
one day short of AP[['HOW3'], 390][['HOW3'], 390]Passed
closed cheap class[['HOW3'], 390][['HOW3'], 390]Passed
price tie between classes[['KRT7'], 640][['LRT21'], 640]Failed
nothing sellableNO_FARENO_FAREPassed
OW trip ignores RT fares[['YOW'], 900][['YOW'], 900]Passed
sampled case 1[['TRT2'], 570][['TRT2'], 570]Passed
sampled case 2NO_FARENO_FAREPassed
sampled case 3[['TOW2'], 1300][['TOW2'], 1300]Passed
regression: equal-price tie break[['VOW0'], 200][['BOW1'], 200]Failed

SHA-256 / 5692c4be262babfdd2250d8dc9bfa167258a9334d699574bc8cb303a4e9c42bc

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 12 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

Verification & scope

A stipulated toy fare-rule contract with invented constants; it is not an ATPCO or carrier tariff implementation and makes no claim of industry-standard conformance. 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:44.784004+00:00.

Case digest / 57cf7dc6a09585fdb3eac786bb60d2a0d3e799d4b2f370def67ec11a9adf2663