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

N = 1
observations = []
def solve(commands, size):
    full=set(range(size))
    out=[]
    for draws in commands:
        occluded=set()
        visible=[]
        for key,coverage,opaque,clip,writes in reversed(draws):
            effective=set(coverage)&set(clip)&set(writes)&full
            remaining=effective-occluded
            visible.append([key,sorted(remaining)])
            occluded |= effective
        out.append(list(reversed(visible)))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 4), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 4), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 4), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 4), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 4), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 4), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 4), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 4), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 4), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 4), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 4), [[['a', [0, 1, 2, 3]]]])
if N == 2:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 5), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 5), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 5), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 5), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 5), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 5), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 5), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 5), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 5), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 5), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 5), [[['a', [0, 1, 2, 3, 4]]]])
if N == 3:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 6), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 6), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 6), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 6), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 6), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 6), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 6), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 6), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 6), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 6), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 6), [[['a', [0, 1, 2, 3, 4, 5]]]])
if N == 4:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 7), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 7), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 7), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 7), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 7), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 7), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 7), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 7), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 7), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 7), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 7), [[['a', [0, 1, 2, 3, 4, 5, 6]]]])
if N == 5:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 8), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 8), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 8), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 8), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 8), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 8), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 8), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 8), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 8), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 8), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 8), [[['a', [0, 1, 2, 3, 4, 5, 6, 7]]]])
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(commands, size):
    full=set(range(size))
    out=[]
    for draws in commands:
        occluded=set()
        visible=[]
        for key,coverage,opaque,clip,writes in reversed(draws):
            effective=set(coverage)&set(clip)&set(writes)&full
            remaining=effective-occluded
            visible.append([key,sorted(remaining)])
            if opaque or len(effective)>1: occluded |= effective
        out.append(list(reversed(visible)))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 4), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 4), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 4), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 4), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 4), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 4), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 4), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 4), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 4), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 4), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 4), [[['a', [0, 1, 2, 3]]]])
if N == 2:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 5), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 5), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 5), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 5), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 5), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 5), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 5), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 5), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 5), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 5), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 5), [[['a', [0, 1, 2, 3, 4]]]])
if N == 3:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 6), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 6), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 6), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 6), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 6), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 6), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 6), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 6), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 6), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 6), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 6), [[['a', [0, 1, 2, 3, 4, 5]]]])
if N == 4:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 7), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 7), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 7), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 7), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 7), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 7), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 7), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 7), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 7), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 7), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 7), [[['a', [0, 1, 2, 3, 4, 5, 6]]]])
if N == 5:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 8), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 8), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 8), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 8), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 8), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 8), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 8), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 8), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 8), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 8), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 8), [[['a', [0, 1, 2, 3, 4, 5, 6, 7]]]])
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:
Transparent coverage is treated as fully occluding.

Draws are supplied back to front as ID, coverage set, opaque flag, clip set and sample-write-enable set. Visibility traverses front to back, subtracting only front opaque written samples. Transparent draws remain visible but do not occlude. Return every draw in original order, including empty visibility, labeled by ID. Repeated IDs are distinct draws. All coverage is finite-target bounded.

split: open-access


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

N = 1
observations = []
def solve(commands, size):
    full=set(range(size))
    out=[]
    for draws in commands:
        occluded=set()
        visible=[]
        for key,coverage,opaque,clip,writes in reversed(draws):
            effective=set(coverage)&set(writes)&full
            remaining=effective-occluded
            visible.append([key,sorted(remaining)])
            if opaque: occluded |= effective
        out.append(list(reversed(visible)))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 4), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 4), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 4), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 4), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 4), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 4), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 4), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 4), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 4), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 4), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 4), [[['a', [0, 1, 2, 3]]]])
if N == 2:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 5), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 5), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 5), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 5), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 5), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 5), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 5), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 5), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 5), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 5), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 5), [[['a', [0, 1, 2, 3, 4]]]])
if N == 3:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 6), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 6), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 6), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 6), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 6), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 6), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 6), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 6), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 6), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 6), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 6), [[['a', [0, 1, 2, 3, 4, 5]]]])
if N == 4:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 7), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 7), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 7), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 7), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 7), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 7), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 7), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 7), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 7), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 7), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 7), [[['a', [0, 1, 2, 3, 4, 5, 6]]]])
if N == 5:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 8), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 8), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 8), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 8), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 8), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 8), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 8), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 8), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 8), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 8), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 8), [[['a', [0, 1, 2, 3, 4, 5, 6, 7]]]])
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(commands, size):
    full=set(range(size))
    out=[]
    for draws in commands:
        occluded=set()
        visible=[]
        for key,coverage,opaque,clip,writes in reversed(draws):
            effective=set(coverage)&(set(clip) or full)&set(writes)&full
            remaining=effective-occluded
            visible.append([key,sorted(remaining)])
            if opaque: occluded |= effective
        out.append(list(reversed(visible)))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 4), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 4), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 4), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 4), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 4), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 4), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 4), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 4), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 4), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 4), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 4), [[['a', [0, 1, 2, 3]]]])
if N == 2:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 5), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 5), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 5), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 5), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 5), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 5), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 5), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 5), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 5), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 5), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 5), [[['a', [0, 1, 2, 3, 4]]]])
if N == 3:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 6), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 6), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 6), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 6), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 6), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 6), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 6), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 6), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 6), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 6), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 6), [[['a', [0, 1, 2, 3, 4, 5]]]])
if N == 4:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 7), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 7), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 7), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 7), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 7), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 7), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 7), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 7), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 7), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 7), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 7), [[['a', [0, 1, 2, 3, 4, 5, 6]]]])
if N == 5:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 8), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 8), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 8), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 8), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 8), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 8), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 8), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 8), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 8), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 8), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 8), [[['a', [0, 1, 2, 3, 4, 5, 6, 7]]]])
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:
Opaque samples outside a draw clip occlude backgrounds.

Draws are supplied back to front as ID, coverage set, opaque flag, clip set and sample-write-enable set. Visibility traverses front to back, subtracting only front opaque written samples. Transparent draws remain visible but do not occlude. Return every draw in original order, including empty visibility, labeled by ID. Repeated IDs are distinct draws. All coverage is finite-target bounded.

split: open-access


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

N = 1
observations = []
def solve(commands, size):
    full=set(range(size))
    out=[]
    for draws in commands:
        occluded=set()
        visible=[]
        for key,coverage,opaque,clip,writes in reversed(draws):
            effective=set(coverage)&set(clip)&full
            remaining=effective-occluded
            visible.append([key,sorted(remaining)])
            if opaque: occluded |= effective
        out.append(list(reversed(visible)))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 4), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 4), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 4), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 4), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 4), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 4), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 4), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 4), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 4), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 4), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 4), [[['a', [0, 1, 2, 3]]]])
if N == 2:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 5), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 5), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 5), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 5), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 5), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 5), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 5), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 5), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 5), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 5), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 5), [[['a', [0, 1, 2, 3, 4]]]])
if N == 3:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 6), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 6), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 6), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 6), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 6), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 6), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 6), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 6), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 6), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 6), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 6), [[['a', [0, 1, 2, 3, 4, 5]]]])
if N == 4:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 7), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 7), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 7), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 7), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 7), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 7), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 7), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 7), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 7), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 7), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 7), [[['a', [0, 1, 2, 3, 4, 5, 6]]]])
if N == 5:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 8), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 8), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 8), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 8), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 8), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 8), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 8), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 8), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 8), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 8), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 8), [[['a', [0, 1, 2, 3, 4, 5, 6, 7]]]])
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(commands, size):
    full=set(range(size))
    out=[]
    for draws in commands:
        occluded=set()
        visible=[]
        for key,coverage,opaque,clip,writes in reversed(draws):
            effective=set(coverage)&set(clip)&(set(writes) or full)&full
            remaining=effective-occluded
            visible.append([key,sorted(remaining)])
            if opaque: occluded |= effective
        out.append(list(reversed(visible)))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 4), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 4), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 4), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 4), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 4), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 4), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 4), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 4), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 4), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 4), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 4), [[['a', [0, 1, 2, 3]]]])
if N == 2:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 5), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 5), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 5), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 5), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 5), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 5), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 5), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 5), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 5), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 5), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 5), [[['a', [0, 1, 2, 3, 4]]]])
if N == 3:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 6), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 6), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 6), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 6), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 6), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 6), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 6), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 6), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 6), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 6), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 6), [[['a', [0, 1, 2, 3, 4, 5]]]])
if N == 4:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 7), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 7), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 7), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 7), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 7), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 7), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 7), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 7), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 7), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 7), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 7), [[['a', [0, 1, 2, 3, 4, 5, 6]]]])
if N == 5:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 8), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 8), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 8), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 8), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 8), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 8), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 8), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 8), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 8), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 8), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 8), [[['a', [0, 1, 2, 3, 4, 5, 6, 7]]]])
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:
Color-write-disabled samples participate in opaque occlusion.

Draws are supplied back to front as ID, coverage set, opaque flag, clip set and sample-write-enable set. Visibility traverses front to back, subtracting only front opaque written samples. Transparent draws remain visible but do not occlude. Return every draw in original order, including empty visibility, labeled by ID. Repeated IDs are distinct draws. All coverage is finite-target bounded.

split: open-access


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

N = 1
observations = []
def solve(commands, size):
    full=set(range(size))
    out=[]
    for draws in commands:
        occluded=set()
        visible=[]
        for key,coverage,opaque,clip,writes in reversed(draws):
            effective=set(coverage)&set(clip)&set(writes)&full
            remaining=effective^occluded
            visible.append([key,sorted(remaining)])
            if opaque: occluded |= effective
        out.append(list(reversed(visible)))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 4), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 4), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 4), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 4), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 4), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 4), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 4), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 4), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 4), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 4), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 4), [[['a', [0, 1, 2, 3]]]])
if N == 2:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 5), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 5), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 5), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 5), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 5), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 5), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 5), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 5), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 5), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 5), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 5), [[['a', [0, 1, 2, 3, 4]]]])
if N == 3:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 6), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 6), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 6), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 6), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 6), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 6), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 6), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 6), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 6), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 6), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 6), [[['a', [0, 1, 2, 3, 4, 5]]]])
if N == 4:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 7), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 7), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 7), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 7), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 7), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 7), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 7), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 7), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 7), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 7), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 7), [[['a', [0, 1, 2, 3, 4, 5, 6]]]])
if N == 5:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 8), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 8), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 8), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 8), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 8), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 8), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 8), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 8), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 8), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 8), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 8), [[['a', [0, 1, 2, 3, 4, 5, 6, 7]]]])
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(commands, size):
    full=set(range(size))
    out=[]
    for draws in commands:
        occluded=set()
        visible=[]
        for key,coverage,opaque,clip,writes in reversed(draws):
            effective=set(coverage)&set(clip)&set(writes)&full
            remaining=effective if not effective & occluded else set()
            visible.append([key,sorted(remaining)])
            if opaque: occluded |= effective
        out.append(list(reversed(visible)))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 4), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 4), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 4), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 4), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 4), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 4), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 4), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 4), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 4), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 4), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 4), [[['a', [0, 1, 2, 3]]]])
if N == 2:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 5), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 5), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 5), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 5), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 5), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 5), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 5), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 5), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 5), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 5), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 5), [[['a', [0, 1, 2, 3, 4]]]])
if N == 3:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 6), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 6), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 6), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 6), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 6), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 6), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 6), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 6), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 6), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 6), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 6), [[['a', [0, 1, 2, 3, 4, 5]]]])
if N == 4:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 7), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 7), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 7), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 7), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 7), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 7), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 7), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 7), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 7), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 7), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 7), [[['a', [0, 1, 2, 3, 4, 5, 6]]]])
if N == 5:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 8), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 8), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 8), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 8), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 8), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 8), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 8), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 8), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 8), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 8), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 8), [[['a', [0, 1, 2, 3, 4, 5, 6, 7]]]])
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:
Visibility subtraction adds samples covered only by foreground draws.

Draws are supplied back to front as ID, coverage set, opaque flag, clip set and sample-write-enable set. Visibility traverses front to back, subtracting only front opaque written samples. Transparent draws remain visible but do not occlude. Return every draw in original order, including empty visibility, labeled by ID. Repeated IDs are distinct draws. All coverage is finite-target bounded.

split: open-access


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

N = 1
observations = []
def solve(commands, size):
    full=set(range(size))
    out=[]
    for draws in commands:
        occluded=set()
        visible=[]
        for key,coverage,opaque,clip,writes in reversed(draws):
            effective=set(coverage)&set(clip)&set(writes)&full
            remaining=effective-occluded
            visible.append([key,sorted(remaining)])
            if opaque: occluded = effective
        out.append(list(reversed(visible)))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 4), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 4), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 4), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 4), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 4), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 4), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 4), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 4), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 4), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 4), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 4), [[['a', [0, 1, 2, 3]]]])
if N == 2:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 5), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 5), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 5), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 5), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 5), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 5), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 5), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 5), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 5), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 5), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 5), [[['a', [0, 1, 2, 3, 4]]]])
if N == 3:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 6), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 6), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 6), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 6), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 6), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 6), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 6), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 6), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 6), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 6), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 6), [[['a', [0, 1, 2, 3, 4, 5]]]])
if N == 4:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 7), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 7), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 7), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 7), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 7), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 7), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 7), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 7), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 7), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 7), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 7), [[['a', [0, 1, 2, 3, 4, 5, 6]]]])
if N == 5:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 8), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 8), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 8), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 8), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 8), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 8), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 8), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 8), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 8), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 8), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 8), [[['a', [0, 1, 2, 3, 4, 5, 6, 7]]]])
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(commands, size):
    full=set(range(size))
    out=[]
    for draws in commands:
        occluded=set()
        visible=[]
        for key,coverage,opaque,clip,writes in reversed(draws):
            effective=set(coverage)&set(clip)&set(writes)&full
            remaining=effective-occluded
            visible.append([key,sorted(remaining)])
            if opaque: occluded = occluded & effective
        out.append(list(reversed(visible)))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 4), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 4), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 4), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 4), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 4), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 4), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 4), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 4), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 4), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 4), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 4), [[['a', [0, 1, 2, 3]]]])
if N == 2:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 5), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 5), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 5), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 5), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 5), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 5), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 5), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 5), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 5), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 5), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 5), [[['a', [0, 1, 2, 3, 4]]]])
if N == 3:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 6), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 6), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 6), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 6), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 6), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 6), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 6), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 6), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 6), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 6), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 6), [[['a', [0, 1, 2, 3, 4, 5]]]])
if N == 4:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 7), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 7), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 7), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 7), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 7), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 7), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 7), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 7), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 7), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 7), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 7), [[['a', [0, 1, 2, 3, 4, 5, 6]]]])
if N == 5:
    check('explicit sequence 0', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [1], True, [1], [1]]]], 8), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 1', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], False, [0, 1], [0, 1]]]], 8), [[['back', [0, 1]], ['front', [0, 1]]]])
    check('explicit sequence 2', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0], [0, 1]]]], 8), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 3', solve([[['back', [0, 1], True, [0, 1], [0, 1]], ['front', [0, 1], True, [0, 1], [0]]]], 8), [[['back', [1]], ['front', [0]]]])
    check('explicit sequence 4', solve([[['back', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 8), [[['back', [0]], ['front', [1]]]])
    check('explicit sequence 5', solve([[['back', [0, 1, 2], True, [0, 1, 2], [0, 1, 2]], ['middle', [0], True, [0], [0]], ['front', [1], True, [1], [1]]]], 8), [[['back', [2]], ['middle', [0]], ['front', [1]]]])
    check('explicit sequence 6', solve([[['z', [0], False, [0], [0]], ['a', [1], False, [1], [1]]]], 8), [[['z', [0]], ['a', [1]]]])
    check('explicit sequence 7', solve([[['a', [0], False, [], [0]], ['b', [1], True, [1], [1]]]], 8), [[['a', []], ['b', [1]]]])
    check('explicit sequence 8', solve([[['same', [0], False, [0], [0]], ['same', [1], False, [1], [1]]]], 8), [[['same', [0]], ['same', [1]]]])
    check('explicit sequence 9', solve([[['a', [0], True, [0], []]]], 8), [[['a', []]]])
    check('explicit sequence 10', solve([[['a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], True, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]]], 8), [[['a', [0, 1, 2, 3, 4, 5, 6, 7]]]])
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:
Each opaque draw overwrites foreground occlusion accumulated from earlier draws.

Draws are supplied back to front as ID, coverage set, opaque flag, clip set and sample-write-enable set. Visibility traverses front to back, subtracting only front opaque written samples. Transparent draws remain visible but do not occlude. Return every draw in original order, including empty visibility, labeled by ID. Repeated IDs are distinct draws. All coverage is finite-target bounded.

split: open-access