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=1<<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 set()
            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<<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 set(scissors[viewport])
            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 viewport with scissor disabled becomes completely clipped.

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


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=1<<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([viewport,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)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

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

N = 1
observations = []
def solve(commands, size):
    full=set(range(size))
    out=[]
    for viewclips,active,primitive,routes,scissors,scissor_enabled,samples in commands:
        rendered=[]
        for view in range(len(viewclips)):
            bit=1<<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([len(rendered),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:
Results are labeled by viewport ID instead of the view that rendered them.

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


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=1<<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
            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<<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&{x for x in set(samples) if x>=0}
            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:
Two clip masks agreeing on an exterior sample let it escape the finite target.

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


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

N = 1
observations = []
def solve(commands, size):
    pattern=[]
    offset=0
    phase=0
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op=='pattern':
            pattern=list(cmd[1])
            if False: pattern=pattern*2
            phase=offset
        elif op=='offset': offset=cmd[1]
        elif op=='move': phase=offset
        elif op=='advance': phase+=cmd[1]
        elif op=='draw':
            length,visible=cmd[1],set(cmd[2])
            covered=[]
            for i in range(length):
                on=True
                if pattern:
                    position=(phase+i)%sum(pattern)
                    dash=0
                    while position>=pattern[dash]:
                        position-=pattern[dash]
                        dash+=1
                    on=dash%2==0
                if on and i in visible and 0<=i<size: covered.append(i)
            phase+=length
            out.append(covered)
    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([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 4), [[0, 2]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 4), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 4), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 4), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 4), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 4), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 4), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 4), [[0, 1, 2, 3], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 4), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 4), [[]])
if N == 2:
    check('explicit sequence 0', solve([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 5), [[0, 2, 4]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 5), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 5), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 5), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 5), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 5), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 5), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 5), [[0, 1, 2, 3, 4], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 5), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 5), [[]])
if N == 3:
    check('explicit sequence 0', solve([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 6), [[0, 2, 4]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 6), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 6), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 6), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 6), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 6), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 6), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 6), [[0, 1, 2, 3, 4, 5], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 6), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 6), [[]])
if N == 4:
    check('explicit sequence 0', solve([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 7), [[0, 2, 4]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 7), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 7), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 7), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 7), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 7), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 7), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 7), [[0, 1, 2, 3, 4, 5, 6], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 7), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 7), [[]])
if N == 5:
    check('explicit sequence 0', solve([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 8), [[0, 2, 4]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 8), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 8), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 8), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 8), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 8), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 8), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 8), [[0, 1, 2, 3, 4, 5, 6, 7], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 8), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 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):
    pattern=[]
    offset=0
    phase=0
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op=='pattern':
            pattern=list(cmd[1])
            if len(pattern)==1: pattern=pattern*2
            phase=offset
        elif op=='offset': offset=cmd[1]
        elif op=='move': phase=offset
        elif op=='advance': phase+=cmd[1]
        elif op=='draw':
            length,visible=cmd[1],set(cmd[2])
            covered=[]
            for i in range(length):
                on=True
                if pattern:
                    position=(phase+i)%sum(pattern)
                    dash=0
                    while position>=pattern[dash]:
                        position-=pattern[dash]
                        dash+=1
                    on=dash%2==0
                if on and i in visible and 0<=i<size: covered.append(i)
            phase+=length
            out.append(covered)
    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([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 4), [[0, 2]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 4), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 4), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 4), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 4), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 4), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 4), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 4), [[0, 1, 2, 3], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 4), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 4), [[]])
if N == 2:
    check('explicit sequence 0', solve([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 5), [[0, 2, 4]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 5), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 5), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 5), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 5), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 5), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 5), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 5), [[0, 1, 2, 3, 4], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 5), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 5), [[]])
if N == 3:
    check('explicit sequence 0', solve([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 6), [[0, 2, 4]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 6), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 6), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 6), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 6), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 6), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 6), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 6), [[0, 1, 2, 3, 4, 5], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 6), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 6), [[]])
if N == 4:
    check('explicit sequence 0', solve([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 7), [[0, 2, 4]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 7), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 7), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 7), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 7), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 7), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 7), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 7), [[0, 1, 2, 3, 4, 5, 6], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 7), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 7), [[]])
if N == 5:
    check('explicit sequence 0', solve([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 8), [[0, 2, 4]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 8), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 8), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 8), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 8), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 8), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 8), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 8), [[0, 1, 2, 3, 4, 5, 6, 7], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 8), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 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:
Odd dash arrays restart with the same on/off parity after each undoubled cycle.

A logical stroke has positive integer dash lengths; an odd-length dash array is duplicated to preserve on/off parity over cycles. Each draw advances path phase through all samples, including clipped samples. Move begins a new subpath at the configured offset. Changing offset affects the next move, while changing pattern resets phase immediately. Empty pattern means solid. Draw reports visible on-sample positions within that segment.

split: open-access


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

N = 1
observations = []
def solve(commands, size):
    pattern=[]
    offset=0
    phase=0
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op=='pattern':
            pattern=list(cmd[1])
            if len(pattern)%2: pattern=pattern*2
            phase=0
        elif op=='offset': offset=cmd[1]
        elif op=='move': phase=offset
        elif op=='advance': phase+=cmd[1]
        elif op=='draw':
            length,visible=cmd[1],set(cmd[2])
            covered=[]
            for i in range(length):
                on=True
                if pattern:
                    position=(phase+i)%sum(pattern)
                    dash=0
                    while position>=pattern[dash]:
                        position-=pattern[dash]
                        dash+=1
                    on=dash%2==0
                if on and i in visible and 0<=i<size: covered.append(i)
            phase+=length
            out.append(covered)
    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([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 4), [[0, 2]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 4), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 4), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 4), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 4), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 4), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 4), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 4), [[0, 1, 2, 3], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 4), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 4), [[]])
if N == 2:
    check('explicit sequence 0', solve([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 5), [[0, 2, 4]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 5), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 5), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 5), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 5), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 5), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 5), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 5), [[0, 1, 2, 3, 4], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 5), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 5), [[]])
if N == 3:
    check('explicit sequence 0', solve([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 6), [[0, 2, 4]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 6), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 6), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 6), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 6), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 6), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 6), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 6), [[0, 1, 2, 3, 4, 5], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 6), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 6), [[]])
if N == 4:
    check('explicit sequence 0', solve([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 7), [[0, 2, 4]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 7), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 7), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 7), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 7), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 7), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 7), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 7), [[0, 1, 2, 3, 4, 5, 6], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 7), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 7), [[]])
if N == 5:
    check('explicit sequence 0', solve([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 8), [[0, 2, 4]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 8), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 8), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 8), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 8), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 8), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 8), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 8), [[0, 1, 2, 3, 4, 5, 6, 7], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 8), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 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):
    pattern=[]
    offset=0
    phase=0
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op=='pattern':
            pattern=list(cmd[1])
            if len(pattern)%2: pattern=pattern*2
            phase=max(0,offset)
        elif op=='offset': offset=cmd[1]
        elif op=='move': phase=offset
        elif op=='advance': phase+=cmd[1]
        elif op=='draw':
            length,visible=cmd[1],set(cmd[2])
            covered=[]
            for i in range(length):
                on=True
                if pattern:
                    position=(phase+i)%sum(pattern)
                    dash=0
                    while position>=pattern[dash]:
                        position-=pattern[dash]
                        dash+=1
                    on=dash%2==0
                if on and i in visible and 0<=i<size: covered.append(i)
            phase+=length
            out.append(covered)
    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([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 4), [[0, 2]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 4), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 4), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 4), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 4), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 4), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 4), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 4), [[0, 1, 2, 3], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 4), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 4), [[]])
if N == 2:
    check('explicit sequence 0', solve([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 5), [[0, 2, 4]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 5), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 5), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 5), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 5), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 5), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 5), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 5), [[0, 1, 2, 3, 4], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 5), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 5), [[]])
if N == 3:
    check('explicit sequence 0', solve([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 6), [[0, 2, 4]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 6), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 6), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 6), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 6), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 6), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 6), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 6), [[0, 1, 2, 3, 4, 5], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 6), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 6), [[]])
if N == 4:
    check('explicit sequence 0', solve([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 7), [[0, 2, 4]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 7), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 7), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 7), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 7), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 7), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 7), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 7), [[0, 1, 2, 3, 4, 5, 6], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 7), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 7), [[]])
if N == 5:
    check('explicit sequence 0', solve([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 8), [[0, 2, 4]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 8), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 8), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 8), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 8), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 8), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 8), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 8), [[0, 1, 2, 3, 4, 5, 6, 7], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 8), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 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:
Changing the pattern resets phase to zero rather than the configured offset.

A logical stroke has positive integer dash lengths; an odd-length dash array is duplicated to preserve on/off parity over cycles. Each draw advances path phase through all samples, including clipped samples. Move begins a new subpath at the configured offset. Changing offset affects the next move, while changing pattern resets phase immediately. Empty pattern means solid. Draw reports visible on-sample positions within that segment.

split: open-access


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

N = 1
observations = []
def solve(commands, size):
    pattern=[]
    offset=0
    phase=0
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op=='pattern':
            pattern=list(cmd[1])
            if len(pattern)%2: pattern=pattern*2
            phase=offset
        elif op=='offset': offset=cmd[1]; phase=offset
        elif op=='move': phase=offset
        elif op=='advance': phase+=cmd[1]
        elif op=='draw':
            length,visible=cmd[1],set(cmd[2])
            covered=[]
            for i in range(length):
                on=True
                if pattern:
                    position=(phase+i)%sum(pattern)
                    dash=0
                    while position>=pattern[dash]:
                        position-=pattern[dash]
                        dash+=1
                    on=dash%2==0
                if on and i in visible and 0<=i<size: covered.append(i)
            phase+=length
            out.append(covered)
    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([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 4), [[0, 2]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 4), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 4), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 4), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 4), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 4), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 4), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 4), [[0, 1, 2, 3], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 4), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 4), [[]])
if N == 2:
    check('explicit sequence 0', solve([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 5), [[0, 2, 4]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 5), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 5), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 5), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 5), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 5), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 5), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 5), [[0, 1, 2, 3, 4], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 5), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 5), [[]])
if N == 3:
    check('explicit sequence 0', solve([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 6), [[0, 2, 4]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 6), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 6), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 6), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 6), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 6), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 6), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 6), [[0, 1, 2, 3, 4, 5], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 6), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 6), [[]])
if N == 4:
    check('explicit sequence 0', solve([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 7), [[0, 2, 4]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 7), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 7), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 7), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 7), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 7), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 7), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 7), [[0, 1, 2, 3, 4, 5, 6], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 7), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 7), [[]])
if N == 5:
    check('explicit sequence 0', solve([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 8), [[0, 2, 4]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 8), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 8), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 8), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 8), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 8), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 8), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 8), [[0, 1, 2, 3, 4, 5, 6, 7], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 8), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 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):
    pattern=[]
    offset=0
    phase=0
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op=='pattern':
            pattern=list(cmd[1])
            if len(pattern)%2: pattern=pattern*2
            phase=offset
        elif op=='offset': offset=cmd[1]; phase+=offset
        elif op=='move': phase=offset
        elif op=='advance': phase+=cmd[1]
        elif op=='draw':
            length,visible=cmd[1],set(cmd[2])
            covered=[]
            for i in range(length):
                on=True
                if pattern:
                    position=(phase+i)%sum(pattern)
                    dash=0
                    while position>=pattern[dash]:
                        position-=pattern[dash]
                        dash+=1
                    on=dash%2==0
                if on and i in visible and 0<=i<size: covered.append(i)
            phase+=length
            out.append(covered)
    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([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 4), [[0, 2]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 4), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 4), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 4), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 4), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 4), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 4), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 4), [[0, 1, 2, 3], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 4), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 4), [[]])
if N == 2:
    check('explicit sequence 0', solve([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 5), [[0, 2, 4]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 5), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 5), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 5), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 5), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 5), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 5), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 5), [[0, 1, 2, 3, 4], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 5), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 5), [[]])
if N == 3:
    check('explicit sequence 0', solve([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 6), [[0, 2, 4]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 6), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 6), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 6), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 6), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 6), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 6), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 6), [[0, 1, 2, 3, 4, 5], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 6), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 6), [[]])
if N == 4:
    check('explicit sequence 0', solve([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 7), [[0, 2, 4]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 7), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 7), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 7), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 7), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 7), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 7), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 7), [[0, 1, 2, 3, 4, 5, 6], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 7), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 7), [[]])
if N == 5:
    check('explicit sequence 0', solve([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 8), [[0, 2, 4]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 8), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 8), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 8), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 8), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 8), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 8), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 8), [[0, 1, 2, 3, 4, 5, 6, 7], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 8), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 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:
Setting the next subpath offset shifts the current in-progress stroke.

A logical stroke has positive integer dash lengths; an odd-length dash array is duplicated to preserve on/off parity over cycles. Each draw advances path phase through all samples, including clipped samples. Move begins a new subpath at the configured offset. Changing offset affects the next move, while changing pattern resets phase immediately. Empty pattern means solid. Draw reports visible on-sample positions within that segment.

split: open-access