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

N = 1
observations = []
def solve(d):
    try:
        output,batches=d
        result=[]
        for schema,rows in batches:
            columns={field:index for index,(field,name) in enumerate(schema)}
            for row in rows:
                record=[]
                for field,name,default in output:
                    value=(row[columns[field]] if field in columns else None) or default
                    record.append(value)
                result.append(record)
        return result
    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('renamed field', solve([[[2, 'new', 99], [1, 'a', 88]], [[[[1, 'a'], [2, 'old']], [[1, 2]]]]]), [[2, 1]])
    check('reordered batch', solve([[[1, 'a', 0], [2, 'b', 0]], [[[[1, 'a'], [2, 'b']], [[1, 2]]], [[[2, 'b'], [1, 'a']], [[3, 4]]]]]), [[1, 2], [4, 3]])
    check('absent default', solve([[[1, 'a', 7], [2, 'b', 1]], [[[[1, 'a']], [[2]]]]]), [[2, 1]])
    check('explicit null', solve([[[1, 'a', 1]], [[[[1, 'a']], [[None]]]]]), [[None]])
    check('duplicate rows', solve([[[1, 'a', 0]], [[[[1, 'a']], [[1], [1]]]]]), [[1], [1]])
    check('no batches', solve([[[1, 'a', 0]], []]), [])
    check('zero preserved', solve([[[1, 'a', 1]], [[[[1, 'a']], [[0]]]]]), [[0]])
elif N == 2:
    check('renamed field', solve([[[2, 'new', 99], [1, 'a', 88]], [[[[1, 'a'], [2, 'old']], [[2, 3]]]]]), [[3, 2]])
    check('reordered batch', solve([[[1, 'a', 0], [2, 'b', 0]], [[[[1, 'a'], [2, 'b']], [[2, 3]]], [[[2, 'b'], [1, 'a']], [[4, 5]]]]]), [[2, 3], [5, 4]])
    check('absent default', solve([[[1, 'a', 7], [2, 'b', 2]], [[[[1, 'a']], [[3]]]]]), [[3, 2]])
    check('explicit null', solve([[[1, 'a', 2]], [[[[1, 'a']], [[None]]]]]), [[None]])
    check('duplicate rows', solve([[[1, 'a', 0]], [[[[1, 'a']], [[2], [2]]]]]), [[2], [2]])
    check('no batches', solve([[[1, 'a', 0]], []]), [])
    check('zero preserved', solve([[[1, 'a', 2]], [[[[1, 'a']], [[0]]]]]), [[0]])
elif N == 3:
    check('renamed field', solve([[[2, 'new', 99], [1, 'a', 88]], [[[[1, 'a'], [2, 'old']], [[3, 4]]]]]), [[4, 3]])
    check('reordered batch', solve([[[1, 'a', 0], [2, 'b', 0]], [[[[1, 'a'], [2, 'b']], [[3, 4]]], [[[2, 'b'], [1, 'a']], [[5, 6]]]]]), [[3, 4], [6, 5]])
    check('absent default', solve([[[1, 'a', 7], [2, 'b', 3]], [[[[1, 'a']], [[4]]]]]), [[4, 3]])
    check('explicit null', solve([[[1, 'a', 3]], [[[[1, 'a']], [[None]]]]]), [[None]])
    check('duplicate rows', solve([[[1, 'a', 0]], [[[[1, 'a']], [[3], [3]]]]]), [[3], [3]])
    check('no batches', solve([[[1, 'a', 0]], []]), [])
    check('zero preserved', solve([[[1, 'a', 3]], [[[[1, 'a']], [[0]]]]]), [[0]])
elif N == 4:
    check('renamed field', solve([[[2, 'new', 99], [1, 'a', 88]], [[[[1, 'a'], [2, 'old']], [[4, 5]]]]]), [[5, 4]])
    check('reordered batch', solve([[[1, 'a', 0], [2, 'b', 0]], [[[[1, 'a'], [2, 'b']], [[4, 5]]], [[[2, 'b'], [1, 'a']], [[6, 7]]]]]), [[4, 5], [7, 6]])
    check('absent default', solve([[[1, 'a', 7], [2, 'b', 4]], [[[[1, 'a']], [[5]]]]]), [[5, 4]])
    check('explicit null', solve([[[1, 'a', 4]], [[[[1, 'a']], [[None]]]]]), [[None]])
    check('duplicate rows', solve([[[1, 'a', 0]], [[[[1, 'a']], [[4], [4]]]]]), [[4], [4]])
    check('no batches', solve([[[1, 'a', 0]], []]), [])
    check('zero preserved', solve([[[1, 'a', 4]], [[[[1, 'a']], [[0]]]]]), [[0]])
elif N == 5:
    check('renamed field', solve([[[2, 'new', 99], [1, 'a', 88]], [[[[1, 'a'], [2, 'old']], [[5, 6]]]]]), [[6, 5]])
    check('reordered batch', solve([[[1, 'a', 0], [2, 'b', 0]], [[[[1, 'a'], [2, 'b']], [[5, 6]]], [[[2, 'b'], [1, 'a']], [[7, 8]]]]]), [[5, 6], [8, 7]])
    check('absent default', solve([[[1, 'a', 7], [2, 'b', 5]], [[[[1, 'a']], [[6]]]]]), [[6, 5]])
    check('explicit null', solve([[[1, 'a', 5]], [[[[1, 'a']], [[None]]]]]), [[None]])
    check('duplicate rows', solve([[[1, 'a', 0]], [[[[1, 'a']], [[5], [5]]]]]), [[5], [5]])
    check('no batches', solve([[[1, 'a', 0]], []]), [])
    check('zero preserved', solve([[[1, 'a', 5]], [[[[1, 'a']], [[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:
        output,batches=d
        result=[]
        for schema,rows in batches:
            columns={field:index for index,(field,name) in enumerate(schema)}
            for row in rows:
                record=[]
                for field,name,default in output:
                    value=default if field not in columns or row[columns[field]] is None else row[columns[field]]
                    record.append(value)
                result.append(record)
        return result
    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('renamed field', solve([[[2, 'new', 99], [1, 'a', 88]], [[[[1, 'a'], [2, 'old']], [[1, 2]]]]]), [[2, 1]])
    check('reordered batch', solve([[[1, 'a', 0], [2, 'b', 0]], [[[[1, 'a'], [2, 'b']], [[1, 2]]], [[[2, 'b'], [1, 'a']], [[3, 4]]]]]), [[1, 2], [4, 3]])
    check('absent default', solve([[[1, 'a', 7], [2, 'b', 1]], [[[[1, 'a']], [[2]]]]]), [[2, 1]])
    check('explicit null', solve([[[1, 'a', 1]], [[[[1, 'a']], [[None]]]]]), [[None]])
    check('duplicate rows', solve([[[1, 'a', 0]], [[[[1, 'a']], [[1], [1]]]]]), [[1], [1]])
    check('no batches', solve([[[1, 'a', 0]], []]), [])
    check('zero preserved', solve([[[1, 'a', 1]], [[[[1, 'a']], [[0]]]]]), [[0]])
elif N == 2:
    check('renamed field', solve([[[2, 'new', 99], [1, 'a', 88]], [[[[1, 'a'], [2, 'old']], [[2, 3]]]]]), [[3, 2]])
    check('reordered batch', solve([[[1, 'a', 0], [2, 'b', 0]], [[[[1, 'a'], [2, 'b']], [[2, 3]]], [[[2, 'b'], [1, 'a']], [[4, 5]]]]]), [[2, 3], [5, 4]])
    check('absent default', solve([[[1, 'a', 7], [2, 'b', 2]], [[[[1, 'a']], [[3]]]]]), [[3, 2]])
    check('explicit null', solve([[[1, 'a', 2]], [[[[1, 'a']], [[None]]]]]), [[None]])
    check('duplicate rows', solve([[[1, 'a', 0]], [[[[1, 'a']], [[2], [2]]]]]), [[2], [2]])
    check('no batches', solve([[[1, 'a', 0]], []]), [])
    check('zero preserved', solve([[[1, 'a', 2]], [[[[1, 'a']], [[0]]]]]), [[0]])
elif N == 3:
    check('renamed field', solve([[[2, 'new', 99], [1, 'a', 88]], [[[[1, 'a'], [2, 'old']], [[3, 4]]]]]), [[4, 3]])
    check('reordered batch', solve([[[1, 'a', 0], [2, 'b', 0]], [[[[1, 'a'], [2, 'b']], [[3, 4]]], [[[2, 'b'], [1, 'a']], [[5, 6]]]]]), [[3, 4], [6, 5]])
    check('absent default', solve([[[1, 'a', 7], [2, 'b', 3]], [[[[1, 'a']], [[4]]]]]), [[4, 3]])
    check('explicit null', solve([[[1, 'a', 3]], [[[[1, 'a']], [[None]]]]]), [[None]])
    check('duplicate rows', solve([[[1, 'a', 0]], [[[[1, 'a']], [[3], [3]]]]]), [[3], [3]])
    check('no batches', solve([[[1, 'a', 0]], []]), [])
    check('zero preserved', solve([[[1, 'a', 3]], [[[[1, 'a']], [[0]]]]]), [[0]])
elif N == 4:
    check('renamed field', solve([[[2, 'new', 99], [1, 'a', 88]], [[[[1, 'a'], [2, 'old']], [[4, 5]]]]]), [[5, 4]])
    check('reordered batch', solve([[[1, 'a', 0], [2, 'b', 0]], [[[[1, 'a'], [2, 'b']], [[4, 5]]], [[[2, 'b'], [1, 'a']], [[6, 7]]]]]), [[4, 5], [7, 6]])
    check('absent default', solve([[[1, 'a', 7], [2, 'b', 4]], [[[[1, 'a']], [[5]]]]]), [[5, 4]])
    check('explicit null', solve([[[1, 'a', 4]], [[[[1, 'a']], [[None]]]]]), [[None]])
    check('duplicate rows', solve([[[1, 'a', 0]], [[[[1, 'a']], [[4], [4]]]]]), [[4], [4]])
    check('no batches', solve([[[1, 'a', 0]], []]), [])
    check('zero preserved', solve([[[1, 'a', 4]], [[[[1, 'a']], [[0]]]]]), [[0]])
elif N == 5:
    check('renamed field', solve([[[2, 'new', 99], [1, 'a', 88]], [[[[1, 'a'], [2, 'old']], [[5, 6]]]]]), [[6, 5]])
    check('reordered batch', solve([[[1, 'a', 0], [2, 'b', 0]], [[[[1, 'a'], [2, 'b']], [[5, 6]]], [[[2, 'b'], [1, 'a']], [[7, 8]]]]]), [[5, 6], [8, 7]])
    check('absent default', solve([[[1, 'a', 7], [2, 'b', 5]], [[[[1, 'a']], [[6]]]]]), [[6, 5]])
    check('explicit null', solve([[[1, 'a', 5]], [[[[1, 'a']], [[None]]]]]), [[None]])
    check('duplicate rows', solve([[[1, 'a', 0]], [[[[1, 'a']], [[5], [5]]]]]), [[5], [5]])
    check('no batches', solve([[[1, 'a', 0]], []]), [])
    check('zero preserved', solve([[[1, 'a', 5]], [[[[1, 'a']], [[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:
Schema union applies defaults to explicit null cells.

Union batches using stable numeric field identities. The output schema is an ordered list [id,current_name,default]; batch schemas map old names to IDs. Project each batch row into output order, use defaults only for absent columns, and preserve explicit nulls and all rows.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        output,batches=d
        result=[]
        for schema,rows in batches:
            columns={field:index for index,(field,name) in enumerate(schema)}
            for row in rows:
                record=[]
                for field,name,default in output:
                    value=row[columns[field]] if field in columns else None
                    record.append(value)
                result.append(record)
        return result
    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('renamed field', solve([[[2, 'new', 99], [1, 'a', 88]], [[[[1, 'a'], [2, 'old']], [[1, 2]]]]]), [[2, 1]])
    check('reordered batch', solve([[[1, 'a', 0], [2, 'b', 0]], [[[[1, 'a'], [2, 'b']], [[1, 2]]], [[[2, 'b'], [1, 'a']], [[3, 4]]]]]), [[1, 2], [4, 3]])
    check('absent default', solve([[[1, 'a', 7], [2, 'b', 1]], [[[[1, 'a']], [[2]]]]]), [[2, 1]])
    check('explicit null', solve([[[1, 'a', 1]], [[[[1, 'a']], [[None]]]]]), [[None]])
    check('duplicate rows', solve([[[1, 'a', 0]], [[[[1, 'a']], [[1], [1]]]]]), [[1], [1]])
    check('no batches', solve([[[1, 'a', 0]], []]), [])
    check('zero preserved', solve([[[1, 'a', 1]], [[[[1, 'a']], [[0]]]]]), [[0]])
elif N == 2:
    check('renamed field', solve([[[2, 'new', 99], [1, 'a', 88]], [[[[1, 'a'], [2, 'old']], [[2, 3]]]]]), [[3, 2]])
    check('reordered batch', solve([[[1, 'a', 0], [2, 'b', 0]], [[[[1, 'a'], [2, 'b']], [[2, 3]]], [[[2, 'b'], [1, 'a']], [[4, 5]]]]]), [[2, 3], [5, 4]])
    check('absent default', solve([[[1, 'a', 7], [2, 'b', 2]], [[[[1, 'a']], [[3]]]]]), [[3, 2]])
    check('explicit null', solve([[[1, 'a', 2]], [[[[1, 'a']], [[None]]]]]), [[None]])
    check('duplicate rows', solve([[[1, 'a', 0]], [[[[1, 'a']], [[2], [2]]]]]), [[2], [2]])
    check('no batches', solve([[[1, 'a', 0]], []]), [])
    check('zero preserved', solve([[[1, 'a', 2]], [[[[1, 'a']], [[0]]]]]), [[0]])
elif N == 3:
    check('renamed field', solve([[[2, 'new', 99], [1, 'a', 88]], [[[[1, 'a'], [2, 'old']], [[3, 4]]]]]), [[4, 3]])
    check('reordered batch', solve([[[1, 'a', 0], [2, 'b', 0]], [[[[1, 'a'], [2, 'b']], [[3, 4]]], [[[2, 'b'], [1, 'a']], [[5, 6]]]]]), [[3, 4], [6, 5]])
    check('absent default', solve([[[1, 'a', 7], [2, 'b', 3]], [[[[1, 'a']], [[4]]]]]), [[4, 3]])
    check('explicit null', solve([[[1, 'a', 3]], [[[[1, 'a']], [[None]]]]]), [[None]])
    check('duplicate rows', solve([[[1, 'a', 0]], [[[[1, 'a']], [[3], [3]]]]]), [[3], [3]])
    check('no batches', solve([[[1, 'a', 0]], []]), [])
    check('zero preserved', solve([[[1, 'a', 3]], [[[[1, 'a']], [[0]]]]]), [[0]])
elif N == 4:
    check('renamed field', solve([[[2, 'new', 99], [1, 'a', 88]], [[[[1, 'a'], [2, 'old']], [[4, 5]]]]]), [[5, 4]])
    check('reordered batch', solve([[[1, 'a', 0], [2, 'b', 0]], [[[[1, 'a'], [2, 'b']], [[4, 5]]], [[[2, 'b'], [1, 'a']], [[6, 7]]]]]), [[4, 5], [7, 6]])
    check('absent default', solve([[[1, 'a', 7], [2, 'b', 4]], [[[[1, 'a']], [[5]]]]]), [[5, 4]])
    check('explicit null', solve([[[1, 'a', 4]], [[[[1, 'a']], [[None]]]]]), [[None]])
    check('duplicate rows', solve([[[1, 'a', 0]], [[[[1, 'a']], [[4], [4]]]]]), [[4], [4]])
    check('no batches', solve([[[1, 'a', 0]], []]), [])
    check('zero preserved', solve([[[1, 'a', 4]], [[[[1, 'a']], [[0]]]]]), [[0]])
elif N == 5:
    check('renamed field', solve([[[2, 'new', 99], [1, 'a', 88]], [[[[1, 'a'], [2, 'old']], [[5, 6]]]]]), [[6, 5]])
    check('reordered batch', solve([[[1, 'a', 0], [2, 'b', 0]], [[[[1, 'a'], [2, 'b']], [[5, 6]]], [[[2, 'b'], [1, 'a']], [[7, 8]]]]]), [[5, 6], [8, 7]])
    check('absent default', solve([[[1, 'a', 7], [2, 'b', 5]], [[[[1, 'a']], [[6]]]]]), [[6, 5]])
    check('explicit null', solve([[[1, 'a', 5]], [[[[1, 'a']], [[None]]]]]), [[None]])
    check('duplicate rows', solve([[[1, 'a', 0]], [[[[1, 'a']], [[5], [5]]]]]), [[5], [5]])
    check('no batches', solve([[[1, 'a', 0]], []]), [])
    check('zero preserved', solve([[[1, 'a', 5]], [[[[1, 'a']], [[0]]]]]), [[0]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

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

N = 1
observations = []
def solve(d):
    try:
        output,batches=d
        result=[]
        for schema,rows in batches:
            columns={field:index for index,(field,name) in enumerate(schema)}
            for row in rows:
                record=[]
                for field,name,default in output:
                    value=row[columns[field]] if field in columns else 0
                    record.append(value)
                result.append(record)
        return result
    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('renamed field', solve([[[2, 'new', 99], [1, 'a', 88]], [[[[1, 'a'], [2, 'old']], [[1, 2]]]]]), [[2, 1]])
    check('reordered batch', solve([[[1, 'a', 0], [2, 'b', 0]], [[[[1, 'a'], [2, 'b']], [[1, 2]]], [[[2, 'b'], [1, 'a']], [[3, 4]]]]]), [[1, 2], [4, 3]])
    check('absent default', solve([[[1, 'a', 7], [2, 'b', 1]], [[[[1, 'a']], [[2]]]]]), [[2, 1]])
    check('explicit null', solve([[[1, 'a', 1]], [[[[1, 'a']], [[None]]]]]), [[None]])
    check('duplicate rows', solve([[[1, 'a', 0]], [[[[1, 'a']], [[1], [1]]]]]), [[1], [1]])
    check('no batches', solve([[[1, 'a', 0]], []]), [])
    check('zero preserved', solve([[[1, 'a', 1]], [[[[1, 'a']], [[0]]]]]), [[0]])
elif N == 2:
    check('renamed field', solve([[[2, 'new', 99], [1, 'a', 88]], [[[[1, 'a'], [2, 'old']], [[2, 3]]]]]), [[3, 2]])
    check('reordered batch', solve([[[1, 'a', 0], [2, 'b', 0]], [[[[1, 'a'], [2, 'b']], [[2, 3]]], [[[2, 'b'], [1, 'a']], [[4, 5]]]]]), [[2, 3], [5, 4]])
    check('absent default', solve([[[1, 'a', 7], [2, 'b', 2]], [[[[1, 'a']], [[3]]]]]), [[3, 2]])
    check('explicit null', solve([[[1, 'a', 2]], [[[[1, 'a']], [[None]]]]]), [[None]])
    check('duplicate rows', solve([[[1, 'a', 0]], [[[[1, 'a']], [[2], [2]]]]]), [[2], [2]])
    check('no batches', solve([[[1, 'a', 0]], []]), [])
    check('zero preserved', solve([[[1, 'a', 2]], [[[[1, 'a']], [[0]]]]]), [[0]])
elif N == 3:
    check('renamed field', solve([[[2, 'new', 99], [1, 'a', 88]], [[[[1, 'a'], [2, 'old']], [[3, 4]]]]]), [[4, 3]])
    check('reordered batch', solve([[[1, 'a', 0], [2, 'b', 0]], [[[[1, 'a'], [2, 'b']], [[3, 4]]], [[[2, 'b'], [1, 'a']], [[5, 6]]]]]), [[3, 4], [6, 5]])
    check('absent default', solve([[[1, 'a', 7], [2, 'b', 3]], [[[[1, 'a']], [[4]]]]]), [[4, 3]])
    check('explicit null', solve([[[1, 'a', 3]], [[[[1, 'a']], [[None]]]]]), [[None]])
    check('duplicate rows', solve([[[1, 'a', 0]], [[[[1, 'a']], [[3], [3]]]]]), [[3], [3]])
    check('no batches', solve([[[1, 'a', 0]], []]), [])
    check('zero preserved', solve([[[1, 'a', 3]], [[[[1, 'a']], [[0]]]]]), [[0]])
elif N == 4:
    check('renamed field', solve([[[2, 'new', 99], [1, 'a', 88]], [[[[1, 'a'], [2, 'old']], [[4, 5]]]]]), [[5, 4]])
    check('reordered batch', solve([[[1, 'a', 0], [2, 'b', 0]], [[[[1, 'a'], [2, 'b']], [[4, 5]]], [[[2, 'b'], [1, 'a']], [[6, 7]]]]]), [[4, 5], [7, 6]])
    check('absent default', solve([[[1, 'a', 7], [2, 'b', 4]], [[[[1, 'a']], [[5]]]]]), [[5, 4]])
    check('explicit null', solve([[[1, 'a', 4]], [[[[1, 'a']], [[None]]]]]), [[None]])
    check('duplicate rows', solve([[[1, 'a', 0]], [[[[1, 'a']], [[4], [4]]]]]), [[4], [4]])
    check('no batches', solve([[[1, 'a', 0]], []]), [])
    check('zero preserved', solve([[[1, 'a', 4]], [[[[1, 'a']], [[0]]]]]), [[0]])
elif N == 5:
    check('renamed field', solve([[[2, 'new', 99], [1, 'a', 88]], [[[[1, 'a'], [2, 'old']], [[5, 6]]]]]), [[6, 5]])
    check('reordered batch', solve([[[1, 'a', 0], [2, 'b', 0]], [[[[1, 'a'], [2, 'b']], [[5, 6]]], [[[2, 'b'], [1, 'a']], [[7, 8]]]]]), [[5, 6], [8, 7]])
    check('absent default', solve([[[1, 'a', 7], [2, 'b', 5]], [[[[1, 'a']], [[6]]]]]), [[6, 5]])
    check('explicit null', solve([[[1, 'a', 5]], [[[[1, 'a']], [[None]]]]]), [[None]])
    check('duplicate rows', solve([[[1, 'a', 0]], [[[[1, 'a']], [[5], [5]]]]]), [[5], [5]])
    check('no batches', solve([[[1, 'a', 0]], []]), [])
    check('zero preserved', solve([[[1, 'a', 5]], [[[[1, 'a']], [[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:
Schema union ignores non-null defaults for missing columns.

Union batches using stable numeric field identities. The output schema is an ordered list [id,current_name,default]; batch schemas map old names to IDs. Project each batch row into output order, use defaults only for absent columns, and preserve explicit nulls and all rows.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        output,batches=d
        result=[]
        for schema,rows in batches:
            columns={field:index for index,(field,name) in enumerate(schema)}
            for row in rows:
                record=[]
                for field,name,default in output:
                    value=row[columns[field]] if field in columns else default
                    record.append(value)
                result.append(record)
        return [r for i,r in enumerate(result) if r not in result[:i]]
    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('renamed field', solve([[[2, 'new', 99], [1, 'a', 88]], [[[[1, 'a'], [2, 'old']], [[1, 2]]]]]), [[2, 1]])
    check('reordered batch', solve([[[1, 'a', 0], [2, 'b', 0]], [[[[1, 'a'], [2, 'b']], [[1, 2]]], [[[2, 'b'], [1, 'a']], [[3, 4]]]]]), [[1, 2], [4, 3]])
    check('absent default', solve([[[1, 'a', 7], [2, 'b', 1]], [[[[1, 'a']], [[2]]]]]), [[2, 1]])
    check('explicit null', solve([[[1, 'a', 1]], [[[[1, 'a']], [[None]]]]]), [[None]])
    check('duplicate rows', solve([[[1, 'a', 0]], [[[[1, 'a']], [[1], [1]]]]]), [[1], [1]])
    check('no batches', solve([[[1, 'a', 0]], []]), [])
    check('zero preserved', solve([[[1, 'a', 1]], [[[[1, 'a']], [[0]]]]]), [[0]])
elif N == 2:
    check('renamed field', solve([[[2, 'new', 99], [1, 'a', 88]], [[[[1, 'a'], [2, 'old']], [[2, 3]]]]]), [[3, 2]])
    check('reordered batch', solve([[[1, 'a', 0], [2, 'b', 0]], [[[[1, 'a'], [2, 'b']], [[2, 3]]], [[[2, 'b'], [1, 'a']], [[4, 5]]]]]), [[2, 3], [5, 4]])
    check('absent default', solve([[[1, 'a', 7], [2, 'b', 2]], [[[[1, 'a']], [[3]]]]]), [[3, 2]])
    check('explicit null', solve([[[1, 'a', 2]], [[[[1, 'a']], [[None]]]]]), [[None]])
    check('duplicate rows', solve([[[1, 'a', 0]], [[[[1, 'a']], [[2], [2]]]]]), [[2], [2]])
    check('no batches', solve([[[1, 'a', 0]], []]), [])
    check('zero preserved', solve([[[1, 'a', 2]], [[[[1, 'a']], [[0]]]]]), [[0]])
elif N == 3:
    check('renamed field', solve([[[2, 'new', 99], [1, 'a', 88]], [[[[1, 'a'], [2, 'old']], [[3, 4]]]]]), [[4, 3]])
    check('reordered batch', solve([[[1, 'a', 0], [2, 'b', 0]], [[[[1, 'a'], [2, 'b']], [[3, 4]]], [[[2, 'b'], [1, 'a']], [[5, 6]]]]]), [[3, 4], [6, 5]])
    check('absent default', solve([[[1, 'a', 7], [2, 'b', 3]], [[[[1, 'a']], [[4]]]]]), [[4, 3]])
    check('explicit null', solve([[[1, 'a', 3]], [[[[1, 'a']], [[None]]]]]), [[None]])
    check('duplicate rows', solve([[[1, 'a', 0]], [[[[1, 'a']], [[3], [3]]]]]), [[3], [3]])
    check('no batches', solve([[[1, 'a', 0]], []]), [])
    check('zero preserved', solve([[[1, 'a', 3]], [[[[1, 'a']], [[0]]]]]), [[0]])
elif N == 4:
    check('renamed field', solve([[[2, 'new', 99], [1, 'a', 88]], [[[[1, 'a'], [2, 'old']], [[4, 5]]]]]), [[5, 4]])
    check('reordered batch', solve([[[1, 'a', 0], [2, 'b', 0]], [[[[1, 'a'], [2, 'b']], [[4, 5]]], [[[2, 'b'], [1, 'a']], [[6, 7]]]]]), [[4, 5], [7, 6]])
    check('absent default', solve([[[1, 'a', 7], [2, 'b', 4]], [[[[1, 'a']], [[5]]]]]), [[5, 4]])
    check('explicit null', solve([[[1, 'a', 4]], [[[[1, 'a']], [[None]]]]]), [[None]])
    check('duplicate rows', solve([[[1, 'a', 0]], [[[[1, 'a']], [[4], [4]]]]]), [[4], [4]])
    check('no batches', solve([[[1, 'a', 0]], []]), [])
    check('zero preserved', solve([[[1, 'a', 4]], [[[[1, 'a']], [[0]]]]]), [[0]])
elif N == 5:
    check('renamed field', solve([[[2, 'new', 99], [1, 'a', 88]], [[[[1, 'a'], [2, 'old']], [[5, 6]]]]]), [[6, 5]])
    check('reordered batch', solve([[[1, 'a', 0], [2, 'b', 0]], [[[[1, 'a'], [2, 'b']], [[5, 6]]], [[[2, 'b'], [1, 'a']], [[7, 8]]]]]), [[5, 6], [8, 7]])
    check('absent default', solve([[[1, 'a', 7], [2, 'b', 5]], [[[[1, 'a']], [[6]]]]]), [[6, 5]])
    check('explicit null', solve([[[1, 'a', 5]], [[[[1, 'a']], [[None]]]]]), [[None]])
    check('duplicate rows', solve([[[1, 'a', 0]], [[[[1, 'a']], [[5], [5]]]]]), [[5], [5]])
    check('no batches', solve([[[1, 'a', 0]], []]), [])
    check('zero preserved', solve([[[1, 'a', 5]], [[[[1, 'a']], [[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:
        output,batches=d
        result=[]
        for schema,rows in batches:
            columns={field:index for index,(field,name) in enumerate(schema)}
            for row in rows:
                record=[]
                for field,name,default in output:
                    value=row[columns[field]] if field in columns else default
                    record.append(value)
                result.append(record)
        return [r for i,r in enumerate(result) if i==0 or r!=result[i-1]]
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('renamed field', solve([[[2, 'new', 99], [1, 'a', 88]], [[[[1, 'a'], [2, 'old']], [[1, 2]]]]]), [[2, 1]])
    check('reordered batch', solve([[[1, 'a', 0], [2, 'b', 0]], [[[[1, 'a'], [2, 'b']], [[1, 2]]], [[[2, 'b'], [1, 'a']], [[3, 4]]]]]), [[1, 2], [4, 3]])
    check('absent default', solve([[[1, 'a', 7], [2, 'b', 1]], [[[[1, 'a']], [[2]]]]]), [[2, 1]])
    check('explicit null', solve([[[1, 'a', 1]], [[[[1, 'a']], [[None]]]]]), [[None]])
    check('duplicate rows', solve([[[1, 'a', 0]], [[[[1, 'a']], [[1], [1]]]]]), [[1], [1]])
    check('no batches', solve([[[1, 'a', 0]], []]), [])
    check('zero preserved', solve([[[1, 'a', 1]], [[[[1, 'a']], [[0]]]]]), [[0]])
elif N == 2:
    check('renamed field', solve([[[2, 'new', 99], [1, 'a', 88]], [[[[1, 'a'], [2, 'old']], [[2, 3]]]]]), [[3, 2]])
    check('reordered batch', solve([[[1, 'a', 0], [2, 'b', 0]], [[[[1, 'a'], [2, 'b']], [[2, 3]]], [[[2, 'b'], [1, 'a']], [[4, 5]]]]]), [[2, 3], [5, 4]])
    check('absent default', solve([[[1, 'a', 7], [2, 'b', 2]], [[[[1, 'a']], [[3]]]]]), [[3, 2]])
    check('explicit null', solve([[[1, 'a', 2]], [[[[1, 'a']], [[None]]]]]), [[None]])
    check('duplicate rows', solve([[[1, 'a', 0]], [[[[1, 'a']], [[2], [2]]]]]), [[2], [2]])
    check('no batches', solve([[[1, 'a', 0]], []]), [])
    check('zero preserved', solve([[[1, 'a', 2]], [[[[1, 'a']], [[0]]]]]), [[0]])
elif N == 3:
    check('renamed field', solve([[[2, 'new', 99], [1, 'a', 88]], [[[[1, 'a'], [2, 'old']], [[3, 4]]]]]), [[4, 3]])
    check('reordered batch', solve([[[1, 'a', 0], [2, 'b', 0]], [[[[1, 'a'], [2, 'b']], [[3, 4]]], [[[2, 'b'], [1, 'a']], [[5, 6]]]]]), [[3, 4], [6, 5]])
    check('absent default', solve([[[1, 'a', 7], [2, 'b', 3]], [[[[1, 'a']], [[4]]]]]), [[4, 3]])
    check('explicit null', solve([[[1, 'a', 3]], [[[[1, 'a']], [[None]]]]]), [[None]])
    check('duplicate rows', solve([[[1, 'a', 0]], [[[[1, 'a']], [[3], [3]]]]]), [[3], [3]])
    check('no batches', solve([[[1, 'a', 0]], []]), [])
    check('zero preserved', solve([[[1, 'a', 3]], [[[[1, 'a']], [[0]]]]]), [[0]])
elif N == 4:
    check('renamed field', solve([[[2, 'new', 99], [1, 'a', 88]], [[[[1, 'a'], [2, 'old']], [[4, 5]]]]]), [[5, 4]])
    check('reordered batch', solve([[[1, 'a', 0], [2, 'b', 0]], [[[[1, 'a'], [2, 'b']], [[4, 5]]], [[[2, 'b'], [1, 'a']], [[6, 7]]]]]), [[4, 5], [7, 6]])
    check('absent default', solve([[[1, 'a', 7], [2, 'b', 4]], [[[[1, 'a']], [[5]]]]]), [[5, 4]])
    check('explicit null', solve([[[1, 'a', 4]], [[[[1, 'a']], [[None]]]]]), [[None]])
    check('duplicate rows', solve([[[1, 'a', 0]], [[[[1, 'a']], [[4], [4]]]]]), [[4], [4]])
    check('no batches', solve([[[1, 'a', 0]], []]), [])
    check('zero preserved', solve([[[1, 'a', 4]], [[[[1, 'a']], [[0]]]]]), [[0]])
elif N == 5:
    check('renamed field', solve([[[2, 'new', 99], [1, 'a', 88]], [[[[1, 'a'], [2, 'old']], [[5, 6]]]]]), [[6, 5]])
    check('reordered batch', solve([[[1, 'a', 0], [2, 'b', 0]], [[[[1, 'a'], [2, 'b']], [[5, 6]]], [[[2, 'b'], [1, 'a']], [[7, 8]]]]]), [[5, 6], [8, 7]])
    check('absent default', solve([[[1, 'a', 7], [2, 'b', 5]], [[[[1, 'a']], [[6]]]]]), [[6, 5]])
    check('explicit null', solve([[[1, 'a', 5]], [[[[1, 'a']], [[None]]]]]), [[None]])
    check('duplicate rows', solve([[[1, 'a', 0]], [[[[1, 'a']], [[5], [5]]]]]), [[5], [5]])
    check('no batches', solve([[[1, 'a', 0]], []]), [])
    check('zero preserved', solve([[[1, 'a', 5]], [[[[1, 'a']], [[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:
Schema union deduplicates equal projected rows.

Union batches using stable numeric field identities. The output schema is an ordered list [id,current_name,default]; batch schemas map old names to IDs. Project each batch row into output order, use defaults only for absent columns, and preserve explicit nulls and all rows.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        rows,projection=d
        out=[]
        for source in rows:
            record=[]
            env=source.copy()
            for alias,name in projection:
                value=env.get(name)
                record.append([alias,value]); env[alias]=value
            out.append(record)
        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('shadowed input', solve([[{'a': 1, 'b': 2}], [['b', 'a'], ['c', 'b']]]), [[['b', 1], ['c', 2]]])
    check('new alias not input', solve([[{'a': 1}], [['x', 'a'], ['y', 'x']]]), [[['x', 1], ['y', None]]])
    check('repeated label', solve([[{'a': 1, 'b': 2}], [['x', 'a'], ['x', 'b']]]), [[['x', 1], ['x', 2]]])
    check('multiple rows', solve([[{'a': 1}, {'a': 2}], [['z', 'a']]]), [[['z', 1]], [['z', 2]]])
    check('missing with alias present', solve([[{'x': 1}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 1}, {'a': 2}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 2:
    check('shadowed input', solve([[{'a': 2, 'b': 3}], [['b', 'a'], ['c', 'b']]]), [[['b', 2], ['c', 3]]])
    check('new alias not input', solve([[{'a': 2}], [['x', 'a'], ['y', 'x']]]), [[['x', 2], ['y', None]]])
    check('repeated label', solve([[{'a': 2, 'b': 3}], [['x', 'a'], ['x', 'b']]]), [[['x', 2], ['x', 3]]])
    check('multiple rows', solve([[{'a': 2}, {'a': 3}], [['z', 'a']]]), [[['z', 2]], [['z', 3]]])
    check('missing with alias present', solve([[{'x': 2}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 2}, {'a': 3}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 3:
    check('shadowed input', solve([[{'a': 3, 'b': 4}], [['b', 'a'], ['c', 'b']]]), [[['b', 3], ['c', 4]]])
    check('new alias not input', solve([[{'a': 3}], [['x', 'a'], ['y', 'x']]]), [[['x', 3], ['y', None]]])
    check('repeated label', solve([[{'a': 3, 'b': 4}], [['x', 'a'], ['x', 'b']]]), [[['x', 3], ['x', 4]]])
    check('multiple rows', solve([[{'a': 3}, {'a': 4}], [['z', 'a']]]), [[['z', 3]], [['z', 4]]])
    check('missing with alias present', solve([[{'x': 3}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 3}, {'a': 4}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 4:
    check('shadowed input', solve([[{'a': 4, 'b': 5}], [['b', 'a'], ['c', 'b']]]), [[['b', 4], ['c', 5]]])
    check('new alias not input', solve([[{'a': 4}], [['x', 'a'], ['y', 'x']]]), [[['x', 4], ['y', None]]])
    check('repeated label', solve([[{'a': 4, 'b': 5}], [['x', 'a'], ['x', 'b']]]), [[['x', 4], ['x', 5]]])
    check('multiple rows', solve([[{'a': 4}, {'a': 5}], [['z', 'a']]]), [[['z', 4]], [['z', 5]]])
    check('missing with alias present', solve([[{'x': 4}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 4}, {'a': 5}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 5:
    check('shadowed input', solve([[{'a': 5, 'b': 6}], [['b', 'a'], ['c', 'b']]]), [[['b', 5], ['c', 6]]])
    check('new alias not input', solve([[{'a': 5}], [['x', 'a'], ['y', 'x']]]), [[['x', 5], ['y', None]]])
    check('repeated label', solve([[{'a': 5, 'b': 6}], [['x', 'a'], ['x', 'b']]]), [[['x', 5], ['x', 6]]])
    check('multiple rows', solve([[{'a': 5}, {'a': 6}], [['z', 'a']]]), [[['z', 5]], [['z', 6]]])
    check('missing with alias present', solve([[{'x': 5}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 5}, {'a': 6}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
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:
        rows,projection=d
        out=[]
        for source in rows:
            record=[]
            env=source.copy()
            for alias,name in projection:
                value=env.get(name)
                record.append([alias,value]); env.setdefault(alias,value)
            out.append(record)
        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('shadowed input', solve([[{'a': 1, 'b': 2}], [['b', 'a'], ['c', 'b']]]), [[['b', 1], ['c', 2]]])
    check('new alias not input', solve([[{'a': 1}], [['x', 'a'], ['y', 'x']]]), [[['x', 1], ['y', None]]])
    check('repeated label', solve([[{'a': 1, 'b': 2}], [['x', 'a'], ['x', 'b']]]), [[['x', 1], ['x', 2]]])
    check('multiple rows', solve([[{'a': 1}, {'a': 2}], [['z', 'a']]]), [[['z', 1]], [['z', 2]]])
    check('missing with alias present', solve([[{'x': 1}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 1}, {'a': 2}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 2:
    check('shadowed input', solve([[{'a': 2, 'b': 3}], [['b', 'a'], ['c', 'b']]]), [[['b', 2], ['c', 3]]])
    check('new alias not input', solve([[{'a': 2}], [['x', 'a'], ['y', 'x']]]), [[['x', 2], ['y', None]]])
    check('repeated label', solve([[{'a': 2, 'b': 3}], [['x', 'a'], ['x', 'b']]]), [[['x', 2], ['x', 3]]])
    check('multiple rows', solve([[{'a': 2}, {'a': 3}], [['z', 'a']]]), [[['z', 2]], [['z', 3]]])
    check('missing with alias present', solve([[{'x': 2}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 2}, {'a': 3}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 3:
    check('shadowed input', solve([[{'a': 3, 'b': 4}], [['b', 'a'], ['c', 'b']]]), [[['b', 3], ['c', 4]]])
    check('new alias not input', solve([[{'a': 3}], [['x', 'a'], ['y', 'x']]]), [[['x', 3], ['y', None]]])
    check('repeated label', solve([[{'a': 3, 'b': 4}], [['x', 'a'], ['x', 'b']]]), [[['x', 3], ['x', 4]]])
    check('multiple rows', solve([[{'a': 3}, {'a': 4}], [['z', 'a']]]), [[['z', 3]], [['z', 4]]])
    check('missing with alias present', solve([[{'x': 3}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 3}, {'a': 4}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 4:
    check('shadowed input', solve([[{'a': 4, 'b': 5}], [['b', 'a'], ['c', 'b']]]), [[['b', 4], ['c', 5]]])
    check('new alias not input', solve([[{'a': 4}], [['x', 'a'], ['y', 'x']]]), [[['x', 4], ['y', None]]])
    check('repeated label', solve([[{'a': 4, 'b': 5}], [['x', 'a'], ['x', 'b']]]), [[['x', 4], ['x', 5]]])
    check('multiple rows', solve([[{'a': 4}, {'a': 5}], [['z', 'a']]]), [[['z', 4]], [['z', 5]]])
    check('missing with alias present', solve([[{'x': 4}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 4}, {'a': 5}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 5:
    check('shadowed input', solve([[{'a': 5, 'b': 6}], [['b', 'a'], ['c', 'b']]]), [[['b', 5], ['c', 6]]])
    check('new alias not input', solve([[{'a': 5}], [['x', 'a'], ['y', 'x']]]), [[['x', 5], ['y', None]]])
    check('repeated label', solve([[{'a': 5, 'b': 6}], [['x', 'a'], ['x', 'b']]]), [[['x', 5], ['x', 6]]])
    check('multiple rows', solve([[{'a': 5}, {'a': 6}], [['z', 'a']]]), [[['z', 5]], [['z', 6]]])
    check('missing with alias present', solve([[{'x': 5}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 5}, {'a': 6}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
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:
Projection aliases overwrite the input name environment.

Evaluate ordered projection [output-name,input-name] pairs against each immutable input record, not earlier output aliases. Missing inputs yield None. Repeated output names occupy distinct result columns, and empty projections retain one empty result per input row.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        rows,projection=d
        out=[]
        for source in rows:
            record=[]
            env=source.copy()
            for alias,name in projection:
                value=env.get(alias)
                record.append([alias,value])
            out.append(record)
        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('shadowed input', solve([[{'a': 1, 'b': 2}], [['b', 'a'], ['c', 'b']]]), [[['b', 1], ['c', 2]]])
    check('new alias not input', solve([[{'a': 1}], [['x', 'a'], ['y', 'x']]]), [[['x', 1], ['y', None]]])
    check('repeated label', solve([[{'a': 1, 'b': 2}], [['x', 'a'], ['x', 'b']]]), [[['x', 1], ['x', 2]]])
    check('multiple rows', solve([[{'a': 1}, {'a': 2}], [['z', 'a']]]), [[['z', 1]], [['z', 2]]])
    check('missing with alias present', solve([[{'x': 1}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 1}, {'a': 2}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 2:
    check('shadowed input', solve([[{'a': 2, 'b': 3}], [['b', 'a'], ['c', 'b']]]), [[['b', 2], ['c', 3]]])
    check('new alias not input', solve([[{'a': 2}], [['x', 'a'], ['y', 'x']]]), [[['x', 2], ['y', None]]])
    check('repeated label', solve([[{'a': 2, 'b': 3}], [['x', 'a'], ['x', 'b']]]), [[['x', 2], ['x', 3]]])
    check('multiple rows', solve([[{'a': 2}, {'a': 3}], [['z', 'a']]]), [[['z', 2]], [['z', 3]]])
    check('missing with alias present', solve([[{'x': 2}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 2}, {'a': 3}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 3:
    check('shadowed input', solve([[{'a': 3, 'b': 4}], [['b', 'a'], ['c', 'b']]]), [[['b', 3], ['c', 4]]])
    check('new alias not input', solve([[{'a': 3}], [['x', 'a'], ['y', 'x']]]), [[['x', 3], ['y', None]]])
    check('repeated label', solve([[{'a': 3, 'b': 4}], [['x', 'a'], ['x', 'b']]]), [[['x', 3], ['x', 4]]])
    check('multiple rows', solve([[{'a': 3}, {'a': 4}], [['z', 'a']]]), [[['z', 3]], [['z', 4]]])
    check('missing with alias present', solve([[{'x': 3}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 3}, {'a': 4}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 4:
    check('shadowed input', solve([[{'a': 4, 'b': 5}], [['b', 'a'], ['c', 'b']]]), [[['b', 4], ['c', 5]]])
    check('new alias not input', solve([[{'a': 4}], [['x', 'a'], ['y', 'x']]]), [[['x', 4], ['y', None]]])
    check('repeated label', solve([[{'a': 4, 'b': 5}], [['x', 'a'], ['x', 'b']]]), [[['x', 4], ['x', 5]]])
    check('multiple rows', solve([[{'a': 4}, {'a': 5}], [['z', 'a']]]), [[['z', 4]], [['z', 5]]])
    check('missing with alias present', solve([[{'x': 4}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 4}, {'a': 5}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 5:
    check('shadowed input', solve([[{'a': 5, 'b': 6}], [['b', 'a'], ['c', 'b']]]), [[['b', 5], ['c', 6]]])
    check('new alias not input', solve([[{'a': 5}], [['x', 'a'], ['y', 'x']]]), [[['x', 5], ['y', None]]])
    check('repeated label', solve([[{'a': 5, 'b': 6}], [['x', 'a'], ['x', 'b']]]), [[['x', 5], ['x', 6]]])
    check('multiple rows', solve([[{'a': 5}, {'a': 6}], [['z', 'a']]]), [[['z', 5]], [['z', 6]]])
    check('missing with alias present', solve([[{'x': 5}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 5}, {'a': 6}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
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:
        rows,projection=d
        out=[]
        for source in rows:
            record=[]
            env=source.copy()
            for alias,name in projection:
                value=env.get(name,env.get(alias))
                record.append([alias,value])
            out.append(record)
        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('shadowed input', solve([[{'a': 1, 'b': 2}], [['b', 'a'], ['c', 'b']]]), [[['b', 1], ['c', 2]]])
    check('new alias not input', solve([[{'a': 1}], [['x', 'a'], ['y', 'x']]]), [[['x', 1], ['y', None]]])
    check('repeated label', solve([[{'a': 1, 'b': 2}], [['x', 'a'], ['x', 'b']]]), [[['x', 1], ['x', 2]]])
    check('multiple rows', solve([[{'a': 1}, {'a': 2}], [['z', 'a']]]), [[['z', 1]], [['z', 2]]])
    check('missing with alias present', solve([[{'x': 1}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 1}, {'a': 2}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 2:
    check('shadowed input', solve([[{'a': 2, 'b': 3}], [['b', 'a'], ['c', 'b']]]), [[['b', 2], ['c', 3]]])
    check('new alias not input', solve([[{'a': 2}], [['x', 'a'], ['y', 'x']]]), [[['x', 2], ['y', None]]])
    check('repeated label', solve([[{'a': 2, 'b': 3}], [['x', 'a'], ['x', 'b']]]), [[['x', 2], ['x', 3]]])
    check('multiple rows', solve([[{'a': 2}, {'a': 3}], [['z', 'a']]]), [[['z', 2]], [['z', 3]]])
    check('missing with alias present', solve([[{'x': 2}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 2}, {'a': 3}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 3:
    check('shadowed input', solve([[{'a': 3, 'b': 4}], [['b', 'a'], ['c', 'b']]]), [[['b', 3], ['c', 4]]])
    check('new alias not input', solve([[{'a': 3}], [['x', 'a'], ['y', 'x']]]), [[['x', 3], ['y', None]]])
    check('repeated label', solve([[{'a': 3, 'b': 4}], [['x', 'a'], ['x', 'b']]]), [[['x', 3], ['x', 4]]])
    check('multiple rows', solve([[{'a': 3}, {'a': 4}], [['z', 'a']]]), [[['z', 3]], [['z', 4]]])
    check('missing with alias present', solve([[{'x': 3}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 3}, {'a': 4}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 4:
    check('shadowed input', solve([[{'a': 4, 'b': 5}], [['b', 'a'], ['c', 'b']]]), [[['b', 4], ['c', 5]]])
    check('new alias not input', solve([[{'a': 4}], [['x', 'a'], ['y', 'x']]]), [[['x', 4], ['y', None]]])
    check('repeated label', solve([[{'a': 4, 'b': 5}], [['x', 'a'], ['x', 'b']]]), [[['x', 4], ['x', 5]]])
    check('multiple rows', solve([[{'a': 4}, {'a': 5}], [['z', 'a']]]), [[['z', 4]], [['z', 5]]])
    check('missing with alias present', solve([[{'x': 4}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 4}, {'a': 5}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 5:
    check('shadowed input', solve([[{'a': 5, 'b': 6}], [['b', 'a'], ['c', 'b']]]), [[['b', 5], ['c', 6]]])
    check('new alias not input', solve([[{'a': 5}], [['x', 'a'], ['y', 'x']]]), [[['x', 5], ['y', None]]])
    check('repeated label', solve([[{'a': 5, 'b': 6}], [['x', 'a'], ['x', 'b']]]), [[['x', 5], ['x', 6]]])
    check('multiple rows', solve([[{'a': 5}, {'a': 6}], [['z', 'a']]]), [[['z', 5]], [['z', 6]]])
    check('missing with alias present', solve([[{'x': 5}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 5}, {'a': 6}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
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:
Projection reads the alias rather than the input field.

Evaluate ordered projection [output-name,input-name] pairs against each immutable input record, not earlier output aliases. Missing inputs yield None. Repeated output names occupy distinct result columns, and empty projections retain one empty result per input row.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        rows,projection=d
        out=[]
        for source in rows:
            record=[]
            env=source.copy()
            for alias,name in dict(projection).items():
                value=env.get(name)
                record.append([alias,value])
            out.append(record)
        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('shadowed input', solve([[{'a': 1, 'b': 2}], [['b', 'a'], ['c', 'b']]]), [[['b', 1], ['c', 2]]])
    check('new alias not input', solve([[{'a': 1}], [['x', 'a'], ['y', 'x']]]), [[['x', 1], ['y', None]]])
    check('repeated label', solve([[{'a': 1, 'b': 2}], [['x', 'a'], ['x', 'b']]]), [[['x', 1], ['x', 2]]])
    check('multiple rows', solve([[{'a': 1}, {'a': 2}], [['z', 'a']]]), [[['z', 1]], [['z', 2]]])
    check('missing with alias present', solve([[{'x': 1}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 1}, {'a': 2}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 2:
    check('shadowed input', solve([[{'a': 2, 'b': 3}], [['b', 'a'], ['c', 'b']]]), [[['b', 2], ['c', 3]]])
    check('new alias not input', solve([[{'a': 2}], [['x', 'a'], ['y', 'x']]]), [[['x', 2], ['y', None]]])
    check('repeated label', solve([[{'a': 2, 'b': 3}], [['x', 'a'], ['x', 'b']]]), [[['x', 2], ['x', 3]]])
    check('multiple rows', solve([[{'a': 2}, {'a': 3}], [['z', 'a']]]), [[['z', 2]], [['z', 3]]])
    check('missing with alias present', solve([[{'x': 2}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 2}, {'a': 3}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 3:
    check('shadowed input', solve([[{'a': 3, 'b': 4}], [['b', 'a'], ['c', 'b']]]), [[['b', 3], ['c', 4]]])
    check('new alias not input', solve([[{'a': 3}], [['x', 'a'], ['y', 'x']]]), [[['x', 3], ['y', None]]])
    check('repeated label', solve([[{'a': 3, 'b': 4}], [['x', 'a'], ['x', 'b']]]), [[['x', 3], ['x', 4]]])
    check('multiple rows', solve([[{'a': 3}, {'a': 4}], [['z', 'a']]]), [[['z', 3]], [['z', 4]]])
    check('missing with alias present', solve([[{'x': 3}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 3}, {'a': 4}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 4:
    check('shadowed input', solve([[{'a': 4, 'b': 5}], [['b', 'a'], ['c', 'b']]]), [[['b', 4], ['c', 5]]])
    check('new alias not input', solve([[{'a': 4}], [['x', 'a'], ['y', 'x']]]), [[['x', 4], ['y', None]]])
    check('repeated label', solve([[{'a': 4, 'b': 5}], [['x', 'a'], ['x', 'b']]]), [[['x', 4], ['x', 5]]])
    check('multiple rows', solve([[{'a': 4}, {'a': 5}], [['z', 'a']]]), [[['z', 4]], [['z', 5]]])
    check('missing with alias present', solve([[{'x': 4}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 4}, {'a': 5}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 5:
    check('shadowed input', solve([[{'a': 5, 'b': 6}], [['b', 'a'], ['c', 'b']]]), [[['b', 5], ['c', 6]]])
    check('new alias not input', solve([[{'a': 5}], [['x', 'a'], ['y', 'x']]]), [[['x', 5], ['y', None]]])
    check('repeated label', solve([[{'a': 5, 'b': 6}], [['x', 'a'], ['x', 'b']]]), [[['x', 5], ['x', 6]]])
    check('multiple rows', solve([[{'a': 5}, {'a': 6}], [['z', 'a']]]), [[['z', 5]], [['z', 6]]])
    check('missing with alias present', solve([[{'x': 5}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 5}, {'a': 6}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
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:
        rows,projection=d
        out=[]
        for source in rows:
            record=[]
            env=source.copy()
            for alias,name in dict((a,k) for a,k in reversed(projection)).items():
                value=env.get(name)
                record.append([alias,value])
            out.append(record)
        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('shadowed input', solve([[{'a': 1, 'b': 2}], [['b', 'a'], ['c', 'b']]]), [[['b', 1], ['c', 2]]])
    check('new alias not input', solve([[{'a': 1}], [['x', 'a'], ['y', 'x']]]), [[['x', 1], ['y', None]]])
    check('repeated label', solve([[{'a': 1, 'b': 2}], [['x', 'a'], ['x', 'b']]]), [[['x', 1], ['x', 2]]])
    check('multiple rows', solve([[{'a': 1}, {'a': 2}], [['z', 'a']]]), [[['z', 1]], [['z', 2]]])
    check('missing with alias present', solve([[{'x': 1}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 1}, {'a': 2}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 2:
    check('shadowed input', solve([[{'a': 2, 'b': 3}], [['b', 'a'], ['c', 'b']]]), [[['b', 2], ['c', 3]]])
    check('new alias not input', solve([[{'a': 2}], [['x', 'a'], ['y', 'x']]]), [[['x', 2], ['y', None]]])
    check('repeated label', solve([[{'a': 2, 'b': 3}], [['x', 'a'], ['x', 'b']]]), [[['x', 2], ['x', 3]]])
    check('multiple rows', solve([[{'a': 2}, {'a': 3}], [['z', 'a']]]), [[['z', 2]], [['z', 3]]])
    check('missing with alias present', solve([[{'x': 2}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 2}, {'a': 3}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 3:
    check('shadowed input', solve([[{'a': 3, 'b': 4}], [['b', 'a'], ['c', 'b']]]), [[['b', 3], ['c', 4]]])
    check('new alias not input', solve([[{'a': 3}], [['x', 'a'], ['y', 'x']]]), [[['x', 3], ['y', None]]])
    check('repeated label', solve([[{'a': 3, 'b': 4}], [['x', 'a'], ['x', 'b']]]), [[['x', 3], ['x', 4]]])
    check('multiple rows', solve([[{'a': 3}, {'a': 4}], [['z', 'a']]]), [[['z', 3]], [['z', 4]]])
    check('missing with alias present', solve([[{'x': 3}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 3}, {'a': 4}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 4:
    check('shadowed input', solve([[{'a': 4, 'b': 5}], [['b', 'a'], ['c', 'b']]]), [[['b', 4], ['c', 5]]])
    check('new alias not input', solve([[{'a': 4}], [['x', 'a'], ['y', 'x']]]), [[['x', 4], ['y', None]]])
    check('repeated label', solve([[{'a': 4, 'b': 5}], [['x', 'a'], ['x', 'b']]]), [[['x', 4], ['x', 5]]])
    check('multiple rows', solve([[{'a': 4}, {'a': 5}], [['z', 'a']]]), [[['z', 4]], [['z', 5]]])
    check('missing with alias present', solve([[{'x': 4}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 4}, {'a': 5}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 5:
    check('shadowed input', solve([[{'a': 5, 'b': 6}], [['b', 'a'], ['c', 'b']]]), [[['b', 5], ['c', 6]]])
    check('new alias not input', solve([[{'a': 5}], [['x', 'a'], ['y', 'x']]]), [[['x', 5], ['y', None]]])
    check('repeated label', solve([[{'a': 5, 'b': 6}], [['x', 'a'], ['x', 'b']]]), [[['x', 5], ['x', 6]]])
    check('multiple rows', solve([[{'a': 5}, {'a': 6}], [['z', 'a']]]), [[['z', 5]], [['z', 6]]])
    check('missing with alias present', solve([[{'x': 5}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 5}, {'a': 6}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
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:
Projection deduplicates repeated output labels.

Evaluate ordered projection [output-name,input-name] pairs against each immutable input record, not earlier output aliases. Missing inputs yield None. Repeated output names occupy distinct result columns, and empty projections retain one empty result per input row.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        rows,projection=d
        out=[]
        for source in rows:
            record=[]
            env=rows[0].copy()
            for alias,name in projection:
                value=env.get(name)
                record.append([alias,value])
            out.append(record)
        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('shadowed input', solve([[{'a': 1, 'b': 2}], [['b', 'a'], ['c', 'b']]]), [[['b', 1], ['c', 2]]])
    check('new alias not input', solve([[{'a': 1}], [['x', 'a'], ['y', 'x']]]), [[['x', 1], ['y', None]]])
    check('repeated label', solve([[{'a': 1, 'b': 2}], [['x', 'a'], ['x', 'b']]]), [[['x', 1], ['x', 2]]])
    check('multiple rows', solve([[{'a': 1}, {'a': 2}], [['z', 'a']]]), [[['z', 1]], [['z', 2]]])
    check('missing with alias present', solve([[{'x': 1}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 1}, {'a': 2}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 2:
    check('shadowed input', solve([[{'a': 2, 'b': 3}], [['b', 'a'], ['c', 'b']]]), [[['b', 2], ['c', 3]]])
    check('new alias not input', solve([[{'a': 2}], [['x', 'a'], ['y', 'x']]]), [[['x', 2], ['y', None]]])
    check('repeated label', solve([[{'a': 2, 'b': 3}], [['x', 'a'], ['x', 'b']]]), [[['x', 2], ['x', 3]]])
    check('multiple rows', solve([[{'a': 2}, {'a': 3}], [['z', 'a']]]), [[['z', 2]], [['z', 3]]])
    check('missing with alias present', solve([[{'x': 2}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 2}, {'a': 3}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 3:
    check('shadowed input', solve([[{'a': 3, 'b': 4}], [['b', 'a'], ['c', 'b']]]), [[['b', 3], ['c', 4]]])
    check('new alias not input', solve([[{'a': 3}], [['x', 'a'], ['y', 'x']]]), [[['x', 3], ['y', None]]])
    check('repeated label', solve([[{'a': 3, 'b': 4}], [['x', 'a'], ['x', 'b']]]), [[['x', 3], ['x', 4]]])
    check('multiple rows', solve([[{'a': 3}, {'a': 4}], [['z', 'a']]]), [[['z', 3]], [['z', 4]]])
    check('missing with alias present', solve([[{'x': 3}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 3}, {'a': 4}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 4:
    check('shadowed input', solve([[{'a': 4, 'b': 5}], [['b', 'a'], ['c', 'b']]]), [[['b', 4], ['c', 5]]])
    check('new alias not input', solve([[{'a': 4}], [['x', 'a'], ['y', 'x']]]), [[['x', 4], ['y', None]]])
    check('repeated label', solve([[{'a': 4, 'b': 5}], [['x', 'a'], ['x', 'b']]]), [[['x', 4], ['x', 5]]])
    check('multiple rows', solve([[{'a': 4}, {'a': 5}], [['z', 'a']]]), [[['z', 4]], [['z', 5]]])
    check('missing with alias present', solve([[{'x': 4}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 4}, {'a': 5}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 5:
    check('shadowed input', solve([[{'a': 5, 'b': 6}], [['b', 'a'], ['c', 'b']]]), [[['b', 5], ['c', 6]]])
    check('new alias not input', solve([[{'a': 5}], [['x', 'a'], ['y', 'x']]]), [[['x', 5], ['y', None]]])
    check('repeated label', solve([[{'a': 5, 'b': 6}], [['x', 'a'], ['x', 'b']]]), [[['x', 5], ['x', 6]]])
    check('multiple rows', solve([[{'a': 5}, {'a': 6}], [['z', 'a']]]), [[['z', 5]], [['z', 6]]])
    check('missing with alias present', solve([[{'x': 5}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 5}, {'a': 6}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
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:
        rows,projection=d
        out=[]
        for source in rows:
            record=[]
            env=rows[-1].copy()
            for alias,name in projection:
                value=env.get(name)
                record.append([alias,value])
            out.append(record)
        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('shadowed input', solve([[{'a': 1, 'b': 2}], [['b', 'a'], ['c', 'b']]]), [[['b', 1], ['c', 2]]])
    check('new alias not input', solve([[{'a': 1}], [['x', 'a'], ['y', 'x']]]), [[['x', 1], ['y', None]]])
    check('repeated label', solve([[{'a': 1, 'b': 2}], [['x', 'a'], ['x', 'b']]]), [[['x', 1], ['x', 2]]])
    check('multiple rows', solve([[{'a': 1}, {'a': 2}], [['z', 'a']]]), [[['z', 1]], [['z', 2]]])
    check('missing with alias present', solve([[{'x': 1}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 1}, {'a': 2}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 2:
    check('shadowed input', solve([[{'a': 2, 'b': 3}], [['b', 'a'], ['c', 'b']]]), [[['b', 2], ['c', 3]]])
    check('new alias not input', solve([[{'a': 2}], [['x', 'a'], ['y', 'x']]]), [[['x', 2], ['y', None]]])
    check('repeated label', solve([[{'a': 2, 'b': 3}], [['x', 'a'], ['x', 'b']]]), [[['x', 2], ['x', 3]]])
    check('multiple rows', solve([[{'a': 2}, {'a': 3}], [['z', 'a']]]), [[['z', 2]], [['z', 3]]])
    check('missing with alias present', solve([[{'x': 2}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 2}, {'a': 3}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 3:
    check('shadowed input', solve([[{'a': 3, 'b': 4}], [['b', 'a'], ['c', 'b']]]), [[['b', 3], ['c', 4]]])
    check('new alias not input', solve([[{'a': 3}], [['x', 'a'], ['y', 'x']]]), [[['x', 3], ['y', None]]])
    check('repeated label', solve([[{'a': 3, 'b': 4}], [['x', 'a'], ['x', 'b']]]), [[['x', 3], ['x', 4]]])
    check('multiple rows', solve([[{'a': 3}, {'a': 4}], [['z', 'a']]]), [[['z', 3]], [['z', 4]]])
    check('missing with alias present', solve([[{'x': 3}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 3}, {'a': 4}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 4:
    check('shadowed input', solve([[{'a': 4, 'b': 5}], [['b', 'a'], ['c', 'b']]]), [[['b', 4], ['c', 5]]])
    check('new alias not input', solve([[{'a': 4}], [['x', 'a'], ['y', 'x']]]), [[['x', 4], ['y', None]]])
    check('repeated label', solve([[{'a': 4, 'b': 5}], [['x', 'a'], ['x', 'b']]]), [[['x', 4], ['x', 5]]])
    check('multiple rows', solve([[{'a': 4}, {'a': 5}], [['z', 'a']]]), [[['z', 4]], [['z', 5]]])
    check('missing with alias present', solve([[{'x': 4}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 4}, {'a': 5}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 5:
    check('shadowed input', solve([[{'a': 5, 'b': 6}], [['b', 'a'], ['c', 'b']]]), [[['b', 5], ['c', 6]]])
    check('new alias not input', solve([[{'a': 5}], [['x', 'a'], ['y', 'x']]]), [[['x', 5], ['y', None]]])
    check('repeated label', solve([[{'a': 5, 'b': 6}], [['x', 'a'], ['x', 'b']]]), [[['x', 5], ['x', 6]]])
    check('multiple rows', solve([[{'a': 5}, {'a': 6}], [['z', 'a']]]), [[['z', 5]], [['z', 6]]])
    check('missing with alias present', solve([[{'x': 5}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 5}, {'a': 6}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
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:
Projection evaluates every row against the first source record.

Evaluate ordered projection [output-name,input-name] pairs against each immutable input record, not earlier output aliases. Missing inputs yield None. Repeated output names occupy distinct result columns, and empty projections retain one empty result per input row.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        rows,projection=d
        out=[]
        for source in rows:
            record=[]
            env=source.copy()
            for alias,name in projection:
                value=env.get(name)
                if name in env: record.append([alias,value])
            out.append(record)
        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('shadowed input', solve([[{'a': 1, 'b': 2}], [['b', 'a'], ['c', 'b']]]), [[['b', 1], ['c', 2]]])
    check('new alias not input', solve([[{'a': 1}], [['x', 'a'], ['y', 'x']]]), [[['x', 1], ['y', None]]])
    check('repeated label', solve([[{'a': 1, 'b': 2}], [['x', 'a'], ['x', 'b']]]), [[['x', 1], ['x', 2]]])
    check('multiple rows', solve([[{'a': 1}, {'a': 2}], [['z', 'a']]]), [[['z', 1]], [['z', 2]]])
    check('missing with alias present', solve([[{'x': 1}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 1}, {'a': 2}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 2:
    check('shadowed input', solve([[{'a': 2, 'b': 3}], [['b', 'a'], ['c', 'b']]]), [[['b', 2], ['c', 3]]])
    check('new alias not input', solve([[{'a': 2}], [['x', 'a'], ['y', 'x']]]), [[['x', 2], ['y', None]]])
    check('repeated label', solve([[{'a': 2, 'b': 3}], [['x', 'a'], ['x', 'b']]]), [[['x', 2], ['x', 3]]])
    check('multiple rows', solve([[{'a': 2}, {'a': 3}], [['z', 'a']]]), [[['z', 2]], [['z', 3]]])
    check('missing with alias present', solve([[{'x': 2}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 2}, {'a': 3}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 3:
    check('shadowed input', solve([[{'a': 3, 'b': 4}], [['b', 'a'], ['c', 'b']]]), [[['b', 3], ['c', 4]]])
    check('new alias not input', solve([[{'a': 3}], [['x', 'a'], ['y', 'x']]]), [[['x', 3], ['y', None]]])
    check('repeated label', solve([[{'a': 3, 'b': 4}], [['x', 'a'], ['x', 'b']]]), [[['x', 3], ['x', 4]]])
    check('multiple rows', solve([[{'a': 3}, {'a': 4}], [['z', 'a']]]), [[['z', 3]], [['z', 4]]])
    check('missing with alias present', solve([[{'x': 3}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 3}, {'a': 4}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 4:
    check('shadowed input', solve([[{'a': 4, 'b': 5}], [['b', 'a'], ['c', 'b']]]), [[['b', 4], ['c', 5]]])
    check('new alias not input', solve([[{'a': 4}], [['x', 'a'], ['y', 'x']]]), [[['x', 4], ['y', None]]])
    check('repeated label', solve([[{'a': 4, 'b': 5}], [['x', 'a'], ['x', 'b']]]), [[['x', 4], ['x', 5]]])
    check('multiple rows', solve([[{'a': 4}, {'a': 5}], [['z', 'a']]]), [[['z', 4]], [['z', 5]]])
    check('missing with alias present', solve([[{'x': 4}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 4}, {'a': 5}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 5:
    check('shadowed input', solve([[{'a': 5, 'b': 6}], [['b', 'a'], ['c', 'b']]]), [[['b', 5], ['c', 6]]])
    check('new alias not input', solve([[{'a': 5}], [['x', 'a'], ['y', 'x']]]), [[['x', 5], ['y', None]]])
    check('repeated label', solve([[{'a': 5, 'b': 6}], [['x', 'a'], ['x', 'b']]]), [[['x', 5], ['x', 6]]])
    check('multiple rows', solve([[{'a': 5}, {'a': 6}], [['z', 'a']]]), [[['z', 5]], [['z', 6]]])
    check('missing with alias present', solve([[{'x': 5}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 5}, {'a': 6}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
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:
        rows,projection=d
        out=[]
        for source in rows:
            record=[]
            env=source.copy()
            for alias,name in projection:
                value=env.get(name)
                record.append([alias,0 if name not in env else value])
            out.append(record)
        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('shadowed input', solve([[{'a': 1, 'b': 2}], [['b', 'a'], ['c', 'b']]]), [[['b', 1], ['c', 2]]])
    check('new alias not input', solve([[{'a': 1}], [['x', 'a'], ['y', 'x']]]), [[['x', 1], ['y', None]]])
    check('repeated label', solve([[{'a': 1, 'b': 2}], [['x', 'a'], ['x', 'b']]]), [[['x', 1], ['x', 2]]])
    check('multiple rows', solve([[{'a': 1}, {'a': 2}], [['z', 'a']]]), [[['z', 1]], [['z', 2]]])
    check('missing with alias present', solve([[{'x': 1}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 1}, {'a': 2}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 2:
    check('shadowed input', solve([[{'a': 2, 'b': 3}], [['b', 'a'], ['c', 'b']]]), [[['b', 2], ['c', 3]]])
    check('new alias not input', solve([[{'a': 2}], [['x', 'a'], ['y', 'x']]]), [[['x', 2], ['y', None]]])
    check('repeated label', solve([[{'a': 2, 'b': 3}], [['x', 'a'], ['x', 'b']]]), [[['x', 2], ['x', 3]]])
    check('multiple rows', solve([[{'a': 2}, {'a': 3}], [['z', 'a']]]), [[['z', 2]], [['z', 3]]])
    check('missing with alias present', solve([[{'x': 2}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 2}, {'a': 3}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 3:
    check('shadowed input', solve([[{'a': 3, 'b': 4}], [['b', 'a'], ['c', 'b']]]), [[['b', 3], ['c', 4]]])
    check('new alias not input', solve([[{'a': 3}], [['x', 'a'], ['y', 'x']]]), [[['x', 3], ['y', None]]])
    check('repeated label', solve([[{'a': 3, 'b': 4}], [['x', 'a'], ['x', 'b']]]), [[['x', 3], ['x', 4]]])
    check('multiple rows', solve([[{'a': 3}, {'a': 4}], [['z', 'a']]]), [[['z', 3]], [['z', 4]]])
    check('missing with alias present', solve([[{'x': 3}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 3}, {'a': 4}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 4:
    check('shadowed input', solve([[{'a': 4, 'b': 5}], [['b', 'a'], ['c', 'b']]]), [[['b', 4], ['c', 5]]])
    check('new alias not input', solve([[{'a': 4}], [['x', 'a'], ['y', 'x']]]), [[['x', 4], ['y', None]]])
    check('repeated label', solve([[{'a': 4, 'b': 5}], [['x', 'a'], ['x', 'b']]]), [[['x', 4], ['x', 5]]])
    check('multiple rows', solve([[{'a': 4}, {'a': 5}], [['z', 'a']]]), [[['z', 4]], [['z', 5]]])
    check('missing with alias present', solve([[{'x': 4}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 4}, {'a': 5}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 5:
    check('shadowed input', solve([[{'a': 5, 'b': 6}], [['b', 'a'], ['c', 'b']]]), [[['b', 5], ['c', 6]]])
    check('new alias not input', solve([[{'a': 5}], [['x', 'a'], ['y', 'x']]]), [[['x', 5], ['y', None]]])
    check('repeated label', solve([[{'a': 5, 'b': 6}], [['x', 'a'], ['x', 'b']]]), [[['x', 5], ['x', 6]]])
    check('multiple rows', solve([[{'a': 5}, {'a': 6}], [['z', 'a']]]), [[['z', 5]], [['z', 6]]])
    check('missing with alias present', solve([[{'x': 5}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 5}, {'a': 6}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
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:
Projection silently drops columns whose source is absent.

Evaluate ordered projection [output-name,input-name] pairs against each immutable input record, not earlier output aliases. Missing inputs yield None. Repeated output names occupy distinct result columns, and empty projections retain one empty result per input row.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        rows,projection=d
        out=[]
        for source in rows:
            record=[]
            env=source.copy()
            for alias,name in projection:
                value=env.get(name)
                record.append([alias,value])
            if record: out.append(record)
        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('shadowed input', solve([[{'a': 1, 'b': 2}], [['b', 'a'], ['c', 'b']]]), [[['b', 1], ['c', 2]]])
    check('new alias not input', solve([[{'a': 1}], [['x', 'a'], ['y', 'x']]]), [[['x', 1], ['y', None]]])
    check('repeated label', solve([[{'a': 1, 'b': 2}], [['x', 'a'], ['x', 'b']]]), [[['x', 1], ['x', 2]]])
    check('multiple rows', solve([[{'a': 1}, {'a': 2}], [['z', 'a']]]), [[['z', 1]], [['z', 2]]])
    check('missing with alias present', solve([[{'x': 1}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 1}, {'a': 2}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 2:
    check('shadowed input', solve([[{'a': 2, 'b': 3}], [['b', 'a'], ['c', 'b']]]), [[['b', 2], ['c', 3]]])
    check('new alias not input', solve([[{'a': 2}], [['x', 'a'], ['y', 'x']]]), [[['x', 2], ['y', None]]])
    check('repeated label', solve([[{'a': 2, 'b': 3}], [['x', 'a'], ['x', 'b']]]), [[['x', 2], ['x', 3]]])
    check('multiple rows', solve([[{'a': 2}, {'a': 3}], [['z', 'a']]]), [[['z', 2]], [['z', 3]]])
    check('missing with alias present', solve([[{'x': 2}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 2}, {'a': 3}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 3:
    check('shadowed input', solve([[{'a': 3, 'b': 4}], [['b', 'a'], ['c', 'b']]]), [[['b', 3], ['c', 4]]])
    check('new alias not input', solve([[{'a': 3}], [['x', 'a'], ['y', 'x']]]), [[['x', 3], ['y', None]]])
    check('repeated label', solve([[{'a': 3, 'b': 4}], [['x', 'a'], ['x', 'b']]]), [[['x', 3], ['x', 4]]])
    check('multiple rows', solve([[{'a': 3}, {'a': 4}], [['z', 'a']]]), [[['z', 3]], [['z', 4]]])
    check('missing with alias present', solve([[{'x': 3}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 3}, {'a': 4}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 4:
    check('shadowed input', solve([[{'a': 4, 'b': 5}], [['b', 'a'], ['c', 'b']]]), [[['b', 4], ['c', 5]]])
    check('new alias not input', solve([[{'a': 4}], [['x', 'a'], ['y', 'x']]]), [[['x', 4], ['y', None]]])
    check('repeated label', solve([[{'a': 4, 'b': 5}], [['x', 'a'], ['x', 'b']]]), [[['x', 4], ['x', 5]]])
    check('multiple rows', solve([[{'a': 4}, {'a': 5}], [['z', 'a']]]), [[['z', 4]], [['z', 5]]])
    check('missing with alias present', solve([[{'x': 4}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 4}, {'a': 5}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 5:
    check('shadowed input', solve([[{'a': 5, 'b': 6}], [['b', 'a'], ['c', 'b']]]), [[['b', 5], ['c', 6]]])
    check('new alias not input', solve([[{'a': 5}], [['x', 'a'], ['y', 'x']]]), [[['x', 5], ['y', None]]])
    check('repeated label', solve([[{'a': 5, 'b': 6}], [['x', 'a'], ['x', 'b']]]), [[['x', 5], ['x', 6]]])
    check('multiple rows', solve([[{'a': 5}, {'a': 6}], [['z', 'a']]]), [[['z', 5]], [['z', 6]]])
    check('missing with alias present', solve([[{'x': 5}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 5}, {'a': 6}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
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:
        rows,projection=d
        out=[]
        for source in rows:
            record=[]
            env=source.copy()
            for alias,name in projection:
                value=env.get(name)
                record.append([alias,value])
            if projection: out.append(record)
        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('shadowed input', solve([[{'a': 1, 'b': 2}], [['b', 'a'], ['c', 'b']]]), [[['b', 1], ['c', 2]]])
    check('new alias not input', solve([[{'a': 1}], [['x', 'a'], ['y', 'x']]]), [[['x', 1], ['y', None]]])
    check('repeated label', solve([[{'a': 1, 'b': 2}], [['x', 'a'], ['x', 'b']]]), [[['x', 1], ['x', 2]]])
    check('multiple rows', solve([[{'a': 1}, {'a': 2}], [['z', 'a']]]), [[['z', 1]], [['z', 2]]])
    check('missing with alias present', solve([[{'x': 1}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 1}, {'a': 2}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 2:
    check('shadowed input', solve([[{'a': 2, 'b': 3}], [['b', 'a'], ['c', 'b']]]), [[['b', 2], ['c', 3]]])
    check('new alias not input', solve([[{'a': 2}], [['x', 'a'], ['y', 'x']]]), [[['x', 2], ['y', None]]])
    check('repeated label', solve([[{'a': 2, 'b': 3}], [['x', 'a'], ['x', 'b']]]), [[['x', 2], ['x', 3]]])
    check('multiple rows', solve([[{'a': 2}, {'a': 3}], [['z', 'a']]]), [[['z', 2]], [['z', 3]]])
    check('missing with alias present', solve([[{'x': 2}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 2}, {'a': 3}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 3:
    check('shadowed input', solve([[{'a': 3, 'b': 4}], [['b', 'a'], ['c', 'b']]]), [[['b', 3], ['c', 4]]])
    check('new alias not input', solve([[{'a': 3}], [['x', 'a'], ['y', 'x']]]), [[['x', 3], ['y', None]]])
    check('repeated label', solve([[{'a': 3, 'b': 4}], [['x', 'a'], ['x', 'b']]]), [[['x', 3], ['x', 4]]])
    check('multiple rows', solve([[{'a': 3}, {'a': 4}], [['z', 'a']]]), [[['z', 3]], [['z', 4]]])
    check('missing with alias present', solve([[{'x': 3}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 3}, {'a': 4}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 4:
    check('shadowed input', solve([[{'a': 4, 'b': 5}], [['b', 'a'], ['c', 'b']]]), [[['b', 4], ['c', 5]]])
    check('new alias not input', solve([[{'a': 4}], [['x', 'a'], ['y', 'x']]]), [[['x', 4], ['y', None]]])
    check('repeated label', solve([[{'a': 4, 'b': 5}], [['x', 'a'], ['x', 'b']]]), [[['x', 4], ['x', 5]]])
    check('multiple rows', solve([[{'a': 4}, {'a': 5}], [['z', 'a']]]), [[['z', 4]], [['z', 5]]])
    check('missing with alias present', solve([[{'x': 4}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 4}, {'a': 5}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
elif N == 5:
    check('shadowed input', solve([[{'a': 5, 'b': 6}], [['b', 'a'], ['c', 'b']]]), [[['b', 5], ['c', 6]]])
    check('new alias not input', solve([[{'a': 5}], [['x', 'a'], ['y', 'x']]]), [[['x', 5], ['y', None]]])
    check('repeated label', solve([[{'a': 5, 'b': 6}], [['x', 'a'], ['x', 'b']]]), [[['x', 5], ['x', 6]]])
    check('multiple rows', solve([[{'a': 5}, {'a': 6}], [['z', 'a']]]), [[['z', 5]], [['z', 6]]])
    check('missing with alias present', solve([[{'x': 5}], [['x', 'missing']]]), [[['x', None]]])
    check('empty projection', solve([[{'a': 5}, {'a': 6}], []]), [[], []])
    check('empty input', solve([[], [['x', 'a']]]), [])
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:
Zero-column projection removes all source rows.

Evaluate ordered projection [output-name,input-name] pairs against each immutable input record, not earlier output aliases. Missing inputs yield None. Repeated output names occupy distinct result columns, and empty projections retain one empty result per input row.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        outer,inner=d
        result=[]
        for ident,key,minimum in [(i,outer[0][1],m) for i,k,m in outer]:
            matches=[value for k,value in inner if key is not None and k==key and value>=minimum]
            if not matches: result.append([ident,None])
            for value in matches:
                result.append([ident,value])
        return result
    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('per-row bindings', solve([[[10, 'a', 1], [11, 'b', 3]], [['a', 2], ['b', 2], ['b', 4]]]), [[10, 2], [11, 4]])
    check('same key different parameter', solve([[[10, 'a', 1], [11, 'a', 3]], [['a', 2], ['a', 4]]]), [[10, 2], [10, 4], [11, 4]])
    check('null key', solve([[[10, None, 1]], [[None, 2]]]), [[10, None]])
    check('empty inner', solve([[[10, 'a', 1]], []]), [[10, None]])
    check('duplicate inner', solve([[[10, 'a', 1]], [['a', 1], ['a', 1]]]), [[10, 1], [10, 1]])
    check('empty outer', solve([[], [['a', 1]]]), [])
    check('unmatched key', solve([[[10, 'z', 1]], [['a', 2]]]), [[10, None]])
elif N == 2:
    check('per-row bindings', solve([[[10, 'a', 2], [11, 'b', 4]], [['a', 3], ['b', 3], ['b', 5]]]), [[10, 3], [11, 5]])
    check('same key different parameter', solve([[[10, 'a', 2], [11, 'a', 4]], [['a', 3], ['a', 5]]]), [[10, 3], [10, 5], [11, 5]])
    check('null key', solve([[[10, None, 2]], [[None, 3]]]), [[10, None]])
    check('empty inner', solve([[[10, 'a', 2]], []]), [[10, None]])
    check('duplicate inner', solve([[[10, 'a', 2]], [['a', 2], ['a', 2]]]), [[10, 2], [10, 2]])
    check('empty outer', solve([[], [['a', 2]]]), [])
    check('unmatched key', solve([[[10, 'z', 2]], [['a', 3]]]), [[10, None]])
elif N == 3:
    check('per-row bindings', solve([[[10, 'a', 3], [11, 'b', 5]], [['a', 4], ['b', 4], ['b', 6]]]), [[10, 4], [11, 6]])
    check('same key different parameter', solve([[[10, 'a', 3], [11, 'a', 5]], [['a', 4], ['a', 6]]]), [[10, 4], [10, 6], [11, 6]])
    check('null key', solve([[[10, None, 3]], [[None, 4]]]), [[10, None]])
    check('empty inner', solve([[[10, 'a', 3]], []]), [[10, None]])
    check('duplicate inner', solve([[[10, 'a', 3]], [['a', 3], ['a', 3]]]), [[10, 3], [10, 3]])
    check('empty outer', solve([[], [['a', 3]]]), [])
    check('unmatched key', solve([[[10, 'z', 3]], [['a', 4]]]), [[10, None]])
elif N == 4:
    check('per-row bindings', solve([[[10, 'a', 4], [11, 'b', 6]], [['a', 5], ['b', 5], ['b', 7]]]), [[10, 5], [11, 7]])
    check('same key different parameter', solve([[[10, 'a', 4], [11, 'a', 6]], [['a', 5], ['a', 7]]]), [[10, 5], [10, 7], [11, 7]])
    check('null key', solve([[[10, None, 4]], [[None, 5]]]), [[10, None]])
    check('empty inner', solve([[[10, 'a', 4]], []]), [[10, None]])
    check('duplicate inner', solve([[[10, 'a', 4]], [['a', 4], ['a', 4]]]), [[10, 4], [10, 4]])
    check('empty outer', solve([[], [['a', 4]]]), [])
    check('unmatched key', solve([[[10, 'z', 4]], [['a', 5]]]), [[10, None]])
elif N == 5:
    check('per-row bindings', solve([[[10, 'a', 5], [11, 'b', 7]], [['a', 6], ['b', 6], ['b', 8]]]), [[10, 6], [11, 8]])
    check('same key different parameter', solve([[[10, 'a', 5], [11, 'a', 7]], [['a', 6], ['a', 8]]]), [[10, 6], [10, 8], [11, 8]])
    check('null key', solve([[[10, None, 5]], [[None, 6]]]), [[10, None]])
    check('empty inner', solve([[[10, 'a', 5]], []]), [[10, None]])
    check('duplicate inner', solve([[[10, 'a', 5]], [['a', 5], ['a', 5]]]), [[10, 5], [10, 5]])
    check('empty outer', solve([[], [['a', 5]]]), [])
    check('unmatched key', solve([[[10, 'z', 5]], [['a', 6]]]), [[10, None]])
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:
        outer,inner=d
        result=[]
        for ident,key,minimum in [(i,outer[-1][1],m) for i,k,m in outer]:
            matches=[value for k,value in inner if key is not None and k==key and value>=minimum]
            if not matches: result.append([ident,None])
            for value in matches:
                result.append([ident,value])
        return result
    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('per-row bindings', solve([[[10, 'a', 1], [11, 'b', 3]], [['a', 2], ['b', 2], ['b', 4]]]), [[10, 2], [11, 4]])
    check('same key different parameter', solve([[[10, 'a', 1], [11, 'a', 3]], [['a', 2], ['a', 4]]]), [[10, 2], [10, 4], [11, 4]])
    check('null key', solve([[[10, None, 1]], [[None, 2]]]), [[10, None]])
    check('empty inner', solve([[[10, 'a', 1]], []]), [[10, None]])
    check('duplicate inner', solve([[[10, 'a', 1]], [['a', 1], ['a', 1]]]), [[10, 1], [10, 1]])
    check('empty outer', solve([[], [['a', 1]]]), [])
    check('unmatched key', solve([[[10, 'z', 1]], [['a', 2]]]), [[10, None]])
elif N == 2:
    check('per-row bindings', solve([[[10, 'a', 2], [11, 'b', 4]], [['a', 3], ['b', 3], ['b', 5]]]), [[10, 3], [11, 5]])
    check('same key different parameter', solve([[[10, 'a', 2], [11, 'a', 4]], [['a', 3], ['a', 5]]]), [[10, 3], [10, 5], [11, 5]])
    check('null key', solve([[[10, None, 2]], [[None, 3]]]), [[10, None]])
    check('empty inner', solve([[[10, 'a', 2]], []]), [[10, None]])
    check('duplicate inner', solve([[[10, 'a', 2]], [['a', 2], ['a', 2]]]), [[10, 2], [10, 2]])
    check('empty outer', solve([[], [['a', 2]]]), [])
    check('unmatched key', solve([[[10, 'z', 2]], [['a', 3]]]), [[10, None]])
elif N == 3:
    check('per-row bindings', solve([[[10, 'a', 3], [11, 'b', 5]], [['a', 4], ['b', 4], ['b', 6]]]), [[10, 4], [11, 6]])
    check('same key different parameter', solve([[[10, 'a', 3], [11, 'a', 5]], [['a', 4], ['a', 6]]]), [[10, 4], [10, 6], [11, 6]])
    check('null key', solve([[[10, None, 3]], [[None, 4]]]), [[10, None]])
    check('empty inner', solve([[[10, 'a', 3]], []]), [[10, None]])
    check('duplicate inner', solve([[[10, 'a', 3]], [['a', 3], ['a', 3]]]), [[10, 3], [10, 3]])
    check('empty outer', solve([[], [['a', 3]]]), [])
    check('unmatched key', solve([[[10, 'z', 3]], [['a', 4]]]), [[10, None]])
elif N == 4:
    check('per-row bindings', solve([[[10, 'a', 4], [11, 'b', 6]], [['a', 5], ['b', 5], ['b', 7]]]), [[10, 5], [11, 7]])
    check('same key different parameter', solve([[[10, 'a', 4], [11, 'a', 6]], [['a', 5], ['a', 7]]]), [[10, 5], [10, 7], [11, 7]])
    check('null key', solve([[[10, None, 4]], [[None, 5]]]), [[10, None]])
    check('empty inner', solve([[[10, 'a', 4]], []]), [[10, None]])
    check('duplicate inner', solve([[[10, 'a', 4]], [['a', 4], ['a', 4]]]), [[10, 4], [10, 4]])
    check('empty outer', solve([[], [['a', 4]]]), [])
    check('unmatched key', solve([[[10, 'z', 4]], [['a', 5]]]), [[10, None]])
elif N == 5:
    check('per-row bindings', solve([[[10, 'a', 5], [11, 'b', 7]], [['a', 6], ['b', 6], ['b', 8]]]), [[10, 6], [11, 8]])
    check('same key different parameter', solve([[[10, 'a', 5], [11, 'a', 7]], [['a', 6], ['a', 8]]]), [[10, 6], [10, 8], [11, 8]])
    check('null key', solve([[[10, None, 5]], [[None, 6]]]), [[10, None]])
    check('empty inner', solve([[[10, 'a', 5]], []]), [[10, None]])
    check('duplicate inner', solve([[[10, 'a', 5]], [['a', 5], ['a', 5]]]), [[10, 5], [10, 5]])
    check('empty outer', solve([[], [['a', 5]]]), [])
    check('unmatched key', solve([[[10, 'z', 5]], [['a', 6]]]), [[10, None]])
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:
Lateral execution reuses the first outer row correlation key.

For each outer [id,key] row, evaluate matching [key,value] inner rows with a minimum supplied by that outer row. Emit [id,value] in source order, preserving duplicate inner matches. Empty matches emit [id,None] under outer lateral semantics.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        outer,inner=d
        result=[]
        for ident,key,minimum in outer:
            matches=[value for k,value in inner if key is not None and k==key and value>=outer[0][2]]
            if not matches: result.append([ident,None])
            for value in matches:
                result.append([ident,value])
        return result
    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('per-row bindings', solve([[[10, 'a', 1], [11, 'b', 3]], [['a', 2], ['b', 2], ['b', 4]]]), [[10, 2], [11, 4]])
    check('same key different parameter', solve([[[10, 'a', 1], [11, 'a', 3]], [['a', 2], ['a', 4]]]), [[10, 2], [10, 4], [11, 4]])
    check('null key', solve([[[10, None, 1]], [[None, 2]]]), [[10, None]])
    check('empty inner', solve([[[10, 'a', 1]], []]), [[10, None]])
    check('duplicate inner', solve([[[10, 'a', 1]], [['a', 1], ['a', 1]]]), [[10, 1], [10, 1]])
    check('empty outer', solve([[], [['a', 1]]]), [])
    check('unmatched key', solve([[[10, 'z', 1]], [['a', 2]]]), [[10, None]])
elif N == 2:
    check('per-row bindings', solve([[[10, 'a', 2], [11, 'b', 4]], [['a', 3], ['b', 3], ['b', 5]]]), [[10, 3], [11, 5]])
    check('same key different parameter', solve([[[10, 'a', 2], [11, 'a', 4]], [['a', 3], ['a', 5]]]), [[10, 3], [10, 5], [11, 5]])
    check('null key', solve([[[10, None, 2]], [[None, 3]]]), [[10, None]])
    check('empty inner', solve([[[10, 'a', 2]], []]), [[10, None]])
    check('duplicate inner', solve([[[10, 'a', 2]], [['a', 2], ['a', 2]]]), [[10, 2], [10, 2]])
    check('empty outer', solve([[], [['a', 2]]]), [])
    check('unmatched key', solve([[[10, 'z', 2]], [['a', 3]]]), [[10, None]])
elif N == 3:
    check('per-row bindings', solve([[[10, 'a', 3], [11, 'b', 5]], [['a', 4], ['b', 4], ['b', 6]]]), [[10, 4], [11, 6]])
    check('same key different parameter', solve([[[10, 'a', 3], [11, 'a', 5]], [['a', 4], ['a', 6]]]), [[10, 4], [10, 6], [11, 6]])
    check('null key', solve([[[10, None, 3]], [[None, 4]]]), [[10, None]])
    check('empty inner', solve([[[10, 'a', 3]], []]), [[10, None]])
    check('duplicate inner', solve([[[10, 'a', 3]], [['a', 3], ['a', 3]]]), [[10, 3], [10, 3]])
    check('empty outer', solve([[], [['a', 3]]]), [])
    check('unmatched key', solve([[[10, 'z', 3]], [['a', 4]]]), [[10, None]])
elif N == 4:
    check('per-row bindings', solve([[[10, 'a', 4], [11, 'b', 6]], [['a', 5], ['b', 5], ['b', 7]]]), [[10, 5], [11, 7]])
    check('same key different parameter', solve([[[10, 'a', 4], [11, 'a', 6]], [['a', 5], ['a', 7]]]), [[10, 5], [10, 7], [11, 7]])
    check('null key', solve([[[10, None, 4]], [[None, 5]]]), [[10, None]])
    check('empty inner', solve([[[10, 'a', 4]], []]), [[10, None]])
    check('duplicate inner', solve([[[10, 'a', 4]], [['a', 4], ['a', 4]]]), [[10, 4], [10, 4]])
    check('empty outer', solve([[], [['a', 4]]]), [])
    check('unmatched key', solve([[[10, 'z', 4]], [['a', 5]]]), [[10, None]])
elif N == 5:
    check('per-row bindings', solve([[[10, 'a', 5], [11, 'b', 7]], [['a', 6], ['b', 6], ['b', 8]]]), [[10, 6], [11, 8]])
    check('same key different parameter', solve([[[10, 'a', 5], [11, 'a', 7]], [['a', 6], ['a', 8]]]), [[10, 6], [10, 8], [11, 8]])
    check('null key', solve([[[10, None, 5]], [[None, 6]]]), [[10, None]])
    check('empty inner', solve([[[10, 'a', 5]], []]), [[10, None]])
    check('duplicate inner', solve([[[10, 'a', 5]], [['a', 5], ['a', 5]]]), [[10, 5], [10, 5]])
    check('empty outer', solve([[], [['a', 5]]]), [])
    check('unmatched key', solve([[[10, 'z', 5]], [['a', 6]]]), [[10, None]])
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:
        outer,inner=d
        result=[]
        for ident,key,minimum in outer:
            matches=[value for k,value in inner if key is not None and k==key and value>=min(m for i,k,m in outer)]
            if not matches: result.append([ident,None])
            for value in matches:
                result.append([ident,value])
        return result
    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('per-row bindings', solve([[[10, 'a', 1], [11, 'b', 3]], [['a', 2], ['b', 2], ['b', 4]]]), [[10, 2], [11, 4]])
    check('same key different parameter', solve([[[10, 'a', 1], [11, 'a', 3]], [['a', 2], ['a', 4]]]), [[10, 2], [10, 4], [11, 4]])
    check('null key', solve([[[10, None, 1]], [[None, 2]]]), [[10, None]])
    check('empty inner', solve([[[10, 'a', 1]], []]), [[10, None]])
    check('duplicate inner', solve([[[10, 'a', 1]], [['a', 1], ['a', 1]]]), [[10, 1], [10, 1]])
    check('empty outer', solve([[], [['a', 1]]]), [])
    check('unmatched key', solve([[[10, 'z', 1]], [['a', 2]]]), [[10, None]])
elif N == 2:
    check('per-row bindings', solve([[[10, 'a', 2], [11, 'b', 4]], [['a', 3], ['b', 3], ['b', 5]]]), [[10, 3], [11, 5]])
    check('same key different parameter', solve([[[10, 'a', 2], [11, 'a', 4]], [['a', 3], ['a', 5]]]), [[10, 3], [10, 5], [11, 5]])
    check('null key', solve([[[10, None, 2]], [[None, 3]]]), [[10, None]])
    check('empty inner', solve([[[10, 'a', 2]], []]), [[10, None]])
    check('duplicate inner', solve([[[10, 'a', 2]], [['a', 2], ['a', 2]]]), [[10, 2], [10, 2]])
    check('empty outer', solve([[], [['a', 2]]]), [])
    check('unmatched key', solve([[[10, 'z', 2]], [['a', 3]]]), [[10, None]])
elif N == 3:
    check('per-row bindings', solve([[[10, 'a', 3], [11, 'b', 5]], [['a', 4], ['b', 4], ['b', 6]]]), [[10, 4], [11, 6]])
    check('same key different parameter', solve([[[10, 'a', 3], [11, 'a', 5]], [['a', 4], ['a', 6]]]), [[10, 4], [10, 6], [11, 6]])
    check('null key', solve([[[10, None, 3]], [[None, 4]]]), [[10, None]])
    check('empty inner', solve([[[10, 'a', 3]], []]), [[10, None]])
    check('duplicate inner', solve([[[10, 'a', 3]], [['a', 3], ['a', 3]]]), [[10, 3], [10, 3]])
    check('empty outer', solve([[], [['a', 3]]]), [])
    check('unmatched key', solve([[[10, 'z', 3]], [['a', 4]]]), [[10, None]])
elif N == 4:
    check('per-row bindings', solve([[[10, 'a', 4], [11, 'b', 6]], [['a', 5], ['b', 5], ['b', 7]]]), [[10, 5], [11, 7]])
    check('same key different parameter', solve([[[10, 'a', 4], [11, 'a', 6]], [['a', 5], ['a', 7]]]), [[10, 5], [10, 7], [11, 7]])
    check('null key', solve([[[10, None, 4]], [[None, 5]]]), [[10, None]])
    check('empty inner', solve([[[10, 'a', 4]], []]), [[10, None]])
    check('duplicate inner', solve([[[10, 'a', 4]], [['a', 4], ['a', 4]]]), [[10, 4], [10, 4]])
    check('empty outer', solve([[], [['a', 4]]]), [])
    check('unmatched key', solve([[[10, 'z', 4]], [['a', 5]]]), [[10, None]])
elif N == 5:
    check('per-row bindings', solve([[[10, 'a', 5], [11, 'b', 7]], [['a', 6], ['b', 6], ['b', 8]]]), [[10, 6], [11, 8]])
    check('same key different parameter', solve([[[10, 'a', 5], [11, 'a', 7]], [['a', 6], ['a', 8]]]), [[10, 6], [10, 8], [11, 8]])
    check('null key', solve([[[10, None, 5]], [[None, 6]]]), [[10, None]])
    check('empty inner', solve([[[10, 'a', 5]], []]), [[10, None]])
    check('duplicate inner', solve([[[10, 'a', 5]], [['a', 5], ['a', 5]]]), [[10, 5], [10, 5]])
    check('empty outer', solve([[], [['a', 5]]]), [])
    check('unmatched key', solve([[[10, 'z', 5]], [['a', 6]]]), [[10, None]])
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:
Lateral execution reuses the first outer predicate parameter.

For each outer [id,key] row, evaluate matching [key,value] inner rows with a minimum supplied by that outer row. Emit [id,value] in source order, preserving duplicate inner matches. Empty matches emit [id,None] under outer lateral semantics.

split: open-access