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

N = 1
observations = []
def solve(x):
    pins,token,owner,retired,epoch=x
    found=any(p[0]==token for p in pins)
    active=[p for p in pins if p[0]!=token]
    can_reclaim=not active and not owner
    reclaimed=retired[:] if can_reclaim else []
    pending=[] if reclaimed else retired[:]
    version=epoch+found
    return [active,found,pending,reclaimed,version,bool(active),owner]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([[[1,N],[2,N+1]],1,False,[4,5],2]), {1: [[[2, 2]], True, [4, 5], [], 2, True, False], 2: [[[2, 3]], True, [4, 5], [], 2, True, False], 3: [[[2, 4]], True, [4, 5], [], 2, True, False], 4: [[[2, 5]], True, [4, 5], [], 2, True, False], 5: [[[2, 6]], True, [4, 5], [], 2, True, False]}[N])
check('1', solve([[[1,N]],1,False,[4,5],2]), {1: [[], True, [], [4, 5], 3, False, False], 2: [[], True, [], [4, 5], 3, False, False], 3: [[], True, [], [4, 5], 3, False, False], 4: [[], True, [], [4, 5], 3, False, False], 5: [[], True, [], [4, 5], 3, False, False]}[N])
check('2', solve([[[1,N]],1,True,[4],3]), {1: [[], True, [4], [], 3, False, True], 2: [[], True, [4], [], 3, False, True], 3: [[], True, [4], [], 3, False, True], 4: [[], True, [4], [], 3, False, True], 5: [[], True, [4], [], 3, False, True]}[N])
check('3', solve([[[1,N]],9,False,[4],1]), {1: [[[1, 1]], False, [4], [], 1, True, False], 2: [[[1, 2]], False, [4], [], 1, True, False], 3: [[[1, 3]], False, [4], [], 1, True, False], 4: [[[1, 4]], False, [4], [], 1, True, False], 5: [[[1, 5]], False, [4], [], 1, True, False]}[N])
check('4', solve([[],9,True,[],0]), {1: [[], False, [], [], 0, False, True], 2: [[], False, [], [], 0, False, True], 3: [[], False, [], [], 0, False, True], 4: [[], False, [], [], 0, False, True], 5: [[], False, [], [], 0, False, True]}[N])
check('5', solve([[[1,N],[2,N+1]],2,False,[],4]), {1: [[[1, 1]], True, [], [], 4, True, False], 2: [[[1, 2]], True, [], [], 4, True, False], 3: [[[1, 3]], True, [], [], 4, True, False], 4: [[[1, 4]], True, [], [], 4, True, False], 5: [[[1, 5]], True, [], [], 4, True, False]}[N])
check('pin identity differs from payload', solve([[[17,N],[18,N+1]],17,False,[4],3]), [[[18,N+1]],True,[4],[],3,True,False])
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):
    pins,token,owner,retired,epoch=x
    found=any(p[0]==token for p in pins)
    active=[p for p in pins if p[0]!=token]
    can_reclaim=not active and not owner
    reclaimed=retired[:] if can_reclaim else []
    pending=[] if reclaimed else retired[:]
    version=epoch+bool(found and retired)
    return [active,found,pending,reclaimed,version,bool(active),owner]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([[[1,N],[2,N+1]],1,False,[4,5],2]), {1: [[[2, 2]], True, [4, 5], [], 2, True, False], 2: [[[2, 3]], True, [4, 5], [], 2, True, False], 3: [[[2, 4]], True, [4, 5], [], 2, True, False], 4: [[[2, 5]], True, [4, 5], [], 2, True, False], 5: [[[2, 6]], True, [4, 5], [], 2, True, False]}[N])
check('1', solve([[[1,N]],1,False,[4,5],2]), {1: [[], True, [], [4, 5], 3, False, False], 2: [[], True, [], [4, 5], 3, False, False], 3: [[], True, [], [4, 5], 3, False, False], 4: [[], True, [], [4, 5], 3, False, False], 5: [[], True, [], [4, 5], 3, False, False]}[N])
check('2', solve([[[1,N]],1,True,[4],3]), {1: [[], True, [4], [], 3, False, True], 2: [[], True, [4], [], 3, False, True], 3: [[], True, [4], [], 3, False, True], 4: [[], True, [4], [], 3, False, True], 5: [[], True, [4], [], 3, False, True]}[N])
check('3', solve([[[1,N]],9,False,[4],1]), {1: [[[1, 1]], False, [4], [], 1, True, False], 2: [[[1, 2]], False, [4], [], 1, True, False], 3: [[[1, 3]], False, [4], [], 1, True, False], 4: [[[1, 4]], False, [4], [], 1, True, False], 5: [[[1, 5]], False, [4], [], 1, True, False]}[N])
check('4', solve([[],9,True,[],0]), {1: [[], False, [], [], 0, False, True], 2: [[], False, [], [], 0, False, True], 3: [[], False, [], [], 0, False, True], 4: [[], False, [], [], 0, False, True], 5: [[], False, [], [], 0, False, True]}[N])
check('5', solve([[[1,N],[2,N+1]],2,False,[],4]), {1: [[[1, 1]], True, [], [], 4, True, False], 2: [[[1, 2]], True, [], [], 4, True, False], 3: [[[1, 3]], True, [], [], 4, True, False], 4: [[[1, 4]], True, [], [], 4, True, False], 5: [[[1, 5]], True, [], [], 4, True, False]}[N])
check('pin identity differs from payload', solve([[[17,N],[18,N+1]],17,False,[4],3]), [[[18,N+1]],True,[4],[],3,True,False])
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:
Deque borrow release advances reclamation epoch before memory is reclaimed.

Release a unique deque borrow token. Retired storage is reclaimed only when both the owner and all borrowers are gone; unknown releases are idempotent. Return active pins, receipt, retired/reclaimed sets, reclamation epoch and owner state.

split: open-access


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

N = 1
observations = []
def solve(x):
    pins,token,owner,retired,epoch=x
    found=any(p[0]==token for p in pins)
    active=[p for p in pins if p[0]!=token]
    can_reclaim=not active and not owner
    reclaimed=retired[:] if can_reclaim else []
    pending=[] if reclaimed else retired[:]
    version=epoch+(found and bool(reclaimed))
    return [active,found,pending,reclaimed,version,bool(pins),owner]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([[[1,N],[2,N+1]],1,False,[4,5],2]), {1: [[[2, 2]], True, [4, 5], [], 2, True, False], 2: [[[2, 3]], True, [4, 5], [], 2, True, False], 3: [[[2, 4]], True, [4, 5], [], 2, True, False], 4: [[[2, 5]], True, [4, 5], [], 2, True, False], 5: [[[2, 6]], True, [4, 5], [], 2, True, False]}[N])
check('1', solve([[[1,N]],1,False,[4,5],2]), {1: [[], True, [], [4, 5], 3, False, False], 2: [[], True, [], [4, 5], 3, False, False], 3: [[], True, [], [4, 5], 3, False, False], 4: [[], True, [], [4, 5], 3, False, False], 5: [[], True, [], [4, 5], 3, False, False]}[N])
check('2', solve([[[1,N]],1,True,[4],3]), {1: [[], True, [4], [], 3, False, True], 2: [[], True, [4], [], 3, False, True], 3: [[], True, [4], [], 3, False, True], 4: [[], True, [4], [], 3, False, True], 5: [[], True, [4], [], 3, False, True]}[N])
check('3', solve([[[1,N]],9,False,[4],1]), {1: [[[1, 1]], False, [4], [], 1, True, False], 2: [[[1, 2]], False, [4], [], 1, True, False], 3: [[[1, 3]], False, [4], [], 1, True, False], 4: [[[1, 4]], False, [4], [], 1, True, False], 5: [[[1, 5]], False, [4], [], 1, True, False]}[N])
check('4', solve([[],9,True,[],0]), {1: [[], False, [], [], 0, False, True], 2: [[], False, [], [], 0, False, True], 3: [[], False, [], [], 0, False, True], 4: [[], False, [], [], 0, False, True], 5: [[], False, [], [], 0, False, True]}[N])
check('5', solve([[[1,N],[2,N+1]],2,False,[],4]), {1: [[[1, 1]], True, [], [], 4, True, False], 2: [[[1, 2]], True, [], [], 4, True, False], 3: [[[1, 3]], True, [], [], 4, True, False], 4: [[[1, 4]], True, [], [], 4, True, False], 5: [[[1, 5]], True, [], [], 4, True, False]}[N])
check('pin identity differs from payload', solve([[[17,N],[18,N+1]],17,False,[4],3]), [[[18,N+1]],True,[4],[],3,True,False])
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):
    pins,token,owner,retired,epoch=x
    found=any(p[0]==token for p in pins)
    active=[p for p in pins if p[0]!=token]
    can_reclaim=not active and not owner
    reclaimed=retired[:] if can_reclaim else []
    pending=[] if reclaimed else retired[:]
    version=epoch+(found and bool(reclaimed))
    return [active,found,pending,reclaimed,version,bool(active) if not found else bool(pins),owner]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([[[1,N],[2,N+1]],1,False,[4,5],2]), {1: [[[2, 2]], True, [4, 5], [], 2, True, False], 2: [[[2, 3]], True, [4, 5], [], 2, True, False], 3: [[[2, 4]], True, [4, 5], [], 2, True, False], 4: [[[2, 5]], True, [4, 5], [], 2, True, False], 5: [[[2, 6]], True, [4, 5], [], 2, True, False]}[N])
check('1', solve([[[1,N]],1,False,[4,5],2]), {1: [[], True, [], [4, 5], 3, False, False], 2: [[], True, [], [4, 5], 3, False, False], 3: [[], True, [], [4, 5], 3, False, False], 4: [[], True, [], [4, 5], 3, False, False], 5: [[], True, [], [4, 5], 3, False, False]}[N])
check('2', solve([[[1,N]],1,True,[4],3]), {1: [[], True, [4], [], 3, False, True], 2: [[], True, [4], [], 3, False, True], 3: [[], True, [4], [], 3, False, True], 4: [[], True, [4], [], 3, False, True], 5: [[], True, [4], [], 3, False, True]}[N])
check('3', solve([[[1,N]],9,False,[4],1]), {1: [[[1, 1]], False, [4], [], 1, True, False], 2: [[[1, 2]], False, [4], [], 1, True, False], 3: [[[1, 3]], False, [4], [], 1, True, False], 4: [[[1, 4]], False, [4], [], 1, True, False], 5: [[[1, 5]], False, [4], [], 1, True, False]}[N])
check('4', solve([[],9,True,[],0]), {1: [[], False, [], [], 0, False, True], 2: [[], False, [], [], 0, False, True], 3: [[], False, [], [], 0, False, True], 4: [[], False, [], [], 0, False, True], 5: [[], False, [], [], 0, False, True]}[N])
check('5', solve([[[1,N],[2,N+1]],2,False,[],4]), {1: [[[1, 1]], True, [], [], 4, True, False], 2: [[[1, 2]], True, [], [], 4, True, False], 3: [[[1, 3]], True, [], [], 4, True, False], 4: [[[1, 4]], True, [], [], 4, True, False], 5: [[[1, 5]], True, [], [], 4, True, False]}[N])
check('pin identity differs from payload', solve([[[17,N],[18,N+1]],17,False,[4],3]), [[[18,N+1]],True,[4],[],3,True,False])
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:
Deque borrow release reports old rather than remaining pin state.

Release a unique deque borrow token. Retired storage is reclaimed only when both the owner and all borrowers are gone; unknown releases are idempotent. Return active pins, receipt, retired/reclaimed sets, reclamation epoch and owner state.

split: open-access


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

N = 1
observations = []
def solve(x):
    storage,reverse,op,value,cap=x
    logical=storage[::-1] if reverse else storage[:]
    if op=='flip':return [storage[::-1],not reverse,logical[::-1],None]
    if op=='push':
        if len(storage)==cap:return [storage,reverse,logical,'full']
        physical=[value]+storage if reverse else storage+[value]
        return [physical,reverse,logical+[value],None]
    if not storage:return [storage,reverse,logical,'empty']
    result=storage[:-1] if reverse else storage[1:]
    removed=storage[-1] if reverse else storage[0]
    remaining=result[::-1] if reverse else result[:]
    return [result,reverse,remaining,removed]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([[N,N+1,N+2],True,"pop",0,4]), {1: [[1, 2], True, [2, 1], 3], 2: [[2, 3], True, [3, 2], 4], 3: [[3, 4], True, [4, 3], 5], 4: [[4, 5], True, [5, 4], 6], 5: [[5, 6], True, [6, 5], 7]}[N])
check('1', solve([[N,N+1],True,"push",N+2,4]), {1: [[3, 1, 2], True, [2, 1, 3], None], 2: [[4, 2, 3], True, [3, 2, 4], None], 3: [[5, 3, 4], True, [4, 3, 5], None], 4: [[6, 4, 5], True, [5, 4, 6], None], 5: [[7, 5, 6], True, [6, 5, 7], None]}[N])
check('2', solve([[N,N+1],False,"flip",0,3]), {1: [[1, 2], True, [2, 1], None], 2: [[2, 3], True, [3, 2], None], 3: [[3, 4], True, [4, 3], None], 4: [[4, 5], True, [5, 4], None], 5: [[5, 6], True, [6, 5], None]}[N])
check('3', solve([[N,N+1],True,"flip",0,3]), {1: [[1, 2], False, [1, 2], None], 2: [[2, 3], False, [2, 3], None], 3: [[3, 4], False, [3, 4], None], 4: [[4, 5], False, [4, 5], None], 5: [[5, 6], False, [5, 6], None]}[N])
check('4', solve([[N],False,"push",N+1,1]), {1: [[1], False, [1], 'full'], 2: [[2], False, [2], 'full'], 3: [[3], False, [3], 'full'], 4: [[4], False, [4], 'full'], 5: [[5], False, [5], 'full']}[N])
check('5', solve([[],True,"pop",0,3]), {1: [[], True, [], 'empty'], 2: [[], True, [], 'empty'], 3: [[], True, [], 'empty'], 4: [[], True, [], 'empty'], 5: [[], True, [], 'empty']}[N])
check('6', solve([[N,N+1],False,"pop",0,3]), {1: [[2], False, [2], 1], 2: [[3], False, [3], 2], 3: [[4], False, [4], 3], 4: [[5], False, [5], 4], 5: [[6], False, [6], 5]}[N])
check('7', solve([[N],False,"push",N+1,3]), {1: [[1, 2], False, [1, 2], None], 2: [[2, 3], False, [2, 3], None], 3: [[3, 4], False, [3, 4], None], 4: [[4, 5], False, [4, 5], None], 5: [[5, 6], False, [5, 6], None]}[N])
check('full reversed rejection', solve([[N,N+1],True,'push',N+2,2]), [[N,N+1],True,[N+1,N],'full'])
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):
    storage,reverse,op,value,cap=x
    logical=storage[::-1] if reverse else storage[:]
    if op=='flip':return [storage[::-1] if not reverse else storage,not reverse,logical[::-1],None]
    if op=='push':
        if len(storage)==cap:return [storage,reverse,logical,'full']
        physical=[value]+storage if reverse else storage+[value]
        return [physical,reverse,logical+[value],None]
    if not storage:return [storage,reverse,logical,'empty']
    result=storage[:-1] if reverse else storage[1:]
    removed=storage[-1] if reverse else storage[0]
    remaining=result[::-1] if reverse else result[:]
    return [result,reverse,remaining,removed]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([[N,N+1,N+2],True,"pop",0,4]), {1: [[1, 2], True, [2, 1], 3], 2: [[2, 3], True, [3, 2], 4], 3: [[3, 4], True, [4, 3], 5], 4: [[4, 5], True, [5, 4], 6], 5: [[5, 6], True, [6, 5], 7]}[N])
check('1', solve([[N,N+1],True,"push",N+2,4]), {1: [[3, 1, 2], True, [2, 1, 3], None], 2: [[4, 2, 3], True, [3, 2, 4], None], 3: [[5, 3, 4], True, [4, 3, 5], None], 4: [[6, 4, 5], True, [5, 4, 6], None], 5: [[7, 5, 6], True, [6, 5, 7], None]}[N])
check('2', solve([[N,N+1],False,"flip",0,3]), {1: [[1, 2], True, [2, 1], None], 2: [[2, 3], True, [3, 2], None], 3: [[3, 4], True, [4, 3], None], 4: [[4, 5], True, [5, 4], None], 5: [[5, 6], True, [6, 5], None]}[N])
check('3', solve([[N,N+1],True,"flip",0,3]), {1: [[1, 2], False, [1, 2], None], 2: [[2, 3], False, [2, 3], None], 3: [[3, 4], False, [3, 4], None], 4: [[4, 5], False, [4, 5], None], 5: [[5, 6], False, [5, 6], None]}[N])
check('4', solve([[N],False,"push",N+1,1]), {1: [[1], False, [1], 'full'], 2: [[2], False, [2], 'full'], 3: [[3], False, [3], 'full'], 4: [[4], False, [4], 'full'], 5: [[5], False, [5], 'full']}[N])
check('5', solve([[],True,"pop",0,3]), {1: [[], True, [], 'empty'], 2: [[], True, [], 'empty'], 3: [[], True, [], 'empty'], 4: [[], True, [], 'empty'], 5: [[], True, [], 'empty']}[N])
check('6', solve([[N,N+1],False,"pop",0,3]), {1: [[2], False, [2], 1], 2: [[3], False, [3], 2], 3: [[4], False, [4], 3], 4: [[5], False, [5], 4], 5: [[6], False, [6], 5]}[N])
check('7', solve([[N],False,"push",N+1,3]), {1: [[1, 2], False, [1, 2], None], 2: [[2, 3], False, [2, 3], None], 3: [[3, 4], False, [3, 4], None], 4: [[4, 5], False, [4, 5], None], 5: [[5, 6], False, [5, 6], None]}[N])
check('full reversed rejection', solve([[N,N+1],True,'push',N+2,2]), [[N,N+1],True,[N+1,N],'full'])
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:
Lazy deque reversal also physically reverses storage.

A bounded deque stores physical values and a lazy reversed flag. Flip toggles orientation without moving storage; logical append and front-pop select the appropriate physical endpoint. Full append rejects.

split: open-access


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

N = 1
observations = []
def solve(x):
    storage,reverse,op,value,cap=x
    logical=storage[::-1] if reverse else storage[:]
    if op=='flip':return [storage,True,logical[::-1],None]
    if op=='push':
        if len(storage)==cap:return [storage,reverse,logical,'full']
        physical=[value]+storage if reverse else storage+[value]
        return [physical,reverse,logical+[value],None]
    if not storage:return [storage,reverse,logical,'empty']
    result=storage[:-1] if reverse else storage[1:]
    removed=storage[-1] if reverse else storage[0]
    remaining=result[::-1] if reverse else result[:]
    return [result,reverse,remaining,removed]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([[N,N+1,N+2],True,"pop",0,4]), {1: [[1, 2], True, [2, 1], 3], 2: [[2, 3], True, [3, 2], 4], 3: [[3, 4], True, [4, 3], 5], 4: [[4, 5], True, [5, 4], 6], 5: [[5, 6], True, [6, 5], 7]}[N])
check('1', solve([[N,N+1],True,"push",N+2,4]), {1: [[3, 1, 2], True, [2, 1, 3], None], 2: [[4, 2, 3], True, [3, 2, 4], None], 3: [[5, 3, 4], True, [4, 3, 5], None], 4: [[6, 4, 5], True, [5, 4, 6], None], 5: [[7, 5, 6], True, [6, 5, 7], None]}[N])
check('2', solve([[N,N+1],False,"flip",0,3]), {1: [[1, 2], True, [2, 1], None], 2: [[2, 3], True, [3, 2], None], 3: [[3, 4], True, [4, 3], None], 4: [[4, 5], True, [5, 4], None], 5: [[5, 6], True, [6, 5], None]}[N])
check('3', solve([[N,N+1],True,"flip",0,3]), {1: [[1, 2], False, [1, 2], None], 2: [[2, 3], False, [2, 3], None], 3: [[3, 4], False, [3, 4], None], 4: [[4, 5], False, [4, 5], None], 5: [[5, 6], False, [5, 6], None]}[N])
check('4', solve([[N],False,"push",N+1,1]), {1: [[1], False, [1], 'full'], 2: [[2], False, [2], 'full'], 3: [[3], False, [3], 'full'], 4: [[4], False, [4], 'full'], 5: [[5], False, [5], 'full']}[N])
check('5', solve([[],True,"pop",0,3]), {1: [[], True, [], 'empty'], 2: [[], True, [], 'empty'], 3: [[], True, [], 'empty'], 4: [[], True, [], 'empty'], 5: [[], True, [], 'empty']}[N])
check('6', solve([[N,N+1],False,"pop",0,3]), {1: [[2], False, [2], 1], 2: [[3], False, [3], 2], 3: [[4], False, [4], 3], 4: [[5], False, [5], 4], 5: [[6], False, [6], 5]}[N])
check('7', solve([[N],False,"push",N+1,3]), {1: [[1, 2], False, [1, 2], None], 2: [[2, 3], False, [2, 3], None], 3: [[3, 4], False, [3, 4], None], 4: [[4, 5], False, [4, 5], None], 5: [[5, 6], False, [5, 6], None]}[N])
check('full reversed rejection', solve([[N,N+1],True,'push',N+2,2]), [[N,N+1],True,[N+1,N],'full'])
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):
    storage,reverse,op,value,cap=x
    logical=storage[::-1] if reverse else storage[:]
    if op=='flip':return [storage,(not reverse if not storage else True),logical[::-1],None]
    if op=='push':
        if len(storage)==cap:return [storage,reverse,logical,'full']
        physical=[value]+storage if reverse else storage+[value]
        return [physical,reverse,logical+[value],None]
    if not storage:return [storage,reverse,logical,'empty']
    result=storage[:-1] if reverse else storage[1:]
    removed=storage[-1] if reverse else storage[0]
    remaining=result[::-1] if reverse else result[:]
    return [result,reverse,remaining,removed]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([[N,N+1,N+2],True,"pop",0,4]), {1: [[1, 2], True, [2, 1], 3], 2: [[2, 3], True, [3, 2], 4], 3: [[3, 4], True, [4, 3], 5], 4: [[4, 5], True, [5, 4], 6], 5: [[5, 6], True, [6, 5], 7]}[N])
check('1', solve([[N,N+1],True,"push",N+2,4]), {1: [[3, 1, 2], True, [2, 1, 3], None], 2: [[4, 2, 3], True, [3, 2, 4], None], 3: [[5, 3, 4], True, [4, 3, 5], None], 4: [[6, 4, 5], True, [5, 4, 6], None], 5: [[7, 5, 6], True, [6, 5, 7], None]}[N])
check('2', solve([[N,N+1],False,"flip",0,3]), {1: [[1, 2], True, [2, 1], None], 2: [[2, 3], True, [3, 2], None], 3: [[3, 4], True, [4, 3], None], 4: [[4, 5], True, [5, 4], None], 5: [[5, 6], True, [6, 5], None]}[N])
check('3', solve([[N,N+1],True,"flip",0,3]), {1: [[1, 2], False, [1, 2], None], 2: [[2, 3], False, [2, 3], None], 3: [[3, 4], False, [3, 4], None], 4: [[4, 5], False, [4, 5], None], 5: [[5, 6], False, [5, 6], None]}[N])
check('4', solve([[N],False,"push",N+1,1]), {1: [[1], False, [1], 'full'], 2: [[2], False, [2], 'full'], 3: [[3], False, [3], 'full'], 4: [[4], False, [4], 'full'], 5: [[5], False, [5], 'full']}[N])
check('5', solve([[],True,"pop",0,3]), {1: [[], True, [], 'empty'], 2: [[], True, [], 'empty'], 3: [[], True, [], 'empty'], 4: [[], True, [], 'empty'], 5: [[], True, [], 'empty']}[N])
check('6', solve([[N,N+1],False,"pop",0,3]), {1: [[2], False, [2], 1], 2: [[3], False, [3], 2], 3: [[4], False, [4], 3], 4: [[5], False, [5], 4], 5: [[6], False, [6], 5]}[N])
check('7', solve([[N],False,"push",N+1,3]), {1: [[1, 2], False, [1, 2], None], 2: [[2, 3], False, [2, 3], None], 3: [[3, 4], False, [3, 4], None], 4: [[4, 5], False, [4, 5], None], 5: [[5, 6], False, [5, 6], None]}[N])
check('full reversed rejection', solve([[N,N+1],True,'push',N+2,2]), [[N,N+1],True,[N+1,N],'full'])
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:
Repeated lazy deque flip leaves the orientation reversed.

A bounded deque stores physical values and a lazy reversed flag. Flip toggles orientation without moving storage; logical append and front-pop select the appropriate physical endpoint. Full append rejects.

split: open-access


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

N = 1
observations = []
def solve(x):
    storage,reverse,op,value,cap=x
    logical=storage[::-1] if reverse else storage[:]
    if op=='flip':return [storage,not reverse,logical[::-1],None]
    if op=='push':
        if len(storage)==cap:return [storage,reverse,logical,'full']
        physical=storage+[value]
        return [physical,reverse,logical+[value],None]
    if not storage:return [storage,reverse,logical,'empty']
    result=storage[:-1] if reverse else storage[1:]
    removed=storage[-1] if reverse else storage[0]
    remaining=result[::-1] if reverse else result[:]
    return [result,reverse,remaining,removed]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([[N,N+1,N+2],True,"pop",0,4]), {1: [[1, 2], True, [2, 1], 3], 2: [[2, 3], True, [3, 2], 4], 3: [[3, 4], True, [4, 3], 5], 4: [[4, 5], True, [5, 4], 6], 5: [[5, 6], True, [6, 5], 7]}[N])
check('1', solve([[N,N+1],True,"push",N+2,4]), {1: [[3, 1, 2], True, [2, 1, 3], None], 2: [[4, 2, 3], True, [3, 2, 4], None], 3: [[5, 3, 4], True, [4, 3, 5], None], 4: [[6, 4, 5], True, [5, 4, 6], None], 5: [[7, 5, 6], True, [6, 5, 7], None]}[N])
check('2', solve([[N,N+1],False,"flip",0,3]), {1: [[1, 2], True, [2, 1], None], 2: [[2, 3], True, [3, 2], None], 3: [[3, 4], True, [4, 3], None], 4: [[4, 5], True, [5, 4], None], 5: [[5, 6], True, [6, 5], None]}[N])
check('3', solve([[N,N+1],True,"flip",0,3]), {1: [[1, 2], False, [1, 2], None], 2: [[2, 3], False, [2, 3], None], 3: [[3, 4], False, [3, 4], None], 4: [[4, 5], False, [4, 5], None], 5: [[5, 6], False, [5, 6], None]}[N])
check('4', solve([[N],False,"push",N+1,1]), {1: [[1], False, [1], 'full'], 2: [[2], False, [2], 'full'], 3: [[3], False, [3], 'full'], 4: [[4], False, [4], 'full'], 5: [[5], False, [5], 'full']}[N])
check('5', solve([[],True,"pop",0,3]), {1: [[], True, [], 'empty'], 2: [[], True, [], 'empty'], 3: [[], True, [], 'empty'], 4: [[], True, [], 'empty'], 5: [[], True, [], 'empty']}[N])
check('6', solve([[N,N+1],False,"pop",0,3]), {1: [[2], False, [2], 1], 2: [[3], False, [3], 2], 3: [[4], False, [4], 3], 4: [[5], False, [5], 4], 5: [[6], False, [6], 5]}[N])
check('7', solve([[N],False,"push",N+1,3]), {1: [[1, 2], False, [1, 2], None], 2: [[2, 3], False, [2, 3], None], 3: [[3, 4], False, [3, 4], None], 4: [[4, 5], False, [4, 5], None], 5: [[5, 6], False, [5, 6], None]}[N])
check('full reversed rejection', solve([[N,N+1],True,'push',N+2,2]), [[N,N+1],True,[N+1,N],'full'])
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):
    storage,reverse,op,value,cap=x
    logical=storage[::-1] if reverse else storage[:]
    if op=='flip':return [storage,not reverse,logical[::-1],None]
    if op=='push':
        if len(storage)==cap:return [storage,reverse,logical,'full']
        physical=[value]+storage if reverse and len(storage)<2 else storage+[value]
        return [physical,reverse,logical+[value],None]
    if not storage:return [storage,reverse,logical,'empty']
    result=storage[:-1] if reverse else storage[1:]
    removed=storage[-1] if reverse else storage[0]
    remaining=result[::-1] if reverse else result[:]
    return [result,reverse,remaining,removed]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([[N,N+1,N+2],True,"pop",0,4]), {1: [[1, 2], True, [2, 1], 3], 2: [[2, 3], True, [3, 2], 4], 3: [[3, 4], True, [4, 3], 5], 4: [[4, 5], True, [5, 4], 6], 5: [[5, 6], True, [6, 5], 7]}[N])
check('1', solve([[N,N+1],True,"push",N+2,4]), {1: [[3, 1, 2], True, [2, 1, 3], None], 2: [[4, 2, 3], True, [3, 2, 4], None], 3: [[5, 3, 4], True, [4, 3, 5], None], 4: [[6, 4, 5], True, [5, 4, 6], None], 5: [[7, 5, 6], True, [6, 5, 7], None]}[N])
check('2', solve([[N,N+1],False,"flip",0,3]), {1: [[1, 2], True, [2, 1], None], 2: [[2, 3], True, [3, 2], None], 3: [[3, 4], True, [4, 3], None], 4: [[4, 5], True, [5, 4], None], 5: [[5, 6], True, [6, 5], None]}[N])
check('3', solve([[N,N+1],True,"flip",0,3]), {1: [[1, 2], False, [1, 2], None], 2: [[2, 3], False, [2, 3], None], 3: [[3, 4], False, [3, 4], None], 4: [[4, 5], False, [4, 5], None], 5: [[5, 6], False, [5, 6], None]}[N])
check('4', solve([[N],False,"push",N+1,1]), {1: [[1], False, [1], 'full'], 2: [[2], False, [2], 'full'], 3: [[3], False, [3], 'full'], 4: [[4], False, [4], 'full'], 5: [[5], False, [5], 'full']}[N])
check('5', solve([[],True,"pop",0,3]), {1: [[], True, [], 'empty'], 2: [[], True, [], 'empty'], 3: [[], True, [], 'empty'], 4: [[], True, [], 'empty'], 5: [[], True, [], 'empty']}[N])
check('6', solve([[N,N+1],False,"pop",0,3]), {1: [[2], False, [2], 1], 2: [[3], False, [3], 2], 3: [[4], False, [4], 3], 4: [[5], False, [5], 4], 5: [[6], False, [6], 5]}[N])
check('7', solve([[N],False,"push",N+1,3]), {1: [[1, 2], False, [1, 2], None], 2: [[2, 3], False, [2, 3], None], 3: [[3, 4], False, [3, 4], None], 4: [[4, 5], False, [4, 5], None], 5: [[5, 6], False, [5, 6], None]}[N])
check('full reversed rejection', solve([[N,N+1],True,'push',N+2,2]), [[N,N+1],True,[N+1,N],'full'])
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:
Lazy reversed deque appends at the wrong physical endpoint.

A bounded deque stores physical values and a lazy reversed flag. Flip toggles orientation without moving storage; logical append and front-pop select the appropriate physical endpoint. Full append rejects.

split: open-access


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

N = 1
observations = []
def solve(x):
    storage,reverse,op,value,cap=x
    logical=storage[::-1] if reverse else storage[:]
    if op=='flip':return [storage,not reverse,logical[::-1],None]
    if op=='push':
        if len(storage)==cap:return [storage,reverse,logical,'full']
        physical=[value]+storage if reverse else storage+[value]
        return [physical,reverse,logical+[value],None]
    if not storage:return [storage,reverse,logical,'empty']
    result=storage[1:]
    removed=storage[-1] if reverse else storage[0]
    remaining=result[::-1] if reverse else result[:]
    return [result,reverse,remaining,removed]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([[N,N+1,N+2],True,"pop",0,4]), {1: [[1, 2], True, [2, 1], 3], 2: [[2, 3], True, [3, 2], 4], 3: [[3, 4], True, [4, 3], 5], 4: [[4, 5], True, [5, 4], 6], 5: [[5, 6], True, [6, 5], 7]}[N])
check('1', solve([[N,N+1],True,"push",N+2,4]), {1: [[3, 1, 2], True, [2, 1, 3], None], 2: [[4, 2, 3], True, [3, 2, 4], None], 3: [[5, 3, 4], True, [4, 3, 5], None], 4: [[6, 4, 5], True, [5, 4, 6], None], 5: [[7, 5, 6], True, [6, 5, 7], None]}[N])
check('2', solve([[N,N+1],False,"flip",0,3]), {1: [[1, 2], True, [2, 1], None], 2: [[2, 3], True, [3, 2], None], 3: [[3, 4], True, [4, 3], None], 4: [[4, 5], True, [5, 4], None], 5: [[5, 6], True, [6, 5], None]}[N])
check('3', solve([[N,N+1],True,"flip",0,3]), {1: [[1, 2], False, [1, 2], None], 2: [[2, 3], False, [2, 3], None], 3: [[3, 4], False, [3, 4], None], 4: [[4, 5], False, [4, 5], None], 5: [[5, 6], False, [5, 6], None]}[N])
check('4', solve([[N],False,"push",N+1,1]), {1: [[1], False, [1], 'full'], 2: [[2], False, [2], 'full'], 3: [[3], False, [3], 'full'], 4: [[4], False, [4], 'full'], 5: [[5], False, [5], 'full']}[N])
check('5', solve([[],True,"pop",0,3]), {1: [[], True, [], 'empty'], 2: [[], True, [], 'empty'], 3: [[], True, [], 'empty'], 4: [[], True, [], 'empty'], 5: [[], True, [], 'empty']}[N])
check('6', solve([[N,N+1],False,"pop",0,3]), {1: [[2], False, [2], 1], 2: [[3], False, [3], 2], 3: [[4], False, [4], 3], 4: [[5], False, [5], 4], 5: [[6], False, [6], 5]}[N])
check('7', solve([[N],False,"push",N+1,3]), {1: [[1, 2], False, [1, 2], None], 2: [[2, 3], False, [2, 3], None], 3: [[3, 4], False, [3, 4], None], 4: [[4, 5], False, [4, 5], None], 5: [[5, 6], False, [5, 6], None]}[N])
check('full reversed rejection', solve([[N,N+1],True,'push',N+2,2]), [[N,N+1],True,[N+1,N],'full'])
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):
    storage,reverse,op,value,cap=x
    logical=storage[::-1] if reverse else storage[:]
    if op=='flip':return [storage,not reverse,logical[::-1],None]
    if op=='push':
        if len(storage)==cap:return [storage,reverse,logical,'full']
        physical=[value]+storage if reverse else storage+[value]
        return [physical,reverse,logical+[value],None]
    if not storage:return [storage,reverse,logical,'empty']
    result=storage[:-1] if reverse and len(storage)==1 else storage[1:]
    removed=storage[-1] if reverse else storage[0]
    remaining=result[::-1] if reverse else result[:]
    return [result,reverse,remaining,removed]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([[N,N+1,N+2],True,"pop",0,4]), {1: [[1, 2], True, [2, 1], 3], 2: [[2, 3], True, [3, 2], 4], 3: [[3, 4], True, [4, 3], 5], 4: [[4, 5], True, [5, 4], 6], 5: [[5, 6], True, [6, 5], 7]}[N])
check('1', solve([[N,N+1],True,"push",N+2,4]), {1: [[3, 1, 2], True, [2, 1, 3], None], 2: [[4, 2, 3], True, [3, 2, 4], None], 3: [[5, 3, 4], True, [4, 3, 5], None], 4: [[6, 4, 5], True, [5, 4, 6], None], 5: [[7, 5, 6], True, [6, 5, 7], None]}[N])
check('2', solve([[N,N+1],False,"flip",0,3]), {1: [[1, 2], True, [2, 1], None], 2: [[2, 3], True, [3, 2], None], 3: [[3, 4], True, [4, 3], None], 4: [[4, 5], True, [5, 4], None], 5: [[5, 6], True, [6, 5], None]}[N])
check('3', solve([[N,N+1],True,"flip",0,3]), {1: [[1, 2], False, [1, 2], None], 2: [[2, 3], False, [2, 3], None], 3: [[3, 4], False, [3, 4], None], 4: [[4, 5], False, [4, 5], None], 5: [[5, 6], False, [5, 6], None]}[N])
check('4', solve([[N],False,"push",N+1,1]), {1: [[1], False, [1], 'full'], 2: [[2], False, [2], 'full'], 3: [[3], False, [3], 'full'], 4: [[4], False, [4], 'full'], 5: [[5], False, [5], 'full']}[N])
check('5', solve([[],True,"pop",0,3]), {1: [[], True, [], 'empty'], 2: [[], True, [], 'empty'], 3: [[], True, [], 'empty'], 4: [[], True, [], 'empty'], 5: [[], True, [], 'empty']}[N])
check('6', solve([[N,N+1],False,"pop",0,3]), {1: [[2], False, [2], 1], 2: [[3], False, [3], 2], 3: [[4], False, [4], 3], 4: [[5], False, [5], 4], 5: [[6], False, [6], 5]}[N])
check('7', solve([[N],False,"push",N+1,3]), {1: [[1, 2], False, [1, 2], None], 2: [[2, 3], False, [2, 3], None], 3: [[3, 4], False, [3, 4], None], 4: [[4, 5], False, [4, 5], None], 5: [[5, 6], False, [5, 6], None]}[N])
check('full reversed rejection', solve([[N,N+1],True,'push',N+2,2]), [[N,N+1],True,[N+1,N],'full'])
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:
Lazy reversed deque removes the physical front.

A bounded deque stores physical values and a lazy reversed flag. Flip toggles orientation without moving storage; logical append and front-pop select the appropriate physical endpoint. Full append rejects.

split: open-access


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

N = 1
observations = []
def solve(x):
    storage,reverse,op,value,cap=x
    logical=storage[::-1] if reverse else storage[:]
    if op=='flip':return [storage,not reverse,logical[::-1],None]
    if op=='push':
        if len(storage)==cap:return [storage,reverse,logical,'full']
        physical=[value]+storage if reverse else storage+[value]
        return [physical,reverse,logical+[value],None]
    if not storage:return [storage,reverse,logical,'empty']
    result=storage[:-1] if reverse else storage[1:]
    removed=storage[0]
    remaining=result[::-1] if reverse else result[:]
    return [result,reverse,remaining,removed]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([[N,N+1,N+2],True,"pop",0,4]), {1: [[1, 2], True, [2, 1], 3], 2: [[2, 3], True, [3, 2], 4], 3: [[3, 4], True, [4, 3], 5], 4: [[4, 5], True, [5, 4], 6], 5: [[5, 6], True, [6, 5], 7]}[N])
check('1', solve([[N,N+1],True,"push",N+2,4]), {1: [[3, 1, 2], True, [2, 1, 3], None], 2: [[4, 2, 3], True, [3, 2, 4], None], 3: [[5, 3, 4], True, [4, 3, 5], None], 4: [[6, 4, 5], True, [5, 4, 6], None], 5: [[7, 5, 6], True, [6, 5, 7], None]}[N])
check('2', solve([[N,N+1],False,"flip",0,3]), {1: [[1, 2], True, [2, 1], None], 2: [[2, 3], True, [3, 2], None], 3: [[3, 4], True, [4, 3], None], 4: [[4, 5], True, [5, 4], None], 5: [[5, 6], True, [6, 5], None]}[N])
check('3', solve([[N,N+1],True,"flip",0,3]), {1: [[1, 2], False, [1, 2], None], 2: [[2, 3], False, [2, 3], None], 3: [[3, 4], False, [3, 4], None], 4: [[4, 5], False, [4, 5], None], 5: [[5, 6], False, [5, 6], None]}[N])
check('4', solve([[N],False,"push",N+1,1]), {1: [[1], False, [1], 'full'], 2: [[2], False, [2], 'full'], 3: [[3], False, [3], 'full'], 4: [[4], False, [4], 'full'], 5: [[5], False, [5], 'full']}[N])
check('5', solve([[],True,"pop",0,3]), {1: [[], True, [], 'empty'], 2: [[], True, [], 'empty'], 3: [[], True, [], 'empty'], 4: [[], True, [], 'empty'], 5: [[], True, [], 'empty']}[N])
check('6', solve([[N,N+1],False,"pop",0,3]), {1: [[2], False, [2], 1], 2: [[3], False, [3], 2], 3: [[4], False, [4], 3], 4: [[5], False, [5], 4], 5: [[6], False, [6], 5]}[N])
check('7', solve([[N],False,"push",N+1,3]), {1: [[1, 2], False, [1, 2], None], 2: [[2, 3], False, [2, 3], None], 3: [[3, 4], False, [3, 4], None], 4: [[4, 5], False, [4, 5], None], 5: [[5, 6], False, [5, 6], None]}[N])
check('full reversed rejection', solve([[N,N+1],True,'push',N+2,2]), [[N,N+1],True,[N+1,N],'full'])
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):
    storage,reverse,op,value,cap=x
    logical=storage[::-1] if reverse else storage[:]
    if op=='flip':return [storage,not reverse,logical[::-1],None]
    if op=='push':
        if len(storage)==cap:return [storage,reverse,logical,'full']
        physical=[value]+storage if reverse else storage+[value]
        return [physical,reverse,logical+[value],None]
    if not storage:return [storage,reverse,logical,'empty']
    result=storage[:-1] if reverse else storage[1:]
    removed=storage[-1] if reverse and len(storage)==1 else storage[0]
    remaining=result[::-1] if reverse else result[:]
    return [result,reverse,remaining,removed]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([[N,N+1,N+2],True,"pop",0,4]), {1: [[1, 2], True, [2, 1], 3], 2: [[2, 3], True, [3, 2], 4], 3: [[3, 4], True, [4, 3], 5], 4: [[4, 5], True, [5, 4], 6], 5: [[5, 6], True, [6, 5], 7]}[N])
check('1', solve([[N,N+1],True,"push",N+2,4]), {1: [[3, 1, 2], True, [2, 1, 3], None], 2: [[4, 2, 3], True, [3, 2, 4], None], 3: [[5, 3, 4], True, [4, 3, 5], None], 4: [[6, 4, 5], True, [5, 4, 6], None], 5: [[7, 5, 6], True, [6, 5, 7], None]}[N])
check('2', solve([[N,N+1],False,"flip",0,3]), {1: [[1, 2], True, [2, 1], None], 2: [[2, 3], True, [3, 2], None], 3: [[3, 4], True, [4, 3], None], 4: [[4, 5], True, [5, 4], None], 5: [[5, 6], True, [6, 5], None]}[N])
check('3', solve([[N,N+1],True,"flip",0,3]), {1: [[1, 2], False, [1, 2], None], 2: [[2, 3], False, [2, 3], None], 3: [[3, 4], False, [3, 4], None], 4: [[4, 5], False, [4, 5], None], 5: [[5, 6], False, [5, 6], None]}[N])
check('4', solve([[N],False,"push",N+1,1]), {1: [[1], False, [1], 'full'], 2: [[2], False, [2], 'full'], 3: [[3], False, [3], 'full'], 4: [[4], False, [4], 'full'], 5: [[5], False, [5], 'full']}[N])
check('5', solve([[],True,"pop",0,3]), {1: [[], True, [], 'empty'], 2: [[], True, [], 'empty'], 3: [[], True, [], 'empty'], 4: [[], True, [], 'empty'], 5: [[], True, [], 'empty']}[N])
check('6', solve([[N,N+1],False,"pop",0,3]), {1: [[2], False, [2], 1], 2: [[3], False, [3], 2], 3: [[4], False, [4], 3], 4: [[5], False, [5], 4], 5: [[6], False, [6], 5]}[N])
check('7', solve([[N],False,"push",N+1,3]), {1: [[1, 2], False, [1, 2], None], 2: [[2, 3], False, [2, 3], None], 3: [[3, 4], False, [3, 4], None], 4: [[4, 5], False, [4, 5], None], 5: [[5, 6], False, [5, 6], None]}[N])
check('full reversed rejection', solve([[N,N+1],True,'push',N+2,2]), [[N,N+1],True,[N+1,N],'full'])
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:
Lazy reversed deque reports the physical front payload.

A bounded deque stores physical values and a lazy reversed flag. Flip toggles orientation without moving storage; logical append and front-pop select the appropriate physical endpoint. Full append rejects.

split: open-access


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

N = 1
observations = []
def solve(x):
    storage,reverse,op,value,cap=x
    logical=storage[::-1] if reverse else storage[:]
    if op=='flip':return [storage,not reverse,logical[::-1],None]
    if op=='push':
        if len(storage)==cap:return [storage,reverse,logical,'full']
        physical=[value]+storage if reverse else storage+[value]
        return [physical,reverse,logical+[value],None]
    if not storage:return [storage,reverse,logical,'empty']
    result=storage[:-1] if reverse else storage[1:]
    removed=storage[-1] if reverse else storage[0]
    remaining=result[:]
    return [result,reverse,remaining,removed]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([[N,N+1,N+2],True,"pop",0,4]), {1: [[1, 2], True, [2, 1], 3], 2: [[2, 3], True, [3, 2], 4], 3: [[3, 4], True, [4, 3], 5], 4: [[4, 5], True, [5, 4], 6], 5: [[5, 6], True, [6, 5], 7]}[N])
check('1', solve([[N,N+1],True,"push",N+2,4]), {1: [[3, 1, 2], True, [2, 1, 3], None], 2: [[4, 2, 3], True, [3, 2, 4], None], 3: [[5, 3, 4], True, [4, 3, 5], None], 4: [[6, 4, 5], True, [5, 4, 6], None], 5: [[7, 5, 6], True, [6, 5, 7], None]}[N])
check('2', solve([[N,N+1],False,"flip",0,3]), {1: [[1, 2], True, [2, 1], None], 2: [[2, 3], True, [3, 2], None], 3: [[3, 4], True, [4, 3], None], 4: [[4, 5], True, [5, 4], None], 5: [[5, 6], True, [6, 5], None]}[N])
check('3', solve([[N,N+1],True,"flip",0,3]), {1: [[1, 2], False, [1, 2], None], 2: [[2, 3], False, [2, 3], None], 3: [[3, 4], False, [3, 4], None], 4: [[4, 5], False, [4, 5], None], 5: [[5, 6], False, [5, 6], None]}[N])
check('4', solve([[N],False,"push",N+1,1]), {1: [[1], False, [1], 'full'], 2: [[2], False, [2], 'full'], 3: [[3], False, [3], 'full'], 4: [[4], False, [4], 'full'], 5: [[5], False, [5], 'full']}[N])
check('5', solve([[],True,"pop",0,3]), {1: [[], True, [], 'empty'], 2: [[], True, [], 'empty'], 3: [[], True, [], 'empty'], 4: [[], True, [], 'empty'], 5: [[], True, [], 'empty']}[N])
check('6', solve([[N,N+1],False,"pop",0,3]), {1: [[2], False, [2], 1], 2: [[3], False, [3], 2], 3: [[4], False, [4], 3], 4: [[5], False, [5], 4], 5: [[6], False, [6], 5]}[N])
check('7', solve([[N],False,"push",N+1,3]), {1: [[1, 2], False, [1, 2], None], 2: [[2, 3], False, [2, 3], None], 3: [[3, 4], False, [3, 4], None], 4: [[4, 5], False, [4, 5], None], 5: [[5, 6], False, [5, 6], None]}[N])
check('full reversed rejection', solve([[N,N+1],True,'push',N+2,2]), [[N,N+1],True,[N+1,N],'full'])
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):
    storage,reverse,op,value,cap=x
    logical=storage[::-1] if reverse else storage[:]
    if op=='flip':return [storage,not reverse,logical[::-1],None]
    if op=='push':
        if len(storage)==cap:return [storage,reverse,logical,'full']
        physical=[value]+storage if reverse else storage+[value]
        return [physical,reverse,logical+[value],None]
    if not storage:return [storage,reverse,logical,'empty']
    result=storage[:-1] if reverse else storage[1:]
    removed=storage[-1] if reverse else storage[0]
    remaining=result[::-1] if reverse and len(result)<2 else result[:]
    return [result,reverse,remaining,removed]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([[N,N+1,N+2],True,"pop",0,4]), {1: [[1, 2], True, [2, 1], 3], 2: [[2, 3], True, [3, 2], 4], 3: [[3, 4], True, [4, 3], 5], 4: [[4, 5], True, [5, 4], 6], 5: [[5, 6], True, [6, 5], 7]}[N])
check('1', solve([[N,N+1],True,"push",N+2,4]), {1: [[3, 1, 2], True, [2, 1, 3], None], 2: [[4, 2, 3], True, [3, 2, 4], None], 3: [[5, 3, 4], True, [4, 3, 5], None], 4: [[6, 4, 5], True, [5, 4, 6], None], 5: [[7, 5, 6], True, [6, 5, 7], None]}[N])
check('2', solve([[N,N+1],False,"flip",0,3]), {1: [[1, 2], True, [2, 1], None], 2: [[2, 3], True, [3, 2], None], 3: [[3, 4], True, [4, 3], None], 4: [[4, 5], True, [5, 4], None], 5: [[5, 6], True, [6, 5], None]}[N])
check('3', solve([[N,N+1],True,"flip",0,3]), {1: [[1, 2], False, [1, 2], None], 2: [[2, 3], False, [2, 3], None], 3: [[3, 4], False, [3, 4], None], 4: [[4, 5], False, [4, 5], None], 5: [[5, 6], False, [5, 6], None]}[N])
check('4', solve([[N],False,"push",N+1,1]), {1: [[1], False, [1], 'full'], 2: [[2], False, [2], 'full'], 3: [[3], False, [3], 'full'], 4: [[4], False, [4], 'full'], 5: [[5], False, [5], 'full']}[N])
check('5', solve([[],True,"pop",0,3]), {1: [[], True, [], 'empty'], 2: [[], True, [], 'empty'], 3: [[], True, [], 'empty'], 4: [[], True, [], 'empty'], 5: [[], True, [], 'empty']}[N])
check('6', solve([[N,N+1],False,"pop",0,3]), {1: [[2], False, [2], 1], 2: [[3], False, [3], 2], 3: [[4], False, [4], 3], 4: [[5], False, [5], 4], 5: [[6], False, [6], 5]}[N])
check('7', solve([[N],False,"push",N+1,3]), {1: [[1, 2], False, [1, 2], None], 2: [[2, 3], False, [2, 3], None], 3: [[3, 4], False, [3, 4], None], 4: [[4, 5], False, [4, 5], None], 5: [[5, 6], False, [5, 6], None]}[N])
check('full reversed rejection', solve([[N,N+1],True,'push',N+2,2]), [[N,N+1],True,[N+1,N],'full'])
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:
Lazy deque pop exposes physical order as logical order.

A bounded deque stores physical values and a lazy reversed flag. Flip toggles orientation without moving storage; logical append and front-pop select the appropriate physical endpoint. Full append rejects.

split: open-access


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

N = 1
observations = []
def solve(x):
    storage,reverse,op,value,cap=x
    logical=storage[::-1] if reverse else storage[:]
    if op=='flip':return [storage,not reverse,logical[::-1],None]
    if op=='push':
        if len(storage)==cap:return [storage,False,logical,'full']
        physical=[value]+storage if reverse else storage+[value]
        return [physical,reverse,logical+[value],None]
    if not storage:return [storage,reverse,logical,'empty']
    result=storage[:-1] if reverse else storage[1:]
    removed=storage[-1] if reverse else storage[0]
    remaining=result[::-1] if reverse else result[:]
    return [result,reverse,remaining,removed]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([[N,N+1,N+2],True,"pop",0,4]), {1: [[1, 2], True, [2, 1], 3], 2: [[2, 3], True, [3, 2], 4], 3: [[3, 4], True, [4, 3], 5], 4: [[4, 5], True, [5, 4], 6], 5: [[5, 6], True, [6, 5], 7]}[N])
check('1', solve([[N,N+1],True,"push",N+2,4]), {1: [[3, 1, 2], True, [2, 1, 3], None], 2: [[4, 2, 3], True, [3, 2, 4], None], 3: [[5, 3, 4], True, [4, 3, 5], None], 4: [[6, 4, 5], True, [5, 4, 6], None], 5: [[7, 5, 6], True, [6, 5, 7], None]}[N])
check('2', solve([[N,N+1],False,"flip",0,3]), {1: [[1, 2], True, [2, 1], None], 2: [[2, 3], True, [3, 2], None], 3: [[3, 4], True, [4, 3], None], 4: [[4, 5], True, [5, 4], None], 5: [[5, 6], True, [6, 5], None]}[N])
check('3', solve([[N,N+1],True,"flip",0,3]), {1: [[1, 2], False, [1, 2], None], 2: [[2, 3], False, [2, 3], None], 3: [[3, 4], False, [3, 4], None], 4: [[4, 5], False, [4, 5], None], 5: [[5, 6], False, [5, 6], None]}[N])
check('4', solve([[N],False,"push",N+1,1]), {1: [[1], False, [1], 'full'], 2: [[2], False, [2], 'full'], 3: [[3], False, [3], 'full'], 4: [[4], False, [4], 'full'], 5: [[5], False, [5], 'full']}[N])
check('5', solve([[],True,"pop",0,3]), {1: [[], True, [], 'empty'], 2: [[], True, [], 'empty'], 3: [[], True, [], 'empty'], 4: [[], True, [], 'empty'], 5: [[], True, [], 'empty']}[N])
check('6', solve([[N,N+1],False,"pop",0,3]), {1: [[2], False, [2], 1], 2: [[3], False, [3], 2], 3: [[4], False, [4], 3], 4: [[5], False, [5], 4], 5: [[6], False, [6], 5]}[N])
check('7', solve([[N],False,"push",N+1,3]), {1: [[1, 2], False, [1, 2], None], 2: [[2, 3], False, [2, 3], None], 3: [[3, 4], False, [3, 4], None], 4: [[4, 5], False, [4, 5], None], 5: [[5, 6], False, [5, 6], None]}[N])
check('full reversed rejection', solve([[N,N+1],True,'push',N+2,2]), [[N,N+1],True,[N+1,N],'full'])
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):
    storage,reverse,op,value,cap=x
    logical=storage[::-1] if reverse else storage[:]
    if op=='flip':return [storage,not reverse,logical[::-1],None]
    if op=='push':
        if len(storage)==cap:return [storage,False if storage else reverse,logical,'full']
        physical=[value]+storage if reverse else storage+[value]
        return [physical,reverse,logical+[value],None]
    if not storage:return [storage,reverse,logical,'empty']
    result=storage[:-1] if reverse else storage[1:]
    removed=storage[-1] if reverse else storage[0]
    remaining=result[::-1] if reverse else result[:]
    return [result,reverse,remaining,removed]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([[N,N+1,N+2],True,"pop",0,4]), {1: [[1, 2], True, [2, 1], 3], 2: [[2, 3], True, [3, 2], 4], 3: [[3, 4], True, [4, 3], 5], 4: [[4, 5], True, [5, 4], 6], 5: [[5, 6], True, [6, 5], 7]}[N])
check('1', solve([[N,N+1],True,"push",N+2,4]), {1: [[3, 1, 2], True, [2, 1, 3], None], 2: [[4, 2, 3], True, [3, 2, 4], None], 3: [[5, 3, 4], True, [4, 3, 5], None], 4: [[6, 4, 5], True, [5, 4, 6], None], 5: [[7, 5, 6], True, [6, 5, 7], None]}[N])
check('2', solve([[N,N+1],False,"flip",0,3]), {1: [[1, 2], True, [2, 1], None], 2: [[2, 3], True, [3, 2], None], 3: [[3, 4], True, [4, 3], None], 4: [[4, 5], True, [5, 4], None], 5: [[5, 6], True, [6, 5], None]}[N])
check('3', solve([[N,N+1],True,"flip",0,3]), {1: [[1, 2], False, [1, 2], None], 2: [[2, 3], False, [2, 3], None], 3: [[3, 4], False, [3, 4], None], 4: [[4, 5], False, [4, 5], None], 5: [[5, 6], False, [5, 6], None]}[N])
check('4', solve([[N],False,"push",N+1,1]), {1: [[1], False, [1], 'full'], 2: [[2], False, [2], 'full'], 3: [[3], False, [3], 'full'], 4: [[4], False, [4], 'full'], 5: [[5], False, [5], 'full']}[N])
check('5', solve([[],True,"pop",0,3]), {1: [[], True, [], 'empty'], 2: [[], True, [], 'empty'], 3: [[], True, [], 'empty'], 4: [[], True, [], 'empty'], 5: [[], True, [], 'empty']}[N])
check('6', solve([[N,N+1],False,"pop",0,3]), {1: [[2], False, [2], 1], 2: [[3], False, [3], 2], 3: [[4], False, [4], 3], 4: [[5], False, [5], 4], 5: [[6], False, [6], 5]}[N])
check('7', solve([[N],False,"push",N+1,3]), {1: [[1, 2], False, [1, 2], None], 2: [[2, 3], False, [2, 3], None], 3: [[3, 4], False, [3, 4], None], 4: [[4, 5], False, [4, 5], None], 5: [[5, 6], False, [5, 6], None]}[N])
check('full reversed rejection', solve([[N,N+1],True,'push',N+2,2]), [[N,N+1],True,[N+1,N],'full'])
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:
Full deque append rejection clears its lazy orientation flag.

A bounded deque stores physical values and a lazy reversed flag. Flip toggles orientation without moving storage; logical append and front-pop select the appropriate physical endpoint. Full append rejects.

split: open-access


prompt:
Deque view drops negative traversal direction.

Read an explicitly valid positive- or negative-stride bounded deque view. Preserve index order, capture an epoch, and report first/last source positions or null for an empty view.

split: open-access


prompt:
Deque view ignores a multi-slot stride.

Read an explicitly valid positive- or negative-stride bounded deque view. Preserve index order, capture an epoch, and report first/last source positions or null for an empty view.

split: open-access


prompt:
Deque strided view gathers source positions in sorted order.

Read an explicitly valid positive- or negative-stride bounded deque view. Preserve index order, capture an epoch, and report first/last source positions or null for an empty view.

split: open-access


prompt:
Deque strided view reports span width instead of selected count.

Read an explicitly valid positive- or negative-stride bounded deque view. Preserve index order, capture an epoch, and report first/last source positions or null for an empty view.

split: open-access


prompt:
Deque strided view advances epoch merely by reading.

Read an explicitly valid positive- or negative-stride bounded deque view. Preserve index order, capture an epoch, and report first/last source positions or null for an empty view.

split: open-access


prompt:
Deque strided view uses the smallest rather than first source index.

Read an explicitly valid positive- or negative-stride bounded deque view. Preserve index order, capture an epoch, and report first/last source positions or null for an empty view.

split: open-access


prompt:
Deque strided view reports its exclusive stop as last position.

Read an explicitly valid positive- or negative-stride bounded deque view. Preserve index order, capture an epoch, and report first/last source positions or null for an empty view.

split: open-access


prompt:
Ring gap insertion reads backing array order as logical order.

Insert into a valid logical gap by moving the shorter ring side, preferring the right side on equal cost. Left shifts decrement physical head; reconstruct live arc and clear all vacant slots. Full ring rejects atomically.

split: open-access


prompt:
Ring gap insertion shifts the left side on an equal-cost tie.

Insert into a valid logical gap by moving the shorter ring side, preferring the right side on equal cost. Left shifts decrement physical head; reconstruct live arc and clear all vacant slots. Full ring rejects atomically.

split: open-access


prompt:
Ring gap insertion advances head when shifting the prefix.

Insert into a valid logical gap by moving the shorter ring side, preferring the right side on equal cost. Left shifts decrement physical head; reconstruct live arc and clear all vacant slots. Full ring rejects atomically.

split: open-access


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

N = 1
observations = []
def solve(x):
    slots,head,size,gap,value=x
    cap=len(slots)
    if size==cap:return [slots,head,size,False,0]
    logical=[slots[(head+i)%cap] for i in range(size)]
    left=gap<size-gap
    origin=(head-1)%cap if left else head
    inserted=logical[:gap]+[value]+logical[gap:] if gap==0 else logical[:gap]+[value]+logical[gap+1:]
    result=[None]*cap
    for i,v in enumerate(inserted):result[(origin+i)%cap]=v
    count=size+1
    moved=gap if left else size-gap
    return [result,origin,count,True,moved]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([[N,N+1,N+2,None,None],0,3,1,N+3]), {1: [[4, 2, 3, None, 1], 4, 4, True, 1], 2: [[5, 3, 4, None, 2], 4, 4, True, 1], 3: [[6, 4, 5, None, 3], 4, 4, True, 1], 4: [[7, 5, 6, None, 4], 4, 4, True, 1], 5: [[8, 6, 7, None, 5], 4, 4, True, 1]}[N])
check('1', solve([[N+2,None,None,N,N+1],3,3,1,N+3]), {1: [[3, None, 1, 4, 2], 2, 4, True, 1], 2: [[4, None, 2, 5, 3], 2, 4, True, 1], 3: [[5, None, 3, 6, 4], 2, 4, True, 1], 4: [[6, None, 4, 7, 5], 2, 4, True, 1], 5: [[7, None, 5, 8, 6], 2, 4, True, 1]}[N])
check('2', solve([[N,N+1,N+2,N+3,None,None],0,4,2,N+4]), {1: [[1, 2, 5, 3, 4, None], 0, 5, True, 2], 2: [[2, 3, 6, 4, 5, None], 0, 5, True, 2], 3: [[3, 4, 7, 5, 6, None], 0, 5, True, 2], 4: [[4, 5, 8, 6, 7, None], 0, 5, True, 2], 5: [[5, 6, 9, 7, 8, None], 0, 5, True, 2]}[N])
check('3', solve([[None,N,N+1,None],1,2,2,N+2]), {1: [[None, 1, 2, 3], 1, 3, True, 0], 2: [[None, 2, 3, 4], 1, 3, True, 0], 3: [[None, 3, 4, 5], 1, 3, True, 0], 4: [[None, 4, 5, 6], 1, 3, True, 0], 5: [[None, 5, 6, 7], 1, 3, True, 0]}[N])
check('4', solve([[N,N+1],0,2,1,N+2]), {1: [[1, 2], 0, 2, False, 0], 2: [[2, 3], 0, 2, False, 0], 3: [[3, 4], 0, 2, False, 0], 4: [[4, 5], 0, 2, False, 0], 5: [[5, 6], 0, 2, False, 0]}[N])
check('5', solve([[None,None,None],2,0,0,N]), {1: [[None, None, 1], 2, 1, True, 0], 2: [[None, None, 2], 2, 1, True, 0], 3: [[None, None, 3], 2, 1, True, 0], 4: [[None, None, 4], 2, 1, True, 0], 5: [[None, None, 5], 2, 1, True, 0]}[N])
check('6', solve([[N+1,None,None,N],3,2,0,N+2]), {1: [[2, None, 3, 1], 2, 3, True, 0], 2: [[3, None, 4, 2], 2, 3, True, 0], 3: [[4, None, 5, 3], 2, 3, True, 0], 4: [[5, None, 6, 4], 2, 3, True, 0], 5: [[6, None, 7, 5], 2, 3, True, 0]}[N])
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:
Ring gap insertion omits the first suffix element.

Insert into a valid logical gap by moving the shorter ring side, preferring the right side on equal cost. Left shifts decrement physical head; reconstruct live arc and clear all vacant slots. Full ring rejects atomically.

split: open-access


prompt:
Ring gap insertion fills vacant slots with the inserted payload.

Insert into a valid logical gap by moving the shorter ring side, preferring the right side on equal cost. Left shifts decrement physical head; reconstruct live arc and clear all vacant slots. Full ring rejects atomically.

split: open-access


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

N = 1
observations = []
def solve(x):
    slots,head,size,gap,value=x
    cap=len(slots)
    if size==cap:return [slots,head,size,False,0]
    logical=[slots[(head+i)%cap] for i in range(size)]
    left=gap<size-gap
    origin=(head-1)%cap if left else head
    inserted=logical[:gap]+[value]+logical[gap:]
    result=[None]*cap
    for i,v in enumerate(inserted):result[(origin+i)%cap if not left else i%cap]=v
    count=size+1
    moved=gap if left else size-gap
    return [result,origin,count,True,moved]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([[N,N+1,N+2,None,None],0,3,1,N+3]), {1: [[4, 2, 3, None, 1], 4, 4, True, 1], 2: [[5, 3, 4, None, 2], 4, 4, True, 1], 3: [[6, 4, 5, None, 3], 4, 4, True, 1], 4: [[7, 5, 6, None, 4], 4, 4, True, 1], 5: [[8, 6, 7, None, 5], 4, 4, True, 1]}[N])
check('1', solve([[N+2,None,None,N,N+1],3,3,1,N+3]), {1: [[3, None, 1, 4, 2], 2, 4, True, 1], 2: [[4, None, 2, 5, 3], 2, 4, True, 1], 3: [[5, None, 3, 6, 4], 2, 4, True, 1], 4: [[6, None, 4, 7, 5], 2, 4, True, 1], 5: [[7, None, 5, 8, 6], 2, 4, True, 1]}[N])
check('2', solve([[N,N+1,N+2,N+3,None,None],0,4,2,N+4]), {1: [[1, 2, 5, 3, 4, None], 0, 5, True, 2], 2: [[2, 3, 6, 4, 5, None], 0, 5, True, 2], 3: [[3, 4, 7, 5, 6, None], 0, 5, True, 2], 4: [[4, 5, 8, 6, 7, None], 0, 5, True, 2], 5: [[5, 6, 9, 7, 8, None], 0, 5, True, 2]}[N])
check('3', solve([[None,N,N+1,None],1,2,2,N+2]), {1: [[None, 1, 2, 3], 1, 3, True, 0], 2: [[None, 2, 3, 4], 1, 3, True, 0], 3: [[None, 3, 4, 5], 1, 3, True, 0], 4: [[None, 4, 5, 6], 1, 3, True, 0], 5: [[None, 5, 6, 7], 1, 3, True, 0]}[N])
check('4', solve([[N,N+1],0,2,1,N+2]), {1: [[1, 2], 0, 2, False, 0], 2: [[2, 3], 0, 2, False, 0], 3: [[3, 4], 0, 2, False, 0], 4: [[4, 5], 0, 2, False, 0], 5: [[5, 6], 0, 2, False, 0]}[N])
check('5', solve([[None,None,None],2,0,0,N]), {1: [[None, None, 1], 2, 1, True, 0], 2: [[None, None, 2], 2, 1, True, 0], 3: [[None, None, 3], 2, 1, True, 0], 4: [[None, None, 4], 2, 1, True, 0], 5: [[None, None, 5], 2, 1, True, 0]}[N])
check('6', solve([[N+1,None,None,N],3,2,0,N+2]), {1: [[2, None, 3, 1], 2, 3, True, 0], 2: [[3, None, 4, 2], 2, 3, True, 0], 3: [[4, None, 5, 3], 2, 3, True, 0], 4: [[5, None, 6, 4], 2, 3, True, 0], 5: [[6, None, 7, 5], 2, 3, True, 0]}[N])
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:
Ring gap insertion ignores its updated head while scattering.

Insert into a valid logical gap by moving the shorter ring side, preferring the right side on equal cost. Left shifts decrement physical head; reconstruct live arc and clear all vacant slots. Full ring rejects atomically.

split: open-access


prompt:
Ring gap insertion reports the long side as moved.

Insert into a valid logical gap by moving the shorter ring side, preferring the right side on equal cost. Left shifts decrement physical head; reconstruct live arc and clear all vacant slots. Full ring rejects atomically.

split: open-access


prompt:
Deque compaction builds the inverse relocation table.

Compact a deque node arena using its logical live-ID chain. Preserve chain order, remap nullable stable cursors, return old-to-new relocation map, advance epoch, and identify reclaimed old storage IDs.

split: open-access


prompt:
Deque arena compaction copies ascending storage IDs.

Compact a deque node arena using its logical live-ID chain. Preserve chain order, remap nullable stable cursors, return old-to-new relocation map, advance epoch, and identify reclaimed old storage IDs.

split: open-access


prompt:
Deque compaction leaves old IDs in its traversal chain.

Compact a deque node arena using its logical live-ID chain. Preserve chain order, remap nullable stable cursors, return old-to-new relocation map, advance epoch, and identify reclaimed old storage IDs.

split: open-access


prompt:
Deque compaction preserves stale physical cursor indices.

Compact a deque node arena using its logical live-ID chain. Preserve chain order, remap nullable stable cursors, return old-to-new relocation map, advance epoch, and identify reclaimed old storage IDs.

split: open-access


prompt:
Deque compaction fails to invalidate physical-location caches.

Compact a deque node arena using its logical live-ID chain. Preserve chain order, remap nullable stable cursors, return old-to-new relocation map, advance epoch, and identify reclaimed old storage IDs.

split: open-access


prompt:
Deque compaction frees live old node IDs instead of holes.

Compact a deque node arena using its logical live-ID chain. Preserve chain order, remap nullable stable cursors, return old-to-new relocation map, advance epoch, and identify reclaimed old storage IDs.

split: open-access


prompt:
Deque compaction retains old arena length as logical length.

Compact a deque node arena using its logical live-ID chain. Preserve chain order, remap nullable stable cursors, return old-to-new relocation map, advance epoch, and identify reclaimed old storage IDs.

split: open-access


prompt:
Deque shrink ignores the minimum backing allocation.

A bounded deque shrinks by half, floored by live size and a minimum allocation, only at or below low occupancy, with no borrows and with resulting capacity at least the configured high watermark. Unchanged allocations keep epoch.

split: open-access


prompt:
Deque shrink halves below its live occupancy.

A bounded deque shrinks by half, floored by live size and a minimum allocation, only at or below low occupancy, with no borrows and with resulting capacity at least the configured high watermark. Unchanged allocations keep epoch.

split: open-access


prompt:
Deque shrink misses an exact low-watermark trigger.

A bounded deque shrinks by half, floored by live size and a minimum allocation, only at or below low occupancy, with no borrows and with resulting capacity at least the configured high watermark. Unchanged allocations keep epoch.

split: open-access


prompt:
Deque shrink reallocates while a storage borrow exists.

A bounded deque shrinks by half, floored by live size and a minimum allocation, only at or below low occupancy, with no borrows and with resulting capacity at least the configured high watermark. Unchanged allocations keep epoch.

split: open-access


prompt:
Deque shrink ignores post-shrink high watermark headroom.

A bounded deque shrinks by half, floored by live size and a minimum allocation, only at or below low occupancy, with no borrows and with resulting capacity at least the configured high watermark. Unchanged allocations keep epoch.

split: open-access


prompt:
Deque shrink attempt advances epoch even when prohibited.

A bounded deque shrinks by half, floored by live size and a minimum allocation, only at or below low occupancy, with no borrows and with resulting capacity at least the configured high watermark. Unchanged allocations keep epoch.

split: open-access


prompt:
Deque shrink retains pre-shrink free-slot accounting.

A bounded deque shrinks by half, floored by live size and a minimum allocation, only at or below low occupancy, with no borrows and with resulting capacity at least the configured high watermark. Unchanged allocations keep epoch.

split: open-access


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

N = 1
observations = []
def solve(x):
    old,new,low,high,paused=x
    events=[]
    state=paused
    if not paused and new>=high:
        state=True
        events.append('pause')
    if paused and old>low>=new:
        state=False
        events.append('resume')
    at_high=new>=high
    at_low=new<=low
    headroom=max(0,high-new)
    excess=max(0,new-low)
    return [state,events,at_high,at_low,headroom,excess]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([2,5,2,5,False]), {1: [True, ['pause'], True, False, 0, 3], 2: [True, ['pause'], True, False, 0, 3], 3: [True, ['pause'], True, False, 0, 3], 4: [True, ['pause'], True, False, 0, 3], 5: [True, ['pause'], True, False, 0, 3]}[N])
check('1', solve([5,2,2,5,True]), {1: [False, ['resume'], False, True, 3, 0], 2: [False, ['resume'], False, True, 3, 0], 3: [False, ['resume'], False, True, 3, 0], 4: [False, ['resume'], False, True, 3, 0], 5: [False, ['resume'], False, True, 3, 0]}[N])
check('2', solve([5,6,2,5,False]), {1: [False, [], True, False, 0, 4], 2: [False, [], True, False, 0, 4], 3: [False, [], True, False, 0, 4], 4: [False, [], True, False, 0, 4], 5: [False, [], True, False, 0, 4]}[N])
check('3', solve([2,1,2,5,True]), {1: [True, [], False, True, 4, 0], 2: [True, [], False, True, 4, 0], 3: [True, [], False, True, 4, 0], 4: [True, [], False, True, 4, 0], 5: [True, [], False, True, 4, 0]}[N])
check('4', solve([N,N,0,N+3,False]), {1: [False, [], False, False, 3, 1], 2: [False, [], False, False, 3, 2], 3: [False, [], False, False, 3, 3], 4: [False, [], False, False, 3, 4], 5: [False, [], False, False, 3, 5]}[N])
check('5', solve([3,4,2,5,False]), {1: [False, [], False, False, 1, 2], 2: [False, [], False, False, 1, 2], 3: [False, [], False, False, 1, 2], 4: [False, [], False, False, 1, 2], 5: [False, [], False, False, 1, 2]}[N])
check('6', solve([6,1,2,5,True]), {1: [False, ['resume'], False, True, 4, 0], 2: [False, ['resume'], False, True, 4, 0], 3: [False, ['resume'], False, True, 4, 0], 4: [False, ['resume'], False, True, 4, 0], 5: [False, ['resume'], False, True, 4, 0]}[N])
check('7', solve([1,7,2,5,False]), {1: [True, ['pause'], True, False, 0, 5], 2: [True, ['pause'], True, False, 0, 5], 3: [True, ['pause'], True, False, 0, 5], 4: [True, ['pause'], True, False, 0, 5], 5: [True, ['pause'], True, False, 0, 5]}[N])
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):
    old,new,low,high,paused=x
    events=[]
    state=paused
    if not paused and new>=high and old!=new:
        state=True
        events.append('pause')
    if paused and old>low>=new:
        state=False
        events.append('resume')
    at_high=new>=high
    at_low=new<=low
    headroom=max(0,high-new)
    excess=max(0,new-low)
    return [state,events,at_high,at_low,headroom,excess]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([2,5,2,5,False]), {1: [True, ['pause'], True, False, 0, 3], 2: [True, ['pause'], True, False, 0, 3], 3: [True, ['pause'], True, False, 0, 3], 4: [True, ['pause'], True, False, 0, 3], 5: [True, ['pause'], True, False, 0, 3]}[N])
check('1', solve([5,2,2,5,True]), {1: [False, ['resume'], False, True, 3, 0], 2: [False, ['resume'], False, True, 3, 0], 3: [False, ['resume'], False, True, 3, 0], 4: [False, ['resume'], False, True, 3, 0], 5: [False, ['resume'], False, True, 3, 0]}[N])
check('2', solve([5,6,2,5,False]), {1: [False, [], True, False, 0, 4], 2: [False, [], True, False, 0, 4], 3: [False, [], True, False, 0, 4], 4: [False, [], True, False, 0, 4], 5: [False, [], True, False, 0, 4]}[N])
check('3', solve([2,1,2,5,True]), {1: [True, [], False, True, 4, 0], 2: [True, [], False, True, 4, 0], 3: [True, [], False, True, 4, 0], 4: [True, [], False, True, 4, 0], 5: [True, [], False, True, 4, 0]}[N])
check('4', solve([N,N,0,N+3,False]), {1: [False, [], False, False, 3, 1], 2: [False, [], False, False, 3, 2], 3: [False, [], False, False, 3, 3], 4: [False, [], False, False, 3, 4], 5: [False, [], False, False, 3, 5]}[N])
check('5', solve([3,4,2,5,False]), {1: [False, [], False, False, 1, 2], 2: [False, [], False, False, 1, 2], 3: [False, [], False, False, 1, 2], 4: [False, [], False, False, 1, 2], 5: [False, [], False, False, 1, 2]}[N])
check('6', solve([6,1,2,5,True]), {1: [False, ['resume'], False, True, 4, 0], 2: [False, ['resume'], False, True, 4, 0], 3: [False, ['resume'], False, True, 4, 0], 4: [False, ['resume'], False, True, 4, 0], 5: [False, ['resume'], False, True, 4, 0]}[N])
check('7', solve([1,7,2,5,False]), {1: [True, ['pause'], True, False, 0, 5], 2: [True, ['pause'], True, False, 0, 5], 3: [True, ['pause'], True, False, 0, 5], 4: [True, ['pause'], True, False, 0, 5], 5: [True, ['pause'], True, False, 0, 5]}[N])
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:
Deque pressure emits pause repeatedly while above high watermark.

Bounded deque pressure notifications are edge-triggered: unpaused producers pause on an upward high crossing; paused producers resume on a downward low crossing. Return state, ordered notification list and distances to both thresholds.

split: open-access


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

N = 1
observations = []
def solve(x):
    old,new,low,high,paused=x
    events=[]
    state=paused
    if not paused and old<high<=new:
        state=True
        events.append('pause')
    if paused and new<=low:
        state=False
        events.append('resume')
    at_high=new>=high
    at_low=new<=low
    headroom=max(0,high-new)
    excess=max(0,new-low)
    return [state,events,at_high,at_low,headroom,excess]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([2,5,2,5,False]), {1: [True, ['pause'], True, False, 0, 3], 2: [True, ['pause'], True, False, 0, 3], 3: [True, ['pause'], True, False, 0, 3], 4: [True, ['pause'], True, False, 0, 3], 5: [True, ['pause'], True, False, 0, 3]}[N])
check('1', solve([5,2,2,5,True]), {1: [False, ['resume'], False, True, 3, 0], 2: [False, ['resume'], False, True, 3, 0], 3: [False, ['resume'], False, True, 3, 0], 4: [False, ['resume'], False, True, 3, 0], 5: [False, ['resume'], False, True, 3, 0]}[N])
check('2', solve([5,6,2,5,False]), {1: [False, [], True, False, 0, 4], 2: [False, [], True, False, 0, 4], 3: [False, [], True, False, 0, 4], 4: [False, [], True, False, 0, 4], 5: [False, [], True, False, 0, 4]}[N])
check('3', solve([2,1,2,5,True]), {1: [True, [], False, True, 4, 0], 2: [True, [], False, True, 4, 0], 3: [True, [], False, True, 4, 0], 4: [True, [], False, True, 4, 0], 5: [True, [], False, True, 4, 0]}[N])
check('4', solve([N,N,0,N+3,False]), {1: [False, [], False, False, 3, 1], 2: [False, [], False, False, 3, 2], 3: [False, [], False, False, 3, 3], 4: [False, [], False, False, 3, 4], 5: [False, [], False, False, 3, 5]}[N])
check('5', solve([3,4,2,5,False]), {1: [False, [], False, False, 1, 2], 2: [False, [], False, False, 1, 2], 3: [False, [], False, False, 1, 2], 4: [False, [], False, False, 1, 2], 5: [False, [], False, False, 1, 2]}[N])
check('6', solve([6,1,2,5,True]), {1: [False, ['resume'], False, True, 4, 0], 2: [False, ['resume'], False, True, 4, 0], 3: [False, ['resume'], False, True, 4, 0], 4: [False, ['resume'], False, True, 4, 0], 5: [False, ['resume'], False, True, 4, 0]}[N])
check('7', solve([1,7,2,5,False]), {1: [True, ['pause'], True, False, 0, 5], 2: [True, ['pause'], True, False, 0, 5], 3: [True, ['pause'], True, False, 0, 5], 4: [True, ['pause'], True, False, 0, 5], 5: [True, ['pause'], True, False, 0, 5]}[N])
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):
    old,new,low,high,paused=x
    events=[]
    state=paused
    if not paused and old<high<=new:
        state=True
        events.append('pause')
    if paused and new<=low and old!=new:
        state=False
        events.append('resume')
    at_high=new>=high
    at_low=new<=low
    headroom=max(0,high-new)
    excess=max(0,new-low)
    return [state,events,at_high,at_low,headroom,excess]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([2,5,2,5,False]), {1: [True, ['pause'], True, False, 0, 3], 2: [True, ['pause'], True, False, 0, 3], 3: [True, ['pause'], True, False, 0, 3], 4: [True, ['pause'], True, False, 0, 3], 5: [True, ['pause'], True, False, 0, 3]}[N])
check('1', solve([5,2,2,5,True]), {1: [False, ['resume'], False, True, 3, 0], 2: [False, ['resume'], False, True, 3, 0], 3: [False, ['resume'], False, True, 3, 0], 4: [False, ['resume'], False, True, 3, 0], 5: [False, ['resume'], False, True, 3, 0]}[N])
check('2', solve([5,6,2,5,False]), {1: [False, [], True, False, 0, 4], 2: [False, [], True, False, 0, 4], 3: [False, [], True, False, 0, 4], 4: [False, [], True, False, 0, 4], 5: [False, [], True, False, 0, 4]}[N])
check('3', solve([2,1,2,5,True]), {1: [True, [], False, True, 4, 0], 2: [True, [], False, True, 4, 0], 3: [True, [], False, True, 4, 0], 4: [True, [], False, True, 4, 0], 5: [True, [], False, True, 4, 0]}[N])
check('4', solve([N,N,0,N+3,False]), {1: [False, [], False, False, 3, 1], 2: [False, [], False, False, 3, 2], 3: [False, [], False, False, 3, 3], 4: [False, [], False, False, 3, 4], 5: [False, [], False, False, 3, 5]}[N])
check('5', solve([3,4,2,5,False]), {1: [False, [], False, False, 1, 2], 2: [False, [], False, False, 1, 2], 3: [False, [], False, False, 1, 2], 4: [False, [], False, False, 1, 2], 5: [False, [], False, False, 1, 2]}[N])
check('6', solve([6,1,2,5,True]), {1: [False, ['resume'], False, True, 4, 0], 2: [False, ['resume'], False, True, 4, 0], 3: [False, ['resume'], False, True, 4, 0], 4: [False, ['resume'], False, True, 4, 0], 5: [False, ['resume'], False, True, 4, 0]}[N])
check('7', solve([1,7,2,5,False]), {1: [True, ['pause'], True, False, 0, 5], 2: [True, ['pause'], True, False, 0, 5], 3: [True, ['pause'], True, False, 0, 5], 4: [True, ['pause'], True, False, 0, 5], 5: [True, ['pause'], True, False, 0, 5]}[N])
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:
Deque pressure emits resume repeatedly below low watermark.

Bounded deque pressure notifications are edge-triggered: unpaused producers pause on an upward high crossing; paused producers resume on a downward low crossing. Return state, ordered notification list and distances to both thresholds.

split: open-access


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

N = 1
observations = []
def solve(x):
    old,new,low,high,paused=x
    events=[]
    state=paused
    if not paused and old<high<=new:
        state=paused
        events.append('pause')
    if paused and old>low>=new:
        state=False
        events.append('resume')
    at_high=new>=high
    at_low=new<=low
    headroom=max(0,high-new)
    excess=max(0,new-low)
    return [state,events,at_high,at_low,headroom,excess]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([2,5,2,5,False]), {1: [True, ['pause'], True, False, 0, 3], 2: [True, ['pause'], True, False, 0, 3], 3: [True, ['pause'], True, False, 0, 3], 4: [True, ['pause'], True, False, 0, 3], 5: [True, ['pause'], True, False, 0, 3]}[N])
check('1', solve([5,2,2,5,True]), {1: [False, ['resume'], False, True, 3, 0], 2: [False, ['resume'], False, True, 3, 0], 3: [False, ['resume'], False, True, 3, 0], 4: [False, ['resume'], False, True, 3, 0], 5: [False, ['resume'], False, True, 3, 0]}[N])
check('2', solve([5,6,2,5,False]), {1: [False, [], True, False, 0, 4], 2: [False, [], True, False, 0, 4], 3: [False, [], True, False, 0, 4], 4: [False, [], True, False, 0, 4], 5: [False, [], True, False, 0, 4]}[N])
check('3', solve([2,1,2,5,True]), {1: [True, [], False, True, 4, 0], 2: [True, [], False, True, 4, 0], 3: [True, [], False, True, 4, 0], 4: [True, [], False, True, 4, 0], 5: [True, [], False, True, 4, 0]}[N])
check('4', solve([N,N,0,N+3,False]), {1: [False, [], False, False, 3, 1], 2: [False, [], False, False, 3, 2], 3: [False, [], False, False, 3, 3], 4: [False, [], False, False, 3, 4], 5: [False, [], False, False, 3, 5]}[N])
check('5', solve([3,4,2,5,False]), {1: [False, [], False, False, 1, 2], 2: [False, [], False, False, 1, 2], 3: [False, [], False, False, 1, 2], 4: [False, [], False, False, 1, 2], 5: [False, [], False, False, 1, 2]}[N])
check('6', solve([6,1,2,5,True]), {1: [False, ['resume'], False, True, 4, 0], 2: [False, ['resume'], False, True, 4, 0], 3: [False, ['resume'], False, True, 4, 0], 4: [False, ['resume'], False, True, 4, 0], 5: [False, ['resume'], False, True, 4, 0]}[N])
check('7', solve([1,7,2,5,False]), {1: [True, ['pause'], True, False, 0, 5], 2: [True, ['pause'], True, False, 0, 5], 3: [True, ['pause'], True, False, 0, 5], 4: [True, ['pause'], True, False, 0, 5], 5: [True, ['pause'], True, False, 0, 5]}[N])
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):
    old,new,low,high,paused=x
    events=[]
    state=paused
    if not paused and old<high<=new:
        state=True if new>high else paused
        events.append('pause')
    if paused and old>low>=new:
        state=False
        events.append('resume')
    at_high=new>=high
    at_low=new<=low
    headroom=max(0,high-new)
    excess=max(0,new-low)
    return [state,events,at_high,at_low,headroom,excess]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([2,5,2,5,False]), {1: [True, ['pause'], True, False, 0, 3], 2: [True, ['pause'], True, False, 0, 3], 3: [True, ['pause'], True, False, 0, 3], 4: [True, ['pause'], True, False, 0, 3], 5: [True, ['pause'], True, False, 0, 3]}[N])
check('1', solve([5,2,2,5,True]), {1: [False, ['resume'], False, True, 3, 0], 2: [False, ['resume'], False, True, 3, 0], 3: [False, ['resume'], False, True, 3, 0], 4: [False, ['resume'], False, True, 3, 0], 5: [False, ['resume'], False, True, 3, 0]}[N])
check('2', solve([5,6,2,5,False]), {1: [False, [], True, False, 0, 4], 2: [False, [], True, False, 0, 4], 3: [False, [], True, False, 0, 4], 4: [False, [], True, False, 0, 4], 5: [False, [], True, False, 0, 4]}[N])
check('3', solve([2,1,2,5,True]), {1: [True, [], False, True, 4, 0], 2: [True, [], False, True, 4, 0], 3: [True, [], False, True, 4, 0], 4: [True, [], False, True, 4, 0], 5: [True, [], False, True, 4, 0]}[N])
check('4', solve([N,N,0,N+3,False]), {1: [False, [], False, False, 3, 1], 2: [False, [], False, False, 3, 2], 3: [False, [], False, False, 3, 3], 4: [False, [], False, False, 3, 4], 5: [False, [], False, False, 3, 5]}[N])
check('5', solve([3,4,2,5,False]), {1: [False, [], False, False, 1, 2], 2: [False, [], False, False, 1, 2], 3: [False, [], False, False, 1, 2], 4: [False, [], False, False, 1, 2], 5: [False, [], False, False, 1, 2]}[N])
check('6', solve([6,1,2,5,True]), {1: [False, ['resume'], False, True, 4, 0], 2: [False, ['resume'], False, True, 4, 0], 3: [False, ['resume'], False, True, 4, 0], 4: [False, ['resume'], False, True, 4, 0], 5: [False, ['resume'], False, True, 4, 0]}[N])
check('7', solve([1,7,2,5,False]), {1: [True, ['pause'], True, False, 0, 5], 2: [True, ['pause'], True, False, 0, 5], 3: [True, ['pause'], True, False, 0, 5], 4: [True, ['pause'], True, False, 0, 5], 5: [True, ['pause'], True, False, 0, 5]}[N])
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:
Deque high-watermark crossing emits a pause without storing paused state.

Bounded deque pressure notifications are edge-triggered: unpaused producers pause on an upward high crossing; paused producers resume on a downward low crossing. Return state, ordered notification list and distances to both thresholds.

split: open-access


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

N = 1
observations = []
def solve(x):
    old,new,low,high,paused=x
    events=[]
    state=paused
    if not paused and old<high<=new:
        state=True
        events.append('pause')
    if paused and old>low>=new:
        state=paused
        events.append('resume')
    at_high=new>=high
    at_low=new<=low
    headroom=max(0,high-new)
    excess=max(0,new-low)
    return [state,events,at_high,at_low,headroom,excess]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([2,5,2,5,False]), {1: [True, ['pause'], True, False, 0, 3], 2: [True, ['pause'], True, False, 0, 3], 3: [True, ['pause'], True, False, 0, 3], 4: [True, ['pause'], True, False, 0, 3], 5: [True, ['pause'], True, False, 0, 3]}[N])
check('1', solve([5,2,2,5,True]), {1: [False, ['resume'], False, True, 3, 0], 2: [False, ['resume'], False, True, 3, 0], 3: [False, ['resume'], False, True, 3, 0], 4: [False, ['resume'], False, True, 3, 0], 5: [False, ['resume'], False, True, 3, 0]}[N])
check('2', solve([5,6,2,5,False]), {1: [False, [], True, False, 0, 4], 2: [False, [], True, False, 0, 4], 3: [False, [], True, False, 0, 4], 4: [False, [], True, False, 0, 4], 5: [False, [], True, False, 0, 4]}[N])
check('3', solve([2,1,2,5,True]), {1: [True, [], False, True, 4, 0], 2: [True, [], False, True, 4, 0], 3: [True, [], False, True, 4, 0], 4: [True, [], False, True, 4, 0], 5: [True, [], False, True, 4, 0]}[N])
check('4', solve([N,N,0,N+3,False]), {1: [False, [], False, False, 3, 1], 2: [False, [], False, False, 3, 2], 3: [False, [], False, False, 3, 3], 4: [False, [], False, False, 3, 4], 5: [False, [], False, False, 3, 5]}[N])
check('5', solve([3,4,2,5,False]), {1: [False, [], False, False, 1, 2], 2: [False, [], False, False, 1, 2], 3: [False, [], False, False, 1, 2], 4: [False, [], False, False, 1, 2], 5: [False, [], False, False, 1, 2]}[N])
check('6', solve([6,1,2,5,True]), {1: [False, ['resume'], False, True, 4, 0], 2: [False, ['resume'], False, True, 4, 0], 3: [False, ['resume'], False, True, 4, 0], 4: [False, ['resume'], False, True, 4, 0], 5: [False, ['resume'], False, True, 4, 0]}[N])
check('7', solve([1,7,2,5,False]), {1: [True, ['pause'], True, False, 0, 5], 2: [True, ['pause'], True, False, 0, 5], 3: [True, ['pause'], True, False, 0, 5], 4: [True, ['pause'], True, False, 0, 5], 5: [True, ['pause'], True, False, 0, 5]}[N])
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):
    old,new,low,high,paused=x
    events=[]
    state=paused
    if not paused and old<high<=new:
        state=True
        events.append('pause')
    if paused and old>low>=new:
        state=False if new<low else paused
        events.append('resume')
    at_high=new>=high
    at_low=new<=low
    headroom=max(0,high-new)
    excess=max(0,new-low)
    return [state,events,at_high,at_low,headroom,excess]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([2,5,2,5,False]), {1: [True, ['pause'], True, False, 0, 3], 2: [True, ['pause'], True, False, 0, 3], 3: [True, ['pause'], True, False, 0, 3], 4: [True, ['pause'], True, False, 0, 3], 5: [True, ['pause'], True, False, 0, 3]}[N])
check('1', solve([5,2,2,5,True]), {1: [False, ['resume'], False, True, 3, 0], 2: [False, ['resume'], False, True, 3, 0], 3: [False, ['resume'], False, True, 3, 0], 4: [False, ['resume'], False, True, 3, 0], 5: [False, ['resume'], False, True, 3, 0]}[N])
check('2', solve([5,6,2,5,False]), {1: [False, [], True, False, 0, 4], 2: [False, [], True, False, 0, 4], 3: [False, [], True, False, 0, 4], 4: [False, [], True, False, 0, 4], 5: [False, [], True, False, 0, 4]}[N])
check('3', solve([2,1,2,5,True]), {1: [True, [], False, True, 4, 0], 2: [True, [], False, True, 4, 0], 3: [True, [], False, True, 4, 0], 4: [True, [], False, True, 4, 0], 5: [True, [], False, True, 4, 0]}[N])
check('4', solve([N,N,0,N+3,False]), {1: [False, [], False, False, 3, 1], 2: [False, [], False, False, 3, 2], 3: [False, [], False, False, 3, 3], 4: [False, [], False, False, 3, 4], 5: [False, [], False, False, 3, 5]}[N])
check('5', solve([3,4,2,5,False]), {1: [False, [], False, False, 1, 2], 2: [False, [], False, False, 1, 2], 3: [False, [], False, False, 1, 2], 4: [False, [], False, False, 1, 2], 5: [False, [], False, False, 1, 2]}[N])
check('6', solve([6,1,2,5,True]), {1: [False, ['resume'], False, True, 4, 0], 2: [False, ['resume'], False, True, 4, 0], 3: [False, ['resume'], False, True, 4, 0], 4: [False, ['resume'], False, True, 4, 0], 5: [False, ['resume'], False, True, 4, 0]}[N])
check('7', solve([1,7,2,5,False]), {1: [True, ['pause'], True, False, 0, 5], 2: [True, ['pause'], True, False, 0, 5], 3: [True, ['pause'], True, False, 0, 5], 4: [True, ['pause'], True, False, 0, 5], 5: [True, ['pause'], True, False, 0, 5]}[N])
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:
Deque low-watermark crossing emits resume while remaining paused.

Bounded deque pressure notifications are edge-triggered: unpaused producers pause on an upward high crossing; paused producers resume on a downward low crossing. Return state, ordered notification list and distances to both thresholds.

split: open-access


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

N = 1
observations = []
def solve(x):
    old,new,low,high,paused=x
    events=[]
    state=paused
    if not paused and old<high<=new:
        state=True
        events.append('pause')
    if paused and old>low>=new:
        state=False
        events.append('resume')
    at_high=new>high
    at_low=new<=low
    headroom=max(0,high-new)
    excess=max(0,new-low)
    return [state,events,at_high,at_low,headroom,excess]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([2,5,2,5,False]), {1: [True, ['pause'], True, False, 0, 3], 2: [True, ['pause'], True, False, 0, 3], 3: [True, ['pause'], True, False, 0, 3], 4: [True, ['pause'], True, False, 0, 3], 5: [True, ['pause'], True, False, 0, 3]}[N])
check('1', solve([5,2,2,5,True]), {1: [False, ['resume'], False, True, 3, 0], 2: [False, ['resume'], False, True, 3, 0], 3: [False, ['resume'], False, True, 3, 0], 4: [False, ['resume'], False, True, 3, 0], 5: [False, ['resume'], False, True, 3, 0]}[N])
check('2', solve([5,6,2,5,False]), {1: [False, [], True, False, 0, 4], 2: [False, [], True, False, 0, 4], 3: [False, [], True, False, 0, 4], 4: [False, [], True, False, 0, 4], 5: [False, [], True, False, 0, 4]}[N])
check('3', solve([2,1,2,5,True]), {1: [True, [], False, True, 4, 0], 2: [True, [], False, True, 4, 0], 3: [True, [], False, True, 4, 0], 4: [True, [], False, True, 4, 0], 5: [True, [], False, True, 4, 0]}[N])
check('4', solve([N,N,0,N+3,False]), {1: [False, [], False, False, 3, 1], 2: [False, [], False, False, 3, 2], 3: [False, [], False, False, 3, 3], 4: [False, [], False, False, 3, 4], 5: [False, [], False, False, 3, 5]}[N])
check('5', solve([3,4,2,5,False]), {1: [False, [], False, False, 1, 2], 2: [False, [], False, False, 1, 2], 3: [False, [], False, False, 1, 2], 4: [False, [], False, False, 1, 2], 5: [False, [], False, False, 1, 2]}[N])
check('6', solve([6,1,2,5,True]), {1: [False, ['resume'], False, True, 4, 0], 2: [False, ['resume'], False, True, 4, 0], 3: [False, ['resume'], False, True, 4, 0], 4: [False, ['resume'], False, True, 4, 0], 5: [False, ['resume'], False, True, 4, 0]}[N])
check('7', solve([1,7,2,5,False]), {1: [True, ['pause'], True, False, 0, 5], 2: [True, ['pause'], True, False, 0, 5], 3: [True, ['pause'], True, False, 0, 5], 4: [True, ['pause'], True, False, 0, 5], 5: [True, ['pause'], True, False, 0, 5]}[N])
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):
    old,new,low,high,paused=x
    events=[]
    state=paused
    if not paused and old<high<=new:
        state=True
        events.append('pause')
    if paused and old>low>=new:
        state=False
        events.append('resume')
    at_high=new>high or (high==0 and new==0)
    at_low=new<=low
    headroom=max(0,high-new)
    excess=max(0,new-low)
    return [state,events,at_high,at_low,headroom,excess]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([2,5,2,5,False]), {1: [True, ['pause'], True, False, 0, 3], 2: [True, ['pause'], True, False, 0, 3], 3: [True, ['pause'], True, False, 0, 3], 4: [True, ['pause'], True, False, 0, 3], 5: [True, ['pause'], True, False, 0, 3]}[N])
check('1', solve([5,2,2,5,True]), {1: [False, ['resume'], False, True, 3, 0], 2: [False, ['resume'], False, True, 3, 0], 3: [False, ['resume'], False, True, 3, 0], 4: [False, ['resume'], False, True, 3, 0], 5: [False, ['resume'], False, True, 3, 0]}[N])
check('2', solve([5,6,2,5,False]), {1: [False, [], True, False, 0, 4], 2: [False, [], True, False, 0, 4], 3: [False, [], True, False, 0, 4], 4: [False, [], True, False, 0, 4], 5: [False, [], True, False, 0, 4]}[N])
check('3', solve([2,1,2,5,True]), {1: [True, [], False, True, 4, 0], 2: [True, [], False, True, 4, 0], 3: [True, [], False, True, 4, 0], 4: [True, [], False, True, 4, 0], 5: [True, [], False, True, 4, 0]}[N])
check('4', solve([N,N,0,N+3,False]), {1: [False, [], False, False, 3, 1], 2: [False, [], False, False, 3, 2], 3: [False, [], False, False, 3, 3], 4: [False, [], False, False, 3, 4], 5: [False, [], False, False, 3, 5]}[N])
check('5', solve([3,4,2,5,False]), {1: [False, [], False, False, 1, 2], 2: [False, [], False, False, 1, 2], 3: [False, [], False, False, 1, 2], 4: [False, [], False, False, 1, 2], 5: [False, [], False, False, 1, 2]}[N])
check('6', solve([6,1,2,5,True]), {1: [False, ['resume'], False, True, 4, 0], 2: [False, ['resume'], False, True, 4, 0], 3: [False, ['resume'], False, True, 4, 0], 4: [False, ['resume'], False, True, 4, 0], 5: [False, ['resume'], False, True, 4, 0]}[N])
check('7', solve([1,7,2,5,False]), {1: [True, ['pause'], True, False, 0, 5], 2: [True, ['pause'], True, False, 0, 5], 3: [True, ['pause'], True, False, 0, 5], 4: [True, ['pause'], True, False, 0, 5], 5: [True, ['pause'], True, False, 0, 5]}[N])
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:
Deque pressure treats exact high occupancy as below high.

Bounded deque pressure notifications are edge-triggered: unpaused producers pause on an upward high crossing; paused producers resume on a downward low crossing. Return state, ordered notification list and distances to both thresholds.

split: open-access