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

N = 1
observations = []
def solve(commands, size):
    pattern=[]
    offset=0
    phase=0
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op=='pattern':
            pattern=list(cmd[1])
            if len(pattern)%2: pattern=pattern*2
            phase=offset
        elif op=='offset': offset=cmd[1]
        elif op=='move': phase=offset
        elif op=='advance': phase+=cmd[1]
        elif op=='draw':
            length,visible=cmd[1],set(cmd[2])
            covered=[]
            for i in range(length):
                on=False
                if pattern:
                    position=(phase+i)%sum(pattern)
                    dash=0
                    while position>=pattern[dash]:
                        position-=pattern[dash]
                        dash+=1
                    on=dash%2==0
                if on and i in visible and 0<=i<size: covered.append(i)
            phase+=length
            out.append(covered)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('explicit sequence 0', solve([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 4), [[0, 2]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 4), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 4), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 4), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 4), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 4), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 4), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 4), [[0, 1, 2, 3], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 4), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 4), [[]])
if N == 2:
    check('explicit sequence 0', solve([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 5), [[0, 2, 4]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 5), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 5), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 5), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 5), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 5), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 5), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 5), [[0, 1, 2, 3, 4], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 5), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 5), [[]])
if N == 3:
    check('explicit sequence 0', solve([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 6), [[0, 2, 4]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 6), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 6), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 6), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 6), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 6), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 6), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 6), [[0, 1, 2, 3, 4, 5], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 6), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 6), [[]])
if N == 4:
    check('explicit sequence 0', solve([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 7), [[0, 2, 4]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 7), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 7), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 7), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 7), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 7), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 7), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 7), [[0, 1, 2, 3, 4, 5, 6], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 7), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 7), [[]])
if N == 5:
    check('explicit sequence 0', solve([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 8), [[0, 2, 4]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 8), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 8), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 8), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 8), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 8), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 8), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 8), [[0, 1, 2, 3, 4, 5, 6, 7], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 8), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 8), [[]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(commands, size):
    pattern=[]
    offset=0
    phase=0
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op=='pattern':
            pattern=list(cmd[1])
            if len(pattern)%2: pattern=pattern*2
            phase=offset
        elif op=='offset': offset=cmd[1]
        elif op=='move': phase=offset
        elif op=='advance': phase+=cmd[1]
        elif op=='draw':
            length,visible=cmd[1],set(cmd[2])
            covered=[]
            for i in range(length):
                on=phase==0
                if pattern:
                    position=(phase+i)%sum(pattern)
                    dash=0
                    while position>=pattern[dash]:
                        position-=pattern[dash]
                        dash+=1
                    on=dash%2==0
                if on and i in visible and 0<=i<size: covered.append(i)
            phase+=length
            out.append(covered)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('explicit sequence 0', solve([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 4), [[0, 2]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 4), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 4), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 4), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 4), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 4), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 4), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 4), [[0, 1, 2, 3], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 4), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 4), [[]])
if N == 2:
    check('explicit sequence 0', solve([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 5), [[0, 2, 4]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 5), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 5), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 5), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 5), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 5), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 5), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 5), [[0, 1, 2, 3, 4], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 5), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 5), [[]])
if N == 3:
    check('explicit sequence 0', solve([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 6), [[0, 2, 4]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 6), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 6), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 6), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 6), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 6), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 6), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 6), [[0, 1, 2, 3, 4, 5], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 6), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 6), [[]])
if N == 4:
    check('explicit sequence 0', solve([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 7), [[0, 2, 4]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 7), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 7), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 7), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 7), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 7), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 7), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 7), [[0, 1, 2, 3, 4, 5, 6], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 7), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 7), [[]])
if N == 5:
    check('explicit sequence 0', solve([['pattern', [1, 1, 1]], ['draw', 6, [0, 1, 2, 3, 4, 5]]], 8), [[0, 2, 4]])
    check('explicit sequence 1', solve([['offset', -1], ['pattern', [2, 1]], ['draw', 4, [0, 1, 2, 3]]], 8), [[1, 2]])
    check('explicit sequence 2', solve([['pattern', [2, 1]], ['draw', 1, [0]], ['offset', 2], ['draw', 3, [0, 1, 2]]], 8), [[0], [0, 2]])
    check('explicit sequence 3', solve([['offset', 1], ['pattern', [2, 2]], ['draw', 2, [0, 1]], ['move'], ['draw', 3, [0, 1, 2]]], 8), [[0], [0]])
    check('explicit sequence 4', solve([['pattern', [2, 2]], ['draw', 1, [0]], ['advance', 1], ['draw', 3, [0, 1, 2]]], 8), [[0], [2]])
    check('explicit sequence 5', solve([['pattern', [2, 2]], ['draw', 3, [0]], ['draw', 3, [0, 1, 2]]], 8), [[0], [1, 2]])
    check('explicit sequence 6', solve([['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 8), [[0, 3]])
    check('explicit sequence 7', solve([['pattern', []], ['draw', 10, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw', 2, [0, 1]]], 8), [[0, 1, 2, 3, 4, 5, 6, 7], [0, 1]])
    check('explicit sequence 8', solve([['offset', 1], ['pattern', [1, 2]], ['draw', 4, [0, 1, 2, 3]]], 8), [[2]])
    check('explicit sequence 9', solve([['pattern', [1, 1]], ['draw', 0, []]], 8), [[]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
An empty dash array is interpreted as an entirely off stroke.

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

split: open-access


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

N = 1
observations = []
def solve(commands, size):
    full=set(range(size))
    sources={}
    counts={x:0 for x in full}
    mode='union'
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op in ('put','move','remove'):
            key=cmd[1]
            old=sources.get(key,set())
            for x in old & full: counts[x]+=0
            if op=='put': new=set(cmd[2])
            elif op=='move': new={x+cmd[2] for x in old}
            else: new=set()
            if op=='remove': sources.pop(key,None)
            else: sources[key]=new
            for x in new & full: counts[x]+=1
        elif op=='mode': mode=cmd[1]
        elif op=='draw':
            if mode=='union': selected=[x for x in full if counts[x]>0]
            elif mode=='single': selected=[x for x in full if counts[x]==1]
            elif mode=='overlap': selected=[x for x in full if counts[x]>=2]
            else: selected=[x for x in full if counts[x]%2==1]
            out.append(sorted(selected))
    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([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 4), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 4), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 4), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 4), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 4), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 4), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 4), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 4), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 4), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 4), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 4), [[0, 1, 2, 3]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 4), [[0, 1]])
if N == 2:
    check('explicit sequence 0', solve([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 5), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 5), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 5), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 5), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 5), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 5), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 5), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 5), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 5), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 5), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 5), [[0, 1, 2, 3, 4]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 5), [[0, 1]])
if N == 3:
    check('explicit sequence 0', solve([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 6), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 6), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 6), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 6), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 6), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 6), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 6), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 6), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 6), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 6), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 6), [[0, 1, 2, 3, 4, 5]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 6), [[0, 1]])
if N == 4:
    check('explicit sequence 0', solve([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 7), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 7), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 7), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 7), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 7), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 7), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 7), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 7), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 7), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 7), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 7), [[0, 1, 2, 3, 4, 5, 6]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 7), [[0, 1]])
if N == 5:
    check('explicit sequence 0', solve([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 8), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 8), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 8), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 8), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 8), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 8), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 8), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 8), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 8), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 8), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 8), [[0, 1, 2, 3, 4, 5, 6, 7]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 8), [[0, 1]])
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))
    sources={}
    counts={x:0 for x in full}
    mode='union'
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op in ('put','move','remove'):
            key=cmd[1]
            old=sources.get(key,set())
            for x in old & full: counts[x]=0
            if op=='put': new=set(cmd[2])
            elif op=='move': new={x+cmd[2] for x in old}
            else: new=set()
            if op=='remove': sources.pop(key,None)
            else: sources[key]=new
            for x in new & full: counts[x]+=1
        elif op=='mode': mode=cmd[1]
        elif op=='draw':
            if mode=='union': selected=[x for x in full if counts[x]>0]
            elif mode=='single': selected=[x for x in full if counts[x]==1]
            elif mode=='overlap': selected=[x for x in full if counts[x]>=2]
            else: selected=[x for x in full if counts[x]%2==1]
            out.append(sorted(selected))
    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([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 4), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 4), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 4), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 4), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 4), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 4), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 4), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 4), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 4), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 4), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 4), [[0, 1, 2, 3]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 4), [[0, 1]])
if N == 2:
    check('explicit sequence 0', solve([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 5), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 5), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 5), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 5), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 5), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 5), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 5), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 5), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 5), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 5), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 5), [[0, 1, 2, 3, 4]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 5), [[0, 1]])
if N == 3:
    check('explicit sequence 0', solve([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 6), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 6), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 6), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 6), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 6), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 6), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 6), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 6), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 6), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 6), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 6), [[0, 1, 2, 3, 4, 5]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 6), [[0, 1]])
if N == 4:
    check('explicit sequence 0', solve([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 7), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 7), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 7), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 7), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 7), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 7), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 7), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 7), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 7), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 7), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 7), [[0, 1, 2, 3, 4, 5, 6]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 7), [[0, 1]])
if N == 5:
    check('explicit sequence 0', solve([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 8), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 8), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 8), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 8), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 8), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 8), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 8), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 8), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 8), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 8), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 8), [[0, 1, 2, 3, 4, 5, 6, 7]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 8), [[0, 1]])
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:
Replacing or moving a source leaves its old coverage contribution behind.

Sources contribute unique sample sets to an overlap-count clip. Replacing a source first removes its old contribution. Removing an unknown source is inert. Coverage may select union, exactly-one, at-least-two or odd count. Moving a source translates its retained original sample set before clipping to the target, allowing previously exterior samples to enter. Draw emits selected finite samples.

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))
    sources={}
    counts={x:0 for x in full}
    mode='union'
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op in ('put','move','remove'):
            key=cmd[1]
            old=sources.get(key,set())
            for x in old & full: counts[x]-=1
            if op=='put': new=set(cmd[2]) & full
            elif op=='move': new={x+cmd[2] for x in old}
            else: new=set()
            if op=='remove': sources.pop(key,None)
            else: sources[key]=new
            for x in new & full: counts[x]+=1
        elif op=='mode': mode=cmd[1]
        elif op=='draw':
            if mode=='union': selected=[x for x in full if counts[x]>0]
            elif mode=='single': selected=[x for x in full if counts[x]==1]
            elif mode=='overlap': selected=[x for x in full if counts[x]>=2]
            else: selected=[x for x in full if counts[x]%2==1]
            out.append(sorted(selected))
    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([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 4), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 4), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 4), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 4), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 4), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 4), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 4), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 4), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 4), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 4), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 4), [[0, 1, 2, 3]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 4), [[0, 1]])
if N == 2:
    check('explicit sequence 0', solve([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 5), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 5), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 5), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 5), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 5), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 5), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 5), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 5), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 5), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 5), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 5), [[0, 1, 2, 3, 4]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 5), [[0, 1]])
if N == 3:
    check('explicit sequence 0', solve([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 6), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 6), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 6), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 6), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 6), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 6), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 6), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 6), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 6), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 6), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 6), [[0, 1, 2, 3, 4, 5]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 6), [[0, 1]])
if N == 4:
    check('explicit sequence 0', solve([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 7), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 7), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 7), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 7), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 7), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 7), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 7), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 7), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 7), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 7), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 7), [[0, 1, 2, 3, 4, 5, 6]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 7), [[0, 1]])
if N == 5:
    check('explicit sequence 0', solve([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 8), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 8), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 8), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 8), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 8), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 8), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 8), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 8), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 8), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 8), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 8), [[0, 1, 2, 3, 4, 5, 6, 7]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 8), [[0, 1]])
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))
    sources={}
    counts={x:0 for x in full}
    mode='union'
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op in ('put','move','remove'):
            key=cmd[1]
            old=sources.get(key,set())
            for x in old & full: counts[x]-=1
            if op=='put': new={x for x in cmd[2] if x>=0}
            elif op=='move': new={x+cmd[2] for x in old}
            else: new=set()
            if op=='remove': sources.pop(key,None)
            else: sources[key]=new
            for x in new & full: counts[x]+=1
        elif op=='mode': mode=cmd[1]
        elif op=='draw':
            if mode=='union': selected=[x for x in full if counts[x]>0]
            elif mode=='single': selected=[x for x in full if counts[x]==1]
            elif mode=='overlap': selected=[x for x in full if counts[x]>=2]
            else: selected=[x for x in full if counts[x]%2==1]
            out.append(sorted(selected))
    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([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 4), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 4), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 4), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 4), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 4), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 4), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 4), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 4), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 4), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 4), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 4), [[0, 1, 2, 3]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 4), [[0, 1]])
if N == 2:
    check('explicit sequence 0', solve([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 5), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 5), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 5), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 5), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 5), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 5), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 5), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 5), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 5), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 5), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 5), [[0, 1, 2, 3, 4]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 5), [[0, 1]])
if N == 3:
    check('explicit sequence 0', solve([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 6), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 6), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 6), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 6), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 6), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 6), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 6), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 6), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 6), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 6), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 6), [[0, 1, 2, 3, 4, 5]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 6), [[0, 1]])
if N == 4:
    check('explicit sequence 0', solve([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 7), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 7), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 7), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 7), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 7), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 7), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 7), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 7), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 7), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 7), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 7), [[0, 1, 2, 3, 4, 5, 6]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 7), [[0, 1]])
if N == 5:
    check('explicit sequence 0', solve([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 8), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 8), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 8), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 8), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 8), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 8), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 8), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 8), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 8), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 8), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 8), [[0, 1, 2, 3, 4, 5, 6, 7]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 8), [[0, 1]])
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:
Storing only initially visible source samples loses exterior coverage needed by later translations.

Sources contribute unique sample sets to an overlap-count clip. Replacing a source first removes its old contribution. Removing an unknown source is inert. Coverage may select union, exactly-one, at-least-two or odd count. Moving a source translates its retained original sample set before clipping to the target, allowing previously exterior samples to enter. Draw emits selected finite samples.

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))
    sources={}
    counts={x:0 for x in full}
    mode='union'
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op in ('put','move','remove'):
            key=cmd[1]
            old=sources.get(key,set())
            for x in old & full: counts[x]-=1
            if op=='put': new=set(cmd[2])
            elif op=='move': new={x+cmd[2] for x in old & full}
            else: new=set()
            if op=='remove': sources.pop(key,None)
            else: sources[key]=new
            for x in new & full: counts[x]+=1
        elif op=='mode': mode=cmd[1]
        elif op=='draw':
            if mode=='union': selected=[x for x in full if counts[x]>0]
            elif mode=='single': selected=[x for x in full if counts[x]==1]
            elif mode=='overlap': selected=[x for x in full if counts[x]>=2]
            else: selected=[x for x in full if counts[x]%2==1]
            out.append(sorted(selected))
    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([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 4), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 4), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 4), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 4), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 4), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 4), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 4), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 4), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 4), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 4), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 4), [[0, 1, 2, 3]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 4), [[0, 1]])
if N == 2:
    check('explicit sequence 0', solve([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 5), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 5), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 5), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 5), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 5), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 5), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 5), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 5), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 5), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 5), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 5), [[0, 1, 2, 3, 4]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 5), [[0, 1]])
if N == 3:
    check('explicit sequence 0', solve([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 6), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 6), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 6), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 6), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 6), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 6), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 6), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 6), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 6), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 6), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 6), [[0, 1, 2, 3, 4, 5]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 6), [[0, 1]])
if N == 4:
    check('explicit sequence 0', solve([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 7), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 7), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 7), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 7), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 7), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 7), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 7), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 7), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 7), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 7), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 7), [[0, 1, 2, 3, 4, 5, 6]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 7), [[0, 1]])
if N == 5:
    check('explicit sequence 0', solve([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 8), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 8), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 8), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 8), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 8), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 8), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 8), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 8), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 8), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 8), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 8), [[0, 1, 2, 3, 4, 5, 6, 7]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 8), [[0, 1]])
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))
    sources={}
    counts={x:0 for x in full}
    mode='union'
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op in ('put','move','remove'):
            key=cmd[1]
            old=sources.get(key,set())
            for x in old & full: counts[x]-=1
            if op=='put': new=set(cmd[2])
            elif op=='move': new={max(0,x)+cmd[2] for x in old}
            else: new=set()
            if op=='remove': sources.pop(key,None)
            else: sources[key]=new
            for x in new & full: counts[x]+=1
        elif op=='mode': mode=cmd[1]
        elif op=='draw':
            if mode=='union': selected=[x for x in full if counts[x]>0]
            elif mode=='single': selected=[x for x in full if counts[x]==1]
            elif mode=='overlap': selected=[x for x in full if counts[x]>=2]
            else: selected=[x for x in full if counts[x]%2==1]
            out.append(sorted(selected))
    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([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 4), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 4), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 4), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 4), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 4), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 4), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 4), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 4), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 4), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 4), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 4), [[0, 1, 2, 3]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 4), [[0, 1]])
if N == 2:
    check('explicit sequence 0', solve([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 5), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 5), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 5), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 5), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 5), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 5), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 5), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 5), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 5), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 5), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 5), [[0, 1, 2, 3, 4]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 5), [[0, 1]])
if N == 3:
    check('explicit sequence 0', solve([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 6), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 6), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 6), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 6), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 6), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 6), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 6), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 6), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 6), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 6), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 6), [[0, 1, 2, 3, 4, 5]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 6), [[0, 1]])
if N == 4:
    check('explicit sequence 0', solve([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 7), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 7), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 7), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 7), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 7), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 7), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 7), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 7), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 7), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 7), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 7), [[0, 1, 2, 3, 4, 5, 6]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 7), [[0, 1]])
if N == 5:
    check('explicit sequence 0', solve([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 8), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 8), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 8), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 8), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 8), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 8), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 8), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 8), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 8), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 8), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 8), [[0, 1, 2, 3, 4, 5, 6, 7]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 8), [[0, 1]])
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:
Clipping a source before translation prevents exterior coverage from entering the surface.

Sources contribute unique sample sets to an overlap-count clip. Replacing a source first removes its old contribution. Removing an unknown source is inert. Coverage may select union, exactly-one, at-least-two or odd count. Moving a source translates its retained original sample set before clipping to the target, allowing previously exterior samples to enter. Draw emits selected finite samples.

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))
    sources={}
    counts={x:0 for x in full}
    mode='union'
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op in ('put','move','remove'):
            key=cmd[1]
            old=sources.get(key,set())
            for x in old & full: counts[x]-=1
            if op=='put': new=set(cmd[2])
            elif op=='move': new={x-cmd[2] for x in old}
            else: new=set()
            if op=='remove': sources.pop(key,None)
            else: sources[key]=new
            for x in new & full: counts[x]+=1
        elif op=='mode': mode=cmd[1]
        elif op=='draw':
            if mode=='union': selected=[x for x in full if counts[x]>0]
            elif mode=='single': selected=[x for x in full if counts[x]==1]
            elif mode=='overlap': selected=[x for x in full if counts[x]>=2]
            else: selected=[x for x in full if counts[x]%2==1]
            out.append(sorted(selected))
    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([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 4), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 4), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 4), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 4), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 4), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 4), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 4), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 4), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 4), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 4), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 4), [[0, 1, 2, 3]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 4), [[0, 1]])
if N == 2:
    check('explicit sequence 0', solve([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 5), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 5), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 5), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 5), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 5), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 5), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 5), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 5), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 5), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 5), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 5), [[0, 1, 2, 3, 4]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 5), [[0, 1]])
if N == 3:
    check('explicit sequence 0', solve([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 6), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 6), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 6), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 6), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 6), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 6), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 6), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 6), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 6), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 6), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 6), [[0, 1, 2, 3, 4, 5]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 6), [[0, 1]])
if N == 4:
    check('explicit sequence 0', solve([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 7), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 7), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 7), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 7), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 7), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 7), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 7), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 7), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 7), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 7), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 7), [[0, 1, 2, 3, 4, 5, 6]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 7), [[0, 1]])
if N == 5:
    check('explicit sequence 0', solve([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 8), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 8), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 8), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 8), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 8), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 8), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 8), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 8), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 8), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 8), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 8), [[0, 1, 2, 3, 4, 5, 6, 7]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 8), [[0, 1]])
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))
    sources={}
    counts={x:0 for x in full}
    mode='union'
    out=[]
    for cmd in commands:
        op=cmd[0]
        if op in ('put','move','remove'):
            key=cmd[1]
            old=sources.get(key,set())
            for x in old & full: counts[x]-=1
            if op=='put': new=set(cmd[2])
            elif op=='move': new={x+abs(cmd[2]) for x in old}
            else: new=set()
            if op=='remove': sources.pop(key,None)
            else: sources[key]=new
            for x in new & full: counts[x]+=1
        elif op=='mode': mode=cmd[1]
        elif op=='draw':
            if mode=='union': selected=[x for x in full if counts[x]>0]
            elif mode=='single': selected=[x for x in full if counts[x]==1]
            elif mode=='overlap': selected=[x for x in full if counts[x]>=2]
            else: selected=[x for x in full if counts[x]%2==1]
            out.append(sorted(selected))
    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([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 4), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 4), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 4), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 4), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 4), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 4), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 4), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 4), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 4), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 4), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 4), [[0, 1, 2, 3]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 4), [[0, 1]])
if N == 2:
    check('explicit sequence 0', solve([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 5), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 5), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 5), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 5), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 5), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 5), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 5), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 5), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 5), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 5), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 5), [[0, 1, 2, 3, 4]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 5), [[0, 1]])
if N == 3:
    check('explicit sequence 0', solve([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 6), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 6), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 6), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 6), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 6), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 6), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 6), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 6), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 6), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 6), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 6), [[0, 1, 2, 3, 4, 5]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 6), [[0, 1]])
if N == 4:
    check('explicit sequence 0', solve([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 7), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 7), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 7), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 7), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 7), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 7), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 7), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 7), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 7), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 7), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 7), [[0, 1, 2, 3, 4, 5, 6]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 7), [[0, 1]])
if N == 5:
    check('explicit sequence 0', solve([['put', 'a', [0, 1]], ['put', 'a', [2]], ['draw']], 8), [[2]])
    check('explicit sequence 1', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['draw']], 8), [[0]])
    check('explicit sequence 2', solve([['put', 'a', [-1]], ['move', 'a', 2], ['draw']], 8), [[1]])
    check('explicit sequence 3', solve([['put', 'a', [2]], ['move', 'a', -1], ['draw']], 8), [[1]])
    check('explicit sequence 4', solve([['put', 'a', [0]], ['put', 'b', [0]], ['remove', 'a'], ['remove', 'a'], ['draw']], 8), [[0]])
    check('explicit sequence 5', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'overlap'], ['draw']], 8), [[0]])
    check('explicit sequence 6', solve([['put', 'a', [0]], ['mode', 'single'], ['draw']], 8), [[0]])
    check('explicit sequence 7', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'single'], ['draw']], 8), [[]])
    check('explicit sequence 8', solve([['put', 'a', [0]], ['put', 'b', [0]], ['put', 'c', [0]], ['mode', 'overlap'], ['draw'], ['mode', 'odd'], ['draw']], 8), [[0], [0]])
    check('explicit sequence 9', solve([['put', 'a', [0]], ['put', 'b', [0]], ['mode', 'odd'], ['draw']], 8), [[]])
    check('explicit sequence 10', solve([['put', 'a', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]], ['draw']], 8), [[0, 1, 2, 3, 4, 5, 6, 7]])
    check('explicit sequence 11', solve([['put', 'a', [0, 1]], ['put', 'b', [1]], ['draw']], 8), [[0, 1]])
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:
Moving a clip source applies displacement with reversed sign.

Sources contribute unique sample sets to an overlap-count clip. Replacing a source first removes its old contribution. Removing an unknown source is inert. Coverage may select union, exactly-one, at-least-two or odd count. Moving a source translates its retained original sample set before clipping to the target, allowing previously exterior samples to enter. Draw emits selected finite samples.

split: open-access