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

N = 1
observations = []
def solve(d):
    try:
        merged=[]; batches=[]
        for dictionary,codes,valid in d:
            for value in dictionary:
                if value not in merged: merged.append(value)
            mapping=[merged.index(v) if v in merged else -1 for v in dictionary]
            rewritten=[mapping[c] for i,c in enumerate(codes)]
            batches.append(rewritten)
        return [merged,batches]
    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('overlapping domains', solve([[[1, 2], [1, 0], [True, True]], [[3, 1], [1, 0], [True, True]]]), [[1, 2, 3], [[1, 0], [0, 2]]])
    check('unused values', solve([[[1, 2, 3], [1], [True]]]), [[1, 2, 3], [[1]]])
    check('nonadjacent duplicate', solve([[[1, 2, 1], [2, 0], [True, True]]]), [[1, 2], [[0, 0]]])
    check('null lanes', solve([[[1, 2], [1, 0], [False, True]]]), [[1, 2], [[None, 0]]])
    check('empty batch', solve([[[1], [], []], [[2], [0], [True]]]), [[1, 2], [[], [1]]])
    check('no batches', solve([]), [[], []])
    check('single domain', solve([[[1], [0, 0], [True, True]]]), [[1], [[0, 0]]])
elif N == 2:
    check('overlapping domains', solve([[[2, 3], [1, 0], [True, True]], [[4, 2], [1, 0], [True, True]]]), [[2, 3, 4], [[1, 0], [0, 2]]])
    check('unused values', solve([[[2, 3, 4], [1], [True]]]), [[2, 3, 4], [[1]]])
    check('nonadjacent duplicate', solve([[[2, 3, 2], [2, 0], [True, True]]]), [[2, 3], [[0, 0]]])
    check('null lanes', solve([[[2, 3], [1, 0], [False, True]]]), [[2, 3], [[None, 0]]])
    check('empty batch', solve([[[2], [], []], [[3], [0], [True]]]), [[2, 3], [[], [1]]])
    check('no batches', solve([]), [[], []])
    check('single domain', solve([[[2], [0, 0], [True, True]]]), [[2], [[0, 0]]])
elif N == 3:
    check('overlapping domains', solve([[[3, 4], [1, 0], [True, True]], [[5, 3], [1, 0], [True, True]]]), [[3, 4, 5], [[1, 0], [0, 2]]])
    check('unused values', solve([[[3, 4, 5], [1], [True]]]), [[3, 4, 5], [[1]]])
    check('nonadjacent duplicate', solve([[[3, 4, 3], [2, 0], [True, True]]]), [[3, 4], [[0, 0]]])
    check('null lanes', solve([[[3, 4], [1, 0], [False, True]]]), [[3, 4], [[None, 0]]])
    check('empty batch', solve([[[3], [], []], [[4], [0], [True]]]), [[3, 4], [[], [1]]])
    check('no batches', solve([]), [[], []])
    check('single domain', solve([[[3], [0, 0], [True, True]]]), [[3], [[0, 0]]])
elif N == 4:
    check('overlapping domains', solve([[[4, 5], [1, 0], [True, True]], [[6, 4], [1, 0], [True, True]]]), [[4, 5, 6], [[1, 0], [0, 2]]])
    check('unused values', solve([[[4, 5, 6], [1], [True]]]), [[4, 5, 6], [[1]]])
    check('nonadjacent duplicate', solve([[[4, 5, 4], [2, 0], [True, True]]]), [[4, 5], [[0, 0]]])
    check('null lanes', solve([[[4, 5], [1, 0], [False, True]]]), [[4, 5], [[None, 0]]])
    check('empty batch', solve([[[4], [], []], [[5], [0], [True]]]), [[4, 5], [[], [1]]])
    check('no batches', solve([]), [[], []])
    check('single domain', solve([[[4], [0, 0], [True, True]]]), [[4], [[0, 0]]])
elif N == 5:
    check('overlapping domains', solve([[[5, 6], [1, 0], [True, True]], [[7, 5], [1, 0], [True, True]]]), [[5, 6, 7], [[1, 0], [0, 2]]])
    check('unused values', solve([[[5, 6, 7], [1], [True]]]), [[5, 6, 7], [[1]]])
    check('nonadjacent duplicate', solve([[[5, 6, 5], [2, 0], [True, True]]]), [[5, 6], [[0, 0]]])
    check('null lanes', solve([[[5, 6], [1, 0], [False, True]]]), [[5, 6], [[None, 0]]])
    check('empty batch', solve([[[5], [], []], [[6], [0], [True]]]), [[5, 6], [[], [1]]])
    check('no batches', solve([]), [[], []])
    check('single domain', solve([[[5], [0, 0], [True, True]]]), [[5], [[0, 0]]])
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:
        merged=[]; batches=[]
        for dictionary,codes,valid in d:
            for value in dictionary:
                if value not in merged: merged.append(value)
            mapping=[merged.index(v) if v in merged else -1 for v in dictionary]
            rewritten=[mapping[c] if valid[i] else 0 for i,c in enumerate(codes)]
            batches.append(rewritten)
        return [merged,batches]
    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('overlapping domains', solve([[[1, 2], [1, 0], [True, True]], [[3, 1], [1, 0], [True, True]]]), [[1, 2, 3], [[1, 0], [0, 2]]])
    check('unused values', solve([[[1, 2, 3], [1], [True]]]), [[1, 2, 3], [[1]]])
    check('nonadjacent duplicate', solve([[[1, 2, 1], [2, 0], [True, True]]]), [[1, 2], [[0, 0]]])
    check('null lanes', solve([[[1, 2], [1, 0], [False, True]]]), [[1, 2], [[None, 0]]])
    check('empty batch', solve([[[1], [], []], [[2], [0], [True]]]), [[1, 2], [[], [1]]])
    check('no batches', solve([]), [[], []])
    check('single domain', solve([[[1], [0, 0], [True, True]]]), [[1], [[0, 0]]])
elif N == 2:
    check('overlapping domains', solve([[[2, 3], [1, 0], [True, True]], [[4, 2], [1, 0], [True, True]]]), [[2, 3, 4], [[1, 0], [0, 2]]])
    check('unused values', solve([[[2, 3, 4], [1], [True]]]), [[2, 3, 4], [[1]]])
    check('nonadjacent duplicate', solve([[[2, 3, 2], [2, 0], [True, True]]]), [[2, 3], [[0, 0]]])
    check('null lanes', solve([[[2, 3], [1, 0], [False, True]]]), [[2, 3], [[None, 0]]])
    check('empty batch', solve([[[2], [], []], [[3], [0], [True]]]), [[2, 3], [[], [1]]])
    check('no batches', solve([]), [[], []])
    check('single domain', solve([[[2], [0, 0], [True, True]]]), [[2], [[0, 0]]])
elif N == 3:
    check('overlapping domains', solve([[[3, 4], [1, 0], [True, True]], [[5, 3], [1, 0], [True, True]]]), [[3, 4, 5], [[1, 0], [0, 2]]])
    check('unused values', solve([[[3, 4, 5], [1], [True]]]), [[3, 4, 5], [[1]]])
    check('nonadjacent duplicate', solve([[[3, 4, 3], [2, 0], [True, True]]]), [[3, 4], [[0, 0]]])
    check('null lanes', solve([[[3, 4], [1, 0], [False, True]]]), [[3, 4], [[None, 0]]])
    check('empty batch', solve([[[3], [], []], [[4], [0], [True]]]), [[3, 4], [[], [1]]])
    check('no batches', solve([]), [[], []])
    check('single domain', solve([[[3], [0, 0], [True, True]]]), [[3], [[0, 0]]])
elif N == 4:
    check('overlapping domains', solve([[[4, 5], [1, 0], [True, True]], [[6, 4], [1, 0], [True, True]]]), [[4, 5, 6], [[1, 0], [0, 2]]])
    check('unused values', solve([[[4, 5, 6], [1], [True]]]), [[4, 5, 6], [[1]]])
    check('nonadjacent duplicate', solve([[[4, 5, 4], [2, 0], [True, True]]]), [[4, 5], [[0, 0]]])
    check('null lanes', solve([[[4, 5], [1, 0], [False, True]]]), [[4, 5], [[None, 0]]])
    check('empty batch', solve([[[4], [], []], [[5], [0], [True]]]), [[4, 5], [[], [1]]])
    check('no batches', solve([]), [[], []])
    check('single domain', solve([[[4], [0, 0], [True, True]]]), [[4], [[0, 0]]])
elif N == 5:
    check('overlapping domains', solve([[[5, 6], [1, 0], [True, True]], [[7, 5], [1, 0], [True, True]]]), [[5, 6, 7], [[1, 0], [0, 2]]])
    check('unused values', solve([[[5, 6, 7], [1], [True]]]), [[5, 6, 7], [[1]]])
    check('nonadjacent duplicate', solve([[[5, 6, 5], [2, 0], [True, True]]]), [[5, 6], [[0, 0]]])
    check('null lanes', solve([[[5, 6], [1, 0], [False, True]]]), [[5, 6], [[None, 0]]])
    check('empty batch', solve([[[5], [], []], [[6], [0], [True]]]), [[5, 6], [[], [1]]])
    check('no batches', solve([]), [[], []])
    check('single domain', solve([[[5], [0, 0], [True, True]]]), [[5], [[0, 0]]])
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:
Null dictionary lanes are decoded as real values.

Unify dictionaries from ordered batches by first encountered dictionary value, including unused values. Rewrite valid local indices into the unified domain, retaining null lanes and batch boundaries; duplicate dictionary values share one code.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        merged=[]; batches=[]
        for dictionary,codes,valid in d:
            for value in dictionary:
                if value not in merged: merged.append(value)
            mapping=[merged.index(v) if v in merged else -1 for v in dictionary]
            rewritten=[mapping[c] if valid[i] else None for i,c in enumerate(codes)]
            batches.extend(rewritten)
        return [merged,batches]
    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('overlapping domains', solve([[[1, 2], [1, 0], [True, True]], [[3, 1], [1, 0], [True, True]]]), [[1, 2, 3], [[1, 0], [0, 2]]])
    check('unused values', solve([[[1, 2, 3], [1], [True]]]), [[1, 2, 3], [[1]]])
    check('nonadjacent duplicate', solve([[[1, 2, 1], [2, 0], [True, True]]]), [[1, 2], [[0, 0]]])
    check('null lanes', solve([[[1, 2], [1, 0], [False, True]]]), [[1, 2], [[None, 0]]])
    check('empty batch', solve([[[1], [], []], [[2], [0], [True]]]), [[1, 2], [[], [1]]])
    check('no batches', solve([]), [[], []])
    check('single domain', solve([[[1], [0, 0], [True, True]]]), [[1], [[0, 0]]])
elif N == 2:
    check('overlapping domains', solve([[[2, 3], [1, 0], [True, True]], [[4, 2], [1, 0], [True, True]]]), [[2, 3, 4], [[1, 0], [0, 2]]])
    check('unused values', solve([[[2, 3, 4], [1], [True]]]), [[2, 3, 4], [[1]]])
    check('nonadjacent duplicate', solve([[[2, 3, 2], [2, 0], [True, True]]]), [[2, 3], [[0, 0]]])
    check('null lanes', solve([[[2, 3], [1, 0], [False, True]]]), [[2, 3], [[None, 0]]])
    check('empty batch', solve([[[2], [], []], [[3], [0], [True]]]), [[2, 3], [[], [1]]])
    check('no batches', solve([]), [[], []])
    check('single domain', solve([[[2], [0, 0], [True, True]]]), [[2], [[0, 0]]])
elif N == 3:
    check('overlapping domains', solve([[[3, 4], [1, 0], [True, True]], [[5, 3], [1, 0], [True, True]]]), [[3, 4, 5], [[1, 0], [0, 2]]])
    check('unused values', solve([[[3, 4, 5], [1], [True]]]), [[3, 4, 5], [[1]]])
    check('nonadjacent duplicate', solve([[[3, 4, 3], [2, 0], [True, True]]]), [[3, 4], [[0, 0]]])
    check('null lanes', solve([[[3, 4], [1, 0], [False, True]]]), [[3, 4], [[None, 0]]])
    check('empty batch', solve([[[3], [], []], [[4], [0], [True]]]), [[3, 4], [[], [1]]])
    check('no batches', solve([]), [[], []])
    check('single domain', solve([[[3], [0, 0], [True, True]]]), [[3], [[0, 0]]])
elif N == 4:
    check('overlapping domains', solve([[[4, 5], [1, 0], [True, True]], [[6, 4], [1, 0], [True, True]]]), [[4, 5, 6], [[1, 0], [0, 2]]])
    check('unused values', solve([[[4, 5, 6], [1], [True]]]), [[4, 5, 6], [[1]]])
    check('nonadjacent duplicate', solve([[[4, 5, 4], [2, 0], [True, True]]]), [[4, 5], [[0, 0]]])
    check('null lanes', solve([[[4, 5], [1, 0], [False, True]]]), [[4, 5], [[None, 0]]])
    check('empty batch', solve([[[4], [], []], [[5], [0], [True]]]), [[4, 5], [[], [1]]])
    check('no batches', solve([]), [[], []])
    check('single domain', solve([[[4], [0, 0], [True, True]]]), [[4], [[0, 0]]])
elif N == 5:
    check('overlapping domains', solve([[[5, 6], [1, 0], [True, True]], [[7, 5], [1, 0], [True, True]]]), [[5, 6, 7], [[1, 0], [0, 2]]])
    check('unused values', solve([[[5, 6, 7], [1], [True]]]), [[5, 6, 7], [[1]]])
    check('nonadjacent duplicate', solve([[[5, 6, 5], [2, 0], [True, True]]]), [[5, 6], [[0, 0]]])
    check('null lanes', solve([[[5, 6], [1, 0], [False, True]]]), [[5, 6], [[None, 0]]])
    check('empty batch', solve([[[5], [], []], [[6], [0], [True]]]), [[5, 6], [[], [1]]])
    check('no batches', solve([]), [[], []])
    check('single domain', solve([[[5], [0, 0], [True, True]]]), [[5], [[0, 0]]])
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:
        merged=[]; batches=[]
        for dictionary,codes,valid in d:
            for value in dictionary:
                if value not in merged: merged.append(value)
            mapping=[merged.index(v) if v in merged else -1 for v in dictionary]
            rewritten=[mapping[c] if valid[i] else None for i,c in enumerate(codes)]
            batches.extend([rewritten] if rewritten else [])
        return [merged,batches]
    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('overlapping domains', solve([[[1, 2], [1, 0], [True, True]], [[3, 1], [1, 0], [True, True]]]), [[1, 2, 3], [[1, 0], [0, 2]]])
    check('unused values', solve([[[1, 2, 3], [1], [True]]]), [[1, 2, 3], [[1]]])
    check('nonadjacent duplicate', solve([[[1, 2, 1], [2, 0], [True, True]]]), [[1, 2], [[0, 0]]])
    check('null lanes', solve([[[1, 2], [1, 0], [False, True]]]), [[1, 2], [[None, 0]]])
    check('empty batch', solve([[[1], [], []], [[2], [0], [True]]]), [[1, 2], [[], [1]]])
    check('no batches', solve([]), [[], []])
    check('single domain', solve([[[1], [0, 0], [True, True]]]), [[1], [[0, 0]]])
elif N == 2:
    check('overlapping domains', solve([[[2, 3], [1, 0], [True, True]], [[4, 2], [1, 0], [True, True]]]), [[2, 3, 4], [[1, 0], [0, 2]]])
    check('unused values', solve([[[2, 3, 4], [1], [True]]]), [[2, 3, 4], [[1]]])
    check('nonadjacent duplicate', solve([[[2, 3, 2], [2, 0], [True, True]]]), [[2, 3], [[0, 0]]])
    check('null lanes', solve([[[2, 3], [1, 0], [False, True]]]), [[2, 3], [[None, 0]]])
    check('empty batch', solve([[[2], [], []], [[3], [0], [True]]]), [[2, 3], [[], [1]]])
    check('no batches', solve([]), [[], []])
    check('single domain', solve([[[2], [0, 0], [True, True]]]), [[2], [[0, 0]]])
elif N == 3:
    check('overlapping domains', solve([[[3, 4], [1, 0], [True, True]], [[5, 3], [1, 0], [True, True]]]), [[3, 4, 5], [[1, 0], [0, 2]]])
    check('unused values', solve([[[3, 4, 5], [1], [True]]]), [[3, 4, 5], [[1]]])
    check('nonadjacent duplicate', solve([[[3, 4, 3], [2, 0], [True, True]]]), [[3, 4], [[0, 0]]])
    check('null lanes', solve([[[3, 4], [1, 0], [False, True]]]), [[3, 4], [[None, 0]]])
    check('empty batch', solve([[[3], [], []], [[4], [0], [True]]]), [[3, 4], [[], [1]]])
    check('no batches', solve([]), [[], []])
    check('single domain', solve([[[3], [0, 0], [True, True]]]), [[3], [[0, 0]]])
elif N == 4:
    check('overlapping domains', solve([[[4, 5], [1, 0], [True, True]], [[6, 4], [1, 0], [True, True]]]), [[4, 5, 6], [[1, 0], [0, 2]]])
    check('unused values', solve([[[4, 5, 6], [1], [True]]]), [[4, 5, 6], [[1]]])
    check('nonadjacent duplicate', solve([[[4, 5, 4], [2, 0], [True, True]]]), [[4, 5], [[0, 0]]])
    check('null lanes', solve([[[4, 5], [1, 0], [False, True]]]), [[4, 5], [[None, 0]]])
    check('empty batch', solve([[[4], [], []], [[5], [0], [True]]]), [[4, 5], [[], [1]]])
    check('no batches', solve([]), [[], []])
    check('single domain', solve([[[4], [0, 0], [True, True]]]), [[4], [[0, 0]]])
elif N == 5:
    check('overlapping domains', solve([[[5, 6], [1, 0], [True, True]], [[7, 5], [1, 0], [True, True]]]), [[5, 6, 7], [[1, 0], [0, 2]]])
    check('unused values', solve([[[5, 6, 7], [1], [True]]]), [[5, 6, 7], [[1]]])
    check('nonadjacent duplicate', solve([[[5, 6, 5], [2, 0], [True, True]]]), [[5, 6], [[0, 0]]])
    check('null lanes', solve([[[5, 6], [1, 0], [False, True]]]), [[5, 6], [[None, 0]]])
    check('empty batch', solve([[[5], [], []], [[6], [0], [True]]]), [[5, 6], [[], [1]]])
    check('no batches', solve([]), [[], []])
    check('single domain', solve([[[5], [0, 0], [True, True]]]), [[5], [[0, 0]]])
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:
Rewritten dictionary batches are flattened into one batch.

Unify dictionaries from ordered batches by first encountered dictionary value, including unused values. Rewrite valid local indices into the unified domain, retaining null lanes and batch boundaries; duplicate dictionary values share one code.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        ends,values,valid,start,length=d
        out=[]
        for pos in range(length):
            r=next(i for i,end in enumerate(ends) if pos < end)
            value=values[r]
            known=valid[r]
            out.append(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('crossing run boundary', solve([[2, 5], [1, 2], [True, True], 1, 3]), [1, 2, 2])
    check('start at boundary', solve([[2, 5], [1, 2], [True, True], 2, 2]), [2, 2])
    check('null middle run', solve([[1, 3, 5], [1, 2, 3], [True, False, True], 0, 5]), [1, None, None, 3, 3])
    check('null first run', solve([[1, 3], [1, 2], [False, True], 1, 2]), [2, 2])
    check('empty slice', solve([[3], [1], [True], 1, 0]), [])
    check('single run', solve([[4], [1], [True], 0, 4]), [1, 1, 1, 1])
    check('tail slice', solve([[1, 2, 6], [1, 2, 3], [True, True, True], 4, 2]), [3, 3])
elif N == 2:
    check('crossing run boundary', solve([[2, 5], [2, 3], [True, True], 1, 3]), [2, 3, 3])
    check('start at boundary', solve([[2, 5], [2, 3], [True, True], 2, 2]), [3, 3])
    check('null middle run', solve([[1, 3, 5], [2, 3, 4], [True, False, True], 0, 5]), [2, None, None, 4, 4])
    check('null first run', solve([[1, 3], [2, 3], [False, True], 1, 2]), [3, 3])
    check('empty slice', solve([[3], [2], [True], 1, 0]), [])
    check('single run', solve([[4], [2], [True], 0, 4]), [2, 2, 2, 2])
    check('tail slice', solve([[1, 2, 6], [2, 3, 4], [True, True, True], 4, 2]), [4, 4])
elif N == 3:
    check('crossing run boundary', solve([[2, 5], [3, 4], [True, True], 1, 3]), [3, 4, 4])
    check('start at boundary', solve([[2, 5], [3, 4], [True, True], 2, 2]), [4, 4])
    check('null middle run', solve([[1, 3, 5], [3, 4, 5], [True, False, True], 0, 5]), [3, None, None, 5, 5])
    check('null first run', solve([[1, 3], [3, 4], [False, True], 1, 2]), [4, 4])
    check('empty slice', solve([[3], [3], [True], 1, 0]), [])
    check('single run', solve([[4], [3], [True], 0, 4]), [3, 3, 3, 3])
    check('tail slice', solve([[1, 2, 6], [3, 4, 5], [True, True, True], 4, 2]), [5, 5])
elif N == 4:
    check('crossing run boundary', solve([[2, 5], [4, 5], [True, True], 1, 3]), [4, 5, 5])
    check('start at boundary', solve([[2, 5], [4, 5], [True, True], 2, 2]), [5, 5])
    check('null middle run', solve([[1, 3, 5], [4, 5, 6], [True, False, True], 0, 5]), [4, None, None, 6, 6])
    check('null first run', solve([[1, 3], [4, 5], [False, True], 1, 2]), [5, 5])
    check('empty slice', solve([[3], [4], [True], 1, 0]), [])
    check('single run', solve([[4], [4], [True], 0, 4]), [4, 4, 4, 4])
    check('tail slice', solve([[1, 2, 6], [4, 5, 6], [True, True, True], 4, 2]), [6, 6])
elif N == 5:
    check('crossing run boundary', solve([[2, 5], [5, 6], [True, True], 1, 3]), [5, 6, 6])
    check('start at boundary', solve([[2, 5], [5, 6], [True, True], 2, 2]), [6, 6])
    check('null middle run', solve([[1, 3, 5], [5, 6, 7], [True, False, True], 0, 5]), [5, None, None, 7, 7])
    check('null first run', solve([[1, 3], [5, 6], [False, True], 1, 2]), [6, 6])
    check('empty slice', solve([[3], [5], [True], 1, 0]), [])
    check('single run', solve([[4], [5], [True], 0, 4]), [5, 5, 5, 5])
    check('tail slice', solve([[1, 2, 6], [5, 6, 7], [True, True, True], 4, 2]), [7, 7])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(d):
    try:
        ends,values,valid,start,length=d
        out=[]
        for pos in range(start,max(start,length)):
            r=next(i for i,end in enumerate(ends) if pos < end)
            value=values[r]
            known=valid[r]
            out.append(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('crossing run boundary', solve([[2, 5], [1, 2], [True, True], 1, 3]), [1, 2, 2])
    check('start at boundary', solve([[2, 5], [1, 2], [True, True], 2, 2]), [2, 2])
    check('null middle run', solve([[1, 3, 5], [1, 2, 3], [True, False, True], 0, 5]), [1, None, None, 3, 3])
    check('null first run', solve([[1, 3], [1, 2], [False, True], 1, 2]), [2, 2])
    check('empty slice', solve([[3], [1], [True], 1, 0]), [])
    check('single run', solve([[4], [1], [True], 0, 4]), [1, 1, 1, 1])
    check('tail slice', solve([[1, 2, 6], [1, 2, 3], [True, True, True], 4, 2]), [3, 3])
elif N == 2:
    check('crossing run boundary', solve([[2, 5], [2, 3], [True, True], 1, 3]), [2, 3, 3])
    check('start at boundary', solve([[2, 5], [2, 3], [True, True], 2, 2]), [3, 3])
    check('null middle run', solve([[1, 3, 5], [2, 3, 4], [True, False, True], 0, 5]), [2, None, None, 4, 4])
    check('null first run', solve([[1, 3], [2, 3], [False, True], 1, 2]), [3, 3])
    check('empty slice', solve([[3], [2], [True], 1, 0]), [])
    check('single run', solve([[4], [2], [True], 0, 4]), [2, 2, 2, 2])
    check('tail slice', solve([[1, 2, 6], [2, 3, 4], [True, True, True], 4, 2]), [4, 4])
elif N == 3:
    check('crossing run boundary', solve([[2, 5], [3, 4], [True, True], 1, 3]), [3, 4, 4])
    check('start at boundary', solve([[2, 5], [3, 4], [True, True], 2, 2]), [4, 4])
    check('null middle run', solve([[1, 3, 5], [3, 4, 5], [True, False, True], 0, 5]), [3, None, None, 5, 5])
    check('null first run', solve([[1, 3], [3, 4], [False, True], 1, 2]), [4, 4])
    check('empty slice', solve([[3], [3], [True], 1, 0]), [])
    check('single run', solve([[4], [3], [True], 0, 4]), [3, 3, 3, 3])
    check('tail slice', solve([[1, 2, 6], [3, 4, 5], [True, True, True], 4, 2]), [5, 5])
elif N == 4:
    check('crossing run boundary', solve([[2, 5], [4, 5], [True, True], 1, 3]), [4, 5, 5])
    check('start at boundary', solve([[2, 5], [4, 5], [True, True], 2, 2]), [5, 5])
    check('null middle run', solve([[1, 3, 5], [4, 5, 6], [True, False, True], 0, 5]), [4, None, None, 6, 6])
    check('null first run', solve([[1, 3], [4, 5], [False, True], 1, 2]), [5, 5])
    check('empty slice', solve([[3], [4], [True], 1, 0]), [])
    check('single run', solve([[4], [4], [True], 0, 4]), [4, 4, 4, 4])
    check('tail slice', solve([[1, 2, 6], [4, 5, 6], [True, True, True], 4, 2]), [6, 6])
elif N == 5:
    check('crossing run boundary', solve([[2, 5], [5, 6], [True, True], 1, 3]), [5, 6, 6])
    check('start at boundary', solve([[2, 5], [5, 6], [True, True], 2, 2]), [6, 6])
    check('null middle run', solve([[1, 3, 5], [5, 6, 7], [True, False, True], 0, 5]), [5, None, None, 7, 7])
    check('null first run', solve([[1, 3], [5, 6], [False, True], 1, 2]), [6, 6])
    check('empty slice', solve([[3], [5], [True], 1, 0]), [])
    check('single run', solve([[4], [5], [True], 0, 4]), [5, 5, 5, 5])
    check('tail slice', solve([[1, 2, 6], [5, 6, 7], [True, True, True], 4, 2]), [7, 7])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Run decoding rebases positions without rebasing run ends.

Decode a run-end vector into the requested [start,start+length) slice. Run ends are exclusive cumulative positions; values and validity are stored per run. Empty slices return empty.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        ends,values,valid,start,length=d
        out=[]
        for pos in range(start,start+length):
            r=next(i for i,end in enumerate(ends) if pos <= end)
            value=values[r]
            known=valid[r]
            out.append(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('crossing run boundary', solve([[2, 5], [1, 2], [True, True], 1, 3]), [1, 2, 2])
    check('start at boundary', solve([[2, 5], [1, 2], [True, True], 2, 2]), [2, 2])
    check('null middle run', solve([[1, 3, 5], [1, 2, 3], [True, False, True], 0, 5]), [1, None, None, 3, 3])
    check('null first run', solve([[1, 3], [1, 2], [False, True], 1, 2]), [2, 2])
    check('empty slice', solve([[3], [1], [True], 1, 0]), [])
    check('single run', solve([[4], [1], [True], 0, 4]), [1, 1, 1, 1])
    check('tail slice', solve([[1, 2, 6], [1, 2, 3], [True, True, True], 4, 2]), [3, 3])
elif N == 2:
    check('crossing run boundary', solve([[2, 5], [2, 3], [True, True], 1, 3]), [2, 3, 3])
    check('start at boundary', solve([[2, 5], [2, 3], [True, True], 2, 2]), [3, 3])
    check('null middle run', solve([[1, 3, 5], [2, 3, 4], [True, False, True], 0, 5]), [2, None, None, 4, 4])
    check('null first run', solve([[1, 3], [2, 3], [False, True], 1, 2]), [3, 3])
    check('empty slice', solve([[3], [2], [True], 1, 0]), [])
    check('single run', solve([[4], [2], [True], 0, 4]), [2, 2, 2, 2])
    check('tail slice', solve([[1, 2, 6], [2, 3, 4], [True, True, True], 4, 2]), [4, 4])
elif N == 3:
    check('crossing run boundary', solve([[2, 5], [3, 4], [True, True], 1, 3]), [3, 4, 4])
    check('start at boundary', solve([[2, 5], [3, 4], [True, True], 2, 2]), [4, 4])
    check('null middle run', solve([[1, 3, 5], [3, 4, 5], [True, False, True], 0, 5]), [3, None, None, 5, 5])
    check('null first run', solve([[1, 3], [3, 4], [False, True], 1, 2]), [4, 4])
    check('empty slice', solve([[3], [3], [True], 1, 0]), [])
    check('single run', solve([[4], [3], [True], 0, 4]), [3, 3, 3, 3])
    check('tail slice', solve([[1, 2, 6], [3, 4, 5], [True, True, True], 4, 2]), [5, 5])
elif N == 4:
    check('crossing run boundary', solve([[2, 5], [4, 5], [True, True], 1, 3]), [4, 5, 5])
    check('start at boundary', solve([[2, 5], [4, 5], [True, True], 2, 2]), [5, 5])
    check('null middle run', solve([[1, 3, 5], [4, 5, 6], [True, False, True], 0, 5]), [4, None, None, 6, 6])
    check('null first run', solve([[1, 3], [4, 5], [False, True], 1, 2]), [5, 5])
    check('empty slice', solve([[3], [4], [True], 1, 0]), [])
    check('single run', solve([[4], [4], [True], 0, 4]), [4, 4, 4, 4])
    check('tail slice', solve([[1, 2, 6], [4, 5, 6], [True, True, True], 4, 2]), [6, 6])
elif N == 5:
    check('crossing run boundary', solve([[2, 5], [5, 6], [True, True], 1, 3]), [5, 6, 6])
    check('start at boundary', solve([[2, 5], [5, 6], [True, True], 2, 2]), [6, 6])
    check('null middle run', solve([[1, 3, 5], [5, 6, 7], [True, False, True], 0, 5]), [5, None, None, 7, 7])
    check('null first run', solve([[1, 3], [5, 6], [False, True], 1, 2]), [6, 6])
    check('empty slice', solve([[3], [5], [True], 1, 0]), [])
    check('single run', solve([[4], [5], [True], 0, 4]), [5, 5, 5, 5])
    check('tail slice', solve([[1, 2, 6], [5, 6, 7], [True, True, True], 4, 2]), [7, 7])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(d):
    try:
        ends,values,valid,start,length=d
        out=[]
        for pos in range(start,start+length):
            r=next(i for i,end in enumerate(ends) if pos < end or i==0)
            value=values[r]
            known=valid[r]
            out.append(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('crossing run boundary', solve([[2, 5], [1, 2], [True, True], 1, 3]), [1, 2, 2])
    check('start at boundary', solve([[2, 5], [1, 2], [True, True], 2, 2]), [2, 2])
    check('null middle run', solve([[1, 3, 5], [1, 2, 3], [True, False, True], 0, 5]), [1, None, None, 3, 3])
    check('null first run', solve([[1, 3], [1, 2], [False, True], 1, 2]), [2, 2])
    check('empty slice', solve([[3], [1], [True], 1, 0]), [])
    check('single run', solve([[4], [1], [True], 0, 4]), [1, 1, 1, 1])
    check('tail slice', solve([[1, 2, 6], [1, 2, 3], [True, True, True], 4, 2]), [3, 3])
elif N == 2:
    check('crossing run boundary', solve([[2, 5], [2, 3], [True, True], 1, 3]), [2, 3, 3])
    check('start at boundary', solve([[2, 5], [2, 3], [True, True], 2, 2]), [3, 3])
    check('null middle run', solve([[1, 3, 5], [2, 3, 4], [True, False, True], 0, 5]), [2, None, None, 4, 4])
    check('null first run', solve([[1, 3], [2, 3], [False, True], 1, 2]), [3, 3])
    check('empty slice', solve([[3], [2], [True], 1, 0]), [])
    check('single run', solve([[4], [2], [True], 0, 4]), [2, 2, 2, 2])
    check('tail slice', solve([[1, 2, 6], [2, 3, 4], [True, True, True], 4, 2]), [4, 4])
elif N == 3:
    check('crossing run boundary', solve([[2, 5], [3, 4], [True, True], 1, 3]), [3, 4, 4])
    check('start at boundary', solve([[2, 5], [3, 4], [True, True], 2, 2]), [4, 4])
    check('null middle run', solve([[1, 3, 5], [3, 4, 5], [True, False, True], 0, 5]), [3, None, None, 5, 5])
    check('null first run', solve([[1, 3], [3, 4], [False, True], 1, 2]), [4, 4])
    check('empty slice', solve([[3], [3], [True], 1, 0]), [])
    check('single run', solve([[4], [3], [True], 0, 4]), [3, 3, 3, 3])
    check('tail slice', solve([[1, 2, 6], [3, 4, 5], [True, True, True], 4, 2]), [5, 5])
elif N == 4:
    check('crossing run boundary', solve([[2, 5], [4, 5], [True, True], 1, 3]), [4, 5, 5])
    check('start at boundary', solve([[2, 5], [4, 5], [True, True], 2, 2]), [5, 5])
    check('null middle run', solve([[1, 3, 5], [4, 5, 6], [True, False, True], 0, 5]), [4, None, None, 6, 6])
    check('null first run', solve([[1, 3], [4, 5], [False, True], 1, 2]), [5, 5])
    check('empty slice', solve([[3], [4], [True], 1, 0]), [])
    check('single run', solve([[4], [4], [True], 0, 4]), [4, 4, 4, 4])
    check('tail slice', solve([[1, 2, 6], [4, 5, 6], [True, True, True], 4, 2]), [6, 6])
elif N == 5:
    check('crossing run boundary', solve([[2, 5], [5, 6], [True, True], 1, 3]), [5, 6, 6])
    check('start at boundary', solve([[2, 5], [5, 6], [True, True], 2, 2]), [6, 6])
    check('null middle run', solve([[1, 3, 5], [5, 6, 7], [True, False, True], 0, 5]), [5, None, None, 7, 7])
    check('null first run', solve([[1, 3], [5, 6], [False, True], 1, 2]), [6, 6])
    check('empty slice', solve([[3], [5], [True], 1, 0]), [])
    check('single run', solve([[4], [5], [True], 0, 4]), [5, 5, 5, 5])
    check('tail slice', solve([[1, 2, 6], [5, 6, 7], [True, True, True], 4, 2]), [7, 7])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
An exclusive run end is treated as its last included position.

Decode a run-end vector into the requested [start,start+length) slice. Run ends are exclusive cumulative positions; values and validity are stored per run. Empty slices return empty.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        ends,values,valid,start,length=d
        out=[]
        for pos in range(start,start+length):
            r=next(i for i,end in enumerate(ends) if pos < end)
            value=values[min(pos,len(values)-1)]
            known=valid[r]
            out.append(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('crossing run boundary', solve([[2, 5], [1, 2], [True, True], 1, 3]), [1, 2, 2])
    check('start at boundary', solve([[2, 5], [1, 2], [True, True], 2, 2]), [2, 2])
    check('null middle run', solve([[1, 3, 5], [1, 2, 3], [True, False, True], 0, 5]), [1, None, None, 3, 3])
    check('null first run', solve([[1, 3], [1, 2], [False, True], 1, 2]), [2, 2])
    check('empty slice', solve([[3], [1], [True], 1, 0]), [])
    check('single run', solve([[4], [1], [True], 0, 4]), [1, 1, 1, 1])
    check('tail slice', solve([[1, 2, 6], [1, 2, 3], [True, True, True], 4, 2]), [3, 3])
elif N == 2:
    check('crossing run boundary', solve([[2, 5], [2, 3], [True, True], 1, 3]), [2, 3, 3])
    check('start at boundary', solve([[2, 5], [2, 3], [True, True], 2, 2]), [3, 3])
    check('null middle run', solve([[1, 3, 5], [2, 3, 4], [True, False, True], 0, 5]), [2, None, None, 4, 4])
    check('null first run', solve([[1, 3], [2, 3], [False, True], 1, 2]), [3, 3])
    check('empty slice', solve([[3], [2], [True], 1, 0]), [])
    check('single run', solve([[4], [2], [True], 0, 4]), [2, 2, 2, 2])
    check('tail slice', solve([[1, 2, 6], [2, 3, 4], [True, True, True], 4, 2]), [4, 4])
elif N == 3:
    check('crossing run boundary', solve([[2, 5], [3, 4], [True, True], 1, 3]), [3, 4, 4])
    check('start at boundary', solve([[2, 5], [3, 4], [True, True], 2, 2]), [4, 4])
    check('null middle run', solve([[1, 3, 5], [3, 4, 5], [True, False, True], 0, 5]), [3, None, None, 5, 5])
    check('null first run', solve([[1, 3], [3, 4], [False, True], 1, 2]), [4, 4])
    check('empty slice', solve([[3], [3], [True], 1, 0]), [])
    check('single run', solve([[4], [3], [True], 0, 4]), [3, 3, 3, 3])
    check('tail slice', solve([[1, 2, 6], [3, 4, 5], [True, True, True], 4, 2]), [5, 5])
elif N == 4:
    check('crossing run boundary', solve([[2, 5], [4, 5], [True, True], 1, 3]), [4, 5, 5])
    check('start at boundary', solve([[2, 5], [4, 5], [True, True], 2, 2]), [5, 5])
    check('null middle run', solve([[1, 3, 5], [4, 5, 6], [True, False, True], 0, 5]), [4, None, None, 6, 6])
    check('null first run', solve([[1, 3], [4, 5], [False, True], 1, 2]), [5, 5])
    check('empty slice', solve([[3], [4], [True], 1, 0]), [])
    check('single run', solve([[4], [4], [True], 0, 4]), [4, 4, 4, 4])
    check('tail slice', solve([[1, 2, 6], [4, 5, 6], [True, True, True], 4, 2]), [6, 6])
elif N == 5:
    check('crossing run boundary', solve([[2, 5], [5, 6], [True, True], 1, 3]), [5, 6, 6])
    check('start at boundary', solve([[2, 5], [5, 6], [True, True], 2, 2]), [6, 6])
    check('null middle run', solve([[1, 3, 5], [5, 6, 7], [True, False, True], 0, 5]), [5, None, None, 7, 7])
    check('null first run', solve([[1, 3], [5, 6], [False, True], 1, 2]), [6, 6])
    check('empty slice', solve([[3], [5], [True], 1, 0]), [])
    check('single run', solve([[4], [5], [True], 0, 4]), [5, 5, 5, 5])
    check('tail slice', solve([[1, 2, 6], [5, 6, 7], [True, True, True], 4, 2]), [7, 7])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(d):
    try:
        ends,values,valid,start,length=d
        out=[]
        for pos in range(start,start+length):
            r=next(i for i,end in enumerate(ends) if pos < end)
            value=values[min(pos-start,len(values)-1)]
            known=valid[r]
            out.append(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('crossing run boundary', solve([[2, 5], [1, 2], [True, True], 1, 3]), [1, 2, 2])
    check('start at boundary', solve([[2, 5], [1, 2], [True, True], 2, 2]), [2, 2])
    check('null middle run', solve([[1, 3, 5], [1, 2, 3], [True, False, True], 0, 5]), [1, None, None, 3, 3])
    check('null first run', solve([[1, 3], [1, 2], [False, True], 1, 2]), [2, 2])
    check('empty slice', solve([[3], [1], [True], 1, 0]), [])
    check('single run', solve([[4], [1], [True], 0, 4]), [1, 1, 1, 1])
    check('tail slice', solve([[1, 2, 6], [1, 2, 3], [True, True, True], 4, 2]), [3, 3])
elif N == 2:
    check('crossing run boundary', solve([[2, 5], [2, 3], [True, True], 1, 3]), [2, 3, 3])
    check('start at boundary', solve([[2, 5], [2, 3], [True, True], 2, 2]), [3, 3])
    check('null middle run', solve([[1, 3, 5], [2, 3, 4], [True, False, True], 0, 5]), [2, None, None, 4, 4])
    check('null first run', solve([[1, 3], [2, 3], [False, True], 1, 2]), [3, 3])
    check('empty slice', solve([[3], [2], [True], 1, 0]), [])
    check('single run', solve([[4], [2], [True], 0, 4]), [2, 2, 2, 2])
    check('tail slice', solve([[1, 2, 6], [2, 3, 4], [True, True, True], 4, 2]), [4, 4])
elif N == 3:
    check('crossing run boundary', solve([[2, 5], [3, 4], [True, True], 1, 3]), [3, 4, 4])
    check('start at boundary', solve([[2, 5], [3, 4], [True, True], 2, 2]), [4, 4])
    check('null middle run', solve([[1, 3, 5], [3, 4, 5], [True, False, True], 0, 5]), [3, None, None, 5, 5])
    check('null first run', solve([[1, 3], [3, 4], [False, True], 1, 2]), [4, 4])
    check('empty slice', solve([[3], [3], [True], 1, 0]), [])
    check('single run', solve([[4], [3], [True], 0, 4]), [3, 3, 3, 3])
    check('tail slice', solve([[1, 2, 6], [3, 4, 5], [True, True, True], 4, 2]), [5, 5])
elif N == 4:
    check('crossing run boundary', solve([[2, 5], [4, 5], [True, True], 1, 3]), [4, 5, 5])
    check('start at boundary', solve([[2, 5], [4, 5], [True, True], 2, 2]), [5, 5])
    check('null middle run', solve([[1, 3, 5], [4, 5, 6], [True, False, True], 0, 5]), [4, None, None, 6, 6])
    check('null first run', solve([[1, 3], [4, 5], [False, True], 1, 2]), [5, 5])
    check('empty slice', solve([[3], [4], [True], 1, 0]), [])
    check('single run', solve([[4], [4], [True], 0, 4]), [4, 4, 4, 4])
    check('tail slice', solve([[1, 2, 6], [4, 5, 6], [True, True, True], 4, 2]), [6, 6])
elif N == 5:
    check('crossing run boundary', solve([[2, 5], [5, 6], [True, True], 1, 3]), [5, 6, 6])
    check('start at boundary', solve([[2, 5], [5, 6], [True, True], 2, 2]), [6, 6])
    check('null middle run', solve([[1, 3, 5], [5, 6, 7], [True, False, True], 0, 5]), [5, None, None, 7, 7])
    check('null first run', solve([[1, 3], [5, 6], [False, True], 1, 2]), [6, 6])
    check('empty slice', solve([[3], [5], [True], 1, 0]), [])
    check('single run', solve([[4], [5], [True], 0, 4]), [5, 5, 5, 5])
    check('tail slice', solve([[1, 2, 6], [5, 6, 7], [True, True, True], 4, 2]), [7, 7])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Decoded run values use a logical-row address.

Decode a run-end vector into the requested [start,start+length) slice. Run ends are exclusive cumulative positions; values and validity are stored per run. Empty slices return empty.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        ends,values,valid,start,length=d
        out=[]
        for pos in range(start,start+length):
            r=next(i for i,end in enumerate(ends) if pos < end)
            value=values[r]
            known=valid[min(pos-start,len(valid)-1)]
            out.append(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('crossing run boundary', solve([[2, 5], [1, 2], [True, True], 1, 3]), [1, 2, 2])
    check('start at boundary', solve([[2, 5], [1, 2], [True, True], 2, 2]), [2, 2])
    check('null middle run', solve([[1, 3, 5], [1, 2, 3], [True, False, True], 0, 5]), [1, None, None, 3, 3])
    check('null first run', solve([[1, 3], [1, 2], [False, True], 1, 2]), [2, 2])
    check('empty slice', solve([[3], [1], [True], 1, 0]), [])
    check('single run', solve([[4], [1], [True], 0, 4]), [1, 1, 1, 1])
    check('tail slice', solve([[1, 2, 6], [1, 2, 3], [True, True, True], 4, 2]), [3, 3])
elif N == 2:
    check('crossing run boundary', solve([[2, 5], [2, 3], [True, True], 1, 3]), [2, 3, 3])
    check('start at boundary', solve([[2, 5], [2, 3], [True, True], 2, 2]), [3, 3])
    check('null middle run', solve([[1, 3, 5], [2, 3, 4], [True, False, True], 0, 5]), [2, None, None, 4, 4])
    check('null first run', solve([[1, 3], [2, 3], [False, True], 1, 2]), [3, 3])
    check('empty slice', solve([[3], [2], [True], 1, 0]), [])
    check('single run', solve([[4], [2], [True], 0, 4]), [2, 2, 2, 2])
    check('tail slice', solve([[1, 2, 6], [2, 3, 4], [True, True, True], 4, 2]), [4, 4])
elif N == 3:
    check('crossing run boundary', solve([[2, 5], [3, 4], [True, True], 1, 3]), [3, 4, 4])
    check('start at boundary', solve([[2, 5], [3, 4], [True, True], 2, 2]), [4, 4])
    check('null middle run', solve([[1, 3, 5], [3, 4, 5], [True, False, True], 0, 5]), [3, None, None, 5, 5])
    check('null first run', solve([[1, 3], [3, 4], [False, True], 1, 2]), [4, 4])
    check('empty slice', solve([[3], [3], [True], 1, 0]), [])
    check('single run', solve([[4], [3], [True], 0, 4]), [3, 3, 3, 3])
    check('tail slice', solve([[1, 2, 6], [3, 4, 5], [True, True, True], 4, 2]), [5, 5])
elif N == 4:
    check('crossing run boundary', solve([[2, 5], [4, 5], [True, True], 1, 3]), [4, 5, 5])
    check('start at boundary', solve([[2, 5], [4, 5], [True, True], 2, 2]), [5, 5])
    check('null middle run', solve([[1, 3, 5], [4, 5, 6], [True, False, True], 0, 5]), [4, None, None, 6, 6])
    check('null first run', solve([[1, 3], [4, 5], [False, True], 1, 2]), [5, 5])
    check('empty slice', solve([[3], [4], [True], 1, 0]), [])
    check('single run', solve([[4], [4], [True], 0, 4]), [4, 4, 4, 4])
    check('tail slice', solve([[1, 2, 6], [4, 5, 6], [True, True, True], 4, 2]), [6, 6])
elif N == 5:
    check('crossing run boundary', solve([[2, 5], [5, 6], [True, True], 1, 3]), [5, 6, 6])
    check('start at boundary', solve([[2, 5], [5, 6], [True, True], 2, 2]), [6, 6])
    check('null middle run', solve([[1, 3, 5], [5, 6, 7], [True, False, True], 0, 5]), [5, None, None, 7, 7])
    check('null first run', solve([[1, 3], [5, 6], [False, True], 1, 2]), [6, 6])
    check('empty slice', solve([[3], [5], [True], 1, 0]), [])
    check('single run', solve([[4], [5], [True], 0, 4]), [5, 5, 5, 5])
    check('tail slice', solve([[1, 2, 6], [5, 6, 7], [True, True, True], 4, 2]), [7, 7])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(d):
    try:
        ends,values,valid,start,length=d
        out=[]
        for pos in range(start,start+length):
            r=next(i for i,end in enumerate(ends) if pos < end)
            value=values[r]
            known=valid[r] and valid[0]
            out.append(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('crossing run boundary', solve([[2, 5], [1, 2], [True, True], 1, 3]), [1, 2, 2])
    check('start at boundary', solve([[2, 5], [1, 2], [True, True], 2, 2]), [2, 2])
    check('null middle run', solve([[1, 3, 5], [1, 2, 3], [True, False, True], 0, 5]), [1, None, None, 3, 3])
    check('null first run', solve([[1, 3], [1, 2], [False, True], 1, 2]), [2, 2])
    check('empty slice', solve([[3], [1], [True], 1, 0]), [])
    check('single run', solve([[4], [1], [True], 0, 4]), [1, 1, 1, 1])
    check('tail slice', solve([[1, 2, 6], [1, 2, 3], [True, True, True], 4, 2]), [3, 3])
elif N == 2:
    check('crossing run boundary', solve([[2, 5], [2, 3], [True, True], 1, 3]), [2, 3, 3])
    check('start at boundary', solve([[2, 5], [2, 3], [True, True], 2, 2]), [3, 3])
    check('null middle run', solve([[1, 3, 5], [2, 3, 4], [True, False, True], 0, 5]), [2, None, None, 4, 4])
    check('null first run', solve([[1, 3], [2, 3], [False, True], 1, 2]), [3, 3])
    check('empty slice', solve([[3], [2], [True], 1, 0]), [])
    check('single run', solve([[4], [2], [True], 0, 4]), [2, 2, 2, 2])
    check('tail slice', solve([[1, 2, 6], [2, 3, 4], [True, True, True], 4, 2]), [4, 4])
elif N == 3:
    check('crossing run boundary', solve([[2, 5], [3, 4], [True, True], 1, 3]), [3, 4, 4])
    check('start at boundary', solve([[2, 5], [3, 4], [True, True], 2, 2]), [4, 4])
    check('null middle run', solve([[1, 3, 5], [3, 4, 5], [True, False, True], 0, 5]), [3, None, None, 5, 5])
    check('null first run', solve([[1, 3], [3, 4], [False, True], 1, 2]), [4, 4])
    check('empty slice', solve([[3], [3], [True], 1, 0]), [])
    check('single run', solve([[4], [3], [True], 0, 4]), [3, 3, 3, 3])
    check('tail slice', solve([[1, 2, 6], [3, 4, 5], [True, True, True], 4, 2]), [5, 5])
elif N == 4:
    check('crossing run boundary', solve([[2, 5], [4, 5], [True, True], 1, 3]), [4, 5, 5])
    check('start at boundary', solve([[2, 5], [4, 5], [True, True], 2, 2]), [5, 5])
    check('null middle run', solve([[1, 3, 5], [4, 5, 6], [True, False, True], 0, 5]), [4, None, None, 6, 6])
    check('null first run', solve([[1, 3], [4, 5], [False, True], 1, 2]), [5, 5])
    check('empty slice', solve([[3], [4], [True], 1, 0]), [])
    check('single run', solve([[4], [4], [True], 0, 4]), [4, 4, 4, 4])
    check('tail slice', solve([[1, 2, 6], [4, 5, 6], [True, True, True], 4, 2]), [6, 6])
elif N == 5:
    check('crossing run boundary', solve([[2, 5], [5, 6], [True, True], 1, 3]), [5, 6, 6])
    check('start at boundary', solve([[2, 5], [5, 6], [True, True], 2, 2]), [6, 6])
    check('null middle run', solve([[1, 3, 5], [5, 6, 7], [True, False, True], 0, 5]), [5, None, None, 7, 7])
    check('null first run', solve([[1, 3], [5, 6], [False, True], 1, 2]), [6, 6])
    check('empty slice', solve([[3], [5], [True], 1, 0]), [])
    check('single run', solve([[4], [5], [True], 0, 4]), [5, 5, 5, 5])
    check('tail slice', solve([[1, 2, 6], [5, 6, 7], [True, True, True], 4, 2]), [7, 7])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Run validity is addressed by the slice-local row.

Decode a run-end vector into the requested [start,start+length) slice. Run ends are exclusive cumulative positions; values and validity are stored per run. Empty slices return empty.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        ends,values,valid,start,length=d
        out=[]
        for pos in range(start,start+length):
            r=next(i for i,end in enumerate(ends) if pos < end)
            value=values[r]
            known=valid[r]
            out.append(value)
        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('crossing run boundary', solve([[2, 5], [1, 2], [True, True], 1, 3]), [1, 2, 2])
    check('start at boundary', solve([[2, 5], [1, 2], [True, True], 2, 2]), [2, 2])
    check('null middle run', solve([[1, 3, 5], [1, 2, 3], [True, False, True], 0, 5]), [1, None, None, 3, 3])
    check('null first run', solve([[1, 3], [1, 2], [False, True], 1, 2]), [2, 2])
    check('empty slice', solve([[3], [1], [True], 1, 0]), [])
    check('single run', solve([[4], [1], [True], 0, 4]), [1, 1, 1, 1])
    check('tail slice', solve([[1, 2, 6], [1, 2, 3], [True, True, True], 4, 2]), [3, 3])
elif N == 2:
    check('crossing run boundary', solve([[2, 5], [2, 3], [True, True], 1, 3]), [2, 3, 3])
    check('start at boundary', solve([[2, 5], [2, 3], [True, True], 2, 2]), [3, 3])
    check('null middle run', solve([[1, 3, 5], [2, 3, 4], [True, False, True], 0, 5]), [2, None, None, 4, 4])
    check('null first run', solve([[1, 3], [2, 3], [False, True], 1, 2]), [3, 3])
    check('empty slice', solve([[3], [2], [True], 1, 0]), [])
    check('single run', solve([[4], [2], [True], 0, 4]), [2, 2, 2, 2])
    check('tail slice', solve([[1, 2, 6], [2, 3, 4], [True, True, True], 4, 2]), [4, 4])
elif N == 3:
    check('crossing run boundary', solve([[2, 5], [3, 4], [True, True], 1, 3]), [3, 4, 4])
    check('start at boundary', solve([[2, 5], [3, 4], [True, True], 2, 2]), [4, 4])
    check('null middle run', solve([[1, 3, 5], [3, 4, 5], [True, False, True], 0, 5]), [3, None, None, 5, 5])
    check('null first run', solve([[1, 3], [3, 4], [False, True], 1, 2]), [4, 4])
    check('empty slice', solve([[3], [3], [True], 1, 0]), [])
    check('single run', solve([[4], [3], [True], 0, 4]), [3, 3, 3, 3])
    check('tail slice', solve([[1, 2, 6], [3, 4, 5], [True, True, True], 4, 2]), [5, 5])
elif N == 4:
    check('crossing run boundary', solve([[2, 5], [4, 5], [True, True], 1, 3]), [4, 5, 5])
    check('start at boundary', solve([[2, 5], [4, 5], [True, True], 2, 2]), [5, 5])
    check('null middle run', solve([[1, 3, 5], [4, 5, 6], [True, False, True], 0, 5]), [4, None, None, 6, 6])
    check('null first run', solve([[1, 3], [4, 5], [False, True], 1, 2]), [5, 5])
    check('empty slice', solve([[3], [4], [True], 1, 0]), [])
    check('single run', solve([[4], [4], [True], 0, 4]), [4, 4, 4, 4])
    check('tail slice', solve([[1, 2, 6], [4, 5, 6], [True, True, True], 4, 2]), [6, 6])
elif N == 5:
    check('crossing run boundary', solve([[2, 5], [5, 6], [True, True], 1, 3]), [5, 6, 6])
    check('start at boundary', solve([[2, 5], [5, 6], [True, True], 2, 2]), [6, 6])
    check('null middle run', solve([[1, 3, 5], [5, 6, 7], [True, False, True], 0, 5]), [5, None, None, 7, 7])
    check('null first run', solve([[1, 3], [5, 6], [False, True], 1, 2]), [6, 6])
    check('empty slice', solve([[3], [5], [True], 1, 0]), [])
    check('single run', solve([[4], [5], [True], 0, 4]), [5, 5, 5, 5])
    check('tail slice', solve([[1, 2, 6], [5, 6, 7], [True, True, True], 4, 2]), [7, 7])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(d):
    try:
        ends,values,valid,start,length=d
        out=[]
        for pos in range(start,start+length):
            r=next(i for i,end in enumerate(ends) if pos < end)
            value=values[r]
            known=valid[r]
            out.extend([value] if known else [])
        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('crossing run boundary', solve([[2, 5], [1, 2], [True, True], 1, 3]), [1, 2, 2])
    check('start at boundary', solve([[2, 5], [1, 2], [True, True], 2, 2]), [2, 2])
    check('null middle run', solve([[1, 3, 5], [1, 2, 3], [True, False, True], 0, 5]), [1, None, None, 3, 3])
    check('null first run', solve([[1, 3], [1, 2], [False, True], 1, 2]), [2, 2])
    check('empty slice', solve([[3], [1], [True], 1, 0]), [])
    check('single run', solve([[4], [1], [True], 0, 4]), [1, 1, 1, 1])
    check('tail slice', solve([[1, 2, 6], [1, 2, 3], [True, True, True], 4, 2]), [3, 3])
elif N == 2:
    check('crossing run boundary', solve([[2, 5], [2, 3], [True, True], 1, 3]), [2, 3, 3])
    check('start at boundary', solve([[2, 5], [2, 3], [True, True], 2, 2]), [3, 3])
    check('null middle run', solve([[1, 3, 5], [2, 3, 4], [True, False, True], 0, 5]), [2, None, None, 4, 4])
    check('null first run', solve([[1, 3], [2, 3], [False, True], 1, 2]), [3, 3])
    check('empty slice', solve([[3], [2], [True], 1, 0]), [])
    check('single run', solve([[4], [2], [True], 0, 4]), [2, 2, 2, 2])
    check('tail slice', solve([[1, 2, 6], [2, 3, 4], [True, True, True], 4, 2]), [4, 4])
elif N == 3:
    check('crossing run boundary', solve([[2, 5], [3, 4], [True, True], 1, 3]), [3, 4, 4])
    check('start at boundary', solve([[2, 5], [3, 4], [True, True], 2, 2]), [4, 4])
    check('null middle run', solve([[1, 3, 5], [3, 4, 5], [True, False, True], 0, 5]), [3, None, None, 5, 5])
    check('null first run', solve([[1, 3], [3, 4], [False, True], 1, 2]), [4, 4])
    check('empty slice', solve([[3], [3], [True], 1, 0]), [])
    check('single run', solve([[4], [3], [True], 0, 4]), [3, 3, 3, 3])
    check('tail slice', solve([[1, 2, 6], [3, 4, 5], [True, True, True], 4, 2]), [5, 5])
elif N == 4:
    check('crossing run boundary', solve([[2, 5], [4, 5], [True, True], 1, 3]), [4, 5, 5])
    check('start at boundary', solve([[2, 5], [4, 5], [True, True], 2, 2]), [5, 5])
    check('null middle run', solve([[1, 3, 5], [4, 5, 6], [True, False, True], 0, 5]), [4, None, None, 6, 6])
    check('null first run', solve([[1, 3], [4, 5], [False, True], 1, 2]), [5, 5])
    check('empty slice', solve([[3], [4], [True], 1, 0]), [])
    check('single run', solve([[4], [4], [True], 0, 4]), [4, 4, 4, 4])
    check('tail slice', solve([[1, 2, 6], [4, 5, 6], [True, True, True], 4, 2]), [6, 6])
elif N == 5:
    check('crossing run boundary', solve([[2, 5], [5, 6], [True, True], 1, 3]), [5, 6, 6])
    check('start at boundary', solve([[2, 5], [5, 6], [True, True], 2, 2]), [6, 6])
    check('null middle run', solve([[1, 3, 5], [5, 6, 7], [True, False, True], 0, 5]), [5, None, None, 7, 7])
    check('null first run', solve([[1, 3], [5, 6], [False, True], 1, 2]), [6, 6])
    check('empty slice', solve([[3], [5], [True], 1, 0]), [])
    check('single run', solve([[4], [5], [True], 0, 4]), [5, 5, 5, 5])
    check('tail slice', solve([[1, 2, 6], [5, 6, 7], [True, True, True], 4, 2]), [7, 7])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A null run is replaced by its hidden payload.

Decode a run-end vector into the requested [start,start+length) slice. Run ends are exclusive cumulative positions; values and validity are stored per run. Empty slices return empty.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        ends,values,valid,start,length=d
        out=[]
        for pos in range(start,start+length):
            r=next(i for i,end in enumerate(ends) if pos < end)
            value=values[r]
            known=valid[r]
            out.append(value if known else None)
        return list(dict.fromkeys(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('crossing run boundary', solve([[2, 5], [1, 2], [True, True], 1, 3]), [1, 2, 2])
    check('start at boundary', solve([[2, 5], [1, 2], [True, True], 2, 2]), [2, 2])
    check('null middle run', solve([[1, 3, 5], [1, 2, 3], [True, False, True], 0, 5]), [1, None, None, 3, 3])
    check('null first run', solve([[1, 3], [1, 2], [False, True], 1, 2]), [2, 2])
    check('empty slice', solve([[3], [1], [True], 1, 0]), [])
    check('single run', solve([[4], [1], [True], 0, 4]), [1, 1, 1, 1])
    check('tail slice', solve([[1, 2, 6], [1, 2, 3], [True, True, True], 4, 2]), [3, 3])
elif N == 2:
    check('crossing run boundary', solve([[2, 5], [2, 3], [True, True], 1, 3]), [2, 3, 3])
    check('start at boundary', solve([[2, 5], [2, 3], [True, True], 2, 2]), [3, 3])
    check('null middle run', solve([[1, 3, 5], [2, 3, 4], [True, False, True], 0, 5]), [2, None, None, 4, 4])
    check('null first run', solve([[1, 3], [2, 3], [False, True], 1, 2]), [3, 3])
    check('empty slice', solve([[3], [2], [True], 1, 0]), [])
    check('single run', solve([[4], [2], [True], 0, 4]), [2, 2, 2, 2])
    check('tail slice', solve([[1, 2, 6], [2, 3, 4], [True, True, True], 4, 2]), [4, 4])
elif N == 3:
    check('crossing run boundary', solve([[2, 5], [3, 4], [True, True], 1, 3]), [3, 4, 4])
    check('start at boundary', solve([[2, 5], [3, 4], [True, True], 2, 2]), [4, 4])
    check('null middle run', solve([[1, 3, 5], [3, 4, 5], [True, False, True], 0, 5]), [3, None, None, 5, 5])
    check('null first run', solve([[1, 3], [3, 4], [False, True], 1, 2]), [4, 4])
    check('empty slice', solve([[3], [3], [True], 1, 0]), [])
    check('single run', solve([[4], [3], [True], 0, 4]), [3, 3, 3, 3])
    check('tail slice', solve([[1, 2, 6], [3, 4, 5], [True, True, True], 4, 2]), [5, 5])
elif N == 4:
    check('crossing run boundary', solve([[2, 5], [4, 5], [True, True], 1, 3]), [4, 5, 5])
    check('start at boundary', solve([[2, 5], [4, 5], [True, True], 2, 2]), [5, 5])
    check('null middle run', solve([[1, 3, 5], [4, 5, 6], [True, False, True], 0, 5]), [4, None, None, 6, 6])
    check('null first run', solve([[1, 3], [4, 5], [False, True], 1, 2]), [5, 5])
    check('empty slice', solve([[3], [4], [True], 1, 0]), [])
    check('single run', solve([[4], [4], [True], 0, 4]), [4, 4, 4, 4])
    check('tail slice', solve([[1, 2, 6], [4, 5, 6], [True, True, True], 4, 2]), [6, 6])
elif N == 5:
    check('crossing run boundary', solve([[2, 5], [5, 6], [True, True], 1, 3]), [5, 6, 6])
    check('start at boundary', solve([[2, 5], [5, 6], [True, True], 2, 2]), [6, 6])
    check('null middle run', solve([[1, 3, 5], [5, 6, 7], [True, False, True], 0, 5]), [5, None, None, 7, 7])
    check('null first run', solve([[1, 3], [5, 6], [False, True], 1, 2]), [6, 6])
    check('empty slice', solve([[3], [5], [True], 1, 0]), [])
    check('single run', solve([[4], [5], [True], 0, 4]), [5, 5, 5, 5])
    check('tail slice', solve([[1, 2, 6], [5, 6, 7], [True, True, True], 4, 2]), [7, 7])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(d):
    try:
        ends,values,valid,start,length=d
        out=[]
        for pos in range(start,start+length):
            r=next(i for i,end in enumerate(ends) if pos < end)
            value=values[r]
            known=valid[r]
            out.append(value if known else None)
        return [v for i,v in enumerate(out) if i==0 or v!=out[i-1]]
    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('crossing run boundary', solve([[2, 5], [1, 2], [True, True], 1, 3]), [1, 2, 2])
    check('start at boundary', solve([[2, 5], [1, 2], [True, True], 2, 2]), [2, 2])
    check('null middle run', solve([[1, 3, 5], [1, 2, 3], [True, False, True], 0, 5]), [1, None, None, 3, 3])
    check('null first run', solve([[1, 3], [1, 2], [False, True], 1, 2]), [2, 2])
    check('empty slice', solve([[3], [1], [True], 1, 0]), [])
    check('single run', solve([[4], [1], [True], 0, 4]), [1, 1, 1, 1])
    check('tail slice', solve([[1, 2, 6], [1, 2, 3], [True, True, True], 4, 2]), [3, 3])
elif N == 2:
    check('crossing run boundary', solve([[2, 5], [2, 3], [True, True], 1, 3]), [2, 3, 3])
    check('start at boundary', solve([[2, 5], [2, 3], [True, True], 2, 2]), [3, 3])
    check('null middle run', solve([[1, 3, 5], [2, 3, 4], [True, False, True], 0, 5]), [2, None, None, 4, 4])
    check('null first run', solve([[1, 3], [2, 3], [False, True], 1, 2]), [3, 3])
    check('empty slice', solve([[3], [2], [True], 1, 0]), [])
    check('single run', solve([[4], [2], [True], 0, 4]), [2, 2, 2, 2])
    check('tail slice', solve([[1, 2, 6], [2, 3, 4], [True, True, True], 4, 2]), [4, 4])
elif N == 3:
    check('crossing run boundary', solve([[2, 5], [3, 4], [True, True], 1, 3]), [3, 4, 4])
    check('start at boundary', solve([[2, 5], [3, 4], [True, True], 2, 2]), [4, 4])
    check('null middle run', solve([[1, 3, 5], [3, 4, 5], [True, False, True], 0, 5]), [3, None, None, 5, 5])
    check('null first run', solve([[1, 3], [3, 4], [False, True], 1, 2]), [4, 4])
    check('empty slice', solve([[3], [3], [True], 1, 0]), [])
    check('single run', solve([[4], [3], [True], 0, 4]), [3, 3, 3, 3])
    check('tail slice', solve([[1, 2, 6], [3, 4, 5], [True, True, True], 4, 2]), [5, 5])
elif N == 4:
    check('crossing run boundary', solve([[2, 5], [4, 5], [True, True], 1, 3]), [4, 5, 5])
    check('start at boundary', solve([[2, 5], [4, 5], [True, True], 2, 2]), [5, 5])
    check('null middle run', solve([[1, 3, 5], [4, 5, 6], [True, False, True], 0, 5]), [4, None, None, 6, 6])
    check('null first run', solve([[1, 3], [4, 5], [False, True], 1, 2]), [5, 5])
    check('empty slice', solve([[3], [4], [True], 1, 0]), [])
    check('single run', solve([[4], [4], [True], 0, 4]), [4, 4, 4, 4])
    check('tail slice', solve([[1, 2, 6], [4, 5, 6], [True, True, True], 4, 2]), [6, 6])
elif N == 5:
    check('crossing run boundary', solve([[2, 5], [5, 6], [True, True], 1, 3]), [5, 6, 6])
    check('start at boundary', solve([[2, 5], [5, 6], [True, True], 2, 2]), [6, 6])
    check('null middle run', solve([[1, 3, 5], [5, 6, 7], [True, False, True], 0, 5]), [5, None, None, 7, 7])
    check('null first run', solve([[1, 3], [5, 6], [False, True], 1, 2]), [6, 6])
    check('empty slice', solve([[3], [5], [True], 1, 0]), [])
    check('single run', solve([[4], [5], [True], 0, 4]), [5, 5, 5, 5])
    check('tail slice', solve([[1, 2, 6], [5, 6, 7], [True, True, True], 4, 2]), [7, 7])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Only one output is retained per decoded run value.

Decode a run-end vector into the requested [start,start+length) slice. Run ends are exclusive cumulative positions; values and validity are stored per run. Empty slices return empty.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        offsets,child,parents,valid,selection=d
        out=[]
        for row in sorted(selection):
            lo=offsets[row]
            hi=offsets[row+1]
            items=[child[i] if valid[i] else None for i in range(lo,hi)]
            out.append(items if parents[row] 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('shared child offsets', solve([[0, 2, 3], [1, 2, 3], [True, True], [True, True, True], [1, 0]]), [[3], [1, 2]])
    check('null child', solve([[0, 2], [1, 2], [True], [False, True], [0]]), [[None, 2]])
    check('hidden null list', solve([[0, 2], [1, 2], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [1], [True, True], [True], [0, 1]]), [[], [1]])
    check('repeated list', solve([[0, 1, 2], [1, 2], [True, True], [True, True], [1, 1]]), [[2], [2]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 1, 2], [True], [True, True, True], [0]]), [[1, 2]])
elif N == 2:
    check('shared child offsets', solve([[0, 2, 3], [2, 3, 4], [True, True], [True, True, True], [1, 0]]), [[4], [2, 3]])
    check('null child', solve([[0, 2], [2, 3], [True], [False, True], [0]]), [[None, 3]])
    check('hidden null list', solve([[0, 2], [2, 3], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [2], [True, True], [True], [0, 1]]), [[], [2]])
    check('repeated list', solve([[0, 1, 2], [2, 3], [True, True], [True, True], [1, 1]]), [[3], [3]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 2, 3], [True], [True, True, True], [0]]), [[2, 3]])
elif N == 3:
    check('shared child offsets', solve([[0, 2, 3], [3, 4, 5], [True, True], [True, True, True], [1, 0]]), [[5], [3, 4]])
    check('null child', solve([[0, 2], [3, 4], [True], [False, True], [0]]), [[None, 4]])
    check('hidden null list', solve([[0, 2], [3, 4], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [3], [True, True], [True], [0, 1]]), [[], [3]])
    check('repeated list', solve([[0, 1, 2], [3, 4], [True, True], [True, True], [1, 1]]), [[4], [4]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 3, 4], [True], [True, True, True], [0]]), [[3, 4]])
elif N == 4:
    check('shared child offsets', solve([[0, 2, 3], [4, 5, 6], [True, True], [True, True, True], [1, 0]]), [[6], [4, 5]])
    check('null child', solve([[0, 2], [4, 5], [True], [False, True], [0]]), [[None, 5]])
    check('hidden null list', solve([[0, 2], [4, 5], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [4], [True, True], [True], [0, 1]]), [[], [4]])
    check('repeated list', solve([[0, 1, 2], [4, 5], [True, True], [True, True], [1, 1]]), [[5], [5]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 4, 5], [True], [True, True, True], [0]]), [[4, 5]])
elif N == 5:
    check('shared child offsets', solve([[0, 2, 3], [5, 6, 7], [True, True], [True, True, True], [1, 0]]), [[7], [5, 6]])
    check('null child', solve([[0, 2], [5, 6], [True], [False, True], [0]]), [[None, 6]])
    check('hidden null list', solve([[0, 2], [5, 6], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [5], [True, True], [True], [0, 1]]), [[], [5]])
    check('repeated list', solve([[0, 1, 2], [5, 6], [True, True], [True, True], [1, 1]]), [[6], [6]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 5, 6], [True], [True, True, True], [0]]), [[5, 6]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(d):
    try:
        offsets,child,parents,valid,selection=d
        out=[]
        for row in sorted(set(selection)):
            lo=offsets[row]
            hi=offsets[row+1]
            items=[child[i] if valid[i] else None for i in range(lo,hi)]
            out.append(items if parents[row] 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('shared child offsets', solve([[0, 2, 3], [1, 2, 3], [True, True], [True, True, True], [1, 0]]), [[3], [1, 2]])
    check('null child', solve([[0, 2], [1, 2], [True], [False, True], [0]]), [[None, 2]])
    check('hidden null list', solve([[0, 2], [1, 2], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [1], [True, True], [True], [0, 1]]), [[], [1]])
    check('repeated list', solve([[0, 1, 2], [1, 2], [True, True], [True, True], [1, 1]]), [[2], [2]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 1, 2], [True], [True, True, True], [0]]), [[1, 2]])
elif N == 2:
    check('shared child offsets', solve([[0, 2, 3], [2, 3, 4], [True, True], [True, True, True], [1, 0]]), [[4], [2, 3]])
    check('null child', solve([[0, 2], [2, 3], [True], [False, True], [0]]), [[None, 3]])
    check('hidden null list', solve([[0, 2], [2, 3], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [2], [True, True], [True], [0, 1]]), [[], [2]])
    check('repeated list', solve([[0, 1, 2], [2, 3], [True, True], [True, True], [1, 1]]), [[3], [3]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 2, 3], [True], [True, True, True], [0]]), [[2, 3]])
elif N == 3:
    check('shared child offsets', solve([[0, 2, 3], [3, 4, 5], [True, True], [True, True, True], [1, 0]]), [[5], [3, 4]])
    check('null child', solve([[0, 2], [3, 4], [True], [False, True], [0]]), [[None, 4]])
    check('hidden null list', solve([[0, 2], [3, 4], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [3], [True, True], [True], [0, 1]]), [[], [3]])
    check('repeated list', solve([[0, 1, 2], [3, 4], [True, True], [True, True], [1, 1]]), [[4], [4]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 3, 4], [True], [True, True, True], [0]]), [[3, 4]])
elif N == 4:
    check('shared child offsets', solve([[0, 2, 3], [4, 5, 6], [True, True], [True, True, True], [1, 0]]), [[6], [4, 5]])
    check('null child', solve([[0, 2], [4, 5], [True], [False, True], [0]]), [[None, 5]])
    check('hidden null list', solve([[0, 2], [4, 5], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [4], [True, True], [True], [0, 1]]), [[], [4]])
    check('repeated list', solve([[0, 1, 2], [4, 5], [True, True], [True, True], [1, 1]]), [[5], [5]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 4, 5], [True], [True, True, True], [0]]), [[4, 5]])
elif N == 5:
    check('shared child offsets', solve([[0, 2, 3], [5, 6, 7], [True, True], [True, True, True], [1, 0]]), [[7], [5, 6]])
    check('null child', solve([[0, 2], [5, 6], [True], [False, True], [0]]), [[None, 6]])
    check('hidden null list', solve([[0, 2], [5, 6], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [5], [True, True], [True], [0, 1]]), [[], [5]])
    check('repeated list', solve([[0, 1, 2], [5, 6], [True, True], [True, True], [1, 1]]), [[6], [6]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 5, 6], [True], [True, True, True], [0]]), [[5, 6]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
List gather sorts its physical row selection.

Gather selected list rows from offset-based child storage. Parent nullness hides child storage; empty valid lists remain []; child nulls remain None. Preserve repeated selected rows and list element order.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        offsets,child,parents,valid,selection=d
        out=[]
        for row in selection:
            lo=0
            hi=offsets[row+1]
            items=[child[i] if valid[i] else None for i in range(lo,hi)]
            out.append(items if parents[row] 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('shared child offsets', solve([[0, 2, 3], [1, 2, 3], [True, True], [True, True, True], [1, 0]]), [[3], [1, 2]])
    check('null child', solve([[0, 2], [1, 2], [True], [False, True], [0]]), [[None, 2]])
    check('hidden null list', solve([[0, 2], [1, 2], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [1], [True, True], [True], [0, 1]]), [[], [1]])
    check('repeated list', solve([[0, 1, 2], [1, 2], [True, True], [True, True], [1, 1]]), [[2], [2]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 1, 2], [True], [True, True, True], [0]]), [[1, 2]])
elif N == 2:
    check('shared child offsets', solve([[0, 2, 3], [2, 3, 4], [True, True], [True, True, True], [1, 0]]), [[4], [2, 3]])
    check('null child', solve([[0, 2], [2, 3], [True], [False, True], [0]]), [[None, 3]])
    check('hidden null list', solve([[0, 2], [2, 3], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [2], [True, True], [True], [0, 1]]), [[], [2]])
    check('repeated list', solve([[0, 1, 2], [2, 3], [True, True], [True, True], [1, 1]]), [[3], [3]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 2, 3], [True], [True, True, True], [0]]), [[2, 3]])
elif N == 3:
    check('shared child offsets', solve([[0, 2, 3], [3, 4, 5], [True, True], [True, True, True], [1, 0]]), [[5], [3, 4]])
    check('null child', solve([[0, 2], [3, 4], [True], [False, True], [0]]), [[None, 4]])
    check('hidden null list', solve([[0, 2], [3, 4], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [3], [True, True], [True], [0, 1]]), [[], [3]])
    check('repeated list', solve([[0, 1, 2], [3, 4], [True, True], [True, True], [1, 1]]), [[4], [4]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 3, 4], [True], [True, True, True], [0]]), [[3, 4]])
elif N == 4:
    check('shared child offsets', solve([[0, 2, 3], [4, 5, 6], [True, True], [True, True, True], [1, 0]]), [[6], [4, 5]])
    check('null child', solve([[0, 2], [4, 5], [True], [False, True], [0]]), [[None, 5]])
    check('hidden null list', solve([[0, 2], [4, 5], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [4], [True, True], [True], [0, 1]]), [[], [4]])
    check('repeated list', solve([[0, 1, 2], [4, 5], [True, True], [True, True], [1, 1]]), [[5], [5]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 4, 5], [True], [True, True, True], [0]]), [[4, 5]])
elif N == 5:
    check('shared child offsets', solve([[0, 2, 3], [5, 6, 7], [True, True], [True, True, True], [1, 0]]), [[7], [5, 6]])
    check('null child', solve([[0, 2], [5, 6], [True], [False, True], [0]]), [[None, 6]])
    check('hidden null list', solve([[0, 2], [5, 6], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [5], [True, True], [True], [0, 1]]), [[], [5]])
    check('repeated list', solve([[0, 1, 2], [5, 6], [True, True], [True, True], [1, 1]]), [[6], [6]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 5, 6], [True], [True, True, True], [0]]), [[5, 6]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(d):
    try:
        offsets,child,parents,valid,selection=d
        out=[]
        for row in selection:
            lo=row
            hi=offsets[row+1]
            items=[child[i] if valid[i] else None for i in range(lo,hi)]
            out.append(items if parents[row] 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('shared child offsets', solve([[0, 2, 3], [1, 2, 3], [True, True], [True, True, True], [1, 0]]), [[3], [1, 2]])
    check('null child', solve([[0, 2], [1, 2], [True], [False, True], [0]]), [[None, 2]])
    check('hidden null list', solve([[0, 2], [1, 2], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [1], [True, True], [True], [0, 1]]), [[], [1]])
    check('repeated list', solve([[0, 1, 2], [1, 2], [True, True], [True, True], [1, 1]]), [[2], [2]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 1, 2], [True], [True, True, True], [0]]), [[1, 2]])
elif N == 2:
    check('shared child offsets', solve([[0, 2, 3], [2, 3, 4], [True, True], [True, True, True], [1, 0]]), [[4], [2, 3]])
    check('null child', solve([[0, 2], [2, 3], [True], [False, True], [0]]), [[None, 3]])
    check('hidden null list', solve([[0, 2], [2, 3], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [2], [True, True], [True], [0, 1]]), [[], [2]])
    check('repeated list', solve([[0, 1, 2], [2, 3], [True, True], [True, True], [1, 1]]), [[3], [3]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 2, 3], [True], [True, True, True], [0]]), [[2, 3]])
elif N == 3:
    check('shared child offsets', solve([[0, 2, 3], [3, 4, 5], [True, True], [True, True, True], [1, 0]]), [[5], [3, 4]])
    check('null child', solve([[0, 2], [3, 4], [True], [False, True], [0]]), [[None, 4]])
    check('hidden null list', solve([[0, 2], [3, 4], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [3], [True, True], [True], [0, 1]]), [[], [3]])
    check('repeated list', solve([[0, 1, 2], [3, 4], [True, True], [True, True], [1, 1]]), [[4], [4]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 3, 4], [True], [True, True, True], [0]]), [[3, 4]])
elif N == 4:
    check('shared child offsets', solve([[0, 2, 3], [4, 5, 6], [True, True], [True, True, True], [1, 0]]), [[6], [4, 5]])
    check('null child', solve([[0, 2], [4, 5], [True], [False, True], [0]]), [[None, 5]])
    check('hidden null list', solve([[0, 2], [4, 5], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [4], [True, True], [True], [0, 1]]), [[], [4]])
    check('repeated list', solve([[0, 1, 2], [4, 5], [True, True], [True, True], [1, 1]]), [[5], [5]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 4, 5], [True], [True, True, True], [0]]), [[4, 5]])
elif N == 5:
    check('shared child offsets', solve([[0, 2, 3], [5, 6, 7], [True, True], [True, True, True], [1, 0]]), [[7], [5, 6]])
    check('null child', solve([[0, 2], [5, 6], [True], [False, True], [0]]), [[None, 6]])
    check('hidden null list', solve([[0, 2], [5, 6], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [5], [True, True], [True], [0, 1]]), [[], [5]])
    check('repeated list', solve([[0, 1, 2], [5, 6], [True, True], [True, True], [1, 1]]), [[6], [6]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 5, 6], [True], [True, True, True], [0]]), [[5, 6]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A list slice starts at zero in the shared child buffer.

Gather selected list rows from offset-based child storage. Parent nullness hides child storage; empty valid lists remain []; child nulls remain None. Preserve repeated selected rows and list element order.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        offsets,child,parents,valid,selection=d
        out=[]
        for row in selection:
            lo=offsets[row]
            hi=min(row+1,len(child))
            items=[child[i] if valid[i] else None for i in range(lo,hi)]
            out.append(items if parents[row] 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('shared child offsets', solve([[0, 2, 3], [1, 2, 3], [True, True], [True, True, True], [1, 0]]), [[3], [1, 2]])
    check('null child', solve([[0, 2], [1, 2], [True], [False, True], [0]]), [[None, 2]])
    check('hidden null list', solve([[0, 2], [1, 2], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [1], [True, True], [True], [0, 1]]), [[], [1]])
    check('repeated list', solve([[0, 1, 2], [1, 2], [True, True], [True, True], [1, 1]]), [[2], [2]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 1, 2], [True], [True, True, True], [0]]), [[1, 2]])
elif N == 2:
    check('shared child offsets', solve([[0, 2, 3], [2, 3, 4], [True, True], [True, True, True], [1, 0]]), [[4], [2, 3]])
    check('null child', solve([[0, 2], [2, 3], [True], [False, True], [0]]), [[None, 3]])
    check('hidden null list', solve([[0, 2], [2, 3], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [2], [True, True], [True], [0, 1]]), [[], [2]])
    check('repeated list', solve([[0, 1, 2], [2, 3], [True, True], [True, True], [1, 1]]), [[3], [3]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 2, 3], [True], [True, True, True], [0]]), [[2, 3]])
elif N == 3:
    check('shared child offsets', solve([[0, 2, 3], [3, 4, 5], [True, True], [True, True, True], [1, 0]]), [[5], [3, 4]])
    check('null child', solve([[0, 2], [3, 4], [True], [False, True], [0]]), [[None, 4]])
    check('hidden null list', solve([[0, 2], [3, 4], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [3], [True, True], [True], [0, 1]]), [[], [3]])
    check('repeated list', solve([[0, 1, 2], [3, 4], [True, True], [True, True], [1, 1]]), [[4], [4]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 3, 4], [True], [True, True, True], [0]]), [[3, 4]])
elif N == 4:
    check('shared child offsets', solve([[0, 2, 3], [4, 5, 6], [True, True], [True, True, True], [1, 0]]), [[6], [4, 5]])
    check('null child', solve([[0, 2], [4, 5], [True], [False, True], [0]]), [[None, 5]])
    check('hidden null list', solve([[0, 2], [4, 5], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [4], [True, True], [True], [0, 1]]), [[], [4]])
    check('repeated list', solve([[0, 1, 2], [4, 5], [True, True], [True, True], [1, 1]]), [[5], [5]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 4, 5], [True], [True, True, True], [0]]), [[4, 5]])
elif N == 5:
    check('shared child offsets', solve([[0, 2, 3], [5, 6, 7], [True, True], [True, True, True], [1, 0]]), [[7], [5, 6]])
    check('null child', solve([[0, 2], [5, 6], [True], [False, True], [0]]), [[None, 6]])
    check('hidden null list', solve([[0, 2], [5, 6], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [5], [True, True], [True], [0, 1]]), [[], [5]])
    check('repeated list', solve([[0, 1, 2], [5, 6], [True, True], [True, True], [1, 1]]), [[6], [6]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 5, 6], [True], [True, True, True], [0]]), [[5, 6]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(d):
    try:
        offsets,child,parents,valid,selection=d
        out=[]
        for row in selection:
            lo=offsets[row]
            hi=offsets[row]
            items=[child[i] if valid[i] else None for i in range(lo,hi)]
            out.append(items if parents[row] 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('shared child offsets', solve([[0, 2, 3], [1, 2, 3], [True, True], [True, True, True], [1, 0]]), [[3], [1, 2]])
    check('null child', solve([[0, 2], [1, 2], [True], [False, True], [0]]), [[None, 2]])
    check('hidden null list', solve([[0, 2], [1, 2], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [1], [True, True], [True], [0, 1]]), [[], [1]])
    check('repeated list', solve([[0, 1, 2], [1, 2], [True, True], [True, True], [1, 1]]), [[2], [2]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 1, 2], [True], [True, True, True], [0]]), [[1, 2]])
elif N == 2:
    check('shared child offsets', solve([[0, 2, 3], [2, 3, 4], [True, True], [True, True, True], [1, 0]]), [[4], [2, 3]])
    check('null child', solve([[0, 2], [2, 3], [True], [False, True], [0]]), [[None, 3]])
    check('hidden null list', solve([[0, 2], [2, 3], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [2], [True, True], [True], [0, 1]]), [[], [2]])
    check('repeated list', solve([[0, 1, 2], [2, 3], [True, True], [True, True], [1, 1]]), [[3], [3]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 2, 3], [True], [True, True, True], [0]]), [[2, 3]])
elif N == 3:
    check('shared child offsets', solve([[0, 2, 3], [3, 4, 5], [True, True], [True, True, True], [1, 0]]), [[5], [3, 4]])
    check('null child', solve([[0, 2], [3, 4], [True], [False, True], [0]]), [[None, 4]])
    check('hidden null list', solve([[0, 2], [3, 4], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [3], [True, True], [True], [0, 1]]), [[], [3]])
    check('repeated list', solve([[0, 1, 2], [3, 4], [True, True], [True, True], [1, 1]]), [[4], [4]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 3, 4], [True], [True, True, True], [0]]), [[3, 4]])
elif N == 4:
    check('shared child offsets', solve([[0, 2, 3], [4, 5, 6], [True, True], [True, True, True], [1, 0]]), [[6], [4, 5]])
    check('null child', solve([[0, 2], [4, 5], [True], [False, True], [0]]), [[None, 5]])
    check('hidden null list', solve([[0, 2], [4, 5], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [4], [True, True], [True], [0, 1]]), [[], [4]])
    check('repeated list', solve([[0, 1, 2], [4, 5], [True, True], [True, True], [1, 1]]), [[5], [5]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 4, 5], [True], [True, True, True], [0]]), [[4, 5]])
elif N == 5:
    check('shared child offsets', solve([[0, 2, 3], [5, 6, 7], [True, True], [True, True, True], [1, 0]]), [[7], [5, 6]])
    check('null child', solve([[0, 2], [5, 6], [True], [False, True], [0]]), [[None, 6]])
    check('hidden null list', solve([[0, 2], [5, 6], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [5], [True, True], [True], [0, 1]]), [[], [5]])
    check('repeated list', solve([[0, 1, 2], [5, 6], [True, True], [True, True], [1, 1]]), [[6], [6]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 5, 6], [True], [True, True, True], [0]]), [[5, 6]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A list slice ends at the next parent ordinal.

Gather selected list rows from offset-based child storage. Parent nullness hides child storage; empty valid lists remain []; child nulls remain None. Preserve repeated selected rows and list element order.

split: open-access