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

N = 1
observations = []
def solve(d):
    x=d['x']; s=d['singleton']; lo,hi=d['parent']
    return {'completed': sorted([s,x]),
    'lower': x<=lo,
    'upper': x>hi,
    'contained': lo<=x<=hi,
    'displaced': lo if x<lo else hi if x>hi else None,
    'new_size': d["size"]+1}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 7, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 8, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 9, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 10, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 10], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 11, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 11], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 2})]][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):
    x=d['x']; s=d['singleton']; lo,hi=d['parent']
    return {'completed': sorted([s,x]),
    'lower': x<hi,
    'upper': x>hi,
    'contained': lo<=x<=hi,
    'displaced': lo if x<lo else hi if x>hi else None,
    'new_size': d["size"]+1}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 7, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 8, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 9, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 10, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 10], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 11, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 11], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 2})]][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 interval insert certificate reports an incorrect lower.

Insert key x into an interval-heap last-node decision. For a singleton last interval s, complete it as sorted(s,x). For a new singleton with parent [lo,hi], x below lo routes to the lower heap, above hi to the upper heap, otherwise stays. Return pair completion, lower route, upper route, contained route, parent endpoint displaced on crossing, and logical-size increment.

split: open-access


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

N = 1
observations = []
def solve(d):
    x=d['x']; s=d['singleton']; lo,hi=d['parent']
    return {'completed': sorted([s,x]),
    'lower': x<lo,
    'upper': x>=hi,
    'contained': lo<=x<=hi,
    'displaced': lo if x<lo else hi if x>hi else None,
    'new_size': d["size"]+1}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 7, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 8, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 9, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 10, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 10], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 11, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 11], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 2})]][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):
    x=d['x']; s=d['singleton']; lo,hi=d['parent']
    return {'completed': sorted([s,x]),
    'lower': x<lo,
    'upper': x>lo,
    'contained': lo<=x<=hi,
    'displaced': lo if x<lo else hi if x>hi else None,
    'new_size': d["size"]+1}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 7, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 8, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 9, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 10, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 10], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 11, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 11], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 2})]][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 interval insert certificate reports an incorrect upper.

Insert key x into an interval-heap last-node decision. For a singleton last interval s, complete it as sorted(s,x). For a new singleton with parent [lo,hi], x below lo routes to the lower heap, above hi to the upper heap, otherwise stays. Return pair completion, lower route, upper route, contained route, parent endpoint displaced on crossing, and logical-size increment.

split: open-access


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

N = 1
observations = []
def solve(d):
    x=d['x']; s=d['singleton']; lo,hi=d['parent']
    return {'completed': sorted([s,x]),
    'lower': x<lo,
    'upper': x>hi,
    'contained': lo<x<hi,
    'displaced': lo if x<lo else hi if x>hi else None,
    'new_size': d["size"]+1}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 7, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 8, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 9, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 10, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 10], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 11, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 11], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 2})]][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):
    x=d['x']; s=d['singleton']; lo,hi=d['parent']
    return {'completed': sorted([s,x]),
    'lower': x<lo,
    'upper': x>hi,
    'contained': x>=lo or x<=hi,
    'displaced': lo if x<lo else hi if x>hi else None,
    'new_size': d["size"]+1}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 7, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 8, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 9, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 10, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 10], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 11, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 11], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 2})]][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 interval insert certificate reports an incorrect contained.

Insert key x into an interval-heap last-node decision. For a singleton last interval s, complete it as sorted(s,x). For a new singleton with parent [lo,hi], x below lo routes to the lower heap, above hi to the upper heap, otherwise stays. Return pair completion, lower route, upper route, contained route, parent endpoint displaced on crossing, and logical-size increment.

split: open-access


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

N = 1
observations = []
def solve(d):
    x=d['x']; s=d['singleton']; lo,hi=d['parent']
    return {'completed': sorted([s,x]),
    'lower': x<lo,
    'upper': x>hi,
    'contained': lo<=x<=hi,
    'displaced': hi if x<lo else lo if x>hi else None,
    'new_size': d["size"]+1}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 7, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 8, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 9, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 10, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 10], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 11, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 11], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 2})]][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):
    x=d['x']; s=d['singleton']; lo,hi=d['parent']
    return {'completed': sorted([s,x]),
    'lower': x<lo,
    'upper': x>hi,
    'contained': lo<=x<=hi,
    'displaced': lo if x<lo else hi,
    'new_size': d["size"]+1}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 7, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 8, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 9, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 10, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 10], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 11, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 11], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 2})]][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 interval insert certificate reports an incorrect displaced.

Insert key x into an interval-heap last-node decision. For a singleton last interval s, complete it as sorted(s,x). For a new singleton with parent [lo,hi], x below lo routes to the lower heap, above hi to the upper heap, otherwise stays. Return pair completion, lower route, upper route, contained route, parent endpoint displaced on crossing, and logical-size increment.

split: open-access


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

N = 1
observations = []
def solve(d):
    x=d['x']; s=d['singleton']; lo,hi=d['parent']
    return {'completed': sorted([s,x]),
    'lower': x<lo,
    'upper': x>hi,
    'contained': lo<=x<=hi,
    'displaced': lo if x<lo else hi if x>hi else None,
    'new_size': d["size"]+2}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 7, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 8, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 9, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 10, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 10], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 11, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 11], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 2})]][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):
    x=d['x']; s=d['singleton']; lo,hi=d['parent']
    return {'completed': sorted([s,x]),
    'lower': x<lo,
    'upper': x>hi,
    'contained': lo<=x<=hi,
    'displaced': lo if x<lo else hi if x>hi else None,
    'new_size': d["size"]+int(x!=s)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 7, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 8, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 9, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 10, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 10], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 2})], [({'x': 1, 'singleton': 6, 'parent': [2, 8], 'size': 3}, {'completed': [1, 6], 'lower': True, 'upper': False, 'contained': False, 'displaced': 2, 'new_size': 4}), ({'x': 9, 'singleton': 4, 'parent': [2, 8], 'size': 5}, {'completed': [4, 9], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 6}), ({'x': 5, 'singleton': 7, 'parent': [2, 8], 'size': 7}, {'completed': [5, 7], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 8}), ({'x': 2, 'singleton': 3, 'parent': [2, 8], 'size': 9}, {'completed': [2, 3], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 10}), ({'x': 8, 'singleton': 1, 'parent': [2, 8], 'size': 11}, {'completed': [1, 8], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 12}), ({'x': 6, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 6], 'lower': False, 'upper': False, 'contained': True, 'displaced': None, 'new_size': 2}), ({'x': 11, 'singleton': 6, 'parent': [2, 8], 'size': 1}, {'completed': [6, 11], 'lower': False, 'upper': True, 'contained': False, 'displaced': 8, 'new_size': 2})]][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 interval insert certificate reports an incorrect new size.

Insert key x into an interval-heap last-node decision. For a singleton last interval s, complete it as sorted(s,x). For a new singleton with parent [lo,hi], x below lo routes to the lower heap, above hi to the upper heap, otherwise stays. Return pair completion, lower route, upper route, contained route, parent endpoint displaced on crossing, and logical-size increment.

split: open-access


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

N = 1
observations = []
def solve(d):
    c=d['capacity']; s=d['slot']; leaf=c+s; path=[]; siblings=[]; v=leaf
    while v>1:
        siblings.append(v^1); v//=2; path.append(v)
    return {'replay': list(reversed(path)),
    'siblings': siblings,
    'root': 1,
    'comparisons': len(path),
    'leaf': leaf,
    'untouched': [i for i in range(c) if i!=s]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'capacity': 1, 'slot': 0}, {'replay': [], 'siblings': [], 'root': 1, 'comparisons': 0, 'leaf': 1, 'untouched': []}), ({'capacity': 2, 'slot': 1}, {'replay': [1], 'siblings': [2], 'root': 1, 'comparisons': 1, 'leaf': 3, 'untouched': [0]}), ({'capacity': 4, 'slot': 0}, {'replay': [2, 1], 'siblings': [5, 3], 'root': 1, 'comparisons': 2, 'leaf': 4, 'untouched': [1, 2, 3]}), ({'capacity': 4, 'slot': 3}, {'replay': [3, 1], 'siblings': [6, 2], 'root': 1, 'comparisons': 2, 'leaf': 7, 'untouched': [0, 1, 2]}), ({'capacity': 8, 'slot': 5}, {'replay': [6, 3, 1], 'siblings': [12, 7, 2], 'root': 1, 'comparisons': 3, 'leaf': 13, 'untouched': [0, 1, 2, 3, 4, 6, 7]}), ({'capacity': 16, 'slot': 10}, {'replay': [13, 6, 3, 1], 'siblings': [27, 12, 7, 2], 'root': 1, 'comparisons': 4, 'leaf': 26, 'untouched': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15]}), ({'capacity': 16, 'slot': 1}, {'replay': [8, 4, 2, 1], 'siblings': [16, 9, 5, 3], 'root': 1, 'comparisons': 4, 'leaf': 17, 'untouched': [0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]})], [({'capacity': 1, 'slot': 0}, {'replay': [], 'siblings': [], 'root': 1, 'comparisons': 0, 'leaf': 1, 'untouched': []}), ({'capacity': 2, 'slot': 1}, {'replay': [1], 'siblings': [2], 'root': 1, 'comparisons': 1, 'leaf': 3, 'untouched': [0]}), ({'capacity': 4, 'slot': 0}, {'replay': [2, 1], 'siblings': [5, 3], 'root': 1, 'comparisons': 2, 'leaf': 4, 'untouched': [1, 2, 3]}), ({'capacity': 4, 'slot': 3}, {'replay': [3, 1], 'siblings': [6, 2], 'root': 1, 'comparisons': 2, 'leaf': 7, 'untouched': [0, 1, 2]}), ({'capacity': 8, 'slot': 5}, {'replay': [6, 3, 1], 'siblings': [12, 7, 2], 'root': 1, 'comparisons': 3, 'leaf': 13, 'untouched': [0, 1, 2, 3, 4, 6, 7]}), ({'capacity': 16, 'slot': 10}, {'replay': [13, 6, 3, 1], 'siblings': [27, 12, 7, 2], 'root': 1, 'comparisons': 4, 'leaf': 26, 'untouched': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15]}), ({'capacity': 16, 'slot': 2}, {'replay': [9, 4, 2, 1], 'siblings': [19, 8, 5, 3], 'root': 1, 'comparisons': 4, 'leaf': 18, 'untouched': [0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]})], [({'capacity': 1, 'slot': 0}, {'replay': [], 'siblings': [], 'root': 1, 'comparisons': 0, 'leaf': 1, 'untouched': []}), ({'capacity': 2, 'slot': 1}, {'replay': [1], 'siblings': [2], 'root': 1, 'comparisons': 1, 'leaf': 3, 'untouched': [0]}), ({'capacity': 4, 'slot': 0}, {'replay': [2, 1], 'siblings': [5, 3], 'root': 1, 'comparisons': 2, 'leaf': 4, 'untouched': [1, 2, 3]}), ({'capacity': 4, 'slot': 3}, {'replay': [3, 1], 'siblings': [6, 2], 'root': 1, 'comparisons': 2, 'leaf': 7, 'untouched': [0, 1, 2]}), ({'capacity': 8, 'slot': 5}, {'replay': [6, 3, 1], 'siblings': [12, 7, 2], 'root': 1, 'comparisons': 3, 'leaf': 13, 'untouched': [0, 1, 2, 3, 4, 6, 7]}), ({'capacity': 16, 'slot': 10}, {'replay': [13, 6, 3, 1], 'siblings': [27, 12, 7, 2], 'root': 1, 'comparisons': 4, 'leaf': 26, 'untouched': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15]}), ({'capacity': 16, 'slot': 3}, {'replay': [9, 4, 2, 1], 'siblings': [18, 8, 5, 3], 'root': 1, 'comparisons': 4, 'leaf': 19, 'untouched': [0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]})], [({'capacity': 1, 'slot': 0}, {'replay': [], 'siblings': [], 'root': 1, 'comparisons': 0, 'leaf': 1, 'untouched': []}), ({'capacity': 2, 'slot': 1}, {'replay': [1], 'siblings': [2], 'root': 1, 'comparisons': 1, 'leaf': 3, 'untouched': [0]}), ({'capacity': 4, 'slot': 0}, {'replay': [2, 1], 'siblings': [5, 3], 'root': 1, 'comparisons': 2, 'leaf': 4, 'untouched': [1, 2, 3]}), ({'capacity': 4, 'slot': 3}, {'replay': [3, 1], 'siblings': [6, 2], 'root': 1, 'comparisons': 2, 'leaf': 7, 'untouched': [0, 1, 2]}), ({'capacity': 8, 'slot': 5}, {'replay': [6, 3, 1], 'siblings': [12, 7, 2], 'root': 1, 'comparisons': 3, 'leaf': 13, 'untouched': [0, 1, 2, 3, 4, 6, 7]}), ({'capacity': 16, 'slot': 10}, {'replay': [13, 6, 3, 1], 'siblings': [27, 12, 7, 2], 'root': 1, 'comparisons': 4, 'leaf': 26, 'untouched': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15]}), ({'capacity': 16, 'slot': 4}, {'replay': [10, 5, 2, 1], 'siblings': [21, 11, 4, 3], 'root': 1, 'comparisons': 4, 'leaf': 20, 'untouched': [0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]})], [({'capacity': 1, 'slot': 0}, {'replay': [], 'siblings': [], 'root': 1, 'comparisons': 0, 'leaf': 1, 'untouched': []}), ({'capacity': 2, 'slot': 1}, {'replay': [1], 'siblings': [2], 'root': 1, 'comparisons': 1, 'leaf': 3, 'untouched': [0]}), ({'capacity': 4, 'slot': 0}, {'replay': [2, 1], 'siblings': [5, 3], 'root': 1, 'comparisons': 2, 'leaf': 4, 'untouched': [1, 2, 3]}), ({'capacity': 4, 'slot': 3}, {'replay': [3, 1], 'siblings': [6, 2], 'root': 1, 'comparisons': 2, 'leaf': 7, 'untouched': [0, 1, 2]}), ({'capacity': 8, 'slot': 5}, {'replay': [6, 3, 1], 'siblings': [12, 7, 2], 'root': 1, 'comparisons': 3, 'leaf': 13, 'untouched': [0, 1, 2, 3, 4, 6, 7]}), ({'capacity': 16, 'slot': 10}, {'replay': [13, 6, 3, 1], 'siblings': [27, 12, 7, 2], 'root': 1, 'comparisons': 4, 'leaf': 26, 'untouched': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15]}), ({'capacity': 16, 'slot': 5}, {'replay': [10, 5, 2, 1], 'siblings': [20, 11, 4, 3], 'root': 1, 'comparisons': 4, 'leaf': 21, 'untouched': [0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 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):
    c=d['capacity']; s=d['slot']; leaf=c+s; path=[]; siblings=[]; v=leaf
    while v>1:
        siblings.append(v^1); v//=2; path.append(v)
    return {'replay': path[1:],
    'siblings': siblings,
    'root': 1,
    'comparisons': len(path),
    'leaf': leaf,
    'untouched': [i for i in range(c) if i!=s]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'capacity': 1, 'slot': 0}, {'replay': [], 'siblings': [], 'root': 1, 'comparisons': 0, 'leaf': 1, 'untouched': []}), ({'capacity': 2, 'slot': 1}, {'replay': [1], 'siblings': [2], 'root': 1, 'comparisons': 1, 'leaf': 3, 'untouched': [0]}), ({'capacity': 4, 'slot': 0}, {'replay': [2, 1], 'siblings': [5, 3], 'root': 1, 'comparisons': 2, 'leaf': 4, 'untouched': [1, 2, 3]}), ({'capacity': 4, 'slot': 3}, {'replay': [3, 1], 'siblings': [6, 2], 'root': 1, 'comparisons': 2, 'leaf': 7, 'untouched': [0, 1, 2]}), ({'capacity': 8, 'slot': 5}, {'replay': [6, 3, 1], 'siblings': [12, 7, 2], 'root': 1, 'comparisons': 3, 'leaf': 13, 'untouched': [0, 1, 2, 3, 4, 6, 7]}), ({'capacity': 16, 'slot': 10}, {'replay': [13, 6, 3, 1], 'siblings': [27, 12, 7, 2], 'root': 1, 'comparisons': 4, 'leaf': 26, 'untouched': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15]}), ({'capacity': 16, 'slot': 1}, {'replay': [8, 4, 2, 1], 'siblings': [16, 9, 5, 3], 'root': 1, 'comparisons': 4, 'leaf': 17, 'untouched': [0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]})], [({'capacity': 1, 'slot': 0}, {'replay': [], 'siblings': [], 'root': 1, 'comparisons': 0, 'leaf': 1, 'untouched': []}), ({'capacity': 2, 'slot': 1}, {'replay': [1], 'siblings': [2], 'root': 1, 'comparisons': 1, 'leaf': 3, 'untouched': [0]}), ({'capacity': 4, 'slot': 0}, {'replay': [2, 1], 'siblings': [5, 3], 'root': 1, 'comparisons': 2, 'leaf': 4, 'untouched': [1, 2, 3]}), ({'capacity': 4, 'slot': 3}, {'replay': [3, 1], 'siblings': [6, 2], 'root': 1, 'comparisons': 2, 'leaf': 7, 'untouched': [0, 1, 2]}), ({'capacity': 8, 'slot': 5}, {'replay': [6, 3, 1], 'siblings': [12, 7, 2], 'root': 1, 'comparisons': 3, 'leaf': 13, 'untouched': [0, 1, 2, 3, 4, 6, 7]}), ({'capacity': 16, 'slot': 10}, {'replay': [13, 6, 3, 1], 'siblings': [27, 12, 7, 2], 'root': 1, 'comparisons': 4, 'leaf': 26, 'untouched': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15]}), ({'capacity': 16, 'slot': 2}, {'replay': [9, 4, 2, 1], 'siblings': [19, 8, 5, 3], 'root': 1, 'comparisons': 4, 'leaf': 18, 'untouched': [0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]})], [({'capacity': 1, 'slot': 0}, {'replay': [], 'siblings': [], 'root': 1, 'comparisons': 0, 'leaf': 1, 'untouched': []}), ({'capacity': 2, 'slot': 1}, {'replay': [1], 'siblings': [2], 'root': 1, 'comparisons': 1, 'leaf': 3, 'untouched': [0]}), ({'capacity': 4, 'slot': 0}, {'replay': [2, 1], 'siblings': [5, 3], 'root': 1, 'comparisons': 2, 'leaf': 4, 'untouched': [1, 2, 3]}), ({'capacity': 4, 'slot': 3}, {'replay': [3, 1], 'siblings': [6, 2], 'root': 1, 'comparisons': 2, 'leaf': 7, 'untouched': [0, 1, 2]}), ({'capacity': 8, 'slot': 5}, {'replay': [6, 3, 1], 'siblings': [12, 7, 2], 'root': 1, 'comparisons': 3, 'leaf': 13, 'untouched': [0, 1, 2, 3, 4, 6, 7]}), ({'capacity': 16, 'slot': 10}, {'replay': [13, 6, 3, 1], 'siblings': [27, 12, 7, 2], 'root': 1, 'comparisons': 4, 'leaf': 26, 'untouched': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15]}), ({'capacity': 16, 'slot': 3}, {'replay': [9, 4, 2, 1], 'siblings': [18, 8, 5, 3], 'root': 1, 'comparisons': 4, 'leaf': 19, 'untouched': [0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]})], [({'capacity': 1, 'slot': 0}, {'replay': [], 'siblings': [], 'root': 1, 'comparisons': 0, 'leaf': 1, 'untouched': []}), ({'capacity': 2, 'slot': 1}, {'replay': [1], 'siblings': [2], 'root': 1, 'comparisons': 1, 'leaf': 3, 'untouched': [0]}), ({'capacity': 4, 'slot': 0}, {'replay': [2, 1], 'siblings': [5, 3], 'root': 1, 'comparisons': 2, 'leaf': 4, 'untouched': [1, 2, 3]}), ({'capacity': 4, 'slot': 3}, {'replay': [3, 1], 'siblings': [6, 2], 'root': 1, 'comparisons': 2, 'leaf': 7, 'untouched': [0, 1, 2]}), ({'capacity': 8, 'slot': 5}, {'replay': [6, 3, 1], 'siblings': [12, 7, 2], 'root': 1, 'comparisons': 3, 'leaf': 13, 'untouched': [0, 1, 2, 3, 4, 6, 7]}), ({'capacity': 16, 'slot': 10}, {'replay': [13, 6, 3, 1], 'siblings': [27, 12, 7, 2], 'root': 1, 'comparisons': 4, 'leaf': 26, 'untouched': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15]}), ({'capacity': 16, 'slot': 4}, {'replay': [10, 5, 2, 1], 'siblings': [21, 11, 4, 3], 'root': 1, 'comparisons': 4, 'leaf': 20, 'untouched': [0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]})], [({'capacity': 1, 'slot': 0}, {'replay': [], 'siblings': [], 'root': 1, 'comparisons': 0, 'leaf': 1, 'untouched': []}), ({'capacity': 2, 'slot': 1}, {'replay': [1], 'siblings': [2], 'root': 1, 'comparisons': 1, 'leaf': 3, 'untouched': [0]}), ({'capacity': 4, 'slot': 0}, {'replay': [2, 1], 'siblings': [5, 3], 'root': 1, 'comparisons': 2, 'leaf': 4, 'untouched': [1, 2, 3]}), ({'capacity': 4, 'slot': 3}, {'replay': [3, 1], 'siblings': [6, 2], 'root': 1, 'comparisons': 2, 'leaf': 7, 'untouched': [0, 1, 2]}), ({'capacity': 8, 'slot': 5}, {'replay': [6, 3, 1], 'siblings': [12, 7, 2], 'root': 1, 'comparisons': 3, 'leaf': 13, 'untouched': [0, 1, 2, 3, 4, 6, 7]}), ({'capacity': 16, 'slot': 10}, {'replay': [13, 6, 3, 1], 'siblings': [27, 12, 7, 2], 'root': 1, 'comparisons': 4, 'leaf': 26, 'untouched': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15]}), ({'capacity': 16, 'slot': 5}, {'replay': [10, 5, 2, 1], 'siblings': [20, 11, 4, 3], 'root': 1, 'comparisons': 4, 'leaf': 21, 'untouched': [0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 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 tournament path certificate reports an incorrect replay.

A complete winner tournament has power-of-two leaf capacity c and updated leaf slot s. Tree leaves occupy c+s. Report ancestors in bottom-up replay order, sibling indices along that path, root index, comparison count, leaf index, and unaffected leaf slots. Capacity at least one; slot is in range.

split: open-access


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

N = 1
observations = []
def solve(d):
    c=d['capacity']; s=d['slot']; leaf=c+s; path=[]; siblings=[]; v=leaf
    while v>1:
        siblings.append(v^1); v//=2; path.append(v)
    return {'replay': path,
    'siblings': [x-1 for x in [leaf]+path[:-1]],
    'root': 1,
    'comparisons': len(path),
    'leaf': leaf,
    'untouched': [i for i in range(c) if i!=s]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'capacity': 1, 'slot': 0}, {'replay': [], 'siblings': [], 'root': 1, 'comparisons': 0, 'leaf': 1, 'untouched': []}), ({'capacity': 2, 'slot': 1}, {'replay': [1], 'siblings': [2], 'root': 1, 'comparisons': 1, 'leaf': 3, 'untouched': [0]}), ({'capacity': 4, 'slot': 0}, {'replay': [2, 1], 'siblings': [5, 3], 'root': 1, 'comparisons': 2, 'leaf': 4, 'untouched': [1, 2, 3]}), ({'capacity': 4, 'slot': 3}, {'replay': [3, 1], 'siblings': [6, 2], 'root': 1, 'comparisons': 2, 'leaf': 7, 'untouched': [0, 1, 2]}), ({'capacity': 8, 'slot': 5}, {'replay': [6, 3, 1], 'siblings': [12, 7, 2], 'root': 1, 'comparisons': 3, 'leaf': 13, 'untouched': [0, 1, 2, 3, 4, 6, 7]}), ({'capacity': 16, 'slot': 10}, {'replay': [13, 6, 3, 1], 'siblings': [27, 12, 7, 2], 'root': 1, 'comparisons': 4, 'leaf': 26, 'untouched': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15]}), ({'capacity': 16, 'slot': 1}, {'replay': [8, 4, 2, 1], 'siblings': [16, 9, 5, 3], 'root': 1, 'comparisons': 4, 'leaf': 17, 'untouched': [0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]})], [({'capacity': 1, 'slot': 0}, {'replay': [], 'siblings': [], 'root': 1, 'comparisons': 0, 'leaf': 1, 'untouched': []}), ({'capacity': 2, 'slot': 1}, {'replay': [1], 'siblings': [2], 'root': 1, 'comparisons': 1, 'leaf': 3, 'untouched': [0]}), ({'capacity': 4, 'slot': 0}, {'replay': [2, 1], 'siblings': [5, 3], 'root': 1, 'comparisons': 2, 'leaf': 4, 'untouched': [1, 2, 3]}), ({'capacity': 4, 'slot': 3}, {'replay': [3, 1], 'siblings': [6, 2], 'root': 1, 'comparisons': 2, 'leaf': 7, 'untouched': [0, 1, 2]}), ({'capacity': 8, 'slot': 5}, {'replay': [6, 3, 1], 'siblings': [12, 7, 2], 'root': 1, 'comparisons': 3, 'leaf': 13, 'untouched': [0, 1, 2, 3, 4, 6, 7]}), ({'capacity': 16, 'slot': 10}, {'replay': [13, 6, 3, 1], 'siblings': [27, 12, 7, 2], 'root': 1, 'comparisons': 4, 'leaf': 26, 'untouched': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15]}), ({'capacity': 16, 'slot': 2}, {'replay': [9, 4, 2, 1], 'siblings': [19, 8, 5, 3], 'root': 1, 'comparisons': 4, 'leaf': 18, 'untouched': [0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]})], [({'capacity': 1, 'slot': 0}, {'replay': [], 'siblings': [], 'root': 1, 'comparisons': 0, 'leaf': 1, 'untouched': []}), ({'capacity': 2, 'slot': 1}, {'replay': [1], 'siblings': [2], 'root': 1, 'comparisons': 1, 'leaf': 3, 'untouched': [0]}), ({'capacity': 4, 'slot': 0}, {'replay': [2, 1], 'siblings': [5, 3], 'root': 1, 'comparisons': 2, 'leaf': 4, 'untouched': [1, 2, 3]}), ({'capacity': 4, 'slot': 3}, {'replay': [3, 1], 'siblings': [6, 2], 'root': 1, 'comparisons': 2, 'leaf': 7, 'untouched': [0, 1, 2]}), ({'capacity': 8, 'slot': 5}, {'replay': [6, 3, 1], 'siblings': [12, 7, 2], 'root': 1, 'comparisons': 3, 'leaf': 13, 'untouched': [0, 1, 2, 3, 4, 6, 7]}), ({'capacity': 16, 'slot': 10}, {'replay': [13, 6, 3, 1], 'siblings': [27, 12, 7, 2], 'root': 1, 'comparisons': 4, 'leaf': 26, 'untouched': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15]}), ({'capacity': 16, 'slot': 3}, {'replay': [9, 4, 2, 1], 'siblings': [18, 8, 5, 3], 'root': 1, 'comparisons': 4, 'leaf': 19, 'untouched': [0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]})], [({'capacity': 1, 'slot': 0}, {'replay': [], 'siblings': [], 'root': 1, 'comparisons': 0, 'leaf': 1, 'untouched': []}), ({'capacity': 2, 'slot': 1}, {'replay': [1], 'siblings': [2], 'root': 1, 'comparisons': 1, 'leaf': 3, 'untouched': [0]}), ({'capacity': 4, 'slot': 0}, {'replay': [2, 1], 'siblings': [5, 3], 'root': 1, 'comparisons': 2, 'leaf': 4, 'untouched': [1, 2, 3]}), ({'capacity': 4, 'slot': 3}, {'replay': [3, 1], 'siblings': [6, 2], 'root': 1, 'comparisons': 2, 'leaf': 7, 'untouched': [0, 1, 2]}), ({'capacity': 8, 'slot': 5}, {'replay': [6, 3, 1], 'siblings': [12, 7, 2], 'root': 1, 'comparisons': 3, 'leaf': 13, 'untouched': [0, 1, 2, 3, 4, 6, 7]}), ({'capacity': 16, 'slot': 10}, {'replay': [13, 6, 3, 1], 'siblings': [27, 12, 7, 2], 'root': 1, 'comparisons': 4, 'leaf': 26, 'untouched': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15]}), ({'capacity': 16, 'slot': 4}, {'replay': [10, 5, 2, 1], 'siblings': [21, 11, 4, 3], 'root': 1, 'comparisons': 4, 'leaf': 20, 'untouched': [0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]})], [({'capacity': 1, 'slot': 0}, {'replay': [], 'siblings': [], 'root': 1, 'comparisons': 0, 'leaf': 1, 'untouched': []}), ({'capacity': 2, 'slot': 1}, {'replay': [1], 'siblings': [2], 'root': 1, 'comparisons': 1, 'leaf': 3, 'untouched': [0]}), ({'capacity': 4, 'slot': 0}, {'replay': [2, 1], 'siblings': [5, 3], 'root': 1, 'comparisons': 2, 'leaf': 4, 'untouched': [1, 2, 3]}), ({'capacity': 4, 'slot': 3}, {'replay': [3, 1], 'siblings': [6, 2], 'root': 1, 'comparisons': 2, 'leaf': 7, 'untouched': [0, 1, 2]}), ({'capacity': 8, 'slot': 5}, {'replay': [6, 3, 1], 'siblings': [12, 7, 2], 'root': 1, 'comparisons': 3, 'leaf': 13, 'untouched': [0, 1, 2, 3, 4, 6, 7]}), ({'capacity': 16, 'slot': 10}, {'replay': [13, 6, 3, 1], 'siblings': [27, 12, 7, 2], 'root': 1, 'comparisons': 4, 'leaf': 26, 'untouched': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15]}), ({'capacity': 16, 'slot': 5}, {'replay': [10, 5, 2, 1], 'siblings': [20, 11, 4, 3], 'root': 1, 'comparisons': 4, 'leaf': 21, 'untouched': [0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 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):
    c=d['capacity']; s=d['slot']; leaf=c+s; path=[]; siblings=[]; v=leaf
    while v>1:
        siblings.append(v^1); v//=2; path.append(v)
    return {'replay': path,
    'siblings': [x+1 for x in [leaf]+path[:-1]],
    'root': 1,
    'comparisons': len(path),
    'leaf': leaf,
    'untouched': [i for i in range(c) if i!=s]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'capacity': 1, 'slot': 0}, {'replay': [], 'siblings': [], 'root': 1, 'comparisons': 0, 'leaf': 1, 'untouched': []}), ({'capacity': 2, 'slot': 1}, {'replay': [1], 'siblings': [2], 'root': 1, 'comparisons': 1, 'leaf': 3, 'untouched': [0]}), ({'capacity': 4, 'slot': 0}, {'replay': [2, 1], 'siblings': [5, 3], 'root': 1, 'comparisons': 2, 'leaf': 4, 'untouched': [1, 2, 3]}), ({'capacity': 4, 'slot': 3}, {'replay': [3, 1], 'siblings': [6, 2], 'root': 1, 'comparisons': 2, 'leaf': 7, 'untouched': [0, 1, 2]}), ({'capacity': 8, 'slot': 5}, {'replay': [6, 3, 1], 'siblings': [12, 7, 2], 'root': 1, 'comparisons': 3, 'leaf': 13, 'untouched': [0, 1, 2, 3, 4, 6, 7]}), ({'capacity': 16, 'slot': 10}, {'replay': [13, 6, 3, 1], 'siblings': [27, 12, 7, 2], 'root': 1, 'comparisons': 4, 'leaf': 26, 'untouched': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15]}), ({'capacity': 16, 'slot': 1}, {'replay': [8, 4, 2, 1], 'siblings': [16, 9, 5, 3], 'root': 1, 'comparisons': 4, 'leaf': 17, 'untouched': [0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]})], [({'capacity': 1, 'slot': 0}, {'replay': [], 'siblings': [], 'root': 1, 'comparisons': 0, 'leaf': 1, 'untouched': []}), ({'capacity': 2, 'slot': 1}, {'replay': [1], 'siblings': [2], 'root': 1, 'comparisons': 1, 'leaf': 3, 'untouched': [0]}), ({'capacity': 4, 'slot': 0}, {'replay': [2, 1], 'siblings': [5, 3], 'root': 1, 'comparisons': 2, 'leaf': 4, 'untouched': [1, 2, 3]}), ({'capacity': 4, 'slot': 3}, {'replay': [3, 1], 'siblings': [6, 2], 'root': 1, 'comparisons': 2, 'leaf': 7, 'untouched': [0, 1, 2]}), ({'capacity': 8, 'slot': 5}, {'replay': [6, 3, 1], 'siblings': [12, 7, 2], 'root': 1, 'comparisons': 3, 'leaf': 13, 'untouched': [0, 1, 2, 3, 4, 6, 7]}), ({'capacity': 16, 'slot': 10}, {'replay': [13, 6, 3, 1], 'siblings': [27, 12, 7, 2], 'root': 1, 'comparisons': 4, 'leaf': 26, 'untouched': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15]}), ({'capacity': 16, 'slot': 2}, {'replay': [9, 4, 2, 1], 'siblings': [19, 8, 5, 3], 'root': 1, 'comparisons': 4, 'leaf': 18, 'untouched': [0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]})], [({'capacity': 1, 'slot': 0}, {'replay': [], 'siblings': [], 'root': 1, 'comparisons': 0, 'leaf': 1, 'untouched': []}), ({'capacity': 2, 'slot': 1}, {'replay': [1], 'siblings': [2], 'root': 1, 'comparisons': 1, 'leaf': 3, 'untouched': [0]}), ({'capacity': 4, 'slot': 0}, {'replay': [2, 1], 'siblings': [5, 3], 'root': 1, 'comparisons': 2, 'leaf': 4, 'untouched': [1, 2, 3]}), ({'capacity': 4, 'slot': 3}, {'replay': [3, 1], 'siblings': [6, 2], 'root': 1, 'comparisons': 2, 'leaf': 7, 'untouched': [0, 1, 2]}), ({'capacity': 8, 'slot': 5}, {'replay': [6, 3, 1], 'siblings': [12, 7, 2], 'root': 1, 'comparisons': 3, 'leaf': 13, 'untouched': [0, 1, 2, 3, 4, 6, 7]}), ({'capacity': 16, 'slot': 10}, {'replay': [13, 6, 3, 1], 'siblings': [27, 12, 7, 2], 'root': 1, 'comparisons': 4, 'leaf': 26, 'untouched': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15]}), ({'capacity': 16, 'slot': 3}, {'replay': [9, 4, 2, 1], 'siblings': [18, 8, 5, 3], 'root': 1, 'comparisons': 4, 'leaf': 19, 'untouched': [0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]})], [({'capacity': 1, 'slot': 0}, {'replay': [], 'siblings': [], 'root': 1, 'comparisons': 0, 'leaf': 1, 'untouched': []}), ({'capacity': 2, 'slot': 1}, {'replay': [1], 'siblings': [2], 'root': 1, 'comparisons': 1, 'leaf': 3, 'untouched': [0]}), ({'capacity': 4, 'slot': 0}, {'replay': [2, 1], 'siblings': [5, 3], 'root': 1, 'comparisons': 2, 'leaf': 4, 'untouched': [1, 2, 3]}), ({'capacity': 4, 'slot': 3}, {'replay': [3, 1], 'siblings': [6, 2], 'root': 1, 'comparisons': 2, 'leaf': 7, 'untouched': [0, 1, 2]}), ({'capacity': 8, 'slot': 5}, {'replay': [6, 3, 1], 'siblings': [12, 7, 2], 'root': 1, 'comparisons': 3, 'leaf': 13, 'untouched': [0, 1, 2, 3, 4, 6, 7]}), ({'capacity': 16, 'slot': 10}, {'replay': [13, 6, 3, 1], 'siblings': [27, 12, 7, 2], 'root': 1, 'comparisons': 4, 'leaf': 26, 'untouched': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15]}), ({'capacity': 16, 'slot': 4}, {'replay': [10, 5, 2, 1], 'siblings': [21, 11, 4, 3], 'root': 1, 'comparisons': 4, 'leaf': 20, 'untouched': [0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]})], [({'capacity': 1, 'slot': 0}, {'replay': [], 'siblings': [], 'root': 1, 'comparisons': 0, 'leaf': 1, 'untouched': []}), ({'capacity': 2, 'slot': 1}, {'replay': [1], 'siblings': [2], 'root': 1, 'comparisons': 1, 'leaf': 3, 'untouched': [0]}), ({'capacity': 4, 'slot': 0}, {'replay': [2, 1], 'siblings': [5, 3], 'root': 1, 'comparisons': 2, 'leaf': 4, 'untouched': [1, 2, 3]}), ({'capacity': 4, 'slot': 3}, {'replay': [3, 1], 'siblings': [6, 2], 'root': 1, 'comparisons': 2, 'leaf': 7, 'untouched': [0, 1, 2]}), ({'capacity': 8, 'slot': 5}, {'replay': [6, 3, 1], 'siblings': [12, 7, 2], 'root': 1, 'comparisons': 3, 'leaf': 13, 'untouched': [0, 1, 2, 3, 4, 6, 7]}), ({'capacity': 16, 'slot': 10}, {'replay': [13, 6, 3, 1], 'siblings': [27, 12, 7, 2], 'root': 1, 'comparisons': 4, 'leaf': 26, 'untouched': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15]}), ({'capacity': 16, 'slot': 5}, {'replay': [10, 5, 2, 1], 'siblings': [20, 11, 4, 3], 'root': 1, 'comparisons': 4, 'leaf': 21, 'untouched': [0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 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 tournament path certificate reports an incorrect siblings.

A complete winner tournament has power-of-two leaf capacity c and updated leaf slot s. Tree leaves occupy c+s. Report ancestors in bottom-up replay order, sibling indices along that path, root index, comparison count, leaf index, and unaffected leaf slots. Capacity at least one; slot is in range.

split: open-access