broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    v0 = max(((t,v) for t,v in zip(x["starts"],x["values"]) if t<=x["round"]),default=(0,None))[1]
    v1 = max(((t,v) for t,v,a in zip(x["starts"],x["values"],x["approved"]) if t<=x["round"] and a),default=(0,None))[1]
    v2 = x["current_reserve"] if x["disclosed"] else None
    v3 = x["current_reserve"] if x["frozen"] else x["submitted_reserve"]
    v4 = max(x["submitted_reserve"],x["floor"],x["seller_minimum"])
    v5 = x["submitted_reserve"]>=x["floor"]
    v6 = max(x["lot_minimum"],x["current_reserve"]*x["quantity"])
    v7 = len(x["real_bids"])
    v8 = x["current_reserve"] if x["withdrawn"] else x["submitted_reserve"]
    v9 = x["submitted_reserve"] if x["round"]>=x["grant_round"] else x["current_reserve"]
    return {'effective-reserve-step':v0,'approved-reserve-step':v1,'hidden-reserve-redaction':v2,'reserve-freeze':v3,'reserve-lower-bound':v4,'reserve-range-admission':v5,'whole-lot-reserve':v6,'reserve-not-a-bidder':v7,'withdrawn-reserve-amendment':v8,'grant-round-activation':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('reserve above ceiling', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 22, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [False, False, False, False, False]), ('seller floor binds / reserve above ceiling', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 22, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 15, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [False, False, False, False, False]), ('reserve below floor', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 4, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [False, False, False, False, False]), ('seller floor binds / reserve below floor', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 4, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 15, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [False, False, False, False, False]), ('normal contract', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [True, True, True, True, True]), ('seller floor binds', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 15, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [True, True, True, True, True]), ('amendment starts this round', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 3}, [True, True, True, True, True]), ('first round', {'round': 1, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [True, True, True, True, True]), ('last round', {'round': 6, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [True, True, True, True, True]), ('all approved', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, True, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [True, True, True, True, True]), ('public reserve', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': True, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [True, True, True, True, True]), ('frozen reserve', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': True, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [True, True, True, True, True])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'quantity', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['reserve-range-admission'], expected[N-1])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    v0 = max(((t,v) for t,v in zip(x["starts"],x["values"]) if t<=x["round"]),default=(0,None))[1]
    v1 = max(((t,v) for t,v,a in zip(x["starts"],x["values"],x["approved"]) if t<=x["round"] and a),default=(0,None))[1]
    v2 = x["current_reserve"] if x["disclosed"] else None
    v3 = x["current_reserve"] if x["frozen"] else x["submitted_reserve"]
    v4 = max(x["submitted_reserve"],x["floor"],x["seller_minimum"])
    v5 = x["submitted_reserve"]<=x["ceiling"]
    v6 = max(x["lot_minimum"],x["current_reserve"]*x["quantity"])
    v7 = len(x["real_bids"])
    v8 = x["current_reserve"] if x["withdrawn"] else x["submitted_reserve"]
    v9 = x["submitted_reserve"] if x["round"]>=x["grant_round"] else x["current_reserve"]
    return {'effective-reserve-step':v0,'approved-reserve-step':v1,'hidden-reserve-redaction':v2,'reserve-freeze':v3,'reserve-lower-bound':v4,'reserve-range-admission':v5,'whole-lot-reserve':v6,'reserve-not-a-bidder':v7,'withdrawn-reserve-amendment':v8,'grant-round-activation':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('reserve above ceiling', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 22, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [False, False, False, False, False]), ('seller floor binds / reserve above ceiling', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 22, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 15, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [False, False, False, False, False]), ('reserve below floor', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 4, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [False, False, False, False, False]), ('seller floor binds / reserve below floor', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 4, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 15, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [False, False, False, False, False]), ('normal contract', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [True, True, True, True, True]), ('seller floor binds', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 15, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [True, True, True, True, True]), ('amendment starts this round', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 3}, [True, True, True, True, True]), ('first round', {'round': 1, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [True, True, True, True, True]), ('last round', {'round': 6, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [True, True, True, True, True]), ('all approved', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, True, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [True, True, True, True, True]), ('public reserve', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': True, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [True, True, True, True, True]), ('frozen reserve', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': True, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [True, True, True, True, True])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'quantity', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['reserve-range-admission'], expected[N-1])
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)

prompt:
A reserve range check enforces only one side of the approved interval.

A seller precommits a reserve schedule before an auction. Reserve changes have effective rounds, approval and disclosure states. A hidden reserve can block sale but must not be represented as a competing bidder. The model certifies schedules rather than selecting a second-price payment. Named decision reserve-range-admission: For reserve range admission, apply the stipulated decision x["floor"]<=x["submitted_reserve"]<=x["ceiling"].

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    v0 = max(((t,v) for t,v in zip(x["starts"],x["values"]) if t<=x["round"]),default=(0,None))[1]
    v1 = max(((t,v) for t,v,a in zip(x["starts"],x["values"],x["approved"]) if t<=x["round"] and a),default=(0,None))[1]
    v2 = x["current_reserve"] if x["disclosed"] else None
    v3 = x["current_reserve"] if x["frozen"] else x["submitted_reserve"]
    v4 = max(x["submitted_reserve"],x["floor"],x["seller_minimum"])
    v5 = x["floor"]<=x["submitted_reserve"]<=x["ceiling"]
    v6 = x["current_reserve"]
    v7 = len(x["real_bids"])
    v8 = x["current_reserve"] if x["withdrawn"] else x["submitted_reserve"]
    v9 = x["submitted_reserve"] if x["round"]>=x["grant_round"] else x["current_reserve"]
    return {'effective-reserve-step':v0,'approved-reserve-step':v1,'hidden-reserve-redaction':v2,'reserve-freeze':v3,'reserve-lower-bound':v4,'reserve-range-admission':v5,'whole-lot-reserve':v6,'reserve-not-a-bidder':v7,'withdrawn-reserve-amendment':v8,'grant-round-activation':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [30, 60, 90, 120, 150]), ('seller floor binds', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 15, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [30, 60, 90, 120, 150]), ('one-unit lot', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 1, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [24, 48, 72, 96, 120]), ('seller floor binds / one-unit lot', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 15, 'ceiling': 20, 'quantity': 1, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [24, 48, 72, 96, 120]), ('amendment starts this round', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 3}, [30, 60, 90, 120, 150]), ('first round', {'round': 1, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [30, 60, 90, 120, 150]), ('last round', {'round': 6, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [30, 60, 90, 120, 150]), ('all approved', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, True, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [30, 60, 90, 120, 150]), ('public reserve', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': True, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [30, 60, 90, 120, 150]), ('frozen reserve', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': True, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [30, 60, 90, 120, 150]), ('reserve below floor', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 4, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [30, 60, 90, 120, 150])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'quantity', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['whole-lot-reserve'], expected[N-1])
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)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    v0 = max(((t,v) for t,v in zip(x["starts"],x["values"]) if t<=x["round"]),default=(0,None))[1]
    v1 = max(((t,v) for t,v,a in zip(x["starts"],x["values"],x["approved"]) if t<=x["round"] and a),default=(0,None))[1]
    v2 = x["current_reserve"] if x["disclosed"] else None
    v3 = x["current_reserve"] if x["frozen"] else x["submitted_reserve"]
    v4 = max(x["submitted_reserve"],x["floor"],x["seller_minimum"])
    v5 = x["floor"]<=x["submitted_reserve"]<=x["ceiling"]
    v6 = x["current_reserve"]*x["quantity"]
    v7 = len(x["real_bids"])
    v8 = x["current_reserve"] if x["withdrawn"] else x["submitted_reserve"]
    v9 = x["submitted_reserve"] if x["round"]>=x["grant_round"] else x["current_reserve"]
    return {'effective-reserve-step':v0,'approved-reserve-step':v1,'hidden-reserve-redaction':v2,'reserve-freeze':v3,'reserve-lower-bound':v4,'reserve-range-admission':v5,'whole-lot-reserve':v6,'reserve-not-a-bidder':v7,'withdrawn-reserve-amendment':v8,'grant-round-activation':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [30, 60, 90, 120, 150]), ('seller floor binds', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 15, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [30, 60, 90, 120, 150]), ('one-unit lot', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 1, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [24, 48, 72, 96, 120]), ('seller floor binds / one-unit lot', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 15, 'ceiling': 20, 'quantity': 1, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [24, 48, 72, 96, 120]), ('amendment starts this round', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 3}, [30, 60, 90, 120, 150]), ('first round', {'round': 1, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [30, 60, 90, 120, 150]), ('last round', {'round': 6, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [30, 60, 90, 120, 150]), ('all approved', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, True, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [30, 60, 90, 120, 150]), ('public reserve', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': True, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [30, 60, 90, 120, 150]), ('frozen reserve', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': True, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [30, 60, 90, 120, 150]), ('reserve below floor', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 4, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [30, 60, 90, 120, 150])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'quantity', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['whole-lot-reserve'], expected[N-1])
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)

prompt:
Whole-lot reserve ignores either lot minimum or number of units.

A seller precommits a reserve schedule before an auction. Reserve changes have effective rounds, approval and disclosure states. A hidden reserve can block sale but must not be represented as a competing bidder. The model certifies schedules rather than selecting a second-price payment. Named decision whole-lot-reserve: For whole lot reserve, apply the stipulated decision max(x["lot_minimum"],x["current_reserve"]*x["quantity"]).

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    v0 = max(((t,v) for t,v in zip(x["starts"],x["values"]) if t<=x["round"]),default=(0,None))[1]
    v1 = max(((t,v) for t,v,a in zip(x["starts"],x["values"],x["approved"]) if t<=x["round"] and a),default=(0,None))[1]
    v2 = x["current_reserve"] if x["disclosed"] else None
    v3 = x["current_reserve"] if x["frozen"] else x["submitted_reserve"]
    v4 = max(x["submitted_reserve"],x["floor"],x["seller_minimum"])
    v5 = x["floor"]<=x["submitted_reserve"]<=x["ceiling"]
    v6 = max(x["lot_minimum"],x["current_reserve"]*x["quantity"])
    v7 = len(x["real_bids"])+1
    v8 = x["current_reserve"] if x["withdrawn"] else x["submitted_reserve"]
    v9 = x["submitted_reserve"] if x["round"]>=x["grant_round"] else x["current_reserve"]
    return {'effective-reserve-step':v0,'approved-reserve-step':v1,'hidden-reserve-redaction':v2,'reserve-freeze':v3,'reserve-lower-bound':v4,'reserve-range-admission':v5,'whole-lot-reserve':v6,'reserve-not-a-bidder':v7,'withdrawn-reserve-amendment':v8,'grant-round-activation':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [2, 2, 2, 2, 2]), ('seller floor binds', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 15, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [2, 2, 2, 2, 2]), ('amendment starts this round', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 3}, [2, 2, 2, 2, 2]), ('first round', {'round': 1, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [2, 2, 2, 2, 2]), ('last round', {'round': 6, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [2, 2, 2, 2, 2]), ('all approved', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, True, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [2, 2, 2, 2, 2]), ('public reserve', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': True, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [2, 2, 2, 2, 2]), ('frozen reserve', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': True, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [2, 2, 2, 2, 2]), ('reserve below floor', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 4, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [2, 2, 2, 2, 2])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'quantity', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['reserve-not-a-bidder'], expected[N-1])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    v0 = max(((t,v) for t,v in zip(x["starts"],x["values"]) if t<=x["round"]),default=(0,None))[1]
    v1 = max(((t,v) for t,v,a in zip(x["starts"],x["values"],x["approved"]) if t<=x["round"] and a),default=(0,None))[1]
    v2 = x["current_reserve"] if x["disclosed"] else None
    v3 = x["current_reserve"] if x["frozen"] else x["submitted_reserve"]
    v4 = max(x["submitted_reserve"],x["floor"],x["seller_minimum"])
    v5 = x["floor"]<=x["submitted_reserve"]<=x["ceiling"]
    v6 = max(x["lot_minimum"],x["current_reserve"]*x["quantity"])
    v7 = len(x["real_bids"])+(1 if x["real_bids"] else 0)
    v8 = x["current_reserve"] if x["withdrawn"] else x["submitted_reserve"]
    v9 = x["submitted_reserve"] if x["round"]>=x["grant_round"] else x["current_reserve"]
    return {'effective-reserve-step':v0,'approved-reserve-step':v1,'hidden-reserve-redaction':v2,'reserve-freeze':v3,'reserve-lower-bound':v4,'reserve-range-admission':v5,'whole-lot-reserve':v6,'reserve-not-a-bidder':v7,'withdrawn-reserve-amendment':v8,'grant-round-activation':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [2, 2, 2, 2, 2]), ('seller floor binds', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 15, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [2, 2, 2, 2, 2]), ('amendment starts this round', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 3}, [2, 2, 2, 2, 2]), ('first round', {'round': 1, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [2, 2, 2, 2, 2]), ('last round', {'round': 6, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [2, 2, 2, 2, 2]), ('all approved', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, True, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [2, 2, 2, 2, 2]), ('public reserve', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': True, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [2, 2, 2, 2, 2]), ('frozen reserve', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': True, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [2, 2, 2, 2, 2]), ('reserve below floor', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 4, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [2, 2, 2, 2, 2])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'quantity', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['reserve-not-a-bidder'], expected[N-1])
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)

prompt:
A reserve placeholder is counted as auction participation.

A seller precommits a reserve schedule before an auction. Reserve changes have effective rounds, approval and disclosure states. A hidden reserve can block sale but must not be represented as a competing bidder. The model certifies schedules rather than selecting a second-price payment. Named decision reserve-not-a-bidder: For reserve not a bidder, apply the stipulated decision len(x["real_bids"]).

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    v0 = max(((t,v) for t,v in zip(x["starts"],x["values"]) if t<=x["round"]),default=(0,None))[1]
    v1 = max(((t,v) for t,v,a in zip(x["starts"],x["values"],x["approved"]) if t<=x["round"] and a),default=(0,None))[1]
    v2 = x["current_reserve"] if x["disclosed"] else None
    v3 = x["current_reserve"] if x["frozen"] else x["submitted_reserve"]
    v4 = max(x["submitted_reserve"],x["floor"],x["seller_minimum"])
    v5 = x["floor"]<=x["submitted_reserve"]<=x["ceiling"]
    v6 = max(x["lot_minimum"],x["current_reserve"]*x["quantity"])
    v7 = len(x["real_bids"])
    v8 = x["submitted_reserve"]
    v9 = x["submitted_reserve"] if x["round"]>=x["grant_round"] else x["current_reserve"]
    return {'effective-reserve-step':v0,'approved-reserve-step':v1,'hidden-reserve-redaction':v2,'reserve-freeze':v3,'reserve-lower-bound':v4,'reserve-range-admission':v5,'whole-lot-reserve':v6,'reserve-not-a-bidder':v7,'withdrawn-reserve-amendment':v8,'grant-round-activation':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('withdrawn reserve amendment', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': True, 'grant_round': 4}, [10, 20, 30, 40, 50]), ('seller floor binds / withdrawn reserve amendment', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 15, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': True, 'grant_round': 4}, [10, 20, 30, 40, 50]), ('normal contract', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [8, 16, 24, 32, 40]), ('seller floor binds', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 15, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [8, 16, 24, 32, 40]), ('amendment starts this round', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 3}, [8, 16, 24, 32, 40]), ('first round', {'round': 1, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [8, 16, 24, 32, 40]), ('last round', {'round': 6, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [8, 16, 24, 32, 40]), ('all approved', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, True, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [8, 16, 24, 32, 40]), ('public reserve', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': True, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [8, 16, 24, 32, 40]), ('frozen reserve', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': True, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [8, 16, 24, 32, 40]), ('reserve below floor', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 4, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [4, 8, 12, 16, 20])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'quantity', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['withdrawn-reserve-amendment'], expected[N-1])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    v0 = max(((t,v) for t,v in zip(x["starts"],x["values"]) if t<=x["round"]),default=(0,None))[1]
    v1 = max(((t,v) for t,v,a in zip(x["starts"],x["values"],x["approved"]) if t<=x["round"] and a),default=(0,None))[1]
    v2 = x["current_reserve"] if x["disclosed"] else None
    v3 = x["current_reserve"] if x["frozen"] else x["submitted_reserve"]
    v4 = max(x["submitted_reserve"],x["floor"],x["seller_minimum"])
    v5 = x["floor"]<=x["submitted_reserve"]<=x["ceiling"]
    v6 = max(x["lot_minimum"],x["current_reserve"]*x["quantity"])
    v7 = len(x["real_bids"])
    v8 = x["current_reserve"]
    v9 = x["submitted_reserve"] if x["round"]>=x["grant_round"] else x["current_reserve"]
    return {'effective-reserve-step':v0,'approved-reserve-step':v1,'hidden-reserve-redaction':v2,'reserve-freeze':v3,'reserve-lower-bound':v4,'reserve-range-admission':v5,'whole-lot-reserve':v6,'reserve-not-a-bidder':v7,'withdrawn-reserve-amendment':v8,'grant-round-activation':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('withdrawn reserve amendment', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': True, 'grant_round': 4}, [10, 20, 30, 40, 50]), ('seller floor binds / withdrawn reserve amendment', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 15, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': True, 'grant_round': 4}, [10, 20, 30, 40, 50]), ('normal contract', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [8, 16, 24, 32, 40]), ('seller floor binds', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 15, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [8, 16, 24, 32, 40]), ('amendment starts this round', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 3}, [8, 16, 24, 32, 40]), ('first round', {'round': 1, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [8, 16, 24, 32, 40]), ('last round', {'round': 6, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [8, 16, 24, 32, 40]), ('all approved', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, True, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [8, 16, 24, 32, 40]), ('public reserve', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': True, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [8, 16, 24, 32, 40]), ('frozen reserve', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': True, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [8, 16, 24, 32, 40]), ('reserve below floor', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 4, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [4, 8, 12, 16, 20])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'quantity', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['withdrawn-reserve-amendment'], expected[N-1])
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)

prompt:
A withdrawn seller reserve amendment still replaces the binding reserve.

A seller precommits a reserve schedule before an auction. Reserve changes have effective rounds, approval and disclosure states. A hidden reserve can block sale but must not be represented as a competing bidder. The model certifies schedules rather than selecting a second-price payment. Named decision withdrawn-reserve-amendment: For withdrawn reserve amendment, apply the stipulated decision x["current_reserve"] if x["withdrawn"] else x["submitted_reserve"].

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    v0 = max(((t,v) for t,v in zip(x["starts"],x["values"]) if t<=x["round"]),default=(0,None))[1]
    v1 = max(((t,v) for t,v,a in zip(x["starts"],x["values"],x["approved"]) if t<=x["round"] and a),default=(0,None))[1]
    v2 = x["current_reserve"] if x["disclosed"] else None
    v3 = x["current_reserve"] if x["frozen"] else x["submitted_reserve"]
    v4 = max(x["submitted_reserve"],x["floor"],x["seller_minimum"])
    v5 = x["floor"]<=x["submitted_reserve"]<=x["ceiling"]
    v6 = max(x["lot_minimum"],x["current_reserve"]*x["quantity"])
    v7 = len(x["real_bids"])
    v8 = x["current_reserve"] if x["withdrawn"] else x["submitted_reserve"]
    v9 = x["submitted_reserve"]
    return {'effective-reserve-step':v0,'approved-reserve-step':v1,'hidden-reserve-redaction':v2,'reserve-freeze':v3,'reserve-lower-bound':v4,'reserve-range-admission':v5,'whole-lot-reserve':v6,'reserve-not-a-bidder':v7,'withdrawn-reserve-amendment':v8,'grant-round-activation':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [10, 20, 30, 40, 50]), ('seller floor binds', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 15, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [10, 20, 30, 40, 50]), ('amendment starts this round', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 3}, [8, 16, 24, 32, 40]), ('seller floor binds / amendment starts this round', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 15, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 3}, [8, 16, 24, 32, 40]), ('first round', {'round': 1, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [10, 20, 30, 40, 50]), ('last round', {'round': 6, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [8, 16, 24, 32, 40]), ('all approved', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, True, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [10, 20, 30, 40, 50]), ('public reserve', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': True, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [10, 20, 30, 40, 50]), ('frozen reserve', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': True, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [10, 20, 30, 40, 50]), ('reserve below floor', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 4, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [10, 20, 30, 40, 50])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'quantity', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['grant-round-activation'], expected[N-1])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    v0 = max(((t,v) for t,v in zip(x["starts"],x["values"]) if t<=x["round"]),default=(0,None))[1]
    v1 = max(((t,v) for t,v,a in zip(x["starts"],x["values"],x["approved"]) if t<=x["round"] and a),default=(0,None))[1]
    v2 = x["current_reserve"] if x["disclosed"] else None
    v3 = x["current_reserve"] if x["frozen"] else x["submitted_reserve"]
    v4 = max(x["submitted_reserve"],x["floor"],x["seller_minimum"])
    v5 = x["floor"]<=x["submitted_reserve"]<=x["ceiling"]
    v6 = max(x["lot_minimum"],x["current_reserve"]*x["quantity"])
    v7 = len(x["real_bids"])
    v8 = x["current_reserve"] if x["withdrawn"] else x["submitted_reserve"]
    v9 = x["submitted_reserve"] if x["round"]>x["grant_round"] else x["current_reserve"]
    return {'effective-reserve-step':v0,'approved-reserve-step':v1,'hidden-reserve-redaction':v2,'reserve-freeze':v3,'reserve-lower-bound':v4,'reserve-range-admission':v5,'whole-lot-reserve':v6,'reserve-not-a-bidder':v7,'withdrawn-reserve-amendment':v8,'grant-round-activation':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [10, 20, 30, 40, 50]), ('seller floor binds', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 15, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [10, 20, 30, 40, 50]), ('amendment starts this round', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 3}, [8, 16, 24, 32, 40]), ('seller floor binds / amendment starts this round', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 15, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 3}, [8, 16, 24, 32, 40]), ('first round', {'round': 1, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [10, 20, 30, 40, 50]), ('last round', {'round': 6, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [8, 16, 24, 32, 40]), ('all approved', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, True, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [10, 20, 30, 40, 50]), ('public reserve', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': True, 'frozen': False, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [10, 20, 30, 40, 50]), ('frozen reserve', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': True, 'submitted_reserve': 8, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [10, 20, 30, 40, 50]), ('reserve below floor', {'round': 3, 'starts': [1, 3, 5], 'values': [12, 9, 6], 'approved': [True, False, True], 'disclosed': False, 'frozen': False, 'submitted_reserve': 4, 'current_reserve': 10, 'floor': 7, 'seller_minimum': 5, 'ceiling': 20, 'quantity': 3, 'lot_minimum': 24, 'real_bids': [11, 8], 'reserve_as_bid': 10, 'withdrawn': False, 'grant_round': 4}, [10, 20, 30, 40, 50])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'quantity', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['grant-round-activation'], expected[N-1])
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)

prompt:
Reserve amendment approval is confused with its effective auction round.

A seller precommits a reserve schedule before an auction. Reserve changes have effective rounds, approval and disclosure states. A hidden reserve can block sale but must not be represented as a competing bidder. The model certifies schedules rather than selecting a second-price payment. Named decision grant-round-activation: For grant round activation, apply the stipulated decision x["submitted_reserve"] if x["round"]>=x["grant_round"] else x["current_reserve"].

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    v0 = sum(x["amounts"])
    v1 = [min(a,max(0,x["paid"]-sum(x["amounts"][:i]))) for i,a in enumerate(x["amounts"])]
    v2 = x["paid"]>=sum(x["amounts"][:x["delivery_index"]+1])
    v3 = sum(a for i,a in enumerate(x["amounts"]) if i in x["disputed"])
    v4 = sum(a for i,a in enumerate(x["amounts"]) if i not in x["waived"])
    v5 = min(x["refund"],max(0,x["paid"]-x["already_refunded"]))
    v6 = [] if x["cancelled"] else [d for d in x["due"] if d>x["now"]]
    v7 = [x["now"] if x["accelerated"] and d>x["now"] else d for d in x["due"]]
    v8 = x["paid"]+(0 if x["deposit_applied"] else x["deposit"])
    v9 = max(0,x["paid"]-sum(a for i,a in enumerate(x["amounts"]) if i not in x["waived"]))
    return {'due-installments':v0,'oldest-tranche-credit':v1,'delivery-tranche-threshold':v2,'disputed-tranche-hold':v3,'waived-tranche-obligation':v4,'refundable-paid-installments':v5,'cancel-future-collection':v6,'accelerated-maturity':v7,'deposit-credit-once':v8,'excess-installment-credit':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 9, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [12, 24, 36, 48, 60]), ('independent equal receipts', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 9, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r1', 'r2', 'r1'], 'receipt_amounts': [3, 3, 3], 'award_total': 20}, [12, 24, 36, 48, 60]), ('nothing paid', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 0, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [12, 24, 36, 48, 60]), ('fully paid', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 20, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [12, 24, 36, 48, 60]), ('first due', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 2, 'paid': 9, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [5, 10, 15, 20, 25]), ('before any due', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 1, 'paid': 9, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [0, 0, 0, 0, 0]), ('after all due', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 8, 'paid': 9, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [20, 40, 60, 80, 100]), ('no disputes', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 9, 'delivery_index': 1, 'disputed': [], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [12, 24, 36, 48, 60]), ('no waived tranches', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 9, 'delivery_index': 1, 'disputed': [1], 'waived': [], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [12, 24, 36, 48, 60])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['due-installments'], expected[N-1])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    v0 = sum(a for a,d in zip(x["amounts"],x["due"]) if d<x["now"])
    v1 = [min(a,max(0,x["paid"]-sum(x["amounts"][:i]))) for i,a in enumerate(x["amounts"])]
    v2 = x["paid"]>=sum(x["amounts"][:x["delivery_index"]+1])
    v3 = sum(a for i,a in enumerate(x["amounts"]) if i in x["disputed"])
    v4 = sum(a for i,a in enumerate(x["amounts"]) if i not in x["waived"])
    v5 = min(x["refund"],max(0,x["paid"]-x["already_refunded"]))
    v6 = [] if x["cancelled"] else [d for d in x["due"] if d>x["now"]]
    v7 = [x["now"] if x["accelerated"] and d>x["now"] else d for d in x["due"]]
    v8 = x["paid"]+(0 if x["deposit_applied"] else x["deposit"])
    v9 = max(0,x["paid"]-sum(a for i,a in enumerate(x["amounts"]) if i not in x["waived"]))
    return {'due-installments':v0,'oldest-tranche-credit':v1,'delivery-tranche-threshold':v2,'disputed-tranche-hold':v3,'waived-tranche-obligation':v4,'refundable-paid-installments':v5,'cancel-future-collection':v6,'accelerated-maturity':v7,'deposit-credit-once':v8,'excess-installment-credit':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 9, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [12, 24, 36, 48, 60]), ('independent equal receipts', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 9, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r1', 'r2', 'r1'], 'receipt_amounts': [3, 3, 3], 'award_total': 20}, [12, 24, 36, 48, 60]), ('nothing paid', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 0, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [12, 24, 36, 48, 60]), ('fully paid', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 20, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [12, 24, 36, 48, 60]), ('first due', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 2, 'paid': 9, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [5, 10, 15, 20, 25]), ('before any due', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 1, 'paid': 9, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [0, 0, 0, 0, 0]), ('after all due', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 8, 'paid': 9, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [20, 40, 60, 80, 100]), ('no disputes', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 9, 'delivery_index': 1, 'disputed': [], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [12, 24, 36, 48, 60]), ('no waived tranches', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 9, 'delivery_index': 1, 'disputed': [1], 'waived': [], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [12, 24, 36, 48, 60])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['due-installments'], expected[N-1])
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)

prompt:
Future installments are due immediately or the current due tick is skipped.

A toy award permits staged integer-credit installments. Due amounts are a schedule; paid credits are allocated to earlier due installments first. Delivery release depends on the contractual delivery tranche and disputed tranches remain held. No interest or real payment processing is modeled. Named decision due-installments: For due installments, apply the stipulated decision sum(a for a,d in zip(x["amounts"],x["due"]) if d<=x["now"]).

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    v0 = sum(a for a,d in zip(x["amounts"],x["due"]) if d<=x["now"])
    v1 = [min(a,x["paid"]) for a in x["amounts"]]
    v2 = x["paid"]>=sum(x["amounts"][:x["delivery_index"]+1])
    v3 = sum(a for i,a in enumerate(x["amounts"]) if i in x["disputed"])
    v4 = sum(a for i,a in enumerate(x["amounts"]) if i not in x["waived"])
    v5 = min(x["refund"],max(0,x["paid"]-x["already_refunded"]))
    v6 = [] if x["cancelled"] else [d for d in x["due"] if d>x["now"]]
    v7 = [x["now"] if x["accelerated"] and d>x["now"] else d for d in x["due"]]
    v8 = x["paid"]+(0 if x["deposit_applied"] else x["deposit"])
    v9 = max(0,x["paid"]-sum(a for i,a in enumerate(x["amounts"]) if i not in x["waived"]))
    return {'due-installments':v0,'oldest-tranche-credit':v1,'delivery-tranche-threshold':v2,'disputed-tranche-hold':v3,'waived-tranche-obligation':v4,'refundable-paid-installments':v5,'cancel-future-collection':v6,'accelerated-maturity':v7,'deposit-credit-once':v8,'excess-installment-credit':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 9, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [[5, 4, 0], [10, 8, 0], [15, 12, 0], [20, 16, 0], [25, 20, 0]]), ('independent equal receipts', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 9, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r1', 'r2', 'r1'], 'receipt_amounts': [3, 3, 3], 'award_total': 20}, [[5, 4, 0], [10, 8, 0], [15, 12, 0], [20, 16, 0], [25, 20, 0]]), ('nothing paid', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 0, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]]), ('fully paid', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 20, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [[5, 7, 8], [10, 14, 16], [15, 21, 24], [20, 28, 32], [25, 35, 40]]), ('first due', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 2, 'paid': 9, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [[5, 4, 0], [10, 8, 0], [15, 12, 0], [20, 16, 0], [25, 20, 0]]), ('before any due', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 1, 'paid': 9, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [[5, 4, 0], [10, 8, 0], [15, 12, 0], [20, 16, 0], [25, 20, 0]]), ('after all due', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 8, 'paid': 9, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [[5, 4, 0], [10, 8, 0], [15, 12, 0], [20, 16, 0], [25, 20, 0]]), ('no disputes', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 9, 'delivery_index': 1, 'disputed': [], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [[5, 4, 0], [10, 8, 0], [15, 12, 0], [20, 16, 0], [25, 20, 0]]), ('no waived tranches', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 9, 'delivery_index': 1, 'disputed': [1], 'waived': [], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [[5, 4, 0], [10, 8, 0], [15, 12, 0], [20, 16, 0], [25, 20, 0]])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['oldest-tranche-credit'], expected[N-1])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    v0 = sum(a for a,d in zip(x["amounts"],x["due"]) if d<=x["now"])
    v1 = [min(a,max(0,x["paid"]-sum(x["amounts"][i+1:]))) for i,a in enumerate(x["amounts"])]
    v2 = x["paid"]>=sum(x["amounts"][:x["delivery_index"]+1])
    v3 = sum(a for i,a in enumerate(x["amounts"]) if i in x["disputed"])
    v4 = sum(a for i,a in enumerate(x["amounts"]) if i not in x["waived"])
    v5 = min(x["refund"],max(0,x["paid"]-x["already_refunded"]))
    v6 = [] if x["cancelled"] else [d for d in x["due"] if d>x["now"]]
    v7 = [x["now"] if x["accelerated"] and d>x["now"] else d for d in x["due"]]
    v8 = x["paid"]+(0 if x["deposit_applied"] else x["deposit"])
    v9 = max(0,x["paid"]-sum(a for i,a in enumerate(x["amounts"]) if i not in x["waived"]))
    return {'due-installments':v0,'oldest-tranche-credit':v1,'delivery-tranche-threshold':v2,'disputed-tranche-hold':v3,'waived-tranche-obligation':v4,'refundable-paid-installments':v5,'cancel-future-collection':v6,'accelerated-maturity':v7,'deposit-credit-once':v8,'excess-installment-credit':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 9, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [[5, 4, 0], [10, 8, 0], [15, 12, 0], [20, 16, 0], [25, 20, 0]]), ('independent equal receipts', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 9, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r1', 'r2', 'r1'], 'receipt_amounts': [3, 3, 3], 'award_total': 20}, [[5, 4, 0], [10, 8, 0], [15, 12, 0], [20, 16, 0], [25, 20, 0]]), ('nothing paid', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 0, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]]), ('fully paid', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 20, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [[5, 7, 8], [10, 14, 16], [15, 21, 24], [20, 28, 32], [25, 35, 40]]), ('first due', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 2, 'paid': 9, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [[5, 4, 0], [10, 8, 0], [15, 12, 0], [20, 16, 0], [25, 20, 0]]), ('before any due', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 1, 'paid': 9, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [[5, 4, 0], [10, 8, 0], [15, 12, 0], [20, 16, 0], [25, 20, 0]]), ('after all due', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 8, 'paid': 9, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [[5, 4, 0], [10, 8, 0], [15, 12, 0], [20, 16, 0], [25, 20, 0]]), ('no disputes', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 9, 'delivery_index': 1, 'disputed': [], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [[5, 4, 0], [10, 8, 0], [15, 12, 0], [20, 16, 0], [25, 20, 0]]), ('no waived tranches', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 9, 'delivery_index': 1, 'disputed': [1], 'waived': [], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [[5, 4, 0], [10, 8, 0], [15, 12, 0], [20, 16, 0], [25, 20, 0]])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['oldest-tranche-credit'], expected[N-1])
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)

prompt:
Paid credits are reused for each installment or allocated in reverse maturity order.

A toy award permits staged integer-credit installments. Due amounts are a schedule; paid credits are allocated to earlier due installments first. Delivery release depends on the contractual delivery tranche and disputed tranches remain held. No interest or real payment processing is modeled. Named decision oldest-tranche-credit: For oldest tranche credit, apply the stipulated decision [min(a,max(0,x["paid"]-sum(x["amounts"][:i]))) for i,a in enumerate(x["amounts"])].

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    v0 = sum(a for a,d in zip(x["amounts"],x["due"]) if d<=x["now"])
    v1 = [min(a,max(0,x["paid"]-sum(x["amounts"][:i]))) for i,a in enumerate(x["amounts"])]
    v2 = x["paid"]>=x["amounts"][x["delivery_index"]%len(x["amounts"])]
    v3 = sum(a for i,a in enumerate(x["amounts"]) if i in x["disputed"])
    v4 = sum(a for i,a in enumerate(x["amounts"]) if i not in x["waived"])
    v5 = min(x["refund"],max(0,x["paid"]-x["already_refunded"]))
    v6 = [] if x["cancelled"] else [d for d in x["due"] if d>x["now"]]
    v7 = [x["now"] if x["accelerated"] and d>x["now"] else d for d in x["due"]]
    v8 = x["paid"]+(0 if x["deposit_applied"] else x["deposit"])
    v9 = max(0,x["paid"]-sum(a for i,a in enumerate(x["amounts"]) if i not in x["waived"]))
    return {'due-installments':v0,'oldest-tranche-credit':v1,'delivery-tranche-threshold':v2,'disputed-tranche-hold':v3,'waived-tranche-obligation':v4,'refundable-paid-installments':v5,'cancel-future-collection':v6,'accelerated-maturity':v7,'deposit-credit-once':v8,'excess-installment-credit':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 9, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [False, False, False, False, False]), ('independent equal receipts', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 9, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r1', 'r2', 'r1'], 'receipt_amounts': [3, 3, 3], 'award_total': 20}, [False, False, False, False, False]), ('first delivery tranche', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 9, 'delivery_index': 0, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [True, True, True, True, True]), ('excess after waiver', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 18, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [True, True, True, True, True]), ('nothing paid', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 0, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [False, False, False, False, False]), ('fully paid', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 20, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [True, True, True, True, True]), ('first due', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 2, 'paid': 9, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [False, False, False, False, False]), ('before any due', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 1, 'paid': 9, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [False, False, False, False, False]), ('after all due', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 8, 'paid': 9, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [False, False, False, False, False]), ('no disputes', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 9, 'delivery_index': 1, 'disputed': [], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [False, False, False, False, False]), ('no waived tranches', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 9, 'delivery_index': 1, 'disputed': [1], 'waived': [], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [False, False, False, False, False])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['delivery-tranche-threshold'], expected[N-1])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    v0 = sum(a for a,d in zip(x["amounts"],x["due"]) if d<=x["now"])
    v1 = [min(a,max(0,x["paid"]-sum(x["amounts"][:i]))) for i,a in enumerate(x["amounts"])]
    v2 = x["paid"]>=sum(x["amounts"])
    v3 = sum(a for i,a in enumerate(x["amounts"]) if i in x["disputed"])
    v4 = sum(a for i,a in enumerate(x["amounts"]) if i not in x["waived"])
    v5 = min(x["refund"],max(0,x["paid"]-x["already_refunded"]))
    v6 = [] if x["cancelled"] else [d for d in x["due"] if d>x["now"]]
    v7 = [x["now"] if x["accelerated"] and d>x["now"] else d for d in x["due"]]
    v8 = x["paid"]+(0 if x["deposit_applied"] else x["deposit"])
    v9 = max(0,x["paid"]-sum(a for i,a in enumerate(x["amounts"]) if i not in x["waived"]))
    return {'due-installments':v0,'oldest-tranche-credit':v1,'delivery-tranche-threshold':v2,'disputed-tranche-hold':v3,'waived-tranche-obligation':v4,'refundable-paid-installments':v5,'cancel-future-collection':v6,'accelerated-maturity':v7,'deposit-credit-once':v8,'excess-installment-credit':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 9, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [False, False, False, False, False]), ('independent equal receipts', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 9, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r1', 'r2', 'r1'], 'receipt_amounts': [3, 3, 3], 'award_total': 20}, [False, False, False, False, False]), ('first delivery tranche', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 9, 'delivery_index': 0, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [True, True, True, True, True]), ('excess after waiver', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 18, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [True, True, True, True, True]), ('nothing paid', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 0, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [False, False, False, False, False]), ('fully paid', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 20, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [True, True, True, True, True]), ('first due', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 2, 'paid': 9, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [False, False, False, False, False]), ('before any due', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 1, 'paid': 9, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [False, False, False, False, False]), ('after all due', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 8, 'paid': 9, 'delivery_index': 1, 'disputed': [1], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [False, False, False, False, False]), ('no disputes', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 9, 'delivery_index': 1, 'disputed': [], 'waived': [0], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [False, False, False, False, False]), ('no waived tranches', {'amounts': [5, 7, 8], 'due': [2, 4, 6], 'now': 4, 'paid': 9, 'delivery_index': 1, 'disputed': [1], 'waived': [], 'refund': 3, 'already_refunded': 1, 'cancelled': False, 'accelerated': False, 'deposit': 4, 'deposit_applied': False, 'receipt_ids': ['r2', 'r1', 'r2'], 'receipt_amounts': [3, 2, 3], 'award_total': 20}, [False, False, False, False, False])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['delivery-tranche-threshold'], expected[N-1])
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)

prompt:
Delivery threshold ignores earlier required tranches or waits for every tranche.

A toy award permits staged integer-credit installments. Due amounts are a schedule; paid credits are allocated to earlier due installments first. Delivery release depends on the contractual delivery tranche and disputed tranches remain held. No interest or real payment processing is modeled. Named decision delivery-tranche-threshold: For delivery tranche threshold, apply the stipulated decision x["paid"]>=sum(x["amounts"][:x["delivery_index"]+1]).

split: open-access