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):
    evidence = [set(), set()]
    for row in data:
        for i, (value, quoted) in enumerate(row):
            if not quoted and value in ('', 'NULL'): continue
            if False: kind = 'text'
            elif value in ('true', 'false'): kind = 'bool'
            elif value.lstrip('-').isascii() and value.lstrip('-').isdigit() and value == str(int(value)): kind = 'int'
            else: kind = 'text'
            evidence[i].add(kind)
    return [next(iter(kinds)) if len(kinds) == 1 else 'text' if kinds else 'unknown' for kinds in evidence]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('typed', solve(_vary([[['12', False], ['true', False]], [['-2', False], ['false', False]]])), _vary(['int', 'bool']))
check('quoted number', solve(_vary([[['12', True], ['@', False]]])), _vary(['text', 'text']))
check('null only', solve(_vary([[['NULL', False], ['', False]]])), _vary(['unknown', 'unknown']))
check('quoted empty', solve(_vary([[['', True], ['NULL', True]]])), _vary(['text', 'text']))
check('leading zero', solve(_vary([[['01', False], ['-0', False]]])), _vary(['text', 'text']))
check('mixed', solve(_vary([[['1', False], ['true', False]], [['@', False], ['2', False]]])), _vary(['text', 'text']))
check('null ignored', solve(_vary([[['NULL', False], ['', False]], [['1', False], ['false', False]]])), _vary(['int', 'bool']))
check('empty table', solve(_vary([])), _vary(['unknown', 'unknown']))
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):
    evidence = [set(), set()]
    for row in data:
        for i, (value, quoted) in enumerate(row):
            if not quoted and value in ('', 'NULL'): continue
            if quoted and not value: kind = 'text'
            elif value in ('true', 'false'): kind = 'bool'
            elif value.lstrip('-').isascii() and value.lstrip('-').isdigit() and value == str(int(value)): kind = 'int'
            else: kind = 'text'
            evidence[i].add(kind)
    return [next(iter(kinds)) if len(kinds) == 1 else 'text' if kinds else 'unknown' for kinds in evidence]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('typed', solve(_vary([[['12', False], ['true', False]], [['-2', False], ['false', False]]])), _vary(['int', 'bool']))
check('quoted number', solve(_vary([[['12', True], ['@', False]]])), _vary(['text', 'text']))
check('null only', solve(_vary([[['NULL', False], ['', False]]])), _vary(['unknown', 'unknown']))
check('quoted empty', solve(_vary([[['', True], ['NULL', True]]])), _vary(['text', 'text']))
check('leading zero', solve(_vary([[['01', False], ['-0', False]]])), _vary(['text', 'text']))
check('mixed', solve(_vary([[['1', False], ['true', False]], [['@', False], ['2', False]]])), _vary(['text', 'text']))
check('null ignored', solve(_vary([[['NULL', False], ['', False]], [['1', False], ['false', False]]])), _vary(['int', 'bool']))
check('empty table', solve(_vary([])), _vary(['unknown', 'unknown']))
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.

Infer per-column wire types from already lexed two-column rows. Unquoted empty and NULL cells supply no evidence; quoted cells force text. Unquoted lowercase true/false are bool; canonical signed decimal integers without leading zeros are int; all other cells text. Mixed non-null kinds promote to text; a column with no evidence is unknown.

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):
    evidence = [set(), set()]
    for row in data:
        for i, (value, quoted) in enumerate(row):
            if not quoted and value in ('', 'NULL'): continue
            if quoted: kind = 'text'
            elif value in ('true', 'false'): kind = 'bool'
            elif value.lstrip('-').isascii() and value.lstrip('-').isdigit() : kind = 'int'
            else: kind = 'text'
            evidence[i].add(kind)
    return [next(iter(kinds)) if len(kinds) == 1 else 'text' if kinds else 'unknown' for kinds in evidence]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('typed', solve(_vary([[['12', False], ['true', False]], [['-2', False], ['false', False]]])), _vary(['int', 'bool']))
check('quoted number', solve(_vary([[['12', True], ['@', False]]])), _vary(['text', 'text']))
check('null only', solve(_vary([[['NULL', False], ['', False]]])), _vary(['unknown', 'unknown']))
check('quoted empty', solve(_vary([[['', True], ['NULL', True]]])), _vary(['text', 'text']))
check('leading zero', solve(_vary([[['01', False], ['-0', False]]])), _vary(['text', 'text']))
check('mixed', solve(_vary([[['1', False], ['true', False]], [['@', False], ['2', False]]])), _vary(['text', 'text']))
check('null ignored', solve(_vary([[['NULL', False], ['', False]], [['1', False], ['false', False]]])), _vary(['int', 'bool']))
check('empty table', solve(_vary([])), _vary(['unknown', 'unknown']))
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):
    evidence = [set(), set()]
    for row in data:
        for i, (value, quoted) in enumerate(row):
            if not quoted and value in ('', 'NULL'): continue
            if quoted: kind = 'text'
            elif value in ('true', 'false'): kind = 'bool'
            elif value.lstrip('-').isascii() and value.lstrip('-').isdigit() and not value.startswith('0'): kind = 'int'
            else: kind = 'text'
            evidence[i].add(kind)
    return [next(iter(kinds)) if len(kinds) == 1 else 'text' if kinds else 'unknown' for kinds in evidence]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('typed', solve(_vary([[['12', False], ['true', False]], [['-2', False], ['false', False]]])), _vary(['int', 'bool']))
check('quoted number', solve(_vary([[['12', True], ['@', False]]])), _vary(['text', 'text']))
check('null only', solve(_vary([[['NULL', False], ['', False]]])), _vary(['unknown', 'unknown']))
check('quoted empty', solve(_vary([[['', True], ['NULL', True]]])), _vary(['text', 'text']))
check('leading zero', solve(_vary([[['01', False], ['-0', False]]])), _vary(['text', 'text']))
check('mixed', solve(_vary([[['1', False], ['true', False]], [['@', False], ['2', False]]])), _vary(['text', 'text']))
check('null ignored', solve(_vary([[['NULL', False], ['', False]], [['1', False], ['false', False]]])), _vary(['int', 'bool']))
check('empty table', solve(_vary([])), _vary(['unknown', 'unknown']))
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.

Infer per-column wire types from already lexed two-column rows. Unquoted empty and NULL cells supply no evidence; quoted cells force text. Unquoted lowercase true/false are bool; canonical signed decimal integers without leading zeros are int; all other cells text. Mixed non-null kinds promote to text; a column with no evidence is unknown.

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):
    evidence = [set(), set()]
    for row in data:
        for i, (value, quoted) in enumerate(row):
            if not quoted and value in ('', 'NULL'): continue
            if quoted: kind = 'text'
            elif value in ('true', 'false'): kind = 'bool'
            elif value.lstrip('-').isascii() and value.lstrip('-').isdigit() and value == str(int(value)): kind = 'int'
            else: kind = 'text'
            evidence[0].add(kind)
    return [next(iter(kinds)) if len(kinds) == 1 else 'text' if kinds else 'unknown' for kinds in evidence]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('typed', solve(_vary([[['12', False], ['true', False]], [['-2', False], ['false', False]]])), _vary(['int', 'bool']))
check('quoted number', solve(_vary([[['12', True], ['@', False]]])), _vary(['text', 'text']))
check('null only', solve(_vary([[['NULL', False], ['', False]]])), _vary(['unknown', 'unknown']))
check('quoted empty', solve(_vary([[['', True], ['NULL', True]]])), _vary(['text', 'text']))
check('leading zero', solve(_vary([[['01', False], ['-0', False]]])), _vary(['text', 'text']))
check('mixed', solve(_vary([[['1', False], ['true', False]], [['@', False], ['2', False]]])), _vary(['text', 'text']))
check('null ignored', solve(_vary([[['NULL', False], ['', False]], [['1', False], ['false', False]]])), _vary(['int', 'bool']))
check('empty table', solve(_vary([])), _vary(['unknown', 'unknown']))
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):
    evidence = [set(), set()]
    for row in data:
        for i, (value, quoted) in enumerate(row):
            if not quoted and value in ('', 'NULL'): continue
            if quoted: kind = 'text'
            elif value in ('true', 'false'): kind = 'bool'
            elif value.lstrip('-').isascii() and value.lstrip('-').isdigit() and value == str(int(value)): kind = 'int'
            else: kind = 'text'
            evidence[i % 1].add(kind)
    return [next(iter(kinds)) if len(kinds) == 1 else 'text' if kinds else 'unknown' for kinds in evidence]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('typed', solve(_vary([[['12', False], ['true', False]], [['-2', False], ['false', False]]])), _vary(['int', 'bool']))
check('quoted number', solve(_vary([[['12', True], ['@', False]]])), _vary(['text', 'text']))
check('null only', solve(_vary([[['NULL', False], ['', False]]])), _vary(['unknown', 'unknown']))
check('quoted empty', solve(_vary([[['', True], ['NULL', True]]])), _vary(['text', 'text']))
check('leading zero', solve(_vary([[['01', False], ['-0', False]]])), _vary(['text', 'text']))
check('mixed', solve(_vary([[['1', False], ['true', False]], [['@', False], ['2', False]]])), _vary(['text', 'text']))
check('null ignored', solve(_vary([[['NULL', False], ['', False]], [['1', False], ['false', False]]])), _vary(['int', 'bool']))
check('empty table', solve(_vary([])), _vary(['unknown', 'unknown']))
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.

Infer per-column wire types from already lexed two-column rows. Unquoted empty and NULL cells supply no evidence; quoted cells force text. Unquoted lowercase true/false are bool; canonical signed decimal integers without leading zeros are int; all other cells text. Mixed non-null kinds promote to text; a column with no evidence is unknown.

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):
    evidence = [set(), set()]
    for row in data:
        for i, (value, quoted) in enumerate(row):
            if not quoted and value in ('', 'NULL'): continue
            if quoted: kind = 'text'
            elif value in ('true', 'false'): kind = 'bool'
            elif value.lstrip('-').isascii() and value.lstrip('-').isdigit() and value == str(int(value)): kind = 'int'
            else: kind = 'text'
            evidence[i] = {kind}
    return [next(iter(kinds)) if len(kinds) == 1 else 'text' if kinds else 'unknown' for kinds in evidence]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('typed', solve(_vary([[['12', False], ['true', False]], [['-2', False], ['false', False]]])), _vary(['int', 'bool']))
check('quoted number', solve(_vary([[['12', True], ['@', False]]])), _vary(['text', 'text']))
check('null only', solve(_vary([[['NULL', False], ['', False]]])), _vary(['unknown', 'unknown']))
check('quoted empty', solve(_vary([[['', True], ['NULL', True]]])), _vary(['text', 'text']))
check('leading zero', solve(_vary([[['01', False], ['-0', False]]])), _vary(['text', 'text']))
check('mixed', solve(_vary([[['1', False], ['true', False]], [['@', False], ['2', False]]])), _vary(['text', 'text']))
check('null ignored', solve(_vary([[['NULL', False], ['', False]], [['1', False], ['false', False]]])), _vary(['int', 'bool']))
check('empty table', solve(_vary([])), _vary(['unknown', 'unknown']))
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):
    evidence = [set(), set()]
    for row in data:
        for i, (value, quoted) in enumerate(row):
            if not quoted and value in ('', 'NULL'): continue
            if quoted: kind = 'text'
            elif value in ('true', 'false'): kind = 'bool'
            elif value.lstrip('-').isascii() and value.lstrip('-').isdigit() and value == str(int(value)): kind = 'int'
            else: kind = 'text'
            evidence[i].clear(); evidence[i].add(kind)
    return [next(iter(kinds)) if len(kinds) == 1 else 'text' if kinds else 'unknown' for kinds in evidence]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('typed', solve(_vary([[['12', False], ['true', False]], [['-2', False], ['false', False]]])), _vary(['int', 'bool']))
check('quoted number', solve(_vary([[['12', True], ['@', False]]])), _vary(['text', 'text']))
check('null only', solve(_vary([[['NULL', False], ['', False]]])), _vary(['unknown', 'unknown']))
check('quoted empty', solve(_vary([[['', True], ['NULL', True]]])), _vary(['text', 'text']))
check('leading zero', solve(_vary([[['01', False], ['-0', False]]])), _vary(['text', 'text']))
check('mixed', solve(_vary([[['1', False], ['true', False]], [['@', False], ['2', False]]])), _vary(['text', 'text']))
check('null ignored', solve(_vary([[['NULL', False], ['', False]], [['1', False], ['false', False]]])), _vary(['int', 'bool']))
check('empty table', solve(_vary([])), _vary(['unknown', 'unknown']))
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.

Infer per-column wire types from already lexed two-column rows. Unquoted empty and NULL cells supply no evidence; quoted cells force text. Unquoted lowercase true/false are bool; canonical signed decimal integers without leading zeros are int; all other cells text. Mixed non-null kinds promote to text; a column with no evidence is unknown.

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):
    evidence = [set(), set()]
    for row in data:
        for i, (value, quoted) in enumerate(row):
            if not quoted and value in ('', 'NULL'): continue
            if quoted: kind = 'text'
            elif value in ('true', 'false'): kind = 'bool'
            elif value.lstrip('-').isascii() and value.lstrip('-').isdigit() and value == str(int(value)): kind = 'int'
            else: kind = 'text'
            evidence[i].add(kind)
    return [next(iter(kinds)) if len(kinds) == 1 else 'text' if kinds else 'text' for kinds in evidence]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('typed', solve(_vary([[['12', False], ['true', False]], [['-2', False], ['false', False]]])), _vary(['int', 'bool']))
check('quoted number', solve(_vary([[['12', True], ['@', False]]])), _vary(['text', 'text']))
check('null only', solve(_vary([[['NULL', False], ['', False]]])), _vary(['unknown', 'unknown']))
check('quoted empty', solve(_vary([[['', True], ['NULL', True]]])), _vary(['text', 'text']))
check('leading zero', solve(_vary([[['01', False], ['-0', False]]])), _vary(['text', 'text']))
check('mixed', solve(_vary([[['1', False], ['true', False]], [['@', False], ['2', False]]])), _vary(['text', 'text']))
check('null ignored', solve(_vary([[['NULL', False], ['', False]], [['1', False], ['false', False]]])), _vary(['int', 'bool']))
check('empty table', solve(_vary([])), _vary(['unknown', 'unknown']))
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):
    evidence = [set(), set()]
    for row in data:
        for i, (value, quoted) in enumerate(row):
            if not quoted and value in ('', 'NULL'): continue
            if quoted: kind = 'text'
            elif value in ('true', 'false'): kind = 'bool'
            elif value.lstrip('-').isascii() and value.lstrip('-').isdigit() and value == str(int(value)): kind = 'int'
            else: kind = 'text'
            evidence[i].add(kind)
    return [next(iter(kinds)) if len(kinds) == 1 else 'text' if kinds else 'int' for kinds in evidence]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('typed', solve(_vary([[['12', False], ['true', False]], [['-2', False], ['false', False]]])), _vary(['int', 'bool']))
check('quoted number', solve(_vary([[['12', True], ['@', False]]])), _vary(['text', 'text']))
check('null only', solve(_vary([[['NULL', False], ['', False]]])), _vary(['unknown', 'unknown']))
check('quoted empty', solve(_vary([[['', True], ['NULL', True]]])), _vary(['text', 'text']))
check('leading zero', solve(_vary([[['01', False], ['-0', False]]])), _vary(['text', 'text']))
check('mixed', solve(_vary([[['1', False], ['true', False]], [['@', False], ['2', False]]])), _vary(['text', 'text']))
check('null ignored', solve(_vary([[['NULL', False], ['', False]], [['1', False], ['false', False]]])), _vary(['int', 'bool']))
check('empty table', solve(_vary([])), _vary(['unknown', 'unknown']))
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.

Infer per-column wire types from already lexed two-column rows. Unquoted empty and NULL cells supply no evidence; quoted cells force text. Unquoted lowercase true/false are bool; canonical signed decimal integers without leading zeros are int; all other cells text. Mixed non-null kinds promote to text; a column with no evidence is unknown.

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):
    resolved = []
    for name in data['header'].split(','):
        seen = set()
        while name in data['aliases']:
            if name in seen: return None
            seen.add(name)
            name = data['aliases'][name]
            break
        if name not in data['required']: return None
        if name in resolved: return None
        resolved.append(name)
    if set(resolved) != set(data['required']): return None
    return [resolved.index(name) for name in data['required']]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('chain', solve(_vary({'header': 'legacy,b', 'aliases': {'legacy': 'old', 'old': 'a'}, 'required': ['a', 'b']})), _vary([0, 1]))
check('reorder', solve(_vary({'header': 'b,@', 'aliases': {'@': 'a'}, 'required': ['a', 'b']})), _vary([1, 0]))
check('cycle', solve(_vary({'header': 'x,b', 'aliases': {'x': 'y', 'y': 'x'}, 'required': ['a', 'b']})), _vary(None))
check('collision', solve(_vary({'header': 'old,a', 'aliases': {'old': 'a'}, 'required': ['a', 'b']})), _vary(None))
check('unknown', solve(_vary({'header': 'a,z', 'aliases': {}, 'required': ['a', 'b']})), _vary(None))
check('missing', solve(_vary({'header': 'a', 'aliases': {}, 'required': ['a', 'b']})), _vary(None))
check('normal', solve(_vary({'header': 'a,b', 'aliases': {}, 'required': ['a', 'b']})), _vary([0, 1]))
check('cycle permutation', solve(_vary({'header': 'b,c,a', 'aliases': {}, 'required': ['a', 'b', 'c']})), _vary([2, 0, 1]))
check('full collision', solve(_vary({'header': 'old,a', 'aliases': {'old': 'a'}, 'required': ['a']})), _vary(None))
check('shared tail', solve(_vary({'header': 'x,y', 'aliases': {'x': 'a', 'y': 'b'}, 'required': ['a', 'b']})), _vary([0, 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):
    resolved = []
    for name in data['header'].split(','):
        seen = set()
        while name in data['aliases']:
            if name in seen: return None
            seen.add(name)
            name = data['aliases'].get(name, name)
            break
        if name not in data['required']: return None
        if name in resolved: return None
        resolved.append(name)
    if set(resolved) != set(data['required']): return None
    return [resolved.index(name) for name in data['required']]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('chain', solve(_vary({'header': 'legacy,b', 'aliases': {'legacy': 'old', 'old': 'a'}, 'required': ['a', 'b']})), _vary([0, 1]))
check('reorder', solve(_vary({'header': 'b,@', 'aliases': {'@': 'a'}, 'required': ['a', 'b']})), _vary([1, 0]))
check('cycle', solve(_vary({'header': 'x,b', 'aliases': {'x': 'y', 'y': 'x'}, 'required': ['a', 'b']})), _vary(None))
check('collision', solve(_vary({'header': 'old,a', 'aliases': {'old': 'a'}, 'required': ['a', 'b']})), _vary(None))
check('unknown', solve(_vary({'header': 'a,z', 'aliases': {}, 'required': ['a', 'b']})), _vary(None))
check('missing', solve(_vary({'header': 'a', 'aliases': {}, 'required': ['a', 'b']})), _vary(None))
check('normal', solve(_vary({'header': 'a,b', 'aliases': {}, 'required': ['a', 'b']})), _vary([0, 1]))
check('cycle permutation', solve(_vary({'header': 'b,c,a', 'aliases': {}, 'required': ['a', 'b', 'c']})), _vary([2, 0, 1]))
check('full collision', solve(_vary({'header': 'old,a', 'aliases': {'old': 'a'}, 'required': ['a']})), _vary(None))
check('shared tail', solve(_vary({'header': 'x,y', 'aliases': {'x': 'a', 'y': 'b'}, 'required': ['a', 'b']})), _vary([0, 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.

Resolve comma header names through an alias map, then produce a permutation into required canonical columns. A header name may follow multiple alias hops; cycles reject. Reject two physical columns resolving to one canonical name, unknown names, or missing required names. Return physical indexes in required order.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    resolved = []
    for name in data['header'].split(','):
        seen = set()
        while name in data['aliases']:
            if name in seen: return resolved
            seen.add(name)
            name = data['aliases'][name]
        if name not in data['required']: return None
        if name in resolved: return None
        resolved.append(name)
    if set(resolved) != set(data['required']): return None
    return [resolved.index(name) for name in data['required']]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('chain', solve(_vary({'header': 'legacy,b', 'aliases': {'legacy': 'old', 'old': 'a'}, 'required': ['a', 'b']})), _vary([0, 1]))
check('reorder', solve(_vary({'header': 'b,@', 'aliases': {'@': 'a'}, 'required': ['a', 'b']})), _vary([1, 0]))
check('cycle', solve(_vary({'header': 'x,b', 'aliases': {'x': 'y', 'y': 'x'}, 'required': ['a', 'b']})), _vary(None))
check('collision', solve(_vary({'header': 'old,a', 'aliases': {'old': 'a'}, 'required': ['a', 'b']})), _vary(None))
check('unknown', solve(_vary({'header': 'a,z', 'aliases': {}, 'required': ['a', 'b']})), _vary(None))
check('missing', solve(_vary({'header': 'a', 'aliases': {}, 'required': ['a', 'b']})), _vary(None))
check('normal', solve(_vary({'header': 'a,b', 'aliases': {}, 'required': ['a', 'b']})), _vary([0, 1]))
check('cycle permutation', solve(_vary({'header': 'b,c,a', 'aliases': {}, 'required': ['a', 'b', 'c']})), _vary([2, 0, 1]))
check('full collision', solve(_vary({'header': 'old,a', 'aliases': {'old': 'a'}, 'required': ['a']})), _vary(None))
check('shared tail', solve(_vary({'header': 'x,y', 'aliases': {'x': 'a', 'y': 'b'}, 'required': ['a', 'b']})), _vary([0, 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):
    resolved = []
    for name in data['header'].split(','):
        seen = set()
        while name in data['aliases']:
            if name in seen: return []
            seen.add(name)
            name = data['aliases'][name]
        if name not in data['required']: return None
        if name in resolved: return None
        resolved.append(name)
    if set(resolved) != set(data['required']): return None
    return [resolved.index(name) for name in data['required']]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('chain', solve(_vary({'header': 'legacy,b', 'aliases': {'legacy': 'old', 'old': 'a'}, 'required': ['a', 'b']})), _vary([0, 1]))
check('reorder', solve(_vary({'header': 'b,@', 'aliases': {'@': 'a'}, 'required': ['a', 'b']})), _vary([1, 0]))
check('cycle', solve(_vary({'header': 'x,b', 'aliases': {'x': 'y', 'y': 'x'}, 'required': ['a', 'b']})), _vary(None))
check('collision', solve(_vary({'header': 'old,a', 'aliases': {'old': 'a'}, 'required': ['a', 'b']})), _vary(None))
check('unknown', solve(_vary({'header': 'a,z', 'aliases': {}, 'required': ['a', 'b']})), _vary(None))
check('missing', solve(_vary({'header': 'a', 'aliases': {}, 'required': ['a', 'b']})), _vary(None))
check('normal', solve(_vary({'header': 'a,b', 'aliases': {}, 'required': ['a', 'b']})), _vary([0, 1]))
check('cycle permutation', solve(_vary({'header': 'b,c,a', 'aliases': {}, 'required': ['a', 'b', 'c']})), _vary([2, 0, 1]))
check('full collision', solve(_vary({'header': 'old,a', 'aliases': {'old': 'a'}, 'required': ['a']})), _vary(None))
check('shared tail', solve(_vary({'header': 'x,y', 'aliases': {'x': 'a', 'y': 'b'}, 'required': ['a', 'b']})), _vary([0, 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.

Resolve comma header names through an alias map, then produce a permutation into required canonical columns. A header name may follow multiple alias hops; cycles reject. Reject two physical columns resolving to one canonical name, unknown names, or missing required names. Return physical indexes in required order.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    resolved = []
    for name in data['header'].split(','):
        seen = set()
        while name in data['aliases']:
            if name in seen: return None
            seen.add(name)
            name = data['aliases'][name]
        if name not in data['required']: return None
        if name in resolved: continue
        resolved.append(name)
    if set(resolved) != set(data['required']): return None
    return [resolved.index(name) for name in data['required']]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('chain', solve(_vary({'header': 'legacy,b', 'aliases': {'legacy': 'old', 'old': 'a'}, 'required': ['a', 'b']})), _vary([0, 1]))
check('reorder', solve(_vary({'header': 'b,@', 'aliases': {'@': 'a'}, 'required': ['a', 'b']})), _vary([1, 0]))
check('cycle', solve(_vary({'header': 'x,b', 'aliases': {'x': 'y', 'y': 'x'}, 'required': ['a', 'b']})), _vary(None))
check('collision', solve(_vary({'header': 'old,a', 'aliases': {'old': 'a'}, 'required': ['a', 'b']})), _vary(None))
check('unknown', solve(_vary({'header': 'a,z', 'aliases': {}, 'required': ['a', 'b']})), _vary(None))
check('missing', solve(_vary({'header': 'a', 'aliases': {}, 'required': ['a', 'b']})), _vary(None))
check('normal', solve(_vary({'header': 'a,b', 'aliases': {}, 'required': ['a', 'b']})), _vary([0, 1]))
check('cycle permutation', solve(_vary({'header': 'b,c,a', 'aliases': {}, 'required': ['a', 'b', 'c']})), _vary([2, 0, 1]))
check('full collision', solve(_vary({'header': 'old,a', 'aliases': {'old': 'a'}, 'required': ['a']})), _vary(None))
check('shared tail', solve(_vary({'header': 'x,y', 'aliases': {'x': 'a', 'y': 'b'}, 'required': ['a', 'b']})), _vary([0, 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):
    resolved = []
    for name in data['header'].split(','):
        seen = set()
        while name in data['aliases']:
            if name in seen: return None
            seen.add(name)
            name = data['aliases'][name]
        if name not in data['required']: return None
        if name in resolved: resolved.remove(name)
        resolved.append(name)
    if set(resolved) != set(data['required']): return None
    return [resolved.index(name) for name in data['required']]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('chain', solve(_vary({'header': 'legacy,b', 'aliases': {'legacy': 'old', 'old': 'a'}, 'required': ['a', 'b']})), _vary([0, 1]))
check('reorder', solve(_vary({'header': 'b,@', 'aliases': {'@': 'a'}, 'required': ['a', 'b']})), _vary([1, 0]))
check('cycle', solve(_vary({'header': 'x,b', 'aliases': {'x': 'y', 'y': 'x'}, 'required': ['a', 'b']})), _vary(None))
check('collision', solve(_vary({'header': 'old,a', 'aliases': {'old': 'a'}, 'required': ['a', 'b']})), _vary(None))
check('unknown', solve(_vary({'header': 'a,z', 'aliases': {}, 'required': ['a', 'b']})), _vary(None))
check('missing', solve(_vary({'header': 'a', 'aliases': {}, 'required': ['a', 'b']})), _vary(None))
check('normal', solve(_vary({'header': 'a,b', 'aliases': {}, 'required': ['a', 'b']})), _vary([0, 1]))
check('cycle permutation', solve(_vary({'header': 'b,c,a', 'aliases': {}, 'required': ['a', 'b', 'c']})), _vary([2, 0, 1]))
check('full collision', solve(_vary({'header': 'old,a', 'aliases': {'old': 'a'}, 'required': ['a']})), _vary(None))
check('shared tail', solve(_vary({'header': 'x,y', 'aliases': {'x': 'a', 'y': 'b'}, 'required': ['a', 'b']})), _vary([0, 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.

Resolve comma header names through an alias map, then produce a permutation into required canonical columns. A header name may follow multiple alias hops; cycles reject. Reject two physical columns resolving to one canonical name, unknown names, or missing required names. Return physical indexes in required order.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    resolved = []
    for name in data['header'].split(','):
        seen = set()
        while name in data['aliases']:
            if name in seen: return None
            seen.add(name)
            name = data['aliases'][name]
        if name not in data['required']: return None
        if name in resolved: return None
        resolved.append(name)
    if set(resolved) != set(data['required']): return list(range(len(resolved)))
    return [resolved.index(name) for name in data['required']]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('chain', solve(_vary({'header': 'legacy,b', 'aliases': {'legacy': 'old', 'old': 'a'}, 'required': ['a', 'b']})), _vary([0, 1]))
check('reorder', solve(_vary({'header': 'b,@', 'aliases': {'@': 'a'}, 'required': ['a', 'b']})), _vary([1, 0]))
check('cycle', solve(_vary({'header': 'x,b', 'aliases': {'x': 'y', 'y': 'x'}, 'required': ['a', 'b']})), _vary(None))
check('collision', solve(_vary({'header': 'old,a', 'aliases': {'old': 'a'}, 'required': ['a', 'b']})), _vary(None))
check('unknown', solve(_vary({'header': 'a,z', 'aliases': {}, 'required': ['a', 'b']})), _vary(None))
check('missing', solve(_vary({'header': 'a', 'aliases': {}, 'required': ['a', 'b']})), _vary(None))
check('normal', solve(_vary({'header': 'a,b', 'aliases': {}, 'required': ['a', 'b']})), _vary([0, 1]))
check('cycle permutation', solve(_vary({'header': 'b,c,a', 'aliases': {}, 'required': ['a', 'b', 'c']})), _vary([2, 0, 1]))
check('full collision', solve(_vary({'header': 'old,a', 'aliases': {'old': 'a'}, 'required': ['a']})), _vary(None))
check('shared tail', solve(_vary({'header': 'x,y', 'aliases': {'x': 'a', 'y': 'b'}, 'required': ['a', 'b']})), _vary([0, 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):
    resolved = []
    for name in data['header'].split(','):
        seen = set()
        while name in data['aliases']:
            if name in seen: return None
            seen.add(name)
            name = data['aliases'][name]
        if name not in data['required']: return None
        if name in resolved: return None
        resolved.append(name)
    if set(resolved) != set(data['required']): return []
    return [resolved.index(name) for name in data['required']]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('chain', solve(_vary({'header': 'legacy,b', 'aliases': {'legacy': 'old', 'old': 'a'}, 'required': ['a', 'b']})), _vary([0, 1]))
check('reorder', solve(_vary({'header': 'b,@', 'aliases': {'@': 'a'}, 'required': ['a', 'b']})), _vary([1, 0]))
check('cycle', solve(_vary({'header': 'x,b', 'aliases': {'x': 'y', 'y': 'x'}, 'required': ['a', 'b']})), _vary(None))
check('collision', solve(_vary({'header': 'old,a', 'aliases': {'old': 'a'}, 'required': ['a', 'b']})), _vary(None))
check('unknown', solve(_vary({'header': 'a,z', 'aliases': {}, 'required': ['a', 'b']})), _vary(None))
check('missing', solve(_vary({'header': 'a', 'aliases': {}, 'required': ['a', 'b']})), _vary(None))
check('normal', solve(_vary({'header': 'a,b', 'aliases': {}, 'required': ['a', 'b']})), _vary([0, 1]))
check('cycle permutation', solve(_vary({'header': 'b,c,a', 'aliases': {}, 'required': ['a', 'b', 'c']})), _vary([2, 0, 1]))
check('full collision', solve(_vary({'header': 'old,a', 'aliases': {'old': 'a'}, 'required': ['a']})), _vary(None))
check('shared tail', solve(_vary({'header': 'x,y', 'aliases': {'x': 'a', 'y': 'b'}, 'required': ['a', 'b']})), _vary([0, 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.

Resolve comma header names through an alias map, then produce a permutation into required canonical columns. A header name may follow multiple alias hops; cycles reject. Reject two physical columns resolving to one canonical name, unknown names, or missing required names. Return physical indexes in required order.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    resolved = []
    for name in data['header'].split(','):
        seen = set()
        while name in data['aliases']:
            if name in seen: return None
            seen.add(name)
            name = data['aliases'][name]
        if name not in data['required']: return None
        if name in resolved: return None
        resolved.append(name)
    if set(resolved) != set(data['required']): return None
    return [data['required'].index(name) for name in resolved]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('chain', solve(_vary({'header': 'legacy,b', 'aliases': {'legacy': 'old', 'old': 'a'}, 'required': ['a', 'b']})), _vary([0, 1]))
check('reorder', solve(_vary({'header': 'b,@', 'aliases': {'@': 'a'}, 'required': ['a', 'b']})), _vary([1, 0]))
check('cycle', solve(_vary({'header': 'x,b', 'aliases': {'x': 'y', 'y': 'x'}, 'required': ['a', 'b']})), _vary(None))
check('collision', solve(_vary({'header': 'old,a', 'aliases': {'old': 'a'}, 'required': ['a', 'b']})), _vary(None))
check('unknown', solve(_vary({'header': 'a,z', 'aliases': {}, 'required': ['a', 'b']})), _vary(None))
check('missing', solve(_vary({'header': 'a', 'aliases': {}, 'required': ['a', 'b']})), _vary(None))
check('normal', solve(_vary({'header': 'a,b', 'aliases': {}, 'required': ['a', 'b']})), _vary([0, 1]))
check('cycle permutation', solve(_vary({'header': 'b,c,a', 'aliases': {}, 'required': ['a', 'b', 'c']})), _vary([2, 0, 1]))
check('full collision', solve(_vary({'header': 'old,a', 'aliases': {'old': 'a'}, 'required': ['a']})), _vary(None))
check('shared tail', solve(_vary({'header': 'x,y', 'aliases': {'x': 'a', 'y': 'b'}, 'required': ['a', 'b']})), _vary([0, 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):
    resolved = []
    for name in data['header'].split(','):
        seen = set()
        while name in data['aliases']:
            if name in seen: return None
            seen.add(name)
            name = data['aliases'][name]
        if name not in data['required']: return None
        if name in resolved: return None
        resolved.append(name)
    if set(resolved) != set(data['required']): return None
    return sorted(resolved.index(name) for name in data['required'])
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('chain', solve(_vary({'header': 'legacy,b', 'aliases': {'legacy': 'old', 'old': 'a'}, 'required': ['a', 'b']})), _vary([0, 1]))
check('reorder', solve(_vary({'header': 'b,@', 'aliases': {'@': 'a'}, 'required': ['a', 'b']})), _vary([1, 0]))
check('cycle', solve(_vary({'header': 'x,b', 'aliases': {'x': 'y', 'y': 'x'}, 'required': ['a', 'b']})), _vary(None))
check('collision', solve(_vary({'header': 'old,a', 'aliases': {'old': 'a'}, 'required': ['a', 'b']})), _vary(None))
check('unknown', solve(_vary({'header': 'a,z', 'aliases': {}, 'required': ['a', 'b']})), _vary(None))
check('missing', solve(_vary({'header': 'a', 'aliases': {}, 'required': ['a', 'b']})), _vary(None))
check('normal', solve(_vary({'header': 'a,b', 'aliases': {}, 'required': ['a', 'b']})), _vary([0, 1]))
check('cycle permutation', solve(_vary({'header': 'b,c,a', 'aliases': {}, 'required': ['a', 'b', 'c']})), _vary([2, 0, 1]))
check('full collision', solve(_vary({'header': 'old,a', 'aliases': {'old': 'a'}, 'required': ['a']})), _vary(None))
check('shared tail', solve(_vary({'header': 'x,y', 'aliases': {'x': 'a', 'y': 'b'}, 'required': ['a', 'b']})), _vary([0, 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.

Resolve comma header names through an alias map, then produce a permutation into required canonical columns. A header name may follow multiple alias hops; cycles reject. Reject two physical columns resolving to one canonical name, unknown names, or missing required names. Return physical indexes in required order.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    rows = data['rows']
    rstart, rend = data['r']
    cstart, cend = data['c']
    if not rows: return [] if data['r'] == [1, None] and data['c'] == [1, None] else None
    height, width = len(rows), len(rows[0])
    if any(len(row) != width for row in rows): return None
    rend = height if rend is None else rend
    cend = width if cend is None else cend
    if not 1 <= rstart <= rend <= height: return None
    if not 1 <= cstart <= cend <= width: return None
    return [row[cstart-1:cend] for row in rows[rstart:rend]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('window', solve(_vary({'rows': [['a', 'b', 'c'], ['d', '@', 'f'], ['g', 'h', 'i']], 'r': [2, 3], 'c': [2, 3]})), _vary([['@', 'f'], ['h', 'i']]))
check('full', solve(_vary({'rows': [['@', 'x']], 'r': [1, None], 'c': [1, None]})), _vary([['@', 'x']]))
check('zero', solve(_vary({'rows': [['x']], 'r': [0, 1], 'c': [1, 1]})), _vary(None))
check('reversed', solve(_vary({'rows': [['a'], ['b']], 'r': [2, 1], 'c': [1, 1]})), _vary(None))
check('row overflow', solve(_vary({'rows': [['a']], 'r': [1, 2], 'c': [1, 1]})), _vary(None))
check('col overflow', solve(_vary({'rows': [['a']], 'r': [1, 1], 'c': [1, 2]})), _vary(None))
check('ragged', solve(_vary({'rows': [['a', 'b'], ['c']], 'r': [1, 1], 'c': [1, 1]})), _vary(None))
check('empty', solve(_vary({'rows': [], 'r': [1, None], 'c': [1, None]})), _vary([]))
check('prefix window', solve(_vary({'rows': [['@', 'b'], ['c', 'd']], 'r': [1, 1], 'c': [1, 1]})), _vary([['@']]))
check('empty explicit', solve(_vary({'rows': [], 'r': [1, 1], 'c': [1, 1]})), _vary(None))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
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 = data['rows']
    rstart, rend = data['r']
    cstart, cend = data['c']
    if not rows: return [] if data['r'] == [1, None] and data['c'] == [1, None] else None
    height, width = len(rows), len(rows[0])
    if any(len(row) != width for row in rows): return None
    rend = height if rend is None else rend
    cend = width if cend is None else cend
    if not 1 <= rstart <= rend <= height: return None
    if not 1 <= cstart <= cend <= width: return None
    return [row[cstart-1:cend] for row in rows[max(0,rstart-2):rend]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('window', solve(_vary({'rows': [['a', 'b', 'c'], ['d', '@', 'f'], ['g', 'h', 'i']], 'r': [2, 3], 'c': [2, 3]})), _vary([['@', 'f'], ['h', 'i']]))
check('full', solve(_vary({'rows': [['@', 'x']], 'r': [1, None], 'c': [1, None]})), _vary([['@', 'x']]))
check('zero', solve(_vary({'rows': [['x']], 'r': [0, 1], 'c': [1, 1]})), _vary(None))
check('reversed', solve(_vary({'rows': [['a'], ['b']], 'r': [2, 1], 'c': [1, 1]})), _vary(None))
check('row overflow', solve(_vary({'rows': [['a']], 'r': [1, 2], 'c': [1, 1]})), _vary(None))
check('col overflow', solve(_vary({'rows': [['a']], 'r': [1, 1], 'c': [1, 2]})), _vary(None))
check('ragged', solve(_vary({'rows': [['a', 'b'], ['c']], 'r': [1, 1], 'c': [1, 1]})), _vary(None))
check('empty', solve(_vary({'rows': [], 'r': [1, None], 'c': [1, None]})), _vary([]))
check('prefix window', solve(_vary({'rows': [['@', 'b'], ['c', 'd']], 'r': [1, 1], 'c': [1, 1]})), _vary([['@']]))
check('empty explicit', solve(_vary({'rows': [], 'r': [1, 1], 'c': [1, 1]})), _vary(None))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

Select physical cells from a rectangular table using one-based inclusive row and column intervals. Omitted end means last; zero and reversed or out-of-range bounds reject. An empty table accepts only both default [1,null] selectors and produces empty output. Preserve selected order.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    rows = data['rows']
    rstart, rend = data['r']
    cstart, cend = data['c']
    if not rows: return [] if data['r'] == [1, None] and data['c'] == [1, None] else None
    height, width = len(rows), len(rows[0])
    if any(len(row) != width for row in rows): return None
    rend = height if rend is None else rend
    cend = width if cend is None else cend
    if not 1 <= rstart <= rend <= height: return None
    if not 1 <= cstart <= cend <= width: return None
    return [row[cstart:cend] for row in rows[rstart-1:rend]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('window', solve(_vary({'rows': [['a', 'b', 'c'], ['d', '@', 'f'], ['g', 'h', 'i']], 'r': [2, 3], 'c': [2, 3]})), _vary([['@', 'f'], ['h', 'i']]))
check('full', solve(_vary({'rows': [['@', 'x']], 'r': [1, None], 'c': [1, None]})), _vary([['@', 'x']]))
check('zero', solve(_vary({'rows': [['x']], 'r': [0, 1], 'c': [1, 1]})), _vary(None))
check('reversed', solve(_vary({'rows': [['a'], ['b']], 'r': [2, 1], 'c': [1, 1]})), _vary(None))
check('row overflow', solve(_vary({'rows': [['a']], 'r': [1, 2], 'c': [1, 1]})), _vary(None))
check('col overflow', solve(_vary({'rows': [['a']], 'r': [1, 1], 'c': [1, 2]})), _vary(None))
check('ragged', solve(_vary({'rows': [['a', 'b'], ['c']], 'r': [1, 1], 'c': [1, 1]})), _vary(None))
check('empty', solve(_vary({'rows': [], 'r': [1, None], 'c': [1, None]})), _vary([]))
check('prefix window', solve(_vary({'rows': [['@', 'b'], ['c', 'd']], 'r': [1, 1], 'c': [1, 1]})), _vary([['@']]))
check('empty explicit', solve(_vary({'rows': [], 'r': [1, 1], 'c': [1, 1]})), _vary(None))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
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 = data['rows']
    rstart, rend = data['r']
    cstart, cend = data['c']
    if not rows: return [] if data['r'] == [1, None] and data['c'] == [1, None] else None
    height, width = len(rows), len(rows[0])
    if any(len(row) != width for row in rows): return None
    rend = height if rend is None else rend
    cend = width if cend is None else cend
    if not 1 <= rstart <= rend <= height: return None
    if not 1 <= cstart <= cend <= width: return None
    return [row[max(0,cstart-2):cend] for row in rows[rstart-1:rend]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('window', solve(_vary({'rows': [['a', 'b', 'c'], ['d', '@', 'f'], ['g', 'h', 'i']], 'r': [2, 3], 'c': [2, 3]})), _vary([['@', 'f'], ['h', 'i']]))
check('full', solve(_vary({'rows': [['@', 'x']], 'r': [1, None], 'c': [1, None]})), _vary([['@', 'x']]))
check('zero', solve(_vary({'rows': [['x']], 'r': [0, 1], 'c': [1, 1]})), _vary(None))
check('reversed', solve(_vary({'rows': [['a'], ['b']], 'r': [2, 1], 'c': [1, 1]})), _vary(None))
check('row overflow', solve(_vary({'rows': [['a']], 'r': [1, 2], 'c': [1, 1]})), _vary(None))
check('col overflow', solve(_vary({'rows': [['a']], 'r': [1, 1], 'c': [1, 2]})), _vary(None))
check('ragged', solve(_vary({'rows': [['a', 'b'], ['c']], 'r': [1, 1], 'c': [1, 1]})), _vary(None))
check('empty', solve(_vary({'rows': [], 'r': [1, None], 'c': [1, None]})), _vary([]))
check('prefix window', solve(_vary({'rows': [['@', 'b'], ['c', 'd']], 'r': [1, 1], 'c': [1, 1]})), _vary([['@']]))
check('empty explicit', solve(_vary({'rows': [], 'r': [1, 1], 'c': [1, 1]})), _vary(None))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

Select physical cells from a rectangular table using one-based inclusive row and column intervals. Omitted end means last; zero and reversed or out-of-range bounds reject. An empty table accepts only both default [1,null] selectors and produces empty output. Preserve selected order.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    rows = data['rows']
    rstart, rend = data['r']
    cstart, cend = data['c']
    if not rows: return [] if data['r'] == [1, None] and data['c'] == [1, None] else None
    height, width = len(rows), len(rows[0])
    if any(len(row) != width for row in rows): return None
    rend = height if rend is None else rend
    cend = width if cend is None else cend
    if not 1 <= rstart <= rend <= height: return None
    if not 1 <= cstart <= cend <= width: return None
    return [row[cstart-1:cend] for row in rows[rstart-1:rend-1]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('window', solve(_vary({'rows': [['a', 'b', 'c'], ['d', '@', 'f'], ['g', 'h', 'i']], 'r': [2, 3], 'c': [2, 3]})), _vary([['@', 'f'], ['h', 'i']]))
check('full', solve(_vary({'rows': [['@', 'x']], 'r': [1, None], 'c': [1, None]})), _vary([['@', 'x']]))
check('zero', solve(_vary({'rows': [['x']], 'r': [0, 1], 'c': [1, 1]})), _vary(None))
check('reversed', solve(_vary({'rows': [['a'], ['b']], 'r': [2, 1], 'c': [1, 1]})), _vary(None))
check('row overflow', solve(_vary({'rows': [['a']], 'r': [1, 2], 'c': [1, 1]})), _vary(None))
check('col overflow', solve(_vary({'rows': [['a']], 'r': [1, 1], 'c': [1, 2]})), _vary(None))
check('ragged', solve(_vary({'rows': [['a', 'b'], ['c']], 'r': [1, 1], 'c': [1, 1]})), _vary(None))
check('empty', solve(_vary({'rows': [], 'r': [1, None], 'c': [1, None]})), _vary([]))
check('prefix window', solve(_vary({'rows': [['@', 'b'], ['c', 'd']], 'r': [1, 1], 'c': [1, 1]})), _vary([['@']]))
check('empty explicit', solve(_vary({'rows': [], 'r': [1, 1], 'c': [1, 1]})), _vary(None))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
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 = data['rows']
    rstart, rend = data['r']
    cstart, cend = data['c']
    if not rows: return [] if data['r'] == [1, None] and data['c'] == [1, None] else None
    height, width = len(rows), len(rows[0])
    if any(len(row) != width for row in rows): return None
    rend = height if rend is None else rend
    cend = width if cend is None else cend
    if not 1 <= rstart <= rend <= height: return None
    if not 1 <= cstart <= cend <= width: return None
    return [row[cstart-1:cend] for row in rows[rstart-1:rend+1]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('window', solve(_vary({'rows': [['a', 'b', 'c'], ['d', '@', 'f'], ['g', 'h', 'i']], 'r': [2, 3], 'c': [2, 3]})), _vary([['@', 'f'], ['h', 'i']]))
check('full', solve(_vary({'rows': [['@', 'x']], 'r': [1, None], 'c': [1, None]})), _vary([['@', 'x']]))
check('zero', solve(_vary({'rows': [['x']], 'r': [0, 1], 'c': [1, 1]})), _vary(None))
check('reversed', solve(_vary({'rows': [['a'], ['b']], 'r': [2, 1], 'c': [1, 1]})), _vary(None))
check('row overflow', solve(_vary({'rows': [['a']], 'r': [1, 2], 'c': [1, 1]})), _vary(None))
check('col overflow', solve(_vary({'rows': [['a']], 'r': [1, 1], 'c': [1, 2]})), _vary(None))
check('ragged', solve(_vary({'rows': [['a', 'b'], ['c']], 'r': [1, 1], 'c': [1, 1]})), _vary(None))
check('empty', solve(_vary({'rows': [], 'r': [1, None], 'c': [1, None]})), _vary([]))
check('prefix window', solve(_vary({'rows': [['@', 'b'], ['c', 'd']], 'r': [1, 1], 'c': [1, 1]})), _vary([['@']]))
check('empty explicit', solve(_vary({'rows': [], 'r': [1, 1], 'c': [1, 1]})), _vary(None))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

Select physical cells from a rectangular table using one-based inclusive row and column intervals. Omitted end means last; zero and reversed or out-of-range bounds reject. An empty table accepts only both default [1,null] selectors and produces empty output. Preserve selected order.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    rows = data['rows']
    rstart, rend = data['r']
    cstart, cend = data['c']
    if not rows: return [] if data['r'] == [1, None] and data['c'] == [1, None] else None
    height, width = len(rows), len(rows[0])
    if any(len(row) != width for row in rows): return None
    rend = height if rend is None else rend
    cend = width if cend is None else cend
    if not 1 <= rstart <= rend <= height: return None
    if not 1 <= cstart <= cend <= width: return None
    return [row[cstart-1:cend-1] for row in rows[rstart-1:rend]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('window', solve(_vary({'rows': [['a', 'b', 'c'], ['d', '@', 'f'], ['g', 'h', 'i']], 'r': [2, 3], 'c': [2, 3]})), _vary([['@', 'f'], ['h', 'i']]))
check('full', solve(_vary({'rows': [['@', 'x']], 'r': [1, None], 'c': [1, None]})), _vary([['@', 'x']]))
check('zero', solve(_vary({'rows': [['x']], 'r': [0, 1], 'c': [1, 1]})), _vary(None))
check('reversed', solve(_vary({'rows': [['a'], ['b']], 'r': [2, 1], 'c': [1, 1]})), _vary(None))
check('row overflow', solve(_vary({'rows': [['a']], 'r': [1, 2], 'c': [1, 1]})), _vary(None))
check('col overflow', solve(_vary({'rows': [['a']], 'r': [1, 1], 'c': [1, 2]})), _vary(None))
check('ragged', solve(_vary({'rows': [['a', 'b'], ['c']], 'r': [1, 1], 'c': [1, 1]})), _vary(None))
check('empty', solve(_vary({'rows': [], 'r': [1, None], 'c': [1, None]})), _vary([]))
check('prefix window', solve(_vary({'rows': [['@', 'b'], ['c', 'd']], 'r': [1, 1], 'c': [1, 1]})), _vary([['@']]))
check('empty explicit', solve(_vary({'rows': [], 'r': [1, 1], 'c': [1, 1]})), _vary(None))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
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 = data['rows']
    rstart, rend = data['r']
    cstart, cend = data['c']
    if not rows: return [] if data['r'] == [1, None] and data['c'] == [1, None] else None
    height, width = len(rows), len(rows[0])
    if any(len(row) != width for row in rows): return None
    rend = height if rend is None else rend
    cend = width if cend is None else cend
    if not 1 <= rstart <= rend <= height: return None
    if not 1 <= cstart <= cend <= width: return None
    return [row[cstart-1:cend+1] for row in rows[rstart-1:rend]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('window', solve(_vary({'rows': [['a', 'b', 'c'], ['d', '@', 'f'], ['g', 'h', 'i']], 'r': [2, 3], 'c': [2, 3]})), _vary([['@', 'f'], ['h', 'i']]))
check('full', solve(_vary({'rows': [['@', 'x']], 'r': [1, None], 'c': [1, None]})), _vary([['@', 'x']]))
check('zero', solve(_vary({'rows': [['x']], 'r': [0, 1], 'c': [1, 1]})), _vary(None))
check('reversed', solve(_vary({'rows': [['a'], ['b']], 'r': [2, 1], 'c': [1, 1]})), _vary(None))
check('row overflow', solve(_vary({'rows': [['a']], 'r': [1, 2], 'c': [1, 1]})), _vary(None))
check('col overflow', solve(_vary({'rows': [['a']], 'r': [1, 1], 'c': [1, 2]})), _vary(None))
check('ragged', solve(_vary({'rows': [['a', 'b'], ['c']], 'r': [1, 1], 'c': [1, 1]})), _vary(None))
check('empty', solve(_vary({'rows': [], 'r': [1, None], 'c': [1, None]})), _vary([]))
check('prefix window', solve(_vary({'rows': [['@', 'b'], ['c', 'd']], 'r': [1, 1], 'c': [1, 1]})), _vary([['@']]))
check('empty explicit', solve(_vary({'rows': [], 'r': [1, 1], 'c': [1, 1]})), _vary(None))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

Select physical cells from a rectangular table using one-based inclusive row and column intervals. Omitted end means last; zero and reversed or out-of-range bounds reject. An empty table accepts only both default [1,null] selectors and produces empty output. Preserve selected order.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    rows = data['rows']
    rstart, rend = data['r']
    cstart, cend = data['c']
    if not rows: return [] if data['r'] == [1, None] and data['c'] == [1, None] else None
    height, width = len(rows), len(rows[0])
    if False: return None
    rend = height if rend is None else rend
    cend = width if cend is None else cend
    if not 1 <= rstart <= rend <= height: return None
    if not 1 <= cstart <= cend <= width: return None
    return [row[cstart-1:cend] for row in rows[rstart-1:rend]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('window', solve(_vary({'rows': [['a', 'b', 'c'], ['d', '@', 'f'], ['g', 'h', 'i']], 'r': [2, 3], 'c': [2, 3]})), _vary([['@', 'f'], ['h', 'i']]))
check('full', solve(_vary({'rows': [['@', 'x']], 'r': [1, None], 'c': [1, None]})), _vary([['@', 'x']]))
check('zero', solve(_vary({'rows': [['x']], 'r': [0, 1], 'c': [1, 1]})), _vary(None))
check('reversed', solve(_vary({'rows': [['a'], ['b']], 'r': [2, 1], 'c': [1, 1]})), _vary(None))
check('row overflow', solve(_vary({'rows': [['a']], 'r': [1, 2], 'c': [1, 1]})), _vary(None))
check('col overflow', solve(_vary({'rows': [['a']], 'r': [1, 1], 'c': [1, 2]})), _vary(None))
check('ragged', solve(_vary({'rows': [['a', 'b'], ['c']], 'r': [1, 1], 'c': [1, 1]})), _vary(None))
check('empty', solve(_vary({'rows': [], 'r': [1, None], 'c': [1, None]})), _vary([]))
check('prefix window', solve(_vary({'rows': [['@', 'b'], ['c', 'd']], 'r': [1, 1], 'c': [1, 1]})), _vary([['@']]))
check('empty explicit', solve(_vary({'rows': [], 'r': [1, 1], 'c': [1, 1]})), _vary(None))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
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 = data['rows']
    rstart, rend = data['r']
    cstart, cend = data['c']
    if not rows: return [] if data['r'] == [1, None] and data['c'] == [1, None] else None
    height, width = len(rows), len(rows[0])
    if len(rows[-1]) > width: return None
    rend = height if rend is None else rend
    cend = width if cend is None else cend
    if not 1 <= rstart <= rend <= height: return None
    if not 1 <= cstart <= cend <= width: return None
    return [row[cstart-1:cend] for row in rows[rstart-1:rend]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('window', solve(_vary({'rows': [['a', 'b', 'c'], ['d', '@', 'f'], ['g', 'h', 'i']], 'r': [2, 3], 'c': [2, 3]})), _vary([['@', 'f'], ['h', 'i']]))
check('full', solve(_vary({'rows': [['@', 'x']], 'r': [1, None], 'c': [1, None]})), _vary([['@', 'x']]))
check('zero', solve(_vary({'rows': [['x']], 'r': [0, 1], 'c': [1, 1]})), _vary(None))
check('reversed', solve(_vary({'rows': [['a'], ['b']], 'r': [2, 1], 'c': [1, 1]})), _vary(None))
check('row overflow', solve(_vary({'rows': [['a']], 'r': [1, 2], 'c': [1, 1]})), _vary(None))
check('col overflow', solve(_vary({'rows': [['a']], 'r': [1, 1], 'c': [1, 2]})), _vary(None))
check('ragged', solve(_vary({'rows': [['a', 'b'], ['c']], 'r': [1, 1], 'c': [1, 1]})), _vary(None))
check('empty', solve(_vary({'rows': [], 'r': [1, None], 'c': [1, None]})), _vary([]))
check('prefix window', solve(_vary({'rows': [['@', 'b'], ['c', 'd']], 'r': [1, 1], 'c': [1, 1]})), _vary([['@']]))
check('empty explicit', solve(_vary({'rows': [], 'r': [1, 1], 'c': [1, 1]})), _vary(None))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

Select physical cells from a rectangular table using one-based inclusive row and column intervals. Omitted end means last; zero and reversed or out-of-range bounds reject. An empty table accepts only both default [1,null] selectors and produces empty output. Preserve selected order.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    lines = list(data)
    if not lines: return [',', []]
    if False: lines[0] = lines[0][1:]
    delimiter = ','
    if lines[0].startswith('sep='):
        value = lines.pop(0)[4:]
        if len(value) != 1 or value in '\r\n"': return None
        delimiter = value
    return [delimiter, [line.split(delimiter) for line in lines]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('custom', solve(_vary(['sep=;', '@;x'])), _vary([';', [['@', 'x']]]))
check('BOM directive', solve(_vary(['\ufeffsep=;', '@;x'])), _vary([';', [['@', 'x']]]))
check('default', solve(_vary(['@,x'])), _vary([',', [['@', 'x']]]))
check('later directive', solve(_vary(['a,b', 'sep=;'])), _vary([',', [['a', 'b'], ['sep=;']]]))
check('bad multi', solve(_vary(['sep=;;', 'x'])), _vary(None))
check('bad quote', solve(_vary(['sep="', 'x'])), _vary(None))
check('empty marker', solve(_vary(['sep=', 'x'])), _vary(None))
check('directive only', solve(_vary(['sep=;'])), _vary([';', []]))
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):
    lines = list(data)
    if not lines: return [',', []]
    if lines[0] == '\ufeff': lines[0] = ''
    delimiter = ','
    if lines[0].startswith('sep='):
        value = lines.pop(0)[4:]
        if len(value) != 1 or value in '\r\n"': return None
        delimiter = value
    return [delimiter, [line.split(delimiter) for line in lines]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('custom', solve(_vary(['sep=;', '@;x'])), _vary([';', [['@', 'x']]]))
check('BOM directive', solve(_vary(['\ufeffsep=;', '@;x'])), _vary([';', [['@', 'x']]]))
check('default', solve(_vary(['@,x'])), _vary([',', [['@', 'x']]]))
check('later directive', solve(_vary(['a,b', 'sep=;'])), _vary([',', [['a', 'b'], ['sep=;']]]))
check('bad multi', solve(_vary(['sep=;;', 'x'])), _vary(None))
check('bad quote', solve(_vary(['sep="', 'x'])), _vary(None))
check('empty marker', solve(_vary(['sep=', 'x'])), _vary(None))
check('directive only', solve(_vary(['sep=;'])), _vary([';', []]))
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 a table with optional exact first line sep=<single nonquote, nonnewline character>. A first-line BOM is removed before recognizing this directive. Without directive use comma. The directive is not data. Later sep= lines are ordinary records. Return delimiter and split records; empty input has no records.

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):
    lines = list(data)
    if not lines: return [',', []]
    if lines[0].startswith('\ufeff'): lines[0] = lines[0][1:]
    delimiter = ','
    if lines[0].startswith('sep='):
        value = lines[0][4:]
        if len(value) != 1 or value in '\r\n"': return None
        delimiter = value
    return [delimiter, [line.split(delimiter) for line in lines]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('custom', solve(_vary(['sep=;', '@;x'])), _vary([';', [['@', 'x']]]))
check('BOM directive', solve(_vary(['\ufeffsep=;', '@;x'])), _vary([';', [['@', 'x']]]))
check('default', solve(_vary(['@,x'])), _vary([',', [['@', 'x']]]))
check('later directive', solve(_vary(['a,b', 'sep=;'])), _vary([',', [['a', 'b'], ['sep=;']]]))
check('bad multi', solve(_vary(['sep=;;', 'x'])), _vary(None))
check('bad quote', solve(_vary(['sep="', 'x'])), _vary(None))
check('empty marker', solve(_vary(['sep=', 'x'])), _vary(None))
check('directive only', solve(_vary(['sep=;'])), _vary([';', []]))
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):
    lines = list(data)
    if not lines: return [',', []]
    if lines[0].startswith('\ufeff'): lines[0] = lines[0][1:]
    delimiter = ','
    if lines[0].startswith('sep='):
        value = lines.pop()[4:]
        if len(value) != 1 or value in '\r\n"': return None
        delimiter = value
    return [delimiter, [line.split(delimiter) for line in lines]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('custom', solve(_vary(['sep=;', '@;x'])), _vary([';', [['@', 'x']]]))
check('BOM directive', solve(_vary(['\ufeffsep=;', '@;x'])), _vary([';', [['@', 'x']]]))
check('default', solve(_vary(['@,x'])), _vary([',', [['@', 'x']]]))
check('later directive', solve(_vary(['a,b', 'sep=;'])), _vary([',', [['a', 'b'], ['sep=;']]]))
check('bad multi', solve(_vary(['sep=;;', 'x'])), _vary(None))
check('bad quote', solve(_vary(['sep="', 'x'])), _vary(None))
check('empty marker', solve(_vary(['sep=', 'x'])), _vary(None))
check('directive only', solve(_vary(['sep=;'])), _vary([';', []]))
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 a table with optional exact first line sep=<single nonquote, nonnewline character>. A first-line BOM is removed before recognizing this directive. Without directive use comma. The directive is not data. Later sep= lines are ordinary records. Return delimiter and split records; empty input has no records.

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):
    lines = list(data)
    if not lines: return [',', []]
    if lines[0].startswith('\ufeff'): lines[0] = lines[0][1:]
    delimiter = ','
    if lines[0].startswith('sep='):
        value = lines.pop(0)[3:]
        if len(value) != 1 or value in '\r\n"': return None
        delimiter = value
    return [delimiter, [line.split(delimiter) for line in lines]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('custom', solve(_vary(['sep=;', '@;x'])), _vary([';', [['@', 'x']]]))
check('BOM directive', solve(_vary(['\ufeffsep=;', '@;x'])), _vary([';', [['@', 'x']]]))
check('default', solve(_vary(['@,x'])), _vary([',', [['@', 'x']]]))
check('later directive', solve(_vary(['a,b', 'sep=;'])), _vary([',', [['a', 'b'], ['sep=;']]]))
check('bad multi', solve(_vary(['sep=;;', 'x'])), _vary(None))
check('bad quote', solve(_vary(['sep="', 'x'])), _vary(None))
check('empty marker', solve(_vary(['sep=', 'x'])), _vary(None))
check('directive only', solve(_vary(['sep=;'])), _vary([';', []]))
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):
    lines = list(data)
    if not lines: return [',', []]
    if lines[0].startswith('\ufeff'): lines[0] = lines[0][1:]
    delimiter = ','
    if lines[0].startswith('sep='):
        value = lines.pop(0)[5:]
        if len(value) != 1 or value in '\r\n"': return None
        delimiter = value
    return [delimiter, [line.split(delimiter) for line in lines]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('custom', solve(_vary(['sep=;', '@;x'])), _vary([';', [['@', 'x']]]))
check('BOM directive', solve(_vary(['\ufeffsep=;', '@;x'])), _vary([';', [['@', 'x']]]))
check('default', solve(_vary(['@,x'])), _vary([',', [['@', 'x']]]))
check('later directive', solve(_vary(['a,b', 'sep=;'])), _vary([',', [['a', 'b'], ['sep=;']]]))
check('bad multi', solve(_vary(['sep=;;', 'x'])), _vary(None))
check('bad quote', solve(_vary(['sep="', 'x'])), _vary(None))
check('empty marker', solve(_vary(['sep=', 'x'])), _vary(None))
check('directive only', solve(_vary(['sep=;'])), _vary([';', []]))
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 a table with optional exact first line sep=<single nonquote, nonnewline character>. A first-line BOM is removed before recognizing this directive. Without directive use comma. The directive is not data. Later sep= lines are ordinary records. Return delimiter and split records; empty input has no records.

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):
    lines = list(data)
    if not lines: return [',', []]
    if lines[0].startswith('\ufeff'): lines[0] = lines[0][1:]
    delimiter = ','
    if lines[0].startswith('sep='):
        value = lines.pop(0)[4:]
        if len(value) != 1 or value in '\r\n"': return None
        delimiter = delimiter
    return [delimiter, [line.split(delimiter) for line in lines]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('custom', solve(_vary(['sep=;', '@;x'])), _vary([';', [['@', 'x']]]))
check('BOM directive', solve(_vary(['\ufeffsep=;', '@;x'])), _vary([';', [['@', 'x']]]))
check('default', solve(_vary(['@,x'])), _vary([',', [['@', 'x']]]))
check('later directive', solve(_vary(['a,b', 'sep=;'])), _vary([',', [['a', 'b'], ['sep=;']]]))
check('bad multi', solve(_vary(['sep=;;', 'x'])), _vary(None))
check('bad quote', solve(_vary(['sep="', 'x'])), _vary(None))
check('empty marker', solve(_vary(['sep=', 'x'])), _vary(None))
check('directive only', solve(_vary(['sep=;'])), _vary([';', []]))
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):
    lines = list(data)
    if not lines: return [',', []]
    if lines[0].startswith('\ufeff'): lines[0] = lines[0][1:]
    delimiter = ','
    if lines[0].startswith('sep='):
        value = lines.pop(0)[4:]
        if len(value) != 1 or value in '\r\n"': return None
        delimiter = ','
    return [delimiter, [line.split(delimiter) for line in lines]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('custom', solve(_vary(['sep=;', '@;x'])), _vary([';', [['@', 'x']]]))
check('BOM directive', solve(_vary(['\ufeffsep=;', '@;x'])), _vary([';', [['@', 'x']]]))
check('default', solve(_vary(['@,x'])), _vary([',', [['@', 'x']]]))
check('later directive', solve(_vary(['a,b', 'sep=;'])), _vary([',', [['a', 'b'], ['sep=;']]]))
check('bad multi', solve(_vary(['sep=;;', 'x'])), _vary(None))
check('bad quote', solve(_vary(['sep="', 'x'])), _vary(None))
check('empty marker', solve(_vary(['sep=', 'x'])), _vary(None))
check('directive only', solve(_vary(['sep=;'])), _vary([';', []]))
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 a table with optional exact first line sep=<single nonquote, nonnewline character>. A first-line BOM is removed before recognizing this directive. Without directive use comma. The directive is not data. Later sep= lines are ordinary records. Return delimiter and split records; empty input has no records.

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):
    lines = list(data)
    if not lines: return [',', []]
    if lines[0].startswith('\ufeff'): lines[0] = lines[0][1:]
    delimiter = ','
    if lines[0].startswith('sep='):
        value = lines.pop(0)[4:]
        if len(value) != 1 or value in '\r\n': return None
        delimiter = value
    return [delimiter, [line.split(delimiter) for line in lines]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('custom', solve(_vary(['sep=;', '@;x'])), _vary([';', [['@', 'x']]]))
check('BOM directive', solve(_vary(['\ufeffsep=;', '@;x'])), _vary([';', [['@', 'x']]]))
check('default', solve(_vary(['@,x'])), _vary([',', [['@', 'x']]]))
check('later directive', solve(_vary(['a,b', 'sep=;'])), _vary([',', [['a', 'b'], ['sep=;']]]))
check('bad multi', solve(_vary(['sep=;;', 'x'])), _vary(None))
check('bad quote', solve(_vary(['sep="', 'x'])), _vary(None))
check('empty marker', solve(_vary(['sep=', 'x'])), _vary(None))
check('directive only', solve(_vary(['sep=;'])), _vary([';', []]))
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):
    lines = list(data)
    if not lines: return [',', []]
    if lines[0].startswith('\ufeff'): lines[0] = lines[0][1:]
    delimiter = ','
    if lines[0].startswith('sep='):
        value = lines.pop(0)[4:]
        if len(value) != 1 or value in '\n': return None
        delimiter = value
    return [delimiter, [line.split(delimiter) for line in lines]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('custom', solve(_vary(['sep=;', '@;x'])), _vary([';', [['@', 'x']]]))
check('BOM directive', solve(_vary(['\ufeffsep=;', '@;x'])), _vary([';', [['@', 'x']]]))
check('default', solve(_vary(['@,x'])), _vary([',', [['@', 'x']]]))
check('later directive', solve(_vary(['a,b', 'sep=;'])), _vary([',', [['a', 'b'], ['sep=;']]]))
check('bad multi', solve(_vary(['sep=;;', 'x'])), _vary(None))
check('bad quote', solve(_vary(['sep="', 'x'])), _vary(None))
check('empty marker', solve(_vary(['sep=', 'x'])), _vary(None))
check('directive only', solve(_vary(['sep=;'])), _vary([';', []]))
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 a table with optional exact first line sep=<single nonquote, nonnewline character>. A first-line BOM is removed before recognizing this directive. Without directive use comma. The directive is not data. Later sep= lines are ordinary records. Return delimiter and split records; empty input has no records.

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):
    if not data or not data[0].startswith('H,'): return None
    width = len(data[0].split(',')) - 1
    rows, closed = [], False
    for line in data[1:]:
        if closed: return None
        cells = line.split(',')
        if cells[0] == 'D':
            if len(cells) - 1 != width: return None
            rows.append(cells)
        elif cells[0] == 'F':
            if len(cells) != 2 or not cells[1].isascii() or not cells[1].isdecimal(): return None
            if int(cells[1]) != len(rows): return None
            closed = True
        else: return None
    if not closed: return None
    return rows
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('table', solve(_vary(['H,a,b', 'D,@,x', 'D,y,z', 'F,2'])), _vary([['@', 'x'], ['y', 'z']]))
check('count mismatch', solve(_vary(['H,a', 'D,@', 'F,2'])), _vary(None))
check('after footer', solve(_vary(['H,a', 'F,0', 'D,@'])), _vary(None))
check('missing footer', solve(_vary(['H,a', 'D,@'])), _vary(None))
check('empty body', solve(_vary(['H,a', 'F,0'])), _vary([]))
check('bad tag', solve(_vary(['H,a', 'X,@', 'F,1'])), _vary(None))
check('bad width', solve(_vary(['H,a,b', 'D,@', 'F,1'])), _vary(None))
check('missing header', solve(_vary(['D,@', 'F,1'])), _vary(None))
check('second footer', solve(_vary(['H,a', 'F,0', 'F,0'])), _vary(None))
check('bad count', solve(_vary(['H,a', 'F,-1'])), _vary(None))
check('unknown not counted', solve(_vary(['H,a', 'X,@', 'F,0'])), _vary(None))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
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):
    if not data or not data[0].startswith('H,'): return None
    width = len(data[0].split(',')) - 1
    rows, closed = [], False
    for line in data[1:]:
        if closed: return None
        cells = line.split(',')
        if cells[0] == 'D':
            if len(cells) - 1 != width: return None
            rows.append(cells[1:-1])
        elif cells[0] == 'F':
            if len(cells) != 2 or not cells[1].isascii() or not cells[1].isdecimal(): return None
            if int(cells[1]) != len(rows): return None
            closed = True
        else: return None
    if not closed: return None
    return rows
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('table', solve(_vary(['H,a,b', 'D,@,x', 'D,y,z', 'F,2'])), _vary([['@', 'x'], ['y', 'z']]))
check('count mismatch', solve(_vary(['H,a', 'D,@', 'F,2'])), _vary(None))
check('after footer', solve(_vary(['H,a', 'F,0', 'D,@'])), _vary(None))
check('missing footer', solve(_vary(['H,a', 'D,@'])), _vary(None))
check('empty body', solve(_vary(['H,a', 'F,0'])), _vary([]))
check('bad tag', solve(_vary(['H,a', 'X,@', 'F,1'])), _vary(None))
check('bad width', solve(_vary(['H,a,b', 'D,@', 'F,1'])), _vary(None))
check('missing header', solve(_vary(['D,@', 'F,1'])), _vary(None))
check('second footer', solve(_vary(['H,a', 'F,0', 'F,0'])), _vary(None))
check('bad count', solve(_vary(['H,a', 'F,-1'])), _vary(None))
check('unknown not counted', solve(_vary(['H,a', 'X,@', 'F,0'])), _vary(None))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

Read a comma table with header H,<column names>, body D,<values>, and final F,<body count>. Reject missing or misplaced footer, count mismatch, malformed tags, unequal body width, and missing header. Count only body records. Return body arrays.

split: open-access