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

N = 1
observations = []
def solve(x):
    v0 = sum(x["points"][i] for i in set(x["active"])-set(x["withdrawn"]))
    v1 = sum(x["points"][i] for i in set(x["active"])|set(x["standing"]))
    v2 = x["use_waiver"] and x["waivers"]>0
    v3 = x["waivers"]-int(x["use_waiver"] and x["waivers"]>0)
    v4 = min(x["previous"],sum(x["points"][i] for i in x["active"]))
    v5 = x["previous"] if x["use_waiver"] and x["waivers"]>0 else min(x["previous"],x["required"])
    v6 = x["history"] if x["round"]<=x["last_round"] else x["history"]+[x["previous"]]
    v7 = min(x["previous"],x["stage_limits"][min(x["stage"],len(x["stage_limits"])-1)])
    v8 = min(x["qualification"],x["previous"]+x["transferred"])
    v9 = min(x["previous"],x["qualification"])
    return {'withdrawn-activity':v0,'standing-credit-dedup':v1,'waiver-availability':v2,'waiver-consumption':v3,'eligibility-monotonicity':v4,'waiver-preservation':v5,'round-advance':v6,'stage-ceiling':v7,'transfer-cap':v8,'revocation':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('qualification revoked', {'points': {'A': 3, 'B': 2, 'C': 1}, 'active': ['A', 'B'], 'withdrawn': ['B'], 'standing': ['C'], 'previous': 8, 'waivers': 2, 'use_waiver': False, 'required': 5, 'round': 2, 'last_round': 1, 'history': [8, 6, 5], 'stage': 2, 'stage_limits': [10, 7, 4], 'qualification': 9, 'transferred': 2, 'revoked': True}, [0, 0, 0, 0, 0]), ('waiver round / qualification revoked', {'points': {'A': 3, 'B': 2, 'C': 1}, 'active': ['A', 'B'], 'withdrawn': ['B'], 'standing': ['C'], 'previous': 8, 'waivers': 2, 'use_waiver': True, 'required': 5, 'round': 2, 'last_round': 1, 'history': [8, 6, 5], 'stage': 2, 'stage_limits': [10, 7, 4], 'qualification': 9, 'transferred': 2, 'revoked': True}, [0, 0, 0, 0, 0]), ('normal contract', {'points': {'A': 3, 'B': 2, 'C': 1}, 'active': ['A', 'B'], 'withdrawn': ['B'], 'standing': ['C'], 'previous': 8, 'waivers': 2, 'use_waiver': False, 'required': 5, 'round': 2, 'last_round': 1, 'history': [8, 6, 5], 'stage': 2, 'stage_limits': [10, 7, 4], 'qualification': 9, 'transferred': 2, 'revoked': False}, [8, 16, 24, 32, 40]), ('waiver round', {'points': {'A': 3, 'B': 2, 'C': 1}, 'active': ['A', 'B'], 'withdrawn': ['B'], 'standing': ['C'], 'previous': 8, 'waivers': 2, 'use_waiver': True, 'required': 5, 'round': 2, 'last_round': 1, 'history': [8, 6, 5], 'stage': 2, 'stage_limits': [10, 7, 4], 'qualification': 9, 'transferred': 2, 'revoked': False}, [8, 16, 24, 32, 40]), ('no waiver left', {'points': {'A': 3, 'B': 2, 'C': 1}, 'active': ['A', 'B'], 'withdrawn': ['B'], 'standing': ['C'], 'previous': 8, 'waivers': 0, 'use_waiver': True, 'required': 5, 'round': 2, 'last_round': 1, 'history': [8, 6, 5], 'stage': 2, 'stage_limits': [10, 7, 4], 'qualification': 9, 'transferred': 2, 'revoked': False}, [8, 16, 24, 32, 40]), ('all withdrawn', {'points': {'A': 3, 'B': 2, 'C': 1}, 'active': ['A', 'B'], 'withdrawn': ['A', 'B'], 'standing': ['C'], 'previous': 8, 'waivers': 2, 'use_waiver': False, 'required': 5, 'round': 2, 'last_round': 1, 'history': [8, 6, 5], 'stage': 2, 'stage_limits': [10, 7, 4], 'qualification': 9, 'transferred': 2, 'revoked': False}, [8, 16, 24, 32, 40]), ('standing overlaps activity', {'points': {'A': 3, 'B': 2, 'C': 1}, 'active': ['A', 'B'], 'withdrawn': ['B'], 'standing': ['A'], 'previous': 8, 'waivers': 2, 'use_waiver': False, 'required': 5, 'round': 2, 'last_round': 1, 'history': [8, 6, 5], 'stage': 2, 'stage_limits': [10, 7, 4], 'qualification': 9, 'transferred': 2, 'revoked': False}, [8, 16, 24, 32, 40]), ('replayed round', {'points': {'A': 3, 'B': 2, 'C': 1}, 'active': ['A', 'B'], 'withdrawn': ['B'], 'standing': ['C'], 'previous': 8, 'waivers': 2, 'use_waiver': False, 'required': 5, 'round': 1, 'last_round': 1, 'history': [8, 6, 5], 'stage': 2, 'stage_limits': [10, 7, 4], 'qualification': 9, 'transferred': 2, 'revoked': False}, [8, 16, 24, 32, 40]), ('stage entry', {'points': {'A': 3, 'B': 2, 'C': 1}, 'active': ['A', 'B'], 'withdrawn': ['B'], 'standing': ['C'], 'previous': 8, 'waivers': 2, 'use_waiver': False, 'required': 5, 'round': 2, 'last_round': 1, 'history': [8, 6, 5], 'stage': 0, 'stage_limits': [10, 7, 4], 'qualification': 9, 'transferred': 2, 'revoked': False}, [8, 16, 24, 32, 40]), ('small qualification', {'points': {'A': 3, 'B': 2, 'C': 1}, 'active': ['A', 'B'], 'withdrawn': ['B'], 'standing': ['C'], 'previous': 8, 'waivers': 2, 'use_waiver': False, 'required': 5, 'round': 2, 'last_round': 1, 'history': [8, 6, 5], 'stage': 2, 'stage_limits': [10, 7, 4], 'qualification': 2, 'transferred': 2, 'revoked': False}, [2, 4, 6, 8, 10])]
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))['revocation'], expected[N-1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(x):
    v0 = sum(x["points"][i] for i in set(x["active"])-set(x["withdrawn"]))
    v1 = sum(x["points"][i] for i in set(x["active"])|set(x["standing"]))
    v2 = x["use_waiver"] and x["waivers"]>0
    v3 = x["waivers"]-int(x["use_waiver"] and x["waivers"]>0)
    v4 = min(x["previous"],sum(x["points"][i] for i in x["active"]))
    v5 = x["previous"] if x["use_waiver"] and x["waivers"]>0 else min(x["previous"],x["required"])
    v6 = x["history"] if x["round"]<=x["last_round"] else x["history"]+[x["previous"]]
    v7 = min(x["previous"],x["stage_limits"][min(x["stage"],len(x["stage_limits"])-1)])
    v8 = min(x["qualification"],x["previous"]+x["transferred"])
    v9 = 0 if x["revoked"] else x["qualification"]
    return {'withdrawn-activity':v0,'standing-credit-dedup':v1,'waiver-availability':v2,'waiver-consumption':v3,'eligibility-monotonicity':v4,'waiver-preservation':v5,'round-advance':v6,'stage-ceiling':v7,'transfer-cap':v8,'revocation':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('qualification revoked', {'points': {'A': 3, 'B': 2, 'C': 1}, 'active': ['A', 'B'], 'withdrawn': ['B'], 'standing': ['C'], 'previous': 8, 'waivers': 2, 'use_waiver': False, 'required': 5, 'round': 2, 'last_round': 1, 'history': [8, 6, 5], 'stage': 2, 'stage_limits': [10, 7, 4], 'qualification': 9, 'transferred': 2, 'revoked': True}, [0, 0, 0, 0, 0]), ('waiver round / qualification revoked', {'points': {'A': 3, 'B': 2, 'C': 1}, 'active': ['A', 'B'], 'withdrawn': ['B'], 'standing': ['C'], 'previous': 8, 'waivers': 2, 'use_waiver': True, 'required': 5, 'round': 2, 'last_round': 1, 'history': [8, 6, 5], 'stage': 2, 'stage_limits': [10, 7, 4], 'qualification': 9, 'transferred': 2, 'revoked': True}, [0, 0, 0, 0, 0]), ('normal contract', {'points': {'A': 3, 'B': 2, 'C': 1}, 'active': ['A', 'B'], 'withdrawn': ['B'], 'standing': ['C'], 'previous': 8, 'waivers': 2, 'use_waiver': False, 'required': 5, 'round': 2, 'last_round': 1, 'history': [8, 6, 5], 'stage': 2, 'stage_limits': [10, 7, 4], 'qualification': 9, 'transferred': 2, 'revoked': False}, [8, 16, 24, 32, 40]), ('waiver round', {'points': {'A': 3, 'B': 2, 'C': 1}, 'active': ['A', 'B'], 'withdrawn': ['B'], 'standing': ['C'], 'previous': 8, 'waivers': 2, 'use_waiver': True, 'required': 5, 'round': 2, 'last_round': 1, 'history': [8, 6, 5], 'stage': 2, 'stage_limits': [10, 7, 4], 'qualification': 9, 'transferred': 2, 'revoked': False}, [8, 16, 24, 32, 40]), ('no waiver left', {'points': {'A': 3, 'B': 2, 'C': 1}, 'active': ['A', 'B'], 'withdrawn': ['B'], 'standing': ['C'], 'previous': 8, 'waivers': 0, 'use_waiver': True, 'required': 5, 'round': 2, 'last_round': 1, 'history': [8, 6, 5], 'stage': 2, 'stage_limits': [10, 7, 4], 'qualification': 9, 'transferred': 2, 'revoked': False}, [8, 16, 24, 32, 40]), ('all withdrawn', {'points': {'A': 3, 'B': 2, 'C': 1}, 'active': ['A', 'B'], 'withdrawn': ['A', 'B'], 'standing': ['C'], 'previous': 8, 'waivers': 2, 'use_waiver': False, 'required': 5, 'round': 2, 'last_round': 1, 'history': [8, 6, 5], 'stage': 2, 'stage_limits': [10, 7, 4], 'qualification': 9, 'transferred': 2, 'revoked': False}, [8, 16, 24, 32, 40]), ('standing overlaps activity', {'points': {'A': 3, 'B': 2, 'C': 1}, 'active': ['A', 'B'], 'withdrawn': ['B'], 'standing': ['A'], 'previous': 8, 'waivers': 2, 'use_waiver': False, 'required': 5, 'round': 2, 'last_round': 1, 'history': [8, 6, 5], 'stage': 2, 'stage_limits': [10, 7, 4], 'qualification': 9, 'transferred': 2, 'revoked': False}, [8, 16, 24, 32, 40]), ('replayed round', {'points': {'A': 3, 'B': 2, 'C': 1}, 'active': ['A', 'B'], 'withdrawn': ['B'], 'standing': ['C'], 'previous': 8, 'waivers': 2, 'use_waiver': False, 'required': 5, 'round': 1, 'last_round': 1, 'history': [8, 6, 5], 'stage': 2, 'stage_limits': [10, 7, 4], 'qualification': 9, 'transferred': 2, 'revoked': False}, [8, 16, 24, 32, 40]), ('stage entry', {'points': {'A': 3, 'B': 2, 'C': 1}, 'active': ['A', 'B'], 'withdrawn': ['B'], 'standing': ['C'], 'previous': 8, 'waivers': 2, 'use_waiver': False, 'required': 5, 'round': 2, 'last_round': 1, 'history': [8, 6, 5], 'stage': 0, 'stage_limits': [10, 7, 4], 'qualification': 9, 'transferred': 2, 'revoked': False}, [8, 16, 24, 32, 40]), ('small qualification', {'points': {'A': 3, 'B': 2, 'C': 1}, 'active': ['A', 'B'], 'withdrawn': ['B'], 'standing': ['C'], 'previous': 8, 'waivers': 2, 'use_waiver': False, 'required': 5, 'round': 2, 'last_round': 1, 'history': [8, 6, 5], 'stage': 2, 'stage_limits': [10, 7, 4], 'qualification': 2, 'transferred': 2, 'revoked': False}, [2, 4, 6, 8, 10])]
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))['revocation'], 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:
Revocation preserves residual eligibility or requalification restores lost points.

A stipulated ascending multiround auction records eligibility in activity points. Submitted lots contribute fixed points, withdrawn lots contribute none, a waiver preserves previous eligibility once, and frozen eligibility cannot grow. These rules are pedagogical and independent of real spectrum-auction regulations. Named decision revocation: Revocation zeroes eligibility; ordinary qualification only caps it.

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = x["requested"]
    v1 = [0 if e else q for e,q in zip(x["exited"],x["requested"])]
    v2 = [p if a else old for p,old,a in zip(x["prices"],x["previous_prices"],x["accepted"])]
    v3 = [min(q,c) for q,c in zip(x["requested"],x["caps"])]
    v4 = [max(0,q-s) for q,s in zip(x["old"],x["supply"])]
    v5 = [i for i,(q,s) in enumerate(zip(x["old"],x["supply"])) if q>s]
    v6 = [d if p>=w else o for d,p,w,o in zip(x["deferred"],x["prices"],x["withdrawal_prices"],x["old"])]
    v7 = all(q<=s for q,s in zip(x["old"],x["supply"]))
    v8 = [a and p!=o for a,p,o in zip(x["accepted"],x["prices"],x["previous_prices"])]
    v9 = x["old"] if x["round"]<=x["last_round"] else x["requested"]
    return {'accepted-reduction':v0,'irreversible-exit':v1,'posted-price-lock':v2,'demand-cap':v3,'excess-demand':v4,'clock-step-selection':v5,'deferred-exit-trigger':v6,'round-clearing-quiescence':v7,'price-change-ack':v8,'round-demand-replay':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 3], [4, 6], [6, 9], [8, 12], [10, 15]]), ('unequal demand caps', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [1, 5], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 3], [4, 6], [6, 9], [8, 12], [10, 15]]), ('none accepted', {'old': [5, 3], 'requested': [2, 4], 'accepted': [False, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[5, 3], [10, 6], [15, 9], [20, 12], [25, 15]]), ('unequal demand caps / none accepted', {'old': [5, 3], 'requested': [2, 4], 'accepted': [False, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [1, 5], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[5, 3], [10, 6], [15, 9], [20, 12], [25, 15]]), ('balanced lots', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [5, 3], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 3], [4, 6], [6, 9], [8, 12], [10, 15]]), ('cross lot surplus', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 9], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 3], [4, 6], [6, 9], [8, 12], [10, 15]]), ('exit at trigger', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [9, 25], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 3], [4, 6], [6, 9], [8, 12], [10, 15]]), ('all accepted', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, True], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 3], [4, 6], [6, 9], [8, 12], [10, 15]]), ('no exited lots', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, False], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 3], [4, 6], [6, 9], [8, 12], [10, 15]]), ('auction reopened', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': True, 'round': 2, 'last_round': 1}, [[2, 3], [4, 6], [6, 9], [8, 12], [10, 15]])]
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))['accepted-reduction'], 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 = [min(o,r) for o,r in zip(x["old"],x["requested"])]
    v1 = [0 if e else q for e,q in zip(x["exited"],x["requested"])]
    v2 = [p if a else old for p,old,a in zip(x["prices"],x["previous_prices"],x["accepted"])]
    v3 = [min(q,c) for q,c in zip(x["requested"],x["caps"])]
    v4 = [max(0,q-s) for q,s in zip(x["old"],x["supply"])]
    v5 = [i for i,(q,s) in enumerate(zip(x["old"],x["supply"])) if q>s]
    v6 = [d if p>=w else o for d,p,w,o in zip(x["deferred"],x["prices"],x["withdrawal_prices"],x["old"])]
    v7 = all(q<=s for q,s in zip(x["old"],x["supply"]))
    v8 = [a and p!=o for a,p,o in zip(x["accepted"],x["prices"],x["previous_prices"])]
    v9 = x["old"] if x["round"]<=x["last_round"] else x["requested"]
    return {'accepted-reduction':v0,'irreversible-exit':v1,'posted-price-lock':v2,'demand-cap':v3,'excess-demand':v4,'clock-step-selection':v5,'deferred-exit-trigger':v6,'round-clearing-quiescence':v7,'price-change-ack':v8,'round-demand-replay':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 3], [4, 6], [6, 9], [8, 12], [10, 15]]), ('unequal demand caps', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [1, 5], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 3], [4, 6], [6, 9], [8, 12], [10, 15]]), ('none accepted', {'old': [5, 3], 'requested': [2, 4], 'accepted': [False, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[5, 3], [10, 6], [15, 9], [20, 12], [25, 15]]), ('unequal demand caps / none accepted', {'old': [5, 3], 'requested': [2, 4], 'accepted': [False, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [1, 5], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[5, 3], [10, 6], [15, 9], [20, 12], [25, 15]]), ('balanced lots', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [5, 3], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 3], [4, 6], [6, 9], [8, 12], [10, 15]]), ('cross lot surplus', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 9], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 3], [4, 6], [6, 9], [8, 12], [10, 15]]), ('exit at trigger', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [9, 25], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 3], [4, 6], [6, 9], [8, 12], [10, 15]]), ('all accepted', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, True], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 3], [4, 6], [6, 9], [8, 12], [10, 15]]), ('no exited lots', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, False], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 3], [4, 6], [6, 9], [8, 12], [10, 15]]), ('auction reopened', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': True, 'round': 2, 'last_round': 1}, [[2, 3], [4, 6], [6, 9], [8, 12], [10, 15]])]
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))['accepted-reduction'], 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:
Unaccepted demand reductions change the binding clock quantity.

One bounded clock-auction round maintains per-lot demand at posted prices. Demand reductions become binding only at accepted clock prices; exits cannot be undone; deferred reductions are reconsidered against the new price. Arrays are aligned by lot and values are nonnegative integers. Named decision accepted-reduction: Apply only accepted reductions and preserve other standing demand.

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = [min(o,r) if a else o for o,r,a in zip(x["old"],x["requested"],x["accepted"])]
    v1 = x["requested"]
    v2 = [p if a else old for p,old,a in zip(x["prices"],x["previous_prices"],x["accepted"])]
    v3 = [min(q,c) for q,c in zip(x["requested"],x["caps"])]
    v4 = [max(0,q-s) for q,s in zip(x["old"],x["supply"])]
    v5 = [i for i,(q,s) in enumerate(zip(x["old"],x["supply"])) if q>s]
    v6 = [d if p>=w else o for d,p,w,o in zip(x["deferred"],x["prices"],x["withdrawal_prices"],x["old"])]
    v7 = all(q<=s for q,s in zip(x["old"],x["supply"]))
    v8 = [a and p!=o for a,p,o in zip(x["accepted"],x["prices"],x["previous_prices"])]
    v9 = x["old"] if x["round"]<=x["last_round"] else x["requested"]
    return {'accepted-reduction':v0,'irreversible-exit':v1,'posted-price-lock':v2,'demand-cap':v3,'excess-demand':v4,'clock-step-selection':v5,'deferred-exit-trigger':v6,'round-clearing-quiescence':v7,'price-change-ack':v8,'round-demand-replay':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 0], [4, 0], [6, 0], [8, 0], [10, 0]]), ('unequal demand caps', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [1, 5], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 0], [4, 0], [6, 0], [8, 0], [10, 0]]), ('auction reopened', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': True, 'round': 2, 'last_round': 1}, [[2, 0], [4, 0], [6, 0], [8, 0], [10, 0]]), ('unequal demand caps / auction reopened', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [1, 5], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': True, 'round': 2, 'last_round': 1}, [[2, 0], [4, 0], [6, 0], [8, 0], [10, 0]]), ('balanced lots', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [5, 3], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 0], [4, 0], [6, 0], [8, 0], [10, 0]]), ('cross lot surplus', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 9], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 0], [4, 0], [6, 0], [8, 0], [10, 0]]), ('exit at trigger', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [9, 25], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 0], [4, 0], [6, 0], [8, 0], [10, 0]]), ('all accepted', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, True], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 0], [4, 0], [6, 0], [8, 0], [10, 0]]), ('none accepted', {'old': [5, 3], 'requested': [2, 4], 'accepted': [False, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 0], [4, 0], [6, 0], [8, 0], [10, 0]]), ('no exited lots', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, False], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 4], [4, 8], [6, 12], [8, 16], [10, 20]])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', '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))['irreversible-exit'], 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 = [min(o,r) if a else o for o,r,a in zip(x["old"],x["requested"],x["accepted"])]
    v1 = [0 if e and not x["reopened"] else q for e,q in zip(x["exited"],x["requested"])]
    v2 = [p if a else old for p,old,a in zip(x["prices"],x["previous_prices"],x["accepted"])]
    v3 = [min(q,c) for q,c in zip(x["requested"],x["caps"])]
    v4 = [max(0,q-s) for q,s in zip(x["old"],x["supply"])]
    v5 = [i for i,(q,s) in enumerate(zip(x["old"],x["supply"])) if q>s]
    v6 = [d if p>=w else o for d,p,w,o in zip(x["deferred"],x["prices"],x["withdrawal_prices"],x["old"])]
    v7 = all(q<=s for q,s in zip(x["old"],x["supply"]))
    v8 = [a and p!=o for a,p,o in zip(x["accepted"],x["prices"],x["previous_prices"])]
    v9 = x["old"] if x["round"]<=x["last_round"] else x["requested"]
    return {'accepted-reduction':v0,'irreversible-exit':v1,'posted-price-lock':v2,'demand-cap':v3,'excess-demand':v4,'clock-step-selection':v5,'deferred-exit-trigger':v6,'round-clearing-quiescence':v7,'price-change-ack':v8,'round-demand-replay':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 0], [4, 0], [6, 0], [8, 0], [10, 0]]), ('unequal demand caps', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [1, 5], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 0], [4, 0], [6, 0], [8, 0], [10, 0]]), ('auction reopened', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': True, 'round': 2, 'last_round': 1}, [[2, 0], [4, 0], [6, 0], [8, 0], [10, 0]]), ('unequal demand caps / auction reopened', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [1, 5], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': True, 'round': 2, 'last_round': 1}, [[2, 0], [4, 0], [6, 0], [8, 0], [10, 0]]), ('balanced lots', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [5, 3], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 0], [4, 0], [6, 0], [8, 0], [10, 0]]), ('cross lot surplus', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 9], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 0], [4, 0], [6, 0], [8, 0], [10, 0]]), ('exit at trigger', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [9, 25], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 0], [4, 0], [6, 0], [8, 0], [10, 0]]), ('all accepted', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, True], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 0], [4, 0], [6, 0], [8, 0], [10, 0]]), ('none accepted', {'old': [5, 3], 'requested': [2, 4], 'accepted': [False, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 0], [4, 0], [6, 0], [8, 0], [10, 0]]), ('no exited lots', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, False], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 4], [4, 8], [6, 12], [8, 16], [10, 20]])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', '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))['irreversible-exit'], 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 previously exited lot silently reacquires demand after reopening.

One bounded clock-auction round maintains per-lot demand at posted prices. Demand reductions become binding only at accepted clock prices; exits cannot be undone; deferred reductions are reconsidered against the new price. Arrays are aligned by lot and values are nonnegative integers. Named decision irreversible-exit: Keep exited lots at zero under this irreversible exit contract.

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = [min(o,r) if a else o for o,r,a in zip(x["old"],x["requested"],x["accepted"])]
    v1 = [0 if e else q for e,q in zip(x["exited"],x["requested"])]
    v2 = x["prices"]
    v3 = [min(q,c) for q,c in zip(x["requested"],x["caps"])]
    v4 = [max(0,q-s) for q,s in zip(x["old"],x["supply"])]
    v5 = [i for i,(q,s) in enumerate(zip(x["old"],x["supply"])) if q>s]
    v6 = [d if p>=w else o for d,p,w,o in zip(x["deferred"],x["prices"],x["withdrawal_prices"],x["old"])]
    v7 = all(q<=s for q,s in zip(x["old"],x["supply"]))
    v8 = [a and p!=o for a,p,o in zip(x["accepted"],x["prices"],x["previous_prices"])]
    v9 = x["old"] if x["round"]<=x["last_round"] else x["requested"]
    return {'accepted-reduction':v0,'irreversible-exit':v1,'posted-price-lock':v2,'demand-cap':v3,'excess-demand':v4,'clock-step-selection':v5,'deferred-exit-trigger':v6,'round-clearing-quiescence':v7,'price-change-ack':v8,'round-demand-replay':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('exit at trigger', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [9, 25], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[9, 20], [18, 40], [27, 60], [36, 80], [45, 100]]), ('none accepted', {'old': [5, 3], 'requested': [2, 4], 'accepted': [False, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[8, 20], [16, 40], [24, 60], [32, 80], [40, 100]]), ('normal contract', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[10, 20], [20, 40], [30, 60], [40, 80], [50, 100]]), ('unequal demand caps', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [1, 5], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[10, 20], [20, 40], [30, 60], [40, 80], [50, 100]]), ('balanced lots', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [5, 3], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[10, 20], [20, 40], [30, 60], [40, 80], [50, 100]]), ('cross lot surplus', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 9], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[10, 20], [20, 40], [30, 60], [40, 80], [50, 100]]), ('all accepted', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, True], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[10, 20], [20, 40], [30, 60], [40, 80], [50, 100]]), ('no exited lots', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, False], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[10, 20], [20, 40], [30, 60], [40, 80], [50, 100]]), ('auction reopened', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': True, 'round': 2, 'last_round': 1}, [[10, 20], [20, 40], [30, 60], [40, 80], [50, 100]])]
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))['posted-price-lock'], 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 = [min(o,r) if a else o for o,r,a in zip(x["old"],x["requested"],x["accepted"])]
    v1 = [0 if e else q for e,q in zip(x["exited"],x["requested"])]
    v2 = x["previous_prices"]
    v3 = [min(q,c) for q,c in zip(x["requested"],x["caps"])]
    v4 = [max(0,q-s) for q,s in zip(x["old"],x["supply"])]
    v5 = [i for i,(q,s) in enumerate(zip(x["old"],x["supply"])) if q>s]
    v6 = [d if p>=w else o for d,p,w,o in zip(x["deferred"],x["prices"],x["withdrawal_prices"],x["old"])]
    v7 = all(q<=s for q,s in zip(x["old"],x["supply"]))
    v8 = [a and p!=o for a,p,o in zip(x["accepted"],x["prices"],x["previous_prices"])]
    v9 = x["old"] if x["round"]<=x["last_round"] else x["requested"]
    return {'accepted-reduction':v0,'irreversible-exit':v1,'posted-price-lock':v2,'demand-cap':v3,'excess-demand':v4,'clock-step-selection':v5,'deferred-exit-trigger':v6,'round-clearing-quiescence':v7,'price-change-ack':v8,'round-demand-replay':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('exit at trigger', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [9, 25], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[9, 20], [18, 40], [27, 60], [36, 80], [45, 100]]), ('none accepted', {'old': [5, 3], 'requested': [2, 4], 'accepted': [False, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[8, 20], [16, 40], [24, 60], [32, 80], [40, 100]]), ('normal contract', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[10, 20], [20, 40], [30, 60], [40, 80], [50, 100]]), ('unequal demand caps', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [1, 5], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[10, 20], [20, 40], [30, 60], [40, 80], [50, 100]]), ('balanced lots', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [5, 3], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[10, 20], [20, 40], [30, 60], [40, 80], [50, 100]]), ('cross lot surplus', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 9], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[10, 20], [20, 40], [30, 60], [40, 80], [50, 100]]), ('all accepted', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, True], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[10, 20], [20, 40], [30, 60], [40, 80], [50, 100]]), ('no exited lots', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, False], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[10, 20], [20, 40], [30, 60], [40, 80], [50, 100]]), ('auction reopened', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': True, 'round': 2, 'last_round': 1}, [[10, 20], [20, 40], [30, 60], [40, 80], [50, 100]])]
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))['posted-price-lock'], 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:
Rejected clock proposals overwrite the bidder binding price.

One bounded clock-auction round maintains per-lot demand at posted prices. Demand reductions become binding only at accepted clock prices; exits cannot be undone; deferred reductions are reconsidered against the new price. Arrays are aligned by lot and values are nonnegative integers. Named decision posted-price-lock: Change a binding price only where that posted proposal was accepted.

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = [min(o,r) if a else o for o,r,a in zip(x["old"],x["requested"],x["accepted"])]
    v1 = [0 if e else q for e,q in zip(x["exited"],x["requested"])]
    v2 = [p if a else old for p,old,a in zip(x["prices"],x["previous_prices"],x["accepted"])]
    v3 = x["requested"]
    v4 = [max(0,q-s) for q,s in zip(x["old"],x["supply"])]
    v5 = [i for i,(q,s) in enumerate(zip(x["old"],x["supply"])) if q>s]
    v6 = [d if p>=w else o for d,p,w,o in zip(x["deferred"],x["prices"],x["withdrawal_prices"],x["old"])]
    v7 = all(q<=s for q,s in zip(x["old"],x["supply"]))
    v8 = [a and p!=o for a,p,o in zip(x["accepted"],x["prices"],x["previous_prices"])]
    v9 = x["old"] if x["round"]<=x["last_round"] else x["requested"]
    return {'accepted-reduction':v0,'irreversible-exit':v1,'posted-price-lock':v2,'demand-cap':v3,'excess-demand':v4,'clock-step-selection':v5,'deferred-exit-trigger':v6,'round-clearing-quiescence':v7,'price-change-ack':v8,'round-demand-replay':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 3], [4, 6], [6, 9], [8, 12], [10, 15]]), ('unequal demand caps', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [1, 5], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[1, 4], [2, 8], [3, 12], [4, 16], [5, 20]]), ('unequal demand caps / balanced lots', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [1, 5], 'supply': [5, 3], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[1, 4], [2, 8], [3, 12], [4, 16], [5, 20]]), ('balanced lots', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [5, 3], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 3], [4, 6], [6, 9], [8, 12], [10, 15]]), ('cross lot surplus', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 9], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 3], [4, 6], [6, 9], [8, 12], [10, 15]]), ('exit at trigger', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [9, 25], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 3], [4, 6], [6, 9], [8, 12], [10, 15]]), ('all accepted', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, True], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 3], [4, 6], [6, 9], [8, 12], [10, 15]]), ('none accepted', {'old': [5, 3], 'requested': [2, 4], 'accepted': [False, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 3], [4, 6], [6, 9], [8, 12], [10, 15]]), ('no exited lots', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, False], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 3], [4, 6], [6, 9], [8, 12], [10, 15]]), ('auction reopened', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': True, 'round': 2, 'last_round': 1}, [[2, 3], [4, 6], [6, 9], [8, 12], [10, 15]])]
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))['demand-cap'], 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 = [min(o,r) if a else o for o,r,a in zip(x["old"],x["requested"],x["accepted"])]
    v1 = [0 if e else q for e,q in zip(x["exited"],x["requested"])]
    v2 = [p if a else old for p,old,a in zip(x["prices"],x["previous_prices"],x["accepted"])]
    v3 = [min(q,max(x["caps"])) for q in x["requested"]]
    v4 = [max(0,q-s) for q,s in zip(x["old"],x["supply"])]
    v5 = [i for i,(q,s) in enumerate(zip(x["old"],x["supply"])) if q>s]
    v6 = [d if p>=w else o for d,p,w,o in zip(x["deferred"],x["prices"],x["withdrawal_prices"],x["old"])]
    v7 = all(q<=s for q,s in zip(x["old"],x["supply"]))
    v8 = [a and p!=o for a,p,o in zip(x["accepted"],x["prices"],x["previous_prices"])]
    v9 = x["old"] if x["round"]<=x["last_round"] else x["requested"]
    return {'accepted-reduction':v0,'irreversible-exit':v1,'posted-price-lock':v2,'demand-cap':v3,'excess-demand':v4,'clock-step-selection':v5,'deferred-exit-trigger':v6,'round-clearing-quiescence':v7,'price-change-ack':v8,'round-demand-replay':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 3], [4, 6], [6, 9], [8, 12], [10, 15]]), ('unequal demand caps', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [1, 5], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[1, 4], [2, 8], [3, 12], [4, 16], [5, 20]]), ('unequal demand caps / balanced lots', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [1, 5], 'supply': [5, 3], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[1, 4], [2, 8], [3, 12], [4, 16], [5, 20]]), ('balanced lots', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [5, 3], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 3], [4, 6], [6, 9], [8, 12], [10, 15]]), ('cross lot surplus', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 9], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 3], [4, 6], [6, 9], [8, 12], [10, 15]]), ('exit at trigger', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [9, 25], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 3], [4, 6], [6, 9], [8, 12], [10, 15]]), ('all accepted', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, True], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 3], [4, 6], [6, 9], [8, 12], [10, 15]]), ('none accepted', {'old': [5, 3], 'requested': [2, 4], 'accepted': [False, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 3], [4, 6], [6, 9], [8, 12], [10, 15]]), ('no exited lots', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, False], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[2, 3], [4, 6], [6, 9], [8, 12], [10, 15]]), ('auction reopened', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': True, 'round': 2, 'last_round': 1}, [[2, 3], [4, 6], [6, 9], [8, 12], [10, 15]])]
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))['demand-cap'], 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 global cap substitutes for each lot demand cap.

One bounded clock-auction round maintains per-lot demand at posted prices. Demand reductions become binding only at accepted clock prices; exits cannot be undone; deferred reductions are reconsidered against the new price. Arrays are aligned by lot and values are nonnegative integers. Named decision demand-cap: Apply each lot cap to its own requested quantity.

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = [min(o,r) if a else o for o,r,a in zip(x["old"],x["requested"],x["accepted"])]
    v1 = [0 if e else q for e,q in zip(x["exited"],x["requested"])]
    v2 = [p if a else old for p,old,a in zip(x["prices"],x["previous_prices"],x["accepted"])]
    v3 = [min(q,c) for q,c in zip(x["requested"],x["caps"])]
    v4 = [q-s for q,s in zip(x["old"],x["supply"])]
    v5 = [i for i,(q,s) in enumerate(zip(x["old"],x["supply"])) if q>s]
    v6 = [d if p>=w else o for d,p,w,o in zip(x["deferred"],x["prices"],x["withdrawal_prices"],x["old"])]
    v7 = all(q<=s for q,s in zip(x["old"],x["supply"]))
    v8 = [a and p!=o for a,p,o in zip(x["accepted"],x["prices"],x["previous_prices"])]
    v9 = x["old"] if x["round"]<=x["last_round"] else x["requested"]
    return {'accepted-reduction':v0,'irreversible-exit':v1,'posted-price-lock':v2,'demand-cap':v3,'excess-demand':v4,'clock-step-selection':v5,'deferred-exit-trigger':v6,'round-clearing-quiescence':v7,'price-change-ack':v8,'round-demand-replay':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('cross lot surplus', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 9], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[1, 0], [2, 0], [3, 0], [4, 0], [5, 0]]), ('shortage disappears', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [9, 9], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0]]), ('normal contract', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]), ('unequal demand caps', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [1, 5], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]), ('balanced lots', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [5, 3], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0]]), ('exit at trigger', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [9, 25], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]), ('all accepted', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, True], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]), ('none accepted', {'old': [5, 3], 'requested': [2, 4], 'accepted': [False, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]), ('no exited lots', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, False], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]), ('auction reopened', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': True, 'round': 2, 'last_round': 1}, [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]])]
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))['excess-demand'], 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 = [min(o,r) if a else o for o,r,a in zip(x["old"],x["requested"],x["accepted"])]
    v1 = [0 if e else q for e,q in zip(x["exited"],x["requested"])]
    v2 = [p if a else old for p,old,a in zip(x["prices"],x["previous_prices"],x["accepted"])]
    v3 = [min(q,c) for q,c in zip(x["requested"],x["caps"])]
    v4 = [max(0,s-q) for q,s in zip(x["old"],x["supply"])]
    v5 = [i for i,(q,s) in enumerate(zip(x["old"],x["supply"])) if q>s]
    v6 = [d if p>=w else o for d,p,w,o in zip(x["deferred"],x["prices"],x["withdrawal_prices"],x["old"])]
    v7 = all(q<=s for q,s in zip(x["old"],x["supply"]))
    v8 = [a and p!=o for a,p,o in zip(x["accepted"],x["prices"],x["previous_prices"])]
    v9 = x["old"] if x["round"]<=x["last_round"] else x["requested"]
    return {'accepted-reduction':v0,'irreversible-exit':v1,'posted-price-lock':v2,'demand-cap':v3,'excess-demand':v4,'clock-step-selection':v5,'deferred-exit-trigger':v6,'round-clearing-quiescence':v7,'price-change-ack':v8,'round-demand-replay':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('cross lot surplus', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 9], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[1, 0], [2, 0], [3, 0], [4, 0], [5, 0]]), ('shortage disappears', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [9, 9], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0]]), ('normal contract', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]), ('unequal demand caps', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [1, 5], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]), ('balanced lots', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [5, 3], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0]]), ('exit at trigger', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [9, 25], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]), ('all accepted', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, True], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]), ('none accepted', {'old': [5, 3], 'requested': [2, 4], 'accepted': [False, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]), ('no exited lots', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, False], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]), ('auction reopened', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': True, 'round': 2, 'last_round': 1}, [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]])]
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))['excess-demand'], 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:
The clock treats spare supply as negative excess or reverses shortage.

One bounded clock-auction round maintains per-lot demand at posted prices. Demand reductions become binding only at accepted clock prices; exits cannot be undone; deferred reductions are reconsidered against the new price. Arrays are aligned by lot and values are nonnegative integers. Named decision excess-demand: Report only unmet demand on each lot.

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = [min(o,r) if a else o for o,r,a in zip(x["old"],x["requested"],x["accepted"])]
    v1 = [0 if e else q for e,q in zip(x["exited"],x["requested"])]
    v2 = [p if a else old for p,old,a in zip(x["prices"],x["previous_prices"],x["accepted"])]
    v3 = [min(q,c) for q,c in zip(x["requested"],x["caps"])]
    v4 = [max(0,q-s) for q,s in zip(x["old"],x["supply"])]
    v5 = list(range(len(x["old"])))
    v6 = [d if p>=w else o for d,p,w,o in zip(x["deferred"],x["prices"],x["withdrawal_prices"],x["old"])]
    v7 = all(q<=s for q,s in zip(x["old"],x["supply"]))
    v8 = [a and p!=o for a,p,o in zip(x["accepted"],x["prices"],x["previous_prices"])]
    v9 = x["old"] if x["round"]<=x["last_round"] else x["requested"]
    return {'accepted-reduction':v0,'irreversible-exit':v1,'posted-price-lock':v2,'demand-cap':v3,'excess-demand':v4,'clock-step-selection':v5,'deferred-exit-trigger':v6,'round-clearing-quiescence':v7,'price-change-ack':v8,'round-demand-replay':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('balanced lots', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [5, 3], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[], [], [], [], []]), ('cross lot surplus', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 9], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[0], [0], [0], [0], [0]]), ('unequal demand caps / balanced lots', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [1, 5], 'supply': [5, 3], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[], [], [], [], []]), ('normal contract', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[0, 1], [0, 1], [0, 1], [0, 1], [0, 1]]), ('unequal demand caps', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [1, 5], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[0, 1], [0, 1], [0, 1], [0, 1], [0, 1]]), ('exit at trigger', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [9, 25], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[0, 1], [0, 1], [0, 1], [0, 1], [0, 1]]), ('all accepted', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, True], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[0, 1], [0, 1], [0, 1], [0, 1], [0, 1]]), ('none accepted', {'old': [5, 3], 'requested': [2, 4], 'accepted': [False, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[0, 1], [0, 1], [0, 1], [0, 1], [0, 1]]), ('no exited lots', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, False], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[0, 1], [0, 1], [0, 1], [0, 1], [0, 1]]), ('auction reopened', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': True, 'round': 2, 'last_round': 1}, [[0, 1], [0, 1], [0, 1], [0, 1], [0, 1]])]
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))['clock-step-selection'], 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 = [min(o,r) if a else o for o,r,a in zip(x["old"],x["requested"],x["accepted"])]
    v1 = [0 if e else q for e,q in zip(x["exited"],x["requested"])]
    v2 = [p if a else old for p,old,a in zip(x["prices"],x["previous_prices"],x["accepted"])]
    v3 = [min(q,c) for q,c in zip(x["requested"],x["caps"])]
    v4 = [max(0,q-s) for q,s in zip(x["old"],x["supply"])]
    v5 = [i for i,(q,s) in enumerate(zip(x["old"],x["supply"])) if q>=s]
    v6 = [d if p>=w else o for d,p,w,o in zip(x["deferred"],x["prices"],x["withdrawal_prices"],x["old"])]
    v7 = all(q<=s for q,s in zip(x["old"],x["supply"]))
    v8 = [a and p!=o for a,p,o in zip(x["accepted"],x["prices"],x["previous_prices"])]
    v9 = x["old"] if x["round"]<=x["last_round"] else x["requested"]
    return {'accepted-reduction':v0,'irreversible-exit':v1,'posted-price-lock':v2,'demand-cap':v3,'excess-demand':v4,'clock-step-selection':v5,'deferred-exit-trigger':v6,'round-clearing-quiescence':v7,'price-change-ack':v8,'round-demand-replay':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('balanced lots', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [5, 3], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[], [], [], [], []]), ('cross lot surplus', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 9], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[0], [0], [0], [0], [0]]), ('unequal demand caps / balanced lots', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [1, 5], 'supply': [5, 3], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[], [], [], [], []]), ('normal contract', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[0, 1], [0, 1], [0, 1], [0, 1], [0, 1]]), ('unequal demand caps', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [1, 5], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[0, 1], [0, 1], [0, 1], [0, 1], [0, 1]]), ('exit at trigger', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [9, 25], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[0, 1], [0, 1], [0, 1], [0, 1], [0, 1]]), ('all accepted', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, True], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[0, 1], [0, 1], [0, 1], [0, 1], [0, 1]]), ('none accepted', {'old': [5, 3], 'requested': [2, 4], 'accepted': [False, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[0, 1], [0, 1], [0, 1], [0, 1], [0, 1]]), ('no exited lots', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, False], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[0, 1], [0, 1], [0, 1], [0, 1], [0, 1]]), ('auction reopened', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': True, 'round': 2, 'last_round': 1}, [[0, 1], [0, 1], [0, 1], [0, 1], [0, 1]])]
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))['clock-step-selection'], 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:
Clock price increments apply to balanced lots.

One bounded clock-auction round maintains per-lot demand at posted prices. Demand reductions become binding only at accepted clock prices; exits cannot be undone; deferred reductions are reconsidered against the new price. Arrays are aligned by lot and values are nonnegative integers. Named decision clock-step-selection: Advance prices only for strictly overdemanded lots.

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = [min(o,r) if a else o for o,r,a in zip(x["old"],x["requested"],x["accepted"])]
    v1 = [0 if e else q for e,q in zip(x["exited"],x["requested"])]
    v2 = [p if a else old for p,old,a in zip(x["prices"],x["previous_prices"],x["accepted"])]
    v3 = [min(q,c) for q,c in zip(x["requested"],x["caps"])]
    v4 = [max(0,q-s) for q,s in zip(x["old"],x["supply"])]
    v5 = [i for i,(q,s) in enumerate(zip(x["old"],x["supply"])) if q>s]
    v6 = x["deferred"]
    v7 = all(q<=s for q,s in zip(x["old"],x["supply"]))
    v8 = [a and p!=o for a,p,o in zip(x["accepted"],x["prices"],x["previous_prices"])]
    v9 = x["old"] if x["round"]<=x["last_round"] else x["requested"]
    return {'accepted-reduction':v0,'irreversible-exit':v1,'posted-price-lock':v2,'demand-cap':v3,'excess-demand':v4,'clock-step-selection':v5,'deferred-exit-trigger':v6,'round-clearing-quiescence':v7,'price-change-ack':v8,'round-demand-replay':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[1, 3], [2, 6], [3, 9], [4, 12], [5, 15]]), ('unequal demand caps', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [1, 5], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[1, 3], [2, 6], [3, 9], [4, 12], [5, 15]]), ('exit at trigger', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [9, 25], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[1, 2], [2, 4], [3, 6], [4, 8], [5, 10]]), ('unequal demand caps / exit at trigger', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [9, 25], 'previous_prices': [8, 20], 'caps': [1, 5], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[1, 2], [2, 4], [3, 6], [4, 8], [5, 10]]), ('balanced lots', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [5, 3], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[1, 3], [2, 6], [3, 9], [4, 12], [5, 15]]), ('cross lot surplus', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 9], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[1, 3], [2, 6], [3, 9], [4, 12], [5, 15]]), ('all accepted', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, True], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[1, 3], [2, 6], [3, 9], [4, 12], [5, 15]]), ('none accepted', {'old': [5, 3], 'requested': [2, 4], 'accepted': [False, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[1, 3], [2, 6], [3, 9], [4, 12], [5, 15]]), ('no exited lots', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, False], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[1, 3], [2, 6], [3, 9], [4, 12], [5, 15]]), ('auction reopened', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': True, 'round': 2, 'last_round': 1}, [[1, 3], [2, 6], [3, 9], [4, 12], [5, 15]])]
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))['deferred-exit-trigger'], 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 = [min(o,r) if a else o for o,r,a in zip(x["old"],x["requested"],x["accepted"])]
    v1 = [0 if e else q for e,q in zip(x["exited"],x["requested"])]
    v2 = [p if a else old for p,old,a in zip(x["prices"],x["previous_prices"],x["accepted"])]
    v3 = [min(q,c) for q,c in zip(x["requested"],x["caps"])]
    v4 = [max(0,q-s) for q,s in zip(x["old"],x["supply"])]
    v5 = [i for i,(q,s) in enumerate(zip(x["old"],x["supply"])) if q>s]
    v6 = [d if p>w else o for d,p,w,o in zip(x["deferred"],x["prices"],x["withdrawal_prices"],x["old"])]
    v7 = all(q<=s for q,s in zip(x["old"],x["supply"]))
    v8 = [a and p!=o for a,p,o in zip(x["accepted"],x["prices"],x["previous_prices"])]
    v9 = x["old"] if x["round"]<=x["last_round"] else x["requested"]
    return {'accepted-reduction':v0,'irreversible-exit':v1,'posted-price-lock':v2,'demand-cap':v3,'excess-demand':v4,'clock-step-selection':v5,'deferred-exit-trigger':v6,'round-clearing-quiescence':v7,'price-change-ack':v8,'round-demand-replay':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[1, 3], [2, 6], [3, 9], [4, 12], [5, 15]]), ('unequal demand caps', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [1, 5], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[1, 3], [2, 6], [3, 9], [4, 12], [5, 15]]), ('exit at trigger', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [9, 25], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[1, 2], [2, 4], [3, 6], [4, 8], [5, 10]]), ('unequal demand caps / exit at trigger', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [9, 25], 'previous_prices': [8, 20], 'caps': [1, 5], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[1, 2], [2, 4], [3, 6], [4, 8], [5, 10]]), ('balanced lots', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [5, 3], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[1, 3], [2, 6], [3, 9], [4, 12], [5, 15]]), ('cross lot surplus', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 9], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[1, 3], [2, 6], [3, 9], [4, 12], [5, 15]]), ('all accepted', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, True], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[1, 3], [2, 6], [3, 9], [4, 12], [5, 15]]), ('none accepted', {'old': [5, 3], 'requested': [2, 4], 'accepted': [False, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[1, 3], [2, 6], [3, 9], [4, 12], [5, 15]]), ('no exited lots', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, False], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [[1, 3], [2, 6], [3, 9], [4, 12], [5, 15]]), ('auction reopened', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': True, 'round': 2, 'last_round': 1}, [[1, 3], [2, 6], [3, 9], [4, 12], [5, 15]])]
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))['deferred-exit-trigger'], 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 queued withdrawal fires before its accepted trigger price.

One bounded clock-auction round maintains per-lot demand at posted prices. Demand reductions become binding only at accepted clock prices; exits cannot be undone; deferred reductions are reconsidered against the new price. Arrays are aligned by lot and values are nonnegative integers. Named decision deferred-exit-trigger: Apply deferred quantities when the posted price reaches the withdrawal trigger.

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = [min(o,r) if a else o for o,r,a in zip(x["old"],x["requested"],x["accepted"])]
    v1 = [0 if e else q for e,q in zip(x["exited"],x["requested"])]
    v2 = [p if a else old for p,old,a in zip(x["prices"],x["previous_prices"],x["accepted"])]
    v3 = [min(q,c) for q,c in zip(x["requested"],x["caps"])]
    v4 = [max(0,q-s) for q,s in zip(x["old"],x["supply"])]
    v5 = [i for i,(q,s) in enumerate(zip(x["old"],x["supply"])) if q>s]
    v6 = [d if p>=w else o for d,p,w,o in zip(x["deferred"],x["prices"],x["withdrawal_prices"],x["old"])]
    v7 = sum(x["old"])<=sum(x["supply"])
    v8 = [a and p!=o for a,p,o in zip(x["accepted"],x["prices"],x["previous_prices"])]
    v9 = x["old"] if x["round"]<=x["last_round"] else x["requested"]
    return {'accepted-reduction':v0,'irreversible-exit':v1,'posted-price-lock':v2,'demand-cap':v3,'excess-demand':v4,'clock-step-selection':v5,'deferred-exit-trigger':v6,'round-clearing-quiescence':v7,'price-change-ack':v8,'round-demand-replay':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('cross lot surplus', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 9], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [False, False, False, False, False]), ('unequal demand caps / cross lot surplus', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [1, 5], 'supply': [4, 9], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [False, False, False, False, False]), ('balanced lots', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [5, 3], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [True, True, True, True, True]), ('unequal demand caps / balanced lots', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [1, 5], 'supply': [5, 3], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [True, True, True, True, True]), ('normal contract', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [False, False, False, False, False]), ('unequal demand caps', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [1, 5], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [False, False, False, False, False]), ('exit at trigger', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [9, 25], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [False, False, False, False, False]), ('all accepted', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, True], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [False, False, False, False, False]), ('none accepted', {'old': [5, 3], 'requested': [2, 4], 'accepted': [False, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [False, False, False, False, False]), ('no exited lots', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, False], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [False, False, False, False, False]), ('auction reopened', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': True, 'round': 2, 'last_round': 1}, [False, False, False, False, False])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['round-clearing-quiescence'], 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 = [min(o,r) if a else o for o,r,a in zip(x["old"],x["requested"],x["accepted"])]
    v1 = [0 if e else q for e,q in zip(x["exited"],x["requested"])]
    v2 = [p if a else old for p,old,a in zip(x["prices"],x["previous_prices"],x["accepted"])]
    v3 = [min(q,c) for q,c in zip(x["requested"],x["caps"])]
    v4 = [max(0,q-s) for q,s in zip(x["old"],x["supply"])]
    v5 = [i for i,(q,s) in enumerate(zip(x["old"],x["supply"])) if q>s]
    v6 = [d if p>=w else o for d,p,w,o in zip(x["deferred"],x["prices"],x["withdrawal_prices"],x["old"])]
    v7 = all(q<s for q,s in zip(x["old"],x["supply"]))
    v8 = [a and p!=o for a,p,o in zip(x["accepted"],x["prices"],x["previous_prices"])]
    v9 = x["old"] if x["round"]<=x["last_round"] else x["requested"]
    return {'accepted-reduction':v0,'irreversible-exit':v1,'posted-price-lock':v2,'demand-cap':v3,'excess-demand':v4,'clock-step-selection':v5,'deferred-exit-trigger':v6,'round-clearing-quiescence':v7,'price-change-ack':v8,'round-demand-replay':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('cross lot surplus', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 9], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [False, False, False, False, False]), ('unequal demand caps / cross lot surplus', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [1, 5], 'supply': [4, 9], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [False, False, False, False, False]), ('balanced lots', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [5, 3], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [True, True, True, True, True]), ('unequal demand caps / balanced lots', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [1, 5], 'supply': [5, 3], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [True, True, True, True, True]), ('normal contract', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [False, False, False, False, False]), ('unequal demand caps', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [1, 5], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [False, False, False, False, False]), ('exit at trigger', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [9, 25], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [False, False, False, False, False]), ('all accepted', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, True], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [False, False, False, False, False]), ('none accepted', {'old': [5, 3], 'requested': [2, 4], 'accepted': [False, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [False, False, False, False, False]), ('no exited lots', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, False], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': False, 'round': 2, 'last_round': 1}, [False, False, False, False, False]), ('auction reopened', {'old': [5, 3], 'requested': [2, 4], 'accepted': [True, False], 'exited': [False, True], 'prices': [10, 20], 'previous_prices': [8, 20], 'caps': [3, 3], 'supply': [4, 2], 'deferred': [1, 2], 'withdrawal_prices': [9, 25], 'reopened': True, 'round': 2, 'last_round': 1}, [False, False, False, False, False])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['round-clearing-quiescence'], 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:
Surplus on one lot hides unmet demand on another at clock close.

One bounded clock-auction round maintains per-lot demand at posted prices. Demand reductions become binding only at accepted clock prices; exits cannot be undone; deferred reductions are reconsidered against the new price. Arrays are aligned by lot and values are nonnegative integers. Named decision round-clearing-quiescence: Require every lot to be non-overdemanded before closing the round.

split: open-access