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

N = 1
observations = []
def solve(commands, size):
    from fractions import Fraction
    out=[]
    for first,last,planes in commands:
        a=list(map(Fraction,first)); b=list(map(Fraction,last))
        original_a=list(a); original_b=list(b)
        rejected=False
        for plane in planes:
            def distance(p):
                if plane=='left': return p[0]+size*p[1]
                if plane=='right': return size*p[1]-p[0]
                return p[1]-1
            da=distance(original_a); db=distance(original_b)
            ia=da>=0; ib=db>=0
            if not ia and not ib: rejected=True; break
            if ia and ib: continue
            t=da/(da-db)
            point=[a[i]+t*(b[i]-a[i]) for i in range(3)]
            if not ia: a=point
            else: b=point
        out.append(None if rejected else [[str(v) for v in a],[str(v) for v in b]])
    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([[[-12, 1, 0], [0, 1, 12], ['left']]], 4), [[['-4', '1', '8'], ['0', '1', '12']]])
    check('explicit sequence 1', solve([[[0, 1, 0], [12, 1, 12], ['right']]], 4), [[['0', '1', '0'], ['4', '1', '4']]])
    check('explicit sequence 2', solve([[[-20, 1, 0], [-15, 1, 5], ['left']]], 4), [None])
    check('explicit sequence 3', solve([[[-4, 1, 0], [-8, 2, 8], ['left']]], 4), [[['-4', '1', '0'], ['-8', '2', '8']]])
    check('explicit sequence 4', solve([[[0, 0, 0], [0, 2, 10], ['eye']]], 4), [[['0', '1', '5'], ['0', '2', '10']]])
    check('explicit sequence 5', solve([[[-12, 1, 0], [12, 1, 24], ['left', 'right']]], 4), [[['-4', '1', '8'], ['4', '1', '16']]])
    check('explicit sequence 6', solve([[[0, 1, 0], [12, 1, 12], ['left', 'right']]], 4), [[['0', '1', '0'], ['4', '1', '4']]])
    check('explicit sequence 7', solve([[[0, 1, 0], [1, 1, 1], ['eye', 'left', 'right']]], 4), [[['0', '1', '0'], ['1', '1', '1']]])
    check('explicit sequence 8', solve([[[-12, 0, 0], [12, 2, 24], ['left', 'right', 'eye']]], 4), [[['0', '1', '12'], ['6', '3/2', '18']]])
    check('explicit sequence 9', solve([[[-15, 1, 0], [-20, 1, 5], ['left']]], 4), [None])
    check('explicit sequence 10', solve([[[0, 0, 0], [0, 1, 1], ['eye']]], 4), [[['0', '1', '1'], ['0', '1', '1']]])
    check('explicit sequence 11', solve([[[-40, 0, 0], [40, 2, 24], ['right', 'eye']]], 4), [[['0', '1', '12'], ['40/9', '10/9', '40/3']]])
if N == 2:
    check('explicit sequence 0', solve([[[-12, 1, 0], [0, 1, 12], ['left']]], 5), [[['-5', '1', '7'], ['0', '1', '12']]])
    check('explicit sequence 1', solve([[[0, 1, 0], [12, 1, 12], ['right']]], 5), [[['0', '1', '0'], ['5', '1', '5']]])
    check('explicit sequence 2', solve([[[-20, 1, 0], [-15, 1, 5], ['left']]], 5), [None])
    check('explicit sequence 3', solve([[[-4, 1, 0], [-8, 2, 8], ['left']]], 5), [[['-4', '1', '0'], ['-8', '2', '8']]])
    check('explicit sequence 4', solve([[[0, 0, 0], [0, 2, 10], ['eye']]], 5), [[['0', '1', '5'], ['0', '2', '10']]])
    check('explicit sequence 5', solve([[[-12, 1, 0], [12, 1, 24], ['left', 'right']]], 5), [[['-5', '1', '7'], ['5', '1', '17']]])
    check('explicit sequence 6', solve([[[0, 1, 0], [12, 1, 12], ['left', 'right']]], 5), [[['0', '1', '0'], ['5', '1', '5']]])
    check('explicit sequence 7', solve([[[0, 1, 0], [1, 1, 1], ['eye', 'left', 'right']]], 5), [[['0', '1', '0'], ['1', '1', '1']]])
    check('explicit sequence 8', solve([[[-12, 0, 0], [12, 2, 24], ['left', 'right', 'eye']]], 5), [[['0', '1', '12'], ['60/7', '12/7', '144/7']]])
    check('explicit sequence 9', solve([[[-15, 1, 0], [-20, 1, 5], ['left']]], 5), [None])
    check('explicit sequence 10', solve([[[0, 0, 0], [0, 1, 1], ['eye']]], 5), [[['0', '1', '1'], ['0', '1', '1']]])
    check('explicit sequence 11', solve([[[-40, 0, 0], [40, 2, 24], ['right', 'eye']]], 5), [[['0', '1', '12'], ['40/7', '8/7', '96/7']]])
if N == 3:
    check('explicit sequence 0', solve([[[-12, 1, 0], [0, 1, 12], ['left']]], 6), [[['-6', '1', '6'], ['0', '1', '12']]])
    check('explicit sequence 1', solve([[[0, 1, 0], [12, 1, 12], ['right']]], 6), [[['0', '1', '0'], ['6', '1', '6']]])
    check('explicit sequence 2', solve([[[-20, 1, 0], [-15, 1, 5], ['left']]], 6), [None])
    check('explicit sequence 3', solve([[[-4, 1, 0], [-8, 2, 8], ['left']]], 6), [[['-4', '1', '0'], ['-8', '2', '8']]])
    check('explicit sequence 4', solve([[[0, 0, 0], [0, 2, 10], ['eye']]], 6), [[['0', '1', '5'], ['0', '2', '10']]])
    check('explicit sequence 5', solve([[[-12, 1, 0], [12, 1, 24], ['left', 'right']]], 6), [[['-6', '1', '6'], ['6', '1', '18']]])
    check('explicit sequence 6', solve([[[0, 1, 0], [12, 1, 12], ['left', 'right']]], 6), [[['0', '1', '0'], ['6', '1', '6']]])
    check('explicit sequence 7', solve([[[0, 1, 0], [1, 1, 1], ['eye', 'left', 'right']]], 6), [[['0', '1', '0'], ['1', '1', '1']]])
    check('explicit sequence 8', solve([[[-12, 0, 0], [12, 2, 24], ['left', 'right', 'eye']]], 6), [[['0', '1', '12'], ['12', '2', '24']]])
    check('explicit sequence 9', solve([[[-15, 1, 0], [-20, 1, 5], ['left']]], 6), [None])
    check('explicit sequence 10', solve([[[0, 0, 0], [0, 1, 1], ['eye']]], 6), [[['0', '1', '1'], ['0', '1', '1']]])
    check('explicit sequence 11', solve([[[-40, 0, 0], [40, 2, 24], ['right', 'eye']]], 6), [[['0', '1', '12'], ['120/17', '20/17', '240/17']]])
if N == 4:
    check('explicit sequence 0', solve([[[-12, 1, 0], [0, 1, 12], ['left']]], 7), [[['-7', '1', '5'], ['0', '1', '12']]])
    check('explicit sequence 1', solve([[[0, 1, 0], [12, 1, 12], ['right']]], 7), [[['0', '1', '0'], ['7', '1', '7']]])
    check('explicit sequence 2', solve([[[-20, 1, 0], [-15, 1, 5], ['left']]], 7), [None])
    check('explicit sequence 3', solve([[[-4, 1, 0], [-8, 2, 8], ['left']]], 7), [[['-4', '1', '0'], ['-8', '2', '8']]])
    check('explicit sequence 4', solve([[[0, 0, 0], [0, 2, 10], ['eye']]], 7), [[['0', '1', '5'], ['0', '2', '10']]])
    check('explicit sequence 5', solve([[[-12, 1, 0], [12, 1, 24], ['left', 'right']]], 7), [[['-7', '1', '5'], ['7', '1', '19']]])
    check('explicit sequence 6', solve([[[0, 1, 0], [12, 1, 12], ['left', 'right']]], 7), [[['0', '1', '0'], ['7', '1', '7']]])
    check('explicit sequence 7', solve([[[0, 1, 0], [1, 1, 1], ['eye', 'left', 'right']]], 7), [[['0', '1', '0'], ['1', '1', '1']]])
    check('explicit sequence 8', solve([[[-12, 0, 0], [12, 2, 24], ['left', 'right', 'eye']]], 7), [[['0', '1', '12'], ['12', '2', '24']]])
    check('explicit sequence 9', solve([[[-15, 1, 0], [-20, 1, 5], ['left']]], 7), [None])
    check('explicit sequence 10', solve([[[0, 0, 0], [0, 1, 1], ['eye']]], 7), [[['0', '1', '1'], ['0', '1', '1']]])
    check('explicit sequence 11', solve([[[-40, 0, 0], [40, 2, 24], ['right', 'eye']]], 7), [[['0', '1', '12'], ['280/33', '40/33', '160/11']]])
if N == 5:
    check('explicit sequence 0', solve([[[-12, 1, 0], [0, 1, 12], ['left']]], 8), [[['-8', '1', '4'], ['0', '1', '12']]])
    check('explicit sequence 1', solve([[[0, 1, 0], [12, 1, 12], ['right']]], 8), [[['0', '1', '0'], ['8', '1', '8']]])
    check('explicit sequence 2', solve([[[-20, 1, 0], [-15, 1, 5], ['left']]], 8), [None])
    check('explicit sequence 3', solve([[[-4, 1, 0], [-8, 2, 8], ['left']]], 8), [[['-4', '1', '0'], ['-8', '2', '8']]])
    check('explicit sequence 4', solve([[[0, 0, 0], [0, 2, 10], ['eye']]], 8), [[['0', '1', '5'], ['0', '2', '10']]])
    check('explicit sequence 5', solve([[[-12, 1, 0], [12, 1, 24], ['left', 'right']]], 8), [[['-8', '1', '4'], ['8', '1', '20']]])
    check('explicit sequence 6', solve([[[0, 1, 0], [12, 1, 12], ['left', 'right']]], 8), [[['0', '1', '0'], ['8', '1', '8']]])
    check('explicit sequence 7', solve([[[0, 1, 0], [1, 1, 1], ['eye', 'left', 'right']]], 8), [[['0', '1', '0'], ['1', '1', '1']]])
    check('explicit sequence 8', solve([[[-12, 0, 0], [12, 2, 24], ['left', 'right', 'eye']]], 8), [[['0', '1', '12'], ['12', '2', '24']]])
    check('explicit sequence 9', solve([[[-15, 1, 0], [-20, 1, 5], ['left']]], 8), [None])
    check('explicit sequence 10', solve([[[0, 0, 0], [0, 1, 1], ['eye']]], 8), [[['0', '1', '1'], ['0', '1', '1']]])
    check('explicit sequence 11', solve([[[-40, 0, 0], [40, 2, 24], ['right', 'eye']]], 8), [[['0', '1', '12'], ['10', '5/4', '15']]])
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):
    from fractions import Fraction
    out=[]
    for first,last,planes in commands:
        a=list(map(Fraction,first)); b=list(map(Fraction,last))
        original_a=list(a); original_b=list(b)
        rejected=False
        for plane in planes:
            def distance(p):
                if plane=='left': return p[0]+size*p[1]
                if plane=='right': return size*p[1]-p[0]
                return p[1]-1
            da=distance(a); db=distance(original_b)
            ia=da>=0; ib=db>=0
            if not ia and not ib: rejected=True; break
            if ia and ib: continue
            t=da/(da-db)
            point=[a[i]+t*(b[i]-a[i]) for i in range(3)]
            if not ia: a=point
            else: b=point
        out.append(None if rejected else [[str(v) for v in a],[str(v) for v in b]])
    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([[[-12, 1, 0], [0, 1, 12], ['left']]], 4), [[['-4', '1', '8'], ['0', '1', '12']]])
    check('explicit sequence 1', solve([[[0, 1, 0], [12, 1, 12], ['right']]], 4), [[['0', '1', '0'], ['4', '1', '4']]])
    check('explicit sequence 2', solve([[[-20, 1, 0], [-15, 1, 5], ['left']]], 4), [None])
    check('explicit sequence 3', solve([[[-4, 1, 0], [-8, 2, 8], ['left']]], 4), [[['-4', '1', '0'], ['-8', '2', '8']]])
    check('explicit sequence 4', solve([[[0, 0, 0], [0, 2, 10], ['eye']]], 4), [[['0', '1', '5'], ['0', '2', '10']]])
    check('explicit sequence 5', solve([[[-12, 1, 0], [12, 1, 24], ['left', 'right']]], 4), [[['-4', '1', '8'], ['4', '1', '16']]])
    check('explicit sequence 6', solve([[[0, 1, 0], [12, 1, 12], ['left', 'right']]], 4), [[['0', '1', '0'], ['4', '1', '4']]])
    check('explicit sequence 7', solve([[[0, 1, 0], [1, 1, 1], ['eye', 'left', 'right']]], 4), [[['0', '1', '0'], ['1', '1', '1']]])
    check('explicit sequence 8', solve([[[-12, 0, 0], [12, 2, 24], ['left', 'right', 'eye']]], 4), [[['0', '1', '12'], ['6', '3/2', '18']]])
    check('explicit sequence 9', solve([[[-15, 1, 0], [-20, 1, 5], ['left']]], 4), [None])
    check('explicit sequence 10', solve([[[0, 0, 0], [0, 1, 1], ['eye']]], 4), [[['0', '1', '1'], ['0', '1', '1']]])
    check('explicit sequence 11', solve([[[-40, 0, 0], [40, 2, 24], ['right', 'eye']]], 4), [[['0', '1', '12'], ['40/9', '10/9', '40/3']]])
if N == 2:
    check('explicit sequence 0', solve([[[-12, 1, 0], [0, 1, 12], ['left']]], 5), [[['-5', '1', '7'], ['0', '1', '12']]])
    check('explicit sequence 1', solve([[[0, 1, 0], [12, 1, 12], ['right']]], 5), [[['0', '1', '0'], ['5', '1', '5']]])
    check('explicit sequence 2', solve([[[-20, 1, 0], [-15, 1, 5], ['left']]], 5), [None])
    check('explicit sequence 3', solve([[[-4, 1, 0], [-8, 2, 8], ['left']]], 5), [[['-4', '1', '0'], ['-8', '2', '8']]])
    check('explicit sequence 4', solve([[[0, 0, 0], [0, 2, 10], ['eye']]], 5), [[['0', '1', '5'], ['0', '2', '10']]])
    check('explicit sequence 5', solve([[[-12, 1, 0], [12, 1, 24], ['left', 'right']]], 5), [[['-5', '1', '7'], ['5', '1', '17']]])
    check('explicit sequence 6', solve([[[0, 1, 0], [12, 1, 12], ['left', 'right']]], 5), [[['0', '1', '0'], ['5', '1', '5']]])
    check('explicit sequence 7', solve([[[0, 1, 0], [1, 1, 1], ['eye', 'left', 'right']]], 5), [[['0', '1', '0'], ['1', '1', '1']]])
    check('explicit sequence 8', solve([[[-12, 0, 0], [12, 2, 24], ['left', 'right', 'eye']]], 5), [[['0', '1', '12'], ['60/7', '12/7', '144/7']]])
    check('explicit sequence 9', solve([[[-15, 1, 0], [-20, 1, 5], ['left']]], 5), [None])
    check('explicit sequence 10', solve([[[0, 0, 0], [0, 1, 1], ['eye']]], 5), [[['0', '1', '1'], ['0', '1', '1']]])
    check('explicit sequence 11', solve([[[-40, 0, 0], [40, 2, 24], ['right', 'eye']]], 5), [[['0', '1', '12'], ['40/7', '8/7', '96/7']]])
if N == 3:
    check('explicit sequence 0', solve([[[-12, 1, 0], [0, 1, 12], ['left']]], 6), [[['-6', '1', '6'], ['0', '1', '12']]])
    check('explicit sequence 1', solve([[[0, 1, 0], [12, 1, 12], ['right']]], 6), [[['0', '1', '0'], ['6', '1', '6']]])
    check('explicit sequence 2', solve([[[-20, 1, 0], [-15, 1, 5], ['left']]], 6), [None])
    check('explicit sequence 3', solve([[[-4, 1, 0], [-8, 2, 8], ['left']]], 6), [[['-4', '1', '0'], ['-8', '2', '8']]])
    check('explicit sequence 4', solve([[[0, 0, 0], [0, 2, 10], ['eye']]], 6), [[['0', '1', '5'], ['0', '2', '10']]])
    check('explicit sequence 5', solve([[[-12, 1, 0], [12, 1, 24], ['left', 'right']]], 6), [[['-6', '1', '6'], ['6', '1', '18']]])
    check('explicit sequence 6', solve([[[0, 1, 0], [12, 1, 12], ['left', 'right']]], 6), [[['0', '1', '0'], ['6', '1', '6']]])
    check('explicit sequence 7', solve([[[0, 1, 0], [1, 1, 1], ['eye', 'left', 'right']]], 6), [[['0', '1', '0'], ['1', '1', '1']]])
    check('explicit sequence 8', solve([[[-12, 0, 0], [12, 2, 24], ['left', 'right', 'eye']]], 6), [[['0', '1', '12'], ['12', '2', '24']]])
    check('explicit sequence 9', solve([[[-15, 1, 0], [-20, 1, 5], ['left']]], 6), [None])
    check('explicit sequence 10', solve([[[0, 0, 0], [0, 1, 1], ['eye']]], 6), [[['0', '1', '1'], ['0', '1', '1']]])
    check('explicit sequence 11', solve([[[-40, 0, 0], [40, 2, 24], ['right', 'eye']]], 6), [[['0', '1', '12'], ['120/17', '20/17', '240/17']]])
if N == 4:
    check('explicit sequence 0', solve([[[-12, 1, 0], [0, 1, 12], ['left']]], 7), [[['-7', '1', '5'], ['0', '1', '12']]])
    check('explicit sequence 1', solve([[[0, 1, 0], [12, 1, 12], ['right']]], 7), [[['0', '1', '0'], ['7', '1', '7']]])
    check('explicit sequence 2', solve([[[-20, 1, 0], [-15, 1, 5], ['left']]], 7), [None])
    check('explicit sequence 3', solve([[[-4, 1, 0], [-8, 2, 8], ['left']]], 7), [[['-4', '1', '0'], ['-8', '2', '8']]])
    check('explicit sequence 4', solve([[[0, 0, 0], [0, 2, 10], ['eye']]], 7), [[['0', '1', '5'], ['0', '2', '10']]])
    check('explicit sequence 5', solve([[[-12, 1, 0], [12, 1, 24], ['left', 'right']]], 7), [[['-7', '1', '5'], ['7', '1', '19']]])
    check('explicit sequence 6', solve([[[0, 1, 0], [12, 1, 12], ['left', 'right']]], 7), [[['0', '1', '0'], ['7', '1', '7']]])
    check('explicit sequence 7', solve([[[0, 1, 0], [1, 1, 1], ['eye', 'left', 'right']]], 7), [[['0', '1', '0'], ['1', '1', '1']]])
    check('explicit sequence 8', solve([[[-12, 0, 0], [12, 2, 24], ['left', 'right', 'eye']]], 7), [[['0', '1', '12'], ['12', '2', '24']]])
    check('explicit sequence 9', solve([[[-15, 1, 0], [-20, 1, 5], ['left']]], 7), [None])
    check('explicit sequence 10', solve([[[0, 0, 0], [0, 1, 1], ['eye']]], 7), [[['0', '1', '1'], ['0', '1', '1']]])
    check('explicit sequence 11', solve([[[-40, 0, 0], [40, 2, 24], ['right', 'eye']]], 7), [[['0', '1', '12'], ['280/33', '40/33', '160/11']]])
if N == 5:
    check('explicit sequence 0', solve([[[-12, 1, 0], [0, 1, 12], ['left']]], 8), [[['-8', '1', '4'], ['0', '1', '12']]])
    check('explicit sequence 1', solve([[[0, 1, 0], [12, 1, 12], ['right']]], 8), [[['0', '1', '0'], ['8', '1', '8']]])
    check('explicit sequence 2', solve([[[-20, 1, 0], [-15, 1, 5], ['left']]], 8), [None])
    check('explicit sequence 3', solve([[[-4, 1, 0], [-8, 2, 8], ['left']]], 8), [[['-4', '1', '0'], ['-8', '2', '8']]])
    check('explicit sequence 4', solve([[[0, 0, 0], [0, 2, 10], ['eye']]], 8), [[['0', '1', '5'], ['0', '2', '10']]])
    check('explicit sequence 5', solve([[[-12, 1, 0], [12, 1, 24], ['left', 'right']]], 8), [[['-8', '1', '4'], ['8', '1', '20']]])
    check('explicit sequence 6', solve([[[0, 1, 0], [12, 1, 12], ['left', 'right']]], 8), [[['0', '1', '0'], ['8', '1', '8']]])
    check('explicit sequence 7', solve([[[0, 1, 0], [1, 1, 1], ['eye', 'left', 'right']]], 8), [[['0', '1', '0'], ['1', '1', '1']]])
    check('explicit sequence 8', solve([[[-12, 0, 0], [12, 2, 24], ['left', 'right', 'eye']]], 8), [[['0', '1', '12'], ['12', '2', '24']]])
    check('explicit sequence 9', solve([[[-15, 1, 0], [-20, 1, 5], ['left']]], 8), [None])
    check('explicit sequence 10', solve([[[0, 0, 0], [0, 1, 1], ['eye']]], 8), [[['0', '1', '1'], ['0', '1', '1']]])
    check('explicit sequence 11', solve([[[-40, 0, 0], [40, 2, 24], ['right', 'eye']]], 8), [[['0', '1', '12'], ['10', '5/4', '15']]])
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:
Later planes classify original vertices rather than endpoints already clipped by earlier planes.

Clip ordered segments in homogeneous (x,w,u) coordinates against requested left x+w>=0, right w-x>=0 and eye w>=1 halfspaces. Interpolate every component at intersections before perspective division; retain endpoint order. Output exact rational strings, or null for rejected segments. The integer surface size scales horizontal halfspaces.

split: open-access


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

N = 1
observations = []
def solve(commands, size):
    out=[]
    for stream in commands:
        history=[]
        parity=0
        draws=[]
        planes=(1<<size)-1
        for vertex in stream:
            if vertex is None:
                parity=0
                continue
            history.append(vertex)
            if len(history)<3: continue
            tri=history[-3:]
            if parity%2: tri=[tri[1],tri[0],tri[2]]
            parity+=1
            if len({v[0] for v in tri})<3: continue
            common=(tri[0][1]&tri[1][1]&tri[2][1]) & planes
            if common: continue
            draws.append([v[0] for v in tri])
        out.append(draws)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 4), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 4), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 4), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 4), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 4), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 4), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 4), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 4), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 4), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 4), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 4), [[[0, 1, 2]]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 4), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 2:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 5), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 5), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 5), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 5), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 5), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 5), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 5), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 5), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 5), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 5), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 5), [[[0, 1, 2]]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 5), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 3:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 6), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 6), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 6), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 6), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 6), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 6), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 6), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 6), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 6), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 6), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 6), [[]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 6), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 4:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 7), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 7), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 7), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 7), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 7), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 7), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 7), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 7), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 7), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 7), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 7), [[]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 7), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 5:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 8), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 8), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 8), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 8), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 8), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 8), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 8), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 8), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 8), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 8), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 8), [[]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 8), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
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):
    out=[]
    for stream in commands:
        history=[]
        parity=0
        draws=[]
        planes=(1<<size)-1
        for vertex in stream:
            if vertex is None:
                history=history[-1:]; parity=0
                continue
            history.append(vertex)
            if len(history)<3: continue
            tri=history[-3:]
            if parity%2: tri=[tri[1],tri[0],tri[2]]
            parity+=1
            if len({v[0] for v in tri})<3: continue
            common=(tri[0][1]&tri[1][1]&tri[2][1]) & planes
            if common: continue
            draws.append([v[0] for v in tri])
        out.append(draws)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 4), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 4), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 4), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 4), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 4), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 4), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 4), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 4), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 4), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 4), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 4), [[[0, 1, 2]]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 4), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 2:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 5), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 5), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 5), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 5), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 5), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 5), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 5), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 5), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 5), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 5), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 5), [[[0, 1, 2]]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 5), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 3:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 6), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 6), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 6), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 6), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 6), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 6), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 6), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 6), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 6), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 6), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 6), [[]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 6), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 4:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 7), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 7), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 7), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 7), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 7), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 7), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 7), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 7), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 7), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 7), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 7), [[]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 7), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 5:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 8), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 8), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 8), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 8), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 8), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 8), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 8), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 8), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 8), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 8), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 8), [[]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 8), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
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:
Primitive restart retains vertices from the previous strip.

A vertex is [ID,outside-plane-bits]. Restart is null. Emit oriented triangle-strip primitives only when three distinct IDs exist and the three outside-plane masks have no common active bit. Strip parity advances for every assembled triangle including rejected/degenerate ones; restart clears both vertex history and parity. Only low size plane bits are active.

split: open-access


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

N = 1
observations = []
def solve(commands, size):
    out=[]
    for stream in commands:
        history=[]
        parity=0
        draws=[]
        planes=(1<<size)-1
        for vertex in stream:
            if vertex is None:
                history=[]
                continue
            history.append(vertex)
            if len(history)<3: continue
            tri=history[-3:]
            if parity%2: tri=[tri[1],tri[0],tri[2]]
            parity+=1
            if len({v[0] for v in tri})<3: continue
            common=(tri[0][1]&tri[1][1]&tri[2][1]) & planes
            if common: continue
            draws.append([v[0] for v in tri])
        out.append(draws)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 4), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 4), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 4), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 4), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 4), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 4), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 4), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 4), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 4), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 4), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 4), [[[0, 1, 2]]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 4), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 2:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 5), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 5), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 5), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 5), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 5), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 5), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 5), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 5), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 5), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 5), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 5), [[[0, 1, 2]]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 5), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 3:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 6), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 6), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 6), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 6), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 6), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 6), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 6), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 6), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 6), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 6), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 6), [[]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 6), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 4:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 7), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 7), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 7), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 7), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 7), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 7), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 7), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 7), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 7), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 7), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 7), [[]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 7), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 5:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 8), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 8), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 8), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 8), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 8), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 8), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 8), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 8), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 8), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 8), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 8), [[]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 8), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
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):
    out=[]
    for stream in commands:
        history=[]
        parity=0
        draws=[]
        planes=(1<<size)-1
        for vertex in stream:
            if vertex is None:
                history=[]; parity=max(0,parity-1)
                continue
            history.append(vertex)
            if len(history)<3: continue
            tri=history[-3:]
            if parity%2: tri=[tri[1],tri[0],tri[2]]
            parity+=1
            if len({v[0] for v in tri})<3: continue
            common=(tri[0][1]&tri[1][1]&tri[2][1]) & planes
            if common: continue
            draws.append([v[0] for v in tri])
        out.append(draws)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 4), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 4), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 4), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 4), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 4), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 4), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 4), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 4), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 4), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 4), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 4), [[[0, 1, 2]]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 4), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 2:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 5), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 5), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 5), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 5), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 5), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 5), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 5), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 5), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 5), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 5), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 5), [[[0, 1, 2]]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 5), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 3:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 6), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 6), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 6), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 6), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 6), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 6), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 6), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 6), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 6), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 6), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 6), [[]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 6), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 4:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 7), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 7), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 7), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 7), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 7), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 7), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 7), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 7), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 7), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 7), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 7), [[]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 7), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 5:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 8), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 8), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 8), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 8), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 8), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 8), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 8), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 8), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 8), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 8), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 8), [[]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 8), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
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:
Primitive restart does not reset winding parity.

A vertex is [ID,outside-plane-bits]. Restart is null. Emit oriented triangle-strip primitives only when three distinct IDs exist and the three outside-plane masks have no common active bit. Strip parity advances for every assembled triangle including rejected/degenerate ones; restart clears both vertex history and parity. Only low size plane bits are active.

split: open-access


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

N = 1
observations = []
def solve(commands, size):
    out=[]
    for stream in commands:
        history=[]
        parity=0
        draws=[]
        planes=(1<<size)-1
        for vertex in stream:
            if vertex is None:
                history=[]; parity=0
                continue
            history.append(vertex)
            if len(history)<3: continue
            tri=history[:3]
            if parity%2: tri=[tri[1],tri[0],tri[2]]
            parity+=1
            if len({v[0] for v in tri})<3: continue
            common=(tri[0][1]&tri[1][1]&tri[2][1]) & planes
            if common: continue
            draws.append([v[0] for v in tri])
        out.append(draws)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 4), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 4), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 4), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 4), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 4), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 4), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 4), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 4), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 4), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 4), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 4), [[[0, 1, 2]]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 4), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 2:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 5), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 5), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 5), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 5), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 5), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 5), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 5), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 5), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 5), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 5), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 5), [[[0, 1, 2]]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 5), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 3:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 6), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 6), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 6), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 6), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 6), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 6), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 6), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 6), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 6), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 6), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 6), [[]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 6), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 4:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 7), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 7), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 7), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 7), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 7), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 7), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 7), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 7), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 7), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 7), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 7), [[]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 7), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 5:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 8), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 8), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 8), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 8), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 8), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 8), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 8), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 8), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 8), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 8), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 8), [[]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 8), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
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):
    out=[]
    for stream in commands:
        history=[]
        parity=0
        draws=[]
        planes=(1<<size)-1
        for vertex in stream:
            if vertex is None:
                history=[]; parity=0
                continue
            history.append(vertex)
            if len(history)<3: continue
            tri=[history[0],history[-2],history[-1]]
            if parity%2: tri=[tri[1],tri[0],tri[2]]
            parity+=1
            if len({v[0] for v in tri})<3: continue
            common=(tri[0][1]&tri[1][1]&tri[2][1]) & planes
            if common: continue
            draws.append([v[0] for v in tri])
        out.append(draws)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 4), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 4), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 4), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 4), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 4), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 4), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 4), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 4), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 4), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 4), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 4), [[[0, 1, 2]]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 4), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 2:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 5), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 5), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 5), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 5), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 5), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 5), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 5), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 5), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 5), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 5), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 5), [[[0, 1, 2]]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 5), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 3:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 6), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 6), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 6), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 6), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 6), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 6), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 6), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 6), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 6), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 6), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 6), [[]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 6), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 4:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 7), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 7), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 7), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 7), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 7), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 7), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 7), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 7), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 7), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 7), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 7), [[]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 7), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 5:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 8), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 8), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 8), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 8), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 8), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 8), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 8), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 8), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 8), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 8), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 8), [[]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 8), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
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:
Every triangle reuses the first three strip vertices.

A vertex is [ID,outside-plane-bits]. Restart is null. Emit oriented triangle-strip primitives only when three distinct IDs exist and the three outside-plane masks have no common active bit. Strip parity advances for every assembled triangle including rejected/degenerate ones; restart clears both vertex history and parity. Only low size plane bits are active.

split: open-access


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

N = 1
observations = []
def solve(commands, size):
    out=[]
    for stream in commands:
        history=[]
        parity=0
        draws=[]
        planes=(1<<size)-1
        for vertex in stream:
            if vertex is None:
                history=[]; parity=0
                continue
            history.append(vertex)
            if len(history)<3: continue
            tri=history[-3:]
            if parity%2==0: tri=[tri[1],tri[0],tri[2]]
            parity+=1
            if len({v[0] for v in tri})<3: continue
            common=(tri[0][1]&tri[1][1]&tri[2][1]) & planes
            if common: continue
            draws.append([v[0] for v in tri])
        out.append(draws)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 4), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 4), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 4), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 4), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 4), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 4), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 4), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 4), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 4), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 4), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 4), [[[0, 1, 2]]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 4), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 2:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 5), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 5), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 5), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 5), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 5), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 5), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 5), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 5), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 5), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 5), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 5), [[[0, 1, 2]]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 5), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 3:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 6), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 6), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 6), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 6), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 6), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 6), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 6), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 6), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 6), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 6), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 6), [[]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 6), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 4:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 7), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 7), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 7), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 7), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 7), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 7), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 7), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 7), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 7), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 7), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 7), [[]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 7), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 5:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 8), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 8), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 8), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 8), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 8), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 8), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 8), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 8), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 8), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 8), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 8), [[]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 8), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
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):
    out=[]
    for stream in commands:
        history=[]
        parity=0
        draws=[]
        planes=(1<<size)-1
        for vertex in stream:
            if vertex is None:
                history=[]; parity=0
                continue
            history.append(vertex)
            if len(history)<3: continue
            tri=history[-3:]
            if parity>0: tri=[tri[1],tri[0],tri[2]]
            parity+=1
            if len({v[0] for v in tri})<3: continue
            common=(tri[0][1]&tri[1][1]&tri[2][1]) & planes
            if common: continue
            draws.append([v[0] for v in tri])
        out.append(draws)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 4), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 4), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 4), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 4), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 4), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 4), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 4), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 4), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 4), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 4), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 4), [[[0, 1, 2]]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 4), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 2:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 5), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 5), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 5), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 5), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 5), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 5), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 5), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 5), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 5), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 5), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 5), [[[0, 1, 2]]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 5), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 3:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 6), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 6), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 6), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 6), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 6), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 6), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 6), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 6), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 6), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 6), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 6), [[]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 6), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 4:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 7), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 7), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 7), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 7), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 7), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 7), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 7), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 7), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 7), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 7), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 7), [[]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 7), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 5:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 8), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 8), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 8), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 8), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 8), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 8), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 8), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 8), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 8), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 8), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 8), [[]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 8), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
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:
Alternating triangle orientation starts with the wrong parity.

A vertex is [ID,outside-plane-bits]. Restart is null. Emit oriented triangle-strip primitives only when three distinct IDs exist and the three outside-plane masks have no common active bit. Strip parity advances for every assembled triangle including rejected/degenerate ones; restart clears both vertex history and parity. Only low size plane bits are active.

split: open-access


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

N = 1
observations = []
def solve(commands, size):
    out=[]
    for stream in commands:
        history=[]
        parity=0
        draws=[]
        planes=(1<<size)-1
        for vertex in stream:
            if vertex is None:
                history=[]; parity=0
                continue
            history.append(vertex)
            if len(history)<3: continue
            tri=history[-3:]
            if parity%2: tri=[tri[0],tri[2],tri[1]]
            parity+=1
            if len({v[0] for v in tri})<3: continue
            common=(tri[0][1]&tri[1][1]&tri[2][1]) & planes
            if common: continue
            draws.append([v[0] for v in tri])
        out.append(draws)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 4), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 4), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 4), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 4), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 4), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 4), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 4), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 4), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 4), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 4), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 4), [[[0, 1, 2]]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 4), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 2:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 5), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 5), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 5), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 5), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 5), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 5), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 5), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 5), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 5), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 5), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 5), [[[0, 1, 2]]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 5), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 3:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 6), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 6), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 6), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 6), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 6), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 6), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 6), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 6), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 6), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 6), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 6), [[]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 6), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 4:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 7), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 7), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 7), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 7), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 7), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 7), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 7), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 7), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 7), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 7), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 7), [[]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 7), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 5:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 8), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 8), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 8), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 8), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 8), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 8), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 8), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 8), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 8), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 8), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 8), [[]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 8), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
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):
    out=[]
    for stream in commands:
        history=[]
        parity=0
        draws=[]
        planes=(1<<size)-1
        for vertex in stream:
            if vertex is None:
                history=[]; parity=0
                continue
            history.append(vertex)
            if len(history)<3: continue
            tri=history[-3:]
            if parity%2: tri=list(reversed(tri))
            parity+=1
            if len({v[0] for v in tri})<3: continue
            common=(tri[0][1]&tri[1][1]&tri[2][1]) & planes
            if common: continue
            draws.append([v[0] for v in tri])
        out.append(draws)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 4), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 4), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 4), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 4), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 4), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 4), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 4), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 4), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 4), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 4), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 4), [[[0, 1, 2]]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 4), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 2:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 5), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 5), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 5), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 5), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 5), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 5), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 5), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 5), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 5), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 5), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 5), [[[0, 1, 2]]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 5), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 3:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 6), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 6), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 6), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 6), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 6), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 6), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 6), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 6), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 6), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 6), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 6), [[]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 6), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 4:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 7), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 7), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 7), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 7), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 7), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 7), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 7), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 7), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 7), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 7), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 7), [[]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 7), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
if N == 5:
    check('explicit sequence 0', solve([[[0, 0], [1, 0], [2, 0], None, [3, 0], [4, 0], [5, 0]]], 8), [[[0, 1, 2], [3, 4, 5]]])
    check('explicit sequence 1', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 8), [[[0, 1, 2], [2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 2', solve([[[0, 0], [1, 0], [1, 0], [2, 0], [3, 0], [4, 0]]], 8), [[[1, 2, 3], [3, 2, 4]]])
    check('explicit sequence 3', solve([[[0, 1], [1, 1], [2, 1], [3, 0], [4, 0]]], 8), [[[2, 1, 3], [2, 3, 4]]])
    check('explicit sequence 4', solve([[[0, 1], [1, 1], [2, 0]]], 8), [[[0, 1, 2]]])
    check('explicit sequence 5', solve([[[0, 512], [1, 512], [2, 512]]], 8), [[[0, 1, 2]]])
    check('explicit sequence 6', solve([[[0, 1], [1, 1], [2, 1]]], 8), [[]])
    check('explicit sequence 7', solve([[[0, 0], [1, 0], [0, 0], [2, 0], [3, 0]]], 8), [[[0, 1, 2], [0, 2, 3]]])
    check('explicit sequence 8', solve([[None, [0, 0], [1, 0]]], 8), [[]])
    check('explicit sequence 9', solve([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], None, [5, 0], [6, 0], [7, 0]]], 8), [[[0, 1, 2], [2, 1, 3], [2, 3, 4], [5, 6, 7]]])
    check('explicit sequence 10', solve([[[0, 32], [1, 32], [2, 32]]], 8), [[]])
    check('explicit sequence 11', solve([[[0, 0], [1, 0], [2, 0], [3, 0], None, [4, 0], [5, 0], [6, 0]]], 8), [[[0, 1, 2], [2, 1, 3], [4, 5, 6]]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Odd strip winding changes the final provoking vertex.

A vertex is [ID,outside-plane-bits]. Restart is null. Emit oriented triangle-strip primitives only when three distinct IDs exist and the three outside-plane masks have no common active bit. Strip parity advances for every assembled triangle including rejected/degenerate ones; restart clears both vertex history and parity. Only low size plane bits are active.

split: open-access