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

N = 1
observations = []
def solve(x):
    v0 = x["buyer_accept"] and x["seller_accept"]
    v1 = x["buyer_version"]==x["seller_version"]==x["version"]
    v2 = x["held"] if x["rejected"] and not x["executed"] else 0
    v3 = max(0,x["held"]-x["fill"])
    v4 = x["buyer_signer"]==x["buyer"] and x["buyer_accept"]
    v5 = (x["seller_signer"]==x["seller"] or x["seller_signer"] in x["seller_delegates"]) and x["seller_accept"]
    v6 = 0 if x["match_id"]==x["last_match"] else x["fill"]
    v7 = x["reversed"] and x["executed"]
    v8 = x["held"] if x["timeout"] else 0
    v9 = [m for m in x["matched"] if m not in x["reported"]]
    return {'both-party-confirmation':v0,'same-proposal-version':v1,'rejection-release':v2,'partial-fill-reservation':v3,'buyer-confirmation-author':v4,'seller-delegate-authorization':v5,'execution-match-replay':v6,'reversal-execution-guard':v7,'timeout-release-guard':v8,'unreported-match-output':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('already executed / confirmation timeout', {'version': 2, 'buyer_version': 2, 'seller_version': 1, 'buyer_accept': True, 'seller_accept': True, 'rejected': False, 'executed': True, 'proposed': 5, 'held': 5, 'fill': 2, 'buyer': 'b', 'seller': 's', 'buyer_signer': 'b', 'seller_signer': 's', 'match_id': 'm2', 'last_match': 'm1', 'reversed': False, 'timeout': True, 'reported': ['m1'], 'matched': ['m1', 'm2'], 'seller_delegates': ['agent']}, [0, 0, 0, 0, 0]), ('normal contract', {'version': 2, 'buyer_version': 2, 'seller_version': 1, 'buyer_accept': True, 'seller_accept': True, 'rejected': False, 'executed': False, 'proposed': 5, 'held': 5, 'fill': 2, 'buyer': 'b', 'seller': 's', 'buyer_signer': 'b', 'seller_signer': 's', 'match_id': 'm2', 'last_match': 'm1', 'reversed': False, 'timeout': False, 'reported': ['m1'], 'matched': ['m1', 'm2'], 'seller_delegates': ['agent']}, [0, 0, 0, 0, 0]), ('both current', {'version': 2, 'buyer_version': 2, 'seller_version': 2, 'buyer_accept': True, 'seller_accept': True, 'rejected': False, 'executed': False, 'proposed': 5, 'held': 5, 'fill': 2, 'buyer': 'b', 'seller': 's', 'buyer_signer': 'b', 'seller_signer': 's', 'match_id': 'm2', 'last_match': 'm1', 'reversed': False, 'timeout': False, 'reported': ['m1'], 'matched': ['m1', 'm2'], 'seller_delegates': ['agent']}, [0, 0, 0, 0, 0]), ('buyer rejects', {'version': 2, 'buyer_version': 2, 'seller_version': 1, 'buyer_accept': False, 'seller_accept': True, 'rejected': False, 'executed': False, 'proposed': 5, 'held': 5, 'fill': 2, 'buyer': 'b', 'seller': 's', 'buyer_signer': 'b', 'seller_signer': 's', 'match_id': 'm2', 'last_match': 'm1', 'reversed': False, 'timeout': False, 'reported': ['m1'], 'matched': ['m1', 'm2'], 'seller_delegates': ['agent']}, [0, 0, 0, 0, 0]), ('seller rejects', {'version': 2, 'buyer_version': 2, 'seller_version': 1, 'buyer_accept': True, 'seller_accept': False, 'rejected': False, 'executed': False, 'proposed': 5, 'held': 5, 'fill': 2, 'buyer': 'b', 'seller': 's', 'buyer_signer': 'b', 'seller_signer': 's', 'match_id': 'm2', 'last_match': 'm1', 'reversed': False, 'timeout': False, 'reported': ['m1'], 'matched': ['m1', 'm2'], 'seller_delegates': ['agent']}, [0, 0, 0, 0, 0]), ('trade rejected', {'version': 2, 'buyer_version': 2, 'seller_version': 1, 'buyer_accept': True, 'seller_accept': True, 'rejected': True, 'executed': False, 'proposed': 5, 'held': 5, 'fill': 2, 'buyer': 'b', 'seller': 's', 'buyer_signer': 'b', 'seller_signer': 's', 'match_id': 'm2', 'last_match': 'm1', 'reversed': False, 'timeout': False, 'reported': ['m1'], 'matched': ['m1', 'm2'], 'seller_delegates': ['agent']}, [0, 0, 0, 0, 0]), ('already executed', {'version': 2, 'buyer_version': 2, 'seller_version': 1, 'buyer_accept': True, 'seller_accept': True, 'rejected': False, 'executed': True, 'proposed': 5, 'held': 5, 'fill': 2, 'buyer': 'b', 'seller': 's', 'buyer_signer': 'b', 'seller_signer': 's', 'match_id': 'm2', 'last_match': 'm1', 'reversed': False, 'timeout': False, 'reported': ['m1'], 'matched': ['m1', 'm2'], 'seller_delegates': ['agent']}, [0, 0, 0, 0, 0]), ('wrong buyer signer', {'version': 2, 'buyer_version': 2, 'seller_version': 1, 'buyer_accept': True, 'seller_accept': True, 'rejected': False, 'executed': False, 'proposed': 5, 'held': 5, 'fill': 2, 'buyer': 'b', 'seller': 's', 'buyer_signer': 's', 'seller_signer': 's', 'match_id': 'm2', 'last_match': 'm1', 'reversed': False, 'timeout': False, 'reported': ['m1'], 'matched': ['m1', 'm2'], 'seller_delegates': ['agent']}, [0, 0, 0, 0, 0]), ('wrong seller signer', {'version': 2, 'buyer_version': 2, 'seller_version': 1, 'buyer_accept': True, 'seller_accept': True, 'rejected': False, 'executed': False, 'proposed': 5, 'held': 5, 'fill': 2, 'buyer': 'b', 'seller': 's', 'buyer_signer': 'b', 'seller_signer': 'b', 'match_id': 'm2', 'last_match': 'm1', 'reversed': False, 'timeout': False, 'reported': ['m1'], 'matched': ['m1', 'm2'], 'seller_delegates': ['agent']}, [0, 0, 0, 0, 0]), ('match replay', {'version': 2, 'buyer_version': 2, 'seller_version': 1, 'buyer_accept': True, 'seller_accept': True, 'rejected': False, 'executed': False, 'proposed': 5, 'held': 5, 'fill': 2, 'buyer': 'b', 'seller': 's', 'buyer_signer': 'b', 'seller_signer': 's', 'match_id': 'm1', 'last_match': 'm1', 'reversed': False, 'timeout': False, 'reported': ['m1'], 'matched': ['m1', 'm2'], 'seller_delegates': ['agent']}, [0, 0, 0, 0, 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))['timeout-release-guard'], 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 = x["buyer_accept"] and x["seller_accept"]
    v1 = x["buyer_version"]==x["seller_version"]==x["version"]
    v2 = x["held"] if x["rejected"] and not x["executed"] else 0
    v3 = max(0,x["held"]-x["fill"])
    v4 = x["buyer_signer"]==x["buyer"] and x["buyer_accept"]
    v5 = (x["seller_signer"]==x["seller"] or x["seller_signer"] in x["seller_delegates"]) and x["seller_accept"]
    v6 = 0 if x["match_id"]==x["last_match"] else x["fill"]
    v7 = x["reversed"] and x["executed"]
    v8 = x["held"] if not x["executed"] else 0
    v9 = [m for m in x["matched"] if m not in x["reported"]]
    return {'both-party-confirmation':v0,'same-proposal-version':v1,'rejection-release':v2,'partial-fill-reservation':v3,'buyer-confirmation-author':v4,'seller-delegate-authorization':v5,'execution-match-replay':v6,'reversal-execution-guard':v7,'timeout-release-guard':v8,'unreported-match-output':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('already executed / confirmation timeout', {'version': 2, 'buyer_version': 2, 'seller_version': 1, 'buyer_accept': True, 'seller_accept': True, 'rejected': False, 'executed': True, 'proposed': 5, 'held': 5, 'fill': 2, 'buyer': 'b', 'seller': 's', 'buyer_signer': 'b', 'seller_signer': 's', 'match_id': 'm2', 'last_match': 'm1', 'reversed': False, 'timeout': True, 'reported': ['m1'], 'matched': ['m1', 'm2'], 'seller_delegates': ['agent']}, [0, 0, 0, 0, 0]), ('normal contract', {'version': 2, 'buyer_version': 2, 'seller_version': 1, 'buyer_accept': True, 'seller_accept': True, 'rejected': False, 'executed': False, 'proposed': 5, 'held': 5, 'fill': 2, 'buyer': 'b', 'seller': 's', 'buyer_signer': 'b', 'seller_signer': 's', 'match_id': 'm2', 'last_match': 'm1', 'reversed': False, 'timeout': False, 'reported': ['m1'], 'matched': ['m1', 'm2'], 'seller_delegates': ['agent']}, [0, 0, 0, 0, 0]), ('both current', {'version': 2, 'buyer_version': 2, 'seller_version': 2, 'buyer_accept': True, 'seller_accept': True, 'rejected': False, 'executed': False, 'proposed': 5, 'held': 5, 'fill': 2, 'buyer': 'b', 'seller': 's', 'buyer_signer': 'b', 'seller_signer': 's', 'match_id': 'm2', 'last_match': 'm1', 'reversed': False, 'timeout': False, 'reported': ['m1'], 'matched': ['m1', 'm2'], 'seller_delegates': ['agent']}, [0, 0, 0, 0, 0]), ('buyer rejects', {'version': 2, 'buyer_version': 2, 'seller_version': 1, 'buyer_accept': False, 'seller_accept': True, 'rejected': False, 'executed': False, 'proposed': 5, 'held': 5, 'fill': 2, 'buyer': 'b', 'seller': 's', 'buyer_signer': 'b', 'seller_signer': 's', 'match_id': 'm2', 'last_match': 'm1', 'reversed': False, 'timeout': False, 'reported': ['m1'], 'matched': ['m1', 'm2'], 'seller_delegates': ['agent']}, [0, 0, 0, 0, 0]), ('seller rejects', {'version': 2, 'buyer_version': 2, 'seller_version': 1, 'buyer_accept': True, 'seller_accept': False, 'rejected': False, 'executed': False, 'proposed': 5, 'held': 5, 'fill': 2, 'buyer': 'b', 'seller': 's', 'buyer_signer': 'b', 'seller_signer': 's', 'match_id': 'm2', 'last_match': 'm1', 'reversed': False, 'timeout': False, 'reported': ['m1'], 'matched': ['m1', 'm2'], 'seller_delegates': ['agent']}, [0, 0, 0, 0, 0]), ('trade rejected', {'version': 2, 'buyer_version': 2, 'seller_version': 1, 'buyer_accept': True, 'seller_accept': True, 'rejected': True, 'executed': False, 'proposed': 5, 'held': 5, 'fill': 2, 'buyer': 'b', 'seller': 's', 'buyer_signer': 'b', 'seller_signer': 's', 'match_id': 'm2', 'last_match': 'm1', 'reversed': False, 'timeout': False, 'reported': ['m1'], 'matched': ['m1', 'm2'], 'seller_delegates': ['agent']}, [0, 0, 0, 0, 0]), ('already executed', {'version': 2, 'buyer_version': 2, 'seller_version': 1, 'buyer_accept': True, 'seller_accept': True, 'rejected': False, 'executed': True, 'proposed': 5, 'held': 5, 'fill': 2, 'buyer': 'b', 'seller': 's', 'buyer_signer': 'b', 'seller_signer': 's', 'match_id': 'm2', 'last_match': 'm1', 'reversed': False, 'timeout': False, 'reported': ['m1'], 'matched': ['m1', 'm2'], 'seller_delegates': ['agent']}, [0, 0, 0, 0, 0]), ('wrong buyer signer', {'version': 2, 'buyer_version': 2, 'seller_version': 1, 'buyer_accept': True, 'seller_accept': True, 'rejected': False, 'executed': False, 'proposed': 5, 'held': 5, 'fill': 2, 'buyer': 'b', 'seller': 's', 'buyer_signer': 's', 'seller_signer': 's', 'match_id': 'm2', 'last_match': 'm1', 'reversed': False, 'timeout': False, 'reported': ['m1'], 'matched': ['m1', 'm2'], 'seller_delegates': ['agent']}, [0, 0, 0, 0, 0]), ('wrong seller signer', {'version': 2, 'buyer_version': 2, 'seller_version': 1, 'buyer_accept': True, 'seller_accept': True, 'rejected': False, 'executed': False, 'proposed': 5, 'held': 5, 'fill': 2, 'buyer': 'b', 'seller': 's', 'buyer_signer': 'b', 'seller_signer': 'b', 'match_id': 'm2', 'last_match': 'm1', 'reversed': False, 'timeout': False, 'reported': ['m1'], 'matched': ['m1', 'm2'], 'seller_delegates': ['agent']}, [0, 0, 0, 0, 0]), ('match replay', {'version': 2, 'buyer_version': 2, 'seller_version': 1, 'buyer_accept': True, 'seller_accept': True, 'rejected': False, 'executed': False, 'proposed': 5, 'held': 5, 'fill': 2, 'buyer': 'b', 'seller': 's', 'buyer_signer': 'b', 'seller_signer': 's', 'match_id': 'm1', 'last_match': 'm1', 'reversed': False, 'timeout': False, 'reported': ['m1'], 'matched': ['m1', 'm2'], 'seller_delegates': ['agent']}, [0, 0, 0, 0, 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))['timeout-release-guard'], 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:
Confirmation timeout releases a completed trade reservation.

After an auction allocation, buyer and seller confirmations reserve a specific trade version. A trade is final only when both parties confirm the same proposed version; rejection releases reservations but does not erase executed trades. Match identity differs from party identity. Named decision timeout-release-guard: For timeout release guard, apply the stipulated decision x["held"] if x["timeout"] and not x["executed"] else 0.

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = x["buyer_accept"] and x["seller_accept"]
    v1 = x["buyer_version"]==x["seller_version"]==x["version"]
    v2 = x["held"] if x["rejected"] and not x["executed"] else 0
    v3 = max(0,x["held"]-x["fill"])
    v4 = x["buyer_signer"]==x["buyer"] and x["buyer_accept"]
    v5 = (x["seller_signer"]==x["seller"] or x["seller_signer"] in x["seller_delegates"]) and x["seller_accept"]
    v6 = 0 if x["match_id"]==x["last_match"] else x["fill"]
    v7 = x["reversed"] and x["executed"]
    v8 = x["held"] if x["timeout"] and not x["executed"] else 0
    v9 = x["matched"]
    return {'both-party-confirmation':v0,'same-proposal-version':v1,'rejection-release':v2,'partial-fill-reservation':v3,'buyer-confirmation-author':v4,'seller-delegate-authorization':v5,'execution-match-replay':v6,'reversal-execution-guard':v7,'timeout-release-guard':v8,'unreported-match-output':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'version': 2, 'buyer_version': 2, 'seller_version': 1, 'buyer_accept': True, 'seller_accept': True, 'rejected': False, 'executed': False, 'proposed': 5, 'held': 5, 'fill': 2, 'buyer': 'b', 'seller': 's', 'buyer_signer': 'b', 'seller_signer': 's', 'match_id': 'm2', 'last_match': 'm1', 'reversed': False, 'timeout': False, 'reported': ['m1'], 'matched': ['m1', 'm2'], 'seller_delegates': ['agent']}, [['m2'], ['m2'], ['m2'], ['m2'], ['m2']]), ('both current', {'version': 2, 'buyer_version': 2, 'seller_version': 2, 'buyer_accept': True, 'seller_accept': True, 'rejected': False, 'executed': False, 'proposed': 5, 'held': 5, 'fill': 2, 'buyer': 'b', 'seller': 's', 'buyer_signer': 'b', 'seller_signer': 's', 'match_id': 'm2', 'last_match': 'm1', 'reversed': False, 'timeout': False, 'reported': ['m1'], 'matched': ['m1', 'm2'], 'seller_delegates': ['agent']}, [['m2'], ['m2'], ['m2'], ['m2'], ['m2']]), ('buyer rejects', {'version': 2, 'buyer_version': 2, 'seller_version': 1, 'buyer_accept': False, 'seller_accept': True, 'rejected': False, 'executed': False, 'proposed': 5, 'held': 5, 'fill': 2, 'buyer': 'b', 'seller': 's', 'buyer_signer': 'b', 'seller_signer': 's', 'match_id': 'm2', 'last_match': 'm1', 'reversed': False, 'timeout': False, 'reported': ['m1'], 'matched': ['m1', 'm2'], 'seller_delegates': ['agent']}, [['m2'], ['m2'], ['m2'], ['m2'], ['m2']]), ('seller rejects', {'version': 2, 'buyer_version': 2, 'seller_version': 1, 'buyer_accept': True, 'seller_accept': False, 'rejected': False, 'executed': False, 'proposed': 5, 'held': 5, 'fill': 2, 'buyer': 'b', 'seller': 's', 'buyer_signer': 'b', 'seller_signer': 's', 'match_id': 'm2', 'last_match': 'm1', 'reversed': False, 'timeout': False, 'reported': ['m1'], 'matched': ['m1', 'm2'], 'seller_delegates': ['agent']}, [['m2'], ['m2'], ['m2'], ['m2'], ['m2']]), ('trade rejected', {'version': 2, 'buyer_version': 2, 'seller_version': 1, 'buyer_accept': True, 'seller_accept': True, 'rejected': True, 'executed': False, 'proposed': 5, 'held': 5, 'fill': 2, 'buyer': 'b', 'seller': 's', 'buyer_signer': 'b', 'seller_signer': 's', 'match_id': 'm2', 'last_match': 'm1', 'reversed': False, 'timeout': False, 'reported': ['m1'], 'matched': ['m1', 'm2'], 'seller_delegates': ['agent']}, [['m2'], ['m2'], ['m2'], ['m2'], ['m2']]), ('already executed', {'version': 2, 'buyer_version': 2, 'seller_version': 1, 'buyer_accept': True, 'seller_accept': True, 'rejected': False, 'executed': True, 'proposed': 5, 'held': 5, 'fill': 2, 'buyer': 'b', 'seller': 's', 'buyer_signer': 'b', 'seller_signer': 's', 'match_id': 'm2', 'last_match': 'm1', 'reversed': False, 'timeout': False, 'reported': ['m1'], 'matched': ['m1', 'm2'], 'seller_delegates': ['agent']}, [['m2'], ['m2'], ['m2'], ['m2'], ['m2']]), ('wrong buyer signer', {'version': 2, 'buyer_version': 2, 'seller_version': 1, 'buyer_accept': True, 'seller_accept': True, 'rejected': False, 'executed': False, 'proposed': 5, 'held': 5, 'fill': 2, 'buyer': 'b', 'seller': 's', 'buyer_signer': 's', 'seller_signer': 's', 'match_id': 'm2', 'last_match': 'm1', 'reversed': False, 'timeout': False, 'reported': ['m1'], 'matched': ['m1', 'm2'], 'seller_delegates': ['agent']}, [['m2'], ['m2'], ['m2'], ['m2'], ['m2']]), ('wrong seller signer', {'version': 2, 'buyer_version': 2, 'seller_version': 1, 'buyer_accept': True, 'seller_accept': True, 'rejected': False, 'executed': False, 'proposed': 5, 'held': 5, 'fill': 2, 'buyer': 'b', 'seller': 's', 'buyer_signer': 'b', 'seller_signer': 'b', 'match_id': 'm2', 'last_match': 'm1', 'reversed': False, 'timeout': False, 'reported': ['m1'], 'matched': ['m1', 'm2'], 'seller_delegates': ['agent']}, [['m2'], ['m2'], ['m2'], ['m2'], ['m2']]), ('match replay', {'version': 2, 'buyer_version': 2, 'seller_version': 1, 'buyer_accept': True, 'seller_accept': True, 'rejected': False, 'executed': False, 'proposed': 5, 'held': 5, 'fill': 2, 'buyer': 'b', 'seller': 's', 'buyer_signer': 'b', 'seller_signer': 's', 'match_id': 'm1', 'last_match': 'm1', 'reversed': False, 'timeout': False, 'reported': ['m1'], 'matched': ['m1', 'm2'], 'seller_delegates': ['agent']}, [['m2'], ['m2'], ['m2'], ['m2'], ['m2']])]
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))['unreported-match-output'], 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 = x["buyer_accept"] and x["seller_accept"]
    v1 = x["buyer_version"]==x["seller_version"]==x["version"]
    v2 = x["held"] if x["rejected"] and not x["executed"] else 0
    v3 = max(0,x["held"]-x["fill"])
    v4 = x["buyer_signer"]==x["buyer"] and x["buyer_accept"]
    v5 = (x["seller_signer"]==x["seller"] or x["seller_signer"] in x["seller_delegates"]) and x["seller_accept"]
    v6 = 0 if x["match_id"]==x["last_match"] else x["fill"]
    v7 = x["reversed"] and x["executed"]
    v8 = x["held"] if x["timeout"] and not x["executed"] else 0
    v9 = [m for m in x["matched"] if m in x["reported"]]
    return {'both-party-confirmation':v0,'same-proposal-version':v1,'rejection-release':v2,'partial-fill-reservation':v3,'buyer-confirmation-author':v4,'seller-delegate-authorization':v5,'execution-match-replay':v6,'reversal-execution-guard':v7,'timeout-release-guard':v8,'unreported-match-output':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'version': 2, 'buyer_version': 2, 'seller_version': 1, 'buyer_accept': True, 'seller_accept': True, 'rejected': False, 'executed': False, 'proposed': 5, 'held': 5, 'fill': 2, 'buyer': 'b', 'seller': 's', 'buyer_signer': 'b', 'seller_signer': 's', 'match_id': 'm2', 'last_match': 'm1', 'reversed': False, 'timeout': False, 'reported': ['m1'], 'matched': ['m1', 'm2'], 'seller_delegates': ['agent']}, [['m2'], ['m2'], ['m2'], ['m2'], ['m2']]), ('both current', {'version': 2, 'buyer_version': 2, 'seller_version': 2, 'buyer_accept': True, 'seller_accept': True, 'rejected': False, 'executed': False, 'proposed': 5, 'held': 5, 'fill': 2, 'buyer': 'b', 'seller': 's', 'buyer_signer': 'b', 'seller_signer': 's', 'match_id': 'm2', 'last_match': 'm1', 'reversed': False, 'timeout': False, 'reported': ['m1'], 'matched': ['m1', 'm2'], 'seller_delegates': ['agent']}, [['m2'], ['m2'], ['m2'], ['m2'], ['m2']]), ('buyer rejects', {'version': 2, 'buyer_version': 2, 'seller_version': 1, 'buyer_accept': False, 'seller_accept': True, 'rejected': False, 'executed': False, 'proposed': 5, 'held': 5, 'fill': 2, 'buyer': 'b', 'seller': 's', 'buyer_signer': 'b', 'seller_signer': 's', 'match_id': 'm2', 'last_match': 'm1', 'reversed': False, 'timeout': False, 'reported': ['m1'], 'matched': ['m1', 'm2'], 'seller_delegates': ['agent']}, [['m2'], ['m2'], ['m2'], ['m2'], ['m2']]), ('seller rejects', {'version': 2, 'buyer_version': 2, 'seller_version': 1, 'buyer_accept': True, 'seller_accept': False, 'rejected': False, 'executed': False, 'proposed': 5, 'held': 5, 'fill': 2, 'buyer': 'b', 'seller': 's', 'buyer_signer': 'b', 'seller_signer': 's', 'match_id': 'm2', 'last_match': 'm1', 'reversed': False, 'timeout': False, 'reported': ['m1'], 'matched': ['m1', 'm2'], 'seller_delegates': ['agent']}, [['m2'], ['m2'], ['m2'], ['m2'], ['m2']]), ('trade rejected', {'version': 2, 'buyer_version': 2, 'seller_version': 1, 'buyer_accept': True, 'seller_accept': True, 'rejected': True, 'executed': False, 'proposed': 5, 'held': 5, 'fill': 2, 'buyer': 'b', 'seller': 's', 'buyer_signer': 'b', 'seller_signer': 's', 'match_id': 'm2', 'last_match': 'm1', 'reversed': False, 'timeout': False, 'reported': ['m1'], 'matched': ['m1', 'm2'], 'seller_delegates': ['agent']}, [['m2'], ['m2'], ['m2'], ['m2'], ['m2']]), ('already executed', {'version': 2, 'buyer_version': 2, 'seller_version': 1, 'buyer_accept': True, 'seller_accept': True, 'rejected': False, 'executed': True, 'proposed': 5, 'held': 5, 'fill': 2, 'buyer': 'b', 'seller': 's', 'buyer_signer': 'b', 'seller_signer': 's', 'match_id': 'm2', 'last_match': 'm1', 'reversed': False, 'timeout': False, 'reported': ['m1'], 'matched': ['m1', 'm2'], 'seller_delegates': ['agent']}, [['m2'], ['m2'], ['m2'], ['m2'], ['m2']]), ('wrong buyer signer', {'version': 2, 'buyer_version': 2, 'seller_version': 1, 'buyer_accept': True, 'seller_accept': True, 'rejected': False, 'executed': False, 'proposed': 5, 'held': 5, 'fill': 2, 'buyer': 'b', 'seller': 's', 'buyer_signer': 's', 'seller_signer': 's', 'match_id': 'm2', 'last_match': 'm1', 'reversed': False, 'timeout': False, 'reported': ['m1'], 'matched': ['m1', 'm2'], 'seller_delegates': ['agent']}, [['m2'], ['m2'], ['m2'], ['m2'], ['m2']]), ('wrong seller signer', {'version': 2, 'buyer_version': 2, 'seller_version': 1, 'buyer_accept': True, 'seller_accept': True, 'rejected': False, 'executed': False, 'proposed': 5, 'held': 5, 'fill': 2, 'buyer': 'b', 'seller': 's', 'buyer_signer': 'b', 'seller_signer': 'b', 'match_id': 'm2', 'last_match': 'm1', 'reversed': False, 'timeout': False, 'reported': ['m1'], 'matched': ['m1', 'm2'], 'seller_delegates': ['agent']}, [['m2'], ['m2'], ['m2'], ['m2'], ['m2']]), ('match replay', {'version': 2, 'buyer_version': 2, 'seller_version': 1, 'buyer_accept': True, 'seller_accept': True, 'rejected': False, 'executed': False, 'proposed': 5, 'held': 5, 'fill': 2, 'buyer': 'b', 'seller': 's', 'buyer_signer': 'b', 'seller_signer': 's', 'match_id': 'm1', 'last_match': 'm1', 'reversed': False, 'timeout': False, 'reported': ['m1'], 'matched': ['m1', 'm2'], 'seller_delegates': ['agent']}, [['m2'], ['m2'], ['m2'], ['m2'], ['m2']])]
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))['unreported-match-output'], 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:
Trade report emission repeats acknowledged matches instead of pending matches.

After an auction allocation, buyer and seller confirmations reserve a specific trade version. A trade is final only when both parties confirm the same proposed version; rejection releases reservations but does not erase executed trades. Match identity differs from party identity. Named decision unreported-match-output: For unreported match output, apply the stipulated decision [m for m in x["matched"] if m not in x["reported"]].

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = [t for t in x["tickets"] if t in x["roster"]]
    v1 = [t for t in x["tickets"] if t in x["roster"]]
    v2 = [t for t in dict.fromkeys(x["tickets"]) if t in x["roster"] and t not in x["disqualified"]]
    v3 = x["roster"][x["draw"]] if 0<=x["draw"]<len(x["roster"]) else None
    v4 = next((t for t in x["committed"] if t not in x["declined"]),None)
    v5 = max(0,x["supply"]-len(set(x["winners"])))
    v6 = list(dict.fromkeys(t for t in x["tickets"] if t in x["roster"]))==x["committed"]
    v7 = x["committed"][:x["supply"]] if x["published"] else []
    v8 = x["round"]==x["ballot_round"]
    v9 = [x["substitutes"].get(w,w) if x["substitutes"].get(w,w) in x["consented"] else w for w in x["winners"]]
    return {'one-ticket-per-bidder':v0,'roster-ticket-admission':v1,'disqualification-before-draw':v2,'draw-index-contract':v3,'declined-ticket-rotation':v4,'ballot-supply-remainder':v5,'ticket-order-commitment':v6,'publication-before-award':v7,'round-specific-ballot':v8,'winner-substitute-consent':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c']]), ('future ballot', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 3, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c']]), ('no declines', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': [], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c']]), ('draw first', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 0, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c']]), ('draw beyond roster', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 7, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c']]), ('all disqualified', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['a', 'b', 'c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c']]), ('all tickets valid', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c']]), ('unpublished draw', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': False, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c']]), ('same round', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 2, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c']])]
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))['one-ticket-per-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 = sorted(set(x["tickets"])&set(x["roster"]))
    v1 = [t for t in x["tickets"] if t in x["roster"]]
    v2 = [t for t in dict.fromkeys(x["tickets"]) if t in x["roster"] and t not in x["disqualified"]]
    v3 = x["roster"][x["draw"]] if 0<=x["draw"]<len(x["roster"]) else None
    v4 = next((t for t in x["committed"] if t not in x["declined"]),None)
    v5 = max(0,x["supply"]-len(set(x["winners"])))
    v6 = list(dict.fromkeys(t for t in x["tickets"] if t in x["roster"]))==x["committed"]
    v7 = x["committed"][:x["supply"]] if x["published"] else []
    v8 = x["round"]==x["ballot_round"]
    v9 = [x["substitutes"].get(w,w) if x["substitutes"].get(w,w) in x["consented"] else w for w in x["winners"]]
    return {'one-ticket-per-bidder':v0,'roster-ticket-admission':v1,'disqualification-before-draw':v2,'draw-index-contract':v3,'declined-ticket-rotation':v4,'ballot-supply-remainder':v5,'ticket-order-commitment':v6,'publication-before-award':v7,'round-specific-ballot':v8,'winner-substitute-consent':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c']]), ('future ballot', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 3, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c']]), ('no declines', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': [], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c']]), ('draw first', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 0, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c']]), ('draw beyond roster', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 7, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c']]), ('all disqualified', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['a', 'b', 'c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c']]), ('all tickets valid', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c']]), ('unpublished draw', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': False, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c']]), ('same round', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 2, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c']])]
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))['one-ticket-per-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:
Duplicate ballot tickets increase one tied bidder draw weight.

A toy tied-award ballot has a frozen eligible bidder roster, published ticket order, one ticket per eligible bidder, and an explicitly supplied draw index. It is deterministic: no randomness claim. Declined winners rotate to the next eligible ticket without returning the declined bidder to the draw. Named decision one-ticket-per-bidder: For one ticket per bidder, apply the stipulated decision list(dict.fromkeys(t for t in x["tickets"] if t in x["roster"])).

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = list(dict.fromkeys(t for t in x["tickets"] if t in x["roster"]))
    v1 = x["tickets"]
    v2 = [t for t in dict.fromkeys(x["tickets"]) if t in x["roster"] and t not in x["disqualified"]]
    v3 = x["roster"][x["draw"]] if 0<=x["draw"]<len(x["roster"]) else None
    v4 = next((t for t in x["committed"] if t not in x["declined"]),None)
    v5 = max(0,x["supply"]-len(set(x["winners"])))
    v6 = list(dict.fromkeys(t for t in x["tickets"] if t in x["roster"]))==x["committed"]
    v7 = x["committed"][:x["supply"]] if x["published"] else []
    v8 = x["round"]==x["ballot_round"]
    v9 = [x["substitutes"].get(w,w) if x["substitutes"].get(w,w) in x["consented"] else w for w in x["winners"]]
    return {'one-ticket-per-bidder':v0,'roster-ticket-admission':v1,'disqualification-before-draw':v2,'draw-index-contract':v3,'declined-ticket-rotation':v4,'ballot-supply-remainder':v5,'ticket-order-commitment':v6,'publication-before-award':v7,'round-specific-ballot':v8,'winner-substitute-consent':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c']]), ('future ballot', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 3, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c']]), ('no declines', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': [], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c']]), ('draw first', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 0, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c']]), ('draw beyond roster', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 7, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c']]), ('all disqualified', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['a', 'b', 'c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c']]), ('all tickets valid', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c']]), ('unpublished draw', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': False, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c']]), ('same round', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 2, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c']])]
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))['roster-ticket-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 = list(dict.fromkeys(t for t in x["tickets"] if t in x["roster"]))
    v1 = [t for t in x["tickets"] if t not in x["disqualified"]]
    v2 = [t for t in dict.fromkeys(x["tickets"]) if t in x["roster"] and t not in x["disqualified"]]
    v3 = x["roster"][x["draw"]] if 0<=x["draw"]<len(x["roster"]) else None
    v4 = next((t for t in x["committed"] if t not in x["declined"]),None)
    v5 = max(0,x["supply"]-len(set(x["winners"])))
    v6 = list(dict.fromkeys(t for t in x["tickets"] if t in x["roster"]))==x["committed"]
    v7 = x["committed"][:x["supply"]] if x["published"] else []
    v8 = x["round"]==x["ballot_round"]
    v9 = [x["substitutes"].get(w,w) if x["substitutes"].get(w,w) in x["consented"] else w for w in x["winners"]]
    return {'one-ticket-per-bidder':v0,'roster-ticket-admission':v1,'disqualification-before-draw':v2,'draw-index-contract':v3,'declined-ticket-rotation':v4,'ballot-supply-remainder':v5,'ticket-order-commitment':v6,'publication-before-award':v7,'round-specific-ballot':v8,'winner-substitute-consent':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c']]), ('future ballot', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 3, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c']]), ('no declines', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': [], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c']]), ('draw first', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 0, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c']]), ('draw beyond roster', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 7, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c']]), ('all disqualified', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['a', 'b', 'c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c']]), ('all tickets valid', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c'], ['b', 'a', 'c']]), ('unpublished draw', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': False, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c']]), ('same round', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 2, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c'], ['b', 'a', 'b', 'c']])]
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))['roster-ticket-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:
An outsider obtains a tie-break ticket.

A toy tied-award ballot has a frozen eligible bidder roster, published ticket order, one ticket per eligible bidder, and an explicitly supplied draw index. It is deterministic: no randomness claim. Declined winners rotate to the next eligible ticket without returning the declined bidder to the draw. Named decision roster-ticket-admission: For roster ticket admission, apply the stipulated decision [t for t in x["tickets"] if t in x["roster"]].

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = list(dict.fromkeys(t for t in x["tickets"] if t in x["roster"]))
    v1 = [t for t in x["tickets"] if t in x["roster"]]
    v2 = list(dict.fromkeys(t for t in x["tickets"] if t in x["roster"]))
    v3 = x["roster"][x["draw"]] if 0<=x["draw"]<len(x["roster"]) else None
    v4 = next((t for t in x["committed"] if t not in x["declined"]),None)
    v5 = max(0,x["supply"]-len(set(x["winners"])))
    v6 = list(dict.fromkeys(t for t in x["tickets"] if t in x["roster"]))==x["committed"]
    v7 = x["committed"][:x["supply"]] if x["published"] else []
    v8 = x["round"]==x["ballot_round"]
    v9 = [x["substitutes"].get(w,w) if x["substitutes"].get(w,w) in x["consented"] else w for w in x["winners"]]
    return {'one-ticket-per-bidder':v0,'roster-ticket-admission':v1,'disqualification-before-draw':v2,'draw-index-contract':v3,'declined-ticket-rotation':v4,'ballot-supply-remainder':v5,'ticket-order-commitment':v6,'publication-before-award':v7,'round-specific-ballot':v8,'winner-substitute-consent':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a'], ['b', 'a'], ['b', 'a'], ['b', 'a'], ['b', 'a']]), ('future ballot', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 3, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a'], ['b', 'a'], ['b', 'a'], ['b', 'a'], ['b', 'a']]), ('no declines', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': [], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a'], ['b', 'a'], ['b', 'a'], ['b', 'a'], ['b', 'a']]), ('draw first', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 0, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a'], ['b', 'a'], ['b', 'a'], ['b', 'a'], ['b', 'a']]), ('draw beyond roster', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 7, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a'], ['b', 'a'], ['b', 'a'], ['b', 'a'], ['b', 'a']]), ('all disqualified', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['a', 'b', 'c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [[], [], [], [], []]), ('all tickets valid', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a'], ['b', 'a'], ['b', 'a'], ['b', 'a'], ['b', 'a']]), ('unpublished draw', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': False, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a'], ['b', 'a'], ['b', 'a'], ['b', 'a'], ['b', 'a']]), ('same round', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 2, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a'], ['b', 'a'], ['b', 'a'], ['b', 'a'], ['b', 'a']])]
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))['disqualification-before-draw'], 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 = list(dict.fromkeys(t for t in x["tickets"] if t in x["roster"]))
    v1 = [t for t in x["tickets"] if t in x["roster"]]
    v2 = [t for t in dict.fromkeys(x["tickets"]) if t not in x["disqualified"]]
    v3 = x["roster"][x["draw"]] if 0<=x["draw"]<len(x["roster"]) else None
    v4 = next((t for t in x["committed"] if t not in x["declined"]),None)
    v5 = max(0,x["supply"]-len(set(x["winners"])))
    v6 = list(dict.fromkeys(t for t in x["tickets"] if t in x["roster"]))==x["committed"]
    v7 = x["committed"][:x["supply"]] if x["published"] else []
    v8 = x["round"]==x["ballot_round"]
    v9 = [x["substitutes"].get(w,w) if x["substitutes"].get(w,w) in x["consented"] else w for w in x["winners"]]
    return {'one-ticket-per-bidder':v0,'roster-ticket-admission':v1,'disqualification-before-draw':v2,'draw-index-contract':v3,'declined-ticket-rotation':v4,'ballot-supply-remainder':v5,'ticket-order-commitment':v6,'publication-before-award':v7,'round-specific-ballot':v8,'winner-substitute-consent':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a'], ['b', 'a'], ['b', 'a'], ['b', 'a'], ['b', 'a']]), ('future ballot', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 3, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a'], ['b', 'a'], ['b', 'a'], ['b', 'a'], ['b', 'a']]), ('no declines', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': [], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a'], ['b', 'a'], ['b', 'a'], ['b', 'a'], ['b', 'a']]), ('draw first', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 0, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a'], ['b', 'a'], ['b', 'a'], ['b', 'a'], ['b', 'a']]), ('draw beyond roster', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 7, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a'], ['b', 'a'], ['b', 'a'], ['b', 'a'], ['b', 'a']]), ('all disqualified', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['a', 'b', 'c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [[], [], [], [], []]), ('all tickets valid', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a'], ['b', 'a'], ['b', 'a'], ['b', 'a'], ['b', 'a']]), ('unpublished draw', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': False, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a'], ['b', 'a'], ['b', 'a'], ['b', 'a'], ['b', 'a']]), ('same round', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 2, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [['b', 'a'], ['b', 'a'], ['b', 'a'], ['b', 'a'], ['b', 'a']])]
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))['disqualification-before-draw'], 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:
Disqualified or outside tickets remain in the frozen draw pool.

A toy tied-award ballot has a frozen eligible bidder roster, published ticket order, one ticket per eligible bidder, and an explicitly supplied draw index. It is deterministic: no randomness claim. Declined winners rotate to the next eligible ticket without returning the declined bidder to the draw. Named decision disqualification-before-draw: For disqualification before draw, apply the stipulated decision [t for t in dict.fromkeys(x["tickets"]) if t in x["roster"] and t not in x["disqualified"]].

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = list(dict.fromkeys(t for t in x["tickets"] if t in x["roster"]))
    v1 = [t for t in x["tickets"] if t in x["roster"]]
    v2 = [t for t in dict.fromkeys(x["tickets"]) if t in x["roster"] and t not in x["disqualified"]]
    v3 = x["roster"][x["draw"]%len(x["roster"])] if x["roster"] else None
    v4 = next((t for t in x["committed"] if t not in x["declined"]),None)
    v5 = max(0,x["supply"]-len(set(x["winners"])))
    v6 = list(dict.fromkeys(t for t in x["tickets"] if t in x["roster"]))==x["committed"]
    v7 = x["committed"][:x["supply"]] if x["published"] else []
    v8 = x["round"]==x["ballot_round"]
    v9 = [x["substitutes"].get(w,w) if x["substitutes"].get(w,w) in x["consented"] else w for w in x["winners"]]
    return {'one-ticket-per-bidder':v0,'roster-ticket-admission':v1,'disqualification-before-draw':v2,'draw-index-contract':v3,'declined-ticket-rotation':v4,'ballot-supply-remainder':v5,'ticket-order-commitment':v6,'publication-before-award':v7,'round-specific-ballot':v8,'winner-substitute-consent':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('draw beyond roster', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 7, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [None, None, None, None, None]), ('future ballot / draw beyond roster', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 7, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 3, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [None, None, None, None, None]), ('normal contract', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, ['b', 'c', None, None, None]), ('future ballot', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 3, 'substitutes': {'a': 'z'}, 'consented': ['z']}, ['b', 'c', None, None, None]), ('no declines', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': [], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, ['b', 'c', None, None, None]), ('draw first', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 0, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, ['a', 'a', 'a', 'a', 'a']), ('all disqualified', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['a', 'b', 'c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, ['b', 'c', None, None, None]), ('all tickets valid', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, ['b', 'c', None, None, None]), ('unpublished draw', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': False, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, ['b', 'c', None, None, None]), ('same round', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 2, 'substitutes': {'a': 'z'}, 'consented': ['z']}, ['b', 'c', None, None, None])]
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))['draw-index-contract'], 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 = list(dict.fromkeys(t for t in x["tickets"] if t in x["roster"]))
    v1 = [t for t in x["tickets"] if t in x["roster"]]
    v2 = [t for t in dict.fromkeys(x["tickets"]) if t in x["roster"] and t not in x["disqualified"]]
    v3 = x["roster"][0] if x["roster"] else None
    v4 = next((t for t in x["committed"] if t not in x["declined"]),None)
    v5 = max(0,x["supply"]-len(set(x["winners"])))
    v6 = list(dict.fromkeys(t for t in x["tickets"] if t in x["roster"]))==x["committed"]
    v7 = x["committed"][:x["supply"]] if x["published"] else []
    v8 = x["round"]==x["ballot_round"]
    v9 = [x["substitutes"].get(w,w) if x["substitutes"].get(w,w) in x["consented"] else w for w in x["winners"]]
    return {'one-ticket-per-bidder':v0,'roster-ticket-admission':v1,'disqualification-before-draw':v2,'draw-index-contract':v3,'declined-ticket-rotation':v4,'ballot-supply-remainder':v5,'ticket-order-commitment':v6,'publication-before-award':v7,'round-specific-ballot':v8,'winner-substitute-consent':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('draw beyond roster', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 7, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [None, None, None, None, None]), ('future ballot / draw beyond roster', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 7, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 3, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [None, None, None, None, None]), ('normal contract', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, ['b', 'c', None, None, None]), ('future ballot', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 3, 'substitutes': {'a': 'z'}, 'consented': ['z']}, ['b', 'c', None, None, None]), ('no declines', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': [], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, ['b', 'c', None, None, None]), ('draw first', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 0, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, ['a', 'a', 'a', 'a', 'a']), ('all disqualified', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['a', 'b', 'c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, ['b', 'c', None, None, None]), ('all tickets valid', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, ['b', 'c', None, None, None]), ('unpublished draw', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': False, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, ['b', 'c', None, None, None]), ('same round', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 2, 'substitutes': {'a': 'z'}, 'consented': ['z']}, ['b', 'c', None, None, None])]
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))['draw-index-contract'], 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:
An out-of-range published draw wraps to another bidder.

A toy tied-award ballot has a frozen eligible bidder roster, published ticket order, one ticket per eligible bidder, and an explicitly supplied draw index. It is deterministic: no randomness claim. Declined winners rotate to the next eligible ticket without returning the declined bidder to the draw. Named decision draw-index-contract: For draw index contract, apply the stipulated decision x["roster"][x["draw"]] if 0<=x["draw"]<len(x["roster"]) else None.

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = list(dict.fromkeys(t for t in x["tickets"] if t in x["roster"]))
    v1 = [t for t in x["tickets"] if t in x["roster"]]
    v2 = [t for t in dict.fromkeys(x["tickets"]) if t in x["roster"] and t not in x["disqualified"]]
    v3 = x["roster"][x["draw"]] if 0<=x["draw"]<len(x["roster"]) else None
    v4 = x["committed"][0] if x["committed"] else None
    v5 = max(0,x["supply"]-len(set(x["winners"])))
    v6 = list(dict.fromkeys(t for t in x["tickets"] if t in x["roster"]))==x["committed"]
    v7 = x["committed"][:x["supply"]] if x["published"] else []
    v8 = x["round"]==x["ballot_round"]
    v9 = [x["substitutes"].get(w,w) if x["substitutes"].get(w,w) in x["consented"] else w for w in x["winners"]]
    return {'one-ticket-per-bidder':v0,'roster-ticket-admission':v1,'disqualification-before-draw':v2,'draw-index-contract':v3,'declined-ticket-rotation':v4,'ballot-supply-remainder':v5,'ticket-order-commitment':v6,'publication-before-award':v7,'round-specific-ballot':v8,'winner-substitute-consent':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, ['a', 'a', 'a', 'a', 'a']), ('future ballot', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 3, 'substitutes': {'a': 'z'}, 'consented': ['z']}, ['a', 'a', 'a', 'a', 'a']), ('no declines', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': [], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, ['b', 'b', 'b', 'b', 'b']), ('draw first', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 0, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, ['a', 'a', 'a', 'a', 'a']), ('draw beyond roster', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 7, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, ['a', 'a', 'a', 'a', 'a']), ('all disqualified', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['a', 'b', 'c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, ['a', 'a', 'a', 'a', 'a']), ('all tickets valid', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, ['a', 'a', 'a', 'a', 'a']), ('unpublished draw', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': False, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, ['a', 'a', 'a', 'a', 'a']), ('same round', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 2, 'substitutes': {'a': 'z'}, 'consented': ['z']}, ['a', 'a', 'a', 'a', 'a'])]
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))['declined-ticket-rotation'], 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 = list(dict.fromkeys(t for t in x["tickets"] if t in x["roster"]))
    v1 = [t for t in x["tickets"] if t in x["roster"]]
    v2 = [t for t in dict.fromkeys(x["tickets"]) if t in x["roster"] and t not in x["disqualified"]]
    v3 = x["roster"][x["draw"]] if 0<=x["draw"]<len(x["roster"]) else None
    v4 = next((t for t in reversed(x["committed"]) if t not in x["declined"]),None)
    v5 = max(0,x["supply"]-len(set(x["winners"])))
    v6 = list(dict.fromkeys(t for t in x["tickets"] if t in x["roster"]))==x["committed"]
    v7 = x["committed"][:x["supply"]] if x["published"] else []
    v8 = x["round"]==x["ballot_round"]
    v9 = [x["substitutes"].get(w,w) if x["substitutes"].get(w,w) in x["consented"] else w for w in x["winners"]]
    return {'one-ticket-per-bidder':v0,'roster-ticket-admission':v1,'disqualification-before-draw':v2,'draw-index-contract':v3,'declined-ticket-rotation':v4,'ballot-supply-remainder':v5,'ticket-order-commitment':v6,'publication-before-award':v7,'round-specific-ballot':v8,'winner-substitute-consent':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, ['a', 'a', 'a', 'a', 'a']), ('future ballot', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 3, 'substitutes': {'a': 'z'}, 'consented': ['z']}, ['a', 'a', 'a', 'a', 'a']), ('no declines', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': [], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, ['b', 'b', 'b', 'b', 'b']), ('draw first', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 0, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, ['a', 'a', 'a', 'a', 'a']), ('draw beyond roster', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 7, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, ['a', 'a', 'a', 'a', 'a']), ('all disqualified', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['a', 'b', 'c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, ['a', 'a', 'a', 'a', 'a']), ('all tickets valid', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, ['a', 'a', 'a', 'a', 'a']), ('unpublished draw', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': False, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, ['a', 'a', 'a', 'a', 'a']), ('same round', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 2, 'substitutes': {'a': 'z'}, 'consented': ['z']}, ['a', 'a', 'a', 'a', 'a'])]
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))['declined-ticket-rotation'], 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 declined tied winner is reoffered the same lot or successor order reverses.

A toy tied-award ballot has a frozen eligible bidder roster, published ticket order, one ticket per eligible bidder, and an explicitly supplied draw index. It is deterministic: no randomness claim. Declined winners rotate to the next eligible ticket without returning the declined bidder to the draw. Named decision declined-ticket-rotation: For declined ticket rotation, apply the stipulated decision next((t for t in x["committed"] if t not in x["declined"]),None).

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = list(dict.fromkeys(t for t in x["tickets"] if t in x["roster"]))
    v1 = [t for t in x["tickets"] if t in x["roster"]]
    v2 = [t for t in dict.fromkeys(x["tickets"]) if t in x["roster"] and t not in x["disqualified"]]
    v3 = x["roster"][x["draw"]] if 0<=x["draw"]<len(x["roster"]) else None
    v4 = next((t for t in x["committed"] if t not in x["declined"]),None)
    v5 = x["supply"]
    v6 = list(dict.fromkeys(t for t in x["tickets"] if t in x["roster"]))==x["committed"]
    v7 = x["committed"][:x["supply"]] if x["published"] else []
    v8 = x["round"]==x["ballot_round"]
    v9 = [x["substitutes"].get(w,w) if x["substitutes"].get(w,w) in x["consented"] else w for w in x["winners"]]
    return {'one-ticket-per-bidder':v0,'roster-ticket-admission':v1,'disqualification-before-draw':v2,'draw-index-contract':v3,'declined-ticket-rotation':v4,'ballot-supply-remainder':v5,'ticket-order-commitment':v6,'publication-before-award':v7,'round-specific-ballot':v8,'winner-substitute-consent':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [1, 3, 5, 7, 9]), ('future ballot', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 3, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [1, 3, 5, 7, 9]), ('zero supply', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 0, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [0, 0, 0, 0, 0]), ('future ballot / zero supply', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 0, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 3, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [0, 0, 0, 0, 0]), ('no declines', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': [], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [1, 3, 5, 7, 9]), ('draw first', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 0, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [1, 3, 5, 7, 9]), ('draw beyond roster', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 7, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [1, 3, 5, 7, 9]), ('all disqualified', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['a', 'b', 'c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [1, 3, 5, 7, 9]), ('all tickets valid', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [1, 3, 5, 7, 9]), ('unpublished draw', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': False, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [1, 3, 5, 7, 9]), ('same round', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 2, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [1, 3, 5, 7, 9])]
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))['ballot-supply-remainder'], 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 = list(dict.fromkeys(t for t in x["tickets"] if t in x["roster"]))
    v1 = [t for t in x["tickets"] if t in x["roster"]]
    v2 = [t for t in dict.fromkeys(x["tickets"]) if t in x["roster"] and t not in x["disqualified"]]
    v3 = x["roster"][x["draw"]] if 0<=x["draw"]<len(x["roster"]) else None
    v4 = next((t for t in x["committed"] if t not in x["declined"]),None)
    v5 = x["supply"]-len(x["winners"])
    v6 = list(dict.fromkeys(t for t in x["tickets"] if t in x["roster"]))==x["committed"]
    v7 = x["committed"][:x["supply"]] if x["published"] else []
    v8 = x["round"]==x["ballot_round"]
    v9 = [x["substitutes"].get(w,w) if x["substitutes"].get(w,w) in x["consented"] else w for w in x["winners"]]
    return {'one-ticket-per-bidder':v0,'roster-ticket-admission':v1,'disqualification-before-draw':v2,'draw-index-contract':v3,'declined-ticket-rotation':v4,'ballot-supply-remainder':v5,'ticket-order-commitment':v6,'publication-before-award':v7,'round-specific-ballot':v8,'winner-substitute-consent':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [1, 3, 5, 7, 9]), ('future ballot', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 3, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [1, 3, 5, 7, 9]), ('zero supply', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 0, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [0, 0, 0, 0, 0]), ('future ballot / zero supply', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 0, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 3, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [0, 0, 0, 0, 0]), ('no declines', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': [], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [1, 3, 5, 7, 9]), ('draw first', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 0, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [1, 3, 5, 7, 9]), ('draw beyond roster', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 7, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [1, 3, 5, 7, 9]), ('all disqualified', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['a', 'b', 'c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [1, 3, 5, 7, 9]), ('all tickets valid', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [1, 3, 5, 7, 9]), ('unpublished draw', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': False, 'round': 2, 'ballot_round': 1, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [1, 3, 5, 7, 9]), ('same round', {'roster': ['a', 'b', 'c'], 'tickets': ['b', 'a', 'b', 'd', 'c'], 'disqualified': ['c'], 'draw': 1, 'declined': ['b'], 'winners': ['a'], 'supply': 2, 'committed': ['b', 'a', 'c'], 'published': True, 'round': 2, 'ballot_round': 2, 'substitutes': {'a': 'z'}, 'consented': ['z']}, [1, 3, 5, 7, 9])]
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))['ballot-supply-remainder'], 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:
Tie ballot distributes full supply again after partial awards.

A toy tied-award ballot has a frozen eligible bidder roster, published ticket order, one ticket per eligible bidder, and an explicitly supplied draw index. It is deterministic: no randomness claim. Declined winners rotate to the next eligible ticket without returning the declined bidder to the draw. Named decision ballot-supply-remainder: For ballot supply remainder, apply the stipulated decision max(0,x["supply"]-len(set(x["winners"]))).

split: open-access