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

N = 1
observations = []
def solve(commands, size):
    full=set(range(size))
    clip=set(full)
    lanes=set(full)
    results={}
    active=None
    query_enabled=True
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op=='clip': clip=set(cmd[1])&full
        elif op=='lanes': lanes=set(cmd[1])&full
        elif op=='begin': active=cmd[1]; results[active]=0
        elif op=='end': active=None
        elif op=='enable-query': query_enabled=cmd[1]
        elif op in ('draw','conditional'):
            samples=cmd[1]
            if op=='conditional' and (cmd[2]==active or results.get(cmd[2],0)==0): continue
            visible=set(samples)&clip&lanes
            if active is not None and query_enabled: results[active]+=len(visible)
        elif op=='read': out.append(results.get(cmd[1],0))
    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([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 4), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 4), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 4), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 4), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 4), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 4), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 4), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 4), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 4), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 4), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 4), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 4), [4])
if N == 2:
    check('explicit sequence 0', solve([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 5), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 5), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 5), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 5), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 5), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 5), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 5), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 5), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 5), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 5), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 5), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 5), [5])
if N == 3:
    check('explicit sequence 0', solve([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 6), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 6), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 6), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 6), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 6), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 6), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 6), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 6), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 6), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 6), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 6), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 6), [6])
if N == 4:
    check('explicit sequence 0', solve([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 7), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 7), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 7), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 7), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 7), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 7), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 7), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 7), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 7), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 7), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 7), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 7), [7])
if N == 5:
    check('explicit sequence 0', solve([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 8), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 8), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 8), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 8), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 8), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 8), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 8), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 8), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 8), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 8), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 8), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 8), [8])
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))
    clip=set(full)
    lanes=set(full)
    results={}
    active=None
    query_enabled=True
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op=='clip': clip=set(cmd[1])&full
        elif op=='lanes': lanes=set(cmd[1])&full
        elif op=='begin': active=cmd[1]; results[active]=0
        elif op=='end': active=None
        elif op=='enable-query': query_enabled=cmd[1]
        elif op in ('draw','conditional'):
            samples=cmd[1]
            if op=='conditional' and (cmd[2]==active or results.get(cmd[2],0)==0): continue
            visible=set(samples)&clip&lanes
            if active is not None and query_enabled: results[active]+=len(visible)
        elif op=='read': out.append(None if cmd[1]==active and not results.get(cmd[1],0) else results.get(cmd[1],0))
    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([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 4), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 4), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 4), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 4), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 4), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 4), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 4), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 4), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 4), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 4), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 4), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 4), [4])
if N == 2:
    check('explicit sequence 0', solve([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 5), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 5), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 5), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 5), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 5), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 5), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 5), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 5), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 5), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 5), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 5), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 5), [5])
if N == 3:
    check('explicit sequence 0', solve([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 6), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 6), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 6), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 6), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 6), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 6), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 6), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 6), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 6), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 6), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 6), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 6), [6])
if N == 4:
    check('explicit sequence 0', solve([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 7), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 7), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 7), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 7), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 7), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 7), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 7), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 7), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 7), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 7), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 7), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 7), [7])
if N == 5:
    check('explicit sequence 0', solve([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 8), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 8), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 8), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 8), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 8), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 8), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 8), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 8), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 8), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 8), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 8), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 8), [8])
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:
Reading an active query exposes an incomplete result.

Queries count distinct covered sample IDs per draw after path clipping and sample enable masking. Multiple draws accumulate independently, while duplicate sample IDs within one draw count once. Begin resets a named result and activates it; end makes it readable. Result reads while active return null. Conditional draws consult only completed query counts. Disabling queries pauses accumulation without disabling clipping.

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))
    clip=set(full)
    lanes=set(full)
    results={}
    active=None
    query_enabled=True
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op=='clip': clip=set(cmd[1])&full
        elif op=='lanes': lanes=set(cmd[1])&full
        elif op=='begin': active=cmd[1]; results[active]=0
        elif op=='end': active=None
        elif op=='enable-query': query_enabled=cmd[1]
        elif op in ('draw','conditional'):
            samples=cmd[1]
            if op=='conditional' and (results.get(cmd[2],0)==0): continue
            visible=set(samples)&clip&lanes
            if active is not None and query_enabled: results[active]+=len(visible)
        elif op=='read': out.append(None if cmd[1]==active else results.get(cmd[1],0))
    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([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 4), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 4), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 4), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 4), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 4), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 4), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 4), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 4), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 4), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 4), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 4), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 4), [4])
if N == 2:
    check('explicit sequence 0', solve([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 5), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 5), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 5), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 5), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 5), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 5), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 5), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 5), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 5), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 5), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 5), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 5), [5])
if N == 3:
    check('explicit sequence 0', solve([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 6), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 6), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 6), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 6), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 6), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 6), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 6), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 6), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 6), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 6), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 6), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 6), [6])
if N == 4:
    check('explicit sequence 0', solve([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 7), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 7), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 7), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 7), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 7), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 7), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 7), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 7), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 7), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 7), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 7), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 7), [7])
if N == 5:
    check('explicit sequence 0', solve([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 8), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 8), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 8), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 8), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 8), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 8), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 8), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 8), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 8), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 8), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 8), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 8), [8])
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))
    clip=set(full)
    lanes=set(full)
    results={}
    active=None
    query_enabled=True
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op=='clip': clip=set(cmd[1])&full
        elif op=='lanes': lanes=set(cmd[1])&full
        elif op=='begin': active=cmd[1]; results[active]=0
        elif op=='end': active=None
        elif op=='enable-query': query_enabled=cmd[1]
        elif op in ('draw','conditional'):
            samples=cmd[1]
            if op=='conditional' and (cmd[2]==active and results.get(cmd[2],0)==0): continue
            visible=set(samples)&clip&lanes
            if active is not None and query_enabled: results[active]+=len(visible)
        elif op=='read': out.append(None if cmd[1]==active else results.get(cmd[1],0))
    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([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 4), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 4), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 4), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 4), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 4), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 4), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 4), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 4), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 4), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 4), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 4), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 4), [4])
if N == 2:
    check('explicit sequence 0', solve([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 5), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 5), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 5), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 5), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 5), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 5), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 5), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 5), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 5), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 5), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 5), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 5), [5])
if N == 3:
    check('explicit sequence 0', solve([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 6), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 6), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 6), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 6), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 6), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 6), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 6), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 6), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 6), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 6), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 6), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 6), [6])
if N == 4:
    check('explicit sequence 0', solve([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 7), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 7), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 7), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 7), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 7), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 7), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 7), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 7), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 7), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 7), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 7), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 7), [7])
if N == 5:
    check('explicit sequence 0', solve([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 8), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 8), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 8), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 8), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 8), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 8), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 8), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 8), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 8), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 8), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 8), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 8), [8])
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:
Conditional rendering uses the partial count of the currently active query.

Queries count distinct covered sample IDs per draw after path clipping and sample enable masking. Multiple draws accumulate independently, while duplicate sample IDs within one draw count once. Begin resets a named result and activates it; end makes it readable. Result reads while active return null. Conditional draws consult only completed query counts. Disabling queries pauses accumulation without disabling clipping.

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))
    clip=set(full)
    lanes=set(full)
    results={}
    active=None
    query_enabled=True
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op=='clip': clip=set(cmd[1])&full
        elif op=='lanes': lanes=set(cmd[1])&full
        elif op=='begin': active=cmd[1]; results[active]=0
        elif op=='end': active=None
        elif op=='enable-query': query_enabled=cmd[1]
        elif op in ('draw','conditional'):
            samples=cmd[1]
            if op=='conditional' and (cmd[2]==active or results.get(cmd[2],1)==0): continue
            visible=set(samples)&clip&lanes
            if active is not None and query_enabled: results[active]+=len(visible)
        elif op=='read': out.append(None if cmd[1]==active else results.get(cmd[1],0))
    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([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 4), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 4), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 4), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 4), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 4), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 4), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 4), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 4), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 4), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 4), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 4), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 4), [4])
if N == 2:
    check('explicit sequence 0', solve([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 5), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 5), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 5), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 5), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 5), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 5), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 5), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 5), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 5), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 5), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 5), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 5), [5])
if N == 3:
    check('explicit sequence 0', solve([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 6), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 6), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 6), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 6), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 6), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 6), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 6), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 6), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 6), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 6), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 6), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 6), [6])
if N == 4:
    check('explicit sequence 0', solve([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 7), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 7), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 7), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 7), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 7), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 7), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 7), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 7), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 7), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 7), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 7), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 7), [7])
if N == 5:
    check('explicit sequence 0', solve([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 8), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 8), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 8), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 8), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 8), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 8), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 8), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 8), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 8), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 8), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 8), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 8), [8])
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))
    clip=set(full)
    lanes=set(full)
    results={}
    active=None
    query_enabled=True
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op=='clip': clip=set(cmd[1])&full
        elif op=='lanes': lanes=set(cmd[1])&full
        elif op=='begin': active=cmd[1]; results[active]=0
        elif op=='end': active=None
        elif op=='enable-query': query_enabled=cmd[1]
        elif op in ('draw','conditional'):
            samples=cmd[1]
            if op=='conditional' and (cmd[2]==active or results.get(cmd[2],len(full))==0): continue
            visible=set(samples)&clip&lanes
            if active is not None and query_enabled: results[active]+=len(visible)
        elif op=='read': out.append(None if cmd[1]==active else results.get(cmd[1],0))
    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([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 4), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 4), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 4), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 4), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 4), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 4), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 4), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 4), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 4), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 4), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 4), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 4), [4])
if N == 2:
    check('explicit sequence 0', solve([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 5), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 5), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 5), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 5), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 5), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 5), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 5), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 5), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 5), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 5), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 5), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 5), [5])
if N == 3:
    check('explicit sequence 0', solve([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 6), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 6), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 6), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 6), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 6), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 6), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 6), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 6), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 6), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 6), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 6), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 6), [6])
if N == 4:
    check('explicit sequence 0', solve([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 7), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 7), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 7), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 7), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 7), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 7), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 7), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 7), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 7), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 7), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 7), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 7), [7])
if N == 5:
    check('explicit sequence 0', solve([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 8), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 8), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 8), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 8), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 8), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 8), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 8), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 8), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 8), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 8), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 8), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 8), [8])
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 missing conditional query defaults to visible and executes the draw.

Queries count distinct covered sample IDs per draw after path clipping and sample enable masking. Multiple draws accumulate independently, while duplicate sample IDs within one draw count once. Begin resets a named result and activates it; end makes it readable. Result reads while active return null. Conditional draws consult only completed query counts. Disabling queries pauses accumulation without disabling clipping.

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))
    clip=set(full)
    lanes=set(full)
    results={}
    active=None
    query_enabled=True
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op=='clip': clip=set(cmd[1])&full
        elif op=='lanes': lanes=set(cmd[1])&full
        elif op=='begin': active=cmd[1]; results[active]=0
        elif op=='end': active=None
        elif op=='enable-query': query_enabled=cmd[1]
        elif op in ('draw','conditional'):
            samples=cmd[1]
            if op=='conditional' and (cmd[2]==active or results.get(cmd[2],0)==0): continue
            visible=set(samples)&clip&lanes
            if active is not None and query_enabled: results[active]+=len(visible)
        elif op=='read': out.append(None if cmd[1]==active else next(iter(results.values()),0))
    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([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 4), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 4), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 4), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 4), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 4), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 4), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 4), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 4), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 4), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 4), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 4), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 4), [4])
if N == 2:
    check('explicit sequence 0', solve([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 5), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 5), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 5), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 5), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 5), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 5), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 5), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 5), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 5), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 5), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 5), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 5), [5])
if N == 3:
    check('explicit sequence 0', solve([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 6), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 6), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 6), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 6), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 6), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 6), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 6), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 6), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 6), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 6), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 6), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 6), [6])
if N == 4:
    check('explicit sequence 0', solve([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 7), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 7), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 7), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 7), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 7), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 7), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 7), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 7), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 7), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 7), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 7), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 7), [7])
if N == 5:
    check('explicit sequence 0', solve([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 8), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 8), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 8), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 8), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 8), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 8), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 8), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 8), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 8), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 8), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 8), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 8), [8])
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))
    clip=set(full)
    lanes=set(full)
    results={}
    active=None
    query_enabled=True
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op=='clip': clip=set(cmd[1])&full
        elif op=='lanes': lanes=set(cmd[1])&full
        elif op=='begin': active=cmd[1]; results[active]=0
        elif op=='end': active=None
        elif op=='enable-query': query_enabled=cmd[1]
        elif op in ('draw','conditional'):
            samples=cmd[1]
            if op=='conditional' and (cmd[2]==active or results.get(cmd[2],0)==0): continue
            visible=set(samples)&clip&lanes
            if active is not None and query_enabled: results[active]+=len(visible)
        elif op=='read': out.append(None if cmd[1]==active else max(results.values(),default=0))
    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([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 4), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 4), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 4), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 4), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 4), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 4), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 4), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 4), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 4), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 4), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 4), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 4), [4])
if N == 2:
    check('explicit sequence 0', solve([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 5), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 5), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 5), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 5), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 5), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 5), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 5), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 5), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 5), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 5), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 5), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 5), [5])
if N == 3:
    check('explicit sequence 0', solve([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 6), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 6), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 6), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 6), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 6), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 6), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 6), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 6), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 6), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 6), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 6), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 6), [6])
if N == 4:
    check('explicit sequence 0', solve([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 7), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 7), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 7), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 7), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 7), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 7), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 7), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 7), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 7), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 7), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 7), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 7), [7])
if N == 5:
    check('explicit sequence 0', solve([['clip', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 8), [1])
    check('explicit sequence 1', solve([['lanes', [0]], ['begin', 'q'], ['draw', [0, 1]], ['end'], ['read', 'q']], 8), [1])
    check('explicit sequence 2', solve([['begin', 'q'], ['draw', [0, 0, 1]], ['end'], ['read', 'q']], 8), [2])
    check('explicit sequence 3', solve([['begin', 'q'], ['draw', [0]], ['draw', [1]], ['end'], ['read', 'q']], 8), [2])
    check('explicit sequence 4', solve([['begin', 'q'], ['draw', [0]], ['end'], ['begin', 'q'], ['end'], ['read', 'q']], 8), [0])
    check('explicit sequence 5', solve([['begin', 'q'], ['draw', [0]], ['end'], ['draw', [1]], ['read', 'q']], 8), [1])
    check('explicit sequence 6', solve([['begin', 'q'], ['enable-query', False], ['draw', [0]], ['enable-query', True], ['end'], ['read', 'q']], 8), [0])
    check('explicit sequence 7', solve([['begin', 'q'], ['draw', [0]], ['read', 'q'], ['conditional', [1], 'q'], ['end'], ['read', 'q']], 8), [None, 1])
    check('explicit sequence 8', solve([['begin', 'q'], ['conditional', [0], 'missing'], ['end'], ['read', 'q']], 8), [0])
    check('explicit sequence 9', solve([['begin', 'a'], ['draw', [0]], ['end'], ['begin', 'b'], ['end'], ['read', 'b']], 8), [0])
    check('explicit sequence 10', solve([['clip', []], ['begin', 'q'], ['draw', [0]], ['end'], ['read', 'q']], 8), [0])
    check('explicit sequence 11', solve([['begin', 'q'], ['draw', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['end'], ['read', 'q']], 8), [8])
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:
Reading a query returns the first recorded query rather than the requested name.

Queries count distinct covered sample IDs per draw after path clipping and sample enable masking. Multiple draws accumulate independently, while duplicate sample IDs within one draw count once. Begin resets a named result and activates it; end makes it readable. Result reads while active return null. Conditional draws consult only completed query counts. Disabling queries pauses accumulation without disabling clipping.

split: open-access


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

N = 1
observations = []
def solve(commands, size):
    full=set(range(size))
    out=[]
    for viewclips,active,primitive,routes,scissors,scissor_enabled,samples in commands:
        rendered=[]
        for view in range(len(viewclips)):
            bit=view
            if not (active & bit and primitive & bit): continue
            viewport=routes[view] if view<len(routes) else view
            if viewport is None: continue
            if viewport<0 or viewport>=len(scissors): continue
            viewport_clip=set(scissors[viewport]) if viewport in scissor_enabled else full
            visible=set(samples)&set(viewclips[view])&viewport_clip&full
            rendered.append([view,sorted(visible)])
        out.append(rendered)
    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([[[[0], [1], [2]], 7, 7, [], [[0], [1], [2]], [0, 1, 2], [0, 1, 2]]], 4), [[[0, [0]], [1, [1]], [2, [2]]]])
    check('explicit sequence 1', solve([[[[0], [1]], 1, 2, [], [[0], [1]], [0, 1], [0, 1]]], 4), [[]])
    check('explicit sequence 2', solve([[[[0, 1], [1, 2]], 3, 3, [1, 0], [[0], [1]], [0, 1], [0, 1, 2]]], 4), [[[0, [1]], [1, []]]])
    check('explicit sequence 3', solve([[[[0]], 1, 1, [None], [[0]], [0], [0]]], 4), [[]])
    check('explicit sequence 4', solve([[[[0]], 1, 1, [-1], [[0]], [0], [0]]], 4), [[]])
    check('explicit sequence 5', solve([[[[0, 1], [0, 1]], 3, 3, [1, 0], [[0], [1]], [0], [0, 1]]], 4), [[[0, [0, 1]], [1, [0]]]])
    check('explicit sequence 6', solve([[[[0]], 1, 1, [0], [[]], [], [0]]], 4), [[[0, [0]]]])
    check('explicit sequence 7', solve([[[[0], [1], [2]], 4, 4, [], [[0], [1], [2]], [0, 1, 2], [0, 1, 2]]], 4), [[[2, [2]]]])
    check('explicit sequence 8', solve([[[[0, 99]], 1, 1, [0], [[0, 99]], [0], [0, 99]]], 4), [[[0, [0]]]])
    check('explicit sequence 9', solve([[[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], 1, 1, [], [[]], [], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]], 4), [[[0, [0, 1, 2, 3]]]])
if N == 2:
    check('explicit sequence 0', solve([[[[0], [1], [2]], 7, 7, [], [[0], [1], [2]], [0, 1, 2], [0, 1, 2]]], 5), [[[0, [0]], [1, [1]], [2, [2]]]])
    check('explicit sequence 1', solve([[[[0], [1]], 1, 2, [], [[0], [1]], [0, 1], [0, 1]]], 5), [[]])
    check('explicit sequence 2', solve([[[[0, 1], [1, 2]], 3, 3, [1, 0], [[0], [1]], [0, 1], [0, 1, 2]]], 5), [[[0, [1]], [1, []]]])
    check('explicit sequence 3', solve([[[[0]], 1, 1, [None], [[0]], [0], [0]]], 5), [[]])
    check('explicit sequence 4', solve([[[[0]], 1, 1, [-1], [[0]], [0], [0]]], 5), [[]])
    check('explicit sequence 5', solve([[[[0, 1], [0, 1]], 3, 3, [1, 0], [[0], [1]], [0], [0, 1]]], 5), [[[0, [0, 1]], [1, [0]]]])
    check('explicit sequence 6', solve([[[[0]], 1, 1, [0], [[]], [], [0]]], 5), [[[0, [0]]]])
    check('explicit sequence 7', solve([[[[0], [1], [2]], 4, 4, [], [[0], [1], [2]], [0, 1, 2], [0, 1, 2]]], 5), [[[2, [2]]]])
    check('explicit sequence 8', solve([[[[0, 99]], 1, 1, [0], [[0, 99]], [0], [0, 99]]], 5), [[[0, [0]]]])
    check('explicit sequence 9', solve([[[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], 1, 1, [], [[]], [], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]], 5), [[[0, [0, 1, 2, 3, 4]]]])
if N == 3:
    check('explicit sequence 0', solve([[[[0], [1], [2]], 7, 7, [], [[0], [1], [2]], [0, 1, 2], [0, 1, 2]]], 6), [[[0, [0]], [1, [1]], [2, [2]]]])
    check('explicit sequence 1', solve([[[[0], [1]], 1, 2, [], [[0], [1]], [0, 1], [0, 1]]], 6), [[]])
    check('explicit sequence 2', solve([[[[0, 1], [1, 2]], 3, 3, [1, 0], [[0], [1]], [0, 1], [0, 1, 2]]], 6), [[[0, [1]], [1, []]]])
    check('explicit sequence 3', solve([[[[0]], 1, 1, [None], [[0]], [0], [0]]], 6), [[]])
    check('explicit sequence 4', solve([[[[0]], 1, 1, [-1], [[0]], [0], [0]]], 6), [[]])
    check('explicit sequence 5', solve([[[[0, 1], [0, 1]], 3, 3, [1, 0], [[0], [1]], [0], [0, 1]]], 6), [[[0, [0, 1]], [1, [0]]]])
    check('explicit sequence 6', solve([[[[0]], 1, 1, [0], [[]], [], [0]]], 6), [[[0, [0]]]])
    check('explicit sequence 7', solve([[[[0], [1], [2]], 4, 4, [], [[0], [1], [2]], [0, 1, 2], [0, 1, 2]]], 6), [[[2, [2]]]])
    check('explicit sequence 8', solve([[[[0, 99]], 1, 1, [0], [[0, 99]], [0], [0, 99]]], 6), [[[0, [0]]]])
    check('explicit sequence 9', solve([[[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], 1, 1, [], [[]], [], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]], 6), [[[0, [0, 1, 2, 3, 4, 5]]]])
if N == 4:
    check('explicit sequence 0', solve([[[[0], [1], [2]], 7, 7, [], [[0], [1], [2]], [0, 1, 2], [0, 1, 2]]], 7), [[[0, [0]], [1, [1]], [2, [2]]]])
    check('explicit sequence 1', solve([[[[0], [1]], 1, 2, [], [[0], [1]], [0, 1], [0, 1]]], 7), [[]])
    check('explicit sequence 2', solve([[[[0, 1], [1, 2]], 3, 3, [1, 0], [[0], [1]], [0, 1], [0, 1, 2]]], 7), [[[0, [1]], [1, []]]])
    check('explicit sequence 3', solve([[[[0]], 1, 1, [None], [[0]], [0], [0]]], 7), [[]])
    check('explicit sequence 4', solve([[[[0]], 1, 1, [-1], [[0]], [0], [0]]], 7), [[]])
    check('explicit sequence 5', solve([[[[0, 1], [0, 1]], 3, 3, [1, 0], [[0], [1]], [0], [0, 1]]], 7), [[[0, [0, 1]], [1, [0]]]])
    check('explicit sequence 6', solve([[[[0]], 1, 1, [0], [[]], [], [0]]], 7), [[[0, [0]]]])
    check('explicit sequence 7', solve([[[[0], [1], [2]], 4, 4, [], [[0], [1], [2]], [0, 1, 2], [0, 1, 2]]], 7), [[[2, [2]]]])
    check('explicit sequence 8', solve([[[[0, 99]], 1, 1, [0], [[0, 99]], [0], [0, 99]]], 7), [[[0, [0]]]])
    check('explicit sequence 9', solve([[[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], 1, 1, [], [[]], [], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]], 7), [[[0, [0, 1, 2, 3, 4, 5, 6]]]])
if N == 5:
    check('explicit sequence 0', solve([[[[0], [1], [2]], 7, 7, [], [[0], [1], [2]], [0, 1, 2], [0, 1, 2]]], 8), [[[0, [0]], [1, [1]], [2, [2]]]])
    check('explicit sequence 1', solve([[[[0], [1]], 1, 2, [], [[0], [1]], [0, 1], [0, 1]]], 8), [[]])
    check('explicit sequence 2', solve([[[[0, 1], [1, 2]], 3, 3, [1, 0], [[0], [1]], [0, 1], [0, 1, 2]]], 8), [[[0, [1]], [1, []]]])
    check('explicit sequence 3', solve([[[[0]], 1, 1, [None], [[0]], [0], [0]]], 8), [[]])
    check('explicit sequence 4', solve([[[[0]], 1, 1, [-1], [[0]], [0], [0]]], 8), [[]])
    check('explicit sequence 5', solve([[[[0, 1], [0, 1]], 3, 3, [1, 0], [[0], [1]], [0], [0, 1]]], 8), [[[0, [0, 1]], [1, [0]]]])
    check('explicit sequence 6', solve([[[[0]], 1, 1, [0], [[]], [], [0]]], 8), [[[0, [0]]]])
    check('explicit sequence 7', solve([[[[0], [1], [2]], 4, 4, [], [[0], [1], [2]], [0, 1, 2], [0, 1, 2]]], 8), [[[2, [2]]]])
    check('explicit sequence 8', solve([[[[0, 99]], 1, 1, [0], [[0, 99]], [0], [0, 99]]], 8), [[[0, [0]]]])
    check('explicit sequence 9', solve([[[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], 1, 1, [], [[]], [], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]], 8), [[[0, [0, 1, 2, 3, 4, 5, 6, 7]]]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(commands, size):
    full=set(range(size))
    out=[]
    for viewclips,active,primitive,routes,scissors,scissor_enabled,samples in commands:
        rendered=[]
        for view in range(len(viewclips)):
            bit=1 if view==0 else view
            if not (active & bit and primitive & bit): continue
            viewport=routes[view] if view<len(routes) else view
            if viewport is None: continue
            if viewport<0 or viewport>=len(scissors): continue
            viewport_clip=set(scissors[viewport]) if viewport in scissor_enabled else full
            visible=set(samples)&set(viewclips[view])&viewport_clip&full
            rendered.append([view,sorted(visible)])
        out.append(rendered)
    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([[[[0], [1], [2]], 7, 7, [], [[0], [1], [2]], [0, 1, 2], [0, 1, 2]]], 4), [[[0, [0]], [1, [1]], [2, [2]]]])
    check('explicit sequence 1', solve([[[[0], [1]], 1, 2, [], [[0], [1]], [0, 1], [0, 1]]], 4), [[]])
    check('explicit sequence 2', solve([[[[0, 1], [1, 2]], 3, 3, [1, 0], [[0], [1]], [0, 1], [0, 1, 2]]], 4), [[[0, [1]], [1, []]]])
    check('explicit sequence 3', solve([[[[0]], 1, 1, [None], [[0]], [0], [0]]], 4), [[]])
    check('explicit sequence 4', solve([[[[0]], 1, 1, [-1], [[0]], [0], [0]]], 4), [[]])
    check('explicit sequence 5', solve([[[[0, 1], [0, 1]], 3, 3, [1, 0], [[0], [1]], [0], [0, 1]]], 4), [[[0, [0, 1]], [1, [0]]]])
    check('explicit sequence 6', solve([[[[0]], 1, 1, [0], [[]], [], [0]]], 4), [[[0, [0]]]])
    check('explicit sequence 7', solve([[[[0], [1], [2]], 4, 4, [], [[0], [1], [2]], [0, 1, 2], [0, 1, 2]]], 4), [[[2, [2]]]])
    check('explicit sequence 8', solve([[[[0, 99]], 1, 1, [0], [[0, 99]], [0], [0, 99]]], 4), [[[0, [0]]]])
    check('explicit sequence 9', solve([[[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], 1, 1, [], [[]], [], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]], 4), [[[0, [0, 1, 2, 3]]]])
if N == 2:
    check('explicit sequence 0', solve([[[[0], [1], [2]], 7, 7, [], [[0], [1], [2]], [0, 1, 2], [0, 1, 2]]], 5), [[[0, [0]], [1, [1]], [2, [2]]]])
    check('explicit sequence 1', solve([[[[0], [1]], 1, 2, [], [[0], [1]], [0, 1], [0, 1]]], 5), [[]])
    check('explicit sequence 2', solve([[[[0, 1], [1, 2]], 3, 3, [1, 0], [[0], [1]], [0, 1], [0, 1, 2]]], 5), [[[0, [1]], [1, []]]])
    check('explicit sequence 3', solve([[[[0]], 1, 1, [None], [[0]], [0], [0]]], 5), [[]])
    check('explicit sequence 4', solve([[[[0]], 1, 1, [-1], [[0]], [0], [0]]], 5), [[]])
    check('explicit sequence 5', solve([[[[0, 1], [0, 1]], 3, 3, [1, 0], [[0], [1]], [0], [0, 1]]], 5), [[[0, [0, 1]], [1, [0]]]])
    check('explicit sequence 6', solve([[[[0]], 1, 1, [0], [[]], [], [0]]], 5), [[[0, [0]]]])
    check('explicit sequence 7', solve([[[[0], [1], [2]], 4, 4, [], [[0], [1], [2]], [0, 1, 2], [0, 1, 2]]], 5), [[[2, [2]]]])
    check('explicit sequence 8', solve([[[[0, 99]], 1, 1, [0], [[0, 99]], [0], [0, 99]]], 5), [[[0, [0]]]])
    check('explicit sequence 9', solve([[[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], 1, 1, [], [[]], [], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]], 5), [[[0, [0, 1, 2, 3, 4]]]])
if N == 3:
    check('explicit sequence 0', solve([[[[0], [1], [2]], 7, 7, [], [[0], [1], [2]], [0, 1, 2], [0, 1, 2]]], 6), [[[0, [0]], [1, [1]], [2, [2]]]])
    check('explicit sequence 1', solve([[[[0], [1]], 1, 2, [], [[0], [1]], [0, 1], [0, 1]]], 6), [[]])
    check('explicit sequence 2', solve([[[[0, 1], [1, 2]], 3, 3, [1, 0], [[0], [1]], [0, 1], [0, 1, 2]]], 6), [[[0, [1]], [1, []]]])
    check('explicit sequence 3', solve([[[[0]], 1, 1, [None], [[0]], [0], [0]]], 6), [[]])
    check('explicit sequence 4', solve([[[[0]], 1, 1, [-1], [[0]], [0], [0]]], 6), [[]])
    check('explicit sequence 5', solve([[[[0, 1], [0, 1]], 3, 3, [1, 0], [[0], [1]], [0], [0, 1]]], 6), [[[0, [0, 1]], [1, [0]]]])
    check('explicit sequence 6', solve([[[[0]], 1, 1, [0], [[]], [], [0]]], 6), [[[0, [0]]]])
    check('explicit sequence 7', solve([[[[0], [1], [2]], 4, 4, [], [[0], [1], [2]], [0, 1, 2], [0, 1, 2]]], 6), [[[2, [2]]]])
    check('explicit sequence 8', solve([[[[0, 99]], 1, 1, [0], [[0, 99]], [0], [0, 99]]], 6), [[[0, [0]]]])
    check('explicit sequence 9', solve([[[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], 1, 1, [], [[]], [], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]], 6), [[[0, [0, 1, 2, 3, 4, 5]]]])
if N == 4:
    check('explicit sequence 0', solve([[[[0], [1], [2]], 7, 7, [], [[0], [1], [2]], [0, 1, 2], [0, 1, 2]]], 7), [[[0, [0]], [1, [1]], [2, [2]]]])
    check('explicit sequence 1', solve([[[[0], [1]], 1, 2, [], [[0], [1]], [0, 1], [0, 1]]], 7), [[]])
    check('explicit sequence 2', solve([[[[0, 1], [1, 2]], 3, 3, [1, 0], [[0], [1]], [0, 1], [0, 1, 2]]], 7), [[[0, [1]], [1, []]]])
    check('explicit sequence 3', solve([[[[0]], 1, 1, [None], [[0]], [0], [0]]], 7), [[]])
    check('explicit sequence 4', solve([[[[0]], 1, 1, [-1], [[0]], [0], [0]]], 7), [[]])
    check('explicit sequence 5', solve([[[[0, 1], [0, 1]], 3, 3, [1, 0], [[0], [1]], [0], [0, 1]]], 7), [[[0, [0, 1]], [1, [0]]]])
    check('explicit sequence 6', solve([[[[0]], 1, 1, [0], [[]], [], [0]]], 7), [[[0, [0]]]])
    check('explicit sequence 7', solve([[[[0], [1], [2]], 4, 4, [], [[0], [1], [2]], [0, 1, 2], [0, 1, 2]]], 7), [[[2, [2]]]])
    check('explicit sequence 8', solve([[[[0, 99]], 1, 1, [0], [[0, 99]], [0], [0, 99]]], 7), [[[0, [0]]]])
    check('explicit sequence 9', solve([[[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], 1, 1, [], [[]], [], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]], 7), [[[0, [0, 1, 2, 3, 4, 5, 6]]]])
if N == 5:
    check('explicit sequence 0', solve([[[[0], [1], [2]], 7, 7, [], [[0], [1], [2]], [0, 1, 2], [0, 1, 2]]], 8), [[[0, [0]], [1, [1]], [2, [2]]]])
    check('explicit sequence 1', solve([[[[0], [1]], 1, 2, [], [[0], [1]], [0, 1], [0, 1]]], 8), [[]])
    check('explicit sequence 2', solve([[[[0, 1], [1, 2]], 3, 3, [1, 0], [[0], [1]], [0, 1], [0, 1, 2]]], 8), [[[0, [1]], [1, []]]])
    check('explicit sequence 3', solve([[[[0]], 1, 1, [None], [[0]], [0], [0]]], 8), [[]])
    check('explicit sequence 4', solve([[[[0]], 1, 1, [-1], [[0]], [0], [0]]], 8), [[]])
    check('explicit sequence 5', solve([[[[0, 1], [0, 1]], 3, 3, [1, 0], [[0], [1]], [0], [0, 1]]], 8), [[[0, [0, 1]], [1, [0]]]])
    check('explicit sequence 6', solve([[[[0]], 1, 1, [0], [[]], [], [0]]], 8), [[[0, [0]]]])
    check('explicit sequence 7', solve([[[[0], [1], [2]], 4, 4, [], [[0], [1], [2]], [0, 1, 2], [0, 1, 2]]], 8), [[[2, [2]]]])
    check('explicit sequence 8', solve([[[[0, 99]], 1, 1, [0], [[0, 99]], [0], [0, 99]]], 8), [[[0, [0]]]])
    check('explicit sequence 9', solve([[[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], 1, 1, [], [[]], [], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]], 8), [[[0, [0, 1, 2, 3, 4, 5, 6, 7]]]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A view index is used directly as its activation bit.

A draw provides per-view clip sets, active-view bits, primitive view bits, optional viewport routing, enabled viewport clips, and primitive sample coverage. A view renders only if both masks include it. Route entries select the viewport clip while preserving output view identity. A null viewport route suppresses that view; absent route defaults to matching view index. Disabled viewport scissor passes full extent.

split: open-access