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

N = 1
observations = []
def solve(commands, size):
    covered=set()
    cursor=0
    mode=True
    previous=None
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op=='seek': cursor=cmd[1]
        elif op=='move': cursor+=cmd[1]
        elif op=='mode': mode=cmd[1]
        elif op=='row': previous=None
        elif op=='clear': covered.clear()
        elif op=='run':
            length=max(0,cmd[1])
            if mode: covered.update(i for i in range(cursor,cursor+length) if 0<=i<size)
            cursor+=length
            previous=(length,mode)
        elif op=='repeat' and previous is not None:
            length,saved=previous
            for _ in range(max(0,cmd[1])):
                if saved: covered.update(i for i in range(cursor,cursor+length) if 0<=i<size)
                cursor+=length
        elif op=='draw': out.append(sorted(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([['run', 2], ['seek', 1], ['run', 1], ['draw']], 4), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 4), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 4), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 4), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 4), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 4), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 4), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 4), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 4), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 4), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 4), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 4), [[2, 3]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 4), [[0, 1, 2, 3]])
if N == 2:
    check('explicit sequence 0', solve([['run', 2], ['seek', 1], ['run', 1], ['draw']], 5), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 5), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 5), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 5), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 5), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 5), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 5), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 5), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 5), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 5), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 5), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 5), [[2, 3, 4]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 5), [[0, 1, 2, 3]])
if N == 3:
    check('explicit sequence 0', solve([['run', 2], ['seek', 1], ['run', 1], ['draw']], 6), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 6), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 6), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 6), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 6), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 6), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 6), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 6), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 6), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 6), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 6), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 6), [[2, 3, 4, 5]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 6), [[0, 1, 2, 3]])
if N == 4:
    check('explicit sequence 0', solve([['run', 2], ['seek', 1], ['run', 1], ['draw']], 7), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 7), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 7), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 7), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 7), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 7), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 7), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 7), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 7), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 7), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 7), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 7), [[2, 3, 4, 5]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 7), [[0, 1, 2, 3]])
if N == 5:
    check('explicit sequence 0', solve([['run', 2], ['seek', 1], ['run', 1], ['draw']], 8), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 8), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 8), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 8), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 8), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 8), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 8), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 8), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 8), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 8), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 8), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 8), [[2, 3, 4, 5]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 8), [[0, 1, 2, 3]])
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):
    covered=set()
    cursor=0
    mode=True
    previous=None
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op=='seek': cursor=cmd[1]
        elif op=='move': cursor+=cmd[1]
        elif op=='mode': mode=cmd[1]
        elif op=='row': cursor=min(cursor,size); previous=None
        elif op=='clear': covered.clear()
        elif op=='run':
            length=max(0,cmd[1])
            if mode: covered.update(i for i in range(cursor,cursor+length) if 0<=i<size)
            cursor+=length
            previous=(length,mode)
        elif op=='repeat' and previous is not None:
            length,saved=previous
            for _ in range(max(0,cmd[1])):
                if saved: covered.update(i for i in range(cursor,cursor+length) if 0<=i<size)
                cursor+=length
        elif op=='draw': out.append(sorted(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([['run', 2], ['seek', 1], ['run', 1], ['draw']], 4), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 4), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 4), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 4), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 4), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 4), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 4), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 4), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 4), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 4), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 4), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 4), [[2, 3]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 4), [[0, 1, 2, 3]])
if N == 2:
    check('explicit sequence 0', solve([['run', 2], ['seek', 1], ['run', 1], ['draw']], 5), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 5), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 5), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 5), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 5), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 5), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 5), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 5), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 5), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 5), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 5), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 5), [[2, 3, 4]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 5), [[0, 1, 2, 3]])
if N == 3:
    check('explicit sequence 0', solve([['run', 2], ['seek', 1], ['run', 1], ['draw']], 6), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 6), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 6), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 6), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 6), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 6), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 6), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 6), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 6), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 6), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 6), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 6), [[2, 3, 4, 5]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 6), [[0, 1, 2, 3]])
if N == 4:
    check('explicit sequence 0', solve([['run', 2], ['seek', 1], ['run', 1], ['draw']], 7), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 7), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 7), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 7), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 7), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 7), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 7), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 7), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 7), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 7), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 7), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 7), [[2, 3, 4, 5]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 7), [[0, 1, 2, 3]])
if N == 5:
    check('explicit sequence 0', solve([['run', 2], ['seek', 1], ['run', 1], ['draw']], 8), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 8), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 8), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 8), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 8), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 8), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 8), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 8), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 8), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 8), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 8), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 8), [[2, 3, 4, 5]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 8), [[0, 1, 2, 3]])
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:
Beginning a new scanline retains the previous row cursor.

A scanline clip stream carries signed cursor moves, covered and uncovered runs, an explicit covered/uncovered mode and row reset. Only covered samples in the finite target are emitted. Repeat reruns the previous run with its original mode. Draw observes unique sorted coverage; clear removes coverage without resetting cursor or mode.

split: open-access


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

N = 1
observations = []
def solve(commands, size):
    covered=set()
    cursor=0
    mode=True
    previous=None
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op=='seek': cursor=cmd[1]
        elif op=='move': cursor+=cmd[1]
        elif op=='mode': mode=cmd[1]
        elif op=='row': cursor=0
        elif op=='clear': covered.clear()
        elif op=='run':
            length=max(0,cmd[1])
            if mode: covered.update(i for i in range(cursor,cursor+length) if 0<=i<size)
            cursor+=length
            previous=(length,mode)
        elif op=='repeat' and previous is not None:
            length,saved=previous
            for _ in range(max(0,cmd[1])):
                if saved: covered.update(i for i in range(cursor,cursor+length) if 0<=i<size)
                cursor+=length
        elif op=='draw': out.append(sorted(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([['run', 2], ['seek', 1], ['run', 1], ['draw']], 4), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 4), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 4), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 4), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 4), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 4), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 4), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 4), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 4), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 4), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 4), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 4), [[2, 3]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 4), [[0, 1, 2, 3]])
if N == 2:
    check('explicit sequence 0', solve([['run', 2], ['seek', 1], ['run', 1], ['draw']], 5), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 5), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 5), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 5), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 5), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 5), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 5), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 5), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 5), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 5), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 5), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 5), [[2, 3, 4]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 5), [[0, 1, 2, 3]])
if N == 3:
    check('explicit sequence 0', solve([['run', 2], ['seek', 1], ['run', 1], ['draw']], 6), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 6), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 6), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 6), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 6), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 6), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 6), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 6), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 6), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 6), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 6), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 6), [[2, 3, 4, 5]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 6), [[0, 1, 2, 3]])
if N == 4:
    check('explicit sequence 0', solve([['run', 2], ['seek', 1], ['run', 1], ['draw']], 7), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 7), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 7), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 7), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 7), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 7), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 7), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 7), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 7), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 7), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 7), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 7), [[2, 3, 4, 5]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 7), [[0, 1, 2, 3]])
if N == 5:
    check('explicit sequence 0', solve([['run', 2], ['seek', 1], ['run', 1], ['draw']], 8), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 8), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 8), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 8), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 8), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 8), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 8), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 8), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 8), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 8), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 8), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 8), [[2, 3, 4, 5]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 8), [[0, 1, 2, 3]])
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):
    covered=set()
    cursor=0
    mode=True
    previous=None
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op=='seek': cursor=cmd[1]
        elif op=='move': cursor+=cmd[1]
        elif op=='mode': mode=cmd[1]
        elif op=='row': cursor=0; previous=(previous[0],True) if previous else None
        elif op=='clear': covered.clear()
        elif op=='run':
            length=max(0,cmd[1])
            if mode: covered.update(i for i in range(cursor,cursor+length) if 0<=i<size)
            cursor+=length
            previous=(length,mode)
        elif op=='repeat' and previous is not None:
            length,saved=previous
            for _ in range(max(0,cmd[1])):
                if saved: covered.update(i for i in range(cursor,cursor+length) if 0<=i<size)
                cursor+=length
        elif op=='draw': out.append(sorted(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([['run', 2], ['seek', 1], ['run', 1], ['draw']], 4), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 4), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 4), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 4), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 4), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 4), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 4), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 4), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 4), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 4), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 4), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 4), [[2, 3]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 4), [[0, 1, 2, 3]])
if N == 2:
    check('explicit sequence 0', solve([['run', 2], ['seek', 1], ['run', 1], ['draw']], 5), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 5), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 5), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 5), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 5), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 5), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 5), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 5), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 5), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 5), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 5), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 5), [[2, 3, 4]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 5), [[0, 1, 2, 3]])
if N == 3:
    check('explicit sequence 0', solve([['run', 2], ['seek', 1], ['run', 1], ['draw']], 6), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 6), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 6), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 6), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 6), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 6), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 6), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 6), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 6), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 6), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 6), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 6), [[2, 3, 4, 5]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 6), [[0, 1, 2, 3]])
if N == 4:
    check('explicit sequence 0', solve([['run', 2], ['seek', 1], ['run', 1], ['draw']], 7), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 7), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 7), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 7), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 7), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 7), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 7), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 7), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 7), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 7), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 7), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 7), [[2, 3, 4, 5]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 7), [[0, 1, 2, 3]])
if N == 5:
    check('explicit sequence 0', solve([['run', 2], ['seek', 1], ['run', 1], ['draw']], 8), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 8), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 8), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 8), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 8), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 8), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 8), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 8), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 8), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 8), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 8), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 8), [[2, 3, 4, 5]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 8), [[0, 1, 2, 3]])
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 repeat at the start of a row replays a run belonging to the previous row.

A scanline clip stream carries signed cursor moves, covered and uncovered runs, an explicit covered/uncovered mode and row reset. Only covered samples in the finite target are emitted. Repeat reruns the previous run with its original mode. Draw observes unique sorted coverage; clear removes coverage without resetting cursor or mode.

split: open-access


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

N = 1
observations = []
def solve(commands, size):
    covered=set()
    cursor=0
    mode=True
    previous=None
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op=='seek': cursor=cmd[1]
        elif op=='move': cursor+=cmd[1]
        elif op=='mode': mode=cmd[1]
        elif op=='row': cursor=0; previous=None
        elif op=='clear': covered.clear(); cursor=0
        elif op=='run':
            length=max(0,cmd[1])
            if mode: covered.update(i for i in range(cursor,cursor+length) if 0<=i<size)
            cursor+=length
            previous=(length,mode)
        elif op=='repeat' and previous is not None:
            length,saved=previous
            for _ in range(max(0,cmd[1])):
                if saved: covered.update(i for i in range(cursor,cursor+length) if 0<=i<size)
                cursor+=length
        elif op=='draw': out.append(sorted(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([['run', 2], ['seek', 1], ['run', 1], ['draw']], 4), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 4), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 4), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 4), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 4), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 4), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 4), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 4), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 4), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 4), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 4), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 4), [[2, 3]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 4), [[0, 1, 2, 3]])
if N == 2:
    check('explicit sequence 0', solve([['run', 2], ['seek', 1], ['run', 1], ['draw']], 5), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 5), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 5), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 5), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 5), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 5), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 5), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 5), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 5), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 5), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 5), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 5), [[2, 3, 4]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 5), [[0, 1, 2, 3]])
if N == 3:
    check('explicit sequence 0', solve([['run', 2], ['seek', 1], ['run', 1], ['draw']], 6), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 6), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 6), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 6), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 6), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 6), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 6), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 6), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 6), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 6), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 6), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 6), [[2, 3, 4, 5]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 6), [[0, 1, 2, 3]])
if N == 4:
    check('explicit sequence 0', solve([['run', 2], ['seek', 1], ['run', 1], ['draw']], 7), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 7), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 7), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 7), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 7), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 7), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 7), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 7), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 7), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 7), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 7), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 7), [[2, 3, 4, 5]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 7), [[0, 1, 2, 3]])
if N == 5:
    check('explicit sequence 0', solve([['run', 2], ['seek', 1], ['run', 1], ['draw']], 8), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 8), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 8), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 8), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 8), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 8), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 8), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 8), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 8), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 8), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 8), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 8), [[2, 3, 4, 5]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 8), [[0, 1, 2, 3]])
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):
    covered=set()
    cursor=0
    mode=True
    previous=None
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op=='seek': cursor=cmd[1]
        elif op=='move': cursor+=cmd[1]
        elif op=='mode': mode=cmd[1]
        elif op=='row': cursor=0; previous=None
        elif op=='clear': covered.clear(); cursor=min(cursor,1)
        elif op=='run':
            length=max(0,cmd[1])
            if mode: covered.update(i for i in range(cursor,cursor+length) if 0<=i<size)
            cursor+=length
            previous=(length,mode)
        elif op=='repeat' and previous is not None:
            length,saved=previous
            for _ in range(max(0,cmd[1])):
                if saved: covered.update(i for i in range(cursor,cursor+length) if 0<=i<size)
                cursor+=length
        elif op=='draw': out.append(sorted(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([['run', 2], ['seek', 1], ['run', 1], ['draw']], 4), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 4), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 4), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 4), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 4), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 4), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 4), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 4), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 4), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 4), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 4), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 4), [[2, 3]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 4), [[0, 1, 2, 3]])
if N == 2:
    check('explicit sequence 0', solve([['run', 2], ['seek', 1], ['run', 1], ['draw']], 5), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 5), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 5), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 5), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 5), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 5), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 5), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 5), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 5), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 5), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 5), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 5), [[2, 3, 4]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 5), [[0, 1, 2, 3]])
if N == 3:
    check('explicit sequence 0', solve([['run', 2], ['seek', 1], ['run', 1], ['draw']], 6), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 6), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 6), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 6), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 6), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 6), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 6), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 6), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 6), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 6), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 6), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 6), [[2, 3, 4, 5]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 6), [[0, 1, 2, 3]])
if N == 4:
    check('explicit sequence 0', solve([['run', 2], ['seek', 1], ['run', 1], ['draw']], 7), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 7), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 7), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 7), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 7), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 7), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 7), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 7), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 7), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 7), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 7), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 7), [[2, 3, 4, 5]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 7), [[0, 1, 2, 3]])
if N == 5:
    check('explicit sequence 0', solve([['run', 2], ['seek', 1], ['run', 1], ['draw']], 8), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 8), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 8), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 8), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 8), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 8), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 8), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 8), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 8), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 8), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 8), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 8), [[2, 3, 4, 5]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 8), [[0, 1, 2, 3]])
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:
Clearing the coverage accumulator unexpectedly rewinds the stream cursor.

A scanline clip stream carries signed cursor moves, covered and uncovered runs, an explicit covered/uncovered mode and row reset. Only covered samples in the finite target are emitted. Repeat reruns the previous run with its original mode. Draw observes unique sorted coverage; clear removes coverage without resetting cursor or mode.

split: open-access


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

N = 1
observations = []
def solve(commands, size):
    covered=set()
    cursor=0
    mode=True
    previous=None
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op=='seek': cursor=cmd[1]
        elif op=='move': cursor+=cmd[1]
        elif op=='mode': mode=cmd[1]
        elif op=='row': cursor=0; previous=None
        elif op=='clear': covered.clear()
        elif op=='run':
            length=max(0,cmd[1])
            if mode: covered.update(i for i in range(cursor,cursor+length) if 0<=i<size)
            cursor+=length
            previous=(length,mode)
        elif op=='repeat' and previous is not None:
            length,saved=previous
            for _ in range(max(0,cmd[1])):
                if saved: covered.update(i for i in range(cursor,cursor+length) if 0<=i<size)
                cursor+=0
        elif op=='draw': out.append(sorted(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([['run', 2], ['seek', 1], ['run', 1], ['draw']], 4), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 4), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 4), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 4), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 4), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 4), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 4), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 4), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 4), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 4), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 4), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 4), [[2, 3]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 4), [[0, 1, 2, 3]])
if N == 2:
    check('explicit sequence 0', solve([['run', 2], ['seek', 1], ['run', 1], ['draw']], 5), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 5), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 5), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 5), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 5), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 5), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 5), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 5), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 5), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 5), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 5), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 5), [[2, 3, 4]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 5), [[0, 1, 2, 3]])
if N == 3:
    check('explicit sequence 0', solve([['run', 2], ['seek', 1], ['run', 1], ['draw']], 6), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 6), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 6), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 6), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 6), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 6), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 6), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 6), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 6), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 6), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 6), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 6), [[2, 3, 4, 5]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 6), [[0, 1, 2, 3]])
if N == 4:
    check('explicit sequence 0', solve([['run', 2], ['seek', 1], ['run', 1], ['draw']], 7), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 7), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 7), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 7), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 7), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 7), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 7), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 7), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 7), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 7), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 7), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 7), [[2, 3, 4, 5]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 7), [[0, 1, 2, 3]])
if N == 5:
    check('explicit sequence 0', solve([['run', 2], ['seek', 1], ['run', 1], ['draw']], 8), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 8), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 8), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 8), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 8), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 8), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 8), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 8), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 8), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 8), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 8), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 8), [[2, 3, 4, 5]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 8), [[0, 1, 2, 3]])
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):
    covered=set()
    cursor=0
    mode=True
    previous=None
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op=='seek': cursor=cmd[1]
        elif op=='move': cursor+=cmd[1]
        elif op=='mode': mode=cmd[1]
        elif op=='row': cursor=0; previous=None
        elif op=='clear': covered.clear()
        elif op=='run':
            length=max(0,cmd[1])
            if mode: covered.update(i for i in range(cursor,cursor+length) if 0<=i<size)
            cursor+=length
            previous=(length,mode)
        elif op=='repeat' and previous is not None:
            length,saved=previous
            for _ in range(max(0,cmd[1])):
                if saved: covered.update(i for i in range(cursor,cursor+length) if 0<=i<size)
                cursor+=1
        elif op=='draw': out.append(sorted(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([['run', 2], ['seek', 1], ['run', 1], ['draw']], 4), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 4), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 4), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 4), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 4), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 4), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 4), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 4), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 4), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 4), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 4), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 4), [[2, 3]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 4), [[0, 1, 2, 3]])
if N == 2:
    check('explicit sequence 0', solve([['run', 2], ['seek', 1], ['run', 1], ['draw']], 5), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 5), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 5), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 5), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 5), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 5), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 5), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 5), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 5), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 5), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 5), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 5), [[2, 3, 4]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 5), [[0, 1, 2, 3]])
if N == 3:
    check('explicit sequence 0', solve([['run', 2], ['seek', 1], ['run', 1], ['draw']], 6), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 6), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 6), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 6), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 6), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 6), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 6), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 6), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 6), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 6), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 6), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 6), [[2, 3, 4, 5]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 6), [[0, 1, 2, 3]])
if N == 4:
    check('explicit sequence 0', solve([['run', 2], ['seek', 1], ['run', 1], ['draw']], 7), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 7), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 7), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 7), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 7), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 7), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 7), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 7), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 7), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 7), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 7), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 7), [[2, 3, 4, 5]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 7), [[0, 1, 2, 3]])
if N == 5:
    check('explicit sequence 0', solve([['run', 2], ['seek', 1], ['run', 1], ['draw']], 8), [[0, 1]])
    check('explicit sequence 1', solve([['move', -2], ['run', 3], ['draw']], 8), [[0]])
    check('explicit sequence 2', solve([['mode', False], ['run', 2], ['mode', True], ['run', 1], ['draw']], 8), [[2]])
    check('explicit sequence 3', solve([['run', 2], ['run', -1], ['run', 1], ['draw']], 8), [[0, 1, 2]])
    check('explicit sequence 4', solve([['run', 1], ['mode', False], ['repeat', 2], ['draw']], 8), [[0, 1, 2]])
    check('explicit sequence 5', solve([['run', 2], ['row'], ['run', 1], ['draw']], 8), [[0, 1]])
    check('explicit sequence 6', solve([['run', 1], ['clear'], ['row'], ['repeat', 1], ['draw']], 8), [[]])
    check('explicit sequence 7', solve([['run', 2], ['clear'], ['run', 1], ['draw']], 8), [[2]])
    check('explicit sequence 8', solve([['seek', 99], ['run', 2], ['draw']], 8), [[]])
    check('explicit sequence 9', solve([['run', 1], ['repeat', 2], ['draw']], 8), [[0, 1, 2]])
    check('explicit sequence 10', solve([['run', 1], ['repeat', 0], ['draw']], 8), [[0]])
    check('explicit sequence 11', solve([['run', 2], ['clear'], ['repeat', 2], ['draw']], 8), [[2, 3, 4, 5]])
    check('explicit sequence 12', solve([['run', 2], ['clear'], ['seek', 0], ['repeat', 2], ['draw']], 8), [[0, 1, 2, 3]])
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:
Repeated runs all cover the same sample range because the repeat cursor never advances.

A scanline clip stream carries signed cursor moves, covered and uncovered runs, an explicit covered/uncovered mode and row reset. Only covered samples in the finite target are emitted. Repeat reruns the previous run with its original mode. Draw observes unique sorted coverage; clear removes coverage without resetting cursor or mode.

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))
    stack=[]
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op=='push': stack.append(set(cmd[1]))
        elif op=='dup': stack.append(set(stack[-1]))
        elif op=='swap': stack[-2],stack[-1]=stack[-1],stack[-2]
        elif op=='not': stack[-1]=full-stack[-1]
        elif op=='clear': stack[-1].clear()
        elif op=='draw': out.append(sorted(stack[-1]))
        else:
            right=stack.pop()
            left=stack.pop()
            if op=='and': result=left & right
            elif op=='or': result=left | right
            elif op=='xor': result=left ^ right
            elif op=='subtract': result=left-right
            elif op=='implies': result=(full-left)|right
            else: result=full-(left^right)
            stack.append(result)
    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([['push', [0, 99]], ['draw']], 4), [[0]])
    check('explicit sequence 1', solve([['push', [0, 1]], ['dup'], ['clear'], ['swap'], ['draw']], 4), [[0, 1]])
    check('explicit sequence 2', solve([['push', [0, 1]], ['push', [1, 2]], ['swap'], ['subtract'], ['draw']], 4), [[2]])
    check('explicit sequence 3', solve([['push', [0]], ['not'], ['draw']], 4), [[1, 2, 3]])
    check('explicit sequence 4', solve([['push', [0, 1]], ['push', [1, 2]], ['and'], ['draw']], 4), [[1]])
    check('explicit sequence 5', solve([['push', [0, 1]], ['push', [1, 2]], ['or'], ['draw']], 4), [[0, 1, 2]])
    check('explicit sequence 6', solve([['push', [0, 1]], ['push', [1, 2]], ['xor'], ['draw']], 4), [[0, 2]])
    check('explicit sequence 7', solve([['push', [0, 1]], ['push', [1, 2]], ['subtract'], ['draw']], 4), [[0]])
    check('explicit sequence 8', solve([['push', [0]], ['push', [1]], ['implies'], ['draw']], 4), [[1, 2, 3]])
    check('explicit sequence 9', solve([['push', [0]], ['push', [1]], ['equal'], ['draw']], 4), [[2, 3]])
    check('explicit sequence 10', solve([['push', [0, 1]], ['push', [1, 2]], ['equal'], ['draw']], 4), [[1, 3]])
if N == 2:
    check('explicit sequence 0', solve([['push', [0, 99]], ['draw']], 5), [[0]])
    check('explicit sequence 1', solve([['push', [0, 1]], ['dup'], ['clear'], ['swap'], ['draw']], 5), [[0, 1]])
    check('explicit sequence 2', solve([['push', [0, 1]], ['push', [1, 2]], ['swap'], ['subtract'], ['draw']], 5), [[2]])
    check('explicit sequence 3', solve([['push', [0]], ['not'], ['draw']], 5), [[1, 2, 3, 4]])
    check('explicit sequence 4', solve([['push', [0, 1]], ['push', [1, 2]], ['and'], ['draw']], 5), [[1]])
    check('explicit sequence 5', solve([['push', [0, 1]], ['push', [1, 2]], ['or'], ['draw']], 5), [[0, 1, 2]])
    check('explicit sequence 6', solve([['push', [0, 1]], ['push', [1, 2]], ['xor'], ['draw']], 5), [[0, 2]])
    check('explicit sequence 7', solve([['push', [0, 1]], ['push', [1, 2]], ['subtract'], ['draw']], 5), [[0]])
    check('explicit sequence 8', solve([['push', [0]], ['push', [1]], ['implies'], ['draw']], 5), [[1, 2, 3, 4]])
    check('explicit sequence 9', solve([['push', [0]], ['push', [1]], ['equal'], ['draw']], 5), [[2, 3, 4]])
    check('explicit sequence 10', solve([['push', [0, 1]], ['push', [1, 2]], ['equal'], ['draw']], 5), [[1, 3, 4]])
if N == 3:
    check('explicit sequence 0', solve([['push', [0, 99]], ['draw']], 6), [[0]])
    check('explicit sequence 1', solve([['push', [0, 1]], ['dup'], ['clear'], ['swap'], ['draw']], 6), [[0, 1]])
    check('explicit sequence 2', solve([['push', [0, 1]], ['push', [1, 2]], ['swap'], ['subtract'], ['draw']], 6), [[2]])
    check('explicit sequence 3', solve([['push', [0]], ['not'], ['draw']], 6), [[1, 2, 3, 4, 5]])
    check('explicit sequence 4', solve([['push', [0, 1]], ['push', [1, 2]], ['and'], ['draw']], 6), [[1]])
    check('explicit sequence 5', solve([['push', [0, 1]], ['push', [1, 2]], ['or'], ['draw']], 6), [[0, 1, 2]])
    check('explicit sequence 6', solve([['push', [0, 1]], ['push', [1, 2]], ['xor'], ['draw']], 6), [[0, 2]])
    check('explicit sequence 7', solve([['push', [0, 1]], ['push', [1, 2]], ['subtract'], ['draw']], 6), [[0]])
    check('explicit sequence 8', solve([['push', [0]], ['push', [1]], ['implies'], ['draw']], 6), [[1, 2, 3, 4, 5]])
    check('explicit sequence 9', solve([['push', [0]], ['push', [1]], ['equal'], ['draw']], 6), [[2, 3, 4, 5]])
    check('explicit sequence 10', solve([['push', [0, 1]], ['push', [1, 2]], ['equal'], ['draw']], 6), [[1, 3, 4, 5]])
if N == 4:
    check('explicit sequence 0', solve([['push', [0, 99]], ['draw']], 7), [[0]])
    check('explicit sequence 1', solve([['push', [0, 1]], ['dup'], ['clear'], ['swap'], ['draw']], 7), [[0, 1]])
    check('explicit sequence 2', solve([['push', [0, 1]], ['push', [1, 2]], ['swap'], ['subtract'], ['draw']], 7), [[2]])
    check('explicit sequence 3', solve([['push', [0]], ['not'], ['draw']], 7), [[1, 2, 3, 4, 5, 6]])
    check('explicit sequence 4', solve([['push', [0, 1]], ['push', [1, 2]], ['and'], ['draw']], 7), [[1]])
    check('explicit sequence 5', solve([['push', [0, 1]], ['push', [1, 2]], ['or'], ['draw']], 7), [[0, 1, 2]])
    check('explicit sequence 6', solve([['push', [0, 1]], ['push', [1, 2]], ['xor'], ['draw']], 7), [[0, 2]])
    check('explicit sequence 7', solve([['push', [0, 1]], ['push', [1, 2]], ['subtract'], ['draw']], 7), [[0]])
    check('explicit sequence 8', solve([['push', [0]], ['push', [1]], ['implies'], ['draw']], 7), [[1, 2, 3, 4, 5, 6]])
    check('explicit sequence 9', solve([['push', [0]], ['push', [1]], ['equal'], ['draw']], 7), [[2, 3, 4, 5, 6]])
    check('explicit sequence 10', solve([['push', [0, 1]], ['push', [1, 2]], ['equal'], ['draw']], 7), [[1, 3, 4, 5, 6]])
if N == 5:
    check('explicit sequence 0', solve([['push', [0, 99]], ['draw']], 8), [[0]])
    check('explicit sequence 1', solve([['push', [0, 1]], ['dup'], ['clear'], ['swap'], ['draw']], 8), [[0, 1]])
    check('explicit sequence 2', solve([['push', [0, 1]], ['push', [1, 2]], ['swap'], ['subtract'], ['draw']], 8), [[2]])
    check('explicit sequence 3', solve([['push', [0]], ['not'], ['draw']], 8), [[1, 2, 3, 4, 5, 6, 7]])
    check('explicit sequence 4', solve([['push', [0, 1]], ['push', [1, 2]], ['and'], ['draw']], 8), [[1]])
    check('explicit sequence 5', solve([['push', [0, 1]], ['push', [1, 2]], ['or'], ['draw']], 8), [[0, 1, 2]])
    check('explicit sequence 6', solve([['push', [0, 1]], ['push', [1, 2]], ['xor'], ['draw']], 8), [[0, 2]])
    check('explicit sequence 7', solve([['push', [0, 1]], ['push', [1, 2]], ['subtract'], ['draw']], 8), [[0]])
    check('explicit sequence 8', solve([['push', [0]], ['push', [1]], ['implies'], ['draw']], 8), [[1, 2, 3, 4, 5, 6, 7]])
    check('explicit sequence 9', solve([['push', [0]], ['push', [1]], ['equal'], ['draw']], 8), [[2, 3, 4, 5, 6, 7]])
    check('explicit sequence 10', solve([['push', [0, 1]], ['push', [1, 2]], ['equal'], ['draw']], 8), [[1, 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))
    stack=[]
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op=='push': stack.append({x for x in cmd[1] if x>=0})
        elif op=='dup': stack.append(set(stack[-1]))
        elif op=='swap': stack[-2],stack[-1]=stack[-1],stack[-2]
        elif op=='not': stack[-1]=full-stack[-1]
        elif op=='clear': stack[-1].clear()
        elif op=='draw': out.append(sorted(stack[-1]))
        else:
            right=stack.pop()
            left=stack.pop()
            if op=='and': result=left & right
            elif op=='or': result=left | right
            elif op=='xor': result=left ^ right
            elif op=='subtract': result=left-right
            elif op=='implies': result=(full-left)|right
            else: result=full-(left^right)
            stack.append(result)
    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([['push', [0, 99]], ['draw']], 4), [[0]])
    check('explicit sequence 1', solve([['push', [0, 1]], ['dup'], ['clear'], ['swap'], ['draw']], 4), [[0, 1]])
    check('explicit sequence 2', solve([['push', [0, 1]], ['push', [1, 2]], ['swap'], ['subtract'], ['draw']], 4), [[2]])
    check('explicit sequence 3', solve([['push', [0]], ['not'], ['draw']], 4), [[1, 2, 3]])
    check('explicit sequence 4', solve([['push', [0, 1]], ['push', [1, 2]], ['and'], ['draw']], 4), [[1]])
    check('explicit sequence 5', solve([['push', [0, 1]], ['push', [1, 2]], ['or'], ['draw']], 4), [[0, 1, 2]])
    check('explicit sequence 6', solve([['push', [0, 1]], ['push', [1, 2]], ['xor'], ['draw']], 4), [[0, 2]])
    check('explicit sequence 7', solve([['push', [0, 1]], ['push', [1, 2]], ['subtract'], ['draw']], 4), [[0]])
    check('explicit sequence 8', solve([['push', [0]], ['push', [1]], ['implies'], ['draw']], 4), [[1, 2, 3]])
    check('explicit sequence 9', solve([['push', [0]], ['push', [1]], ['equal'], ['draw']], 4), [[2, 3]])
    check('explicit sequence 10', solve([['push', [0, 1]], ['push', [1, 2]], ['equal'], ['draw']], 4), [[1, 3]])
if N == 2:
    check('explicit sequence 0', solve([['push', [0, 99]], ['draw']], 5), [[0]])
    check('explicit sequence 1', solve([['push', [0, 1]], ['dup'], ['clear'], ['swap'], ['draw']], 5), [[0, 1]])
    check('explicit sequence 2', solve([['push', [0, 1]], ['push', [1, 2]], ['swap'], ['subtract'], ['draw']], 5), [[2]])
    check('explicit sequence 3', solve([['push', [0]], ['not'], ['draw']], 5), [[1, 2, 3, 4]])
    check('explicit sequence 4', solve([['push', [0, 1]], ['push', [1, 2]], ['and'], ['draw']], 5), [[1]])
    check('explicit sequence 5', solve([['push', [0, 1]], ['push', [1, 2]], ['or'], ['draw']], 5), [[0, 1, 2]])
    check('explicit sequence 6', solve([['push', [0, 1]], ['push', [1, 2]], ['xor'], ['draw']], 5), [[0, 2]])
    check('explicit sequence 7', solve([['push', [0, 1]], ['push', [1, 2]], ['subtract'], ['draw']], 5), [[0]])
    check('explicit sequence 8', solve([['push', [0]], ['push', [1]], ['implies'], ['draw']], 5), [[1, 2, 3, 4]])
    check('explicit sequence 9', solve([['push', [0]], ['push', [1]], ['equal'], ['draw']], 5), [[2, 3, 4]])
    check('explicit sequence 10', solve([['push', [0, 1]], ['push', [1, 2]], ['equal'], ['draw']], 5), [[1, 3, 4]])
if N == 3:
    check('explicit sequence 0', solve([['push', [0, 99]], ['draw']], 6), [[0]])
    check('explicit sequence 1', solve([['push', [0, 1]], ['dup'], ['clear'], ['swap'], ['draw']], 6), [[0, 1]])
    check('explicit sequence 2', solve([['push', [0, 1]], ['push', [1, 2]], ['swap'], ['subtract'], ['draw']], 6), [[2]])
    check('explicit sequence 3', solve([['push', [0]], ['not'], ['draw']], 6), [[1, 2, 3, 4, 5]])
    check('explicit sequence 4', solve([['push', [0, 1]], ['push', [1, 2]], ['and'], ['draw']], 6), [[1]])
    check('explicit sequence 5', solve([['push', [0, 1]], ['push', [1, 2]], ['or'], ['draw']], 6), [[0, 1, 2]])
    check('explicit sequence 6', solve([['push', [0, 1]], ['push', [1, 2]], ['xor'], ['draw']], 6), [[0, 2]])
    check('explicit sequence 7', solve([['push', [0, 1]], ['push', [1, 2]], ['subtract'], ['draw']], 6), [[0]])
    check('explicit sequence 8', solve([['push', [0]], ['push', [1]], ['implies'], ['draw']], 6), [[1, 2, 3, 4, 5]])
    check('explicit sequence 9', solve([['push', [0]], ['push', [1]], ['equal'], ['draw']], 6), [[2, 3, 4, 5]])
    check('explicit sequence 10', solve([['push', [0, 1]], ['push', [1, 2]], ['equal'], ['draw']], 6), [[1, 3, 4, 5]])
if N == 4:
    check('explicit sequence 0', solve([['push', [0, 99]], ['draw']], 7), [[0]])
    check('explicit sequence 1', solve([['push', [0, 1]], ['dup'], ['clear'], ['swap'], ['draw']], 7), [[0, 1]])
    check('explicit sequence 2', solve([['push', [0, 1]], ['push', [1, 2]], ['swap'], ['subtract'], ['draw']], 7), [[2]])
    check('explicit sequence 3', solve([['push', [0]], ['not'], ['draw']], 7), [[1, 2, 3, 4, 5, 6]])
    check('explicit sequence 4', solve([['push', [0, 1]], ['push', [1, 2]], ['and'], ['draw']], 7), [[1]])
    check('explicit sequence 5', solve([['push', [0, 1]], ['push', [1, 2]], ['or'], ['draw']], 7), [[0, 1, 2]])
    check('explicit sequence 6', solve([['push', [0, 1]], ['push', [1, 2]], ['xor'], ['draw']], 7), [[0, 2]])
    check('explicit sequence 7', solve([['push', [0, 1]], ['push', [1, 2]], ['subtract'], ['draw']], 7), [[0]])
    check('explicit sequence 8', solve([['push', [0]], ['push', [1]], ['implies'], ['draw']], 7), [[1, 2, 3, 4, 5, 6]])
    check('explicit sequence 9', solve([['push', [0]], ['push', [1]], ['equal'], ['draw']], 7), [[2, 3, 4, 5, 6]])
    check('explicit sequence 10', solve([['push', [0, 1]], ['push', [1, 2]], ['equal'], ['draw']], 7), [[1, 3, 4, 5, 6]])
if N == 5:
    check('explicit sequence 0', solve([['push', [0, 99]], ['draw']], 8), [[0]])
    check('explicit sequence 1', solve([['push', [0, 1]], ['dup'], ['clear'], ['swap'], ['draw']], 8), [[0, 1]])
    check('explicit sequence 2', solve([['push', [0, 1]], ['push', [1, 2]], ['swap'], ['subtract'], ['draw']], 8), [[2]])
    check('explicit sequence 3', solve([['push', [0]], ['not'], ['draw']], 8), [[1, 2, 3, 4, 5, 6, 7]])
    check('explicit sequence 4', solve([['push', [0, 1]], ['push', [1, 2]], ['and'], ['draw']], 8), [[1]])
    check('explicit sequence 5', solve([['push', [0, 1]], ['push', [1, 2]], ['or'], ['draw']], 8), [[0, 1, 2]])
    check('explicit sequence 6', solve([['push', [0, 1]], ['push', [1, 2]], ['xor'], ['draw']], 8), [[0, 2]])
    check('explicit sequence 7', solve([['push', [0, 1]], ['push', [1, 2]], ['subtract'], ['draw']], 8), [[0]])
    check('explicit sequence 8', solve([['push', [0]], ['push', [1]], ['implies'], ['draw']], 8), [[1, 2, 3, 4, 5, 6, 7]])
    check('explicit sequence 9', solve([['push', [0]], ['push', [1]], ['equal'], ['draw']], 8), [[2, 3, 4, 5, 6, 7]])
    check('explicit sequence 10', solve([['push', [0, 1]], ['push', [1, 2]], ['equal'], ['draw']], 8), [[1, 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 pushed region escapes the finite raster universe.

A postfix region program evaluates finite sample sets. Binary operands preserve left/right order. Complement uses the target universe. Named masks are copied on push; duplicate copies the top value. Subtraction, intersection, union and XOR consume both operands. Draw peeks without consuming. Empty-stack operations are outside this bounded contract.

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))
    stack=[]
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op=='push': stack.append(set(cmd[1]) & full)
        elif op=='dup': stack.append(stack[-1])
        elif op=='swap': stack[-2],stack[-1]=stack[-1],stack[-2]
        elif op=='not': stack[-1]=full-stack[-1]
        elif op=='clear': stack[-1].clear()
        elif op=='draw': out.append(sorted(stack[-1]))
        else:
            right=stack.pop()
            left=stack.pop()
            if op=='and': result=left & right
            elif op=='or': result=left | right
            elif op=='xor': result=left ^ right
            elif op=='subtract': result=left-right
            elif op=='implies': result=(full-left)|right
            else: result=full-(left^right)
            stack.append(result)
    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([['push', [0, 99]], ['draw']], 4), [[0]])
    check('explicit sequence 1', solve([['push', [0, 1]], ['dup'], ['clear'], ['swap'], ['draw']], 4), [[0, 1]])
    check('explicit sequence 2', solve([['push', [0, 1]], ['push', [1, 2]], ['swap'], ['subtract'], ['draw']], 4), [[2]])
    check('explicit sequence 3', solve([['push', [0]], ['not'], ['draw']], 4), [[1, 2, 3]])
    check('explicit sequence 4', solve([['push', [0, 1]], ['push', [1, 2]], ['and'], ['draw']], 4), [[1]])
    check('explicit sequence 5', solve([['push', [0, 1]], ['push', [1, 2]], ['or'], ['draw']], 4), [[0, 1, 2]])
    check('explicit sequence 6', solve([['push', [0, 1]], ['push', [1, 2]], ['xor'], ['draw']], 4), [[0, 2]])
    check('explicit sequence 7', solve([['push', [0, 1]], ['push', [1, 2]], ['subtract'], ['draw']], 4), [[0]])
    check('explicit sequence 8', solve([['push', [0]], ['push', [1]], ['implies'], ['draw']], 4), [[1, 2, 3]])
    check('explicit sequence 9', solve([['push', [0]], ['push', [1]], ['equal'], ['draw']], 4), [[2, 3]])
    check('explicit sequence 10', solve([['push', [0, 1]], ['push', [1, 2]], ['equal'], ['draw']], 4), [[1, 3]])
if N == 2:
    check('explicit sequence 0', solve([['push', [0, 99]], ['draw']], 5), [[0]])
    check('explicit sequence 1', solve([['push', [0, 1]], ['dup'], ['clear'], ['swap'], ['draw']], 5), [[0, 1]])
    check('explicit sequence 2', solve([['push', [0, 1]], ['push', [1, 2]], ['swap'], ['subtract'], ['draw']], 5), [[2]])
    check('explicit sequence 3', solve([['push', [0]], ['not'], ['draw']], 5), [[1, 2, 3, 4]])
    check('explicit sequence 4', solve([['push', [0, 1]], ['push', [1, 2]], ['and'], ['draw']], 5), [[1]])
    check('explicit sequence 5', solve([['push', [0, 1]], ['push', [1, 2]], ['or'], ['draw']], 5), [[0, 1, 2]])
    check('explicit sequence 6', solve([['push', [0, 1]], ['push', [1, 2]], ['xor'], ['draw']], 5), [[0, 2]])
    check('explicit sequence 7', solve([['push', [0, 1]], ['push', [1, 2]], ['subtract'], ['draw']], 5), [[0]])
    check('explicit sequence 8', solve([['push', [0]], ['push', [1]], ['implies'], ['draw']], 5), [[1, 2, 3, 4]])
    check('explicit sequence 9', solve([['push', [0]], ['push', [1]], ['equal'], ['draw']], 5), [[2, 3, 4]])
    check('explicit sequence 10', solve([['push', [0, 1]], ['push', [1, 2]], ['equal'], ['draw']], 5), [[1, 3, 4]])
if N == 3:
    check('explicit sequence 0', solve([['push', [0, 99]], ['draw']], 6), [[0]])
    check('explicit sequence 1', solve([['push', [0, 1]], ['dup'], ['clear'], ['swap'], ['draw']], 6), [[0, 1]])
    check('explicit sequence 2', solve([['push', [0, 1]], ['push', [1, 2]], ['swap'], ['subtract'], ['draw']], 6), [[2]])
    check('explicit sequence 3', solve([['push', [0]], ['not'], ['draw']], 6), [[1, 2, 3, 4, 5]])
    check('explicit sequence 4', solve([['push', [0, 1]], ['push', [1, 2]], ['and'], ['draw']], 6), [[1]])
    check('explicit sequence 5', solve([['push', [0, 1]], ['push', [1, 2]], ['or'], ['draw']], 6), [[0, 1, 2]])
    check('explicit sequence 6', solve([['push', [0, 1]], ['push', [1, 2]], ['xor'], ['draw']], 6), [[0, 2]])
    check('explicit sequence 7', solve([['push', [0, 1]], ['push', [1, 2]], ['subtract'], ['draw']], 6), [[0]])
    check('explicit sequence 8', solve([['push', [0]], ['push', [1]], ['implies'], ['draw']], 6), [[1, 2, 3, 4, 5]])
    check('explicit sequence 9', solve([['push', [0]], ['push', [1]], ['equal'], ['draw']], 6), [[2, 3, 4, 5]])
    check('explicit sequence 10', solve([['push', [0, 1]], ['push', [1, 2]], ['equal'], ['draw']], 6), [[1, 3, 4, 5]])
if N == 4:
    check('explicit sequence 0', solve([['push', [0, 99]], ['draw']], 7), [[0]])
    check('explicit sequence 1', solve([['push', [0, 1]], ['dup'], ['clear'], ['swap'], ['draw']], 7), [[0, 1]])
    check('explicit sequence 2', solve([['push', [0, 1]], ['push', [1, 2]], ['swap'], ['subtract'], ['draw']], 7), [[2]])
    check('explicit sequence 3', solve([['push', [0]], ['not'], ['draw']], 7), [[1, 2, 3, 4, 5, 6]])
    check('explicit sequence 4', solve([['push', [0, 1]], ['push', [1, 2]], ['and'], ['draw']], 7), [[1]])
    check('explicit sequence 5', solve([['push', [0, 1]], ['push', [1, 2]], ['or'], ['draw']], 7), [[0, 1, 2]])
    check('explicit sequence 6', solve([['push', [0, 1]], ['push', [1, 2]], ['xor'], ['draw']], 7), [[0, 2]])
    check('explicit sequence 7', solve([['push', [0, 1]], ['push', [1, 2]], ['subtract'], ['draw']], 7), [[0]])
    check('explicit sequence 8', solve([['push', [0]], ['push', [1]], ['implies'], ['draw']], 7), [[1, 2, 3, 4, 5, 6]])
    check('explicit sequence 9', solve([['push', [0]], ['push', [1]], ['equal'], ['draw']], 7), [[2, 3, 4, 5, 6]])
    check('explicit sequence 10', solve([['push', [0, 1]], ['push', [1, 2]], ['equal'], ['draw']], 7), [[1, 3, 4, 5, 6]])
if N == 5:
    check('explicit sequence 0', solve([['push', [0, 99]], ['draw']], 8), [[0]])
    check('explicit sequence 1', solve([['push', [0, 1]], ['dup'], ['clear'], ['swap'], ['draw']], 8), [[0, 1]])
    check('explicit sequence 2', solve([['push', [0, 1]], ['push', [1, 2]], ['swap'], ['subtract'], ['draw']], 8), [[2]])
    check('explicit sequence 3', solve([['push', [0]], ['not'], ['draw']], 8), [[1, 2, 3, 4, 5, 6, 7]])
    check('explicit sequence 4', solve([['push', [0, 1]], ['push', [1, 2]], ['and'], ['draw']], 8), [[1]])
    check('explicit sequence 5', solve([['push', [0, 1]], ['push', [1, 2]], ['or'], ['draw']], 8), [[0, 1, 2]])
    check('explicit sequence 6', solve([['push', [0, 1]], ['push', [1, 2]], ['xor'], ['draw']], 8), [[0, 2]])
    check('explicit sequence 7', solve([['push', [0, 1]], ['push', [1, 2]], ['subtract'], ['draw']], 8), [[0]])
    check('explicit sequence 8', solve([['push', [0]], ['push', [1]], ['implies'], ['draw']], 8), [[1, 2, 3, 4, 5, 6, 7]])
    check('explicit sequence 9', solve([['push', [0]], ['push', [1]], ['equal'], ['draw']], 8), [[2, 3, 4, 5, 6, 7]])
    check('explicit sequence 10', solve([['push', [0, 1]], ['push', [1, 2]], ['equal'], ['draw']], 8), [[1, 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))
    stack=[]
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op=='push': stack.append(set(cmd[1]) & full)
        elif op=='dup': stack.append(stack[-1] if stack[-1] else set())
        elif op=='swap': stack[-2],stack[-1]=stack[-1],stack[-2]
        elif op=='not': stack[-1]=full-stack[-1]
        elif op=='clear': stack[-1].clear()
        elif op=='draw': out.append(sorted(stack[-1]))
        else:
            right=stack.pop()
            left=stack.pop()
            if op=='and': result=left & right
            elif op=='or': result=left | right
            elif op=='xor': result=left ^ right
            elif op=='subtract': result=left-right
            elif op=='implies': result=(full-left)|right
            else: result=full-(left^right)
            stack.append(result)
    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([['push', [0, 99]], ['draw']], 4), [[0]])
    check('explicit sequence 1', solve([['push', [0, 1]], ['dup'], ['clear'], ['swap'], ['draw']], 4), [[0, 1]])
    check('explicit sequence 2', solve([['push', [0, 1]], ['push', [1, 2]], ['swap'], ['subtract'], ['draw']], 4), [[2]])
    check('explicit sequence 3', solve([['push', [0]], ['not'], ['draw']], 4), [[1, 2, 3]])
    check('explicit sequence 4', solve([['push', [0, 1]], ['push', [1, 2]], ['and'], ['draw']], 4), [[1]])
    check('explicit sequence 5', solve([['push', [0, 1]], ['push', [1, 2]], ['or'], ['draw']], 4), [[0, 1, 2]])
    check('explicit sequence 6', solve([['push', [0, 1]], ['push', [1, 2]], ['xor'], ['draw']], 4), [[0, 2]])
    check('explicit sequence 7', solve([['push', [0, 1]], ['push', [1, 2]], ['subtract'], ['draw']], 4), [[0]])
    check('explicit sequence 8', solve([['push', [0]], ['push', [1]], ['implies'], ['draw']], 4), [[1, 2, 3]])
    check('explicit sequence 9', solve([['push', [0]], ['push', [1]], ['equal'], ['draw']], 4), [[2, 3]])
    check('explicit sequence 10', solve([['push', [0, 1]], ['push', [1, 2]], ['equal'], ['draw']], 4), [[1, 3]])
if N == 2:
    check('explicit sequence 0', solve([['push', [0, 99]], ['draw']], 5), [[0]])
    check('explicit sequence 1', solve([['push', [0, 1]], ['dup'], ['clear'], ['swap'], ['draw']], 5), [[0, 1]])
    check('explicit sequence 2', solve([['push', [0, 1]], ['push', [1, 2]], ['swap'], ['subtract'], ['draw']], 5), [[2]])
    check('explicit sequence 3', solve([['push', [0]], ['not'], ['draw']], 5), [[1, 2, 3, 4]])
    check('explicit sequence 4', solve([['push', [0, 1]], ['push', [1, 2]], ['and'], ['draw']], 5), [[1]])
    check('explicit sequence 5', solve([['push', [0, 1]], ['push', [1, 2]], ['or'], ['draw']], 5), [[0, 1, 2]])
    check('explicit sequence 6', solve([['push', [0, 1]], ['push', [1, 2]], ['xor'], ['draw']], 5), [[0, 2]])
    check('explicit sequence 7', solve([['push', [0, 1]], ['push', [1, 2]], ['subtract'], ['draw']], 5), [[0]])
    check('explicit sequence 8', solve([['push', [0]], ['push', [1]], ['implies'], ['draw']], 5), [[1, 2, 3, 4]])
    check('explicit sequence 9', solve([['push', [0]], ['push', [1]], ['equal'], ['draw']], 5), [[2, 3, 4]])
    check('explicit sequence 10', solve([['push', [0, 1]], ['push', [1, 2]], ['equal'], ['draw']], 5), [[1, 3, 4]])
if N == 3:
    check('explicit sequence 0', solve([['push', [0, 99]], ['draw']], 6), [[0]])
    check('explicit sequence 1', solve([['push', [0, 1]], ['dup'], ['clear'], ['swap'], ['draw']], 6), [[0, 1]])
    check('explicit sequence 2', solve([['push', [0, 1]], ['push', [1, 2]], ['swap'], ['subtract'], ['draw']], 6), [[2]])
    check('explicit sequence 3', solve([['push', [0]], ['not'], ['draw']], 6), [[1, 2, 3, 4, 5]])
    check('explicit sequence 4', solve([['push', [0, 1]], ['push', [1, 2]], ['and'], ['draw']], 6), [[1]])
    check('explicit sequence 5', solve([['push', [0, 1]], ['push', [1, 2]], ['or'], ['draw']], 6), [[0, 1, 2]])
    check('explicit sequence 6', solve([['push', [0, 1]], ['push', [1, 2]], ['xor'], ['draw']], 6), [[0, 2]])
    check('explicit sequence 7', solve([['push', [0, 1]], ['push', [1, 2]], ['subtract'], ['draw']], 6), [[0]])
    check('explicit sequence 8', solve([['push', [0]], ['push', [1]], ['implies'], ['draw']], 6), [[1, 2, 3, 4, 5]])
    check('explicit sequence 9', solve([['push', [0]], ['push', [1]], ['equal'], ['draw']], 6), [[2, 3, 4, 5]])
    check('explicit sequence 10', solve([['push', [0, 1]], ['push', [1, 2]], ['equal'], ['draw']], 6), [[1, 3, 4, 5]])
if N == 4:
    check('explicit sequence 0', solve([['push', [0, 99]], ['draw']], 7), [[0]])
    check('explicit sequence 1', solve([['push', [0, 1]], ['dup'], ['clear'], ['swap'], ['draw']], 7), [[0, 1]])
    check('explicit sequence 2', solve([['push', [0, 1]], ['push', [1, 2]], ['swap'], ['subtract'], ['draw']], 7), [[2]])
    check('explicit sequence 3', solve([['push', [0]], ['not'], ['draw']], 7), [[1, 2, 3, 4, 5, 6]])
    check('explicit sequence 4', solve([['push', [0, 1]], ['push', [1, 2]], ['and'], ['draw']], 7), [[1]])
    check('explicit sequence 5', solve([['push', [0, 1]], ['push', [1, 2]], ['or'], ['draw']], 7), [[0, 1, 2]])
    check('explicit sequence 6', solve([['push', [0, 1]], ['push', [1, 2]], ['xor'], ['draw']], 7), [[0, 2]])
    check('explicit sequence 7', solve([['push', [0, 1]], ['push', [1, 2]], ['subtract'], ['draw']], 7), [[0]])
    check('explicit sequence 8', solve([['push', [0]], ['push', [1]], ['implies'], ['draw']], 7), [[1, 2, 3, 4, 5, 6]])
    check('explicit sequence 9', solve([['push', [0]], ['push', [1]], ['equal'], ['draw']], 7), [[2, 3, 4, 5, 6]])
    check('explicit sequence 10', solve([['push', [0, 1]], ['push', [1, 2]], ['equal'], ['draw']], 7), [[1, 3, 4, 5, 6]])
if N == 5:
    check('explicit sequence 0', solve([['push', [0, 99]], ['draw']], 8), [[0]])
    check('explicit sequence 1', solve([['push', [0, 1]], ['dup'], ['clear'], ['swap'], ['draw']], 8), [[0, 1]])
    check('explicit sequence 2', solve([['push', [0, 1]], ['push', [1, 2]], ['swap'], ['subtract'], ['draw']], 8), [[2]])
    check('explicit sequence 3', solve([['push', [0]], ['not'], ['draw']], 8), [[1, 2, 3, 4, 5, 6, 7]])
    check('explicit sequence 4', solve([['push', [0, 1]], ['push', [1, 2]], ['and'], ['draw']], 8), [[1]])
    check('explicit sequence 5', solve([['push', [0, 1]], ['push', [1, 2]], ['or'], ['draw']], 8), [[0, 1, 2]])
    check('explicit sequence 6', solve([['push', [0, 1]], ['push', [1, 2]], ['xor'], ['draw']], 8), [[0, 2]])
    check('explicit sequence 7', solve([['push', [0, 1]], ['push', [1, 2]], ['subtract'], ['draw']], 8), [[0]])
    check('explicit sequence 8', solve([['push', [0]], ['push', [1]], ['implies'], ['draw']], 8), [[1, 2, 3, 4, 5, 6, 7]])
    check('explicit sequence 9', solve([['push', [0]], ['push', [1]], ['equal'], ['draw']], 8), [[2, 3, 4, 5, 6, 7]])
    check('explicit sequence 10', solve([['push', [0, 1]], ['push', [1, 2]], ['equal'], ['draw']], 8), [[1, 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:
Duplicating a mask aliases mutable stack entries.

A postfix region program evaluates finite sample sets. Binary operands preserve left/right order. Complement uses the target universe. Named masks are copied on push; duplicate copies the top value. Subtraction, intersection, union and XOR consume both operands. Draw peeks without consuming. Empty-stack operations are outside this bounded contract.

split: open-access