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+=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] if cursor==0 else 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+=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:
An absolute stream seek is decoded as a relative skip.

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=max(0,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+=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+=max(0,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+=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 negative skip is clamped before the following run can be clipped correctly.

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 if mode else 0
            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()
        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 if mode or length==1 else 1
            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:
Uncovered runs fail to advance the clip 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=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()
        elif op=='run':
            length=abs(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:
An invalid negative run silently rewinds the cursor instead of consuming zero samples.

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 mode: 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()
        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 and mode: 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:
Repeat uses the current mode instead of the mode captured with the repeated run.

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]-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()
        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(1,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:
Repeat count includes the original run despite the additional-run contract.

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