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

N = 1
observations = []
def solve(commands, size):
    full=set(range(size))
    masks={}
    active=None
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op=='define': masks[cmd[1]]=set(cmd[2]) & full
        elif op=='bind': active=cmd[1]
        elif op=='delete': masks.pop(active,None)
        elif op=='clone': masks[cmd[2]]=set(masks.get(cmd[1],set()))
        elif op=='subtract' and cmd[1] in masks: masks[cmd[1]]-=set(cmd[2])
        elif op=='rename' and cmd[1] in masks:
            masks[cmd[2]]=masks.pop(cmd[1])
            if active==cmd[1]: active=cmd[2]
        elif op=='reset': masks={}; active=None
        elif op=='draw': out.append(sorted(masks.get(active,set())))
    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([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 4), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 4), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 4), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 4), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 4), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 4), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 4), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 4), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 4), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 4), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 4), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 4), [[0, 1, 2, 3]])
if N == 2:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 5), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 5), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 5), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 5), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 5), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 5), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 5), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 5), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 5), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 5), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 5), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 5), [[0, 1, 2, 3, 4]])
if N == 3:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 6), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 6), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 6), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 6), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 6), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 6), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 6), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 6), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 6), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 6), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 6), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 6), [[0, 1, 2, 3, 4, 5]])
if N == 4:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 7), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 7), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 7), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 7), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 7), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 7), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 7), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 7), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 7), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 7), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 7), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 7), [[0, 1, 2, 3, 4, 5, 6]])
if N == 5:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 8), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 8), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 8), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 8), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 8), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 8), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 8), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 8), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 8), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 8), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 8), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 8), [[0, 1, 2, 3, 4, 5, 6, 7]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(commands, size):
    full=set(range(size))
    masks={}
    active=None
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op=='define': masks[cmd[1]]=set(cmd[2]) & full
        elif op=='bind': active=cmd[1]
        elif op=='delete': masks.pop(cmd[1],None) if cmd[1]==active else masks.pop(active,None)
        elif op=='clone': masks[cmd[2]]=set(masks.get(cmd[1],set()))
        elif op=='subtract' and cmd[1] in masks: masks[cmd[1]]-=set(cmd[2])
        elif op=='rename' and cmd[1] in masks:
            masks[cmd[2]]=masks.pop(cmd[1])
            if active==cmd[1]: active=cmd[2]
        elif op=='reset': masks={}; active=None
        elif op=='draw': out.append(sorted(masks.get(active,set())))
    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([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 4), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 4), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 4), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 4), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 4), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 4), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 4), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 4), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 4), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 4), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 4), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 4), [[0, 1, 2, 3]])
if N == 2:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 5), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 5), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 5), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 5), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 5), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 5), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 5), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 5), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 5), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 5), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 5), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 5), [[0, 1, 2, 3, 4]])
if N == 3:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 6), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 6), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 6), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 6), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 6), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 6), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 6), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 6), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 6), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 6), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 6), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 6), [[0, 1, 2, 3, 4, 5]])
if N == 4:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 7), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 7), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 7), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 7), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 7), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 7), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 7), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 7), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 7), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 7), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 7), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 7), [[0, 1, 2, 3, 4, 5, 6]])
if N == 5:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 8), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 8), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 8), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 8), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 8), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 8), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 8), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 8), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 8), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 8), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 8), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 8), [[0, 1, 2, 3, 4, 5, 6, 7]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Deleting an inactive mask destroys the mask currently used for clipping.

Named clip masks are immutable snapshots clipped to target extent. Bind selects a name, edits replace the named mask, deletion of the active mask makes drawing empty. Renaming preserves active binding; clone is independent; reset clears registry and active binding.

split: open-access


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

N = 1
observations = []
def solve(commands, size):
    full=set(range(size))
    masks={}
    active=None
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op=='define': masks[cmd[1]]=set(cmd[2]) & full
        elif op=='bind': active=cmd[1]
        elif op=='delete': masks.pop(cmd[1],None)
        elif op=='clone': masks[cmd[2]]=masks.get(cmd[1],set())
        elif op=='subtract' and cmd[1] in masks: masks[cmd[1]]-=set(cmd[2])
        elif op=='rename' and cmd[1] in masks:
            masks[cmd[2]]=masks.pop(cmd[1])
            if active==cmd[1]: active=cmd[2]
        elif op=='reset': masks={}; active=None
        elif op=='draw': out.append(sorted(masks.get(active,set())))
    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([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 4), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 4), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 4), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 4), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 4), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 4), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 4), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 4), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 4), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 4), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 4), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 4), [[0, 1, 2, 3]])
if N == 2:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 5), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 5), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 5), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 5), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 5), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 5), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 5), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 5), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 5), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 5), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 5), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 5), [[0, 1, 2, 3, 4]])
if N == 3:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 6), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 6), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 6), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 6), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 6), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 6), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 6), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 6), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 6), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 6), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 6), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 6), [[0, 1, 2, 3, 4, 5]])
if N == 4:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 7), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 7), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 7), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 7), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 7), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 7), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 7), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 7), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 7), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 7), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 7), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 7), [[0, 1, 2, 3, 4, 5, 6]])
if N == 5:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 8), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 8), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 8), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 8), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 8), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 8), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 8), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 8), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 8), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 8), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 8), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 8), [[0, 1, 2, 3, 4, 5, 6, 7]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

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

N = 1
observations = []
def solve(commands, size):
    full=set(range(size))
    masks={}
    active=None
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op=='define': masks[cmd[1]]=set(cmd[2]) & full
        elif op=='bind': active=cmd[1]
        elif op=='delete': masks.pop(cmd[1],None)
        elif op=='clone': masks[cmd[2]]=masks.get(cmd[1],set()) if masks.get(cmd[1]) else set()
        elif op=='subtract' and cmd[1] in masks: masks[cmd[1]]-=set(cmd[2])
        elif op=='rename' and cmd[1] in masks:
            masks[cmd[2]]=masks.pop(cmd[1])
            if active==cmd[1]: active=cmd[2]
        elif op=='reset': masks={}; active=None
        elif op=='draw': out.append(sorted(masks.get(active,set())))
    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([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 4), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 4), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 4), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 4), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 4), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 4), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 4), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 4), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 4), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 4), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 4), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 4), [[0, 1, 2, 3]])
if N == 2:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 5), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 5), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 5), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 5), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 5), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 5), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 5), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 5), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 5), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 5), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 5), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 5), [[0, 1, 2, 3, 4]])
if N == 3:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 6), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 6), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 6), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 6), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 6), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 6), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 6), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 6), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 6), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 6), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 6), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 6), [[0, 1, 2, 3, 4, 5]])
if N == 4:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 7), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 7), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 7), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 7), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 7), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 7), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 7), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 7), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 7), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 7), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 7), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 7), [[0, 1, 2, 3, 4, 5, 6]])
if N == 5:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 8), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 8), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 8), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 8), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 8), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 8), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 8), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 8), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 8), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 8), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 8), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 8), [[0, 1, 2, 3, 4, 5, 6, 7]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Clone aliases mutable coverage and changes when the original mask is edited.

Named clip masks are immutable snapshots clipped to target extent. Bind selects a name, edits replace the named mask, deletion of the active mask makes drawing empty. Renaming preserves active binding; clone is independent; reset clears registry and active binding.

split: open-access


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

N = 1
observations = []
def solve(commands, size):
    full=set(range(size))
    masks={}
    active=None
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op=='define': masks[cmd[1]]=set(cmd[2]) & full
        elif op=='bind': active=cmd[1]
        elif op=='delete': masks.pop(cmd[1],None)
        elif op=='clone': masks[cmd[2]]=set(masks.get(cmd[1],set()))
        elif op=='subtract' and cmd[1] in masks: masks[cmd[1]] &= set(cmd[2])
        elif op=='rename' and cmd[1] in masks:
            masks[cmd[2]]=masks.pop(cmd[1])
            if active==cmd[1]: active=cmd[2]
        elif op=='reset': masks={}; active=None
        elif op=='draw': out.append(sorted(masks.get(active,set())))
    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([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 4), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 4), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 4), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 4), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 4), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 4), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 4), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 4), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 4), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 4), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 4), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 4), [[0, 1, 2, 3]])
if N == 2:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 5), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 5), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 5), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 5), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 5), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 5), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 5), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 5), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 5), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 5), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 5), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 5), [[0, 1, 2, 3, 4]])
if N == 3:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 6), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 6), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 6), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 6), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 6), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 6), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 6), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 6), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 6), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 6), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 6), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 6), [[0, 1, 2, 3, 4, 5]])
if N == 4:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 7), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 7), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 7), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 7), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 7), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 7), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 7), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 7), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 7), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 7), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 7), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 7), [[0, 1, 2, 3, 4, 5, 6]])
if N == 5:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 8), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 8), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 8), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 8), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 8), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 8), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 8), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 8), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 8), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 8), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 8), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 8), [[0, 1, 2, 3, 4, 5, 6, 7]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(commands, size):
    full=set(range(size))
    masks={}
    active=None
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op=='define': masks[cmd[1]]=set(cmd[2]) & full
        elif op=='bind': active=cmd[1]
        elif op=='delete': masks.pop(cmd[1],None)
        elif op=='clone': masks[cmd[2]]=set(masks.get(cmd[1],set()))
        elif op=='subtract' and cmd[1] in masks: masks[cmd[1]]=full-set(cmd[2])
        elif op=='rename' and cmd[1] in masks:
            masks[cmd[2]]=masks.pop(cmd[1])
            if active==cmd[1]: active=cmd[2]
        elif op=='reset': masks={}; active=None
        elif op=='draw': out.append(sorted(masks.get(active,set())))
    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([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 4), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 4), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 4), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 4), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 4), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 4), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 4), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 4), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 4), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 4), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 4), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 4), [[0, 1, 2, 3]])
if N == 2:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 5), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 5), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 5), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 5), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 5), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 5), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 5), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 5), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 5), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 5), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 5), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 5), [[0, 1, 2, 3, 4]])
if N == 3:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 6), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 6), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 6), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 6), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 6), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 6), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 6), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 6), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 6), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 6), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 6), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 6), [[0, 1, 2, 3, 4, 5]])
if N == 4:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 7), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 7), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 7), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 7), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 7), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 7), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 7), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 7), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 7), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 7), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 7), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 7), [[0, 1, 2, 3, 4, 5, 6]])
if N == 5:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 8), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 8), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 8), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 8), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 8), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 8), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 8), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 8), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 8), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 8), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 8), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 8), [[0, 1, 2, 3, 4, 5, 6, 7]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Mask subtraction retains the removed samples instead of their complement.

Named clip masks are immutable snapshots clipped to target extent. Bind selects a name, edits replace the named mask, deletion of the active mask makes drawing empty. Renaming preserves active binding; clone is independent; reset clears registry and active binding.

split: open-access


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

N = 1
observations = []
def solve(commands, size):
    full=set(range(size))
    masks={}
    active=None
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op=='define': masks[cmd[1]]=set(cmd[2]) & full
        elif op=='bind': active=cmd[1]
        elif op=='delete': masks.pop(cmd[1],None)
        elif op=='clone': masks[cmd[2]]=set(masks.get(cmd[1],set()))
        elif op=='subtract' and cmd[1] in masks: masks[cmd[1]]-=set(cmd[2])
        elif op=='rename' and cmd[1] in masks:
            masks[cmd[2]]=masks[cmd[1]]
            if active==cmd[1]: active=cmd[2]
        elif op=='reset': masks={}; active=None
        elif op=='draw': out.append(sorted(masks.get(active,set())))
    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([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 4), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 4), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 4), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 4), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 4), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 4), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 4), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 4), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 4), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 4), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 4), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 4), [[0, 1, 2, 3]])
if N == 2:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 5), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 5), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 5), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 5), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 5), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 5), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 5), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 5), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 5), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 5), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 5), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 5), [[0, 1, 2, 3, 4]])
if N == 3:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 6), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 6), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 6), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 6), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 6), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 6), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 6), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 6), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 6), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 6), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 6), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 6), [[0, 1, 2, 3, 4, 5]])
if N == 4:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 7), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 7), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 7), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 7), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 7), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 7), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 7), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 7), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 7), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 7), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 7), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 7), [[0, 1, 2, 3, 4, 5, 6]])
if N == 5:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 8), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 8), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 8), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 8), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 8), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 8), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 8), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 8), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 8), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 8), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 8), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 8), [[0, 1, 2, 3, 4, 5, 6, 7]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(commands, size):
    full=set(range(size))
    masks={}
    active=None
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op=='define': masks[cmd[1]]=set(cmd[2]) & full
        elif op=='bind': active=cmd[1]
        elif op=='delete': masks.pop(cmd[1],None)
        elif op=='clone': masks[cmd[2]]=set(masks.get(cmd[1],set()))
        elif op=='subtract' and cmd[1] in masks: masks[cmd[1]]-=set(cmd[2])
        elif op=='rename' and cmd[1] in masks:
            masks[cmd[2]]=set(masks[cmd[1]])
            if active==cmd[1]: active=cmd[2]
        elif op=='reset': masks={}; active=None
        elif op=='draw': out.append(sorted(masks.get(active,set())))
    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([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 4), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 4), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 4), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 4), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 4), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 4), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 4), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 4), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 4), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 4), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 4), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 4), [[0, 1, 2, 3]])
if N == 2:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 5), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 5), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 5), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 5), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 5), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 5), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 5), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 5), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 5), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 5), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 5), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 5), [[0, 1, 2, 3, 4]])
if N == 3:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 6), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 6), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 6), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 6), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 6), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 6), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 6), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 6), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 6), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 6), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 6), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 6), [[0, 1, 2, 3, 4, 5]])
if N == 4:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 7), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 7), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 7), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 7), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 7), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 7), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 7), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 7), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 7), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 7), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 7), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 7), [[0, 1, 2, 3, 4, 5, 6]])
if N == 5:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 8), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 8), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 8), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 8), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 8), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 8), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 8), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 8), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 8), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 8), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 8), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 8), [[0, 1, 2, 3, 4, 5, 6, 7]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Renaming leaves the old name live and allows stale commands to keep drawing the mask.

Named clip masks are immutable snapshots clipped to target extent. Bind selects a name, edits replace the named mask, deletion of the active mask makes drawing empty. Renaming preserves active binding; clone is independent; reset clears registry and active binding.

split: open-access


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

N = 1
observations = []
def solve(commands, size):
    full=set(range(size))
    masks={}
    active=None
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op=='define': masks[cmd[1]]=set(cmd[2]) & full
        elif op=='bind': active=cmd[1]
        elif op=='delete': masks.pop(cmd[1],None)
        elif op=='clone': masks[cmd[2]]=set(masks.get(cmd[1],set()))
        elif op=='subtract' and cmd[1] in masks: masks[cmd[1]]-=set(cmd[2])
        elif op=='rename' and cmd[1] in masks:
            masks[cmd[2]]=masks.pop(cmd[1])
            if active==cmd[2]: active=cmd[1]
        elif op=='reset': masks={}; active=None
        elif op=='draw': out.append(sorted(masks.get(active,set())))
    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([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 4), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 4), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 4), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 4), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 4), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 4), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 4), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 4), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 4), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 4), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 4), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 4), [[0, 1, 2, 3]])
if N == 2:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 5), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 5), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 5), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 5), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 5), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 5), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 5), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 5), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 5), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 5), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 5), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 5), [[0, 1, 2, 3, 4]])
if N == 3:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 6), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 6), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 6), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 6), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 6), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 6), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 6), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 6), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 6), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 6), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 6), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 6), [[0, 1, 2, 3, 4, 5]])
if N == 4:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 7), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 7), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 7), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 7), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 7), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 7), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 7), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 7), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 7), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 7), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 7), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 7), [[0, 1, 2, 3, 4, 5, 6]])
if N == 5:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 8), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 8), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 8), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 8), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 8), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 8), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 8), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 8), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 8), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 8), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 8), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 8), [[0, 1, 2, 3, 4, 5, 6, 7]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(commands, size):
    full=set(range(size))
    masks={}
    active=None
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op=='define': masks[cmd[1]]=set(cmd[2]) & full
        elif op=='bind': active=cmd[1]
        elif op=='delete': masks.pop(cmd[1],None)
        elif op=='clone': masks[cmd[2]]=set(masks.get(cmd[1],set()))
        elif op=='subtract' and cmd[1] in masks: masks[cmd[1]]-=set(cmd[2])
        elif op=='rename' and cmd[1] in masks:
            masks[cmd[2]]=masks.pop(cmd[1])
            active=cmd[2]
        elif op=='reset': masks={}; active=None
        elif op=='draw': out.append(sorted(masks.get(active,set())))
    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([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 4), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 4), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 4), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 4), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 4), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 4), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 4), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 4), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 4), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 4), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 4), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 4), [[0, 1, 2, 3]])
if N == 2:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 5), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 5), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 5), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 5), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 5), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 5), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 5), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 5), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 5), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 5), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 5), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 5), [[0, 1, 2, 3, 4]])
if N == 3:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 6), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 6), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 6), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 6), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 6), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 6), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 6), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 6), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 6), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 6), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 6), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 6), [[0, 1, 2, 3, 4, 5]])
if N == 4:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 7), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 7), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 7), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 7), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 7), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 7), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 7), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 7), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 7), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 7), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 7), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 7), [[0, 1, 2, 3, 4, 5, 6]])
if N == 5:
    check('explicit sequence 0', solve([['define', 'a', [0, 99, -1]], ['bind', 'a'], ['draw']], 8), [[0]])
    check('explicit sequence 1', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['draw'], ['bind', 'b'], ['draw']], 8), [[0], [1]])
    check('explicit sequence 2', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['delete', 'b'], ['draw']], 8), [[0]])
    check('explicit sequence 3', solve([['define', 'a', [0, 1]], ['clone', 'a', 'b'], ['subtract', 'a', [0]], ['bind', 'b'], ['draw'], ['bind', 'a'], ['draw']], 8), [[0, 1], [1]])
    check('explicit sequence 4', solve([['define', 'a', [0]], ['bind', 'a'], ['rename', 'a', 'b'], ['draw'], ['bind', 'a'], ['draw']], 8), [[0], []])
    check('explicit sequence 5', solve([['define', 'a', [0]], ['reset'], ['bind', 'a'], ['draw']], 8), [[]])
    check('explicit sequence 6', solve([['bind', 'missing'], ['draw']], 8), [[]])
    check('explicit sequence 7', solve([['define', 'a', [0]], ['define', 'a', [2]], ['bind', 'a'], ['draw']], 8), [[2]])
    check('explicit sequence 8', solve([['define', 'e', []], ['bind', 'e'], ['draw']], 8), [[]])
    check('explicit sequence 9', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['rename', 'b', 'c'], ['draw']], 8), [[0]])
    check('explicit sequence 10', solve([['define', 'a', [0]], ['define', 'b', [1]], ['bind', 'a'], ['reset'], ['bind', 'b'], ['draw']], 8), [[]])
    check('explicit sequence 11', solve([['define', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['bind', 'a'], ['draw']], 8), [[0, 1, 2, 3, 4, 5, 6, 7]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Rename updates the wrong active-name condition and loses the active mask.

Named clip masks are immutable snapshots clipped to target extent. Bind selects a name, edits replace the named mask, deletion of the active mask makes drawing empty. Renaming preserves active binding; clone is independent; reset clears registry and active binding.

split: open-access