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

N = 1
observations = []
def solve(d):
    errors=[]
    if d['iterator_end']<d['loop_end']: errors.append('for-owner-duration')
    if d['error_exit'] and bool(d['body_loans_live']): errors.append('question-error-cleanup')
    if d['rhs_evaluated'] and not d['rhs_enabled']: errors.append('short-circuit-conditional')
    if d['autoderef_place']!=d['autoref_place']: errors.append('autoref-after-autoderef')
    if d['compound_assignment'] and d['destination_evaluations']!=1: errors.append('compound-destination-once')
    if d['base_point']>d['index_point']: errors.append('index-evaluation-order')
    if d['future_owner_end']<d['await_resume']: errors.append('await-future-owner')
    if d['else_branch'] and bool(set(d['success_bindings'])&set(d['else_uses'])): errors.append('let-else-binding-scope')
    if d['first_write']<d['rhs_end']: errors.append('destructure-stage-rhs')
    if False: errors.append('return-before-cleanup')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'iterator_end': 0, 'loop_end': 0, 'error_exit': False, 'body_loans_live': [], 'rhs_evaluated': False, 'rhs_enabled': True, 'autoderef_place': [], 'autoref_place': [], 'destination_evaluations': 0, 'compound_assignment': False, 'base_point': 0, 'index_point': 0, 'future_owner_end': 0, 'await_resume': 0, 'else_branch': False, 'success_bindings': [], 'else_uses': [], 'rhs_end': 0, 'first_write': 0, 'return_check': 0, 'cleanup_point': 0}
check('well formed empty obligations',solve(base),[])
check('for-owner-duration regression 0', solve(dict(base, **({'iterator_end':N,'loop_end':N+1}))), ['for-owner-duration'])
check('for-owner-duration regression 1', solve(dict(base, **({'iterator_end':N+1,'loop_end':N+2}))), ['for-owner-duration'])
check('question-error-cleanup regression 0', solve(dict(base, **({'error_exit':True,'body_loans_live':['r']}))), ['question-error-cleanup'])
check('question-error-cleanup regression 1', solve(dict(base, **({'error_exit':True,'body_loans_live':[N]}))), ['question-error-cleanup'])
check('short-circuit-conditional regression 0', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False}))), ['short-circuit-conditional'])
check('short-circuit-conditional regression 1', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False,'loop_end':N,'iterator_end':N}))), ['short-circuit-conditional'])
check('autoref-after-autoderef regression 0', solve(dict(base, **({'autoderef_place':['r','*'],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('autoref-after-autoderef regression 1', solve(dict(base, **({'autoderef_place':['r','*',N],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('compound-destination-once regression 0', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':2}))), ['compound-destination-once'])
check('compound-destination-once regression 1', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':N+2}))), ['compound-destination-once'])
check('index-evaluation-order regression 0', solve(dict(base, **({'base_point':N+1,'index_point':N}))), ['index-evaluation-order'])
check('index-evaluation-order regression 1', solve(dict(base, **({'base_point':N+2,'index_point':N+1}))), ['index-evaluation-order'])
check('await-future-owner regression 0', solve(dict(base, **({'future_owner_end':N,'await_resume':N+1}))), ['await-future-owner'])
check('await-future-owner regression 1', solve(dict(base, **({'future_owner_end':N+1,'await_resume':N+2}))), ['await-future-owner'])
check('let-else-binding-scope regression 0', solve(dict(base, **({'else_branch':True,'success_bindings':['x'],'else_uses':['x']}))), ['let-else-binding-scope'])
check('let-else-binding-scope regression 1', solve(dict(base, **({'else_branch':True,'success_bindings':[N],'else_uses':[N]}))), ['let-else-binding-scope'])
check('destructure-stage-rhs regression 0', solve(dict(base, **({'first_write':N,'rhs_end':N+1}))), ['destructure-stage-rhs'])
check('destructure-stage-rhs regression 1', solve(dict(base, **({'first_write':N+1,'rhs_end':N+2}))), ['destructure-stage-rhs'])
check('return-before-cleanup regression 0', solve(dict(base, **({'return_check':N+1,'cleanup_point':N}))), ['return-before-cleanup'])
check('return-before-cleanup regression 1', solve(dict(base, **({'return_check':N+2,'cleanup_point':N+1}))), ['return-before-cleanup'])
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):
    errors=[]
    if d['iterator_end']<d['loop_end']: errors.append('for-owner-duration')
    if d['error_exit'] and bool(d['body_loans_live']): errors.append('question-error-cleanup')
    if d['rhs_evaluated'] and not d['rhs_enabled']: errors.append('short-circuit-conditional')
    if d['autoderef_place']!=d['autoref_place']: errors.append('autoref-after-autoderef')
    if d['compound_assignment'] and d['destination_evaluations']!=1: errors.append('compound-destination-once')
    if d['base_point']>d['index_point']: errors.append('index-evaluation-order')
    if d['future_owner_end']<d['await_resume']: errors.append('await-future-owner')
    if d['else_branch'] and bool(set(d['success_bindings'])&set(d['else_uses'])): errors.append('let-else-binding-scope')
    if d['first_write']<d['rhs_end']: errors.append('destructure-stage-rhs')
    if d['return_check']>d['cleanup_point']+1: errors.append('return-before-cleanup')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'iterator_end': 0, 'loop_end': 0, 'error_exit': False, 'body_loans_live': [], 'rhs_evaluated': False, 'rhs_enabled': True, 'autoderef_place': [], 'autoref_place': [], 'destination_evaluations': 0, 'compound_assignment': False, 'base_point': 0, 'index_point': 0, 'future_owner_end': 0, 'await_resume': 0, 'else_branch': False, 'success_bindings': [], 'else_uses': [], 'rhs_end': 0, 'first_write': 0, 'return_check': 0, 'cleanup_point': 0}
check('well formed empty obligations',solve(base),[])
check('for-owner-duration regression 0', solve(dict(base, **({'iterator_end':N,'loop_end':N+1}))), ['for-owner-duration'])
check('for-owner-duration regression 1', solve(dict(base, **({'iterator_end':N+1,'loop_end':N+2}))), ['for-owner-duration'])
check('question-error-cleanup regression 0', solve(dict(base, **({'error_exit':True,'body_loans_live':['r']}))), ['question-error-cleanup'])
check('question-error-cleanup regression 1', solve(dict(base, **({'error_exit':True,'body_loans_live':[N]}))), ['question-error-cleanup'])
check('short-circuit-conditional regression 0', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False}))), ['short-circuit-conditional'])
check('short-circuit-conditional regression 1', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False,'loop_end':N,'iterator_end':N}))), ['short-circuit-conditional'])
check('autoref-after-autoderef regression 0', solve(dict(base, **({'autoderef_place':['r','*'],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('autoref-after-autoderef regression 1', solve(dict(base, **({'autoderef_place':['r','*',N],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('compound-destination-once regression 0', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':2}))), ['compound-destination-once'])
check('compound-destination-once regression 1', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':N+2}))), ['compound-destination-once'])
check('index-evaluation-order regression 0', solve(dict(base, **({'base_point':N+1,'index_point':N}))), ['index-evaluation-order'])
check('index-evaluation-order regression 1', solve(dict(base, **({'base_point':N+2,'index_point':N+1}))), ['index-evaluation-order'])
check('await-future-owner regression 0', solve(dict(base, **({'future_owner_end':N,'await_resume':N+1}))), ['await-future-owner'])
check('await-future-owner regression 1', solve(dict(base, **({'future_owner_end':N+1,'await_resume':N+2}))), ['await-future-owner'])
check('let-else-binding-scope regression 0', solve(dict(base, **({'else_branch':True,'success_bindings':['x'],'else_uses':['x']}))), ['let-else-binding-scope'])
check('let-else-binding-scope regression 1', solve(dict(base, **({'else_branch':True,'success_bindings':[N],'else_uses':[N]}))), ['let-else-binding-scope'])
check('destructure-stage-rhs regression 0', solve(dict(base, **({'first_write':N,'rhs_end':N+1}))), ['destructure-stage-rhs'])
check('destructure-stage-rhs regression 1', solve(dict(base, **({'first_write':N+1,'rhs_end':N+2}))), ['destructure-stage-rhs'])
check('return-before-cleanup regression 0', solve(dict(base, **({'return_check':N+1,'cleanup_point':N}))), ['return-before-cleanup'])
check('return-before-cleanup regression 1', solve(dict(base, **({'return_check':N+2,'cleanup_point':N+1}))), ['return-before-cleanup'])
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:
Return borrow validation observes state after local cleanup erased its provenance.

Validate borrow-sensitive desugaring proof facts. For-loop iterator temporary covers loop; question-mark error exit drops body loans; short-circuit right operand is conditionally evaluated; method autoref targets receiver after autoderef; compound assignment evaluates destination once; indexing evaluates base before index; await suspension preserves the borrowed future owner; let-else failure cannot access successful bindings; destructuring assignment stages RHS borrows before writing destinations; return expression lifetime is checked before local cleanup. Input is a fully explicit descriptor of the stated toy IR. Return rule identifiers in declaration order; absent optional obligations use the provided neutral defaults. No rule is an assertion about a production language.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        base,parent,child,valid,start,count=d
        selected=child[:count]
        indices=[parent[i] for i in selected]
        out=[]
        for j,i in enumerate(indices):
            value=base[i]
            known=valid[i]
            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('permuted duplicates', solve([[1, 2, 3], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [3, 1, 3, 2])
    check('nonzero slice', solve([[1, 2, 3], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [3, 1])
    check('validity moves with address', solve([[1, 2, 3], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [3, 1, None])
    check('empty slice', solve([[1], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[1, 2], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[1, 2], [0, 1], [0, 1], [True, True], 0, 2]), [1, 2])
    check('last slot', solve([[1, 2], [1, 0], [1, 0], [True, True], 1, 1]), [2])
elif N == 2:
    check('permuted duplicates', solve([[2, 3, 4], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [4, 2, 4, 3])
    check('nonzero slice', solve([[2, 3, 4], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [4, 2])
    check('validity moves with address', solve([[2, 3, 4], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [4, 2, None])
    check('empty slice', solve([[2], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[2, 3], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[2, 3], [0, 1], [0, 1], [True, True], 0, 2]), [2, 3])
    check('last slot', solve([[2, 3], [1, 0], [1, 0], [True, True], 1, 1]), [3])
elif N == 3:
    check('permuted duplicates', solve([[3, 4, 5], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [5, 3, 5, 4])
    check('nonzero slice', solve([[3, 4, 5], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [5, 3])
    check('validity moves with address', solve([[3, 4, 5], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [5, 3, None])
    check('empty slice', solve([[3], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[3, 4], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[3, 4], [0, 1], [0, 1], [True, True], 0, 2]), [3, 4])
    check('last slot', solve([[3, 4], [1, 0], [1, 0], [True, True], 1, 1]), [4])
elif N == 4:
    check('permuted duplicates', solve([[4, 5, 6], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [6, 4, 6, 5])
    check('nonzero slice', solve([[4, 5, 6], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [6, 4])
    check('validity moves with address', solve([[4, 5, 6], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [6, 4, None])
    check('empty slice', solve([[4], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[4, 5], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[4, 5], [0, 1], [0, 1], [True, True], 0, 2]), [4, 5])
    check('last slot', solve([[4, 5], [1, 0], [1, 0], [True, True], 1, 1]), [5])
elif N == 5:
    check('permuted duplicates', solve([[5, 6, 7], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [7, 5, 7, 6])
    check('nonzero slice', solve([[5, 6, 7], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [7, 5])
    check('validity moves with address', solve([[5, 6, 7], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [7, 5, None])
    check('empty slice', solve([[5], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[5, 6], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[5, 6], [0, 1], [0, 1], [True, True], 0, 2]), [5, 6])
    check('last slot', solve([[5, 6], [1, 0], [1, 0], [True, True], 1, 1]), [6])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

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

N = 1
observations = []
def solve(d):
    try:
        base,parent,child,valid,start,count=d
        selected=child[start:start+count-1]
        indices=[parent[i] for i in selected]
        out=[]
        for j,i in enumerate(indices):
            value=base[i]
            known=valid[i]
            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('permuted duplicates', solve([[1, 2, 3], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [3, 1, 3, 2])
    check('nonzero slice', solve([[1, 2, 3], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [3, 1])
    check('validity moves with address', solve([[1, 2, 3], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [3, 1, None])
    check('empty slice', solve([[1], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[1, 2], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[1, 2], [0, 1], [0, 1], [True, True], 0, 2]), [1, 2])
    check('last slot', solve([[1, 2], [1, 0], [1, 0], [True, True], 1, 1]), [2])
elif N == 2:
    check('permuted duplicates', solve([[2, 3, 4], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [4, 2, 4, 3])
    check('nonzero slice', solve([[2, 3, 4], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [4, 2])
    check('validity moves with address', solve([[2, 3, 4], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [4, 2, None])
    check('empty slice', solve([[2], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[2, 3], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[2, 3], [0, 1], [0, 1], [True, True], 0, 2]), [2, 3])
    check('last slot', solve([[2, 3], [1, 0], [1, 0], [True, True], 1, 1]), [3])
elif N == 3:
    check('permuted duplicates', solve([[3, 4, 5], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [5, 3, 5, 4])
    check('nonzero slice', solve([[3, 4, 5], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [5, 3])
    check('validity moves with address', solve([[3, 4, 5], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [5, 3, None])
    check('empty slice', solve([[3], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[3, 4], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[3, 4], [0, 1], [0, 1], [True, True], 0, 2]), [3, 4])
    check('last slot', solve([[3, 4], [1, 0], [1, 0], [True, True], 1, 1]), [4])
elif N == 4:
    check('permuted duplicates', solve([[4, 5, 6], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [6, 4, 6, 5])
    check('nonzero slice', solve([[4, 5, 6], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [6, 4])
    check('validity moves with address', solve([[4, 5, 6], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [6, 4, None])
    check('empty slice', solve([[4], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[4, 5], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[4, 5], [0, 1], [0, 1], [True, True], 0, 2]), [4, 5])
    check('last slot', solve([[4, 5], [1, 0], [1, 0], [True, True], 1, 1]), [5])
elif N == 5:
    check('permuted duplicates', solve([[5, 6, 7], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [7, 5, 7, 6])
    check('nonzero slice', solve([[5, 6, 7], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [7, 5])
    check('validity moves with address', solve([[5, 6, 7], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [7, 5, None])
    check('empty slice', solve([[5], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[5, 6], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[5, 6], [0, 1], [0, 1], [True, True], 0, 2]), [5, 6])
    check('last slot', solve([[5, 6], [1, 0], [1, 0], [True, True], 1, 1]), [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 child vector slice starts at the parent origin.

Compose a sliced child selection with its parent selection, gather base values, and consult base validity. Preserve child order and repeated indices; invalid entries produce None.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        base,parent,child,valid,start,count=d
        selected=child[start:start+count]
        indices=selected
        out=[]
        for j,i in enumerate(indices):
            value=base[i]
            known=valid[i]
            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('permuted duplicates', solve([[1, 2, 3], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [3, 1, 3, 2])
    check('nonzero slice', solve([[1, 2, 3], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [3, 1])
    check('validity moves with address', solve([[1, 2, 3], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [3, 1, None])
    check('empty slice', solve([[1], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[1, 2], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[1, 2], [0, 1], [0, 1], [True, True], 0, 2]), [1, 2])
    check('last slot', solve([[1, 2], [1, 0], [1, 0], [True, True], 1, 1]), [2])
elif N == 2:
    check('permuted duplicates', solve([[2, 3, 4], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [4, 2, 4, 3])
    check('nonzero slice', solve([[2, 3, 4], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [4, 2])
    check('validity moves with address', solve([[2, 3, 4], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [4, 2, None])
    check('empty slice', solve([[2], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[2, 3], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[2, 3], [0, 1], [0, 1], [True, True], 0, 2]), [2, 3])
    check('last slot', solve([[2, 3], [1, 0], [1, 0], [True, True], 1, 1]), [3])
elif N == 3:
    check('permuted duplicates', solve([[3, 4, 5], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [5, 3, 5, 4])
    check('nonzero slice', solve([[3, 4, 5], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [5, 3])
    check('validity moves with address', solve([[3, 4, 5], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [5, 3, None])
    check('empty slice', solve([[3], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[3, 4], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[3, 4], [0, 1], [0, 1], [True, True], 0, 2]), [3, 4])
    check('last slot', solve([[3, 4], [1, 0], [1, 0], [True, True], 1, 1]), [4])
elif N == 4:
    check('permuted duplicates', solve([[4, 5, 6], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [6, 4, 6, 5])
    check('nonzero slice', solve([[4, 5, 6], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [6, 4])
    check('validity moves with address', solve([[4, 5, 6], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [6, 4, None])
    check('empty slice', solve([[4], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[4, 5], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[4, 5], [0, 1], [0, 1], [True, True], 0, 2]), [4, 5])
    check('last slot', solve([[4, 5], [1, 0], [1, 0], [True, True], 1, 1]), [5])
elif N == 5:
    check('permuted duplicates', solve([[5, 6, 7], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [7, 5, 7, 6])
    check('nonzero slice', solve([[5, 6, 7], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [7, 5])
    check('validity moves with address', solve([[5, 6, 7], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [7, 5, None])
    check('empty slice', solve([[5], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[5, 6], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[5, 6], [0, 1], [0, 1], [True, True], 0, 2]), [5, 6])
    check('last slot', solve([[5, 6], [1, 0], [1, 0], [True, True], 1, 1]), [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:
        base,parent,child,valid,start,count=d
        selected=child[start:start+count]
        indices=[parent[i] if i else i for i in selected]
        out=[]
        for j,i in enumerate(indices):
            value=base[i]
            known=valid[i]
            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('permuted duplicates', solve([[1, 2, 3], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [3, 1, 3, 2])
    check('nonzero slice', solve([[1, 2, 3], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [3, 1])
    check('validity moves with address', solve([[1, 2, 3], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [3, 1, None])
    check('empty slice', solve([[1], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[1, 2], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[1, 2], [0, 1], [0, 1], [True, True], 0, 2]), [1, 2])
    check('last slot', solve([[1, 2], [1, 0], [1, 0], [True, True], 1, 1]), [2])
elif N == 2:
    check('permuted duplicates', solve([[2, 3, 4], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [4, 2, 4, 3])
    check('nonzero slice', solve([[2, 3, 4], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [4, 2])
    check('validity moves with address', solve([[2, 3, 4], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [4, 2, None])
    check('empty slice', solve([[2], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[2, 3], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[2, 3], [0, 1], [0, 1], [True, True], 0, 2]), [2, 3])
    check('last slot', solve([[2, 3], [1, 0], [1, 0], [True, True], 1, 1]), [3])
elif N == 3:
    check('permuted duplicates', solve([[3, 4, 5], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [5, 3, 5, 4])
    check('nonzero slice', solve([[3, 4, 5], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [5, 3])
    check('validity moves with address', solve([[3, 4, 5], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [5, 3, None])
    check('empty slice', solve([[3], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[3, 4], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[3, 4], [0, 1], [0, 1], [True, True], 0, 2]), [3, 4])
    check('last slot', solve([[3, 4], [1, 0], [1, 0], [True, True], 1, 1]), [4])
elif N == 4:
    check('permuted duplicates', solve([[4, 5, 6], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [6, 4, 6, 5])
    check('nonzero slice', solve([[4, 5, 6], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [6, 4])
    check('validity moves with address', solve([[4, 5, 6], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [6, 4, None])
    check('empty slice', solve([[4], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[4, 5], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[4, 5], [0, 1], [0, 1], [True, True], 0, 2]), [4, 5])
    check('last slot', solve([[4, 5], [1, 0], [1, 0], [True, True], 1, 1]), [5])
elif N == 5:
    check('permuted duplicates', solve([[5, 6, 7], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [7, 5, 7, 6])
    check('nonzero slice', solve([[5, 6, 7], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [7, 5])
    check('validity moves with address', solve([[5, 6, 7], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [7, 5, None])
    check('empty slice', solve([[5], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[5, 6], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[5, 6], [0, 1], [0, 1], [True, True], 0, 2]), [5, 6])
    check('last slot', solve([[5, 6], [1, 0], [1, 0], [True, True], 1, 1]), [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:
Selection composition gathers child offsets as base offsets.

Compose a sliced child selection with its parent selection, gather base values, and consult base validity. Preserve child order and repeated indices; invalid entries produce None.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        base,parent,child,valid,start,count=d
        selected=child[start:start+count]
        indices=[parent[i] for i in selected]
        out=[]
        for j,i in enumerate(dict.fromkeys(indices)):
            value=base[i]
            known=valid[i]
            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('permuted duplicates', solve([[1, 2, 3], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [3, 1, 3, 2])
    check('nonzero slice', solve([[1, 2, 3], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [3, 1])
    check('validity moves with address', solve([[1, 2, 3], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [3, 1, None])
    check('empty slice', solve([[1], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[1, 2], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[1, 2], [0, 1], [0, 1], [True, True], 0, 2]), [1, 2])
    check('last slot', solve([[1, 2], [1, 0], [1, 0], [True, True], 1, 1]), [2])
elif N == 2:
    check('permuted duplicates', solve([[2, 3, 4], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [4, 2, 4, 3])
    check('nonzero slice', solve([[2, 3, 4], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [4, 2])
    check('validity moves with address', solve([[2, 3, 4], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [4, 2, None])
    check('empty slice', solve([[2], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[2, 3], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[2, 3], [0, 1], [0, 1], [True, True], 0, 2]), [2, 3])
    check('last slot', solve([[2, 3], [1, 0], [1, 0], [True, True], 1, 1]), [3])
elif N == 3:
    check('permuted duplicates', solve([[3, 4, 5], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [5, 3, 5, 4])
    check('nonzero slice', solve([[3, 4, 5], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [5, 3])
    check('validity moves with address', solve([[3, 4, 5], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [5, 3, None])
    check('empty slice', solve([[3], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[3, 4], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[3, 4], [0, 1], [0, 1], [True, True], 0, 2]), [3, 4])
    check('last slot', solve([[3, 4], [1, 0], [1, 0], [True, True], 1, 1]), [4])
elif N == 4:
    check('permuted duplicates', solve([[4, 5, 6], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [6, 4, 6, 5])
    check('nonzero slice', solve([[4, 5, 6], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [6, 4])
    check('validity moves with address', solve([[4, 5, 6], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [6, 4, None])
    check('empty slice', solve([[4], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[4, 5], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[4, 5], [0, 1], [0, 1], [True, True], 0, 2]), [4, 5])
    check('last slot', solve([[4, 5], [1, 0], [1, 0], [True, True], 1, 1]), [5])
elif N == 5:
    check('permuted duplicates', solve([[5, 6, 7], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [7, 5, 7, 6])
    check('nonzero slice', solve([[5, 6, 7], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [7, 5])
    check('validity moves with address', solve([[5, 6, 7], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [7, 5, None])
    check('empty slice', solve([[5], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[5, 6], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[5, 6], [0, 1], [0, 1], [True, True], 0, 2]), [5, 6])
    check('last slot', solve([[5, 6], [1, 0], [1, 0], [True, True], 1, 1]), [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:
        base,parent,child,valid,start,count=d
        selected=child[start:start+count]
        indices=[parent[i] for i in selected]
        out=[]
        for j,i in enumerate(sorted(set(indices))):
            value=base[i]
            known=valid[i]
            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('permuted duplicates', solve([[1, 2, 3], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [3, 1, 3, 2])
    check('nonzero slice', solve([[1, 2, 3], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [3, 1])
    check('validity moves with address', solve([[1, 2, 3], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [3, 1, None])
    check('empty slice', solve([[1], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[1, 2], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[1, 2], [0, 1], [0, 1], [True, True], 0, 2]), [1, 2])
    check('last slot', solve([[1, 2], [1, 0], [1, 0], [True, True], 1, 1]), [2])
elif N == 2:
    check('permuted duplicates', solve([[2, 3, 4], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [4, 2, 4, 3])
    check('nonzero slice', solve([[2, 3, 4], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [4, 2])
    check('validity moves with address', solve([[2, 3, 4], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [4, 2, None])
    check('empty slice', solve([[2], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[2, 3], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[2, 3], [0, 1], [0, 1], [True, True], 0, 2]), [2, 3])
    check('last slot', solve([[2, 3], [1, 0], [1, 0], [True, True], 1, 1]), [3])
elif N == 3:
    check('permuted duplicates', solve([[3, 4, 5], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [5, 3, 5, 4])
    check('nonzero slice', solve([[3, 4, 5], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [5, 3])
    check('validity moves with address', solve([[3, 4, 5], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [5, 3, None])
    check('empty slice', solve([[3], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[3, 4], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[3, 4], [0, 1], [0, 1], [True, True], 0, 2]), [3, 4])
    check('last slot', solve([[3, 4], [1, 0], [1, 0], [True, True], 1, 1]), [4])
elif N == 4:
    check('permuted duplicates', solve([[4, 5, 6], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [6, 4, 6, 5])
    check('nonzero slice', solve([[4, 5, 6], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [6, 4])
    check('validity moves with address', solve([[4, 5, 6], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [6, 4, None])
    check('empty slice', solve([[4], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[4, 5], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[4, 5], [0, 1], [0, 1], [True, True], 0, 2]), [4, 5])
    check('last slot', solve([[4, 5], [1, 0], [1, 0], [True, True], 1, 1]), [5])
elif N == 5:
    check('permuted duplicates', solve([[5, 6, 7], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [7, 5, 7, 6])
    check('nonzero slice', solve([[5, 6, 7], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [7, 5])
    check('validity moves with address', solve([[5, 6, 7], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [7, 5, None])
    check('empty slice', solve([[5], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[5, 6], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[5, 6], [0, 1], [0, 1], [True, True], 0, 2]), [5, 6])
    check('last slot', solve([[5, 6], [1, 0], [1, 0], [True, True], 1, 1]), [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 physical selection is deduplicated before gathering.

Compose a sliced child selection with its parent selection, gather base values, and consult base validity. Preserve child order and repeated indices; invalid entries produce None.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        base,parent,child,valid,start,count=d
        selected=child[start:start+count]
        indices=[parent[i] for i in selected]
        out=[]
        for j,i in enumerate(indices):
            value=base[j] if j<len(base) else None
            known=valid[i]
            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('permuted duplicates', solve([[1, 2, 3], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [3, 1, 3, 2])
    check('nonzero slice', solve([[1, 2, 3], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [3, 1])
    check('validity moves with address', solve([[1, 2, 3], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [3, 1, None])
    check('empty slice', solve([[1], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[1, 2], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[1, 2], [0, 1], [0, 1], [True, True], 0, 2]), [1, 2])
    check('last slot', solve([[1, 2], [1, 0], [1, 0], [True, True], 1, 1]), [2])
elif N == 2:
    check('permuted duplicates', solve([[2, 3, 4], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [4, 2, 4, 3])
    check('nonzero slice', solve([[2, 3, 4], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [4, 2])
    check('validity moves with address', solve([[2, 3, 4], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [4, 2, None])
    check('empty slice', solve([[2], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[2, 3], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[2, 3], [0, 1], [0, 1], [True, True], 0, 2]), [2, 3])
    check('last slot', solve([[2, 3], [1, 0], [1, 0], [True, True], 1, 1]), [3])
elif N == 3:
    check('permuted duplicates', solve([[3, 4, 5], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [5, 3, 5, 4])
    check('nonzero slice', solve([[3, 4, 5], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [5, 3])
    check('validity moves with address', solve([[3, 4, 5], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [5, 3, None])
    check('empty slice', solve([[3], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[3, 4], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[3, 4], [0, 1], [0, 1], [True, True], 0, 2]), [3, 4])
    check('last slot', solve([[3, 4], [1, 0], [1, 0], [True, True], 1, 1]), [4])
elif N == 4:
    check('permuted duplicates', solve([[4, 5, 6], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [6, 4, 6, 5])
    check('nonzero slice', solve([[4, 5, 6], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [6, 4])
    check('validity moves with address', solve([[4, 5, 6], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [6, 4, None])
    check('empty slice', solve([[4], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[4, 5], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[4, 5], [0, 1], [0, 1], [True, True], 0, 2]), [4, 5])
    check('last slot', solve([[4, 5], [1, 0], [1, 0], [True, True], 1, 1]), [5])
elif N == 5:
    check('permuted duplicates', solve([[5, 6, 7], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [7, 5, 7, 6])
    check('nonzero slice', solve([[5, 6, 7], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [7, 5])
    check('validity moves with address', solve([[5, 6, 7], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [7, 5, None])
    check('empty slice', solve([[5], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[5, 6], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[5, 6], [0, 1], [0, 1], [True, True], 0, 2]), [5, 6])
    check('last slot', solve([[5, 6], [1, 0], [1, 0], [True, True], 1, 1]), [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:
        base,parent,child,valid,start,count=d
        selected=child[start:start+count]
        indices=[parent[i] for i in selected]
        out=[]
        for j,i in enumerate(indices):
            value=base[min(i,j)]
            known=valid[i]
            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('permuted duplicates', solve([[1, 2, 3], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [3, 1, 3, 2])
    check('nonzero slice', solve([[1, 2, 3], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [3, 1])
    check('validity moves with address', solve([[1, 2, 3], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [3, 1, None])
    check('empty slice', solve([[1], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[1, 2], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[1, 2], [0, 1], [0, 1], [True, True], 0, 2]), [1, 2])
    check('last slot', solve([[1, 2], [1, 0], [1, 0], [True, True], 1, 1]), [2])
elif N == 2:
    check('permuted duplicates', solve([[2, 3, 4], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [4, 2, 4, 3])
    check('nonzero slice', solve([[2, 3, 4], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [4, 2])
    check('validity moves with address', solve([[2, 3, 4], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [4, 2, None])
    check('empty slice', solve([[2], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[2, 3], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[2, 3], [0, 1], [0, 1], [True, True], 0, 2]), [2, 3])
    check('last slot', solve([[2, 3], [1, 0], [1, 0], [True, True], 1, 1]), [3])
elif N == 3:
    check('permuted duplicates', solve([[3, 4, 5], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [5, 3, 5, 4])
    check('nonzero slice', solve([[3, 4, 5], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [5, 3])
    check('validity moves with address', solve([[3, 4, 5], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [5, 3, None])
    check('empty slice', solve([[3], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[3, 4], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[3, 4], [0, 1], [0, 1], [True, True], 0, 2]), [3, 4])
    check('last slot', solve([[3, 4], [1, 0], [1, 0], [True, True], 1, 1]), [4])
elif N == 4:
    check('permuted duplicates', solve([[4, 5, 6], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [6, 4, 6, 5])
    check('nonzero slice', solve([[4, 5, 6], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [6, 4])
    check('validity moves with address', solve([[4, 5, 6], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [6, 4, None])
    check('empty slice', solve([[4], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[4, 5], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[4, 5], [0, 1], [0, 1], [True, True], 0, 2]), [4, 5])
    check('last slot', solve([[4, 5], [1, 0], [1, 0], [True, True], 1, 1]), [5])
elif N == 5:
    check('permuted duplicates', solve([[5, 6, 7], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [7, 5, 7, 6])
    check('nonzero slice', solve([[5, 6, 7], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [7, 5])
    check('validity moves with address', solve([[5, 6, 7], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [7, 5, None])
    check('empty slice', solve([[5], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[5, 6], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[5, 6], [0, 1], [0, 1], [True, True], 0, 2]), [5, 6])
    check('last slot', solve([[5, 6], [1, 0], [1, 0], [True, True], 1, 1]), [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:
Gather reads the output position instead of the selected position.

Compose a sliced child selection with its parent selection, gather base values, and consult base validity. Preserve child order and repeated indices; invalid entries produce None.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        base,parent,child,valid,start,count=d
        selected=child[start:start+count]
        indices=[parent[i] for i in selected]
        out=[]
        for j,i in enumerate(indices):
            value=base[i]
            known=valid[j] if j<len(valid) else False
            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('permuted duplicates', solve([[1, 2, 3], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [3, 1, 3, 2])
    check('nonzero slice', solve([[1, 2, 3], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [3, 1])
    check('validity moves with address', solve([[1, 2, 3], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [3, 1, None])
    check('empty slice', solve([[1], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[1, 2], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[1, 2], [0, 1], [0, 1], [True, True], 0, 2]), [1, 2])
    check('last slot', solve([[1, 2], [1, 0], [1, 0], [True, True], 1, 1]), [2])
elif N == 2:
    check('permuted duplicates', solve([[2, 3, 4], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [4, 2, 4, 3])
    check('nonzero slice', solve([[2, 3, 4], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [4, 2])
    check('validity moves with address', solve([[2, 3, 4], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [4, 2, None])
    check('empty slice', solve([[2], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[2, 3], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[2, 3], [0, 1], [0, 1], [True, True], 0, 2]), [2, 3])
    check('last slot', solve([[2, 3], [1, 0], [1, 0], [True, True], 1, 1]), [3])
elif N == 3:
    check('permuted duplicates', solve([[3, 4, 5], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [5, 3, 5, 4])
    check('nonzero slice', solve([[3, 4, 5], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [5, 3])
    check('validity moves with address', solve([[3, 4, 5], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [5, 3, None])
    check('empty slice', solve([[3], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[3, 4], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[3, 4], [0, 1], [0, 1], [True, True], 0, 2]), [3, 4])
    check('last slot', solve([[3, 4], [1, 0], [1, 0], [True, True], 1, 1]), [4])
elif N == 4:
    check('permuted duplicates', solve([[4, 5, 6], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [6, 4, 6, 5])
    check('nonzero slice', solve([[4, 5, 6], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [6, 4])
    check('validity moves with address', solve([[4, 5, 6], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [6, 4, None])
    check('empty slice', solve([[4], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[4, 5], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[4, 5], [0, 1], [0, 1], [True, True], 0, 2]), [4, 5])
    check('last slot', solve([[4, 5], [1, 0], [1, 0], [True, True], 1, 1]), [5])
elif N == 5:
    check('permuted duplicates', solve([[5, 6, 7], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [7, 5, 7, 6])
    check('nonzero slice', solve([[5, 6, 7], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [7, 5])
    check('validity moves with address', solve([[5, 6, 7], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [7, 5, None])
    check('empty slice', solve([[5], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[5, 6], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[5, 6], [0, 1], [0, 1], [True, True], 0, 2]), [5, 6])
    check('last slot', solve([[5, 6], [1, 0], [1, 0], [True, True], 1, 1]), [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:
        base,parent,child,valid,start,count=d
        selected=child[start:start+count]
        indices=[parent[i] for i in selected]
        out=[]
        for j,i in enumerate(indices):
            value=base[i]
            known=valid[i] and (valid[j] if j<len(valid) else False)
            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('permuted duplicates', solve([[1, 2, 3], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [3, 1, 3, 2])
    check('nonzero slice', solve([[1, 2, 3], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [3, 1])
    check('validity moves with address', solve([[1, 2, 3], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [3, 1, None])
    check('empty slice', solve([[1], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[1, 2], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[1, 2], [0, 1], [0, 1], [True, True], 0, 2]), [1, 2])
    check('last slot', solve([[1, 2], [1, 0], [1, 0], [True, True], 1, 1]), [2])
elif N == 2:
    check('permuted duplicates', solve([[2, 3, 4], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [4, 2, 4, 3])
    check('nonzero slice', solve([[2, 3, 4], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [4, 2])
    check('validity moves with address', solve([[2, 3, 4], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [4, 2, None])
    check('empty slice', solve([[2], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[2, 3], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[2, 3], [0, 1], [0, 1], [True, True], 0, 2]), [2, 3])
    check('last slot', solve([[2, 3], [1, 0], [1, 0], [True, True], 1, 1]), [3])
elif N == 3:
    check('permuted duplicates', solve([[3, 4, 5], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [5, 3, 5, 4])
    check('nonzero slice', solve([[3, 4, 5], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [5, 3])
    check('validity moves with address', solve([[3, 4, 5], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [5, 3, None])
    check('empty slice', solve([[3], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[3, 4], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[3, 4], [0, 1], [0, 1], [True, True], 0, 2]), [3, 4])
    check('last slot', solve([[3, 4], [1, 0], [1, 0], [True, True], 1, 1]), [4])
elif N == 4:
    check('permuted duplicates', solve([[4, 5, 6], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [6, 4, 6, 5])
    check('nonzero slice', solve([[4, 5, 6], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [6, 4])
    check('validity moves with address', solve([[4, 5, 6], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [6, 4, None])
    check('empty slice', solve([[4], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[4, 5], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[4, 5], [0, 1], [0, 1], [True, True], 0, 2]), [4, 5])
    check('last slot', solve([[4, 5], [1, 0], [1, 0], [True, True], 1, 1]), [5])
elif N == 5:
    check('permuted duplicates', solve([[5, 6, 7], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [7, 5, 7, 6])
    check('nonzero slice', solve([[5, 6, 7], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [7, 5])
    check('validity moves with address', solve([[5, 6, 7], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [7, 5, None])
    check('empty slice', solve([[5], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[5, 6], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[5, 6], [0, 1], [0, 1], [True, True], 0, 2]), [5, 6])
    check('last slot', solve([[5, 6], [1, 0], [1, 0], [True, True], 1, 1]), [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:
Validity follows output position instead of base position.

Compose a sliced child selection with its parent selection, gather base values, and consult base validity. Preserve child order and repeated indices; invalid entries produce None.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        base,parent,child,valid,start,count=d
        selected=child[start:start+count]
        indices=[parent[i] for i in selected]
        out=[]
        for j,i in enumerate(indices):
            value=base[i]
            known=valid[i]
            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('permuted duplicates', solve([[1, 2, 3], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [3, 1, 3, 2])
    check('nonzero slice', solve([[1, 2, 3], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [3, 1])
    check('validity moves with address', solve([[1, 2, 3], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [3, 1, None])
    check('empty slice', solve([[1], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[1, 2], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[1, 2], [0, 1], [0, 1], [True, True], 0, 2]), [1, 2])
    check('last slot', solve([[1, 2], [1, 0], [1, 0], [True, True], 1, 1]), [2])
elif N == 2:
    check('permuted duplicates', solve([[2, 3, 4], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [4, 2, 4, 3])
    check('nonzero slice', solve([[2, 3, 4], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [4, 2])
    check('validity moves with address', solve([[2, 3, 4], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [4, 2, None])
    check('empty slice', solve([[2], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[2, 3], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[2, 3], [0, 1], [0, 1], [True, True], 0, 2]), [2, 3])
    check('last slot', solve([[2, 3], [1, 0], [1, 0], [True, True], 1, 1]), [3])
elif N == 3:
    check('permuted duplicates', solve([[3, 4, 5], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [5, 3, 5, 4])
    check('nonzero slice', solve([[3, 4, 5], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [5, 3])
    check('validity moves with address', solve([[3, 4, 5], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [5, 3, None])
    check('empty slice', solve([[3], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[3, 4], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[3, 4], [0, 1], [0, 1], [True, True], 0, 2]), [3, 4])
    check('last slot', solve([[3, 4], [1, 0], [1, 0], [True, True], 1, 1]), [4])
elif N == 4:
    check('permuted duplicates', solve([[4, 5, 6], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [6, 4, 6, 5])
    check('nonzero slice', solve([[4, 5, 6], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [6, 4])
    check('validity moves with address', solve([[4, 5, 6], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [6, 4, None])
    check('empty slice', solve([[4], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[4, 5], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[4, 5], [0, 1], [0, 1], [True, True], 0, 2]), [4, 5])
    check('last slot', solve([[4, 5], [1, 0], [1, 0], [True, True], 1, 1]), [5])
elif N == 5:
    check('permuted duplicates', solve([[5, 6, 7], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [7, 5, 7, 6])
    check('nonzero slice', solve([[5, 6, 7], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [7, 5])
    check('validity moves with address', solve([[5, 6, 7], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [7, 5, None])
    check('empty slice', solve([[5], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[5, 6], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[5, 6], [0, 1], [0, 1], [True, True], 0, 2]), [5, 6])
    check('last slot', solve([[5, 6], [1, 0], [1, 0], [True, True], 1, 1]), [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:
        base,parent,child,valid,start,count=d
        selected=child[start:start+count]
        indices=[parent[i] for i in selected]
        out=[]
        for j,i in enumerate(indices):
            value=base[i]
            known=valid[i]
            out.append(value if known else 0)
        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('permuted duplicates', solve([[1, 2, 3], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [3, 1, 3, 2])
    check('nonzero slice', solve([[1, 2, 3], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [3, 1])
    check('validity moves with address', solve([[1, 2, 3], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [3, 1, None])
    check('empty slice', solve([[1], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[1, 2], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[1, 2], [0, 1], [0, 1], [True, True], 0, 2]), [1, 2])
    check('last slot', solve([[1, 2], [1, 0], [1, 0], [True, True], 1, 1]), [2])
elif N == 2:
    check('permuted duplicates', solve([[2, 3, 4], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [4, 2, 4, 3])
    check('nonzero slice', solve([[2, 3, 4], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [4, 2])
    check('validity moves with address', solve([[2, 3, 4], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [4, 2, None])
    check('empty slice', solve([[2], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[2, 3], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[2, 3], [0, 1], [0, 1], [True, True], 0, 2]), [2, 3])
    check('last slot', solve([[2, 3], [1, 0], [1, 0], [True, True], 1, 1]), [3])
elif N == 3:
    check('permuted duplicates', solve([[3, 4, 5], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [5, 3, 5, 4])
    check('nonzero slice', solve([[3, 4, 5], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [5, 3])
    check('validity moves with address', solve([[3, 4, 5], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [5, 3, None])
    check('empty slice', solve([[3], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[3, 4], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[3, 4], [0, 1], [0, 1], [True, True], 0, 2]), [3, 4])
    check('last slot', solve([[3, 4], [1, 0], [1, 0], [True, True], 1, 1]), [4])
elif N == 4:
    check('permuted duplicates', solve([[4, 5, 6], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [6, 4, 6, 5])
    check('nonzero slice', solve([[4, 5, 6], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [6, 4])
    check('validity moves with address', solve([[4, 5, 6], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [6, 4, None])
    check('empty slice', solve([[4], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[4, 5], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[4, 5], [0, 1], [0, 1], [True, True], 0, 2]), [4, 5])
    check('last slot', solve([[4, 5], [1, 0], [1, 0], [True, True], 1, 1]), [5])
elif N == 5:
    check('permuted duplicates', solve([[5, 6, 7], [2, 0, 1], [0, 1, 0, 2], [True, True, True], 0, 4]), [7, 5, 7, 6])
    check('nonzero slice', solve([[5, 6, 7], [2, 0, 1], [2, 0, 1], [True, True, True], 1, 2]), [7, 5])
    check('validity moves with address', solve([[5, 6, 7], [2, 0, 1], [0, 1, 2], [True, False, True], 0, 3]), [7, 5, None])
    check('empty slice', solve([[5], [0], [0], [True], 0, 0]), [])
    check('all null', solve([[5, 6], [1, 0], [0, 1], [False, False], 0, 2]), [None, None])
    check('identity control', solve([[5, 6], [0, 1], [0, 1], [True, True], 0, 2]), [5, 6])
    check('last slot', solve([[5, 6], [1, 0], [1, 0], [True, True], 1, 1]), [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:
Invalid gathered lanes disappear instead of retaining a null slot.

Compose a sliced child selection with its parent selection, gather base values, and consult base validity. Preserve child order and repeated indices; invalid entries produce None.

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:
            merged=[]
            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.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:
            merged=merged[:1]
            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.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:
Each dictionary batch replaces the unified value domain.

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[c] for c in codes]:
                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.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[c] for i,c in enumerate(codes) if valid[i]]:
                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.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:
Dictionary unification omits values unused by this 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:
        merged=[]; batches=[]
        for dictionary,codes,valid in d:
            for value in dictionary:
                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.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 not merged or value != merged[-1]: 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.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:
Repeated dictionary values allocate different global codes.

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=list(range(len(dictionary)))
            rewritten=[mapping[c] if valid[i] else None 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(dictionary[0])+i for i in range(len(dictionary))]
            rewritten=[mapping[c] if valid[i] else None 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:
Local dictionary codes survive a global dictionary merge.

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