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

N = 1
observations = []
def solve(d):
    try:
        value,scalar_valid,row_valid,selection=d
        out=[]
        for row in selection:
            known=scalar_valid and row_valid[row]
            out.append([len(out),value if known else None])
        return out
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('selected validity', solve([1, True, [True, False, True], [2, 1, 0]]), [[2, 1], [1, None], [0, 1]])
    check('scalar null', solve([1, False, [True, True], [0, 1]]), [[0, None], [1, None]])
    check('mixed row null', solve([1, True, [False, True], [1, 0]]), [[1, 1], [0, None]])
    check('zero constant', solve([0, True, [True], [0]]), [[0, 0]])
    check('repeat row', solve([1, True, [True, True], [1, 1]]), [[1, 1], [1, 1]])
    check('empty selection', solve([1, True, [True], []]), [])
    check('single row control', solve([1, True, [True], [0]]), [[0, 1]])
elif N == 2:
    check('selected validity', solve([2, True, [True, False, True], [2, 1, 0]]), [[2, 2], [1, None], [0, 2]])
    check('scalar null', solve([2, False, [True, True], [0, 1]]), [[0, None], [1, None]])
    check('mixed row null', solve([2, True, [False, True], [1, 0]]), [[1, 2], [0, None]])
    check('zero constant', solve([0, True, [True], [0]]), [[0, 0]])
    check('repeat row', solve([2, True, [True, True], [1, 1]]), [[1, 2], [1, 2]])
    check('empty selection', solve([2, True, [True], []]), [])
    check('single row control', solve([2, True, [True], [0]]), [[0, 2]])
elif N == 3:
    check('selected validity', solve([3, True, [True, False, True], [2, 1, 0]]), [[2, 3], [1, None], [0, 3]])
    check('scalar null', solve([3, False, [True, True], [0, 1]]), [[0, None], [1, None]])
    check('mixed row null', solve([3, True, [False, True], [1, 0]]), [[1, 3], [0, None]])
    check('zero constant', solve([0, True, [True], [0]]), [[0, 0]])
    check('repeat row', solve([3, True, [True, True], [1, 1]]), [[1, 3], [1, 3]])
    check('empty selection', solve([3, True, [True], []]), [])
    check('single row control', solve([3, True, [True], [0]]), [[0, 3]])
elif N == 4:
    check('selected validity', solve([4, True, [True, False, True], [2, 1, 0]]), [[2, 4], [1, None], [0, 4]])
    check('scalar null', solve([4, False, [True, True], [0, 1]]), [[0, None], [1, None]])
    check('mixed row null', solve([4, True, [False, True], [1, 0]]), [[1, 4], [0, None]])
    check('zero constant', solve([0, True, [True], [0]]), [[0, 0]])
    check('repeat row', solve([4, True, [True, True], [1, 1]]), [[1, 4], [1, 4]])
    check('empty selection', solve([4, True, [True], []]), [])
    check('single row control', solve([4, True, [True], [0]]), [[0, 4]])
elif N == 5:
    check('selected validity', solve([5, True, [True, False, True], [2, 1, 0]]), [[2, 5], [1, None], [0, 5]])
    check('scalar null', solve([5, False, [True, True], [0, 1]]), [[0, None], [1, None]])
    check('mixed row null', solve([5, True, [False, True], [1, 0]]), [[1, 5], [0, None]])
    check('zero constant', solve([0, True, [True], [0]]), [[0, 0]])
    check('repeat row', solve([5, True, [True, True], [1, 1]]), [[1, 5], [1, 5]])
    check('empty selection', solve([5, True, [True], []]), [])
    check('single row control', solve([5, True, [True], [0]]), [[0, 5]])
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(d):
    try:
        value,scalar_valid,row_valid,selection=d
        out=[]
        for row in selection:
            known=scalar_valid and row_valid[row]
            out.append([0,value if known else None])
        return out
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('selected validity', solve([1, True, [True, False, True], [2, 1, 0]]), [[2, 1], [1, None], [0, 1]])
    check('scalar null', solve([1, False, [True, True], [0, 1]]), [[0, None], [1, None]])
    check('mixed row null', solve([1, True, [False, True], [1, 0]]), [[1, 1], [0, None]])
    check('zero constant', solve([0, True, [True], [0]]), [[0, 0]])
    check('repeat row', solve([1, True, [True, True], [1, 1]]), [[1, 1], [1, 1]])
    check('empty selection', solve([1, True, [True], []]), [])
    check('single row control', solve([1, True, [True], [0]]), [[0, 1]])
elif N == 2:
    check('selected validity', solve([2, True, [True, False, True], [2, 1, 0]]), [[2, 2], [1, None], [0, 2]])
    check('scalar null', solve([2, False, [True, True], [0, 1]]), [[0, None], [1, None]])
    check('mixed row null', solve([2, True, [False, True], [1, 0]]), [[1, 2], [0, None]])
    check('zero constant', solve([0, True, [True], [0]]), [[0, 0]])
    check('repeat row', solve([2, True, [True, True], [1, 1]]), [[1, 2], [1, 2]])
    check('empty selection', solve([2, True, [True], []]), [])
    check('single row control', solve([2, True, [True], [0]]), [[0, 2]])
elif N == 3:
    check('selected validity', solve([3, True, [True, False, True], [2, 1, 0]]), [[2, 3], [1, None], [0, 3]])
    check('scalar null', solve([3, False, [True, True], [0, 1]]), [[0, None], [1, None]])
    check('mixed row null', solve([3, True, [False, True], [1, 0]]), [[1, 3], [0, None]])
    check('zero constant', solve([0, True, [True], [0]]), [[0, 0]])
    check('repeat row', solve([3, True, [True, True], [1, 1]]), [[1, 3], [1, 3]])
    check('empty selection', solve([3, True, [True], []]), [])
    check('single row control', solve([3, True, [True], [0]]), [[0, 3]])
elif N == 4:
    check('selected validity', solve([4, True, [True, False, True], [2, 1, 0]]), [[2, 4], [1, None], [0, 4]])
    check('scalar null', solve([4, False, [True, True], [0, 1]]), [[0, None], [1, None]])
    check('mixed row null', solve([4, True, [False, True], [1, 0]]), [[1, 4], [0, None]])
    check('zero constant', solve([0, True, [True], [0]]), [[0, 0]])
    check('repeat row', solve([4, True, [True, True], [1, 1]]), [[1, 4], [1, 4]])
    check('empty selection', solve([4, True, [True], []]), [])
    check('single row control', solve([4, True, [True], [0]]), [[0, 4]])
elif N == 5:
    check('selected validity', solve([5, True, [True, False, True], [2, 1, 0]]), [[2, 5], [1, None], [0, 5]])
    check('scalar null', solve([5, False, [True, True], [0, 1]]), [[0, None], [1, None]])
    check('mixed row null', solve([5, True, [False, True], [1, 0]]), [[1, 5], [0, None]])
    check('zero constant', solve([0, True, [True], [0]]), [[0, 0]])
    check('repeat row', solve([5, True, [True, True], [1, 1]]), [[1, 5], [1, 5]])
    check('empty selection', solve([5, True, [True], []]), [])
    check('single row control', solve([5, True, [True], [0]]), [[0, 5]])
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:
Constant vector loses source row ordinals in output.

Materialize a constant vector over a requested logical length, combining scalar validity with row validity. A selection chooses logical rows and may repeat them. Return [row-index,value-or-null] for every selected row; scalar zero is a valid value.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        values,valid,updates=d
        values=list(values); valid=list(valid)
        for target,value,known,selected in updates:
            if False: continue
            values[target]=value
            valid[target]=known
        return [v if valid[i] else None for i,v in enumerate(values)]
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('nonzero target', solve([[1, 2, 3], [True, True, True], [[2, 4, True, True]]]), [1, 2, 4])
    check('masked value', solve([[1, 2], [True, True], [[1, 3, True, False]]]), [1, 2])
    check('masked null', solve([[1, 2], [True, True], [[1, 3, False, False]]]), [1, 2])
    check('selected null', solve([[1, 2], [True, True], [[1, 3, False, True]]]), [1, None])
    check('resurrect null', solve([[1, 2], [True, False], [[1, 3, True, True]]]), [1, 3])
    check('repeated target', solve([[1, 2], [True, True], [[1, 3, True, True], [1, 4, True, True]]]), [1, 4])
    check('middle validity', solve([[1, 2, 3], [True, True, True], [[1, 4, False, True]]]), [1, None, 3])
    check('no writes', solve([[1, 2], [False, True], []]), [None, 2])
elif N == 2:
    check('nonzero target', solve([[2, 3, 4], [True, True, True], [[2, 5, True, True]]]), [2, 3, 5])
    check('masked value', solve([[2, 3], [True, True], [[1, 4, True, False]]]), [2, 3])
    check('masked null', solve([[2, 3], [True, True], [[1, 4, False, False]]]), [2, 3])
    check('selected null', solve([[2, 3], [True, True], [[1, 4, False, True]]]), [2, None])
    check('resurrect null', solve([[2, 3], [True, False], [[1, 4, True, True]]]), [2, 4])
    check('repeated target', solve([[2, 3], [True, True], [[1, 4, True, True], [1, 5, True, True]]]), [2, 5])
    check('middle validity', solve([[2, 3, 4], [True, True, True], [[1, 5, False, True]]]), [2, None, 4])
    check('no writes', solve([[2, 3], [False, True], []]), [None, 3])
elif N == 3:
    check('nonzero target', solve([[3, 4, 5], [True, True, True], [[2, 6, True, True]]]), [3, 4, 6])
    check('masked value', solve([[3, 4], [True, True], [[1, 5, True, False]]]), [3, 4])
    check('masked null', solve([[3, 4], [True, True], [[1, 5, False, False]]]), [3, 4])
    check('selected null', solve([[3, 4], [True, True], [[1, 5, False, True]]]), [3, None])
    check('resurrect null', solve([[3, 4], [True, False], [[1, 5, True, True]]]), [3, 5])
    check('repeated target', solve([[3, 4], [True, True], [[1, 5, True, True], [1, 6, True, True]]]), [3, 6])
    check('middle validity', solve([[3, 4, 5], [True, True, True], [[1, 6, False, True]]]), [3, None, 5])
    check('no writes', solve([[3, 4], [False, True], []]), [None, 4])
elif N == 4:
    check('nonzero target', solve([[4, 5, 6], [True, True, True], [[2, 7, True, True]]]), [4, 5, 7])
    check('masked value', solve([[4, 5], [True, True], [[1, 6, True, False]]]), [4, 5])
    check('masked null', solve([[4, 5], [True, True], [[1, 6, False, False]]]), [4, 5])
    check('selected null', solve([[4, 5], [True, True], [[1, 6, False, True]]]), [4, None])
    check('resurrect null', solve([[4, 5], [True, False], [[1, 6, True, True]]]), [4, 6])
    check('repeated target', solve([[4, 5], [True, True], [[1, 6, True, True], [1, 7, True, True]]]), [4, 7])
    check('middle validity', solve([[4, 5, 6], [True, True, True], [[1, 7, False, True]]]), [4, None, 6])
    check('no writes', solve([[4, 5], [False, True], []]), [None, 5])
elif N == 5:
    check('nonzero target', solve([[5, 6, 7], [True, True, True], [[2, 8, True, True]]]), [5, 6, 8])
    check('masked value', solve([[5, 6], [True, True], [[1, 7, True, False]]]), [5, 6])
    check('masked null', solve([[5, 6], [True, True], [[1, 7, False, False]]]), [5, 6])
    check('selected null', solve([[5, 6], [True, True], [[1, 7, False, True]]]), [5, None])
    check('resurrect null', solve([[5, 6], [True, False], [[1, 7, True, True]]]), [5, 7])
    check('repeated target', solve([[5, 6], [True, True], [[1, 7, True, True], [1, 8, True, True]]]), [5, 8])
    check('middle validity', solve([[5, 6, 7], [True, True, True], [[1, 8, False, True]]]), [5, None, 7])
    check('no writes', solve([[5, 6], [False, True], []]), [None, 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(d):
    try:
        values,valid,updates=d
        values=list(values); valid=list(valid)
        for target,value,known,selected in updates:
            if not selected and known: continue
            values[target]=value
            valid[target]=known
        return [v if valid[i] else None for i,v in enumerate(values)]
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('nonzero target', solve([[1, 2, 3], [True, True, True], [[2, 4, True, True]]]), [1, 2, 4])
    check('masked value', solve([[1, 2], [True, True], [[1, 3, True, False]]]), [1, 2])
    check('masked null', solve([[1, 2], [True, True], [[1, 3, False, False]]]), [1, 2])
    check('selected null', solve([[1, 2], [True, True], [[1, 3, False, True]]]), [1, None])
    check('resurrect null', solve([[1, 2], [True, False], [[1, 3, True, True]]]), [1, 3])
    check('repeated target', solve([[1, 2], [True, True], [[1, 3, True, True], [1, 4, True, True]]]), [1, 4])
    check('middle validity', solve([[1, 2, 3], [True, True, True], [[1, 4, False, True]]]), [1, None, 3])
    check('no writes', solve([[1, 2], [False, True], []]), [None, 2])
elif N == 2:
    check('nonzero target', solve([[2, 3, 4], [True, True, True], [[2, 5, True, True]]]), [2, 3, 5])
    check('masked value', solve([[2, 3], [True, True], [[1, 4, True, False]]]), [2, 3])
    check('masked null', solve([[2, 3], [True, True], [[1, 4, False, False]]]), [2, 3])
    check('selected null', solve([[2, 3], [True, True], [[1, 4, False, True]]]), [2, None])
    check('resurrect null', solve([[2, 3], [True, False], [[1, 4, True, True]]]), [2, 4])
    check('repeated target', solve([[2, 3], [True, True], [[1, 4, True, True], [1, 5, True, True]]]), [2, 5])
    check('middle validity', solve([[2, 3, 4], [True, True, True], [[1, 5, False, True]]]), [2, None, 4])
    check('no writes', solve([[2, 3], [False, True], []]), [None, 3])
elif N == 3:
    check('nonzero target', solve([[3, 4, 5], [True, True, True], [[2, 6, True, True]]]), [3, 4, 6])
    check('masked value', solve([[3, 4], [True, True], [[1, 5, True, False]]]), [3, 4])
    check('masked null', solve([[3, 4], [True, True], [[1, 5, False, False]]]), [3, 4])
    check('selected null', solve([[3, 4], [True, True], [[1, 5, False, True]]]), [3, None])
    check('resurrect null', solve([[3, 4], [True, False], [[1, 5, True, True]]]), [3, 5])
    check('repeated target', solve([[3, 4], [True, True], [[1, 5, True, True], [1, 6, True, True]]]), [3, 6])
    check('middle validity', solve([[3, 4, 5], [True, True, True], [[1, 6, False, True]]]), [3, None, 5])
    check('no writes', solve([[3, 4], [False, True], []]), [None, 4])
elif N == 4:
    check('nonzero target', solve([[4, 5, 6], [True, True, True], [[2, 7, True, True]]]), [4, 5, 7])
    check('masked value', solve([[4, 5], [True, True], [[1, 6, True, False]]]), [4, 5])
    check('masked null', solve([[4, 5], [True, True], [[1, 6, False, False]]]), [4, 5])
    check('selected null', solve([[4, 5], [True, True], [[1, 6, False, True]]]), [4, None])
    check('resurrect null', solve([[4, 5], [True, False], [[1, 6, True, True]]]), [4, 6])
    check('repeated target', solve([[4, 5], [True, True], [[1, 6, True, True], [1, 7, True, True]]]), [4, 7])
    check('middle validity', solve([[4, 5, 6], [True, True, True], [[1, 7, False, True]]]), [4, None, 6])
    check('no writes', solve([[4, 5], [False, True], []]), [None, 5])
elif N == 5:
    check('nonzero target', solve([[5, 6, 7], [True, True, True], [[2, 8, True, True]]]), [5, 6, 8])
    check('masked value', solve([[5, 6], [True, True], [[1, 7, True, False]]]), [5, 6])
    check('masked null', solve([[5, 6], [True, True], [[1, 7, False, False]]]), [5, 6])
    check('selected null', solve([[5, 6], [True, True], [[1, 7, False, True]]]), [5, None])
    check('resurrect null', solve([[5, 6], [True, False], [[1, 7, True, True]]]), [5, 7])
    check('repeated target', solve([[5, 6], [True, True], [[1, 7, True, True], [1, 8, True, True]]]), [5, 8])
    check('middle validity', solve([[5, 6, 7], [True, True, True], [[1, 8, False, True]]]), [5, None, 7])
    check('no writes', solve([[5, 6], [False, True], []]), [None, 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:
Scatter writes lanes disabled by the update selection mask.

Apply an ordered scatter update to a column using [target-index,value,is-valid,is-selected] records. Unselected writes do nothing; selected null writes clear validity. Repeated targets use the final selected write, and untouched lanes retain both payload visibility and validity.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        values,valid,updates=d
        values=list(values); valid=list(valid)
        for target,value,known,selected in updates:
            if not selected: continue
            values[updates.index([target,value,known,selected])]=value
            valid[target]=known
        return [v if valid[i] else None for i,v in enumerate(values)]
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('nonzero target', solve([[1, 2, 3], [True, True, True], [[2, 4, True, True]]]), [1, 2, 4])
    check('masked value', solve([[1, 2], [True, True], [[1, 3, True, False]]]), [1, 2])
    check('masked null', solve([[1, 2], [True, True], [[1, 3, False, False]]]), [1, 2])
    check('selected null', solve([[1, 2], [True, True], [[1, 3, False, True]]]), [1, None])
    check('resurrect null', solve([[1, 2], [True, False], [[1, 3, True, True]]]), [1, 3])
    check('repeated target', solve([[1, 2], [True, True], [[1, 3, True, True], [1, 4, True, True]]]), [1, 4])
    check('middle validity', solve([[1, 2, 3], [True, True, True], [[1, 4, False, True]]]), [1, None, 3])
    check('no writes', solve([[1, 2], [False, True], []]), [None, 2])
elif N == 2:
    check('nonzero target', solve([[2, 3, 4], [True, True, True], [[2, 5, True, True]]]), [2, 3, 5])
    check('masked value', solve([[2, 3], [True, True], [[1, 4, True, False]]]), [2, 3])
    check('masked null', solve([[2, 3], [True, True], [[1, 4, False, False]]]), [2, 3])
    check('selected null', solve([[2, 3], [True, True], [[1, 4, False, True]]]), [2, None])
    check('resurrect null', solve([[2, 3], [True, False], [[1, 4, True, True]]]), [2, 4])
    check('repeated target', solve([[2, 3], [True, True], [[1, 4, True, True], [1, 5, True, True]]]), [2, 5])
    check('middle validity', solve([[2, 3, 4], [True, True, True], [[1, 5, False, True]]]), [2, None, 4])
    check('no writes', solve([[2, 3], [False, True], []]), [None, 3])
elif N == 3:
    check('nonzero target', solve([[3, 4, 5], [True, True, True], [[2, 6, True, True]]]), [3, 4, 6])
    check('masked value', solve([[3, 4], [True, True], [[1, 5, True, False]]]), [3, 4])
    check('masked null', solve([[3, 4], [True, True], [[1, 5, False, False]]]), [3, 4])
    check('selected null', solve([[3, 4], [True, True], [[1, 5, False, True]]]), [3, None])
    check('resurrect null', solve([[3, 4], [True, False], [[1, 5, True, True]]]), [3, 5])
    check('repeated target', solve([[3, 4], [True, True], [[1, 5, True, True], [1, 6, True, True]]]), [3, 6])
    check('middle validity', solve([[3, 4, 5], [True, True, True], [[1, 6, False, True]]]), [3, None, 5])
    check('no writes', solve([[3, 4], [False, True], []]), [None, 4])
elif N == 4:
    check('nonzero target', solve([[4, 5, 6], [True, True, True], [[2, 7, True, True]]]), [4, 5, 7])
    check('masked value', solve([[4, 5], [True, True], [[1, 6, True, False]]]), [4, 5])
    check('masked null', solve([[4, 5], [True, True], [[1, 6, False, False]]]), [4, 5])
    check('selected null', solve([[4, 5], [True, True], [[1, 6, False, True]]]), [4, None])
    check('resurrect null', solve([[4, 5], [True, False], [[1, 6, True, True]]]), [4, 6])
    check('repeated target', solve([[4, 5], [True, True], [[1, 6, True, True], [1, 7, True, True]]]), [4, 7])
    check('middle validity', solve([[4, 5, 6], [True, True, True], [[1, 7, False, True]]]), [4, None, 6])
    check('no writes', solve([[4, 5], [False, True], []]), [None, 5])
elif N == 5:
    check('nonzero target', solve([[5, 6, 7], [True, True, True], [[2, 8, True, True]]]), [5, 6, 8])
    check('masked value', solve([[5, 6], [True, True], [[1, 7, True, False]]]), [5, 6])
    check('masked null', solve([[5, 6], [True, True], [[1, 7, False, False]]]), [5, 6])
    check('selected null', solve([[5, 6], [True, True], [[1, 7, False, True]]]), [5, None])
    check('resurrect null', solve([[5, 6], [True, False], [[1, 7, True, True]]]), [5, 7])
    check('repeated target', solve([[5, 6], [True, True], [[1, 7, True, True], [1, 8, True, True]]]), [5, 8])
    check('middle validity', solve([[5, 6, 7], [True, True, True], [[1, 8, False, True]]]), [5, None, 7])
    check('no writes', solve([[5, 6], [False, True], []]), [None, 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(d):
    try:
        values,valid,updates=d
        values=list(values); valid=list(valid)
        for target,value,known,selected in updates:
            if not selected: continue
            values[0]=value
            valid[target]=known
        return [v if valid[i] else None for i,v in enumerate(values)]
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('nonzero target', solve([[1, 2, 3], [True, True, True], [[2, 4, True, True]]]), [1, 2, 4])
    check('masked value', solve([[1, 2], [True, True], [[1, 3, True, False]]]), [1, 2])
    check('masked null', solve([[1, 2], [True, True], [[1, 3, False, False]]]), [1, 2])
    check('selected null', solve([[1, 2], [True, True], [[1, 3, False, True]]]), [1, None])
    check('resurrect null', solve([[1, 2], [True, False], [[1, 3, True, True]]]), [1, 3])
    check('repeated target', solve([[1, 2], [True, True], [[1, 3, True, True], [1, 4, True, True]]]), [1, 4])
    check('middle validity', solve([[1, 2, 3], [True, True, True], [[1, 4, False, True]]]), [1, None, 3])
    check('no writes', solve([[1, 2], [False, True], []]), [None, 2])
elif N == 2:
    check('nonzero target', solve([[2, 3, 4], [True, True, True], [[2, 5, True, True]]]), [2, 3, 5])
    check('masked value', solve([[2, 3], [True, True], [[1, 4, True, False]]]), [2, 3])
    check('masked null', solve([[2, 3], [True, True], [[1, 4, False, False]]]), [2, 3])
    check('selected null', solve([[2, 3], [True, True], [[1, 4, False, True]]]), [2, None])
    check('resurrect null', solve([[2, 3], [True, False], [[1, 4, True, True]]]), [2, 4])
    check('repeated target', solve([[2, 3], [True, True], [[1, 4, True, True], [1, 5, True, True]]]), [2, 5])
    check('middle validity', solve([[2, 3, 4], [True, True, True], [[1, 5, False, True]]]), [2, None, 4])
    check('no writes', solve([[2, 3], [False, True], []]), [None, 3])
elif N == 3:
    check('nonzero target', solve([[3, 4, 5], [True, True, True], [[2, 6, True, True]]]), [3, 4, 6])
    check('masked value', solve([[3, 4], [True, True], [[1, 5, True, False]]]), [3, 4])
    check('masked null', solve([[3, 4], [True, True], [[1, 5, False, False]]]), [3, 4])
    check('selected null', solve([[3, 4], [True, True], [[1, 5, False, True]]]), [3, None])
    check('resurrect null', solve([[3, 4], [True, False], [[1, 5, True, True]]]), [3, 5])
    check('repeated target', solve([[3, 4], [True, True], [[1, 5, True, True], [1, 6, True, True]]]), [3, 6])
    check('middle validity', solve([[3, 4, 5], [True, True, True], [[1, 6, False, True]]]), [3, None, 5])
    check('no writes', solve([[3, 4], [False, True], []]), [None, 4])
elif N == 4:
    check('nonzero target', solve([[4, 5, 6], [True, True, True], [[2, 7, True, True]]]), [4, 5, 7])
    check('masked value', solve([[4, 5], [True, True], [[1, 6, True, False]]]), [4, 5])
    check('masked null', solve([[4, 5], [True, True], [[1, 6, False, False]]]), [4, 5])
    check('selected null', solve([[4, 5], [True, True], [[1, 6, False, True]]]), [4, None])
    check('resurrect null', solve([[4, 5], [True, False], [[1, 6, True, True]]]), [4, 6])
    check('repeated target', solve([[4, 5], [True, True], [[1, 6, True, True], [1, 7, True, True]]]), [4, 7])
    check('middle validity', solve([[4, 5, 6], [True, True, True], [[1, 7, False, True]]]), [4, None, 6])
    check('no writes', solve([[4, 5], [False, True], []]), [None, 5])
elif N == 5:
    check('nonzero target', solve([[5, 6, 7], [True, True, True], [[2, 8, True, True]]]), [5, 6, 8])
    check('masked value', solve([[5, 6], [True, True], [[1, 7, True, False]]]), [5, 6])
    check('masked null', solve([[5, 6], [True, True], [[1, 7, False, False]]]), [5, 6])
    check('selected null', solve([[5, 6], [True, True], [[1, 7, False, True]]]), [5, None])
    check('resurrect null', solve([[5, 6], [True, False], [[1, 7, True, True]]]), [5, 7])
    check('repeated target', solve([[5, 6], [True, True], [[1, 7, True, True], [1, 8, True, True]]]), [5, 8])
    check('middle validity', solve([[5, 6, 7], [True, True, True], [[1, 8, False, True]]]), [5, None, 7])
    check('no writes', solve([[5, 6], [False, True], []]), [None, 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:
Scatter uses update position instead of target address.

Apply an ordered scatter update to a column using [target-index,value,is-valid,is-selected] records. Unselected writes do nothing; selected null writes clear validity. Repeated targets use the final selected write, and untouched lanes retain both payload visibility and validity.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        values,valid,updates=d
        values=list(values); valid=list(valid)
        for target,value,known,selected in updates:
            if not selected: continue
            values[target]=value
            valid[target]=valid[target] or known
        return [v if valid[i] else None for i,v in enumerate(values)]
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('nonzero target', solve([[1, 2, 3], [True, True, True], [[2, 4, True, True]]]), [1, 2, 4])
    check('masked value', solve([[1, 2], [True, True], [[1, 3, True, False]]]), [1, 2])
    check('masked null', solve([[1, 2], [True, True], [[1, 3, False, False]]]), [1, 2])
    check('selected null', solve([[1, 2], [True, True], [[1, 3, False, True]]]), [1, None])
    check('resurrect null', solve([[1, 2], [True, False], [[1, 3, True, True]]]), [1, 3])
    check('repeated target', solve([[1, 2], [True, True], [[1, 3, True, True], [1, 4, True, True]]]), [1, 4])
    check('middle validity', solve([[1, 2, 3], [True, True, True], [[1, 4, False, True]]]), [1, None, 3])
    check('no writes', solve([[1, 2], [False, True], []]), [None, 2])
elif N == 2:
    check('nonzero target', solve([[2, 3, 4], [True, True, True], [[2, 5, True, True]]]), [2, 3, 5])
    check('masked value', solve([[2, 3], [True, True], [[1, 4, True, False]]]), [2, 3])
    check('masked null', solve([[2, 3], [True, True], [[1, 4, False, False]]]), [2, 3])
    check('selected null', solve([[2, 3], [True, True], [[1, 4, False, True]]]), [2, None])
    check('resurrect null', solve([[2, 3], [True, False], [[1, 4, True, True]]]), [2, 4])
    check('repeated target', solve([[2, 3], [True, True], [[1, 4, True, True], [1, 5, True, True]]]), [2, 5])
    check('middle validity', solve([[2, 3, 4], [True, True, True], [[1, 5, False, True]]]), [2, None, 4])
    check('no writes', solve([[2, 3], [False, True], []]), [None, 3])
elif N == 3:
    check('nonzero target', solve([[3, 4, 5], [True, True, True], [[2, 6, True, True]]]), [3, 4, 6])
    check('masked value', solve([[3, 4], [True, True], [[1, 5, True, False]]]), [3, 4])
    check('masked null', solve([[3, 4], [True, True], [[1, 5, False, False]]]), [3, 4])
    check('selected null', solve([[3, 4], [True, True], [[1, 5, False, True]]]), [3, None])
    check('resurrect null', solve([[3, 4], [True, False], [[1, 5, True, True]]]), [3, 5])
    check('repeated target', solve([[3, 4], [True, True], [[1, 5, True, True], [1, 6, True, True]]]), [3, 6])
    check('middle validity', solve([[3, 4, 5], [True, True, True], [[1, 6, False, True]]]), [3, None, 5])
    check('no writes', solve([[3, 4], [False, True], []]), [None, 4])
elif N == 4:
    check('nonzero target', solve([[4, 5, 6], [True, True, True], [[2, 7, True, True]]]), [4, 5, 7])
    check('masked value', solve([[4, 5], [True, True], [[1, 6, True, False]]]), [4, 5])
    check('masked null', solve([[4, 5], [True, True], [[1, 6, False, False]]]), [4, 5])
    check('selected null', solve([[4, 5], [True, True], [[1, 6, False, True]]]), [4, None])
    check('resurrect null', solve([[4, 5], [True, False], [[1, 6, True, True]]]), [4, 6])
    check('repeated target', solve([[4, 5], [True, True], [[1, 6, True, True], [1, 7, True, True]]]), [4, 7])
    check('middle validity', solve([[4, 5, 6], [True, True, True], [[1, 7, False, True]]]), [4, None, 6])
    check('no writes', solve([[4, 5], [False, True], []]), [None, 5])
elif N == 5:
    check('nonzero target', solve([[5, 6, 7], [True, True, True], [[2, 8, True, True]]]), [5, 6, 8])
    check('masked value', solve([[5, 6], [True, True], [[1, 7, True, False]]]), [5, 6])
    check('masked null', solve([[5, 6], [True, True], [[1, 7, False, False]]]), [5, 6])
    check('selected null', solve([[5, 6], [True, True], [[1, 7, False, True]]]), [5, None])
    check('resurrect null', solve([[5, 6], [True, False], [[1, 7, True, True]]]), [5, 7])
    check('repeated target', solve([[5, 6], [True, True], [[1, 7, True, True], [1, 8, True, True]]]), [5, 8])
    check('middle validity', solve([[5, 6, 7], [True, True, True], [[1, 8, False, True]]]), [5, None, 7])
    check('no writes', solve([[5, 6], [False, True], []]), [None, 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(d):
    try:
        values,valid,updates=d
        values=list(values); valid=list(valid)
        for target,value,known,selected in updates:
            if not selected: continue
            values[target]=value
            valid[target]=True
        return [v if valid[i] else None for i,v in enumerate(values)]
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('nonzero target', solve([[1, 2, 3], [True, True, True], [[2, 4, True, True]]]), [1, 2, 4])
    check('masked value', solve([[1, 2], [True, True], [[1, 3, True, False]]]), [1, 2])
    check('masked null', solve([[1, 2], [True, True], [[1, 3, False, False]]]), [1, 2])
    check('selected null', solve([[1, 2], [True, True], [[1, 3, False, True]]]), [1, None])
    check('resurrect null', solve([[1, 2], [True, False], [[1, 3, True, True]]]), [1, 3])
    check('repeated target', solve([[1, 2], [True, True], [[1, 3, True, True], [1, 4, True, True]]]), [1, 4])
    check('middle validity', solve([[1, 2, 3], [True, True, True], [[1, 4, False, True]]]), [1, None, 3])
    check('no writes', solve([[1, 2], [False, True], []]), [None, 2])
elif N == 2:
    check('nonzero target', solve([[2, 3, 4], [True, True, True], [[2, 5, True, True]]]), [2, 3, 5])
    check('masked value', solve([[2, 3], [True, True], [[1, 4, True, False]]]), [2, 3])
    check('masked null', solve([[2, 3], [True, True], [[1, 4, False, False]]]), [2, 3])
    check('selected null', solve([[2, 3], [True, True], [[1, 4, False, True]]]), [2, None])
    check('resurrect null', solve([[2, 3], [True, False], [[1, 4, True, True]]]), [2, 4])
    check('repeated target', solve([[2, 3], [True, True], [[1, 4, True, True], [1, 5, True, True]]]), [2, 5])
    check('middle validity', solve([[2, 3, 4], [True, True, True], [[1, 5, False, True]]]), [2, None, 4])
    check('no writes', solve([[2, 3], [False, True], []]), [None, 3])
elif N == 3:
    check('nonzero target', solve([[3, 4, 5], [True, True, True], [[2, 6, True, True]]]), [3, 4, 6])
    check('masked value', solve([[3, 4], [True, True], [[1, 5, True, False]]]), [3, 4])
    check('masked null', solve([[3, 4], [True, True], [[1, 5, False, False]]]), [3, 4])
    check('selected null', solve([[3, 4], [True, True], [[1, 5, False, True]]]), [3, None])
    check('resurrect null', solve([[3, 4], [True, False], [[1, 5, True, True]]]), [3, 5])
    check('repeated target', solve([[3, 4], [True, True], [[1, 5, True, True], [1, 6, True, True]]]), [3, 6])
    check('middle validity', solve([[3, 4, 5], [True, True, True], [[1, 6, False, True]]]), [3, None, 5])
    check('no writes', solve([[3, 4], [False, True], []]), [None, 4])
elif N == 4:
    check('nonzero target', solve([[4, 5, 6], [True, True, True], [[2, 7, True, True]]]), [4, 5, 7])
    check('masked value', solve([[4, 5], [True, True], [[1, 6, True, False]]]), [4, 5])
    check('masked null', solve([[4, 5], [True, True], [[1, 6, False, False]]]), [4, 5])
    check('selected null', solve([[4, 5], [True, True], [[1, 6, False, True]]]), [4, None])
    check('resurrect null', solve([[4, 5], [True, False], [[1, 6, True, True]]]), [4, 6])
    check('repeated target', solve([[4, 5], [True, True], [[1, 6, True, True], [1, 7, True, True]]]), [4, 7])
    check('middle validity', solve([[4, 5, 6], [True, True, True], [[1, 7, False, True]]]), [4, None, 6])
    check('no writes', solve([[4, 5], [False, True], []]), [None, 5])
elif N == 5:
    check('nonzero target', solve([[5, 6, 7], [True, True, True], [[2, 8, True, True]]]), [5, 6, 8])
    check('masked value', solve([[5, 6], [True, True], [[1, 7, True, False]]]), [5, 6])
    check('masked null', solve([[5, 6], [True, True], [[1, 7, False, False]]]), [5, 6])
    check('selected null', solve([[5, 6], [True, True], [[1, 7, False, True]]]), [5, None])
    check('resurrect null', solve([[5, 6], [True, False], [[1, 7, True, True]]]), [5, 7])
    check('repeated target', solve([[5, 6], [True, True], [[1, 7, True, True], [1, 8, True, True]]]), [5, 8])
    check('middle validity', solve([[5, 6, 7], [True, True, True], [[1, 8, False, True]]]), [5, None, 7])
    check('no writes', solve([[5, 6], [False, True], []]), [None, 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:
Scatter retains old validity when a selected update is null.

Apply an ordered scatter update to a column using [target-index,value,is-valid,is-selected] records. Unselected writes do nothing; selected null writes clear validity. Repeated targets use the final selected write, and untouched lanes retain both payload visibility and validity.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        values,valid,updates=d
        values=list(values); valid=list(valid)
        for target,value,known,selected in updates:
            if not selected: continue
            values[target]=value
            valid[0]=known
        return [v if valid[i] else None for i,v in enumerate(values)]
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('nonzero target', solve([[1, 2, 3], [True, True, True], [[2, 4, True, True]]]), [1, 2, 4])
    check('masked value', solve([[1, 2], [True, True], [[1, 3, True, False]]]), [1, 2])
    check('masked null', solve([[1, 2], [True, True], [[1, 3, False, False]]]), [1, 2])
    check('selected null', solve([[1, 2], [True, True], [[1, 3, False, True]]]), [1, None])
    check('resurrect null', solve([[1, 2], [True, False], [[1, 3, True, True]]]), [1, 3])
    check('repeated target', solve([[1, 2], [True, True], [[1, 3, True, True], [1, 4, True, True]]]), [1, 4])
    check('middle validity', solve([[1, 2, 3], [True, True, True], [[1, 4, False, True]]]), [1, None, 3])
    check('no writes', solve([[1, 2], [False, True], []]), [None, 2])
elif N == 2:
    check('nonzero target', solve([[2, 3, 4], [True, True, True], [[2, 5, True, True]]]), [2, 3, 5])
    check('masked value', solve([[2, 3], [True, True], [[1, 4, True, False]]]), [2, 3])
    check('masked null', solve([[2, 3], [True, True], [[1, 4, False, False]]]), [2, 3])
    check('selected null', solve([[2, 3], [True, True], [[1, 4, False, True]]]), [2, None])
    check('resurrect null', solve([[2, 3], [True, False], [[1, 4, True, True]]]), [2, 4])
    check('repeated target', solve([[2, 3], [True, True], [[1, 4, True, True], [1, 5, True, True]]]), [2, 5])
    check('middle validity', solve([[2, 3, 4], [True, True, True], [[1, 5, False, True]]]), [2, None, 4])
    check('no writes', solve([[2, 3], [False, True], []]), [None, 3])
elif N == 3:
    check('nonzero target', solve([[3, 4, 5], [True, True, True], [[2, 6, True, True]]]), [3, 4, 6])
    check('masked value', solve([[3, 4], [True, True], [[1, 5, True, False]]]), [3, 4])
    check('masked null', solve([[3, 4], [True, True], [[1, 5, False, False]]]), [3, 4])
    check('selected null', solve([[3, 4], [True, True], [[1, 5, False, True]]]), [3, None])
    check('resurrect null', solve([[3, 4], [True, False], [[1, 5, True, True]]]), [3, 5])
    check('repeated target', solve([[3, 4], [True, True], [[1, 5, True, True], [1, 6, True, True]]]), [3, 6])
    check('middle validity', solve([[3, 4, 5], [True, True, True], [[1, 6, False, True]]]), [3, None, 5])
    check('no writes', solve([[3, 4], [False, True], []]), [None, 4])
elif N == 4:
    check('nonzero target', solve([[4, 5, 6], [True, True, True], [[2, 7, True, True]]]), [4, 5, 7])
    check('masked value', solve([[4, 5], [True, True], [[1, 6, True, False]]]), [4, 5])
    check('masked null', solve([[4, 5], [True, True], [[1, 6, False, False]]]), [4, 5])
    check('selected null', solve([[4, 5], [True, True], [[1, 6, False, True]]]), [4, None])
    check('resurrect null', solve([[4, 5], [True, False], [[1, 6, True, True]]]), [4, 6])
    check('repeated target', solve([[4, 5], [True, True], [[1, 6, True, True], [1, 7, True, True]]]), [4, 7])
    check('middle validity', solve([[4, 5, 6], [True, True, True], [[1, 7, False, True]]]), [4, None, 6])
    check('no writes', solve([[4, 5], [False, True], []]), [None, 5])
elif N == 5:
    check('nonzero target', solve([[5, 6, 7], [True, True, True], [[2, 8, True, True]]]), [5, 6, 8])
    check('masked value', solve([[5, 6], [True, True], [[1, 7, True, False]]]), [5, 6])
    check('masked null', solve([[5, 6], [True, True], [[1, 7, False, False]]]), [5, 6])
    check('selected null', solve([[5, 6], [True, True], [[1, 7, False, True]]]), [5, None])
    check('resurrect null', solve([[5, 6], [True, False], [[1, 7, True, True]]]), [5, 7])
    check('repeated target', solve([[5, 6], [True, True], [[1, 7, True, True], [1, 8, True, True]]]), [5, 8])
    check('middle validity', solve([[5, 6, 7], [True, True, True], [[1, 8, False, True]]]), [5, None, 7])
    check('no writes', solve([[5, 6], [False, True], []]), [None, 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(d):
    try:
        values,valid,updates=d
        values=list(values); valid=list(valid)
        for target,value,known,selected in updates:
            if not selected: continue
            values[target]=value
            valid[-1]=known
        return [v if valid[i] else None for i,v in enumerate(values)]
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('nonzero target', solve([[1, 2, 3], [True, True, True], [[2, 4, True, True]]]), [1, 2, 4])
    check('masked value', solve([[1, 2], [True, True], [[1, 3, True, False]]]), [1, 2])
    check('masked null', solve([[1, 2], [True, True], [[1, 3, False, False]]]), [1, 2])
    check('selected null', solve([[1, 2], [True, True], [[1, 3, False, True]]]), [1, None])
    check('resurrect null', solve([[1, 2], [True, False], [[1, 3, True, True]]]), [1, 3])
    check('repeated target', solve([[1, 2], [True, True], [[1, 3, True, True], [1, 4, True, True]]]), [1, 4])
    check('middle validity', solve([[1, 2, 3], [True, True, True], [[1, 4, False, True]]]), [1, None, 3])
    check('no writes', solve([[1, 2], [False, True], []]), [None, 2])
elif N == 2:
    check('nonzero target', solve([[2, 3, 4], [True, True, True], [[2, 5, True, True]]]), [2, 3, 5])
    check('masked value', solve([[2, 3], [True, True], [[1, 4, True, False]]]), [2, 3])
    check('masked null', solve([[2, 3], [True, True], [[1, 4, False, False]]]), [2, 3])
    check('selected null', solve([[2, 3], [True, True], [[1, 4, False, True]]]), [2, None])
    check('resurrect null', solve([[2, 3], [True, False], [[1, 4, True, True]]]), [2, 4])
    check('repeated target', solve([[2, 3], [True, True], [[1, 4, True, True], [1, 5, True, True]]]), [2, 5])
    check('middle validity', solve([[2, 3, 4], [True, True, True], [[1, 5, False, True]]]), [2, None, 4])
    check('no writes', solve([[2, 3], [False, True], []]), [None, 3])
elif N == 3:
    check('nonzero target', solve([[3, 4, 5], [True, True, True], [[2, 6, True, True]]]), [3, 4, 6])
    check('masked value', solve([[3, 4], [True, True], [[1, 5, True, False]]]), [3, 4])
    check('masked null', solve([[3, 4], [True, True], [[1, 5, False, False]]]), [3, 4])
    check('selected null', solve([[3, 4], [True, True], [[1, 5, False, True]]]), [3, None])
    check('resurrect null', solve([[3, 4], [True, False], [[1, 5, True, True]]]), [3, 5])
    check('repeated target', solve([[3, 4], [True, True], [[1, 5, True, True], [1, 6, True, True]]]), [3, 6])
    check('middle validity', solve([[3, 4, 5], [True, True, True], [[1, 6, False, True]]]), [3, None, 5])
    check('no writes', solve([[3, 4], [False, True], []]), [None, 4])
elif N == 4:
    check('nonzero target', solve([[4, 5, 6], [True, True, True], [[2, 7, True, True]]]), [4, 5, 7])
    check('masked value', solve([[4, 5], [True, True], [[1, 6, True, False]]]), [4, 5])
    check('masked null', solve([[4, 5], [True, True], [[1, 6, False, False]]]), [4, 5])
    check('selected null', solve([[4, 5], [True, True], [[1, 6, False, True]]]), [4, None])
    check('resurrect null', solve([[4, 5], [True, False], [[1, 6, True, True]]]), [4, 6])
    check('repeated target', solve([[4, 5], [True, True], [[1, 6, True, True], [1, 7, True, True]]]), [4, 7])
    check('middle validity', solve([[4, 5, 6], [True, True, True], [[1, 7, False, True]]]), [4, None, 6])
    check('no writes', solve([[4, 5], [False, True], []]), [None, 5])
elif N == 5:
    check('nonzero target', solve([[5, 6, 7], [True, True, True], [[2, 8, True, True]]]), [5, 6, 8])
    check('masked value', solve([[5, 6], [True, True], [[1, 7, True, False]]]), [5, 6])
    check('masked null', solve([[5, 6], [True, True], [[1, 7, False, False]]]), [5, 6])
    check('selected null', solve([[5, 6], [True, True], [[1, 7, False, True]]]), [5, None])
    check('resurrect null', solve([[5, 6], [True, False], [[1, 7, True, True]]]), [5, 7])
    check('repeated target', solve([[5, 6], [True, True], [[1, 7, True, True], [1, 8, True, True]]]), [5, 8])
    check('middle validity', solve([[5, 6, 7], [True, True, True], [[1, 8, False, True]]]), [5, None, 7])
    check('no writes', solve([[5, 6], [False, True], []]), [None, 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:
Scatter updates validity at the first lane instead of the target.

Apply an ordered scatter update to a column using [target-index,value,is-valid,is-selected] records. Unselected writes do nothing; selected null writes clear validity. Repeated targets use the final selected write, and untouched lanes retain both payload visibility and validity.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        values,valid,updates=d
        values=list(values); valid=list(valid)
        for target,value,known,selected in reversed(updates):
            if not selected: continue
            values[target]=value
            valid[target]=known
        return [v if valid[i] else None for i,v in enumerate(values)]
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('nonzero target', solve([[1, 2, 3], [True, True, True], [[2, 4, True, True]]]), [1, 2, 4])
    check('masked value', solve([[1, 2], [True, True], [[1, 3, True, False]]]), [1, 2])
    check('masked null', solve([[1, 2], [True, True], [[1, 3, False, False]]]), [1, 2])
    check('selected null', solve([[1, 2], [True, True], [[1, 3, False, True]]]), [1, None])
    check('resurrect null', solve([[1, 2], [True, False], [[1, 3, True, True]]]), [1, 3])
    check('repeated target', solve([[1, 2], [True, True], [[1, 3, True, True], [1, 4, True, True]]]), [1, 4])
    check('middle validity', solve([[1, 2, 3], [True, True, True], [[1, 4, False, True]]]), [1, None, 3])
    check('no writes', solve([[1, 2], [False, True], []]), [None, 2])
elif N == 2:
    check('nonzero target', solve([[2, 3, 4], [True, True, True], [[2, 5, True, True]]]), [2, 3, 5])
    check('masked value', solve([[2, 3], [True, True], [[1, 4, True, False]]]), [2, 3])
    check('masked null', solve([[2, 3], [True, True], [[1, 4, False, False]]]), [2, 3])
    check('selected null', solve([[2, 3], [True, True], [[1, 4, False, True]]]), [2, None])
    check('resurrect null', solve([[2, 3], [True, False], [[1, 4, True, True]]]), [2, 4])
    check('repeated target', solve([[2, 3], [True, True], [[1, 4, True, True], [1, 5, True, True]]]), [2, 5])
    check('middle validity', solve([[2, 3, 4], [True, True, True], [[1, 5, False, True]]]), [2, None, 4])
    check('no writes', solve([[2, 3], [False, True], []]), [None, 3])
elif N == 3:
    check('nonzero target', solve([[3, 4, 5], [True, True, True], [[2, 6, True, True]]]), [3, 4, 6])
    check('masked value', solve([[3, 4], [True, True], [[1, 5, True, False]]]), [3, 4])
    check('masked null', solve([[3, 4], [True, True], [[1, 5, False, False]]]), [3, 4])
    check('selected null', solve([[3, 4], [True, True], [[1, 5, False, True]]]), [3, None])
    check('resurrect null', solve([[3, 4], [True, False], [[1, 5, True, True]]]), [3, 5])
    check('repeated target', solve([[3, 4], [True, True], [[1, 5, True, True], [1, 6, True, True]]]), [3, 6])
    check('middle validity', solve([[3, 4, 5], [True, True, True], [[1, 6, False, True]]]), [3, None, 5])
    check('no writes', solve([[3, 4], [False, True], []]), [None, 4])
elif N == 4:
    check('nonzero target', solve([[4, 5, 6], [True, True, True], [[2, 7, True, True]]]), [4, 5, 7])
    check('masked value', solve([[4, 5], [True, True], [[1, 6, True, False]]]), [4, 5])
    check('masked null', solve([[4, 5], [True, True], [[1, 6, False, False]]]), [4, 5])
    check('selected null', solve([[4, 5], [True, True], [[1, 6, False, True]]]), [4, None])
    check('resurrect null', solve([[4, 5], [True, False], [[1, 6, True, True]]]), [4, 6])
    check('repeated target', solve([[4, 5], [True, True], [[1, 6, True, True], [1, 7, True, True]]]), [4, 7])
    check('middle validity', solve([[4, 5, 6], [True, True, True], [[1, 7, False, True]]]), [4, None, 6])
    check('no writes', solve([[4, 5], [False, True], []]), [None, 5])
elif N == 5:
    check('nonzero target', solve([[5, 6, 7], [True, True, True], [[2, 8, True, True]]]), [5, 6, 8])
    check('masked value', solve([[5, 6], [True, True], [[1, 7, True, False]]]), [5, 6])
    check('masked null', solve([[5, 6], [True, True], [[1, 7, False, False]]]), [5, 6])
    check('selected null', solve([[5, 6], [True, True], [[1, 7, False, True]]]), [5, None])
    check('resurrect null', solve([[5, 6], [True, False], [[1, 7, True, True]]]), [5, 7])
    check('repeated target', solve([[5, 6], [True, True], [[1, 7, True, True], [1, 8, True, True]]]), [5, 8])
    check('middle validity', solve([[5, 6, 7], [True, True, True], [[1, 8, False, True]]]), [5, None, 7])
    check('no writes', solve([[5, 6], [False, True], []]), [None, 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(d):
    try:
        values,valid,updates=d
        values=list(values); valid=list(valid)
        for target,value,known,selected in sorted(updates,key=lambda r:r[1],reverse=True):
            if not selected: continue
            values[target]=value
            valid[target]=known
        return [v if valid[i] else None for i,v in enumerate(values)]
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('nonzero target', solve([[1, 2, 3], [True, True, True], [[2, 4, True, True]]]), [1, 2, 4])
    check('masked value', solve([[1, 2], [True, True], [[1, 3, True, False]]]), [1, 2])
    check('masked null', solve([[1, 2], [True, True], [[1, 3, False, False]]]), [1, 2])
    check('selected null', solve([[1, 2], [True, True], [[1, 3, False, True]]]), [1, None])
    check('resurrect null', solve([[1, 2], [True, False], [[1, 3, True, True]]]), [1, 3])
    check('repeated target', solve([[1, 2], [True, True], [[1, 3, True, True], [1, 4, True, True]]]), [1, 4])
    check('middle validity', solve([[1, 2, 3], [True, True, True], [[1, 4, False, True]]]), [1, None, 3])
    check('no writes', solve([[1, 2], [False, True], []]), [None, 2])
elif N == 2:
    check('nonzero target', solve([[2, 3, 4], [True, True, True], [[2, 5, True, True]]]), [2, 3, 5])
    check('masked value', solve([[2, 3], [True, True], [[1, 4, True, False]]]), [2, 3])
    check('masked null', solve([[2, 3], [True, True], [[1, 4, False, False]]]), [2, 3])
    check('selected null', solve([[2, 3], [True, True], [[1, 4, False, True]]]), [2, None])
    check('resurrect null', solve([[2, 3], [True, False], [[1, 4, True, True]]]), [2, 4])
    check('repeated target', solve([[2, 3], [True, True], [[1, 4, True, True], [1, 5, True, True]]]), [2, 5])
    check('middle validity', solve([[2, 3, 4], [True, True, True], [[1, 5, False, True]]]), [2, None, 4])
    check('no writes', solve([[2, 3], [False, True], []]), [None, 3])
elif N == 3:
    check('nonzero target', solve([[3, 4, 5], [True, True, True], [[2, 6, True, True]]]), [3, 4, 6])
    check('masked value', solve([[3, 4], [True, True], [[1, 5, True, False]]]), [3, 4])
    check('masked null', solve([[3, 4], [True, True], [[1, 5, False, False]]]), [3, 4])
    check('selected null', solve([[3, 4], [True, True], [[1, 5, False, True]]]), [3, None])
    check('resurrect null', solve([[3, 4], [True, False], [[1, 5, True, True]]]), [3, 5])
    check('repeated target', solve([[3, 4], [True, True], [[1, 5, True, True], [1, 6, True, True]]]), [3, 6])
    check('middle validity', solve([[3, 4, 5], [True, True, True], [[1, 6, False, True]]]), [3, None, 5])
    check('no writes', solve([[3, 4], [False, True], []]), [None, 4])
elif N == 4:
    check('nonzero target', solve([[4, 5, 6], [True, True, True], [[2, 7, True, True]]]), [4, 5, 7])
    check('masked value', solve([[4, 5], [True, True], [[1, 6, True, False]]]), [4, 5])
    check('masked null', solve([[4, 5], [True, True], [[1, 6, False, False]]]), [4, 5])
    check('selected null', solve([[4, 5], [True, True], [[1, 6, False, True]]]), [4, None])
    check('resurrect null', solve([[4, 5], [True, False], [[1, 6, True, True]]]), [4, 6])
    check('repeated target', solve([[4, 5], [True, True], [[1, 6, True, True], [1, 7, True, True]]]), [4, 7])
    check('middle validity', solve([[4, 5, 6], [True, True, True], [[1, 7, False, True]]]), [4, None, 6])
    check('no writes', solve([[4, 5], [False, True], []]), [None, 5])
elif N == 5:
    check('nonzero target', solve([[5, 6, 7], [True, True, True], [[2, 8, True, True]]]), [5, 6, 8])
    check('masked value', solve([[5, 6], [True, True], [[1, 7, True, False]]]), [5, 6])
    check('masked null', solve([[5, 6], [True, True], [[1, 7, False, False]]]), [5, 6])
    check('selected null', solve([[5, 6], [True, True], [[1, 7, False, True]]]), [5, None])
    check('resurrect null', solve([[5, 6], [True, False], [[1, 7, True, True]]]), [5, 7])
    check('repeated target', solve([[5, 6], [True, True], [[1, 7, True, True], [1, 8, True, True]]]), [5, 8])
    check('middle validity', solve([[5, 6, 7], [True, True, True], [[1, 8, False, True]]]), [5, None, 7])
    check('no writes', solve([[5, 6], [False, True], []]), [None, 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:
Repeated scatter targets keep the earliest selected write.

Apply an ordered scatter update to a column using [target-index,value,is-valid,is-selected] records. Unselected writes do nothing; selected null writes clear validity. Repeated targets use the final selected write, and untouched lanes retain both payload visibility and validity.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        values,valid,updates=d
        values=list(values); valid=list(valid)
        for target,value,known,selected in updates:
            if not selected: continue
            values[target]=value
            valid[target]=known
        return [values[i] if valid[i] else None for i in dict.fromkeys(u[0] for u in updates)]
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('nonzero target', solve([[1, 2, 3], [True, True, True], [[2, 4, True, True]]]), [1, 2, 4])
    check('masked value', solve([[1, 2], [True, True], [[1, 3, True, False]]]), [1, 2])
    check('masked null', solve([[1, 2], [True, True], [[1, 3, False, False]]]), [1, 2])
    check('selected null', solve([[1, 2], [True, True], [[1, 3, False, True]]]), [1, None])
    check('resurrect null', solve([[1, 2], [True, False], [[1, 3, True, True]]]), [1, 3])
    check('repeated target', solve([[1, 2], [True, True], [[1, 3, True, True], [1, 4, True, True]]]), [1, 4])
    check('middle validity', solve([[1, 2, 3], [True, True, True], [[1, 4, False, True]]]), [1, None, 3])
    check('no writes', solve([[1, 2], [False, True], []]), [None, 2])
elif N == 2:
    check('nonzero target', solve([[2, 3, 4], [True, True, True], [[2, 5, True, True]]]), [2, 3, 5])
    check('masked value', solve([[2, 3], [True, True], [[1, 4, True, False]]]), [2, 3])
    check('masked null', solve([[2, 3], [True, True], [[1, 4, False, False]]]), [2, 3])
    check('selected null', solve([[2, 3], [True, True], [[1, 4, False, True]]]), [2, None])
    check('resurrect null', solve([[2, 3], [True, False], [[1, 4, True, True]]]), [2, 4])
    check('repeated target', solve([[2, 3], [True, True], [[1, 4, True, True], [1, 5, True, True]]]), [2, 5])
    check('middle validity', solve([[2, 3, 4], [True, True, True], [[1, 5, False, True]]]), [2, None, 4])
    check('no writes', solve([[2, 3], [False, True], []]), [None, 3])
elif N == 3:
    check('nonzero target', solve([[3, 4, 5], [True, True, True], [[2, 6, True, True]]]), [3, 4, 6])
    check('masked value', solve([[3, 4], [True, True], [[1, 5, True, False]]]), [3, 4])
    check('masked null', solve([[3, 4], [True, True], [[1, 5, False, False]]]), [3, 4])
    check('selected null', solve([[3, 4], [True, True], [[1, 5, False, True]]]), [3, None])
    check('resurrect null', solve([[3, 4], [True, False], [[1, 5, True, True]]]), [3, 5])
    check('repeated target', solve([[3, 4], [True, True], [[1, 5, True, True], [1, 6, True, True]]]), [3, 6])
    check('middle validity', solve([[3, 4, 5], [True, True, True], [[1, 6, False, True]]]), [3, None, 5])
    check('no writes', solve([[3, 4], [False, True], []]), [None, 4])
elif N == 4:
    check('nonzero target', solve([[4, 5, 6], [True, True, True], [[2, 7, True, True]]]), [4, 5, 7])
    check('masked value', solve([[4, 5], [True, True], [[1, 6, True, False]]]), [4, 5])
    check('masked null', solve([[4, 5], [True, True], [[1, 6, False, False]]]), [4, 5])
    check('selected null', solve([[4, 5], [True, True], [[1, 6, False, True]]]), [4, None])
    check('resurrect null', solve([[4, 5], [True, False], [[1, 6, True, True]]]), [4, 6])
    check('repeated target', solve([[4, 5], [True, True], [[1, 6, True, True], [1, 7, True, True]]]), [4, 7])
    check('middle validity', solve([[4, 5, 6], [True, True, True], [[1, 7, False, True]]]), [4, None, 6])
    check('no writes', solve([[4, 5], [False, True], []]), [None, 5])
elif N == 5:
    check('nonzero target', solve([[5, 6, 7], [True, True, True], [[2, 8, True, True]]]), [5, 6, 8])
    check('masked value', solve([[5, 6], [True, True], [[1, 7, True, False]]]), [5, 6])
    check('masked null', solve([[5, 6], [True, True], [[1, 7, False, False]]]), [5, 6])
    check('selected null', solve([[5, 6], [True, True], [[1, 7, False, True]]]), [5, None])
    check('resurrect null', solve([[5, 6], [True, False], [[1, 7, True, True]]]), [5, 7])
    check('repeated target', solve([[5, 6], [True, True], [[1, 7, True, True], [1, 8, True, True]]]), [5, 8])
    check('middle validity', solve([[5, 6, 7], [True, True, True], [[1, 8, False, True]]]), [5, None, 7])
    check('no writes', solve([[5, 6], [False, True], []]), [None, 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(d):
    try:
        values,valid,updates=d
        values=list(values); valid=list(valid)
        for target,value,known,selected in updates:
            if not selected: continue
            values[target]=value
            valid[target]=known
        return [values[i] if valid[i] else None for i in sorted(set(u[0] for u in updates))]
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('nonzero target', solve([[1, 2, 3], [True, True, True], [[2, 4, True, True]]]), [1, 2, 4])
    check('masked value', solve([[1, 2], [True, True], [[1, 3, True, False]]]), [1, 2])
    check('masked null', solve([[1, 2], [True, True], [[1, 3, False, False]]]), [1, 2])
    check('selected null', solve([[1, 2], [True, True], [[1, 3, False, True]]]), [1, None])
    check('resurrect null', solve([[1, 2], [True, False], [[1, 3, True, True]]]), [1, 3])
    check('repeated target', solve([[1, 2], [True, True], [[1, 3, True, True], [1, 4, True, True]]]), [1, 4])
    check('middle validity', solve([[1, 2, 3], [True, True, True], [[1, 4, False, True]]]), [1, None, 3])
    check('no writes', solve([[1, 2], [False, True], []]), [None, 2])
elif N == 2:
    check('nonzero target', solve([[2, 3, 4], [True, True, True], [[2, 5, True, True]]]), [2, 3, 5])
    check('masked value', solve([[2, 3], [True, True], [[1, 4, True, False]]]), [2, 3])
    check('masked null', solve([[2, 3], [True, True], [[1, 4, False, False]]]), [2, 3])
    check('selected null', solve([[2, 3], [True, True], [[1, 4, False, True]]]), [2, None])
    check('resurrect null', solve([[2, 3], [True, False], [[1, 4, True, True]]]), [2, 4])
    check('repeated target', solve([[2, 3], [True, True], [[1, 4, True, True], [1, 5, True, True]]]), [2, 5])
    check('middle validity', solve([[2, 3, 4], [True, True, True], [[1, 5, False, True]]]), [2, None, 4])
    check('no writes', solve([[2, 3], [False, True], []]), [None, 3])
elif N == 3:
    check('nonzero target', solve([[3, 4, 5], [True, True, True], [[2, 6, True, True]]]), [3, 4, 6])
    check('masked value', solve([[3, 4], [True, True], [[1, 5, True, False]]]), [3, 4])
    check('masked null', solve([[3, 4], [True, True], [[1, 5, False, False]]]), [3, 4])
    check('selected null', solve([[3, 4], [True, True], [[1, 5, False, True]]]), [3, None])
    check('resurrect null', solve([[3, 4], [True, False], [[1, 5, True, True]]]), [3, 5])
    check('repeated target', solve([[3, 4], [True, True], [[1, 5, True, True], [1, 6, True, True]]]), [3, 6])
    check('middle validity', solve([[3, 4, 5], [True, True, True], [[1, 6, False, True]]]), [3, None, 5])
    check('no writes', solve([[3, 4], [False, True], []]), [None, 4])
elif N == 4:
    check('nonzero target', solve([[4, 5, 6], [True, True, True], [[2, 7, True, True]]]), [4, 5, 7])
    check('masked value', solve([[4, 5], [True, True], [[1, 6, True, False]]]), [4, 5])
    check('masked null', solve([[4, 5], [True, True], [[1, 6, False, False]]]), [4, 5])
    check('selected null', solve([[4, 5], [True, True], [[1, 6, False, True]]]), [4, None])
    check('resurrect null', solve([[4, 5], [True, False], [[1, 6, True, True]]]), [4, 6])
    check('repeated target', solve([[4, 5], [True, True], [[1, 6, True, True], [1, 7, True, True]]]), [4, 7])
    check('middle validity', solve([[4, 5, 6], [True, True, True], [[1, 7, False, True]]]), [4, None, 6])
    check('no writes', solve([[4, 5], [False, True], []]), [None, 5])
elif N == 5:
    check('nonzero target', solve([[5, 6, 7], [True, True, True], [[2, 8, True, True]]]), [5, 6, 8])
    check('masked value', solve([[5, 6], [True, True], [[1, 7, True, False]]]), [5, 6])
    check('masked null', solve([[5, 6], [True, True], [[1, 7, False, False]]]), [5, 6])
    check('selected null', solve([[5, 6], [True, True], [[1, 7, False, True]]]), [5, None])
    check('resurrect null', solve([[5, 6], [True, False], [[1, 7, True, True]]]), [5, 7])
    check('repeated target', solve([[5, 6], [True, True], [[1, 7, True, True], [1, 8, True, True]]]), [5, 8])
    check('middle validity', solve([[5, 6, 7], [True, True, True], [[1, 8, False, True]]]), [5, None, 7])
    check('no writes', solve([[5, 6], [False, True], []]), [None, 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:
Scatter returns only explicitly updated lanes.

Apply an ordered scatter update to a column using [target-index,value,is-valid,is-selected] records. Unselected writes do nothing; selected null writes clear validity. Repeated targets use the final selected write, and untouched lanes retain both payload visibility and validity.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        out_offsets=[0]; out_child=[]; out_valid=[]
        for offsets,child,child_valid,parent_valid in d:
            start=0; stop=offsets[-1]
            base=len(out_child)
            out_child.extend(child[i] if child_valid[i] else None for i in range(start,stop))
            out_offsets.extend(base+x-start for x in offsets[1:])
            out_valid.extend(parent_valid)
        return [out_offsets,out_child,out_valid]
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('two batches', solve([[[0, 2], [1, 2], [True, True], [True]], [[0, 1], [3], [True], [True]]]), [[0, 2, 3], [1, 2, 3], [True, True]])
    check('sliced child', solve([[[1, 3], [0, 1, 2, 99], [True, True, True, True], [True]]]), [[0, 2], [1, 2], [True]])
    check('null children', solve([[[0, 2], [1, 2], [False, True], [True]]]), [[0, 2], [None, 2], [True]])
    check('empty valid row', solve([[[0, 0], [], [], [True]]]), [[0, 0], [], [True]])
    check('null parent storage', solve([[[0, 1], [1], [True], [False]]]), [[0, 1], [1], [False]])
    check('no batches', solve([]), [[0], [], []])
    check('empty batch then row', solve([[[0], [], [], []], [[0, 1], [1], [True], [True]]]), [[0, 1], [1], [True]])
elif N == 2:
    check('two batches', solve([[[0, 2], [2, 3], [True, True], [True]], [[0, 1], [4], [True], [True]]]), [[0, 2, 3], [2, 3, 4], [True, True]])
    check('sliced child', solve([[[1, 3], [0, 2, 3, 99], [True, True, True, True], [True]]]), [[0, 2], [2, 3], [True]])
    check('null children', solve([[[0, 2], [2, 3], [False, True], [True]]]), [[0, 2], [None, 3], [True]])
    check('empty valid row', solve([[[0, 0], [], [], [True]]]), [[0, 0], [], [True]])
    check('null parent storage', solve([[[0, 1], [2], [True], [False]]]), [[0, 1], [2], [False]])
    check('no batches', solve([]), [[0], [], []])
    check('empty batch then row', solve([[[0], [], [], []], [[0, 1], [2], [True], [True]]]), [[0, 1], [2], [True]])
elif N == 3:
    check('two batches', solve([[[0, 2], [3, 4], [True, True], [True]], [[0, 1], [5], [True], [True]]]), [[0, 2, 3], [3, 4, 5], [True, True]])
    check('sliced child', solve([[[1, 3], [0, 3, 4, 99], [True, True, True, True], [True]]]), [[0, 2], [3, 4], [True]])
    check('null children', solve([[[0, 2], [3, 4], [False, True], [True]]]), [[0, 2], [None, 4], [True]])
    check('empty valid row', solve([[[0, 0], [], [], [True]]]), [[0, 0], [], [True]])
    check('null parent storage', solve([[[0, 1], [3], [True], [False]]]), [[0, 1], [3], [False]])
    check('no batches', solve([]), [[0], [], []])
    check('empty batch then row', solve([[[0], [], [], []], [[0, 1], [3], [True], [True]]]), [[0, 1], [3], [True]])
elif N == 4:
    check('two batches', solve([[[0, 2], [4, 5], [True, True], [True]], [[0, 1], [6], [True], [True]]]), [[0, 2, 3], [4, 5, 6], [True, True]])
    check('sliced child', solve([[[1, 3], [0, 4, 5, 99], [True, True, True, True], [True]]]), [[0, 2], [4, 5], [True]])
    check('null children', solve([[[0, 2], [4, 5], [False, True], [True]]]), [[0, 2], [None, 5], [True]])
    check('empty valid row', solve([[[0, 0], [], [], [True]]]), [[0, 0], [], [True]])
    check('null parent storage', solve([[[0, 1], [4], [True], [False]]]), [[0, 1], [4], [False]])
    check('no batches', solve([]), [[0], [], []])
    check('empty batch then row', solve([[[0], [], [], []], [[0, 1], [4], [True], [True]]]), [[0, 1], [4], [True]])
elif N == 5:
    check('two batches', solve([[[0, 2], [5, 6], [True, True], [True]], [[0, 1], [7], [True], [True]]]), [[0, 2, 3], [5, 6, 7], [True, True]])
    check('sliced child', solve([[[1, 3], [0, 5, 6, 99], [True, True, True, True], [True]]]), [[0, 2], [5, 6], [True]])
    check('null children', solve([[[0, 2], [5, 6], [False, True], [True]]]), [[0, 2], [None, 6], [True]])
    check('empty valid row', solve([[[0, 0], [], [], [True]]]), [[0, 0], [], [True]])
    check('null parent storage', solve([[[0, 1], [5], [True], [False]]]), [[0, 1], [5], [False]])
    check('no batches', solve([]), [[0], [], []])
    check('empty batch then row', solve([[[0], [], [], []], [[0, 1], [5], [True], [True]]]), [[0, 1], [5], [True]])
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(d):
    try:
        out_offsets=[0]; out_child=[]; out_valid=[]
        for offsets,child,child_valid,parent_valid in d:
            start=offsets[0]; stop=len(child)
            base=len(out_child)
            out_child.extend(child[i] if child_valid[i] else None for i in range(start,stop))
            out_offsets.extend(base+x-start for x in offsets[1:])
            out_valid.extend(parent_valid)
        return [out_offsets,out_child,out_valid]
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('two batches', solve([[[0, 2], [1, 2], [True, True], [True]], [[0, 1], [3], [True], [True]]]), [[0, 2, 3], [1, 2, 3], [True, True]])
    check('sliced child', solve([[[1, 3], [0, 1, 2, 99], [True, True, True, True], [True]]]), [[0, 2], [1, 2], [True]])
    check('null children', solve([[[0, 2], [1, 2], [False, True], [True]]]), [[0, 2], [None, 2], [True]])
    check('empty valid row', solve([[[0, 0], [], [], [True]]]), [[0, 0], [], [True]])
    check('null parent storage', solve([[[0, 1], [1], [True], [False]]]), [[0, 1], [1], [False]])
    check('no batches', solve([]), [[0], [], []])
    check('empty batch then row', solve([[[0], [], [], []], [[0, 1], [1], [True], [True]]]), [[0, 1], [1], [True]])
elif N == 2:
    check('two batches', solve([[[0, 2], [2, 3], [True, True], [True]], [[0, 1], [4], [True], [True]]]), [[0, 2, 3], [2, 3, 4], [True, True]])
    check('sliced child', solve([[[1, 3], [0, 2, 3, 99], [True, True, True, True], [True]]]), [[0, 2], [2, 3], [True]])
    check('null children', solve([[[0, 2], [2, 3], [False, True], [True]]]), [[0, 2], [None, 3], [True]])
    check('empty valid row', solve([[[0, 0], [], [], [True]]]), [[0, 0], [], [True]])
    check('null parent storage', solve([[[0, 1], [2], [True], [False]]]), [[0, 1], [2], [False]])
    check('no batches', solve([]), [[0], [], []])
    check('empty batch then row', solve([[[0], [], [], []], [[0, 1], [2], [True], [True]]]), [[0, 1], [2], [True]])
elif N == 3:
    check('two batches', solve([[[0, 2], [3, 4], [True, True], [True]], [[0, 1], [5], [True], [True]]]), [[0, 2, 3], [3, 4, 5], [True, True]])
    check('sliced child', solve([[[1, 3], [0, 3, 4, 99], [True, True, True, True], [True]]]), [[0, 2], [3, 4], [True]])
    check('null children', solve([[[0, 2], [3, 4], [False, True], [True]]]), [[0, 2], [None, 4], [True]])
    check('empty valid row', solve([[[0, 0], [], [], [True]]]), [[0, 0], [], [True]])
    check('null parent storage', solve([[[0, 1], [3], [True], [False]]]), [[0, 1], [3], [False]])
    check('no batches', solve([]), [[0], [], []])
    check('empty batch then row', solve([[[0], [], [], []], [[0, 1], [3], [True], [True]]]), [[0, 1], [3], [True]])
elif N == 4:
    check('two batches', solve([[[0, 2], [4, 5], [True, True], [True]], [[0, 1], [6], [True], [True]]]), [[0, 2, 3], [4, 5, 6], [True, True]])
    check('sliced child', solve([[[1, 3], [0, 4, 5, 99], [True, True, True, True], [True]]]), [[0, 2], [4, 5], [True]])
    check('null children', solve([[[0, 2], [4, 5], [False, True], [True]]]), [[0, 2], [None, 5], [True]])
    check('empty valid row', solve([[[0, 0], [], [], [True]]]), [[0, 0], [], [True]])
    check('null parent storage', solve([[[0, 1], [4], [True], [False]]]), [[0, 1], [4], [False]])
    check('no batches', solve([]), [[0], [], []])
    check('empty batch then row', solve([[[0], [], [], []], [[0, 1], [4], [True], [True]]]), [[0, 1], [4], [True]])
elif N == 5:
    check('two batches', solve([[[0, 2], [5, 6], [True, True], [True]], [[0, 1], [7], [True], [True]]]), [[0, 2, 3], [5, 6, 7], [True, True]])
    check('sliced child', solve([[[1, 3], [0, 5, 6, 99], [True, True, True, True], [True]]]), [[0, 2], [5, 6], [True]])
    check('null children', solve([[[0, 2], [5, 6], [False, True], [True]]]), [[0, 2], [None, 6], [True]])
    check('empty valid row', solve([[[0, 0], [], [], [True]]]), [[0, 0], [], [True]])
    check('null parent storage', solve([[[0, 1], [5], [True], [False]]]), [[0, 1], [5], [False]])
    check('no batches', solve([]), [[0], [], []])
    check('empty batch then row', solve([[[0], [], [], []], [[0, 1], [5], [True], [True]]]), [[0, 1], [5], [True]])
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:
List concatenation copies unused child-buffer prefixes.

Concatenate offset-based list batches into one compact child buffer. Rebase every row offset, copy only each batch referenced child span, preserve parent validity, and preserve child nulls. Output [offsets,visible-child,parent-validity].

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        out_offsets=[0]; out_child=[]; out_valid=[]
        for offsets,child,child_valid,parent_valid in d:
            start=offsets[0]; stop=offsets[-1]
            base=len(out_child)
            out_child.extend(child[i] if child_valid[i] else None for i in range(start,stop))
            out_offsets.extend(x-start for x in offsets[1:])
            out_valid.extend(parent_valid)
        return [out_offsets,out_child,out_valid]
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('two batches', solve([[[0, 2], [1, 2], [True, True], [True]], [[0, 1], [3], [True], [True]]]), [[0, 2, 3], [1, 2, 3], [True, True]])
    check('sliced child', solve([[[1, 3], [0, 1, 2, 99], [True, True, True, True], [True]]]), [[0, 2], [1, 2], [True]])
    check('null children', solve([[[0, 2], [1, 2], [False, True], [True]]]), [[0, 2], [None, 2], [True]])
    check('empty valid row', solve([[[0, 0], [], [], [True]]]), [[0, 0], [], [True]])
    check('null parent storage', solve([[[0, 1], [1], [True], [False]]]), [[0, 1], [1], [False]])
    check('no batches', solve([]), [[0], [], []])
    check('empty batch then row', solve([[[0], [], [], []], [[0, 1], [1], [True], [True]]]), [[0, 1], [1], [True]])
elif N == 2:
    check('two batches', solve([[[0, 2], [2, 3], [True, True], [True]], [[0, 1], [4], [True], [True]]]), [[0, 2, 3], [2, 3, 4], [True, True]])
    check('sliced child', solve([[[1, 3], [0, 2, 3, 99], [True, True, True, True], [True]]]), [[0, 2], [2, 3], [True]])
    check('null children', solve([[[0, 2], [2, 3], [False, True], [True]]]), [[0, 2], [None, 3], [True]])
    check('empty valid row', solve([[[0, 0], [], [], [True]]]), [[0, 0], [], [True]])
    check('null parent storage', solve([[[0, 1], [2], [True], [False]]]), [[0, 1], [2], [False]])
    check('no batches', solve([]), [[0], [], []])
    check('empty batch then row', solve([[[0], [], [], []], [[0, 1], [2], [True], [True]]]), [[0, 1], [2], [True]])
elif N == 3:
    check('two batches', solve([[[0, 2], [3, 4], [True, True], [True]], [[0, 1], [5], [True], [True]]]), [[0, 2, 3], [3, 4, 5], [True, True]])
    check('sliced child', solve([[[1, 3], [0, 3, 4, 99], [True, True, True, True], [True]]]), [[0, 2], [3, 4], [True]])
    check('null children', solve([[[0, 2], [3, 4], [False, True], [True]]]), [[0, 2], [None, 4], [True]])
    check('empty valid row', solve([[[0, 0], [], [], [True]]]), [[0, 0], [], [True]])
    check('null parent storage', solve([[[0, 1], [3], [True], [False]]]), [[0, 1], [3], [False]])
    check('no batches', solve([]), [[0], [], []])
    check('empty batch then row', solve([[[0], [], [], []], [[0, 1], [3], [True], [True]]]), [[0, 1], [3], [True]])
elif N == 4:
    check('two batches', solve([[[0, 2], [4, 5], [True, True], [True]], [[0, 1], [6], [True], [True]]]), [[0, 2, 3], [4, 5, 6], [True, True]])
    check('sliced child', solve([[[1, 3], [0, 4, 5, 99], [True, True, True, True], [True]]]), [[0, 2], [4, 5], [True]])
    check('null children', solve([[[0, 2], [4, 5], [False, True], [True]]]), [[0, 2], [None, 5], [True]])
    check('empty valid row', solve([[[0, 0], [], [], [True]]]), [[0, 0], [], [True]])
    check('null parent storage', solve([[[0, 1], [4], [True], [False]]]), [[0, 1], [4], [False]])
    check('no batches', solve([]), [[0], [], []])
    check('empty batch then row', solve([[[0], [], [], []], [[0, 1], [4], [True], [True]]]), [[0, 1], [4], [True]])
elif N == 5:
    check('two batches', solve([[[0, 2], [5, 6], [True, True], [True]], [[0, 1], [7], [True], [True]]]), [[0, 2, 3], [5, 6, 7], [True, True]])
    check('sliced child', solve([[[1, 3], [0, 5, 6, 99], [True, True, True, True], [True]]]), [[0, 2], [5, 6], [True]])
    check('null children', solve([[[0, 2], [5, 6], [False, True], [True]]]), [[0, 2], [None, 6], [True]])
    check('empty valid row', solve([[[0, 0], [], [], [True]]]), [[0, 0], [], [True]])
    check('null parent storage', solve([[[0, 1], [5], [True], [False]]]), [[0, 1], [5], [False]])
    check('no batches', solve([]), [[0], [], []])
    check('empty batch then row', solve([[[0], [], [], []], [[0, 1], [5], [True], [True]]]), [[0, 1], [5], [True]])
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(d):
    try:
        out_offsets=[0]; out_child=[]; out_valid=[]
        for offsets,child,child_valid,parent_valid in d:
            start=offsets[0]; stop=offsets[-1]
            base=len(out_child)
            out_child.extend(child[i] if child_valid[i] else None for i in range(start,stop))
            out_offsets.extend(base+x for x in offsets[1:])
            out_valid.extend(parent_valid)
        return [out_offsets,out_child,out_valid]
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('two batches', solve([[[0, 2], [1, 2], [True, True], [True]], [[0, 1], [3], [True], [True]]]), [[0, 2, 3], [1, 2, 3], [True, True]])
    check('sliced child', solve([[[1, 3], [0, 1, 2, 99], [True, True, True, True], [True]]]), [[0, 2], [1, 2], [True]])
    check('null children', solve([[[0, 2], [1, 2], [False, True], [True]]]), [[0, 2], [None, 2], [True]])
    check('empty valid row', solve([[[0, 0], [], [], [True]]]), [[0, 0], [], [True]])
    check('null parent storage', solve([[[0, 1], [1], [True], [False]]]), [[0, 1], [1], [False]])
    check('no batches', solve([]), [[0], [], []])
    check('empty batch then row', solve([[[0], [], [], []], [[0, 1], [1], [True], [True]]]), [[0, 1], [1], [True]])
elif N == 2:
    check('two batches', solve([[[0, 2], [2, 3], [True, True], [True]], [[0, 1], [4], [True], [True]]]), [[0, 2, 3], [2, 3, 4], [True, True]])
    check('sliced child', solve([[[1, 3], [0, 2, 3, 99], [True, True, True, True], [True]]]), [[0, 2], [2, 3], [True]])
    check('null children', solve([[[0, 2], [2, 3], [False, True], [True]]]), [[0, 2], [None, 3], [True]])
    check('empty valid row', solve([[[0, 0], [], [], [True]]]), [[0, 0], [], [True]])
    check('null parent storage', solve([[[0, 1], [2], [True], [False]]]), [[0, 1], [2], [False]])
    check('no batches', solve([]), [[0], [], []])
    check('empty batch then row', solve([[[0], [], [], []], [[0, 1], [2], [True], [True]]]), [[0, 1], [2], [True]])
elif N == 3:
    check('two batches', solve([[[0, 2], [3, 4], [True, True], [True]], [[0, 1], [5], [True], [True]]]), [[0, 2, 3], [3, 4, 5], [True, True]])
    check('sliced child', solve([[[1, 3], [0, 3, 4, 99], [True, True, True, True], [True]]]), [[0, 2], [3, 4], [True]])
    check('null children', solve([[[0, 2], [3, 4], [False, True], [True]]]), [[0, 2], [None, 4], [True]])
    check('empty valid row', solve([[[0, 0], [], [], [True]]]), [[0, 0], [], [True]])
    check('null parent storage', solve([[[0, 1], [3], [True], [False]]]), [[0, 1], [3], [False]])
    check('no batches', solve([]), [[0], [], []])
    check('empty batch then row', solve([[[0], [], [], []], [[0, 1], [3], [True], [True]]]), [[0, 1], [3], [True]])
elif N == 4:
    check('two batches', solve([[[0, 2], [4, 5], [True, True], [True]], [[0, 1], [6], [True], [True]]]), [[0, 2, 3], [4, 5, 6], [True, True]])
    check('sliced child', solve([[[1, 3], [0, 4, 5, 99], [True, True, True, True], [True]]]), [[0, 2], [4, 5], [True]])
    check('null children', solve([[[0, 2], [4, 5], [False, True], [True]]]), [[0, 2], [None, 5], [True]])
    check('empty valid row', solve([[[0, 0], [], [], [True]]]), [[0, 0], [], [True]])
    check('null parent storage', solve([[[0, 1], [4], [True], [False]]]), [[0, 1], [4], [False]])
    check('no batches', solve([]), [[0], [], []])
    check('empty batch then row', solve([[[0], [], [], []], [[0, 1], [4], [True], [True]]]), [[0, 1], [4], [True]])
elif N == 5:
    check('two batches', solve([[[0, 2], [5, 6], [True, True], [True]], [[0, 1], [7], [True], [True]]]), [[0, 2, 3], [5, 6, 7], [True, True]])
    check('sliced child', solve([[[1, 3], [0, 5, 6, 99], [True, True, True, True], [True]]]), [[0, 2], [5, 6], [True]])
    check('null children', solve([[[0, 2], [5, 6], [False, True], [True]]]), [[0, 2], [None, 6], [True]])
    check('empty valid row', solve([[[0, 0], [], [], [True]]]), [[0, 0], [], [True]])
    check('null parent storage', solve([[[0, 1], [5], [True], [False]]]), [[0, 1], [5], [False]])
    check('no batches', solve([]), [[0], [], []])
    check('empty batch then row', solve([[[0], [], [], []], [[0, 1], [5], [True], [True]]]), [[0, 1], [5], [True]])
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:
List concatenation retains batch-local offsets.

Concatenate offset-based list batches into one compact child buffer. Rebase every row offset, copy only each batch referenced child span, preserve parent validity, and preserve child nulls. Output [offsets,visible-child,parent-validity].

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        out_offsets=[0]; out_child=[]; out_valid=[]
        for offsets,child,child_valid,parent_valid in d:
            start=offsets[0]; stop=offsets[-1]
            base=len(out_child)
            out_child.extend(child[i] if child_valid[i] else None for i in range(start,stop))
            out_offsets.extend(base+x-start for x in offsets)
            out_valid.extend(parent_valid)
        return [out_offsets,out_child,out_valid]
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('two batches', solve([[[0, 2], [1, 2], [True, True], [True]], [[0, 1], [3], [True], [True]]]), [[0, 2, 3], [1, 2, 3], [True, True]])
    check('sliced child', solve([[[1, 3], [0, 1, 2, 99], [True, True, True, True], [True]]]), [[0, 2], [1, 2], [True]])
    check('null children', solve([[[0, 2], [1, 2], [False, True], [True]]]), [[0, 2], [None, 2], [True]])
    check('empty valid row', solve([[[0, 0], [], [], [True]]]), [[0, 0], [], [True]])
    check('null parent storage', solve([[[0, 1], [1], [True], [False]]]), [[0, 1], [1], [False]])
    check('no batches', solve([]), [[0], [], []])
    check('empty batch then row', solve([[[0], [], [], []], [[0, 1], [1], [True], [True]]]), [[0, 1], [1], [True]])
elif N == 2:
    check('two batches', solve([[[0, 2], [2, 3], [True, True], [True]], [[0, 1], [4], [True], [True]]]), [[0, 2, 3], [2, 3, 4], [True, True]])
    check('sliced child', solve([[[1, 3], [0, 2, 3, 99], [True, True, True, True], [True]]]), [[0, 2], [2, 3], [True]])
    check('null children', solve([[[0, 2], [2, 3], [False, True], [True]]]), [[0, 2], [None, 3], [True]])
    check('empty valid row', solve([[[0, 0], [], [], [True]]]), [[0, 0], [], [True]])
    check('null parent storage', solve([[[0, 1], [2], [True], [False]]]), [[0, 1], [2], [False]])
    check('no batches', solve([]), [[0], [], []])
    check('empty batch then row', solve([[[0], [], [], []], [[0, 1], [2], [True], [True]]]), [[0, 1], [2], [True]])
elif N == 3:
    check('two batches', solve([[[0, 2], [3, 4], [True, True], [True]], [[0, 1], [5], [True], [True]]]), [[0, 2, 3], [3, 4, 5], [True, True]])
    check('sliced child', solve([[[1, 3], [0, 3, 4, 99], [True, True, True, True], [True]]]), [[0, 2], [3, 4], [True]])
    check('null children', solve([[[0, 2], [3, 4], [False, True], [True]]]), [[0, 2], [None, 4], [True]])
    check('empty valid row', solve([[[0, 0], [], [], [True]]]), [[0, 0], [], [True]])
    check('null parent storage', solve([[[0, 1], [3], [True], [False]]]), [[0, 1], [3], [False]])
    check('no batches', solve([]), [[0], [], []])
    check('empty batch then row', solve([[[0], [], [], []], [[0, 1], [3], [True], [True]]]), [[0, 1], [3], [True]])
elif N == 4:
    check('two batches', solve([[[0, 2], [4, 5], [True, True], [True]], [[0, 1], [6], [True], [True]]]), [[0, 2, 3], [4, 5, 6], [True, True]])
    check('sliced child', solve([[[1, 3], [0, 4, 5, 99], [True, True, True, True], [True]]]), [[0, 2], [4, 5], [True]])
    check('null children', solve([[[0, 2], [4, 5], [False, True], [True]]]), [[0, 2], [None, 5], [True]])
    check('empty valid row', solve([[[0, 0], [], [], [True]]]), [[0, 0], [], [True]])
    check('null parent storage', solve([[[0, 1], [4], [True], [False]]]), [[0, 1], [4], [False]])
    check('no batches', solve([]), [[0], [], []])
    check('empty batch then row', solve([[[0], [], [], []], [[0, 1], [4], [True], [True]]]), [[0, 1], [4], [True]])
elif N == 5:
    check('two batches', solve([[[0, 2], [5, 6], [True, True], [True]], [[0, 1], [7], [True], [True]]]), [[0, 2, 3], [5, 6, 7], [True, True]])
    check('sliced child', solve([[[1, 3], [0, 5, 6, 99], [True, True, True, True], [True]]]), [[0, 2], [5, 6], [True]])
    check('null children', solve([[[0, 2], [5, 6], [False, True], [True]]]), [[0, 2], [None, 6], [True]])
    check('empty valid row', solve([[[0, 0], [], [], [True]]]), [[0, 0], [], [True]])
    check('null parent storage', solve([[[0, 1], [5], [True], [False]]]), [[0, 1], [5], [False]])
    check('no batches', solve([]), [[0], [], []])
    check('empty batch then row', solve([[[0], [], [], []], [[0, 1], [5], [True], [True]]]), [[0, 1], [5], [True]])
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(d):
    try:
        out_offsets=[0]; out_child=[]; out_valid=[]
        for offsets,child,child_valid,parent_valid in d:
            start=offsets[0]; stop=offsets[-1]
            base=len(out_child)
            out_child.extend(child[i] if child_valid[i] else None for i in range(start,stop))
            out_offsets.extend(base+x-start for x in offsets[:-1])
            out_valid.extend(parent_valid)
        return [out_offsets,out_child,out_valid]
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('two batches', solve([[[0, 2], [1, 2], [True, True], [True]], [[0, 1], [3], [True], [True]]]), [[0, 2, 3], [1, 2, 3], [True, True]])
    check('sliced child', solve([[[1, 3], [0, 1, 2, 99], [True, True, True, True], [True]]]), [[0, 2], [1, 2], [True]])
    check('null children', solve([[[0, 2], [1, 2], [False, True], [True]]]), [[0, 2], [None, 2], [True]])
    check('empty valid row', solve([[[0, 0], [], [], [True]]]), [[0, 0], [], [True]])
    check('null parent storage', solve([[[0, 1], [1], [True], [False]]]), [[0, 1], [1], [False]])
    check('no batches', solve([]), [[0], [], []])
    check('empty batch then row', solve([[[0], [], [], []], [[0, 1], [1], [True], [True]]]), [[0, 1], [1], [True]])
elif N == 2:
    check('two batches', solve([[[0, 2], [2, 3], [True, True], [True]], [[0, 1], [4], [True], [True]]]), [[0, 2, 3], [2, 3, 4], [True, True]])
    check('sliced child', solve([[[1, 3], [0, 2, 3, 99], [True, True, True, True], [True]]]), [[0, 2], [2, 3], [True]])
    check('null children', solve([[[0, 2], [2, 3], [False, True], [True]]]), [[0, 2], [None, 3], [True]])
    check('empty valid row', solve([[[0, 0], [], [], [True]]]), [[0, 0], [], [True]])
    check('null parent storage', solve([[[0, 1], [2], [True], [False]]]), [[0, 1], [2], [False]])
    check('no batches', solve([]), [[0], [], []])
    check('empty batch then row', solve([[[0], [], [], []], [[0, 1], [2], [True], [True]]]), [[0, 1], [2], [True]])
elif N == 3:
    check('two batches', solve([[[0, 2], [3, 4], [True, True], [True]], [[0, 1], [5], [True], [True]]]), [[0, 2, 3], [3, 4, 5], [True, True]])
    check('sliced child', solve([[[1, 3], [0, 3, 4, 99], [True, True, True, True], [True]]]), [[0, 2], [3, 4], [True]])
    check('null children', solve([[[0, 2], [3, 4], [False, True], [True]]]), [[0, 2], [None, 4], [True]])
    check('empty valid row', solve([[[0, 0], [], [], [True]]]), [[0, 0], [], [True]])
    check('null parent storage', solve([[[0, 1], [3], [True], [False]]]), [[0, 1], [3], [False]])
    check('no batches', solve([]), [[0], [], []])
    check('empty batch then row', solve([[[0], [], [], []], [[0, 1], [3], [True], [True]]]), [[0, 1], [3], [True]])
elif N == 4:
    check('two batches', solve([[[0, 2], [4, 5], [True, True], [True]], [[0, 1], [6], [True], [True]]]), [[0, 2, 3], [4, 5, 6], [True, True]])
    check('sliced child', solve([[[1, 3], [0, 4, 5, 99], [True, True, True, True], [True]]]), [[0, 2], [4, 5], [True]])
    check('null children', solve([[[0, 2], [4, 5], [False, True], [True]]]), [[0, 2], [None, 5], [True]])
    check('empty valid row', solve([[[0, 0], [], [], [True]]]), [[0, 0], [], [True]])
    check('null parent storage', solve([[[0, 1], [4], [True], [False]]]), [[0, 1], [4], [False]])
    check('no batches', solve([]), [[0], [], []])
    check('empty batch then row', solve([[[0], [], [], []], [[0, 1], [4], [True], [True]]]), [[0, 1], [4], [True]])
elif N == 5:
    check('two batches', solve([[[0, 2], [5, 6], [True, True], [True]], [[0, 1], [7], [True], [True]]]), [[0, 2, 3], [5, 6, 7], [True, True]])
    check('sliced child', solve([[[1, 3], [0, 5, 6, 99], [True, True, True, True], [True]]]), [[0, 2], [5, 6], [True]])
    check('null children', solve([[[0, 2], [5, 6], [False, True], [True]]]), [[0, 2], [None, 6], [True]])
    check('empty valid row', solve([[[0, 0], [], [], [True]]]), [[0, 0], [], [True]])
    check('null parent storage', solve([[[0, 1], [5], [True], [False]]]), [[0, 1], [5], [False]])
    check('no batches', solve([]), [[0], [], []])
    check('empty batch then row', solve([[[0], [], [], []], [[0, 1], [5], [True], [True]]]), [[0, 1], [5], [True]])
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:
List concatenation repeats each batch initial offset sentinel.

Concatenate offset-based list batches into one compact child buffer. Rebase every row offset, copy only each batch referenced child span, preserve parent validity, and preserve child nulls. Output [offsets,visible-child,parent-validity].

split: open-access