broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out=[]
    for cell in data.split(','):
        if '[' in cell:
            opening=cell.find('[')
            if not cell.endswith(']') or cell.count('[')!=1 or cell.count(']')!=1: return None
            name,unit=cell[:opening],cell[opening+1:-1]
            if not name or not unit: return None
        else:
            if not cell or ']' in cell: return None
            name,unit=cell,''
        pair=[name,unit]
        if pair in out: return None
        out.append(pair)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('units', solve(_vary('@ [kg],time[s]')), _vary([['@ ', 'kg'], ['time', 's']]))
check('bare', solve(_vary('@')), _vary([['@', None]]))
check('two units', solve(_vary('mass[kg],mass[g]')), _vary([['mass', 'kg'], ['mass', 'g']]))
check('duplicate', solve(_vary('a[x],a[x]')), _vary(None))
check('empty unit', solve(_vary('a[]')), _vary(None))
check('empty name', solve(_vary('[kg]')), _vary(None))
check('suffix', solve(_vary('a[x]tail')), _vary(None))
check('nested', solve(_vary('a[[x]]')), _vary(None))
check('bare space', solve(_vary(' name ')), _vary([[' name ', None]]))
check('unit exact spelling', solve(_vary('a[ Pa ],b[Pa]')), _vary([['a', ' Pa '], ['b', 'Pa']]))
check('shared unit', solve(_vary('a[x],b[x]')), _vary([['a', 'x'], ['b', 'x']]))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out=[]
    for cell in data.split(','):
        if '[' in cell:
            opening=cell.find('[')
            if not cell.endswith(']') or cell.count('[')!=1 or cell.count(']')!=1: return None
            name,unit=cell[:opening],cell[opening+1:-1]
            if not name or not unit: return None
        else:
            if not cell or ']' in cell: return None
            name,unit=cell,'1'
        pair=[name,unit]
        if pair in out: return None
        out.append(pair)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('units', solve(_vary('@ [kg],time[s]')), _vary([['@ ', 'kg'], ['time', 's']]))
check('bare', solve(_vary('@')), _vary([['@', None]]))
check('two units', solve(_vary('mass[kg],mass[g]')), _vary([['mass', 'kg'], ['mass', 'g']]))
check('duplicate', solve(_vary('a[x],a[x]')), _vary(None))
check('empty unit', solve(_vary('a[]')), _vary(None))
check('empty name', solve(_vary('[kg]')), _vary(None))
check('suffix', solve(_vary('a[x]tail')), _vary(None))
check('nested', solve(_vary('a[[x]]')), _vary(None))
check('bare space', solve(_vary(' name ')), _vary([[' name ', None]]))
check('unit exact spelling', solve(_vary('a[ Pa ],b[Pa]')), _vary([['a', ' Pa '], ['b', 'Pa']]))
check('shared unit', solve(_vary('a[x],b[x]')), _vary([['a', 'x'], ['b', 'x']]))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A structured table violates the declared record or column contract.

Parse comma header cells with optional terminal [unit]. Return [name,unit-or-null]. Only one terminal bracket pair is allowed; name and unit must be nonempty. Bare header names are preserved including spaces; bracket text is not normalized. Duplicate full name/unit pairs reject, but one name with different units is allowed.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out=[]
    for cell in data.split(','):
        if '[' in cell:
            opening=cell.find('[')
            if not cell.endswith(']') or cell.count('[')!=1 or cell.count(']')!=1: return None
            name,unit=cell[:opening],cell[opening+1:-1]
            if not name or not unit: return None
        else:
            if not cell or ']' in cell: return None
            name,unit=cell,None
        pair=[name,unit.lower() if unit is not None else None]
        if pair in out: return None
        out.append(pair)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('units', solve(_vary('@ [kg],time[s]')), _vary([['@ ', 'kg'], ['time', 's']]))
check('bare', solve(_vary('@')), _vary([['@', None]]))
check('two units', solve(_vary('mass[kg],mass[g]')), _vary([['mass', 'kg'], ['mass', 'g']]))
check('duplicate', solve(_vary('a[x],a[x]')), _vary(None))
check('empty unit', solve(_vary('a[]')), _vary(None))
check('empty name', solve(_vary('[kg]')), _vary(None))
check('suffix', solve(_vary('a[x]tail')), _vary(None))
check('nested', solve(_vary('a[[x]]')), _vary(None))
check('bare space', solve(_vary(' name ')), _vary([[' name ', None]]))
check('unit exact spelling', solve(_vary('a[ Pa ],b[Pa]')), _vary([['a', ' Pa '], ['b', 'Pa']]))
check('shared unit', solve(_vary('a[x],b[x]')), _vary([['a', 'x'], ['b', 'x']]))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out=[]
    for cell in data.split(','):
        if '[' in cell:
            opening=cell.find('[')
            if not cell.endswith(']') or cell.count('[')!=1 or cell.count(']')!=1: return None
            name,unit=cell[:opening],cell[opening+1:-1]
            if not name or not unit: return None
        else:
            if not cell or ']' in cell: return None
            name,unit=cell,None
        pair=[name,unit.strip() if unit is not None else None]
        if pair in out: return None
        out.append(pair)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('units', solve(_vary('@ [kg],time[s]')), _vary([['@ ', 'kg'], ['time', 's']]))
check('bare', solve(_vary('@')), _vary([['@', None]]))
check('two units', solve(_vary('mass[kg],mass[g]')), _vary([['mass', 'kg'], ['mass', 'g']]))
check('duplicate', solve(_vary('a[x],a[x]')), _vary(None))
check('empty unit', solve(_vary('a[]')), _vary(None))
check('empty name', solve(_vary('[kg]')), _vary(None))
check('suffix', solve(_vary('a[x]tail')), _vary(None))
check('nested', solve(_vary('a[[x]]')), _vary(None))
check('bare space', solve(_vary(' name ')), _vary([[' name ', None]]))
check('unit exact spelling', solve(_vary('a[ Pa ],b[Pa]')), _vary([['a', ' Pa '], ['b', 'Pa']]))
check('shared unit', solve(_vary('a[x],b[x]')), _vary([['a', 'x'], ['b', 'x']]))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A structured table violates the declared record or column contract.

Parse comma header cells with optional terminal [unit]. Return [name,unit-or-null]. Only one terminal bracket pair is allowed; name and unit must be nonempty. Bare header names are preserved including spaces; bracket text is not normalized. Duplicate full name/unit pairs reject, but one name with different units is allowed.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    header=[]
    for table in data:
        if len(set(table['header']))!=len(table['header']): return None
        for name in table['header']:
            if name not in header: header.append(name)
    out=[]
    for table in data:
        for row in table['rows']:
            if len(row)!=len(table['header']): return None
            mapping=dict(zip(table['header'],row))
            out.append([mapping.get(name) for name in header])
    return {'header':sorted(header),'rows':out}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('union', solve(_vary([{'header': ['b', 'a'], 'rows': [['@', 'x']]}, {'header': ['a', 'c'], 'rows': [['y', 'z']]}])), _vary({'header': ['b', 'a', 'c'], 'rows': [['@', 'x', None], [None, 'y', 'z']]}))
check('reordered', solve(_vary([{'header': ['a', 'b'], 'rows': [['@', 'x']]}, {'header': ['b', 'a'], 'rows': [['z', 'y']]}])), _vary({'header': ['a', 'b'], 'rows': [['@', 'x'], ['y', 'z']]}))
check('duplicate', solve(_vary([{'header': ['a', 'a'], 'rows': []}])), _vary(None))
check('ragged', solve(_vary([{'header': ['a', 'b'], 'rows': [['@']]}])), _vary(None))
check('explicit empty', solve(_vary([{'header': ['a'], 'rows': [['']]}, {'header': ['b'], 'rows': [['@']]}])), _vary({'header': ['a', 'b'], 'rows': [['', None], [None, '@']]}))
check('empty', solve(_vary([])), _vary({'header': [], 'rows': []}))
check('header only', solve(_vary([{'header': ['@'], 'rows': []}])), _vary({'header': ['@'], 'rows': []}))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    header=[]
    for table in data:
        if len(set(table['header']))!=len(table['header']): return None
        for name in table['header']:
            if name not in header: header.append(name)
    out=[]
    for table in data:
        for row in table['rows']:
            if len(row)!=len(table['header']): return None
            mapping=dict(zip(table['header'],row))
            out.append([mapping.get(name) for name in header])
    return {'header':list(reversed(header)),'rows':out}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('union', solve(_vary([{'header': ['b', 'a'], 'rows': [['@', 'x']]}, {'header': ['a', 'c'], 'rows': [['y', 'z']]}])), _vary({'header': ['b', 'a', 'c'], 'rows': [['@', 'x', None], [None, 'y', 'z']]}))
check('reordered', solve(_vary([{'header': ['a', 'b'], 'rows': [['@', 'x']]}, {'header': ['b', 'a'], 'rows': [['z', 'y']]}])), _vary({'header': ['a', 'b'], 'rows': [['@', 'x'], ['y', 'z']]}))
check('duplicate', solve(_vary([{'header': ['a', 'a'], 'rows': []}])), _vary(None))
check('ragged', solve(_vary([{'header': ['a', 'b'], 'rows': [['@']]}])), _vary(None))
check('explicit empty', solve(_vary([{'header': ['a'], 'rows': [['']]}, {'header': ['b'], 'rows': [['@']]}])), _vary({'header': ['a', 'b'], 'rows': [['', None], [None, '@']]}))
check('empty', solve(_vary([])), _vary({'header': [], 'rows': []}))
check('header only', solve(_vary([{'header': ['@'], 'rows': []}])), _vary({'header': ['@'], 'rows': []}))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A structured table violates the declared record or column contract.

Combine a list of tables, each {header:[names], rows:[[cells]]}. Output header is the first-seen union of names, preserving first-seen order. Duplicate names within one input header and row-width mismatches reject. Missing columns in a table become null; explicit empty values remain empty. Return {header,rows}.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    header=[]
    for table in data:
        if len(set(table['header']))!=len(table['header']): return None
        for name in table['header']:
            if name not in header: header.append(name)
    out=[]
    for table in data:
        for row in table['rows']:
            if len(row)!=len(table['header']): return None
            mapping=dict(zip(table['header'],row))
            out.append(row+[None]*(len(header)-len(row)))
    return {'header':header,'rows':out}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('union', solve(_vary([{'header': ['b', 'a'], 'rows': [['@', 'x']]}, {'header': ['a', 'c'], 'rows': [['y', 'z']]}])), _vary({'header': ['b', 'a', 'c'], 'rows': [['@', 'x', None], [None, 'y', 'z']]}))
check('reordered', solve(_vary([{'header': ['a', 'b'], 'rows': [['@', 'x']]}, {'header': ['b', 'a'], 'rows': [['z', 'y']]}])), _vary({'header': ['a', 'b'], 'rows': [['@', 'x'], ['y', 'z']]}))
check('duplicate', solve(_vary([{'header': ['a', 'a'], 'rows': []}])), _vary(None))
check('ragged', solve(_vary([{'header': ['a', 'b'], 'rows': [['@']]}])), _vary(None))
check('explicit empty', solve(_vary([{'header': ['a'], 'rows': [['']]}, {'header': ['b'], 'rows': [['@']]}])), _vary({'header': ['a', 'b'], 'rows': [['', None], [None, '@']]}))
check('empty', solve(_vary([])), _vary({'header': [], 'rows': []}))
check('header only', solve(_vary([{'header': ['@'], 'rows': []}])), _vary({'header': ['@'], 'rows': []}))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    header=[]
    for table in data:
        if len(set(table['header']))!=len(table['header']): return None
        for name in table['header']:
            if name not in header: header.append(name)
    out=[]
    for table in data:
        for row in table['rows']:
            if len(row)!=len(table['header']): return None
            mapping=dict(zip(table['header'],row))
            out.append([None]*(len(header)-len(row))+row)
    return {'header':header,'rows':out}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('union', solve(_vary([{'header': ['b', 'a'], 'rows': [['@', 'x']]}, {'header': ['a', 'c'], 'rows': [['y', 'z']]}])), _vary({'header': ['b', 'a', 'c'], 'rows': [['@', 'x', None], [None, 'y', 'z']]}))
check('reordered', solve(_vary([{'header': ['a', 'b'], 'rows': [['@', 'x']]}, {'header': ['b', 'a'], 'rows': [['z', 'y']]}])), _vary({'header': ['a', 'b'], 'rows': [['@', 'x'], ['y', 'z']]}))
check('duplicate', solve(_vary([{'header': ['a', 'a'], 'rows': []}])), _vary(None))
check('ragged', solve(_vary([{'header': ['a', 'b'], 'rows': [['@']]}])), _vary(None))
check('explicit empty', solve(_vary([{'header': ['a'], 'rows': [['']]}, {'header': ['b'], 'rows': [['@']]}])), _vary({'header': ['a', 'b'], 'rows': [['', None], [None, '@']]}))
check('empty', solve(_vary([])), _vary({'header': [], 'rows': []}))
check('header only', solve(_vary([{'header': ['@'], 'rows': []}])), _vary({'header': ['@'], 'rows': []}))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A structured table violates the declared record or column contract.

Combine a list of tables, each {header:[names], rows:[[cells]]}. Output header is the first-seen union of names, preserving first-seen order. Duplicate names within one input header and row-width mismatches reject. Missing columns in a table become null; explicit empty values remain empty. Return {header,rows}.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    header=[]
    for table in data:
        if len(set(table['header']))!=len(table['header']): return None
        for name in table['header']:
            if name not in header: header.append(name)
    out=[]
    for table in data:
        for row in table['rows']:
            if len(row)!=len(table['header']): return None
            mapping=dict(zip(table['header'],row))
            out.append([mapping.get(name,'') for name in header])
    return {'header':header,'rows':out}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('union', solve(_vary([{'header': ['b', 'a'], 'rows': [['@', 'x']]}, {'header': ['a', 'c'], 'rows': [['y', 'z']]}])), _vary({'header': ['b', 'a', 'c'], 'rows': [['@', 'x', None], [None, 'y', 'z']]}))
check('reordered', solve(_vary([{'header': ['a', 'b'], 'rows': [['@', 'x']]}, {'header': ['b', 'a'], 'rows': [['z', 'y']]}])), _vary({'header': ['a', 'b'], 'rows': [['@', 'x'], ['y', 'z']]}))
check('duplicate', solve(_vary([{'header': ['a', 'a'], 'rows': []}])), _vary(None))
check('ragged', solve(_vary([{'header': ['a', 'b'], 'rows': [['@']]}])), _vary(None))
check('explicit empty', solve(_vary([{'header': ['a'], 'rows': [['']]}, {'header': ['b'], 'rows': [['@']]}])), _vary({'header': ['a', 'b'], 'rows': [['', None], [None, '@']]}))
check('empty', solve(_vary([])), _vary({'header': [], 'rows': []}))
check('header only', solve(_vary([{'header': ['@'], 'rows': []}])), _vary({'header': ['@'], 'rows': []}))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    header=[]
    for table in data:
        if len(set(table['header']))!=len(table['header']): return None
        for name in table['header']:
            if name not in header: header.append(name)
    out=[]
    for table in data:
        for row in table['rows']:
            if len(row)!=len(table['header']): return None
            mapping=dict(zip(table['header'],row))
            out.append([mapping.get(name,0) for name in header])
    return {'header':header,'rows':out}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('union', solve(_vary([{'header': ['b', 'a'], 'rows': [['@', 'x']]}, {'header': ['a', 'c'], 'rows': [['y', 'z']]}])), _vary({'header': ['b', 'a', 'c'], 'rows': [['@', 'x', None], [None, 'y', 'z']]}))
check('reordered', solve(_vary([{'header': ['a', 'b'], 'rows': [['@', 'x']]}, {'header': ['b', 'a'], 'rows': [['z', 'y']]}])), _vary({'header': ['a', 'b'], 'rows': [['@', 'x'], ['y', 'z']]}))
check('duplicate', solve(_vary([{'header': ['a', 'a'], 'rows': []}])), _vary(None))
check('ragged', solve(_vary([{'header': ['a', 'b'], 'rows': [['@']]}])), _vary(None))
check('explicit empty', solve(_vary([{'header': ['a'], 'rows': [['']]}, {'header': ['b'], 'rows': [['@']]}])), _vary({'header': ['a', 'b'], 'rows': [['', None], [None, '@']]}))
check('empty', solve(_vary([])), _vary({'header': [], 'rows': []}))
check('header only', solve(_vary([{'header': ['@'], 'rows': []}])), _vary({'header': ['@'], 'rows': []}))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A structured table violates the declared record or column contract.

Combine a list of tables, each {header:[names], rows:[[cells]]}. Output header is the first-seen union of names, preserving first-seen order. Duplicate names within one input header and row-width mismatches reject. Missing columns in a table become null; explicit empty values remain empty. Return {header,rows}.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    header=[]
    for table in data:
        if len(set(table['header']))!=len(table['header']): return None
        for name in table['header']:
            if name not in header: header=[name]
    out=[]
    for table in data:
        for row in table['rows']:
            if len(row)!=len(table['header']): return None
            mapping=dict(zip(table['header'],row))
            out.append([mapping.get(name) for name in header])
    return {'header':header,'rows':out}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('union', solve(_vary([{'header': ['b', 'a'], 'rows': [['@', 'x']]}, {'header': ['a', 'c'], 'rows': [['y', 'z']]}])), _vary({'header': ['b', 'a', 'c'], 'rows': [['@', 'x', None], [None, 'y', 'z']]}))
check('reordered', solve(_vary([{'header': ['a', 'b'], 'rows': [['@', 'x']]}, {'header': ['b', 'a'], 'rows': [['z', 'y']]}])), _vary({'header': ['a', 'b'], 'rows': [['@', 'x'], ['y', 'z']]}))
check('duplicate', solve(_vary([{'header': ['a', 'a'], 'rows': []}])), _vary(None))
check('ragged', solve(_vary([{'header': ['a', 'b'], 'rows': [['@']]}])), _vary(None))
check('explicit empty', solve(_vary([{'header': ['a'], 'rows': [['']]}, {'header': ['b'], 'rows': [['@']]}])), _vary({'header': ['a', 'b'], 'rows': [['', None], [None, '@']]}))
check('empty', solve(_vary([])), _vary({'header': [], 'rows': []}))
check('header only', solve(_vary([{'header': ['@'], 'rows': []}])), _vary({'header': ['@'], 'rows': []}))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    header=[]
    for table in data:
        if len(set(table['header']))!=len(table['header']): return None
        for name in table['header']:
            if name not in header: header.insert(0,name)
    out=[]
    for table in data:
        for row in table['rows']:
            if len(row)!=len(table['header']): return None
            mapping=dict(zip(table['header'],row))
            out.append([mapping.get(name) for name in header])
    return {'header':header,'rows':out}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('union', solve(_vary([{'header': ['b', 'a'], 'rows': [['@', 'x']]}, {'header': ['a', 'c'], 'rows': [['y', 'z']]}])), _vary({'header': ['b', 'a', 'c'], 'rows': [['@', 'x', None], [None, 'y', 'z']]}))
check('reordered', solve(_vary([{'header': ['a', 'b'], 'rows': [['@', 'x']]}, {'header': ['b', 'a'], 'rows': [['z', 'y']]}])), _vary({'header': ['a', 'b'], 'rows': [['@', 'x'], ['y', 'z']]}))
check('duplicate', solve(_vary([{'header': ['a', 'a'], 'rows': []}])), _vary(None))
check('ragged', solve(_vary([{'header': ['a', 'b'], 'rows': [['@']]}])), _vary(None))
check('explicit empty', solve(_vary([{'header': ['a'], 'rows': [['']]}, {'header': ['b'], 'rows': [['@']]}])), _vary({'header': ['a', 'b'], 'rows': [['', None], [None, '@']]}))
check('empty', solve(_vary([])), _vary({'header': [], 'rows': []}))
check('header only', solve(_vary([{'header': ['@'], 'rows': []}])), _vary({'header': ['@'], 'rows': []}))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A structured table violates the declared record or column contract.

Combine a list of tables, each {header:[names], rows:[[cells]]}. Output header is the first-seen union of names, preserving first-seen order. Duplicate names within one input header and row-width mismatches reject. Missing columns in a table become null; explicit empty values remain empty. Return {header,rows}.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    header=[]
    for table in data:
        if len(set(table['header']))!=len(table['header']): return None
        for name in table['header']:
            if name not in header: header.append(name)
    out=[]
    for table in data:
        for row in table['rows']:
            if len(row)!=len(table['header']): return None
            mapping=dict(zip(row,table['header']))
            out.append([mapping.get(name) for name in header])
    return {'header':header,'rows':out}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('union', solve(_vary([{'header': ['b', 'a'], 'rows': [['@', 'x']]}, {'header': ['a', 'c'], 'rows': [['y', 'z']]}])), _vary({'header': ['b', 'a', 'c'], 'rows': [['@', 'x', None], [None, 'y', 'z']]}))
check('reordered', solve(_vary([{'header': ['a', 'b'], 'rows': [['@', 'x']]}, {'header': ['b', 'a'], 'rows': [['z', 'y']]}])), _vary({'header': ['a', 'b'], 'rows': [['@', 'x'], ['y', 'z']]}))
check('duplicate', solve(_vary([{'header': ['a', 'a'], 'rows': []}])), _vary(None))
check('ragged', solve(_vary([{'header': ['a', 'b'], 'rows': [['@']]}])), _vary(None))
check('explicit empty', solve(_vary([{'header': ['a'], 'rows': [['']]}, {'header': ['b'], 'rows': [['@']]}])), _vary({'header': ['a', 'b'], 'rows': [['', None], [None, '@']]}))
check('empty', solve(_vary([])), _vary({'header': [], 'rows': []}))
check('header only', solve(_vary([{'header': ['@'], 'rows': []}])), _vary({'header': ['@'], 'rows': []}))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    header=[]
    for table in data:
        if len(set(table['header']))!=len(table['header']): return None
        for name in table['header']:
            if name not in header: header.append(name)
    out=[]
    for table in data:
        for row in table['rows']:
            if len(row)!=len(table['header']): return None
            mapping=dict(zip(sorted(table['header']),row))
            out.append([mapping.get(name) for name in header])
    return {'header':header,'rows':out}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('union', solve(_vary([{'header': ['b', 'a'], 'rows': [['@', 'x']]}, {'header': ['a', 'c'], 'rows': [['y', 'z']]}])), _vary({'header': ['b', 'a', 'c'], 'rows': [['@', 'x', None], [None, 'y', 'z']]}))
check('reordered', solve(_vary([{'header': ['a', 'b'], 'rows': [['@', 'x']]}, {'header': ['b', 'a'], 'rows': [['z', 'y']]}])), _vary({'header': ['a', 'b'], 'rows': [['@', 'x'], ['y', 'z']]}))
check('duplicate', solve(_vary([{'header': ['a', 'a'], 'rows': []}])), _vary(None))
check('ragged', solve(_vary([{'header': ['a', 'b'], 'rows': [['@']]}])), _vary(None))
check('explicit empty', solve(_vary([{'header': ['a'], 'rows': [['']]}, {'header': ['b'], 'rows': [['@']]}])), _vary({'header': ['a', 'b'], 'rows': [['', None], [None, '@']]}))
check('empty', solve(_vary([])), _vary({'header': [], 'rows': []}))
check('header only', solve(_vary([{'header': ['@'], 'rows': []}])), _vary({'header': ['@'], 'rows': []}))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A structured table violates the declared record or column contract.

Combine a list of tables, each {header:[names], rows:[[cells]]}. Output header is the first-seen union of names, preserving first-seen order. Duplicate names within one input header and row-width mismatches reject. Missing columns in a table become null; explicit empty values remain empty. Return {header,rows}.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    labels,values=[],[]
    for line in data['lines']:
        cells=line.split(',')
        label,row=cells[-1],cells[:-1]
        if len(row)!=data['width'] or label in labels: return None
        labels.append(label); values.append(row)
    return {'labels':labels,'values':values}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rows', solve(_vary({'width': 2, 'lines': ['r,@,x', 'q,y,z']})), _vary({'labels': ['r', 'q'], 'values': [['@', 'x'], ['y', 'z']]}))
check('empty label', solve(_vary({'width': 1, 'lines': [',@']})), _vary({'labels': [''], 'values': [['@']]}))
check('duplicate', solve(_vary({'width': 1, 'lines': ['r,@', 'r,z']})), _vary(None))
check('bad width', solve(_vary({'width': 2, 'lines': ['r,@']})), _vary(None))
check('spaces', solve(_vary({'width': 1, 'lines': [' r ,@']})), _vary({'labels': [' r '], 'values': [['@']]}))
check('uppercase label', solve(_vary({'width': 1, 'lines': ['ROW,@']})), _vary({'labels': ['ROW'], 'values': [['@']]}))
check('zero width', solve(_vary({'width': 0, 'lines': ['@']})), _vary({'labels': ['@'], 'values': [[]]}))
check('empty table', solve(_vary({'width': 2, 'lines': []})), _vary({'labels': [], 'values': []}))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    labels,values=[],[]
    for line in data['lines']:
        cells=line.split(',')
        label,row=cells[0],cells
        if len(row)!=data['width'] or label in labels: return None
        labels.append(label); values.append(row)
    return {'labels':labels,'values':values}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rows', solve(_vary({'width': 2, 'lines': ['r,@,x', 'q,y,z']})), _vary({'labels': ['r', 'q'], 'values': [['@', 'x'], ['y', 'z']]}))
check('empty label', solve(_vary({'width': 1, 'lines': [',@']})), _vary({'labels': [''], 'values': [['@']]}))
check('duplicate', solve(_vary({'width': 1, 'lines': ['r,@', 'r,z']})), _vary(None))
check('bad width', solve(_vary({'width': 2, 'lines': ['r,@']})), _vary(None))
check('spaces', solve(_vary({'width': 1, 'lines': [' r ,@']})), _vary({'labels': [' r '], 'values': [['@']]}))
check('uppercase label', solve(_vary({'width': 1, 'lines': ['ROW,@']})), _vary({'labels': ['ROW'], 'values': [['@']]}))
check('zero width', solve(_vary({'width': 0, 'lines': ['@']})), _vary({'labels': ['@'], 'values': [[]]}))
check('empty table', solve(_vary({'width': 2, 'lines': []})), _vary({'labels': [], 'values': []}))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A structured table violates the declared record or column contract.

Decode comma rows with header label followed by data cells. First field is a row label; labels must be unique, including empty label. Return labels and values separately. All data rows have the width specified in data.width; preserve label spelling and row order.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    labels,values=[],[]
    for line in data['lines']:
        cells=line.split(',')
        label,row=cells[0].strip(),cells[1:]
        if len(row)!=data['width'] or label in labels: return None
        labels.append(label); values.append(row)
    return {'labels':labels,'values':values}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rows', solve(_vary({'width': 2, 'lines': ['r,@,x', 'q,y,z']})), _vary({'labels': ['r', 'q'], 'values': [['@', 'x'], ['y', 'z']]}))
check('empty label', solve(_vary({'width': 1, 'lines': [',@']})), _vary({'labels': [''], 'values': [['@']]}))
check('duplicate', solve(_vary({'width': 1, 'lines': ['r,@', 'r,z']})), _vary(None))
check('bad width', solve(_vary({'width': 2, 'lines': ['r,@']})), _vary(None))
check('spaces', solve(_vary({'width': 1, 'lines': [' r ,@']})), _vary({'labels': [' r '], 'values': [['@']]}))
check('uppercase label', solve(_vary({'width': 1, 'lines': ['ROW,@']})), _vary({'labels': ['ROW'], 'values': [['@']]}))
check('zero width', solve(_vary({'width': 0, 'lines': ['@']})), _vary({'labels': ['@'], 'values': [[]]}))
check('empty table', solve(_vary({'width': 2, 'lines': []})), _vary({'labels': [], 'values': []}))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    labels,values=[],[]
    for line in data['lines']:
        cells=line.split(',')
        label,row=cells[0].lower(),cells[1:]
        if len(row)!=data['width'] or label in labels: return None
        labels.append(label); values.append(row)
    return {'labels':labels,'values':values}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rows', solve(_vary({'width': 2, 'lines': ['r,@,x', 'q,y,z']})), _vary({'labels': ['r', 'q'], 'values': [['@', 'x'], ['y', 'z']]}))
check('empty label', solve(_vary({'width': 1, 'lines': [',@']})), _vary({'labels': [''], 'values': [['@']]}))
check('duplicate', solve(_vary({'width': 1, 'lines': ['r,@', 'r,z']})), _vary(None))
check('bad width', solve(_vary({'width': 2, 'lines': ['r,@']})), _vary(None))
check('spaces', solve(_vary({'width': 1, 'lines': [' r ,@']})), _vary({'labels': [' r '], 'values': [['@']]}))
check('uppercase label', solve(_vary({'width': 1, 'lines': ['ROW,@']})), _vary({'labels': ['ROW'], 'values': [['@']]}))
check('zero width', solve(_vary({'width': 0, 'lines': ['@']})), _vary({'labels': ['@'], 'values': [[]]}))
check('empty table', solve(_vary({'width': 2, 'lines': []})), _vary({'labels': [], 'values': []}))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A structured table violates the declared record or column contract.

Decode comma rows with header label followed by data cells. First field is a row label; labels must be unique, including empty label. Return labels and values separately. All data rows have the width specified in data.width; preserve label spelling and row order.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    labels,values=[],[]
    for line in data['lines']:
        cells=line.split(',')
        label,row=cells[0],cells[1:]
        if len(row)!=data['width'] or label in labels: return None
        labels.append(label); values.append([label]+row)
    return {'labels':labels,'values':values}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rows', solve(_vary({'width': 2, 'lines': ['r,@,x', 'q,y,z']})), _vary({'labels': ['r', 'q'], 'values': [['@', 'x'], ['y', 'z']]}))
check('empty label', solve(_vary({'width': 1, 'lines': [',@']})), _vary({'labels': [''], 'values': [['@']]}))
check('duplicate', solve(_vary({'width': 1, 'lines': ['r,@', 'r,z']})), _vary(None))
check('bad width', solve(_vary({'width': 2, 'lines': ['r,@']})), _vary(None))
check('spaces', solve(_vary({'width': 1, 'lines': [' r ,@']})), _vary({'labels': [' r '], 'values': [['@']]}))
check('uppercase label', solve(_vary({'width': 1, 'lines': ['ROW,@']})), _vary({'labels': ['ROW'], 'values': [['@']]}))
check('zero width', solve(_vary({'width': 0, 'lines': ['@']})), _vary({'labels': ['@'], 'values': [[]]}))
check('empty table', solve(_vary({'width': 2, 'lines': []})), _vary({'labels': [], 'values': []}))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    labels,values=[],[]
    for line in data['lines']:
        cells=line.split(',')
        label,row=cells[0],cells[1:]
        if len(row)!=data['width'] or label in labels: return None
        labels.append(label); values.append(row+[label])
    return {'labels':labels,'values':values}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rows', solve(_vary({'width': 2, 'lines': ['r,@,x', 'q,y,z']})), _vary({'labels': ['r', 'q'], 'values': [['@', 'x'], ['y', 'z']]}))
check('empty label', solve(_vary({'width': 1, 'lines': [',@']})), _vary({'labels': [''], 'values': [['@']]}))
check('duplicate', solve(_vary({'width': 1, 'lines': ['r,@', 'r,z']})), _vary(None))
check('bad width', solve(_vary({'width': 2, 'lines': ['r,@']})), _vary(None))
check('spaces', solve(_vary({'width': 1, 'lines': [' r ,@']})), _vary({'labels': [' r '], 'values': [['@']]}))
check('uppercase label', solve(_vary({'width': 1, 'lines': ['ROW,@']})), _vary({'labels': ['ROW'], 'values': [['@']]}))
check('zero width', solve(_vary({'width': 0, 'lines': ['@']})), _vary({'labels': ['@'], 'values': [[]]}))
check('empty table', solve(_vary({'width': 2, 'lines': []})), _vary({'labels': [], 'values': []}))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A structured table violates the declared record or column contract.

Decode comma rows with header label followed by data cells. First field is a row label; labels must be unique, including empty label. Return labels and values separately. All data rows have the width specified in data.width; preserve label spelling and row order.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    labels,values=[],[]
    for line in data['lines']:
        cells=line.split(',')
        label,row=cells[0],cells[1:]
        if len(row)!=data['width'] or label in labels: return None
        labels.append(label); values.append(row)
    return {'labels':sorted(labels),'values':values}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rows', solve(_vary({'width': 2, 'lines': ['r,@,x', 'q,y,z']})), _vary({'labels': ['r', 'q'], 'values': [['@', 'x'], ['y', 'z']]}))
check('empty label', solve(_vary({'width': 1, 'lines': [',@']})), _vary({'labels': [''], 'values': [['@']]}))
check('duplicate', solve(_vary({'width': 1, 'lines': ['r,@', 'r,z']})), _vary(None))
check('bad width', solve(_vary({'width': 2, 'lines': ['r,@']})), _vary(None))
check('spaces', solve(_vary({'width': 1, 'lines': [' r ,@']})), _vary({'labels': [' r '], 'values': [['@']]}))
check('uppercase label', solve(_vary({'width': 1, 'lines': ['ROW,@']})), _vary({'labels': ['ROW'], 'values': [['@']]}))
check('zero width', solve(_vary({'width': 0, 'lines': ['@']})), _vary({'labels': ['@'], 'values': [[]]}))
check('empty table', solve(_vary({'width': 2, 'lines': []})), _vary({'labels': [], 'values': []}))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    labels,values=[],[]
    for line in data['lines']:
        cells=line.split(',')
        label,row=cells[0],cells[1:]
        if len(row)!=data['width'] or label in labels: return None
        labels.append(label); values.append(row)
    return {'labels':list(reversed(labels)),'values':values}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rows', solve(_vary({'width': 2, 'lines': ['r,@,x', 'q,y,z']})), _vary({'labels': ['r', 'q'], 'values': [['@', 'x'], ['y', 'z']]}))
check('empty label', solve(_vary({'width': 1, 'lines': [',@']})), _vary({'labels': [''], 'values': [['@']]}))
check('duplicate', solve(_vary({'width': 1, 'lines': ['r,@', 'r,z']})), _vary(None))
check('bad width', solve(_vary({'width': 2, 'lines': ['r,@']})), _vary(None))
check('spaces', solve(_vary({'width': 1, 'lines': [' r ,@']})), _vary({'labels': [' r '], 'values': [['@']]}))
check('uppercase label', solve(_vary({'width': 1, 'lines': ['ROW,@']})), _vary({'labels': ['ROW'], 'values': [['@']]}))
check('zero width', solve(_vary({'width': 0, 'lines': ['@']})), _vary({'labels': ['@'], 'values': [[]]}))
check('empty table', solve(_vary({'width': 2, 'lines': []})), _vary({'labels': [], 'values': []}))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A structured table violates the declared record or column contract.

Decode comma rows with header label followed by data cells. First field is a row label; labels must be unique, including empty label. Return labels and values separately. All data rows have the width specified in data.width; preserve label spelling and row order.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    labels,values=[],[]
    for line in data['lines']:
        cells=line.split(',')
        label,row=cells[0],cells[1:]
        if len(row)!=data['width'] or label in labels: return None
        labels.append(label if label else str(len(labels))); values.append(row)
    return {'labels':labels,'values':values}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rows', solve(_vary({'width': 2, 'lines': ['r,@,x', 'q,y,z']})), _vary({'labels': ['r', 'q'], 'values': [['@', 'x'], ['y', 'z']]}))
check('empty label', solve(_vary({'width': 1, 'lines': [',@']})), _vary({'labels': [''], 'values': [['@']]}))
check('duplicate', solve(_vary({'width': 1, 'lines': ['r,@', 'r,z']})), _vary(None))
check('bad width', solve(_vary({'width': 2, 'lines': ['r,@']})), _vary(None))
check('spaces', solve(_vary({'width': 1, 'lines': [' r ,@']})), _vary({'labels': [' r '], 'values': [['@']]}))
check('uppercase label', solve(_vary({'width': 1, 'lines': ['ROW,@']})), _vary({'labels': ['ROW'], 'values': [['@']]}))
check('zero width', solve(_vary({'width': 0, 'lines': ['@']})), _vary({'labels': ['@'], 'values': [[]]}))
check('empty table', solve(_vary({'width': 2, 'lines': []})), _vary({'labels': [], 'values': []}))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    labels,values=[],[]
    for line in data['lines']:
        cells=line.split(',')
        label,row=cells[0],cells[1:]
        if len(row)!=data['width'] or label in labels: return None
        labels.append(label if label else None); values.append(row)
    return {'labels':labels,'values':values}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rows', solve(_vary({'width': 2, 'lines': ['r,@,x', 'q,y,z']})), _vary({'labels': ['r', 'q'], 'values': [['@', 'x'], ['y', 'z']]}))
check('empty label', solve(_vary({'width': 1, 'lines': [',@']})), _vary({'labels': [''], 'values': [['@']]}))
check('duplicate', solve(_vary({'width': 1, 'lines': ['r,@', 'r,z']})), _vary(None))
check('bad width', solve(_vary({'width': 2, 'lines': ['r,@']})), _vary(None))
check('spaces', solve(_vary({'width': 1, 'lines': [' r ,@']})), _vary({'labels': [' r '], 'values': [['@']]}))
check('uppercase label', solve(_vary({'width': 1, 'lines': ['ROW,@']})), _vary({'labels': ['ROW'], 'values': [['@']]}))
check('zero width', solve(_vary({'width': 0, 'lines': ['@']})), _vary({'labels': ['@'], 'values': [[]]}))
check('empty table', solve(_vary({'width': 2, 'lines': []})), _vary({'labels': [], 'values': []}))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A structured table violates the declared record or column contract.

Decode comma rows with header label followed by data cells. First field is a row label; labels must be unique, including empty label. Return labels and values separately. All data rows have the width specified in data.width; preserve label spelling and row order.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    slots={}
    for line in data['fragments']:
        parts=line.split('|',1)
        if len(parts)!=2 or not parts[0].isascii() or not parts[0].isdecimal(): return None
        start=int(parts[0]); fields=parts[1].split(',')
        if start+len(fields)>data['width']: return None
        for offset,value in enumerate(fields):
            index=start+offset
            if index in slots: return None
            slots[index]=value
    if len(slots)!=data['width']: return None
    return list(slots.values())
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('out of order', solve(_vary({'width': 4, 'fragments': ['2|x,z', '0|@,y']})), _vary(['@', 'y', 'x', 'z']))
check('overlap', solve(_vary({'width': 3, 'fragments': ['0|a,b', '1|c,d']})), _vary(None))
check('hole', solve(_vary({'width': 3, 'fragments': ['0|@', '2|z']})), _vary(None))
check('overrun', solve(_vary({'width': 2, 'fragments': ['1|a,b']})), _vary(None))
check('empty supplied', solve(_vary({'width': 2, 'fragments': ['1|', '0|@']})), _vary(['@', '']))
check('zero width', solve(_vary({'width': 0, 'fragments': []})), _vary([]))
check('single', solve(_vary({'width': 1, 'fragments': ['0|@']})), _vary(['@']))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    slots={}
    for line in data['fragments']:
        parts=line.split('|',1)
        if len(parts)!=2 or not parts[0].isascii() or not parts[0].isdecimal(): return None
        start=int(parts[0]); fields=parts[1].split(',')
        if start+len(fields)>data['width']: return None
        for offset,value in enumerate(fields):
            index=start+offset
            if index in slots: return None
            slots[index]=value
    if len(slots)!=data['width']: return None
    return list(reversed(list(slots.values())))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('out of order', solve(_vary({'width': 4, 'fragments': ['2|x,z', '0|@,y']})), _vary(['@', 'y', 'x', 'z']))
check('overlap', solve(_vary({'width': 3, 'fragments': ['0|a,b', '1|c,d']})), _vary(None))
check('hole', solve(_vary({'width': 3, 'fragments': ['0|@', '2|z']})), _vary(None))
check('overrun', solve(_vary({'width': 2, 'fragments': ['1|a,b']})), _vary(None))
check('empty supplied', solve(_vary({'width': 2, 'fragments': ['1|', '0|@']})), _vary(['@', '']))
check('zero width', solve(_vary({'width': 0, 'fragments': []})), _vary([]))
check('single', solve(_vary({'width': 1, 'fragments': ['0|@']})), _vary(['@']))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A structured table violates the declared record or column contract.

Assemble one row from pipe fragments offset|comma-fields and a declared width. Offsets are zero-based unsigned ASCII integers. Fragments may arrive out of order, but overlap, overrun and holes reject. Empty fields are real supplied cells. Return the complete physical row.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    slots={}
    for line in data['fragments']:
        parts=line.split('|',1)
        if len(parts)!=2 or not parts[0].isascii() or not parts[0].isdecimal(): return None
        start=len(slots); fields=parts[1].split(',')
        if start+len(fields)>data['width']: return None
        for offset,value in enumerate(fields):
            index=start+offset
            if index in slots: return None
            slots[index]=value
    if len(slots)!=data['width']: return None
    return [slots[index] for index in range(data['width'])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('out of order', solve(_vary({'width': 4, 'fragments': ['2|x,z', '0|@,y']})), _vary(['@', 'y', 'x', 'z']))
check('overlap', solve(_vary({'width': 3, 'fragments': ['0|a,b', '1|c,d']})), _vary(None))
check('hole', solve(_vary({'width': 3, 'fragments': ['0|@', '2|z']})), _vary(None))
check('overrun', solve(_vary({'width': 2, 'fragments': ['1|a,b']})), _vary(None))
check('empty supplied', solve(_vary({'width': 2, 'fragments': ['1|', '0|@']})), _vary(['@', '']))
check('zero width', solve(_vary({'width': 0, 'fragments': []})), _vary([]))
check('single', solve(_vary({'width': 1, 'fragments': ['0|@']})), _vary(['@']))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    slots={}
    for line in data['fragments']:
        parts=line.split('|',1)
        if len(parts)!=2 or not parts[0].isascii() or not parts[0].isdecimal(): return None
        start=0; fields=parts[1].split(',')
        if start+len(fields)>data['width']: return None
        for offset,value in enumerate(fields):
            index=start+offset
            if index in slots: return None
            slots[index]=value
    if len(slots)!=data['width']: return None
    return [slots[index] for index in range(data['width'])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('out of order', solve(_vary({'width': 4, 'fragments': ['2|x,z', '0|@,y']})), _vary(['@', 'y', 'x', 'z']))
check('overlap', solve(_vary({'width': 3, 'fragments': ['0|a,b', '1|c,d']})), _vary(None))
check('hole', solve(_vary({'width': 3, 'fragments': ['0|@', '2|z']})), _vary(None))
check('overrun', solve(_vary({'width': 2, 'fragments': ['1|a,b']})), _vary(None))
check('empty supplied', solve(_vary({'width': 2, 'fragments': ['1|', '0|@']})), _vary(['@', '']))
check('zero width', solve(_vary({'width': 0, 'fragments': []})), _vary([]))
check('single', solve(_vary({'width': 1, 'fragments': ['0|@']})), _vary(['@']))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A structured table violates the declared record or column contract.

Assemble one row from pipe fragments offset|comma-fields and a declared width. Offsets are zero-based unsigned ASCII integers. Fragments may arrive out of order, but overlap, overrun and holes reject. Empty fields are real supplied cells. Return the complete physical row.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    slots={}
    for line in data['fragments']:
        parts=line.split('|',1)
        if len(parts)!=2 or not parts[0].isascii() or not parts[0].isdecimal(): return None
        start=int(parts[0]); fields=parts[1].split(',')
        if start+len(fields)>data['width']: return None
        for offset,value in enumerate(fields):
            index=start+offset
            if False: return None
            slots[index]=value
    if len(slots)!=data['width']: return None
    return [slots[index] for index in range(data['width'])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('out of order', solve(_vary({'width': 4, 'fragments': ['2|x,z', '0|@,y']})), _vary(['@', 'y', 'x', 'z']))
check('overlap', solve(_vary({'width': 3, 'fragments': ['0|a,b', '1|c,d']})), _vary(None))
check('hole', solve(_vary({'width': 3, 'fragments': ['0|@', '2|z']})), _vary(None))
check('overrun', solve(_vary({'width': 2, 'fragments': ['1|a,b']})), _vary(None))
check('empty supplied', solve(_vary({'width': 2, 'fragments': ['1|', '0|@']})), _vary(['@', '']))
check('zero width', solve(_vary({'width': 0, 'fragments': []})), _vary([]))
check('single', solve(_vary({'width': 1, 'fragments': ['0|@']})), _vary(['@']))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    slots={}
    for line in data['fragments']:
        parts=line.split('|',1)
        if len(parts)!=2 or not parts[0].isascii() or not parts[0].isdecimal(): return None
        start=int(parts[0]); fields=parts[1].split(',')
        if start+len(fields)>data['width']: return None
        for offset,value in enumerate(fields):
            index=start+offset
            if index in slots: continue
            slots[index]=value
    if len(slots)!=data['width']: return None
    return [slots[index] for index in range(data['width'])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('out of order', solve(_vary({'width': 4, 'fragments': ['2|x,z', '0|@,y']})), _vary(['@', 'y', 'x', 'z']))
check('overlap', solve(_vary({'width': 3, 'fragments': ['0|a,b', '1|c,d']})), _vary(None))
check('hole', solve(_vary({'width': 3, 'fragments': ['0|@', '2|z']})), _vary(None))
check('overrun', solve(_vary({'width': 2, 'fragments': ['1|a,b']})), _vary(None))
check('empty supplied', solve(_vary({'width': 2, 'fragments': ['1|', '0|@']})), _vary(['@', '']))
check('zero width', solve(_vary({'width': 0, 'fragments': []})), _vary([]))
check('single', solve(_vary({'width': 1, 'fragments': ['0|@']})), _vary(['@']))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A structured table violates the declared record or column contract.

Assemble one row from pipe fragments offset|comma-fields and a declared width. Offsets are zero-based unsigned ASCII integers. Fragments may arrive out of order, but overlap, overrun and holes reject. Empty fields are real supplied cells. Return the complete physical row.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    slots={}
    for line in data['fragments']:
        parts=line.split('|',1)
        if len(parts)!=2 or not parts[0].isascii() or not parts[0].isdecimal(): return None
        start=int(parts[0]); fields=parts[1].split(',')
        if start+len(fields)>data['width']: return None
        for offset,value in enumerate(fields):
            index=start+offset
            if index in slots: return None
            slots[index]=value
    if len(slots)!=data['width']: return [slots.get(i) for i in range(data['width'])]
    return [slots[index] for index in range(data['width'])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('out of order', solve(_vary({'width': 4, 'fragments': ['2|x,z', '0|@,y']})), _vary(['@', 'y', 'x', 'z']))
check('overlap', solve(_vary({'width': 3, 'fragments': ['0|a,b', '1|c,d']})), _vary(None))
check('hole', solve(_vary({'width': 3, 'fragments': ['0|@', '2|z']})), _vary(None))
check('overrun', solve(_vary({'width': 2, 'fragments': ['1|a,b']})), _vary(None))
check('empty supplied', solve(_vary({'width': 2, 'fragments': ['1|', '0|@']})), _vary(['@', '']))
check('zero width', solve(_vary({'width': 0, 'fragments': []})), _vary([]))
check('single', solve(_vary({'width': 1, 'fragments': ['0|@']})), _vary(['@']))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    slots={}
    for line in data['fragments']:
        parts=line.split('|',1)
        if len(parts)!=2 or not parts[0].isascii() or not parts[0].isdecimal(): return None
        start=int(parts[0]); fields=parts[1].split(',')
        if start+len(fields)>data['width']: return None
        for offset,value in enumerate(fields):
            index=start+offset
            if index in slots: return None
            slots[index]=value
    if len(slots)!=data['width']: return list(slots.values())
    return [slots[index] for index in range(data['width'])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('out of order', solve(_vary({'width': 4, 'fragments': ['2|x,z', '0|@,y']})), _vary(['@', 'y', 'x', 'z']))
check('overlap', solve(_vary({'width': 3, 'fragments': ['0|a,b', '1|c,d']})), _vary(None))
check('hole', solve(_vary({'width': 3, 'fragments': ['0|@', '2|z']})), _vary(None))
check('overrun', solve(_vary({'width': 2, 'fragments': ['1|a,b']})), _vary(None))
check('empty supplied', solve(_vary({'width': 2, 'fragments': ['1|', '0|@']})), _vary(['@', '']))
check('zero width', solve(_vary({'width': 0, 'fragments': []})), _vary([]))
check('single', solve(_vary({'width': 1, 'fragments': ['0|@']})), _vary(['@']))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A structured table violates the declared record or column contract.

Assemble one row from pipe fragments offset|comma-fields and a declared width. Offsets are zero-based unsigned ASCII integers. Fragments may arrive out of order, but overlap, overrun and holes reject. Empty fields are real supplied cells. Return the complete physical row.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    slots={}
    for line in data['fragments']:
        parts=line.split('|',1)
        if len(parts)!=2 or not parts[0].isascii() or not parts[0].isdecimal(): return None
        start=int(parts[0]); fields=parts[1].split(',')
        if start+len(fields)>data['width']: return None
        for offset,value in enumerate(fields):
            index=start
            if index in slots: return None
            slots[index]=value
    if len(slots)!=data['width']: return None
    return [slots[index] for index in range(data['width'])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('out of order', solve(_vary({'width': 4, 'fragments': ['2|x,z', '0|@,y']})), _vary(['@', 'y', 'x', 'z']))
check('overlap', solve(_vary({'width': 3, 'fragments': ['0|a,b', '1|c,d']})), _vary(None))
check('hole', solve(_vary({'width': 3, 'fragments': ['0|@', '2|z']})), _vary(None))
check('overrun', solve(_vary({'width': 2, 'fragments': ['1|a,b']})), _vary(None))
check('empty supplied', solve(_vary({'width': 2, 'fragments': ['1|', '0|@']})), _vary(['@', '']))
check('zero width', solve(_vary({'width': 0, 'fragments': []})), _vary([]))
check('single', solve(_vary({'width': 1, 'fragments': ['0|@']})), _vary(['@']))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    slots={}
    for line in data['fragments']:
        parts=line.split('|',1)
        if len(parts)!=2 or not parts[0].isascii() or not parts[0].isdecimal(): return None
        start=int(parts[0]); fields=parts[1].split(',')
        if start+len(fields)>data['width']: return None
        for offset,value in enumerate(fields):
            index=offset
            if index in slots: return None
            slots[index]=value
    if len(slots)!=data['width']: return None
    return [slots[index] for index in range(data['width'])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('out of order', solve(_vary({'width': 4, 'fragments': ['2|x,z', '0|@,y']})), _vary(['@', 'y', 'x', 'z']))
check('overlap', solve(_vary({'width': 3, 'fragments': ['0|a,b', '1|c,d']})), _vary(None))
check('hole', solve(_vary({'width': 3, 'fragments': ['0|@', '2|z']})), _vary(None))
check('overrun', solve(_vary({'width': 2, 'fragments': ['1|a,b']})), _vary(None))
check('empty supplied', solve(_vary({'width': 2, 'fragments': ['1|', '0|@']})), _vary(['@', '']))
check('zero width', solve(_vary({'width': 0, 'fragments': []})), _vary([]))
check('single', solve(_vary({'width': 1, 'fragments': ['0|@']})), _vary(['@']))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A structured table violates the declared record or column contract.

Assemble one row from pipe fragments offset|comma-fields and a declared width. Offsets are zero-based unsigned ASCII integers. Fragments may arrive out of order, but overlap, overrun and holes reject. Empty fields are real supplied cells. Return the complete physical row.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out=[]; logical=0
    for physical,line in enumerate(data['lines'],1):
        if line=='' or line.startswith('#'): continue
        if data['start']<=logical<data['stop']: out.append([physical,line.split(',')])
        logical=physical
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('window', solve(_vary({'lines': ['#note', 'a,b', '', '@,x', 'z,y'], 'start': 1, 'stop': 2})), _vary([[4, ['@', 'x']]]))
check('all', solve(_vary({'lines': ['@,x', 'z,y'], 'start': 0, 'stop': 2})), _vary([[1, ['@', 'x']], [2, ['z', 'y']]]))
check('space line', solve(_vary({'lines': [' ', '@'], 'start': 0, 'stop': 1})), _vary([[1, [' ']]]))
check('empty window', solve(_vary({'lines': ['@'], 'start': 0, 'stop': 0})), _vary([]))
check('beyond', solve(_vary({'lines': ['@'], 'start': 2, 'stop': 4})), _vary([]))
check('indented comment', solve(_vary({'lines': [' #data', '@'], 'start': 0, 'stop': 1})), _vary([[1, [' #data']]]))
check('zero lines', solve(_vary({'lines': [], 'start': 0, 'stop': 3})), _vary([]))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out=[]; logical=0
    for physical,line in enumerate(data['lines'],1):
        if line=='' or line.startswith('#'): continue
        if data['start']<=logical<data['stop']: out.append([physical,line.split(',')])
        logical+=physical
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('window', solve(_vary({'lines': ['#note', 'a,b', '', '@,x', 'z,y'], 'start': 1, 'stop': 2})), _vary([[4, ['@', 'x']]]))
check('all', solve(_vary({'lines': ['@,x', 'z,y'], 'start': 0, 'stop': 2})), _vary([[1, ['@', 'x']], [2, ['z', 'y']]]))
check('space line', solve(_vary({'lines': [' ', '@'], 'start': 0, 'stop': 1})), _vary([[1, [' ']]]))
check('empty window', solve(_vary({'lines': ['@'], 'start': 0, 'stop': 0})), _vary([]))
check('beyond', solve(_vary({'lines': ['@'], 'start': 2, 'stop': 4})), _vary([]))
check('indented comment', solve(_vary({'lines': [' #data', '@'], 'start': 0, 'stop': 1})), _vary([[1, [' #data']]]))
check('zero lines', solve(_vary({'lines': [], 'start': 0, 'stop': 3})), _vary([]))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A structured table violates the declared record or column contract.

Select a half-open zero-based logical row window [start,stop) from physical comma lines. Column-zero # lines and completely empty physical lines are ignored before numbering; whitespace-only lines remain data. Return [one-based physical line number, split cells] for selected logical rows.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out=[]; logical=0
    for physical,line in enumerate(data['lines'],1):
        if line=='' or line.startswith('#'): continue
        if data['start']<=logical<=data['stop']: out.append([physical,line.split(',')])
        logical+=1
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('window', solve(_vary({'lines': ['#note', 'a,b', '', '@,x', 'z,y'], 'start': 1, 'stop': 2})), _vary([[4, ['@', 'x']]]))
check('all', solve(_vary({'lines': ['@,x', 'z,y'], 'start': 0, 'stop': 2})), _vary([[1, ['@', 'x']], [2, ['z', 'y']]]))
check('space line', solve(_vary({'lines': [' ', '@'], 'start': 0, 'stop': 1})), _vary([[1, [' ']]]))
check('empty window', solve(_vary({'lines': ['@'], 'start': 0, 'stop': 0})), _vary([]))
check('beyond', solve(_vary({'lines': ['@'], 'start': 2, 'stop': 4})), _vary([]))
check('indented comment', solve(_vary({'lines': [' #data', '@'], 'start': 0, 'stop': 1})), _vary([[1, [' #data']]]))
check('zero lines', solve(_vary({'lines': [], 'start': 0, 'stop': 3})), _vary([]))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out=[]; logical=0
    for physical,line in enumerate(data['lines'],1):
        if line=='' or line.startswith('#'): continue
        if data['start']<logical<=data['stop']: out.append([physical,line.split(',')])
        logical+=1
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('window', solve(_vary({'lines': ['#note', 'a,b', '', '@,x', 'z,y'], 'start': 1, 'stop': 2})), _vary([[4, ['@', 'x']]]))
check('all', solve(_vary({'lines': ['@,x', 'z,y'], 'start': 0, 'stop': 2})), _vary([[1, ['@', 'x']], [2, ['z', 'y']]]))
check('space line', solve(_vary({'lines': [' ', '@'], 'start': 0, 'stop': 1})), _vary([[1, [' ']]]))
check('empty window', solve(_vary({'lines': ['@'], 'start': 0, 'stop': 0})), _vary([]))
check('beyond', solve(_vary({'lines': ['@'], 'start': 2, 'stop': 4})), _vary([]))
check('indented comment', solve(_vary({'lines': [' #data', '@'], 'start': 0, 'stop': 1})), _vary([[1, [' #data']]]))
check('zero lines', solve(_vary({'lines': [], 'start': 0, 'stop': 3})), _vary([]))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A structured table violates the declared record or column contract.

Select a half-open zero-based logical row window [start,stop) from physical comma lines. Column-zero # lines and completely empty physical lines are ignored before numbering; whitespace-only lines remain data. Return [one-based physical line number, split cells] for selected logical rows.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out=[]; logical=0
    for physical,line in enumerate(data['lines'],1):
        if line=='' or line.startswith('#'): continue
        if data['start']<=logical<data['stop']: out.append([logical+1,line.split(',')])
        logical+=1
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('window', solve(_vary({'lines': ['#note', 'a,b', '', '@,x', 'z,y'], 'start': 1, 'stop': 2})), _vary([[4, ['@', 'x']]]))
check('all', solve(_vary({'lines': ['@,x', 'z,y'], 'start': 0, 'stop': 2})), _vary([[1, ['@', 'x']], [2, ['z', 'y']]]))
check('space line', solve(_vary({'lines': [' ', '@'], 'start': 0, 'stop': 1})), _vary([[1, [' ']]]))
check('empty window', solve(_vary({'lines': ['@'], 'start': 0, 'stop': 0})), _vary([]))
check('beyond', solve(_vary({'lines': ['@'], 'start': 2, 'stop': 4})), _vary([]))
check('indented comment', solve(_vary({'lines': [' #data', '@'], 'start': 0, 'stop': 1})), _vary([[1, [' #data']]]))
check('zero lines', solve(_vary({'lines': [], 'start': 0, 'stop': 3})), _vary([]))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out=[]; logical=0
    for physical,line in enumerate(data['lines'],1):
        if line=='' or line.startswith('#'): continue
        if data['start']<=logical<data['stop']: out.append([len(out)+1,line.split(',')])
        logical+=1
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('window', solve(_vary({'lines': ['#note', 'a,b', '', '@,x', 'z,y'], 'start': 1, 'stop': 2})), _vary([[4, ['@', 'x']]]))
check('all', solve(_vary({'lines': ['@,x', 'z,y'], 'start': 0, 'stop': 2})), _vary([[1, ['@', 'x']], [2, ['z', 'y']]]))
check('space line', solve(_vary({'lines': [' ', '@'], 'start': 0, 'stop': 1})), _vary([[1, [' ']]]))
check('empty window', solve(_vary({'lines': ['@'], 'start': 0, 'stop': 0})), _vary([]))
check('beyond', solve(_vary({'lines': ['@'], 'start': 2, 'stop': 4})), _vary([]))
check('indented comment', solve(_vary({'lines': [' #data', '@'], 'start': 0, 'stop': 1})), _vary([[1, [' #data']]]))
check('zero lines', solve(_vary({'lines': [], 'start': 0, 'stop': 3})), _vary([]))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A structured table violates the declared record or column contract.

Select a half-open zero-based logical row window [start,stop) from physical comma lines. Column-zero # lines and completely empty physical lines are ignored before numbering; whitespace-only lines remain data. Return [one-based physical line number, split cells] for selected logical rows.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out=[]; logical=0
    for physical,line in enumerate(data['lines'],1):
        if not line.strip() or line.startswith('#'): continue
        if data['start']<=logical<data['stop']: out.append([physical,line.split(',')])
        logical+=1
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('window', solve(_vary({'lines': ['#note', 'a,b', '', '@,x', 'z,y'], 'start': 1, 'stop': 2})), _vary([[4, ['@', 'x']]]))
check('all', solve(_vary({'lines': ['@,x', 'z,y'], 'start': 0, 'stop': 2})), _vary([[1, ['@', 'x']], [2, ['z', 'y']]]))
check('space line', solve(_vary({'lines': [' ', '@'], 'start': 0, 'stop': 1})), _vary([[1, [' ']]]))
check('empty window', solve(_vary({'lines': ['@'], 'start': 0, 'stop': 0})), _vary([]))
check('beyond', solve(_vary({'lines': ['@'], 'start': 2, 'stop': 4})), _vary([]))
check('indented comment', solve(_vary({'lines': [' #data', '@'], 'start': 0, 'stop': 1})), _vary([[1, [' #data']]]))
check('zero lines', solve(_vary({'lines': [], 'start': 0, 'stop': 3})), _vary([]))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out=[]; logical=0
    for physical,line in enumerate(data['lines'],1):
        if line.strip()=='' or line.lstrip().startswith('#'): continue
        if data['start']<=logical<data['stop']: out.append([physical,line.split(',')])
        logical+=1
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('window', solve(_vary({'lines': ['#note', 'a,b', '', '@,x', 'z,y'], 'start': 1, 'stop': 2})), _vary([[4, ['@', 'x']]]))
check('all', solve(_vary({'lines': ['@,x', 'z,y'], 'start': 0, 'stop': 2})), _vary([[1, ['@', 'x']], [2, ['z', 'y']]]))
check('space line', solve(_vary({'lines': [' ', '@'], 'start': 0, 'stop': 1})), _vary([[1, [' ']]]))
check('empty window', solve(_vary({'lines': ['@'], 'start': 0, 'stop': 0})), _vary([]))
check('beyond', solve(_vary({'lines': ['@'], 'start': 2, 'stop': 4})), _vary([]))
check('indented comment', solve(_vary({'lines': [' #data', '@'], 'start': 0, 'stop': 1})), _vary([[1, [' #data']]]))
check('zero lines', solve(_vary({'lines': [], 'start': 0, 'stop': 3})), _vary([]))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A structured table violates the declared record or column contract.

Select a half-open zero-based logical row window [start,stop) from physical comma lines. Column-zero # lines and completely empty physical lines are ignored before numbering; whitespace-only lines remain data. Return [one-based physical line number, split cells] for selected logical rows.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out=[]; logical=1
    for physical,line in enumerate(data['lines'],1):
        if line=='' or line.startswith('#'): continue
        if data['start']<=logical<data['stop']: out.append([physical,line.split(',')])
        logical+=1
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('window', solve(_vary({'lines': ['#note', 'a,b', '', '@,x', 'z,y'], 'start': 1, 'stop': 2})), _vary([[4, ['@', 'x']]]))
check('all', solve(_vary({'lines': ['@,x', 'z,y'], 'start': 0, 'stop': 2})), _vary([[1, ['@', 'x']], [2, ['z', 'y']]]))
check('space line', solve(_vary({'lines': [' ', '@'], 'start': 0, 'stop': 1})), _vary([[1, [' ']]]))
check('empty window', solve(_vary({'lines': ['@'], 'start': 0, 'stop': 0})), _vary([]))
check('beyond', solve(_vary({'lines': ['@'], 'start': 2, 'stop': 4})), _vary([]))
check('indented comment', solve(_vary({'lines': [' #data', '@'], 'start': 0, 'stop': 1})), _vary([[1, [' #data']]]))
check('zero lines', solve(_vary({'lines': [], 'start': 0, 'stop': 3})), _vary([]))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out=[]; logical=-1
    for physical,line in enumerate(data['lines'],1):
        if line=='' or line.startswith('#'): continue
        if data['start']<=logical<data['stop']: out.append([physical,line.split(',')])
        logical+=1
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('window', solve(_vary({'lines': ['#note', 'a,b', '', '@,x', 'z,y'], 'start': 1, 'stop': 2})), _vary([[4, ['@', 'x']]]))
check('all', solve(_vary({'lines': ['@,x', 'z,y'], 'start': 0, 'stop': 2})), _vary([[1, ['@', 'x']], [2, ['z', 'y']]]))
check('space line', solve(_vary({'lines': [' ', '@'], 'start': 0, 'stop': 1})), _vary([[1, [' ']]]))
check('empty window', solve(_vary({'lines': ['@'], 'start': 0, 'stop': 0})), _vary([]))
check('beyond', solve(_vary({'lines': ['@'], 'start': 2, 'stop': 4})), _vary([]))
check('indented comment', solve(_vary({'lines': [' #data', '@'], 'start': 0, 'stop': 1})), _vary([[1, [' #data']]]))
check('zero lines', solve(_vary({'lines': [], 'start': 0, 'stop': 3})), _vary([]))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A structured table violates the declared record or column contract.

Select a half-open zero-based logical row window [start,stop) from physical comma lines. Column-zero # lines and completely empty physical lines are ignored before numbering; whitespace-only lines remain data. Return [one-based physical line number, split cells] for selected logical rows.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out=[]
    for line in data:
        cells=line.split(',')
        if cells[0]=='P':
            if len(cells)!=3: return None
            if not cells[2].isascii() or not cells[2].isdecimal() or str(int(cells[2]))!=cells[2]: return None
            out.append({'kind':'person','name':cells[1],'age':cells[2]})
        elif cells[0]=='M':
            if len(cells)!=4: return None
            out.append({'kind':'message','from':cells[1],'to':cells[2],'text':cells[3]})
        else: return None
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mixed', solve(_vary(['P,@,12', 'M,a,b,hello'])), _vary([{'kind': 'person', 'name': '@', 'age': 12}, {'kind': 'message', 'from': 'a', 'to': 'b', 'text': 'hello'}]))
check('empty text', solve(_vary(['M,a,b,'])), _vary([{'kind': 'message', 'from': 'a', 'to': 'b', 'text': ''}]))
check('zero age', solve(_vary(['P,@,0'])), _vary([{'kind': 'person', 'name': '@', 'age': 0}]))
check('bad tag', solve(_vary(['X,a,b'])), _vary(None))
check('wrong person', solve(_vary(['P,a,12,x'])), _vary(None))
check('wrong message', solve(_vary(['M,a,b'])), _vary(None))
check('leading zero', solve(_vary(['P,@,01'])), _vary(None))
check('empty', solve(_vary([])), _vary([]))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out=[]
    for line in data:
        cells=line.split(',')
        if cells[0]=='P':
            if len(cells)!=3: return None
            if not cells[2].isascii() or not cells[2].isdecimal() or str(int(cells[2]))!=cells[2]: return None
            out.append({'kind':'person','name':cells[1],'age':bool(int(cells[2]))})
        elif cells[0]=='M':
            if len(cells)!=4: return None
            out.append({'kind':'message','from':cells[1],'to':cells[2],'text':cells[3]})
        else: return None
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mixed', solve(_vary(['P,@,12', 'M,a,b,hello'])), _vary([{'kind': 'person', 'name': '@', 'age': 12}, {'kind': 'message', 'from': 'a', 'to': 'b', 'text': 'hello'}]))
check('empty text', solve(_vary(['M,a,b,'])), _vary([{'kind': 'message', 'from': 'a', 'to': 'b', 'text': ''}]))
check('zero age', solve(_vary(['P,@,0'])), _vary([{'kind': 'person', 'name': '@', 'age': 0}]))
check('bad tag', solve(_vary(['X,a,b'])), _vary(None))
check('wrong person', solve(_vary(['P,a,12,x'])), _vary(None))
check('wrong message', solve(_vary(['M,a,b'])), _vary(None))
check('leading zero', solve(_vary(['P,@,01'])), _vary(None))
check('empty', solve(_vary([])), _vary([]))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A structured table violates the declared record or column contract.

Decode tagged comma rows. P,name,age represents a person with canonical unsigned ASCII integer age; M,from,to,text represents a message with text that may be empty. Unknown tags and wrong arities reject. Return tagged dictionaries in source order.

split: open-access