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

N = 1
observations = []
def solve(commands, size):
    full=set(range(size))
    ids=[None]*size
    depths=[float('inf')]*size
    out=[]
    for cmd in commands:
        if cmd[0]=='clear':
            for x in set(cmd[1])&full: ids[x]=None; depths[x]=float('inf')
        elif cmd[0]=='draw':
            _,key,coverage,clip,depth,test,write=cmd
            for x in set(coverage)&set(clip)&full:
                if test and depth>depths[x]: continue
                if test: depths[x]=depth
                if write: ids[x]=key
        else:
            out.append([ids[x] if x in full else None for x in cmd[1]])
    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([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 4), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 4), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 4), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 4), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 4), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 4), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 4), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 4), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 4), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 4), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 4), [[None]])
if N == 2:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 5), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 5), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 5), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 5), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 5), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 5), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 5), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 5), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 5), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 5), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 5), [[None]])
if N == 3:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 6), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 6), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 6), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 6), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 6), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 6), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 6), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 6), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 6), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 6), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 6), [[None]])
if N == 4:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 7), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 7), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 7), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 7), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 7), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 7), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 7), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 7), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 7), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 7), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 7), [[None]])
if N == 5:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 8), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 8), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 8), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 8), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 8), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 8), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 8), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 8), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 8), [[None, 'a', None, 'a']])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 8), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 8), [[None]])
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))
    ids=[None]*size
    depths=[float('inf')]*size
    out=[]
    for cmd in commands:
        if cmd[0]=='clear':
            for x in set(cmd[1])&full: ids[x]=None; depths[x]=float('inf')
        elif cmd[0]=='draw':
            _,key,coverage,clip,depth,test,write=cmd
            for x in set(coverage)&set(clip)&full:
                if test and depth>depths[x] or (depth==depths[x] and key is None): continue
                if test: depths[x]=depth
                if write: ids[x]=key
        else:
            out.append([ids[x] if x in full else None for x in cmd[1]])
    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([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 4), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 4), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 4), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 4), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 4), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 4), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 4), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 4), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 4), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 4), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 4), [[None]])
if N == 2:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 5), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 5), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 5), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 5), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 5), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 5), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 5), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 5), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 5), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 5), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 5), [[None]])
if N == 3:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 6), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 6), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 6), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 6), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 6), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 6), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 6), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 6), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 6), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 6), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 6), [[None]])
if N == 4:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 7), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 7), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 7), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 7), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 7), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 7), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 7), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 7), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 7), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 7), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 7), [[None]])
if N == 5:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 8), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 8), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 8), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 8), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 8), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 8), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 8), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 8), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 8), [[None, 'a', None, 'a']])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 8), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 8), [[None]])
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:
Equal-depth fragments replace the earlier pick ID despite strict-nearer policy.

Each draw has an object ID, coverage samples, clip samples, integer depth, depth-test flag and ID-write flag. ID zero is a valid object. Pick samples start empty with infinite depth. With depth test enabled, strictly nearer fragments replace stored IDs and depth; equal depth keeps the earlier fragment. Disabled depth testing writes without changing depth. ID-write-disabled draws still update depth when tested. Queries return IDs or null for out-of-target samples.

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))
    ids=[None]*size
    depths=[float('inf')]*size
    out=[]
    for cmd in commands:
        if cmd[0]=='clear':
            for x in set(cmd[1])&full: ids[x]=None; depths[x]=float('inf')
        elif cmd[0]=='draw':
            _,key,coverage,clip,depth,test,write=cmd
            for x in set(coverage)&set(clip)&full:
                if test and depth>=depths[x]: continue
                depths[x]=depth
                if write: ids[x]=key
        else:
            out.append([ids[x] if x in full else None for x in cmd[1]])
    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([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 4), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 4), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 4), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 4), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 4), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 4), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 4), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 4), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 4), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 4), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 4), [[None]])
if N == 2:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 5), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 5), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 5), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 5), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 5), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 5), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 5), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 5), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 5), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 5), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 5), [[None]])
if N == 3:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 6), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 6), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 6), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 6), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 6), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 6), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 6), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 6), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 6), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 6), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 6), [[None]])
if N == 4:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 7), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 7), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 7), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 7), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 7), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 7), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 7), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 7), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 7), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 7), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 7), [[None]])
if N == 5:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 8), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 8), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 8), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 8), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 8), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 8), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 8), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 8), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 8), [[None, 'a', None, 'a']])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 8), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 8), [[None]])
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))
    ids=[None]*size
    depths=[float('inf')]*size
    out=[]
    for cmd in commands:
        if cmd[0]=='clear':
            for x in set(cmd[1])&full: ids[x]=None; depths[x]=float('inf')
        elif cmd[0]=='draw':
            _,key,coverage,clip,depth,test,write=cmd
            for x in set(coverage)&set(clip)&full:
                if test and depth>=depths[x]: continue
                if test or depths[x]==float('inf'): depths[x]=depth
                if write: ids[x]=key
        else:
            out.append([ids[x] if x in full else None for x in cmd[1]])
    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([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 4), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 4), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 4), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 4), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 4), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 4), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 4), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 4), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 4), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 4), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 4), [[None]])
if N == 2:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 5), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 5), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 5), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 5), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 5), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 5), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 5), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 5), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 5), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 5), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 5), [[None]])
if N == 3:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 6), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 6), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 6), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 6), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 6), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 6), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 6), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 6), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 6), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 6), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 6), [[None]])
if N == 4:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 7), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 7), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 7), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 7), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 7), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 7), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 7), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 7), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 7), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 7), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 7), [[None]])
if N == 5:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 8), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 8), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 8), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 8), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 8), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 8), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 8), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 8), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 8), [[None, 'a', None, 'a']])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 8), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 8), [[None]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A depth-test-disabled picking draw changes the stored depth used by later tested draws.

Each draw has an object ID, coverage samples, clip samples, integer depth, depth-test flag and ID-write flag. ID zero is a valid object. Pick samples start empty with infinite depth. With depth test enabled, strictly nearer fragments replace stored IDs and depth; equal depth keeps the earlier fragment. Disabled depth testing writes without changing depth. ID-write-disabled draws still update depth when tested. Queries return IDs or null for out-of-target samples.

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))
    ids=[None]*size
    depths=[float('inf')]*size
    out=[]
    for cmd in commands:
        if cmd[0]=='clear':
            for x in set(cmd[1])&full: ids[x]=None; depths[x]=float('inf')
        elif cmd[0]=='draw':
            _,key,coverage,clip,depth,test,write=cmd
            for x in set(coverage)&set(clip)&full:
                if test and depth>=depths[x]: continue
                if test and write: depths[x]=depth
                if write: ids[x]=key
        else:
            out.append([ids[x] if x in full else None for x in cmd[1]])
    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([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 4), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 4), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 4), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 4), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 4), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 4), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 4), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 4), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 4), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 4), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 4), [[None]])
if N == 2:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 5), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 5), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 5), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 5), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 5), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 5), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 5), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 5), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 5), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 5), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 5), [[None]])
if N == 3:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 6), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 6), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 6), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 6), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 6), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 6), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 6), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 6), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 6), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 6), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 6), [[None]])
if N == 4:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 7), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 7), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 7), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 7), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 7), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 7), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 7), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 7), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 7), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 7), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 7), [[None]])
if N == 5:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 8), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 8), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 8), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 8), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 8), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 8), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 8), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 8), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 8), [[None, 'a', None, 'a']])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 8), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 8), [[None]])
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))
    ids=[None]*size
    depths=[float('inf')]*size
    out=[]
    for cmd in commands:
        if cmd[0]=='clear':
            for x in set(cmd[1])&full: ids[x]=None; depths[x]=float('inf')
        elif cmd[0]=='draw':
            _,key,coverage,clip,depth,test,write=cmd
            for x in set(coverage)&set(clip)&full:
                if test and depth>=depths[x]: continue
                if test and (write or key is None): depths[x]=depth
                if write: ids[x]=key
        else:
            out.append([ids[x] if x in full else None for x in cmd[1]])
    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([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 4), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 4), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 4), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 4), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 4), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 4), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 4), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 4), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 4), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 4), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 4), [[None]])
if N == 2:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 5), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 5), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 5), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 5), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 5), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 5), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 5), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 5), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 5), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 5), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 5), [[None]])
if N == 3:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 6), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 6), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 6), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 6), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 6), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 6), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 6), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 6), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 6), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 6), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 6), [[None]])
if N == 4:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 7), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 7), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 7), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 7), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 7), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 7), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 7), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 7), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 7), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 7), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 7), [[None]])
if N == 5:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 8), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 8), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 8), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 8), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 8), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 8), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 8), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 8), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 8), [[None, 'a', None, 'a']])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 8), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 8), [[None]])
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:
An ID-write-disabled depth-only draw fails to occlude later picking draws.

Each draw has an object ID, coverage samples, clip samples, integer depth, depth-test flag and ID-write flag. ID zero is a valid object. Pick samples start empty with infinite depth. With depth test enabled, strictly nearer fragments replace stored IDs and depth; equal depth keeps the earlier fragment. Disabled depth testing writes without changing depth. ID-write-disabled draws still update depth when tested. Queries return IDs or null for out-of-target samples.

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))
    ids=[None]*size
    depths=[float('inf')]*size
    out=[]
    for cmd in commands:
        if cmd[0]=='clear':
            for x in set(cmd[1])&full: ids[x]=None; depths[x]=float('inf')
        elif cmd[0]=='draw':
            _,key,coverage,clip,depth,test,write=cmd
            for x in set(coverage)&set(clip)&full:
                if test and depth>=depths[x]: continue
                if test: depths[x]=depth
                if write and key: ids[x]=key
        else:
            out.append([ids[x] if x in full else None for x in cmd[1]])
    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([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 4), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 4), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 4), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 4), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 4), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 4), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 4), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 4), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 4), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 4), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 4), [[None]])
if N == 2:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 5), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 5), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 5), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 5), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 5), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 5), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 5), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 5), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 5), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 5), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 5), [[None]])
if N == 3:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 6), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 6), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 6), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 6), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 6), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 6), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 6), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 6), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 6), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 6), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 6), [[None]])
if N == 4:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 7), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 7), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 7), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 7), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 7), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 7), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 7), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 7), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 7), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 7), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 7), [[None]])
if N == 5:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 8), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 8), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 8), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 8), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 8), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 8), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 8), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 8), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 8), [[None, 'a', None, 'a']])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 8), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 8), [[None]])
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))
    ids=[None]*size
    depths=[float('inf')]*size
    out=[]
    for cmd in commands:
        if cmd[0]=='clear':
            for x in set(cmd[1])&full: ids[x]=None; depths[x]=float('inf')
        elif cmd[0]=='draw':
            _,key,coverage,clip,depth,test,write=cmd
            for x in set(coverage)&set(clip)&full:
                if test and depth>=depths[x]: continue
                if test: depths[x]=depth
                if write: ids[x]=key or None
        else:
            out.append([ids[x] if x in full else None for x in cmd[1]])
    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([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 4), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 4), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 4), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 4), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 4), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 4), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 4), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 4), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 4), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 4), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 4), [[None]])
if N == 2:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 5), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 5), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 5), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 5), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 5), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 5), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 5), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 5), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 5), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 5), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 5), [[None]])
if N == 3:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 6), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 6), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 6), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 6), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 6), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 6), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 6), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 6), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 6), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 6), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 6), [[None]])
if N == 4:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 7), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 7), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 7), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 7), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 7), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 7), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 7), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 7), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 7), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 7), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 7), [[None]])
if N == 5:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 8), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 8), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 8), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 8), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 8), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 8), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 8), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 8), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 8), [[None, 'a', None, 'a']])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 8), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 8), [[None]])
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:
Object ID zero is treated as absent and never reaches the picking attachment.

Each draw has an object ID, coverage samples, clip samples, integer depth, depth-test flag and ID-write flag. ID zero is a valid object. Pick samples start empty with infinite depth. With depth test enabled, strictly nearer fragments replace stored IDs and depth; equal depth keeps the earlier fragment. Disabled depth testing writes without changing depth. ID-write-disabled draws still update depth when tested. Queries return IDs or null for out-of-target samples.

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))
    ids=[None]*size
    depths=[float('inf')]*size
    out=[]
    for cmd in commands:
        if cmd[0]=='clear':
            for x in set(cmd[1])&full: ids[x]=None; depths[x]=float('inf')
        elif cmd[0]=='draw':
            _,key,coverage,clip,depth,test,write=cmd
            for x in set(coverage)&set(clip)&full:
                if test and depth>=depths[x]: continue
                if test: depths[x]=depth
                ids[x]=key
        else:
            out.append([ids[x] if x in full else None for x in cmd[1]])
    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([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 4), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 4), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 4), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 4), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 4), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 4), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 4), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 4), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 4), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 4), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 4), [[None]])
if N == 2:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 5), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 5), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 5), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 5), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 5), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 5), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 5), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 5), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 5), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 5), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 5), [[None]])
if N == 3:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 6), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 6), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 6), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 6), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 6), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 6), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 6), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 6), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 6), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 6), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 6), [[None]])
if N == 4:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 7), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 7), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 7), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 7), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 7), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 7), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 7), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 7), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 7), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 7), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 7), [[None]])
if N == 5:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 8), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 8), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 8), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 8), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 8), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 8), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 8), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 8), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 8), [[None, 'a', None, 'a']])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 8), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 8), [[None]])
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))
    ids=[None]*size
    depths=[float('inf')]*size
    out=[]
    for cmd in commands:
        if cmd[0]=='clear':
            for x in set(cmd[1])&full: ids[x]=None; depths[x]=float('inf')
        elif cmd[0]=='draw':
            _,key,coverage,clip,depth,test,write=cmd
            for x in set(coverage)&set(clip)&full:
                if test and depth>=depths[x]: continue
                if test: depths[x]=depth
                if write or ids[x] is None: ids[x]=key
        else:
            out.append([ids[x] if x in full else None for x in cmd[1]])
    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([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 4), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 4), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 4), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 4), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 4), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 4), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 4), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 4), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 4), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 4), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 4), [[None]])
if N == 2:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 5), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 5), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 5), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 5), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 5), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 5), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 5), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 5), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 5), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 5), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 5), [[None]])
if N == 3:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 6), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 6), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 6), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 6), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 6), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 6), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 6), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 6), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 6), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 6), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 6), [[None]])
if N == 4:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 7), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 7), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 7), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 7), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 7), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 7), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 7), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 7), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 7), [[None, 'a', None, None]])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 7), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 7), [[None]])
if N == 5:
    check('explicit sequence 0', solve([['draw', 'a', [0, 1], [0], 3, True, True], ['read', [0, 1]]], 8), [['a', None]])
    check('explicit sequence 1', solve([['draw', 'a', [0], [0], 3, True, True], ['draw', 'b', [0], [0], 3, True, True], ['read', [0]]], 8), [['a']])
    check('explicit sequence 2', solve([['draw', 'a', [0], [0], 1, False, True], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 8), [['b']])
    check('explicit sequence 3', solve([['draw', 'a', [0], [0], 1, True, False], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 8), [[None]])
    check('explicit sequence 4', solve([['draw', 0, [0], [0], 1, True, True], ['read', [0]]], 8), [[0]])
    check('explicit sequence 5', solve([['draw', 'a', [0], [0], 1, False, False], ['read', [0]]], 8), [[None]])
    check('explicit sequence 6', solve([['draw', 'a', [0], [0], 1, True, True], ['clear', [0]], ['draw', 'b', [0], [0], 2, True, True], ['read', [0]]], 8), [['b']])
    check('explicit sequence 7', solve([['draw', 'a', [0, 1], [0, 1], 1, True, True], ['clear', [0]], ['read', [0, 1]], ['clear', []], ['read', [1]]], 8), [[None, 'a'], ['a']])
    check('explicit sequence 8', solve([['draw', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1, True, True], ['read', [-1, 0, 99, 7]]], 8), [[None, 'a', None, 'a']])
    check('explicit sequence 9', solve([['draw', 'a', [0], [0], 1, True, True], ['draw', 'b', [1], [1], 1, True, True], ['read', [1, 0, 1]]], 8), [['b', 'a', 'b']])
    check('explicit sequence 10', solve([['draw', 'a', [0], [], 1, True, True], ['read', [0]]], 8), [[None]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A draw with ID writes disabled replaces the pick result.

Each draw has an object ID, coverage samples, clip samples, integer depth, depth-test flag and ID-write flag. ID zero is a valid object. Pick samples start empty with infinite depth. With depth test enabled, strictly nearer fragments replace stored IDs and depth; equal depth keeps the earlier fragment. Disabled depth testing writes without changing depth. ID-write-disabled draws still update depth when tested. Queries return IDs or null for out-of-target samples.

split: open-access