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

N = 1
observations = []
def solve(x):
    v0 = x["cleared"]>=x["required"]
    v1 = max(0,x["cleared"]-x["restricted"])
    v2 = x["waiver"] or x["cleared"]>=x["required"]
    v3 = x["auction"]==x["deposit_auction"]
    v4 = x["currency"]==x["deposit_currency"]
    v5 = x["cleared"]
    v6 = max(0,x["cleared"]-x["locked"])
    v7 = x["owner"]==x["beneficiary"] and x["owner"] in x["owners"]
    v8 = 0 if x["expired"] else x["cleared"]+(x["topup"] if x["confirmed"] else 0)
    v9 = min(x["refunded"],max(0,x["cleared"]-x["locked"]))
    return {'cleared-admission':v0,'restricted-tranche':v1,'deposit-waiver-admission':v2,'auction-scope':v3,'denomination-scope':v4,'chargeback-recovery':v5,'withdrawable-deposit':v6,'beneficial-owner':v7,'topup-posting':v8,'refund-available-ceiling':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [17, 34, 51, 68, 85]), ('cleared sufficient', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 10, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [17, 34, 51, 68, 85]), ('chargeback consumes balance', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 30, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [0, 0, 0, 0, 0]), ('cleared sufficient / chargeback consumes balance', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 10, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 30, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [0, 0, 0, 0, 0]), ('deposit waived', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': True, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [17, 34, 51, 68, 85]), ('wrong auction', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'B', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [17, 34, 51, 68, 85]), ('wrong denomination', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'ALT', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [17, 34, 51, 68, 85]), ('expired deposit', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': True, 'topup': 8, 'confirmed': False, 'refunded': 4}, [17, 34, 51, 68, 85]), ('topup confirmed', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': True, 'refunded': 4}, [17, 34, 51, 68, 85]), ('all locked', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 30, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [17, 34, 51, 68, 85])]
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))['chargeback-recovery'], expected[N-1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(x):
    v0 = x["cleared"]>=x["required"]
    v1 = max(0,x["cleared"]-x["restricted"])
    v2 = x["waiver"] or x["cleared"]>=x["required"]
    v3 = x["auction"]==x["deposit_auction"]
    v4 = x["currency"]==x["deposit_currency"]
    v5 = x["cleared"]-x["chargeback"]
    v6 = max(0,x["cleared"]-x["locked"])
    v7 = x["owner"]==x["beneficiary"] and x["owner"] in x["owners"]
    v8 = 0 if x["expired"] else x["cleared"]+(x["topup"] if x["confirmed"] else 0)
    v9 = min(x["refunded"],max(0,x["cleared"]-x["locked"]))
    return {'cleared-admission':v0,'restricted-tranche':v1,'deposit-waiver-admission':v2,'auction-scope':v3,'denomination-scope':v4,'chargeback-recovery':v5,'withdrawable-deposit':v6,'beneficial-owner':v7,'topup-posting':v8,'refund-available-ceiling':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [17, 34, 51, 68, 85]), ('cleared sufficient', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 10, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [17, 34, 51, 68, 85]), ('chargeback consumes balance', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 30, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [0, 0, 0, 0, 0]), ('cleared sufficient / chargeback consumes balance', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 10, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 30, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [0, 0, 0, 0, 0]), ('deposit waived', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': True, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [17, 34, 51, 68, 85]), ('wrong auction', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'B', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [17, 34, 51, 68, 85]), ('wrong denomination', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'ALT', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [17, 34, 51, 68, 85]), ('expired deposit', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': True, 'topup': 8, 'confirmed': False, 'refunded': 4}, [17, 34, 51, 68, 85]), ('topup confirmed', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': True, 'refunded': 4}, [17, 34, 51, 68, 85]), ('all locked', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 30, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [17, 34, 51, 68, 85])]
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))['chargeback-recovery'], 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:
Chargeback reversal leaves admission collateral overstated or negative.

Toy bidder deposits consist of cleared, pending and restricted tranches. Deposits are auction-scoped and denomination-specific. Admission capacity is per bidder; a waiver substitutes for a required deposit without turning a pending transfer into cash. Named decision chargeback-recovery: For chargeback recovery, apply the stipulated decision max(0,x["cleared"]-x["chargeback"]).

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = x["cleared"]>=x["required"]
    v1 = max(0,x["cleared"]-x["restricted"])
    v2 = x["waiver"] or x["cleared"]>=x["required"]
    v3 = x["auction"]==x["deposit_auction"]
    v4 = x["currency"]==x["deposit_currency"]
    v5 = max(0,x["cleared"]-x["chargeback"])
    v6 = x["cleared"]
    v7 = x["owner"]==x["beneficiary"] and x["owner"] in x["owners"]
    v8 = 0 if x["expired"] else x["cleared"]+(x["topup"] if x["confirmed"] else 0)
    v9 = min(x["refunded"],max(0,x["cleared"]-x["locked"]))
    return {'cleared-admission':v0,'restricted-tranche':v1,'deposit-waiver-admission':v2,'auction-scope':v3,'denomination-scope':v4,'chargeback-recovery':v5,'withdrawable-deposit':v6,'beneficial-owner':v7,'topup-posting':v8,'refund-available-ceiling':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [14, 28, 42, 56, 70]), ('cleared sufficient', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 10, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [14, 28, 42, 56, 70]), ('deposit waived', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': True, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [14, 28, 42, 56, 70]), ('wrong auction', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'B', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [14, 28, 42, 56, 70]), ('wrong denomination', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'ALT', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [14, 28, 42, 56, 70]), ('expired deposit', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': True, 'topup': 8, 'confirmed': False, 'refunded': 4}, [14, 28, 42, 56, 70]), ('topup confirmed', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': True, 'refunded': 4}, [14, 28, 42, 56, 70]), ('chargeback consumes balance', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 30, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [14, 28, 42, 56, 70]), ('all locked', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 30, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [0, 0, 0, 0, 0])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['withdrawable-deposit'], expected[N-1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

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

N = 1
observations = []
def solve(x):
    v0 = x["cleared"]>=x["required"]
    v1 = max(0,x["cleared"]-x["restricted"])
    v2 = x["waiver"] or x["cleared"]>=x["required"]
    v3 = x["auction"]==x["deposit_auction"]
    v4 = x["currency"]==x["deposit_currency"]
    v5 = max(0,x["cleared"]-x["chargeback"])
    v6 = max(0,x["cleared"]-x["restricted"])
    v7 = x["owner"]==x["beneficiary"] and x["owner"] in x["owners"]
    v8 = 0 if x["expired"] else x["cleared"]+(x["topup"] if x["confirmed"] else 0)
    v9 = min(x["refunded"],max(0,x["cleared"]-x["locked"]))
    return {'cleared-admission':v0,'restricted-tranche':v1,'deposit-waiver-admission':v2,'auction-scope':v3,'denomination-scope':v4,'chargeback-recovery':v5,'withdrawable-deposit':v6,'beneficial-owner':v7,'topup-posting':v8,'refund-available-ceiling':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [14, 28, 42, 56, 70]), ('cleared sufficient', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 10, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [14, 28, 42, 56, 70]), ('deposit waived', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': True, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [14, 28, 42, 56, 70]), ('wrong auction', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'B', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [14, 28, 42, 56, 70]), ('wrong denomination', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'ALT', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [14, 28, 42, 56, 70]), ('expired deposit', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': True, 'topup': 8, 'confirmed': False, 'refunded': 4}, [14, 28, 42, 56, 70]), ('topup confirmed', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': True, 'refunded': 4}, [14, 28, 42, 56, 70]), ('chargeback consumes balance', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 30, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [14, 28, 42, 56, 70]), ('all locked', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 30, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [0, 0, 0, 0, 0])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['withdrawable-deposit'], 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:
Collateral locked to awards is withdrawn as free deposit.

Toy bidder deposits consist of cleared, pending and restricted tranches. Deposits are auction-scoped and denomination-specific. Admission capacity is per bidder; a waiver substitutes for a required deposit without turning a pending transfer into cash. Named decision withdrawable-deposit: For withdrawable deposit, apply the stipulated decision max(0,x["cleared"]-x["locked"]).

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = x["cleared"]>=x["required"]
    v1 = max(0,x["cleared"]-x["restricted"])
    v2 = x["waiver"] or x["cleared"]>=x["required"]
    v3 = x["auction"]==x["deposit_auction"]
    v4 = x["currency"]==x["deposit_currency"]
    v5 = max(0,x["cleared"]-x["chargeback"])
    v6 = max(0,x["cleared"]-x["locked"])
    v7 = x["owner"] in x["owners"]
    v8 = 0 if x["expired"] else x["cleared"]+(x["topup"] if x["confirmed"] else 0)
    v9 = min(x["refunded"],max(0,x["cleared"]-x["locked"]))
    return {'cleared-admission':v0,'restricted-tranche':v1,'deposit-waiver-admission':v2,'auction-scope':v3,'denomination-scope':v4,'chargeback-recovery':v5,'withdrawable-deposit':v6,'beneficial-owner':v7,'topup-posting':v8,'refund-available-ceiling':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('wrong beneficiary', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'b', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [False, False, False, False, False]), ('cleared sufficient / wrong beneficiary', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 10, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'b', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [False, False, False, False, False]), ('no owners', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': [], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [False, False, False, False, False]), ('cleared sufficient / no owners', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 10, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': [], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [False, False, False, False, False]), ('normal contract', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [True, True, True, True, True]), ('cleared sufficient', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 10, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [True, True, True, True, True]), ('deposit waived', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': True, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [True, True, True, True, True]), ('wrong auction', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'B', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [True, True, True, True, True]), ('wrong denomination', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'ALT', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [True, True, True, True, True]), ('expired deposit', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': True, 'topup': 8, 'confirmed': False, 'refunded': 4}, [True, True, True, True, True]), ('topup confirmed', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': True, 'refunded': 4}, [True, True, True, True, True]), ('chargeback consumes balance', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 30, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [True, True, True, True, True]), ('all locked', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 30, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [True, True, True, True, True])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', '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))['beneficial-owner'], expected[N-1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(x):
    v0 = x["cleared"]>=x["required"]
    v1 = max(0,x["cleared"]-x["restricted"])
    v2 = x["waiver"] or x["cleared"]>=x["required"]
    v3 = x["auction"]==x["deposit_auction"]
    v4 = x["currency"]==x["deposit_currency"]
    v5 = max(0,x["cleared"]-x["chargeback"])
    v6 = max(0,x["cleared"]-x["locked"])
    v7 = x["owner"]==x["beneficiary"]
    v8 = 0 if x["expired"] else x["cleared"]+(x["topup"] if x["confirmed"] else 0)
    v9 = min(x["refunded"],max(0,x["cleared"]-x["locked"]))
    return {'cleared-admission':v0,'restricted-tranche':v1,'deposit-waiver-admission':v2,'auction-scope':v3,'denomination-scope':v4,'chargeback-recovery':v5,'withdrawable-deposit':v6,'beneficial-owner':v7,'topup-posting':v8,'refund-available-ceiling':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('wrong beneficiary', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'b', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [False, False, False, False, False]), ('cleared sufficient / wrong beneficiary', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 10, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'b', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [False, False, False, False, False]), ('no owners', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': [], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [False, False, False, False, False]), ('cleared sufficient / no owners', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 10, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': [], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [False, False, False, False, False]), ('normal contract', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [True, True, True, True, True]), ('cleared sufficient', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 10, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [True, True, True, True, True]), ('deposit waived', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': True, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [True, True, True, True, True]), ('wrong auction', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'B', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [True, True, True, True, True]), ('wrong denomination', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'ALT', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [True, True, True, True, True]), ('expired deposit', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': True, 'topup': 8, 'confirmed': False, 'refunded': 4}, [True, True, True, True, True]), ('topup confirmed', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': True, 'refunded': 4}, [True, True, True, True, True]), ('chargeback consumes balance', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 30, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [True, True, True, True, True]), ('all locked', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 30, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [True, True, True, True, True])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', '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))['beneficial-owner'], 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:
Third-party beneficiary deposits satisfy bidder-owned collateral checks.

Toy bidder deposits consist of cleared, pending and restricted tranches. Deposits are auction-scoped and denomination-specific. Admission capacity is per bidder; a waiver substitutes for a required deposit without turning a pending transfer into cash. Named decision beneficial-owner: For beneficial owner, apply the stipulated decision x["owner"]==x["beneficiary"] and x["owner"] in x["owners"].

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = x["cleared"]>=x["required"]
    v1 = max(0,x["cleared"]-x["restricted"])
    v2 = x["waiver"] or x["cleared"]>=x["required"]
    v3 = x["auction"]==x["deposit_auction"]
    v4 = x["currency"]==x["deposit_currency"]
    v5 = max(0,x["cleared"]-x["chargeback"])
    v6 = max(0,x["cleared"]-x["locked"])
    v7 = x["owner"]==x["beneficiary"] and x["owner"] in x["owners"]
    v8 = x["cleared"]+x["topup"]
    v9 = min(x["refunded"],max(0,x["cleared"]-x["locked"]))
    return {'cleared-admission':v0,'restricted-tranche':v1,'deposit-waiver-admission':v2,'auction-scope':v3,'denomination-scope':v4,'chargeback-recovery':v5,'withdrawable-deposit':v6,'beneficial-owner':v7,'topup-posting':v8,'refund-available-ceiling':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [20, 40, 60, 80, 100]), ('cleared sufficient', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 10, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [20, 40, 60, 80, 100]), ('expired deposit', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': True, 'topup': 8, 'confirmed': False, 'refunded': 4}, [0, 0, 0, 0, 0]), ('cleared sufficient / expired deposit', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 10, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': True, 'topup': 8, 'confirmed': False, 'refunded': 4}, [0, 0, 0, 0, 0]), ('deposit waived', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': True, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [20, 40, 60, 80, 100]), ('wrong auction', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'B', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [20, 40, 60, 80, 100]), ('wrong denomination', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'ALT', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [20, 40, 60, 80, 100]), ('topup confirmed', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': True, 'refunded': 4}, [28, 56, 84, 112, 140]), ('chargeback consumes balance', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 30, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [20, 40, 60, 80, 100]), ('all locked', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 30, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [20, 40, 60, 80, 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))['topup-posting'], expected[N-1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(x):
    v0 = x["cleared"]>=x["required"]
    v1 = max(0,x["cleared"]-x["restricted"])
    v2 = x["waiver"] or x["cleared"]>=x["required"]
    v3 = x["auction"]==x["deposit_auction"]
    v4 = x["currency"]==x["deposit_currency"]
    v5 = max(0,x["cleared"]-x["chargeback"])
    v6 = max(0,x["cleared"]-x["locked"])
    v7 = x["owner"]==x["beneficiary"] and x["owner"] in x["owners"]
    v8 = x["cleared"]+(x["topup"] if x["confirmed"] else 0)
    v9 = min(x["refunded"],max(0,x["cleared"]-x["locked"]))
    return {'cleared-admission':v0,'restricted-tranche':v1,'deposit-waiver-admission':v2,'auction-scope':v3,'denomination-scope':v4,'chargeback-recovery':v5,'withdrawable-deposit':v6,'beneficial-owner':v7,'topup-posting':v8,'refund-available-ceiling':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [20, 40, 60, 80, 100]), ('cleared sufficient', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 10, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [20, 40, 60, 80, 100]), ('expired deposit', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': True, 'topup': 8, 'confirmed': False, 'refunded': 4}, [0, 0, 0, 0, 0]), ('cleared sufficient / expired deposit', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 10, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': True, 'topup': 8, 'confirmed': False, 'refunded': 4}, [0, 0, 0, 0, 0]), ('deposit waived', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': True, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [20, 40, 60, 80, 100]), ('wrong auction', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'B', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [20, 40, 60, 80, 100]), ('wrong denomination', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'ALT', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [20, 40, 60, 80, 100]), ('topup confirmed', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': True, 'refunded': 4}, [28, 56, 84, 112, 140]), ('chargeback consumes balance', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 30, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [20, 40, 60, 80, 100]), ('all locked', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 30, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [20, 40, 60, 80, 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))['topup-posting'], 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:
Topups restore an expired deposit or post before confirmation.

Toy bidder deposits consist of cleared, pending and restricted tranches. Deposits are auction-scoped and denomination-specific. Admission capacity is per bidder; a waiver substitutes for a required deposit without turning a pending transfer into cash. Named decision topup-posting: For topup posting, apply the stipulated decision 0 if x["expired"] else x["cleared"]+(x["topup"] if x["confirmed"] else 0).

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = x["cleared"]>=x["required"]
    v1 = max(0,x["cleared"]-x["restricted"])
    v2 = x["waiver"] or x["cleared"]>=x["required"]
    v3 = x["auction"]==x["deposit_auction"]
    v4 = x["currency"]==x["deposit_currency"]
    v5 = max(0,x["cleared"]-x["chargeback"])
    v6 = max(0,x["cleared"]-x["locked"])
    v7 = x["owner"]==x["beneficiary"] and x["owner"] in x["owners"]
    v8 = 0 if x["expired"] else x["cleared"]+(x["topup"] if x["confirmed"] else 0)
    v9 = min(x["refunded"],x["cleared"])
    return {'cleared-admission':v0,'restricted-tranche':v1,'deposit-waiver-admission':v2,'auction-scope':v3,'denomination-scope':v4,'chargeback-recovery':v5,'withdrawable-deposit':v6,'beneficial-owner':v7,'topup-posting':v8,'refund-available-ceiling':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('all locked', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 30, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [0, 0, 0, 0, 0]), ('over refund', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 30}, [14, 28, 42, 56, 70]), ('normal contract', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [4, 8, 12, 16, 20]), ('cleared sufficient', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 10, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [4, 8, 12, 16, 20]), ('deposit waived', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': True, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [4, 8, 12, 16, 20]), ('wrong auction', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'B', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [4, 8, 12, 16, 20]), ('wrong denomination', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'ALT', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [4, 8, 12, 16, 20]), ('expired deposit', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': True, 'topup': 8, 'confirmed': False, 'refunded': 4}, [4, 8, 12, 16, 20]), ('topup confirmed', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': True, 'refunded': 4}, [4, 8, 12, 16, 20]), ('chargeback consumes balance', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 30, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [4, 8, 12, 16, 20])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', '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))['refund-available-ceiling'], expected[N-1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(x):
    v0 = x["cleared"]>=x["required"]
    v1 = max(0,x["cleared"]-x["restricted"])
    v2 = x["waiver"] or x["cleared"]>=x["required"]
    v3 = x["auction"]==x["deposit_auction"]
    v4 = x["currency"]==x["deposit_currency"]
    v5 = max(0,x["cleared"]-x["chargeback"])
    v6 = max(0,x["cleared"]-x["locked"])
    v7 = x["owner"]==x["beneficiary"] and x["owner"] in x["owners"]
    v8 = 0 if x["expired"] else x["cleared"]+(x["topup"] if x["confirmed"] else 0)
    v9 = x["refunded"]
    return {'cleared-admission':v0,'restricted-tranche':v1,'deposit-waiver-admission':v2,'auction-scope':v3,'denomination-scope':v4,'chargeback-recovery':v5,'withdrawable-deposit':v6,'beneficial-owner':v7,'topup-posting':v8,'refund-available-ceiling':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('all locked', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 30, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [0, 0, 0, 0, 0]), ('over refund', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 30}, [14, 28, 42, 56, 70]), ('normal contract', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [4, 8, 12, 16, 20]), ('cleared sufficient', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 10, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [4, 8, 12, 16, 20]), ('deposit waived', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': True, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [4, 8, 12, 16, 20]), ('wrong auction', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'B', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [4, 8, 12, 16, 20]), ('wrong denomination', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'ALT', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [4, 8, 12, 16, 20]), ('expired deposit', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': True, 'topup': 8, 'confirmed': False, 'refunded': 4}, [4, 8, 12, 16, 20]), ('topup confirmed', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 3, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': True, 'refunded': 4}, [4, 8, 12, 16, 20]), ('chargeback consumes balance', {'cleared': 20, 'pending': 15, 'restricted': 7, 'required': 25, 'waiver': False, 'auction': 'A', 'deposit_auction': 'A', 'currency': 'TOK', 'deposit_currency': 'TOK', 'chargeback': 30, 'locked': 6, 'owners': ['a', 'b'], 'owner': 'a', 'beneficiary': 'a', 'expired': False, 'topup': 8, 'confirmed': False, 'refunded': 4}, [4, 8, 12, 16, 20])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', '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))['refund-available-ceiling'], 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 deposit refund consumes award-locked collateral.

Toy bidder deposits consist of cleared, pending and restricted tranches. Deposits are auction-scoped and denomination-specific. Admission capacity is per bidder; a waiver substitutes for a required deposit without turning a pending transfer into cash. Named decision refund-available-ceiling: For refund available ceiling, apply the stipulated decision min(x["refunded"],max(0,x["cleared"]-x["locked"])).

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = x["inspected"]
    v1 = max(0,min(x["delivered"],x["inspected"])-x["rejected"])
    v2 = max(0,x["awarded"]-x["delivered"])
    v3 = x["buyer_signed"] and x["seller_signed"]
    v4 = set(x["lots"])<=set(x["certificate"])
    v5 = [i for i in x["lots"] if i in x["certificate"] and i not in x["damaged"]]
    v6 = min(x["paid"],max(0,min(x["delivered"],x["inspected"])-x["rejected"])*x["unit_price"])
    v7 = max(0,x["delivered"]-x["returned"])
    v8 = x["storage"] if x["now"]>x["deadline"] else 0
    v9 = 0 if x["disputed"] else max(0,x["paid"]-x["freight"])
    return {'inspectable-units':v0,'accepted-unit-count':v1,'award-remainder':v2,'title-acceptance':v3,'certificate-coverage':v4,'undamaged-certificate-release':v5,'payout-payment-cap':v6,'returned-fulfillment':v7,'late-storage-charge':v8,'dispute-payout-hold':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('inspection exceeds delivery', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 8, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [5, 10, 15, 20, 25]), ('wrong certificate same count / inspection exceeds delivery', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 8, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A', 'C'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [5, 10, 15, 20, 25]), ('normal contract', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [4, 8, 12, 16, 20]), ('wrong certificate same count', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A', 'C'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [4, 8, 12, 16, 20]), ('delivery at deadline', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 9, 'disputed': False}, [4, 8, 12, 16, 20]), ('buyer accepts', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': True, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [4, 8, 12, 16, 20]), ('nothing delivered', {'awarded': 8, 'shipped': 6, 'delivered': 0, 'inspected': 0, 'rejected': 0, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [0, 0, 0, 0, 0]), ('all inspected rejected', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 4, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [4, 8, 12, 16, 20]), ('all certified', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A', 'B'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [4, 8, 12, 16, 20]), ('no damage', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': [], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [4, 8, 12, 16, 20])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', '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))['inspectable-units'], 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(x["shipped"],x["inspected"])
    v1 = max(0,min(x["delivered"],x["inspected"])-x["rejected"])
    v2 = max(0,x["awarded"]-x["delivered"])
    v3 = x["buyer_signed"] and x["seller_signed"]
    v4 = set(x["lots"])<=set(x["certificate"])
    v5 = [i for i in x["lots"] if i in x["certificate"] and i not in x["damaged"]]
    v6 = min(x["paid"],max(0,min(x["delivered"],x["inspected"])-x["rejected"])*x["unit_price"])
    v7 = max(0,x["delivered"]-x["returned"])
    v8 = x["storage"] if x["now"]>x["deadline"] else 0
    v9 = 0 if x["disputed"] else max(0,x["paid"]-x["freight"])
    return {'inspectable-units':v0,'accepted-unit-count':v1,'award-remainder':v2,'title-acceptance':v3,'certificate-coverage':v4,'undamaged-certificate-release':v5,'payout-payment-cap':v6,'returned-fulfillment':v7,'late-storage-charge':v8,'dispute-payout-hold':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('inspection exceeds delivery', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 8, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [5, 10, 15, 20, 25]), ('wrong certificate same count / inspection exceeds delivery', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 8, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A', 'C'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [5, 10, 15, 20, 25]), ('normal contract', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [4, 8, 12, 16, 20]), ('wrong certificate same count', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A', 'C'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [4, 8, 12, 16, 20]), ('delivery at deadline', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 9, 'disputed': False}, [4, 8, 12, 16, 20]), ('buyer accepts', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': True, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [4, 8, 12, 16, 20]), ('nothing delivered', {'awarded': 8, 'shipped': 6, 'delivered': 0, 'inspected': 0, 'rejected': 0, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [0, 0, 0, 0, 0]), ('all inspected rejected', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 4, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [4, 8, 12, 16, 20]), ('all certified', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A', 'B'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [4, 8, 12, 16, 20]), ('no damage', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': [], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [4, 8, 12, 16, 20])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', '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))['inspectable-units'], 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:
Inspection credits units still in transit.

Award fulfillment tracks delivered, inspected, rejected and accepted units. Title and seller payout require acceptance, not shipping. Partial shipments and certificates refer to individual auction lot identifiers; freight and storage are fixed integer credits. Named decision inspectable-units: For inspectable units, apply the stipulated decision min(x["delivered"],x["inspected"]).

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = min(x["delivered"],x["inspected"])
    v1 = min(x["delivered"],x["inspected"])
    v2 = max(0,x["awarded"]-x["delivered"])
    v3 = x["buyer_signed"] and x["seller_signed"]
    v4 = set(x["lots"])<=set(x["certificate"])
    v5 = [i for i in x["lots"] if i in x["certificate"] and i not in x["damaged"]]
    v6 = min(x["paid"],max(0,min(x["delivered"],x["inspected"])-x["rejected"])*x["unit_price"])
    v7 = max(0,x["delivered"]-x["returned"])
    v8 = x["storage"] if x["now"]>x["deadline"] else 0
    v9 = 0 if x["disputed"] else max(0,x["paid"]-x["freight"])
    return {'inspectable-units':v0,'accepted-unit-count':v1,'award-remainder':v2,'title-acceptance':v3,'certificate-coverage':v4,'undamaged-certificate-release':v5,'payout-payment-cap':v6,'returned-fulfillment':v7,'late-storage-charge':v8,'dispute-payout-hold':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [3, 6, 9, 12, 15]), ('wrong certificate same count', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A', 'C'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [3, 6, 9, 12, 15]), ('delivery at deadline', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 9, 'disputed': False}, [3, 6, 9, 12, 15]), ('buyer accepts', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': True, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [3, 6, 9, 12, 15]), ('nothing delivered', {'awarded': 8, 'shipped': 6, 'delivered': 0, 'inspected': 0, 'rejected': 0, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [0, 0, 0, 0, 0]), ('inspection exceeds delivery', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 8, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [4, 8, 12, 16, 20]), ('all inspected rejected', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 4, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [0, 0, 0, 0, 0]), ('all certified', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A', 'B'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [3, 6, 9, 12, 15]), ('no damage', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': [], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [3, 6, 9, 12, 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-unit-count'], 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(x["delivered"],x["inspected"])
    v1 = max(0,x["delivered"]-x["rejected"])
    v2 = max(0,x["awarded"]-x["delivered"])
    v3 = x["buyer_signed"] and x["seller_signed"]
    v4 = set(x["lots"])<=set(x["certificate"])
    v5 = [i for i in x["lots"] if i in x["certificate"] and i not in x["damaged"]]
    v6 = min(x["paid"],max(0,min(x["delivered"],x["inspected"])-x["rejected"])*x["unit_price"])
    v7 = max(0,x["delivered"]-x["returned"])
    v8 = x["storage"] if x["now"]>x["deadline"] else 0
    v9 = 0 if x["disputed"] else max(0,x["paid"]-x["freight"])
    return {'inspectable-units':v0,'accepted-unit-count':v1,'award-remainder':v2,'title-acceptance':v3,'certificate-coverage':v4,'undamaged-certificate-release':v5,'payout-payment-cap':v6,'returned-fulfillment':v7,'late-storage-charge':v8,'dispute-payout-hold':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [3, 6, 9, 12, 15]), ('wrong certificate same count', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A', 'C'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [3, 6, 9, 12, 15]), ('delivery at deadline', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 9, 'disputed': False}, [3, 6, 9, 12, 15]), ('buyer accepts', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': True, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [3, 6, 9, 12, 15]), ('nothing delivered', {'awarded': 8, 'shipped': 6, 'delivered': 0, 'inspected': 0, 'rejected': 0, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [0, 0, 0, 0, 0]), ('inspection exceeds delivery', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 8, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [4, 8, 12, 16, 20]), ('all inspected rejected', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 4, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [0, 0, 0, 0, 0]), ('all certified', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A', 'B'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [3, 6, 9, 12, 15]), ('no damage', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': [], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [3, 6, 9, 12, 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-unit-count'], 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:
Uninspected or rejected units become accepted award fulfillment.

Award fulfillment tracks delivered, inspected, rejected and accepted units. Title and seller payout require acceptance, not shipping. Partial shipments and certificates refer to individual auction lot identifiers; freight and storage are fixed integer credits. Named decision accepted-unit-count: For accepted unit count, apply the stipulated decision max(0,min(x["delivered"],x["inspected"])-x["rejected"]).

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = min(x["delivered"],x["inspected"])
    v1 = max(0,min(x["delivered"],x["inspected"])-x["rejected"])
    v2 = max(0,x["awarded"]-x["shipped"])
    v3 = x["buyer_signed"] and x["seller_signed"]
    v4 = set(x["lots"])<=set(x["certificate"])
    v5 = [i for i in x["lots"] if i in x["certificate"] and i not in x["damaged"]]
    v6 = min(x["paid"],max(0,min(x["delivered"],x["inspected"])-x["rejected"])*x["unit_price"])
    v7 = max(0,x["delivered"]-x["returned"])
    v8 = x["storage"] if x["now"]>x["deadline"] else 0
    v9 = 0 if x["disputed"] else max(0,x["paid"]-x["freight"])
    return {'inspectable-units':v0,'accepted-unit-count':v1,'award-remainder':v2,'title-acceptance':v3,'certificate-coverage':v4,'undamaged-certificate-release':v5,'payout-payment-cap':v6,'returned-fulfillment':v7,'late-storage-charge':v8,'dispute-payout-hold':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [3, 6, 9, 12, 15]), ('wrong certificate same count', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A', 'C'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [3, 6, 9, 12, 15]), ('delivery at deadline', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 9, 'disputed': False}, [3, 6, 9, 12, 15]), ('buyer accepts', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': True, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [3, 6, 9, 12, 15]), ('nothing delivered', {'awarded': 8, 'shipped': 6, 'delivered': 0, 'inspected': 0, 'rejected': 0, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [8, 16, 24, 32, 40]), ('inspection exceeds delivery', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 8, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [3, 6, 9, 12, 15]), ('all inspected rejected', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 4, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [3, 6, 9, 12, 15]), ('all certified', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A', 'B'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [3, 6, 9, 12, 15]), ('no damage', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': [], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [3, 6, 9, 12, 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))['award-remainder'], expected[N-1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(x):
    v0 = min(x["delivered"],x["inspected"])
    v1 = max(0,min(x["delivered"],x["inspected"])-x["rejected"])
    v2 = max(0,x["awarded"]-x["inspected"])
    v3 = x["buyer_signed"] and x["seller_signed"]
    v4 = set(x["lots"])<=set(x["certificate"])
    v5 = [i for i in x["lots"] if i in x["certificate"] and i not in x["damaged"]]
    v6 = min(x["paid"],max(0,min(x["delivered"],x["inspected"])-x["rejected"])*x["unit_price"])
    v7 = max(0,x["delivered"]-x["returned"])
    v8 = x["storage"] if x["now"]>x["deadline"] else 0
    v9 = 0 if x["disputed"] else max(0,x["paid"]-x["freight"])
    return {'inspectable-units':v0,'accepted-unit-count':v1,'award-remainder':v2,'title-acceptance':v3,'certificate-coverage':v4,'undamaged-certificate-release':v5,'payout-payment-cap':v6,'returned-fulfillment':v7,'late-storage-charge':v8,'dispute-payout-hold':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [3, 6, 9, 12, 15]), ('wrong certificate same count', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A', 'C'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [3, 6, 9, 12, 15]), ('delivery at deadline', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 9, 'disputed': False}, [3, 6, 9, 12, 15]), ('buyer accepts', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': True, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [3, 6, 9, 12, 15]), ('nothing delivered', {'awarded': 8, 'shipped': 6, 'delivered': 0, 'inspected': 0, 'rejected': 0, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [8, 16, 24, 32, 40]), ('inspection exceeds delivery', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 8, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [3, 6, 9, 12, 15]), ('all inspected rejected', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 4, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [3, 6, 9, 12, 15]), ('all certified', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A', 'B'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [3, 6, 9, 12, 15]), ('no damage', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': [], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [3, 6, 9, 12, 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))['award-remainder'], expected[N-1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Shipping notice prematurely closes the undelivered award obligation.

Award fulfillment tracks delivered, inspected, rejected and accepted units. Title and seller payout require acceptance, not shipping. Partial shipments and certificates refer to individual auction lot identifiers; freight and storage are fixed integer credits. Named decision award-remainder: For award remainder, apply the stipulated decision max(0,x["awarded"]-x["delivered"]).

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = min(x["delivered"],x["inspected"])
    v1 = max(0,min(x["delivered"],x["inspected"])-x["rejected"])
    v2 = max(0,x["awarded"]-x["delivered"])
    v3 = x["seller_signed"]
    v4 = set(x["lots"])<=set(x["certificate"])
    v5 = [i for i in x["lots"] if i in x["certificate"] and i not in x["damaged"]]
    v6 = min(x["paid"],max(0,min(x["delivered"],x["inspected"])-x["rejected"])*x["unit_price"])
    v7 = max(0,x["delivered"]-x["returned"])
    v8 = x["storage"] if x["now"]>x["deadline"] else 0
    v9 = 0 if x["disputed"] else max(0,x["paid"]-x["freight"])
    return {'inspectable-units':v0,'accepted-unit-count':v1,'award-remainder':v2,'title-acceptance':v3,'certificate-coverage':v4,'undamaged-certificate-release':v5,'payout-payment-cap':v6,'returned-fulfillment':v7,'late-storage-charge':v8,'dispute-payout-hold':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [False, False, False, False, False]), ('wrong certificate same count', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A', 'C'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [False, False, False, False, False]), ('buyer accepts / seller unsigned', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': True, 'seller_signed': False, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [False, False, False, False, False]), ('delivery at deadline', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 9, 'disputed': False}, [False, False, False, False, False]), ('buyer accepts', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': True, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [True, True, True, True, True]), ('nothing delivered', {'awarded': 8, 'shipped': 6, 'delivered': 0, 'inspected': 0, 'rejected': 0, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [False, False, False, False, False]), ('inspection exceeds delivery', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 8, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [False, False, False, False, False]), ('all inspected rejected', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 4, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [False, False, False, False, False]), ('all certified', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A', 'B'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [False, False, False, False, False]), ('no damage', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': [], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [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))['title-acceptance'], 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(x["delivered"],x["inspected"])
    v1 = max(0,min(x["delivered"],x["inspected"])-x["rejected"])
    v2 = max(0,x["awarded"]-x["delivered"])
    v3 = x["buyer_signed"]
    v4 = set(x["lots"])<=set(x["certificate"])
    v5 = [i for i in x["lots"] if i in x["certificate"] and i not in x["damaged"]]
    v6 = min(x["paid"],max(0,min(x["delivered"],x["inspected"])-x["rejected"])*x["unit_price"])
    v7 = max(0,x["delivered"]-x["returned"])
    v8 = x["storage"] if x["now"]>x["deadline"] else 0
    v9 = 0 if x["disputed"] else max(0,x["paid"]-x["freight"])
    return {'inspectable-units':v0,'accepted-unit-count':v1,'award-remainder':v2,'title-acceptance':v3,'certificate-coverage':v4,'undamaged-certificate-release':v5,'payout-payment-cap':v6,'returned-fulfillment':v7,'late-storage-charge':v8,'dispute-payout-hold':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [False, False, False, False, False]), ('wrong certificate same count', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A', 'C'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [False, False, False, False, False]), ('buyer accepts / seller unsigned', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': True, 'seller_signed': False, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [False, False, False, False, False]), ('delivery at deadline', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 9, 'disputed': False}, [False, False, False, False, False]), ('buyer accepts', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': True, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [True, True, True, True, True]), ('nothing delivered', {'awarded': 8, 'shipped': 6, 'delivered': 0, 'inspected': 0, 'rejected': 0, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [False, False, False, False, False]), ('inspection exceeds delivery', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 8, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [False, False, False, False, False]), ('all inspected rejected', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 4, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [False, False, False, False, False]), ('all certified', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A', 'B'], 'lots': ['A', 'B'], 'damaged': ['B'], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [False, False, False, False, False]), ('no damage', {'awarded': 8, 'shipped': 6, 'delivered': 5, 'inspected': 4, 'rejected': 1, 'paid': 20, 'unit_price': 3, 'certificate': ['A'], 'lots': ['A', 'B'], 'damaged': [], 'buyer_signed': False, 'seller_signed': True, 'freight': 4, 'storage': 2, 'returned': 1, 'deadline': 9, 'now': 7, 'disputed': False}, [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))['title-acceptance'], 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:
Title transfers on only one required acceptance signature.

Award fulfillment tracks delivered, inspected, rejected and accepted units. Title and seller payout require acceptance, not shipping. Partial shipments and certificates refer to individual auction lot identifiers; freight and storage are fixed integer credits. Named decision title-acceptance: For title acceptance, apply the stipulated decision x["buyer_signed"] and x["seller_signed"].

split: open-access