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):
    rows, errors = [], []
    for position,line in enumerate(data['lines'], 1):
        cells = line.split(',')
        if len(cells) != 3:
            if data['mode'] == 'strict': return {'error':position}
            if data['mode'] == 'collect': errors.append([position, cells[:3]])
            continue
        rows.append(cells)
    return {'rows':rows, 'errors':errors}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('collect', solve(_vary({'mode': 'collect', 'lines': ['@,a,b', 'x,y', 'c,d,e', 'z']})), _vary({'rows': [['@', 'a', 'b'], ['c', 'd', 'e']], 'errors': [[2, ['x', 'y']], [4, ['z']]]}))
check('strict', solve(_vary({'mode': 'strict', 'lines': ['@,a,b', 'x,y', 'c,d,e']})), _vary({'error': 2}))
check('skip', solve(_vary({'mode': 'skip', 'lines': ['x,y', '@,a,b', 'z']})), _vary({'rows': [['@', 'a', 'b']], 'errors': []}))
check('normal', solve(_vary({'mode': 'strict', 'lines': ['@,a,b']})), _vary({'rows': [['@', 'a', 'b']], 'errors': []}))
check('empty', solve(_vary({'mode': 'collect', 'lines': []})), _vary({'rows': [], 'errors': []}))
check('empty cells', solve(_vary({'mode': 'collect', 'lines': [',,']})), _vary({'rows': [['', '', '']], 'errors': []}))
check('wide', solve(_vary({'mode': 'collect', 'lines': ['a,b,c,d']})), _vary({'rows': [], 'errors': [[1, ['a', 'b', 'c', 'd']]]}))
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):
    rows, errors = [], []
    for position,line in enumerate(data['lines'], 1):
        cells = line.split(',')
        if len(cells) != 3:
            if data['mode'] == 'strict': return {'error':position}
            if data['mode'] == 'collect': errors.append([position, [','.join(cells)]])
            continue
        rows.append(cells)
    return {'rows':rows, 'errors':errors}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('collect', solve(_vary({'mode': 'collect', 'lines': ['@,a,b', 'x,y', 'c,d,e', 'z']})), _vary({'rows': [['@', 'a', 'b'], ['c', 'd', 'e']], 'errors': [[2, ['x', 'y']], [4, ['z']]]}))
check('strict', solve(_vary({'mode': 'strict', 'lines': ['@,a,b', 'x,y', 'c,d,e']})), _vary({'error': 2}))
check('skip', solve(_vary({'mode': 'skip', 'lines': ['x,y', '@,a,b', 'z']})), _vary({'rows': [['@', 'a', 'b']], 'errors': []}))
check('normal', solve(_vary({'mode': 'strict', 'lines': ['@,a,b']})), _vary({'rows': [['@', 'a', 'b']], 'errors': []}))
check('empty', solve(_vary({'mode': 'collect', 'lines': []})), _vary({'rows': [], 'errors': []}))
check('empty cells', solve(_vary({'mode': 'collect', 'lines': [',,']})), _vary({'rows': [['', '', '']], 'errors': []}))
check('wide', solve(_vary({'mode': 'collect', 'lines': ['a,b,c,d']})), _vary({'rows': [], 'errors': [[1, ['a', 'b', 'c', 'd']]]}))
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.

Import three-column comma rows with exact modes strict, skip, or collect. Width failures are 1-based source record positions. Strict returns {error:position}; skip omits bad rows; collect returns valid rows and errors containing position and original cells. Header is supplied separately and not counted.

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):
    rows, errors = [], []
    for position,line in enumerate(data['lines'], 1):
        cells = line.split(',')
        if len(cells) != 3:
            if data['mode'] == 'strict': return {'error':position}
            if data['mode'] != 'strict': errors.append([position, cells])
            continue
        rows.append(cells)
    return {'rows':rows, 'errors':errors}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('collect', solve(_vary({'mode': 'collect', 'lines': ['@,a,b', 'x,y', 'c,d,e', 'z']})), _vary({'rows': [['@', 'a', 'b'], ['c', 'd', 'e']], 'errors': [[2, ['x', 'y']], [4, ['z']]]}))
check('strict', solve(_vary({'mode': 'strict', 'lines': ['@,a,b', 'x,y', 'c,d,e']})), _vary({'error': 2}))
check('skip', solve(_vary({'mode': 'skip', 'lines': ['x,y', '@,a,b', 'z']})), _vary({'rows': [['@', 'a', 'b']], 'errors': []}))
check('normal', solve(_vary({'mode': 'strict', 'lines': ['@,a,b']})), _vary({'rows': [['@', 'a', 'b']], 'errors': []}))
check('empty', solve(_vary({'mode': 'collect', 'lines': []})), _vary({'rows': [], 'errors': []}))
check('empty cells', solve(_vary({'mode': 'collect', 'lines': [',,']})), _vary({'rows': [['', '', '']], 'errors': []}))
check('wide', solve(_vary({'mode': 'collect', 'lines': ['a,b,c,d']})), _vary({'rows': [], 'errors': [[1, ['a', 'b', 'c', 'd']]]}))
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):
    rows, errors = [], []
    for position,line in enumerate(data['lines'], 1):
        cells = line.split(',')
        if len(cells) != 3:
            if data['mode'] == 'strict': return {'error':position}
            if True: errors.append([position, cells])
            continue
        rows.append(cells)
    return {'rows':rows, 'errors':errors}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('collect', solve(_vary({'mode': 'collect', 'lines': ['@,a,b', 'x,y', 'c,d,e', 'z']})), _vary({'rows': [['@', 'a', 'b'], ['c', 'd', 'e']], 'errors': [[2, ['x', 'y']], [4, ['z']]]}))
check('strict', solve(_vary({'mode': 'strict', 'lines': ['@,a,b', 'x,y', 'c,d,e']})), _vary({'error': 2}))
check('skip', solve(_vary({'mode': 'skip', 'lines': ['x,y', '@,a,b', 'z']})), _vary({'rows': [['@', 'a', 'b']], 'errors': []}))
check('normal', solve(_vary({'mode': 'strict', 'lines': ['@,a,b']})), _vary({'rows': [['@', 'a', 'b']], 'errors': []}))
check('empty', solve(_vary({'mode': 'collect', 'lines': []})), _vary({'rows': [], 'errors': []}))
check('empty cells', solve(_vary({'mode': 'collect', 'lines': [',,']})), _vary({'rows': [['', '', '']], 'errors': []}))
check('wide', solve(_vary({'mode': 'collect', 'lines': ['a,b,c,d']})), _vary({'rows': [], 'errors': [[1, ['a', 'b', 'c', 'd']]]}))
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.

Import three-column comma rows with exact modes strict, skip, or collect. Width failures are 1-based source record positions. Strict returns {error:position}; skip omits bad rows; collect returns valid rows and errors containing position and original cells. Header is supplied separately and not counted.

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):
    schemas, rows = {}, []
    for line in data:
        cells = line.split('|')
        if len(cells) < 3: return None
        tag, version, values = cells[0], cells[1], cells[2:]
        if tag == 'S':
            if version in schemas or len(set(values)) != len(values): return None
            schemas[version] = values
        elif tag == 'D':
            if version not in schemas: return None
            header = list(schemas.values())[-1]
            if len(values) != len(header): return None
            rows.append([version, dict(zip(header,values))])
        else: return None
    return rows
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('versions', solve(_vary(['S|unused|x', 'S|1|a|b', 'D|1|@|z', 'S|2|b|a', 'D|2|y|x', 'D|1|m|n'])), _vary([['1', {'a': '@', 'b': 'z'}], ['2', {'b': 'y', 'a': 'x'}], ['1', {'a': 'm', 'b': 'n'}]]))
check('unknown', solve(_vary(['D|1|@'])), _vary(None))
check('immutable', solve(_vary(['S|1|a', 'S|1|b'])), _vary(None))
check('duplicate header', solve(_vary(['S|1|a|a'])), _vary(None))
check('wrong width', solve(_vary(['S|1|a|b', 'D|1|@'])), _vary(None))
check('normal', solve(_vary(['S|@|a', 'D|@|z'])), _vary([['@', {'a': 'z'}]]))
check('bad tag', solve(_vary(['X|1|a'])), _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):
    schemas, rows = {}, []
    for line in data:
        cells = line.split('|')
        if len(cells) < 3: return None
        tag, version, values = cells[0], cells[1], cells[2:]
        if tag == 'S':
            if version in schemas or len(set(values)) != len(values): return None
            schemas[version] = values
        elif tag == 'D':
            if version not in schemas: return None
            header = list(schemas.values())[0]
            if len(values) != len(header): return None
            rows.append([version, dict(zip(header,values))])
        else: return None
    return rows
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('versions', solve(_vary(['S|unused|x', 'S|1|a|b', 'D|1|@|z', 'S|2|b|a', 'D|2|y|x', 'D|1|m|n'])), _vary([['1', {'a': '@', 'b': 'z'}], ['2', {'b': 'y', 'a': 'x'}], ['1', {'a': 'm', 'b': 'n'}]]))
check('unknown', solve(_vary(['D|1|@'])), _vary(None))
check('immutable', solve(_vary(['S|1|a', 'S|1|b'])), _vary(None))
check('duplicate header', solve(_vary(['S|1|a|a'])), _vary(None))
check('wrong width', solve(_vary(['S|1|a|b', 'D|1|@'])), _vary(None))
check('normal', solve(_vary(['S|@|a', 'D|@|z'])), _vary([['@', {'a': 'z'}]]))
check('bad tag', solve(_vary(['X|1|a'])), _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.

Read tagged pipe rows. S|version|headers installs a schema; D|version|values binds a data row to the matching installed version. Revisions are immutable, may be referenced out of installation order, and headers must be unique. Reject unknown version, duplicate revision, or incorrect row width. Return version plus named 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):
    schemas, rows = {}, []
    for line in data:
        cells = line.split('|')
        if len(cells) < 3: return None
        tag, version, values = cells[0], cells[1], cells[2:]
        if tag == 'S':
            if version in schemas or len(set(values)) != len(values): return None
            schemas[version] = values
        elif tag == 'D':
            if version not in schemas: return None
            header = schemas[version]
            if len(values) != len(header): return None
            rows.append([list(schemas)[-1], dict(zip(header,values))])
        else: return None
    return rows
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('versions', solve(_vary(['S|unused|x', 'S|1|a|b', 'D|1|@|z', 'S|2|b|a', 'D|2|y|x', 'D|1|m|n'])), _vary([['1', {'a': '@', 'b': 'z'}], ['2', {'b': 'y', 'a': 'x'}], ['1', {'a': 'm', 'b': 'n'}]]))
check('unknown', solve(_vary(['D|1|@'])), _vary(None))
check('immutable', solve(_vary(['S|1|a', 'S|1|b'])), _vary(None))
check('duplicate header', solve(_vary(['S|1|a|a'])), _vary(None))
check('wrong width', solve(_vary(['S|1|a|b', 'D|1|@'])), _vary(None))
check('normal', solve(_vary(['S|@|a', 'D|@|z'])), _vary([['@', {'a': 'z'}]]))
check('bad tag', solve(_vary(['X|1|a'])), _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):
    schemas, rows = {}, []
    for line in data:
        cells = line.split('|')
        if len(cells) < 3: return None
        tag, version, values = cells[0], cells[1], cells[2:]
        if tag == 'S':
            if version in schemas or len(set(values)) != len(values): return None
            schemas[version] = values
        elif tag == 'D':
            if version not in schemas: return None
            header = schemas[version]
            if len(values) != len(header): return None
            rows.append([list(schemas)[0], dict(zip(header,values))])
        else: return None
    return rows
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('versions', solve(_vary(['S|unused|x', 'S|1|a|b', 'D|1|@|z', 'S|2|b|a', 'D|2|y|x', 'D|1|m|n'])), _vary([['1', {'a': '@', 'b': 'z'}], ['2', {'b': 'y', 'a': 'x'}], ['1', {'a': 'm', 'b': 'n'}]]))
check('unknown', solve(_vary(['D|1|@'])), _vary(None))
check('immutable', solve(_vary(['S|1|a', 'S|1|b'])), _vary(None))
check('duplicate header', solve(_vary(['S|1|a|a'])), _vary(None))
check('wrong width', solve(_vary(['S|1|a|b', 'D|1|@'])), _vary(None))
check('normal', solve(_vary(['S|@|a', 'D|@|z'])), _vary([['@', {'a': 'z'}]]))
check('bad tag', solve(_vary(['X|1|a'])), _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.

Read tagged pipe rows. S|version|headers installs a schema; D|version|values binds a data row to the matching installed version. Revisions are immutable, may be referenced out of installation order, and headers must be unique. Reject unknown version, duplicate revision, or incorrect row width. Return version plus named 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):
    schemas, rows = {}, []
    for line in data:
        cells = line.split('|')
        if len(cells) < 3: return None
        tag, version, values = cells[0], cells[1], cells[2:]
        if tag == 'S':
            if version in schemas or len(set(values)) != len(values): return None
            schemas[version] = sorted(values)
        elif tag == 'D':
            if version not in schemas: return None
            header = schemas[version]
            if len(values) != len(header): return None
            rows.append([version, dict(zip(header,values))])
        else: return None
    return rows
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('versions', solve(_vary(['S|unused|x', 'S|1|a|b', 'D|1|@|z', 'S|2|b|a', 'D|2|y|x', 'D|1|m|n'])), _vary([['1', {'a': '@', 'b': 'z'}], ['2', {'b': 'y', 'a': 'x'}], ['1', {'a': 'm', 'b': 'n'}]]))
check('unknown', solve(_vary(['D|1|@'])), _vary(None))
check('immutable', solve(_vary(['S|1|a', 'S|1|b'])), _vary(None))
check('duplicate header', solve(_vary(['S|1|a|a'])), _vary(None))
check('wrong width', solve(_vary(['S|1|a|b', 'D|1|@'])), _vary(None))
check('normal', solve(_vary(['S|@|a', 'D|@|z'])), _vary([['@', {'a': 'z'}]]))
check('bad tag', solve(_vary(['X|1|a'])), _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):
    schemas, rows = {}, []
    for line in data:
        cells = line.split('|')
        if len(cells) < 3: return None
        tag, version, values = cells[0], cells[1], cells[2:]
        if tag == 'S':
            if version in schemas or len(set(values)) != len(values): return None
            schemas[version] = list(reversed(values))
        elif tag == 'D':
            if version not in schemas: return None
            header = schemas[version]
            if len(values) != len(header): return None
            rows.append([version, dict(zip(header,values))])
        else: return None
    return rows
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('versions', solve(_vary(['S|unused|x', 'S|1|a|b', 'D|1|@|z', 'S|2|b|a', 'D|2|y|x', 'D|1|m|n'])), _vary([['1', {'a': '@', 'b': 'z'}], ['2', {'b': 'y', 'a': 'x'}], ['1', {'a': 'm', 'b': 'n'}]]))
check('unknown', solve(_vary(['D|1|@'])), _vary(None))
check('immutable', solve(_vary(['S|1|a', 'S|1|b'])), _vary(None))
check('duplicate header', solve(_vary(['S|1|a|a'])), _vary(None))
check('wrong width', solve(_vary(['S|1|a|b', 'D|1|@'])), _vary(None))
check('normal', solve(_vary(['S|@|a', 'D|@|z'])), _vary([['@', {'a': 'z'}]]))
check('bad tag', solve(_vary(['X|1|a'])), _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.

Read tagged pipe rows. S|version|headers installs a schema; D|version|values binds a data row to the matching installed version. Revisions are immutable, may be referenced out of installation order, and headers must be unique. Reject unknown version, duplicate revision, or incorrect row width. Return version plus named 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):
    schemas, rows = {}, []
    for line in data:
        cells = line.split('|')
        if len(cells) < 3: return None
        tag, version, values = cells[0], cells[1], cells[2:]
        if tag == 'S':
            if len(set(values)) != len(values): return None
            schemas[version] = values
        elif tag == 'D':
            if version not in schemas: return None
            header = schemas[version]
            if len(values) != len(header): return None
            rows.append([version, dict(zip(header,values))])
        else: return None
    return rows
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('versions', solve(_vary(['S|unused|x', 'S|1|a|b', 'D|1|@|z', 'S|2|b|a', 'D|2|y|x', 'D|1|m|n'])), _vary([['1', {'a': '@', 'b': 'z'}], ['2', {'b': 'y', 'a': 'x'}], ['1', {'a': 'm', 'b': 'n'}]]))
check('unknown', solve(_vary(['D|1|@'])), _vary(None))
check('immutable', solve(_vary(['S|1|a', 'S|1|b'])), _vary(None))
check('duplicate header', solve(_vary(['S|1|a|a'])), _vary(None))
check('wrong width', solve(_vary(['S|1|a|b', 'D|1|@'])), _vary(None))
check('normal', solve(_vary(['S|@|a', 'D|@|z'])), _vary([['@', {'a': 'z'}]]))
check('bad tag', solve(_vary(['X|1|a'])), _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):
    schemas, rows = {}, []
    for line in data:
        cells = line.split('|')
        if len(cells) < 3: return None
        tag, version, values = cells[0], cells[1], cells[2:]
        if tag == 'S':
            if version in schemas: continue
            if len(set(values)) != len(values): return None
            schemas[version] = values
        elif tag == 'D':
            if version not in schemas: return None
            header = schemas[version]
            if len(values) != len(header): return None
            rows.append([version, dict(zip(header,values))])
        else: return None
    return rows
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('versions', solve(_vary(['S|unused|x', 'S|1|a|b', 'D|1|@|z', 'S|2|b|a', 'D|2|y|x', 'D|1|m|n'])), _vary([['1', {'a': '@', 'b': 'z'}], ['2', {'b': 'y', 'a': 'x'}], ['1', {'a': 'm', 'b': 'n'}]]))
check('unknown', solve(_vary(['D|1|@'])), _vary(None))
check('immutable', solve(_vary(['S|1|a', 'S|1|b'])), _vary(None))
check('duplicate header', solve(_vary(['S|1|a|a'])), _vary(None))
check('wrong width', solve(_vary(['S|1|a|b', 'D|1|@'])), _vary(None))
check('normal', solve(_vary(['S|@|a', 'D|@|z'])), _vary([['@', {'a': 'z'}]]))
check('bad tag', solve(_vary(['X|1|a'])), _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.

Read tagged pipe rows. S|version|headers installs a schema; D|version|values binds a data row to the matching installed version. Revisions are immutable, may be referenced out of installation order, and headers must be unique. Reject unknown version, duplicate revision, or incorrect row width. Return version plus named 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):
    schemas, rows = {}, []
    for line in data:
        cells = line.split('|')
        if len(cells) < 3: return None
        tag, version, values = cells[0], cells[1], cells[2:]
        if tag == 'S':
            if version in schemas or len(set(values)) != len(values): return None
            schemas[version] = values
        elif tag == 'D':
            if version not in schemas: return None
            header = schemas[version]
            if len(values) != len(header): return None
            rows.append([version, dict(zip(header,values))])
        else: continue
    return rows
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('versions', solve(_vary(['S|unused|x', 'S|1|a|b', 'D|1|@|z', 'S|2|b|a', 'D|2|y|x', 'D|1|m|n'])), _vary([['1', {'a': '@', 'b': 'z'}], ['2', {'b': 'y', 'a': 'x'}], ['1', {'a': 'm', 'b': 'n'}]]))
check('unknown', solve(_vary(['D|1|@'])), _vary(None))
check('immutable', solve(_vary(['S|1|a', 'S|1|b'])), _vary(None))
check('duplicate header', solve(_vary(['S|1|a|a'])), _vary(None))
check('wrong width', solve(_vary(['S|1|a|b', 'D|1|@'])), _vary(None))
check('normal', solve(_vary(['S|@|a', 'D|@|z'])), _vary([['@', {'a': 'z'}]]))
check('bad tag', solve(_vary(['X|1|a'])), _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):
    schemas, rows = {}, []
    for line in data:
        cells = line.split('|')
        if len(cells) < 3: return None
        tag, version, values = cells[0], cells[1], cells[2:]
        if tag == 'S':
            if version in schemas or len(set(values)) != len(values): return None
            schemas[version] = values
        elif tag == 'D':
            if version not in schemas: return None
            header = schemas[version]
            if len(values) != len(header): return None
            rows.append([version, dict(zip(header,values))])
        else: rows.append([version, values])
    return rows
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('versions', solve(_vary(['S|unused|x', 'S|1|a|b', 'D|1|@|z', 'S|2|b|a', 'D|2|y|x', 'D|1|m|n'])), _vary([['1', {'a': '@', 'b': 'z'}], ['2', {'b': 'y', 'a': 'x'}], ['1', {'a': 'm', 'b': 'n'}]]))
check('unknown', solve(_vary(['D|1|@'])), _vary(None))
check('immutable', solve(_vary(['S|1|a', 'S|1|b'])), _vary(None))
check('duplicate header', solve(_vary(['S|1|a|a'])), _vary(None))
check('wrong width', solve(_vary(['S|1|a|b', 'D|1|@'])), _vary(None))
check('normal', solve(_vary(['S|@|a', 'D|@|z'])), _vary([['@', {'a': 'z'}]]))
check('bad tag', solve(_vary(['X|1|a'])), _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.

Read tagged pipe rows. S|version|headers installs a schema; D|version|values binds a data row to the matching installed version. Revisions are immutable, may be referenced out of installation order, and headers must be unique. Reject unknown version, duplicate revision, or incorrect row width. Return version plus named 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, active, fields = [], None, {}
    for line in data:
        cells = line.split('|')
        tag = cells[0]
        if tag == 'B' and len(cells) == 2:
            if False: return None
            active, fields = cells[1], {}
        elif tag == 'V' and len(cells) == 3:
            if active is None or cells[1] in fields: return None
            fields[cells[1]] = cells[2]
        elif tag == 'E' and len(cells) == 2:
            if active is None or cells[1] != active: return None
            out.append([active, fields])
            active = None
        else: return None
    if active is not None: return None
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('groups', solve(_vary(['B|@', 'V|a|x', 'E|@', 'B|other', 'V|a|y', 'E|other'])), _vary([['@', {'a': 'x'}], ['other', {'a': 'y'}]]))
check('nested', solve(_vary(['B|a', 'B|b', 'E|b'])), _vary(None))
check('orphan', solve(_vary(['V|a|x'])), _vary(None))
check('mismatch', solve(_vary(['B|a', 'E|b'])), _vary(None))
check('unclosed', solve(_vary(['B|@', 'V|a|x'])), _vary(None))
check('duplicate', solve(_vary(['B|a', 'V|x|1', 'V|x|2', 'E|a'])), _vary(None))
check('empty object', solve(_vary(['B|a', 'E|a'])), _vary([['a', {}]]))
check('empty value', solve(_vary(['B|a', 'V|x|', 'E|a'])), _vary([['a', {'x': ''}]]))
check('zero', 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, active, fields = [], None, {}
    for line in data:
        cells = line.split('|')
        tag = cells[0]
        if tag == 'B' and len(cells) == 2:
            if active is not None: out.append([active,fields])
            active, fields = cells[1], {}
        elif tag == 'V' and len(cells) == 3:
            if active is None or cells[1] in fields: return None
            fields[cells[1]] = cells[2]
        elif tag == 'E' and len(cells) == 2:
            if active is None or cells[1] != active: return None
            out.append([active, fields])
            active = None
        else: return None
    if active is not None: return None
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('groups', solve(_vary(['B|@', 'V|a|x', 'E|@', 'B|other', 'V|a|y', 'E|other'])), _vary([['@', {'a': 'x'}], ['other', {'a': 'y'}]]))
check('nested', solve(_vary(['B|a', 'B|b', 'E|b'])), _vary(None))
check('orphan', solve(_vary(['V|a|x'])), _vary(None))
check('mismatch', solve(_vary(['B|a', 'E|b'])), _vary(None))
check('unclosed', solve(_vary(['B|@', 'V|a|x'])), _vary(None))
check('duplicate', solve(_vary(['B|a', 'V|x|1', 'V|x|2', 'E|a'])), _vary(None))
check('empty object', solve(_vary(['B|a', 'E|a'])), _vary([['a', {}]]))
check('empty value', solve(_vary(['B|a', 'V|x|', 'E|a'])), _vary([['a', {'x': ''}]]))
check('zero', 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.

Read pipe rows: B|id opens an object, V|key|value adds a unique field, E|id closes and emits it. Nested begins, values outside an object, mismatched closes and EOF-open objects reject. Closed objects may reuse field keys. Preserve object order and text including empty values.

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, active, fields = [], None, {}
    for line in data:
        cells = line.split('|')
        tag = cells[0]
        if tag == 'B' and len(cells) == 2:
            if active is not None: return None
            active = cells[1]
        elif tag == 'V' and len(cells) == 3:
            if active is None or cells[1] in fields: return None
            fields[cells[1]] = cells[2]
        elif tag == 'E' and len(cells) == 2:
            if active is None or cells[1] != active: return None
            out.append([active, fields])
            active = None
        else: return None
    if active is not None: return None
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('groups', solve(_vary(['B|@', 'V|a|x', 'E|@', 'B|other', 'V|a|y', 'E|other'])), _vary([['@', {'a': 'x'}], ['other', {'a': 'y'}]]))
check('nested', solve(_vary(['B|a', 'B|b', 'E|b'])), _vary(None))
check('orphan', solve(_vary(['V|a|x'])), _vary(None))
check('mismatch', solve(_vary(['B|a', 'E|b'])), _vary(None))
check('unclosed', solve(_vary(['B|@', 'V|a|x'])), _vary(None))
check('duplicate', solve(_vary(['B|a', 'V|x|1', 'V|x|2', 'E|a'])), _vary(None))
check('empty object', solve(_vary(['B|a', 'E|a'])), _vary([['a', {}]]))
check('empty value', solve(_vary(['B|a', 'V|x|', 'E|a'])), _vary([['a', {'x': ''}]]))
check('zero', 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, active, fields = [], None, {}
    for line in data:
        cells = line.split('|')
        tag = cells[0]
        if tag == 'B' and len(cells) == 2:
            if active is not None: return None
            active, fields = cells[1], dict(fields)
        elif tag == 'V' and len(cells) == 3:
            if active is None or cells[1] in fields: return None
            fields[cells[1]] = cells[2]
        elif tag == 'E' and len(cells) == 2:
            if active is None or cells[1] != active: return None
            out.append([active, fields])
            active = None
        else: return None
    if active is not None: return None
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('groups', solve(_vary(['B|@', 'V|a|x', 'E|@', 'B|other', 'V|a|y', 'E|other'])), _vary([['@', {'a': 'x'}], ['other', {'a': 'y'}]]))
check('nested', solve(_vary(['B|a', 'B|b', 'E|b'])), _vary(None))
check('orphan', solve(_vary(['V|a|x'])), _vary(None))
check('mismatch', solve(_vary(['B|a', 'E|b'])), _vary(None))
check('unclosed', solve(_vary(['B|@', 'V|a|x'])), _vary(None))
check('duplicate', solve(_vary(['B|a', 'V|x|1', 'V|x|2', 'E|a'])), _vary(None))
check('empty object', solve(_vary(['B|a', 'E|a'])), _vary([['a', {}]]))
check('empty value', solve(_vary(['B|a', 'V|x|', 'E|a'])), _vary([['a', {'x': ''}]]))
check('zero', 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.

Read pipe rows: B|id opens an object, V|key|value adds a unique field, E|id closes and emits it. Nested begins, values outside an object, mismatched closes and EOF-open objects reject. Closed objects may reuse field keys. Preserve object order and text including empty values.

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, active, fields = [], None, {}
    for line in data:
        cells = line.split('|')
        tag = cells[0]
        if tag == 'B' and len(cells) == 2:
            if active is not None: return None
            active, fields = cells[1], {}
        elif tag == 'V' and len(cells) == 3:
            if active is None or cells[1] in fields: return None
            fields[cells[1]] = cells[2]
        elif tag == 'E' and len(cells) == 2:
            if active is None: return None
            out.append([active, fields])
            active = None
        else: return None
    if active is not None: return None
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('groups', solve(_vary(['B|@', 'V|a|x', 'E|@', 'B|other', 'V|a|y', 'E|other'])), _vary([['@', {'a': 'x'}], ['other', {'a': 'y'}]]))
check('nested', solve(_vary(['B|a', 'B|b', 'E|b'])), _vary(None))
check('orphan', solve(_vary(['V|a|x'])), _vary(None))
check('mismatch', solve(_vary(['B|a', 'E|b'])), _vary(None))
check('unclosed', solve(_vary(['B|@', 'V|a|x'])), _vary(None))
check('duplicate', solve(_vary(['B|a', 'V|x|1', 'V|x|2', 'E|a'])), _vary(None))
check('empty object', solve(_vary(['B|a', 'E|a'])), _vary([['a', {}]]))
check('empty value', solve(_vary(['B|a', 'V|x|', 'E|a'])), _vary([['a', {'x': ''}]]))
check('zero', 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, active, fields = [], None, {}
    for line in data:
        cells = line.split('|')
        tag = cells[0]
        if tag == 'B' and len(cells) == 2:
            if active is not None: return None
            active, fields = cells[1], {}
        elif tag == 'V' and len(cells) == 3:
            if active is None or cells[1] in fields: return None
            fields[cells[1]] = cells[2]
        elif tag == 'E' and len(cells) == 2:
            if active is None or not cells[1]: return None
            out.append([active, fields])
            active = None
        else: return None
    if active is not None: return None
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('groups', solve(_vary(['B|@', 'V|a|x', 'E|@', 'B|other', 'V|a|y', 'E|other'])), _vary([['@', {'a': 'x'}], ['other', {'a': 'y'}]]))
check('nested', solve(_vary(['B|a', 'B|b', 'E|b'])), _vary(None))
check('orphan', solve(_vary(['V|a|x'])), _vary(None))
check('mismatch', solve(_vary(['B|a', 'E|b'])), _vary(None))
check('unclosed', solve(_vary(['B|@', 'V|a|x'])), _vary(None))
check('duplicate', solve(_vary(['B|a', 'V|x|1', 'V|x|2', 'E|a'])), _vary(None))
check('empty object', solve(_vary(['B|a', 'E|a'])), _vary([['a', {}]]))
check('empty value', solve(_vary(['B|a', 'V|x|', 'E|a'])), _vary([['a', {'x': ''}]]))
check('zero', 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.

Read pipe rows: B|id opens an object, V|key|value adds a unique field, E|id closes and emits it. Nested begins, values outside an object, mismatched closes and EOF-open objects reject. Closed objects may reuse field keys. Preserve object order and text including empty values.

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, active, fields = [], None, {}
    for line in data:
        cells = line.split('|')
        tag = cells[0]
        if tag == 'B' and len(cells) == 2:
            if active is not None: return None
            active, fields = cells[1], {}
        elif tag == 'V' and len(cells) == 3:
            if active is None or cells[1] in fields: return None
            fields[cells[1]] = cells[2]
        elif tag == 'E' and len(cells) == 2:
            if active is None or cells[1] != active: return None
            out.append([active, fields])
            active = active
        else: return None
    if active is not None: return None
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('groups', solve(_vary(['B|@', 'V|a|x', 'E|@', 'B|other', 'V|a|y', 'E|other'])), _vary([['@', {'a': 'x'}], ['other', {'a': 'y'}]]))
check('nested', solve(_vary(['B|a', 'B|b', 'E|b'])), _vary(None))
check('orphan', solve(_vary(['V|a|x'])), _vary(None))
check('mismatch', solve(_vary(['B|a', 'E|b'])), _vary(None))
check('unclosed', solve(_vary(['B|@', 'V|a|x'])), _vary(None))
check('duplicate', solve(_vary(['B|a', 'V|x|1', 'V|x|2', 'E|a'])), _vary(None))
check('empty object', solve(_vary(['B|a', 'E|a'])), _vary([['a', {}]]))
check('empty value', solve(_vary(['B|a', 'V|x|', 'E|a'])), _vary([['a', {'x': ''}]]))
check('zero', 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, active, fields = [], None, {}
    for line in data:
        cells = line.split('|')
        tag = cells[0]
        if tag == 'B' and len(cells) == 2:
            if active is not None: return None
            active, fields = cells[1], {}
        elif tag == 'V' and len(cells) == 3:
            if active is None or cells[1] in fields: return None
            fields[cells[1]] = cells[2]
        elif tag == 'E' and len(cells) == 2:
            if active is None or cells[1] != active: return None
            out.append([active, fields])
            active = ''
        else: return None
    if active is not None: return None
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('groups', solve(_vary(['B|@', 'V|a|x', 'E|@', 'B|other', 'V|a|y', 'E|other'])), _vary([['@', {'a': 'x'}], ['other', {'a': 'y'}]]))
check('nested', solve(_vary(['B|a', 'B|b', 'E|b'])), _vary(None))
check('orphan', solve(_vary(['V|a|x'])), _vary(None))
check('mismatch', solve(_vary(['B|a', 'E|b'])), _vary(None))
check('unclosed', solve(_vary(['B|@', 'V|a|x'])), _vary(None))
check('duplicate', solve(_vary(['B|a', 'V|x|1', 'V|x|2', 'E|a'])), _vary(None))
check('empty object', solve(_vary(['B|a', 'E|a'])), _vary([['a', {}]]))
check('empty value', solve(_vary(['B|a', 'V|x|', 'E|a'])), _vary([['a', {'x': ''}]]))
check('zero', 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.

Read pipe rows: B|id opens an object, V|key|value adds a unique field, E|id closes and emits it. Nested begins, values outside an object, mismatched closes and EOF-open objects reject. Closed objects may reuse field keys. Preserve object order and text including empty values.

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, active, fields = [], None, {}
    for line in data:
        cells = line.split('|')
        tag = cells[0]
        if tag == 'B' and len(cells) == 2:
            if active is not None: return None
            active, fields = cells[1], {}
        elif tag == 'V' and len(cells) == 3:
            if active is None or cells[1] in fields: return None
            fields[cells[1]] = cells[2]
        elif tag == 'E' and len(cells) == 2:
            if active is None or cells[1] != active: return None
            out.append([active, fields])
            active = None
        else: return None
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('groups', solve(_vary(['B|@', 'V|a|x', 'E|@', 'B|other', 'V|a|y', 'E|other'])), _vary([['@', {'a': 'x'}], ['other', {'a': 'y'}]]))
check('nested', solve(_vary(['B|a', 'B|b', 'E|b'])), _vary(None))
check('orphan', solve(_vary(['V|a|x'])), _vary(None))
check('mismatch', solve(_vary(['B|a', 'E|b'])), _vary(None))
check('unclosed', solve(_vary(['B|@', 'V|a|x'])), _vary(None))
check('duplicate', solve(_vary(['B|a', 'V|x|1', 'V|x|2', 'E|a'])), _vary(None))
check('empty object', solve(_vary(['B|a', 'E|a'])), _vary([['a', {}]]))
check('empty value', solve(_vary(['B|a', 'V|x|', 'E|a'])), _vary([['a', {'x': ''}]]))
check('zero', 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, active, fields = [], None, {}
    for line in data:
        cells = line.split('|')
        tag = cells[0]
        if tag == 'B' and len(cells) == 2:
            if active is not None: return None
            active, fields = cells[1], {}
        elif tag == 'V' and len(cells) == 3:
            if active is None or cells[1] in fields: return None
            fields[cells[1]] = cells[2]
        elif tag == 'E' and len(cells) == 2:
            if active is None or cells[1] != active: return None
            out.append([active, fields])
            active = None
        else: return None
    if active is not None: out.append([active,fields])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('groups', solve(_vary(['B|@', 'V|a|x', 'E|@', 'B|other', 'V|a|y', 'E|other'])), _vary([['@', {'a': 'x'}], ['other', {'a': 'y'}]]))
check('nested', solve(_vary(['B|a', 'B|b', 'E|b'])), _vary(None))
check('orphan', solve(_vary(['V|a|x'])), _vary(None))
check('mismatch', solve(_vary(['B|a', 'E|b'])), _vary(None))
check('unclosed', solve(_vary(['B|@', 'V|a|x'])), _vary(None))
check('duplicate', solve(_vary(['B|a', 'V|x|1', 'V|x|2', 'E|a'])), _vary(None))
check('empty object', solve(_vary(['B|a', 'E|a'])), _vary([['a', {}]]))
check('empty value', solve(_vary(['B|a', 'V|x|', 'E|a'])), _vary([['a', {'x': ''}]]))
check('zero', 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.

Read pipe rows: B|id opens an object, V|key|value adds a unique field, E|id closes and emits it. Nested begins, values outside an object, mismatched closes and EOF-open objects reject. Closed objects may reuse field keys. Preserve object order and text including empty values.

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):
    rows, previous = [], None
    for line in data:
        cells = line.split(';')
        if len(cells) != 2: return None
        row = []
        for i, cell in enumerate(cells):
            if cell == '^':
                if previous is None: return None
                value = previous[i]
            else:
                if not cell or cell[0] not in '=+-': return None
                digits = cell[1:]
                if not digits.isascii() or not digits.isdecimal(): return None
                amount = int(digits)
                if cell[0] == '=': value = amount
                else:
                    if previous is None: return None
                    value = previous[i] + amount
            row.append(value)
        rows.append(row)
        previous = row
    return rows
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('deltas', solve(_vary(['=10;=20', '+3;-2', '-1;+4'])), _vary([[10, 20], [13, 18], [12, 22]]))
check('absolute reset', solve(_vary(['=10;=20', '=1;^', '+2;+3'])), _vary([[10, 20], [1, 20], [3, 23]]))
check('initial delta', solve(_vary(['+1;=2'])), _vary(None))
check('initial copy', solve(_vary(['^;=2'])), _vary(None))
check('bad amount', solve(_vary(['=a;=2'])), _vary(None))
check('empty amount', solve(_vary(['=;=2'])), _vary(None))
check('empty table', solve(_vary([])), _vary([]))
check('zero deltas', solve(_vary(['=0;=1', '+0;-0'])), _vary([[0, 1], [0, 1]]))
check('variant delta magnitude', solve(['='+str(N)+';=2','+3;-1']), [[N,2],[N+3,1]])
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):
    rows, previous = [], None
    for line in data:
        cells = line.split(';')
        if len(cells) != 2: return None
        row = []
        for i, cell in enumerate(cells):
            if cell == '^':
                if previous is None: return None
                value = previous[i]
            else:
                if not cell or cell[0] not in '=+-': return None
                digits = cell[1:]
                if not digits.isascii() or not digits.isdecimal(): return None
                amount = int(digits)
                if cell[0] == '=': value = amount
                else:
                    if previous is None: return None
                    value = previous[i] + (-amount if cell[0] == '+' else amount)
            row.append(value)
        rows.append(row)
        previous = row
    return rows
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('deltas', solve(_vary(['=10;=20', '+3;-2', '-1;+4'])), _vary([[10, 20], [13, 18], [12, 22]]))
check('absolute reset', solve(_vary(['=10;=20', '=1;^', '+2;+3'])), _vary([[10, 20], [1, 20], [3, 23]]))
check('initial delta', solve(_vary(['+1;=2'])), _vary(None))
check('initial copy', solve(_vary(['^;=2'])), _vary(None))
check('bad amount', solve(_vary(['=a;=2'])), _vary(None))
check('empty amount', solve(_vary(['=;=2'])), _vary(None))
check('empty table', solve(_vary([])), _vary([]))
check('zero deltas', solve(_vary(['=0;=1', '+0;-0'])), _vary([[0, 1], [0, 1]]))
check('variant delta magnitude', solve(['='+str(N)+';=2','+3;-1']), [[N,2],[N+3,1]])
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 two-column semicolon rows. A first row must contain absolute ASCII integer cells prefixed =. Later cells may use signed integer deltas prefixed + or -, or =absolute. A caret copies prior column value. Return numeric rows. Empty tokens and noncanonical nondecimal tokens reject.

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):
    rows, previous = [], None
    for line in data:
        cells = line.split(';')
        if len(cells) != 2: return None
        row = []
        for i, cell in enumerate(cells):
            if cell == '^':
                if previous is None: return None
                value = previous[i]
            else:
                if not cell or cell[0] not in '=+-': return None
                digits = cell[1:]
                if not digits.isascii() or not digits.isdecimal(): return None
                amount = int(digits)
                if cell[0] == '=': value = amount
                else:
                    if previous is None: return None
                    value = previous[i] + (amount if cell[0] == '+' else -amount)
            row.append(value)
        rows.append(row)
        if previous is None: previous = row
    return rows
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('deltas', solve(_vary(['=10;=20', '+3;-2', '-1;+4'])), _vary([[10, 20], [13, 18], [12, 22]]))
check('absolute reset', solve(_vary(['=10;=20', '=1;^', '+2;+3'])), _vary([[10, 20], [1, 20], [3, 23]]))
check('initial delta', solve(_vary(['+1;=2'])), _vary(None))
check('initial copy', solve(_vary(['^;=2'])), _vary(None))
check('bad amount', solve(_vary(['=a;=2'])), _vary(None))
check('empty amount', solve(_vary(['=;=2'])), _vary(None))
check('empty table', solve(_vary([])), _vary([]))
check('zero deltas', solve(_vary(['=0;=1', '+0;-0'])), _vary([[0, 1], [0, 1]]))
check('variant delta magnitude', solve(['='+str(N)+';=2','+3;-1']), [[N,2],[N+3,1]])
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):
    rows, previous = [], None
    for line in data:
        cells = line.split(';')
        if len(cells) != 2: return None
        row = []
        for i, cell in enumerate(cells):
            if cell == '^':
                if previous is None: return None
                value = previous[i]
            else:
                if not cell or cell[0] not in '=+-': return None
                digits = cell[1:]
                if not digits.isascii() or not digits.isdecimal(): return None
                amount = int(digits)
                if cell[0] == '=': value = amount
                else:
                    if previous is None: return None
                    value = previous[i] + (amount if cell[0] == '+' else -amount)
            row.append(value)
        rows.append(row)
        previous = rows[0]
    return rows
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('deltas', solve(_vary(['=10;=20', '+3;-2', '-1;+4'])), _vary([[10, 20], [13, 18], [12, 22]]))
check('absolute reset', solve(_vary(['=10;=20', '=1;^', '+2;+3'])), _vary([[10, 20], [1, 20], [3, 23]]))
check('initial delta', solve(_vary(['+1;=2'])), _vary(None))
check('initial copy', solve(_vary(['^;=2'])), _vary(None))
check('bad amount', solve(_vary(['=a;=2'])), _vary(None))
check('empty amount', solve(_vary(['=;=2'])), _vary(None))
check('empty table', solve(_vary([])), _vary([]))
check('zero deltas', solve(_vary(['=0;=1', '+0;-0'])), _vary([[0, 1], [0, 1]]))
check('variant delta magnitude', solve(['='+str(N)+';=2','+3;-1']), [[N,2],[N+3,1]])
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 two-column semicolon rows. A first row must contain absolute ASCII integer cells prefixed =. Later cells may use signed integer deltas prefixed + or -, or =absolute. A caret copies prior column value. Return numeric rows. Empty tokens and noncanonical nondecimal tokens reject.

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):
    rows, previous = [], None
    for line in data:
        cells = line.split(';')
        if len(cells) != 2: return None
        row = []
        for i, cell in enumerate(cells):
            if cell == '^':
                if previous is None: return None
                value = previous[i]
            else:
                if not cell or cell[0] not in '=+-': return None
                digits = cell[1:]
                if not digits.isascii() or not digits.isdecimal(): return None
                amount = int(digits)
                if cell[0] == '=': value = amount + (previous[i] if previous is not None else 0)
                else:
                    if previous is None: return None
                    value = previous[i] + (amount if cell[0] == '+' else -amount)
            row.append(value)
        rows.append(row)
        previous = row
    return rows
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('deltas', solve(_vary(['=10;=20', '+3;-2', '-1;+4'])), _vary([[10, 20], [13, 18], [12, 22]]))
check('absolute reset', solve(_vary(['=10;=20', '=1;^', '+2;+3'])), _vary([[10, 20], [1, 20], [3, 23]]))
check('initial delta', solve(_vary(['+1;=2'])), _vary(None))
check('initial copy', solve(_vary(['^;=2'])), _vary(None))
check('bad amount', solve(_vary(['=a;=2'])), _vary(None))
check('empty amount', solve(_vary(['=;=2'])), _vary(None))
check('empty table', solve(_vary([])), _vary([]))
check('zero deltas', solve(_vary(['=0;=1', '+0;-0'])), _vary([[0, 1], [0, 1]]))
check('variant delta magnitude', solve(['='+str(N)+';=2','+3;-1']), [[N,2],[N+3,1]])
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):
    rows, previous = [], None
    for line in data:
        cells = line.split(';')
        if len(cells) != 2: return None
        row = []
        for i, cell in enumerate(cells):
            if cell == '^':
                if previous is None: return None
                value = previous[i]
            else:
                if not cell or cell[0] not in '=+-': return None
                digits = cell[1:]
                if not digits.isascii() or not digits.isdecimal(): return None
                amount = int(digits)
                if cell[0] == '=': value = previous[i] if previous is not None else amount
                else:
                    if previous is None: return None
                    value = previous[i] + (amount if cell[0] == '+' else -amount)
            row.append(value)
        rows.append(row)
        previous = row
    return rows
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('deltas', solve(_vary(['=10;=20', '+3;-2', '-1;+4'])), _vary([[10, 20], [13, 18], [12, 22]]))
check('absolute reset', solve(_vary(['=10;=20', '=1;^', '+2;+3'])), _vary([[10, 20], [1, 20], [3, 23]]))
check('initial delta', solve(_vary(['+1;=2'])), _vary(None))
check('initial copy', solve(_vary(['^;=2'])), _vary(None))
check('bad amount', solve(_vary(['=a;=2'])), _vary(None))
check('empty amount', solve(_vary(['=;=2'])), _vary(None))
check('empty table', solve(_vary([])), _vary([]))
check('zero deltas', solve(_vary(['=0;=1', '+0;-0'])), _vary([[0, 1], [0, 1]]))
check('variant delta magnitude', solve(['='+str(N)+';=2','+3;-1']), [[N,2],[N+3,1]])
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 two-column semicolon rows. A first row must contain absolute ASCII integer cells prefixed =. Later cells may use signed integer deltas prefixed + or -, or =absolute. A caret copies prior column value. Return numeric rows. Empty tokens and noncanonical nondecimal tokens reject.

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):
    rows, previous = [], None
    for line in data:
        cells = line.split(';')
        if len(cells) != 2: return None
        row = []
        for i, cell in enumerate(cells):
            if cell == '^':
                if previous is None: return None
                value = previous[i]
            else:
                if not cell or cell[0] not in '=+-': return None
                digits = cell[1:]
                if not digits.isascii() or not digits.isdecimal(): return None
                amount = int(digits)
                if cell[0] == '=': value = amount
                else:
                    if previous is None: return None
                    value = previous[0] + (amount if cell[0] == '+' else -amount)
            row.append(value)
        rows.append(row)
        previous = row
    return rows
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('deltas', solve(_vary(['=10;=20', '+3;-2', '-1;+4'])), _vary([[10, 20], [13, 18], [12, 22]]))
check('absolute reset', solve(_vary(['=10;=20', '=1;^', '+2;+3'])), _vary([[10, 20], [1, 20], [3, 23]]))
check('initial delta', solve(_vary(['+1;=2'])), _vary(None))
check('initial copy', solve(_vary(['^;=2'])), _vary(None))
check('bad amount', solve(_vary(['=a;=2'])), _vary(None))
check('empty amount', solve(_vary(['=;=2'])), _vary(None))
check('empty table', solve(_vary([])), _vary([]))
check('zero deltas', solve(_vary(['=0;=1', '+0;-0'])), _vary([[0, 1], [0, 1]]))
check('variant delta magnitude', solve(['='+str(N)+';=2','+3;-1']), [[N,2],[N+3,1]])
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):
    rows, previous = [], None
    for line in data:
        cells = line.split(';')
        if len(cells) != 2: return None
        row = []
        for i, cell in enumerate(cells):
            if cell == '^':
                if previous is None: return None
                value = previous[i]
            else:
                if not cell or cell[0] not in '=+-': return None
                digits = cell[1:]
                if not digits.isascii() or not digits.isdecimal(): return None
                amount = int(digits)
                if cell[0] == '=': value = amount
                else:
                    if previous is None: return None
                    value = previous[-1] + (amount if cell[0] == '+' else -amount)
            row.append(value)
        rows.append(row)
        previous = row
    return rows
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('deltas', solve(_vary(['=10;=20', '+3;-2', '-1;+4'])), _vary([[10, 20], [13, 18], [12, 22]]))
check('absolute reset', solve(_vary(['=10;=20', '=1;^', '+2;+3'])), _vary([[10, 20], [1, 20], [3, 23]]))
check('initial delta', solve(_vary(['+1;=2'])), _vary(None))
check('initial copy', solve(_vary(['^;=2'])), _vary(None))
check('bad amount', solve(_vary(['=a;=2'])), _vary(None))
check('empty amount', solve(_vary(['=;=2'])), _vary(None))
check('empty table', solve(_vary([])), _vary([]))
check('zero deltas', solve(_vary(['=0;=1', '+0;-0'])), _vary([[0, 1], [0, 1]]))
check('variant delta magnitude', solve(['='+str(N)+';=2','+3;-1']), [[N,2],[N+3,1]])
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 two-column semicolon rows. A first row must contain absolute ASCII integer cells prefixed =. Later cells may use signed integer deltas prefixed + or -, or =absolute. A caret copies prior column value. Return numeric rows. Empty tokens and noncanonical nondecimal tokens reject.

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):
    rows, previous = [], None
    for line in data:
        cells = line.split(';')
        if len(cells) != 2: return None
        row = []
        for i, cell in enumerate(cells):
            if cell == '^':
                if previous is None: return None
                value = -1
            else:
                if not cell or cell[0] not in '=+-': return None
                digits = cell[1:]
                if not digits.isascii() or not digits.isdecimal(): return None
                amount = int(digits)
                if cell[0] == '=': value = amount
                else:
                    if previous is None: return None
                    value = previous[i] + (amount if cell[0] == '+' else -amount)
            row.append(value)
        rows.append(row)
        previous = row
    return rows
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('deltas', solve(_vary(['=10;=20', '+3;-2', '-1;+4'])), _vary([[10, 20], [13, 18], [12, 22]]))
check('absolute reset', solve(_vary(['=10;=20', '=1;^', '+2;+3'])), _vary([[10, 20], [1, 20], [3, 23]]))
check('initial delta', solve(_vary(['+1;=2'])), _vary(None))
check('initial copy', solve(_vary(['^;=2'])), _vary(None))
check('bad amount', solve(_vary(['=a;=2'])), _vary(None))
check('empty amount', solve(_vary(['=;=2'])), _vary(None))
check('empty table', solve(_vary([])), _vary([]))
check('zero deltas', solve(_vary(['=0;=1', '+0;-0'])), _vary([[0, 1], [0, 1]]))
check('variant delta magnitude', solve(['='+str(N)+';=2','+3;-1']), [[N,2],[N+3,1]])
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):
    rows, previous = [], None
    for line in data:
        cells = line.split(';')
        if len(cells) != 2: return None
        row = []
        for i, cell in enumerate(cells):
            if cell == '^':
                if previous is None: return None
                value = 0
            else:
                if not cell or cell[0] not in '=+-': return None
                digits = cell[1:]
                if not digits.isascii() or not digits.isdecimal(): return None
                amount = int(digits)
                if cell[0] == '=': value = amount
                else:
                    if previous is None: return None
                    value = previous[i] + (amount if cell[0] == '+' else -amount)
            row.append(value)
        rows.append(row)
        previous = row
    return rows
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('deltas', solve(_vary(['=10;=20', '+3;-2', '-1;+4'])), _vary([[10, 20], [13, 18], [12, 22]]))
check('absolute reset', solve(_vary(['=10;=20', '=1;^', '+2;+3'])), _vary([[10, 20], [1, 20], [3, 23]]))
check('initial delta', solve(_vary(['+1;=2'])), _vary(None))
check('initial copy', solve(_vary(['^;=2'])), _vary(None))
check('bad amount', solve(_vary(['=a;=2'])), _vary(None))
check('empty amount', solve(_vary(['=;=2'])), _vary(None))
check('empty table', solve(_vary([])), _vary([]))
check('zero deltas', solve(_vary(['=0;=1', '+0;-0'])), _vary([[0, 1], [0, 1]]))
check('variant delta magnitude', solve(['='+str(N)+';=2','+3;-1']), [[N,2],[N+3,1]])
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 two-column semicolon rows. A first row must contain absolute ASCII integer cells prefixed =. Later cells may use signed integer deltas prefixed + or -, or =absolute. A caret copies prior column value. Return numeric rows. Empty tokens and noncanonical nondecimal tokens reject.

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, start, line = [], 0, 1
    parts = data.split('\n')
    if parts[-1] == '': parts.pop()
    for text in parts:
        size = len(text)
        out.append([text, start, start + size, line])
        start += size + 1
        line += 1
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unicode', solve(_vary('é\n@')), _vary([['é', 0, 2, 1], ['@', 3, '@END', 2]]))
check('empty middle', solve(_vary('a\n\nb')), _vary([['a', 0, 1, 1], ['', 2, 2, 2], ['b', 3, 4, 3]]))
check('final LF', solve(_vary('a\n')), _vary([['a', 0, 1, 1]]))
check('empty', solve(_vary('')), _vary([]))
check('only LF', solve(_vary('\n')), _vary([['', 0, 0, 1]]))
check('astral', solve(_vary('😀\nz')), _vary([['😀', 0, 4, 1], ['z', 5, 6, 2]]))
check('no LF', solve(_vary('x')), _vary([['x', 0, 1, 1]]))
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, start, line = [], 0, 1
    parts = data.split('\n')
    if parts[-1] == '': parts.pop()
    for text in parts:
        size = len(text.encode('utf-16-le'))
        out.append([text, start, start + size, line])
        start += size + 1
        line += 1
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unicode', solve(_vary('é\n@')), _vary([['é', 0, 2, 1], ['@', 3, '@END', 2]]))
check('empty middle', solve(_vary('a\n\nb')), _vary([['a', 0, 1, 1], ['', 2, 2, 2], ['b', 3, 4, 3]]))
check('final LF', solve(_vary('a\n')), _vary([['a', 0, 1, 1]]))
check('empty', solve(_vary('')), _vary([]))
check('only LF', solve(_vary('\n')), _vary([['', 0, 0, 1]]))
check('astral', solve(_vary('😀\nz')), _vary([['😀', 0, 4, 1], ['z', 5, 6, 2]]))
check('no LF', solve(_vary('x')), _vary([['x', 0, 1, 1]]))
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.

For UTF-8 text with LF-delimited physical records, report each record as [text,start_byte,end_byte,line_number]. LF is excluded from text and end offset; a final LF does not add a phantom record. Empty interior records remain. Leading BOM is ordinary text here.

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, start, line = [], 0, 1
    parts = data.split('\n')
    if parts[-1] == '': parts.pop()
    for text in parts:
        size = len(text.encode('utf-8'))
        out.append([text, start, start + size, line])
        start += size
        line += 1
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unicode', solve(_vary('é\n@')), _vary([['é', 0, 2, 1], ['@', 3, '@END', 2]]))
check('empty middle', solve(_vary('a\n\nb')), _vary([['a', 0, 1, 1], ['', 2, 2, 2], ['b', 3, 4, 3]]))
check('final LF', solve(_vary('a\n')), _vary([['a', 0, 1, 1]]))
check('empty', solve(_vary('')), _vary([]))
check('only LF', solve(_vary('\n')), _vary([['', 0, 0, 1]]))
check('astral', solve(_vary('😀\nz')), _vary([['😀', 0, 4, 1], ['z', 5, 6, 2]]))
check('no LF', solve(_vary('x')), _vary([['x', 0, 1, 1]]))
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, start, line = [], 0, 1
    parts = data.split('\n')
    if parts[-1] == '': parts.pop()
    for text in parts:
        size = len(text.encode('utf-8'))
        out.append([text, start, start + size, line])
        start += size + 2
        line += 1
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unicode', solve(_vary('é\n@')), _vary([['é', 0, 2, 1], ['@', 3, '@END', 2]]))
check('empty middle', solve(_vary('a\n\nb')), _vary([['a', 0, 1, 1], ['', 2, 2, 2], ['b', 3, 4, 3]]))
check('final LF', solve(_vary('a\n')), _vary([['a', 0, 1, 1]]))
check('empty', solve(_vary('')), _vary([]))
check('only LF', solve(_vary('\n')), _vary([['', 0, 0, 1]]))
check('astral', solve(_vary('😀\nz')), _vary([['😀', 0, 4, 1], ['z', 5, 6, 2]]))
check('no LF', solve(_vary('x')), _vary([['x', 0, 1, 1]]))
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.

For UTF-8 text with LF-delimited physical records, report each record as [text,start_byte,end_byte,line_number]. LF is excluded from text and end offset; a final LF does not add a phantom record. Empty interior records remain. Leading BOM is ordinary text here.

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, start, line = [], 0, 1
    parts = data.split('\n')
    if parts[-1] == '': parts.pop()
    for text in parts:
        size = len(text.encode('utf-8'))
        out.append([text, start, start + size + 1, line])
        start += size + 1
        line += 1
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unicode', solve(_vary('é\n@')), _vary([['é', 0, 2, 1], ['@', 3, '@END', 2]]))
check('empty middle', solve(_vary('a\n\nb')), _vary([['a', 0, 1, 1], ['', 2, 2, 2], ['b', 3, 4, 3]]))
check('final LF', solve(_vary('a\n')), _vary([['a', 0, 1, 1]]))
check('empty', solve(_vary('')), _vary([]))
check('only LF', solve(_vary('\n')), _vary([['', 0, 0, 1]]))
check('astral', solve(_vary('😀\nz')), _vary([['😀', 0, 4, 1], ['z', 5, 6, 2]]))
check('no LF', solve(_vary('x')), _vary([['x', 0, 1, 1]]))
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, start, line = [], 0, 1
    parts = data.split('\n')
    if parts[-1] == '': parts.pop()
    for text in parts:
        size = len(text.encode('utf-8'))
        out.append([text, start, start + max(size - 1, 0), line])
        start += size + 1
        line += 1
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unicode', solve(_vary('é\n@')), _vary([['é', 0, 2, 1], ['@', 3, '@END', 2]]))
check('empty middle', solve(_vary('a\n\nb')), _vary([['a', 0, 1, 1], ['', 2, 2, 2], ['b', 3, 4, 3]]))
check('final LF', solve(_vary('a\n')), _vary([['a', 0, 1, 1]]))
check('empty', solve(_vary('')), _vary([]))
check('only LF', solve(_vary('\n')), _vary([['', 0, 0, 1]]))
check('astral', solve(_vary('😀\nz')), _vary([['😀', 0, 4, 1], ['z', 5, 6, 2]]))
check('no LF', solve(_vary('x')), _vary([['x', 0, 1, 1]]))
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.

For UTF-8 text with LF-delimited physical records, report each record as [text,start_byte,end_byte,line_number]. LF is excluded from text and end offset; a final LF does not add a phantom record. Empty interior records remain. Leading BOM is ordinary text here.

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, start, line = [], 0, 1
    parts = data.split('\n')
    if False: parts.pop()
    for text in parts:
        size = len(text.encode('utf-8'))
        out.append([text, start, start + size, line])
        start += size + 1
        line += 1
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unicode', solve(_vary('é\n@')), _vary([['é', 0, 2, 1], ['@', 3, '@END', 2]]))
check('empty middle', solve(_vary('a\n\nb')), _vary([['a', 0, 1, 1], ['', 2, 2, 2], ['b', 3, 4, 3]]))
check('final LF', solve(_vary('a\n')), _vary([['a', 0, 1, 1]]))
check('empty', solve(_vary('')), _vary([]))
check('only LF', solve(_vary('\n')), _vary([['', 0, 0, 1]]))
check('astral', solve(_vary('😀\nz')), _vary([['😀', 0, 4, 1], ['z', 5, 6, 2]]))
check('no LF', solve(_vary('x')), _vary([['x', 0, 1, 1]]))
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, start, line = [], 0, 1
    parts = data.split('\n')
    if len(parts) == 1 and parts[-1] == '': parts.pop()
    for text in parts:
        size = len(text.encode('utf-8'))
        out.append([text, start, start + size, line])
        start += size + 1
        line += 1
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unicode', solve(_vary('é\n@')), _vary([['é', 0, 2, 1], ['@', 3, '@END', 2]]))
check('empty middle', solve(_vary('a\n\nb')), _vary([['a', 0, 1, 1], ['', 2, 2, 2], ['b', 3, 4, 3]]))
check('final LF', solve(_vary('a\n')), _vary([['a', 0, 1, 1]]))
check('empty', solve(_vary('')), _vary([]))
check('only LF', solve(_vary('\n')), _vary([['', 0, 0, 1]]))
check('astral', solve(_vary('😀\nz')), _vary([['😀', 0, 4, 1], ['z', 5, 6, 2]]))
check('no LF', solve(_vary('x')), _vary([['x', 0, 1, 1]]))
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.

For UTF-8 text with LF-delimited physical records, report each record as [text,start_byte,end_byte,line_number]. LF is excluded from text and end offset; a final LF does not add a phantom record. Empty interior records remain. Leading BOM is ordinary text here.

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, start, line = [], 0, 0
    parts = data.split('\n')
    if parts[-1] == '': parts.pop()
    for text in parts:
        size = len(text.encode('utf-8'))
        out.append([text, start, start + size, line])
        start += size + 1
        line += 1
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unicode', solve(_vary('é\n@')), _vary([['é', 0, 2, 1], ['@', 3, '@END', 2]]))
check('empty middle', solve(_vary('a\n\nb')), _vary([['a', 0, 1, 1], ['', 2, 2, 2], ['b', 3, 4, 3]]))
check('final LF', solve(_vary('a\n')), _vary([['a', 0, 1, 1]]))
check('empty', solve(_vary('')), _vary([]))
check('only LF', solve(_vary('\n')), _vary([['', 0, 0, 1]]))
check('astral', solve(_vary('😀\nz')), _vary([['😀', 0, 4, 1], ['z', 5, 6, 2]]))
check('no LF', solve(_vary('x')), _vary([['x', 0, 1, 1]]))
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, start, line = [], 0, 2
    parts = data.split('\n')
    if parts[-1] == '': parts.pop()
    for text in parts:
        size = len(text.encode('utf-8'))
        out.append([text, start, start + size, line])
        start += size + 1
        line += 1
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unicode', solve(_vary('é\n@')), _vary([['é', 0, 2, 1], ['@', 3, '@END', 2]]))
check('empty middle', solve(_vary('a\n\nb')), _vary([['a', 0, 1, 1], ['', 2, 2, 2], ['b', 3, 4, 3]]))
check('final LF', solve(_vary('a\n')), _vary([['a', 0, 1, 1]]))
check('empty', solve(_vary('')), _vary([]))
check('only LF', solve(_vary('\n')), _vary([['', 0, 0, 1]]))
check('astral', solve(_vary('😀\nz')), _vary([['😀', 0, 4, 1], ['z', 5, 6, 2]]))
check('no LF', solve(_vary('x')), _vary([['x', 0, 1, 1]]))
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.

For UTF-8 text with LF-delimited physical records, report each record as [text,start_byte,end_byte,line_number]. LF is excluded from text and end offset; a final LF does not add a phantom record. Empty interior records remain. Leading BOM is ordinary text here.

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):
    values = data['row'].split(',')
    if len(values) > 2: return None
    out = []
    for i in range(2):
        if i < len(values): out.append(values[i] or data['defaults'][i])
        elif data['required'][i]: return None
        else: out.append(data['defaults'][i])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('missing optional', solve(_vary({'row': '@', 'required': [True, False], 'defaults': ['x', 'y']})), _vary(['@', 'y']))
check('present empty', solve(_vary({'row': '@,', 'required': [True, False], 'defaults': ['x', 'y']})), _vary(['@', '']))
check('missing required', solve(_vary({'row': '@', 'required': [False, True], 'defaults': ['x', 'y']})), _vary(None))
check('typed default', solve(_vary({'row': '@', 'required': [False, False], 'defaults': [0, [1, 2]]})), _vary(['@', [1, 2]]))
check('null default', solve(_vary({'row': '@', 'required': [False, False], 'defaults': [0, None]})), _vary(['@', None]))
check('extra', solve(_vary({'row': 'a,b,c', 'required': [False, False], 'defaults': [0, 1]})), _vary(None))
check('both present', solve(_vary({'row': '@,z', 'required': [True, True], 'defaults': [0, 1]})), _vary(['@', 'z']))
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):
    values = data['row'].split(',')
    if len(values) > 2: return None
    out = []
    for i in range(2):
        if i < len(values): out.append(values[i] if values[i].strip() else data['defaults'][i])
        elif data['required'][i]: return None
        else: out.append(data['defaults'][i])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('missing optional', solve(_vary({'row': '@', 'required': [True, False], 'defaults': ['x', 'y']})), _vary(['@', 'y']))
check('present empty', solve(_vary({'row': '@,', 'required': [True, False], 'defaults': ['x', 'y']})), _vary(['@', '']))
check('missing required', solve(_vary({'row': '@', 'required': [False, True], 'defaults': ['x', 'y']})), _vary(None))
check('typed default', solve(_vary({'row': '@', 'required': [False, False], 'defaults': [0, [1, 2]]})), _vary(['@', [1, 2]]))
check('null default', solve(_vary({'row': '@', 'required': [False, False], 'defaults': [0, None]})), _vary(['@', None]))
check('extra', solve(_vary({'row': 'a,b,c', 'required': [False, False], 'defaults': [0, 1]})), _vary(None))
check('both present', solve(_vary({'row': '@,z', 'required': [True, True], 'defaults': [0, 1]})), _vary(['@', 'z']))
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.

Bind a two-column comma row to [a,b] with per-column defaults. An absent cell uses its default only if its required flag is false; a present empty cell stays empty. Surplus cells reject. Return ordered values. Defaults may be null or lists and must remain typed.

split: open-access