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

N = 1
observations = []
def solve(d):
    owner=d['owner']; slots=d['slots']; hs=d['handles']
    def bounds(h): return 0<=h[0]<len(slots)
    def live(h): return bounds(h) and slots[h[0]][0]
    def gen(h): return bounds(h) and slots[h[0]][1]==h[1]
    return {'owners': [h[2]==owner for h in hs],
    'bounds': [bounds(h) for h in hs],
    'live': [bounds(h) for h in hs],
    'generation': [gen(h) for h in hs],
    'resolved': [slots[h[0]][2] if h[2]==owner and live(h) and gen(h) else None for h in hs],
    'recycle': [x[1]+1 for x in slots]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 10, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [True, False, False], 'resolved': ['z', None, None], 'recycle': [11]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 11, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [12]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 12, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [13]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 13, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [14]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 14, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [15]})]][N-1]
check('regression certificate 1', solve(cases[0][0]), cases[0][1])
check('regression certificate 2', solve(cases[1][0]), cases[1][1])
check('regression certificate 3', solve(cases[2][0]), cases[2][1])
check('regression certificate 4', solve(cases[3][0]), cases[3][1])
check('regression certificate 5', solve(cases[4][0]), cases[4][1])
check('regression certificate 6', solve(cases[5][0]), cases[5][1])
check('variant-dependent certificate', solve(cases[6][0]), cases[6][1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(d):
    owner=d['owner']; slots=d['slots']; hs=d['handles']
    def bounds(h): return 0<=h[0]<len(slots)
    def live(h): return bounds(h) and slots[h[0]][0]
    def gen(h): return bounds(h) and slots[h[0]][1]==h[1]
    return {'owners': [h[2]==owner for h in hs],
    'bounds': [bounds(h) for h in hs],
    'live': [bounds(h) and bool(slots[h[0]][2]) for h in hs],
    'generation': [gen(h) for h in hs],
    'resolved': [slots[h[0]][2] if h[2]==owner and live(h) and gen(h) else None for h in hs],
    'recycle': [x[1]+1 for x in slots]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 10, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [True, False, False], 'resolved': ['z', None, None], 'recycle': [11]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 11, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [12]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 12, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [13]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 13, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [14]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 14, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [15]})]][N-1]
check('regression certificate 1', solve(cases[0][0]), cases[0][1])
check('regression certificate 2', solve(cases[1][0]), cases[1][1])
check('regression certificate 3', solve(cases[2][0]), cases[2][1])
check('regression certificate 4', solve(cases[3][0]), cases[3][1])
check('regression certificate 5', solve(cases[4][0]), cases[4][1])
check('regression certificate 6', solve(cases[5][0]), cases[5][1])
check('variant-dependent certificate', solve(cases[6][0]), cases[6][1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The bounded handle generation certificate reports an incorrect live.

A heap handle is [slot,generation,owner]. A slot table stores [live,generation,payload]. A handle resolves only for matching owner, in-range slot, live slot, and exact generation. Inspect each supplied handle; return per-handle ownership, bounds, liveness, generation match, resolution, and next generation after recycling each slot. Missing resolution is None.

split: open-access


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

N = 1
observations = []
def solve(d):
    owner=d['owner']; slots=d['slots']; hs=d['handles']
    def bounds(h): return 0<=h[0]<len(slots)
    def live(h): return bounds(h) and slots[h[0]][0]
    def gen(h): return bounds(h) and slots[h[0]][1]==h[1]
    return {'owners': [h[2]==owner for h in hs],
    'bounds': [bounds(h) for h in hs],
    'live': [live(h) for h in hs],
    'generation': [bounds(h) and slots[h[0]][1]>=h[1] for h in hs],
    'resolved': [slots[h[0]][2] if h[2]==owner and live(h) and gen(h) else None for h in hs],
    'recycle': [x[1]+1 for x in slots]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 10, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [True, False, False], 'resolved': ['z', None, None], 'recycle': [11]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 11, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [12]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 12, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [13]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 13, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [14]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 14, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [15]})]][N-1]
check('regression certificate 1', solve(cases[0][0]), cases[0][1])
check('regression certificate 2', solve(cases[1][0]), cases[1][1])
check('regression certificate 3', solve(cases[2][0]), cases[2][1])
check('regression certificate 4', solve(cases[3][0]), cases[3][1])
check('regression certificate 5', solve(cases[4][0]), cases[4][1])
check('regression certificate 6', solve(cases[5][0]), cases[5][1])
check('variant-dependent certificate', solve(cases[6][0]), cases[6][1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

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

N = 1
observations = []
def solve(d):
    owner=d['owner']; slots=d['slots']; hs=d['handles']
    def bounds(h): return 0<=h[0]<len(slots)
    def live(h): return bounds(h) and slots[h[0]][0]
    def gen(h): return bounds(h) and slots[h[0]][1]==h[1]
    return {'owners': [h[2]==owner for h in hs],
    'bounds': [bounds(h) for h in hs],
    'live': [live(h) for h in hs],
    'generation': [bounds(h) and slots[h[0]][1]==h[1]+1 for h in hs],
    'resolved': [slots[h[0]][2] if h[2]==owner and live(h) and gen(h) else None for h in hs],
    'recycle': [x[1]+1 for x in slots]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 10, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [True, False, False], 'resolved': ['z', None, None], 'recycle': [11]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 11, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [12]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 12, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [13]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 13, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [14]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 14, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [15]})]][N-1]
check('regression certificate 1', solve(cases[0][0]), cases[0][1])
check('regression certificate 2', solve(cases[1][0]), cases[1][1])
check('regression certificate 3', solve(cases[2][0]), cases[2][1])
check('regression certificate 4', solve(cases[3][0]), cases[3][1])
check('regression certificate 5', solve(cases[4][0]), cases[4][1])
check('regression certificate 6', solve(cases[5][0]), cases[5][1])
check('variant-dependent certificate', solve(cases[6][0]), cases[6][1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The bounded handle generation certificate reports an incorrect generation.

A heap handle is [slot,generation,owner]. A slot table stores [live,generation,payload]. A handle resolves only for matching owner, in-range slot, live slot, and exact generation. Inspect each supplied handle; return per-handle ownership, bounds, liveness, generation match, resolution, and next generation after recycling each slot. Missing resolution is None.

split: open-access


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

N = 1
observations = []
def solve(d):
    owner=d['owner']; slots=d['slots']; hs=d['handles']
    def bounds(h): return 0<=h[0]<len(slots)
    def live(h): return bounds(h) and slots[h[0]][0]
    def gen(h): return bounds(h) and slots[h[0]][1]==h[1]
    return {'owners': [h[2]==owner for h in hs],
    'bounds': [bounds(h) for h in hs],
    'live': [live(h) for h in hs],
    'generation': [gen(h) for h in hs],
    'resolved': [slots[h[0]][2] if h[2]==owner and live(h) else None for h in hs],
    'recycle': [x[1]+1 for x in slots]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 10, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [True, False, False], 'resolved': ['z', None, None], 'recycle': [11]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 11, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [12]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 12, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [13]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 13, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [14]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 14, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [15]})]][N-1]
check('regression certificate 1', solve(cases[0][0]), cases[0][1])
check('regression certificate 2', solve(cases[1][0]), cases[1][1])
check('regression certificate 3', solve(cases[2][0]), cases[2][1])
check('regression certificate 4', solve(cases[3][0]), cases[3][1])
check('regression certificate 5', solve(cases[4][0]), cases[4][1])
check('regression certificate 6', solve(cases[5][0]), cases[5][1])
check('variant-dependent certificate', solve(cases[6][0]), cases[6][1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(d):
    owner=d['owner']; slots=d['slots']; hs=d['handles']
    def bounds(h): return 0<=h[0]<len(slots)
    def live(h): return bounds(h) and slots[h[0]][0]
    def gen(h): return bounds(h) and slots[h[0]][1]==h[1]
    return {'owners': [h[2]==owner for h in hs],
    'bounds': [bounds(h) for h in hs],
    'live': [live(h) for h in hs],
    'generation': [gen(h) for h in hs],
    'resolved': [slots[h[0]][2] if live(h) and gen(h) else None for h in hs],
    'recycle': [x[1]+1 for x in slots]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 10, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [True, False, False], 'resolved': ['z', None, None], 'recycle': [11]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 11, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [12]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 12, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [13]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 13, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [14]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 14, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [15]})]][N-1]
check('regression certificate 1', solve(cases[0][0]), cases[0][1])
check('regression certificate 2', solve(cases[1][0]), cases[1][1])
check('regression certificate 3', solve(cases[2][0]), cases[2][1])
check('regression certificate 4', solve(cases[3][0]), cases[3][1])
check('regression certificate 5', solve(cases[4][0]), cases[4][1])
check('regression certificate 6', solve(cases[5][0]), cases[5][1])
check('variant-dependent certificate', solve(cases[6][0]), cases[6][1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The bounded handle generation certificate reports an incorrect resolved.

A heap handle is [slot,generation,owner]. A slot table stores [live,generation,payload]. A handle resolves only for matching owner, in-range slot, live slot, and exact generation. Inspect each supplied handle; return per-handle ownership, bounds, liveness, generation match, resolution, and next generation after recycling each slot. Missing resolution is None.

split: open-access


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

N = 1
observations = []
def solve(d):
    owner=d['owner']; slots=d['slots']; hs=d['handles']
    def bounds(h): return 0<=h[0]<len(slots)
    def live(h): return bounds(h) and slots[h[0]][0]
    def gen(h): return bounds(h) and slots[h[0]][1]==h[1]
    return {'owners': [h[2]==owner for h in hs],
    'bounds': [bounds(h) for h in hs],
    'live': [live(h) for h in hs],
    'generation': [gen(h) for h in hs],
    'resolved': [slots[h[0]][2] if h[2]==owner and live(h) and gen(h) else None for h in hs],
    'recycle': [x[1] for x in slots]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 10, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [True, False, False], 'resolved': ['z', None, None], 'recycle': [11]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 11, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [12]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 12, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [13]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 13, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [14]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 14, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [15]})]][N-1]
check('regression certificate 1', solve(cases[0][0]), cases[0][1])
check('regression certificate 2', solve(cases[1][0]), cases[1][1])
check('regression certificate 3', solve(cases[2][0]), cases[2][1])
check('regression certificate 4', solve(cases[3][0]), cases[3][1])
check('regression certificate 5', solve(cases[4][0]), cases[4][1])
check('regression certificate 6', solve(cases[5][0]), cases[5][1])
check('variant-dependent certificate', solve(cases[6][0]), cases[6][1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(d):
    owner=d['owner']; slots=d['slots']; hs=d['handles']
    def bounds(h): return 0<=h[0]<len(slots)
    def live(h): return bounds(h) and slots[h[0]][0]
    def gen(h): return bounds(h) and slots[h[0]][1]==h[1]
    return {'owners': [h[2]==owner for h in hs],
    'bounds': [bounds(h) for h in hs],
    'live': [live(h) for h in hs],
    'generation': [gen(h) for h in hs],
    'resolved': [slots[h[0]][2] if h[2]==owner and live(h) and gen(h) else None for h in hs],
    'recycle': [1 for x in slots]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 10, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [True, False, False], 'resolved': ['z', None, None], 'recycle': [11]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 11, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [12]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 12, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [13]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 13, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [14]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 14, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [15]})]][N-1]
check('regression certificate 1', solve(cases[0][0]), cases[0][1])
check('regression certificate 2', solve(cases[1][0]), cases[1][1])
check('regression certificate 3', solve(cases[2][0]), cases[2][1])
check('regression certificate 4', solve(cases[3][0]), cases[3][1])
check('regression certificate 5', solve(cases[4][0]), cases[4][1])
check('regression certificate 6', solve(cases[5][0]), cases[5][1])
check('variant-dependent certificate', solve(cases[6][0]), cases[6][1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The bounded handle generation certificate reports an incorrect recycle.

A heap handle is [slot,generation,owner]. A slot table stores [live,generation,payload]. A handle resolves only for matching owner, in-range slot, live slot, and exact generation. Inspect each supplied handle; return per-handle ownership, bounds, liveness, generation match, resolution, and next generation after recycling each slot. Missing resolution is None.

split: open-access