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[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) + 1: 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:])
        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


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: continue
        cells = line.split(',')
        if cells[0] == 'D':
            if len(cells) - 1 != width: return None
            rows.append(cells[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)

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):
    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: closed = False
        cells = line.split(',')
        if cells[0] == 'D':
            if len(cells) - 1 != width: return None
            rows.append(cells[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


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[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 False: 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:])
        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 and not rows: 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


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[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: continue
    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:])
        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: rows.append(cells[1:])
    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


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for cell in data.split(';'):
        if cell.startswith('['):
            if not cell.endswith(']'): return None
            inner = cell[1:-1]
            if '[' in inner or ']' in inner: return None
            value = inner.split('|')
        else:
            if '[' in cell or ']' in cell: return None
            value = cell
        out.append(value)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mixed', solve(_vary('@;[a|b]')), _vary(['@', ['a', 'b']]))
check('empty list', solve(_vary('[]')), _vary([[]]))
check('empty elements', solve(_vary('[|a|]')), _vary([['', 'a', '']]))
check('bare empty', solve(_vary('')), _vary(['']))
check('unclosed', solve(_vary('[a')), _vary(None))
check('suffix', solve(_vary('[a]tail')), _vary(None))
check('nested', solve(_vary('[[a]]')), _vary(None))
check('bare bracket', solve(_vary('a]')), _vary(None))
check('pipe bare', solve(_vary('a|b')), _vary(['a|b']))
check('three list', solve(_vary('[a|b|c]')), _vary([['a', 'b', 'c']]))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for cell in data.split(';'):
        if cell.startswith('['):
            if not cell.endswith(']'): return None
            inner = cell[1:-1]
            if '[' in inner or ']' in inner: return None
            value = [inner] if inner == '' else inner.split('|')
        else:
            if '[' in cell or ']' in cell: return None
            value = cell
        out.append(value)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mixed', solve(_vary('@;[a|b]')), _vary(['@', ['a', 'b']]))
check('empty list', solve(_vary('[]')), _vary([[]]))
check('empty elements', solve(_vary('[|a|]')), _vary([['', 'a', '']]))
check('bare empty', solve(_vary('')), _vary(['']))
check('unclosed', solve(_vary('[a')), _vary(None))
check('suffix', solve(_vary('[a]tail')), _vary(None))
check('nested', solve(_vary('[[a]]')), _vary(None))
check('bare bracket', solve(_vary('a]')), _vary(None))
check('pipe bare', solve(_vary('a|b')), _vary(['a|b']))
check('three list', solve(_vary('[a|b|c]')), _vary([['a', 'b', 'c']]))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

Decode a semicolon table row whose cells are either bare scalar text or bracketed pipe lists. Backslash has no special role. List elements may be empty; [] is an empty list. Brackets must occupy the whole cell; nested brackets reject. Return each cell as scalar text or a list.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for cell in data.split(';'):
        if cell.startswith('['):
            if not cell.endswith(']'): return None
            inner = cell[1:-1]
            if '[' in inner or ']' in inner: return None
            value = [] if inner == '' else [x for x in inner.split('|') if x]
        else:
            if '[' in cell or ']' in cell: return None
            value = cell
        out.append(value)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mixed', solve(_vary('@;[a|b]')), _vary(['@', ['a', 'b']]))
check('empty list', solve(_vary('[]')), _vary([[]]))
check('empty elements', solve(_vary('[|a|]')), _vary([['', 'a', '']]))
check('bare empty', solve(_vary('')), _vary(['']))
check('unclosed', solve(_vary('[a')), _vary(None))
check('suffix', solve(_vary('[a]tail')), _vary(None))
check('nested', solve(_vary('[[a]]')), _vary(None))
check('bare bracket', solve(_vary('a]')), _vary(None))
check('pipe bare', solve(_vary('a|b')), _vary(['a|b']))
check('three list', solve(_vary('[a|b|c]')), _vary([['a', 'b', 'c']]))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for cell in data.split(';'):
        if cell.startswith('['):
            if not cell.endswith(']'): return None
            inner = cell[1:-1]
            if '[' in inner or ']' in inner: return None
            value = [] if inner == '' else inner.strip('|').split('|')
        else:
            if '[' in cell or ']' in cell: return None
            value = cell
        out.append(value)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mixed', solve(_vary('@;[a|b]')), _vary(['@', ['a', 'b']]))
check('empty list', solve(_vary('[]')), _vary([[]]))
check('empty elements', solve(_vary('[|a|]')), _vary([['', 'a', '']]))
check('bare empty', solve(_vary('')), _vary(['']))
check('unclosed', solve(_vary('[a')), _vary(None))
check('suffix', solve(_vary('[a]tail')), _vary(None))
check('nested', solve(_vary('[[a]]')), _vary(None))
check('bare bracket', solve(_vary('a]')), _vary(None))
check('pipe bare', solve(_vary('a|b')), _vary(['a|b']))
check('three list', solve(_vary('[a|b|c]')), _vary([['a', 'b', 'c']]))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

Decode a semicolon table row whose cells are either bare scalar text or bracketed pipe lists. Backslash has no special role. List elements may be empty; [] is an empty list. Brackets must occupy the whole cell; nested brackets reject. Return each cell as scalar text or a list.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for cell in data.split(';'):
        if cell.startswith('['):
            if not cell.endswith(']'): return None
            inner = cell[1:-1]
            if False: return None
            value = [] if inner == '' else inner.split('|')
        else:
            if '[' in cell or ']' in cell: return None
            value = cell
        out.append(value)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mixed', solve(_vary('@;[a|b]')), _vary(['@', ['a', 'b']]))
check('empty list', solve(_vary('[]')), _vary([[]]))
check('empty elements', solve(_vary('[|a|]')), _vary([['', 'a', '']]))
check('bare empty', solve(_vary('')), _vary(['']))
check('unclosed', solve(_vary('[a')), _vary(None))
check('suffix', solve(_vary('[a]tail')), _vary(None))
check('nested', solve(_vary('[[a]]')), _vary(None))
check('bare bracket', solve(_vary('a]')), _vary(None))
check('pipe bare', solve(_vary('a|b')), _vary(['a|b']))
check('three list', solve(_vary('[a|b|c]')), _vary([['a', 'b', 'c']]))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for cell in data.split(';'):
        if cell.startswith('['):
            if not cell.endswith(']'): return None
            inner = cell[1:-1]
            if '[' in inner and ']' not in inner: return None
            value = [] if inner == '' else inner.split('|')
        else:
            if '[' in cell or ']' in cell: return None
            value = cell
        out.append(value)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mixed', solve(_vary('@;[a|b]')), _vary(['@', ['a', 'b']]))
check('empty list', solve(_vary('[]')), _vary([[]]))
check('empty elements', solve(_vary('[|a|]')), _vary([['', 'a', '']]))
check('bare empty', solve(_vary('')), _vary(['']))
check('unclosed', solve(_vary('[a')), _vary(None))
check('suffix', solve(_vary('[a]tail')), _vary(None))
check('nested', solve(_vary('[[a]]')), _vary(None))
check('bare bracket', solve(_vary('a]')), _vary(None))
check('pipe bare', solve(_vary('a|b')), _vary(['a|b']))
check('three list', solve(_vary('[a|b|c]')), _vary([['a', 'b', 'c']]))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

Decode a semicolon table row whose cells are either bare scalar text or bracketed pipe lists. Backslash has no special role. List elements may be empty; [] is an empty list. Brackets must occupy the whole cell; nested brackets reject. Return each cell as scalar text or a list.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for cell in data.split(';'):
        if cell.startswith('['):
            if not cell.endswith(']'): return None
            inner = cell[1:-1]
            if '[' in inner or ']' in inner: return None
            value = [] if inner == '' else inner.split('|')
        else:
            if '[' in cell or ']' in cell: return None
            value = cell.split('|')
        out.append(value)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mixed', solve(_vary('@;[a|b]')), _vary(['@', ['a', 'b']]))
check('empty list', solve(_vary('[]')), _vary([[]]))
check('empty elements', solve(_vary('[|a|]')), _vary([['', 'a', '']]))
check('bare empty', solve(_vary('')), _vary(['']))
check('unclosed', solve(_vary('[a')), _vary(None))
check('suffix', solve(_vary('[a]tail')), _vary(None))
check('nested', solve(_vary('[[a]]')), _vary(None))
check('bare bracket', solve(_vary('a]')), _vary(None))
check('pipe bare', solve(_vary('a|b')), _vary(['a|b']))
check('three list', solve(_vary('[a|b|c]')), _vary([['a', 'b', 'c']]))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for cell in data.split(';'):
        if cell.startswith('['):
            if not cell.endswith(']'): return None
            inner = cell[1:-1]
            if '[' in inner or ']' in inner: return None
            value = [] if inner == '' else inner.split('|')
        else:
            if '[' in cell or ']' in cell: return None
            value = cell.split('|') if '|' in cell else cell
        out.append(value)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mixed', solve(_vary('@;[a|b]')), _vary(['@', ['a', 'b']]))
check('empty list', solve(_vary('[]')), _vary([[]]))
check('empty elements', solve(_vary('[|a|]')), _vary([['', 'a', '']]))
check('bare empty', solve(_vary('')), _vary(['']))
check('unclosed', solve(_vary('[a')), _vary(None))
check('suffix', solve(_vary('[a]tail')), _vary(None))
check('nested', solve(_vary('[[a]]')), _vary(None))
check('bare bracket', solve(_vary('a]')), _vary(None))
check('pipe bare', solve(_vary('a|b')), _vary(['a|b']))
check('three list', solve(_vary('[a|b|c]')), _vary([['a', 'b', 'c']]))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

Decode a semicolon table row whose cells are either bare scalar text or bracketed pipe lists. Backslash has no special role. List elements may be empty; [] is an empty list. Brackets must occupy the whole cell; nested brackets reject. Return each cell as scalar text or a list.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for cell in data.split(';'):
        if cell.startswith('['):
            if not cell.endswith(']'): return None
            inner = cell[1:-2]
            if '[' in inner or ']' in inner: return None
            value = [] if inner == '' else inner.split('|')
        else:
            if '[' in cell or ']' in cell: return None
            value = cell
        out.append(value)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mixed', solve(_vary('@;[a|b]')), _vary(['@', ['a', 'b']]))
check('empty list', solve(_vary('[]')), _vary([[]]))
check('empty elements', solve(_vary('[|a|]')), _vary([['', 'a', '']]))
check('bare empty', solve(_vary('')), _vary(['']))
check('unclosed', solve(_vary('[a')), _vary(None))
check('suffix', solve(_vary('[a]tail')), _vary(None))
check('nested', solve(_vary('[[a]]')), _vary(None))
check('bare bracket', solve(_vary('a]')), _vary(None))
check('pipe bare', solve(_vary('a|b')), _vary(['a|b']))
check('three list', solve(_vary('[a|b|c]')), _vary([['a', 'b', 'c']]))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for cell in data.split(';'):
        if cell.startswith('['):
            if not cell.endswith(']'): return None
            inner = cell[2:-1]
            if '[' in inner or ']' in inner: return None
            value = [] if inner == '' else inner.split('|')
        else:
            if '[' in cell or ']' in cell: return None
            value = cell
        out.append(value)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mixed', solve(_vary('@;[a|b]')), _vary(['@', ['a', 'b']]))
check('empty list', solve(_vary('[]')), _vary([[]]))
check('empty elements', solve(_vary('[|a|]')), _vary([['', 'a', '']]))
check('bare empty', solve(_vary('')), _vary(['']))
check('unclosed', solve(_vary('[a')), _vary(None))
check('suffix', solve(_vary('[a]tail')), _vary(None))
check('nested', solve(_vary('[[a]]')), _vary(None))
check('bare bracket', solve(_vary('a]')), _vary(None))
check('pipe bare', solve(_vary('a|b')), _vary(['a|b']))
check('three list', solve(_vary('[a|b|c]')), _vary([['a', 'b', 'c']]))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

Decode a semicolon table row whose cells are either bare scalar text or bracketed pipe lists. Backslash has no special role. List elements may be empty; [] is an empty list. Brackets must occupy the whole cell; nested brackets reject. Return each cell as scalar text or a list.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for token in data['selector'].split(','):
        if token == '*':
            out.extend(range(data['width']))
            continue
        parts = token.split('-')
        if len(parts) not in (1,2) or any(not p.isascii() or not p.isdecimal() for p in parts): return None
        start, end = int(parts[0]), int(parts[-1])
        if not 1 <= start <= end <= data['width']: return None
        out.extend(range(start-1, end))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ordered', solve(_vary({'selector': '3,1', 'width': 3})), _vary([2, 0]))
check('range', solve(_vary({'selector': '2-4', 'width': 4})), _vary([1, 2, 3]))
check('wildcard', solve(_vary({'selector': '2,*', 'width': 3})), _vary([1, 0, 2]))
check('duplicate', solve(_vary({'selector': '2,2', 'width': 3})), _vary([1, 1]))
check('reversed', solve(_vary({'selector': '3-1', 'width': 3})), _vary(None))
check('zero', solve(_vary({'selector': '0', 'width': 3})), _vary(None))
check('outside', solve(_vary({'selector': '4', 'width': 3})), _vary(None))
check('bad range', solve(_vary({'selector': '1-2-3', 'width': 3})), _vary(None))
check('empty', solve(_vary({'selector': '', 'width': 3})), _vary(None))
check('variable width', solve(_vary({'selector': '1,*', 'width': 4})), _vary([0, 1, 2, 3]))
check('variant selector width', solve({'selector':'1,*','width':N+2}), list(range(N+2)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for token in data['selector'].split(','):
        if token == '*':
            out.extend(i for i in range(data['width']) if i != out[-1])
            continue
        parts = token.split('-')
        if len(parts) not in (1,2) or any(not p.isascii() or not p.isdecimal() for p in parts): return None
        start, end = int(parts[0]), int(parts[-1])
        if not 1 <= start <= end <= data['width']: return None
        out.extend(range(start-1, end))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ordered', solve(_vary({'selector': '3,1', 'width': 3})), _vary([2, 0]))
check('range', solve(_vary({'selector': '2-4', 'width': 4})), _vary([1, 2, 3]))
check('wildcard', solve(_vary({'selector': '2,*', 'width': 3})), _vary([1, 0, 2]))
check('duplicate', solve(_vary({'selector': '2,2', 'width': 3})), _vary([1, 1]))
check('reversed', solve(_vary({'selector': '3-1', 'width': 3})), _vary(None))
check('zero', solve(_vary({'selector': '0', 'width': 3})), _vary(None))
check('outside', solve(_vary({'selector': '4', 'width': 3})), _vary(None))
check('bad range', solve(_vary({'selector': '1-2-3', 'width': 3})), _vary(None))
check('empty', solve(_vary({'selector': '', 'width': 3})), _vary(None))
check('variable width', solve(_vary({'selector': '1,*', 'width': 4})), _vary([0, 1, 2, 3]))
check('variant selector width', solve({'selector':'1,*','width':N+2}), list(range(N+2)))
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 an ordered comma column selector against width. Decimal selectors are one based, ranges a-b include both endpoints, and * adds every column not selected earlier. Explicit duplicate selections are retained. Reject malformed, reversed or out-of-bound numeric ranges. Return zero-based physical indexes.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for token in data['selector'].split(','):
        if token == '*':
            out.extend(i for i in range(data['width']) if i not in out)
            continue
        parts = token.split('-')
        if len(parts) not in (1,2) or any(not p.isascii() or not p.isdecimal() for p in parts): return None
        start, end = int(parts[0]), int(parts[-1])
        if not 1 <= start <= end <= data['width']: return None
        out.extend(range(start-1, end-1))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ordered', solve(_vary({'selector': '3,1', 'width': 3})), _vary([2, 0]))
check('range', solve(_vary({'selector': '2-4', 'width': 4})), _vary([1, 2, 3]))
check('wildcard', solve(_vary({'selector': '2,*', 'width': 3})), _vary([1, 0, 2]))
check('duplicate', solve(_vary({'selector': '2,2', 'width': 3})), _vary([1, 1]))
check('reversed', solve(_vary({'selector': '3-1', 'width': 3})), _vary(None))
check('zero', solve(_vary({'selector': '0', 'width': 3})), _vary(None))
check('outside', solve(_vary({'selector': '4', 'width': 3})), _vary(None))
check('bad range', solve(_vary({'selector': '1-2-3', 'width': 3})), _vary(None))
check('empty', solve(_vary({'selector': '', 'width': 3})), _vary(None))
check('variable width', solve(_vary({'selector': '1,*', 'width': 4})), _vary([0, 1, 2, 3]))
check('variant selector width', solve({'selector':'1,*','width':N+2}), list(range(N+2)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for token in data['selector'].split(','):
        if token == '*':
            out.extend(i for i in range(data['width']) if i not in out)
            continue
        parts = token.split('-')
        if len(parts) not in (1,2) or any(not p.isascii() or not p.isdecimal() for p in parts): return None
        start, end = int(parts[0]), int(parts[-1])
        if not 1 <= start <= end <= data['width']: return None
        out.extend(range(start-1, min(end+1, data['width'])))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ordered', solve(_vary({'selector': '3,1', 'width': 3})), _vary([2, 0]))
check('range', solve(_vary({'selector': '2-4', 'width': 4})), _vary([1, 2, 3]))
check('wildcard', solve(_vary({'selector': '2,*', 'width': 3})), _vary([1, 0, 2]))
check('duplicate', solve(_vary({'selector': '2,2', 'width': 3})), _vary([1, 1]))
check('reversed', solve(_vary({'selector': '3-1', 'width': 3})), _vary(None))
check('zero', solve(_vary({'selector': '0', 'width': 3})), _vary(None))
check('outside', solve(_vary({'selector': '4', 'width': 3})), _vary(None))
check('bad range', solve(_vary({'selector': '1-2-3', 'width': 3})), _vary(None))
check('empty', solve(_vary({'selector': '', 'width': 3})), _vary(None))
check('variable width', solve(_vary({'selector': '1,*', 'width': 4})), _vary([0, 1, 2, 3]))
check('variant selector width', solve({'selector':'1,*','width':N+2}), list(range(N+2)))
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 an ordered comma column selector against width. Decimal selectors are one based, ranges a-b include both endpoints, and * adds every column not selected earlier. Explicit duplicate selections are retained. Reject malformed, reversed or out-of-bound numeric ranges. Return zero-based physical indexes.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for token in data['selector'].split(','):
        if token == '*':
            out.extend(i for i in range(data['width']) if i not in out)
            continue
        parts = token.split('-')
        if len(parts) not in (1,2) or any(not p.isascii() or not p.isdecimal() for p in parts): return None
        start, end = int(parts[0]), int(parts[-1])
        if not 1 <= start <= end <= data['width']: return None
        out.extend(range(start, end))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ordered', solve(_vary({'selector': '3,1', 'width': 3})), _vary([2, 0]))
check('range', solve(_vary({'selector': '2-4', 'width': 4})), _vary([1, 2, 3]))
check('wildcard', solve(_vary({'selector': '2,*', 'width': 3})), _vary([1, 0, 2]))
check('duplicate', solve(_vary({'selector': '2,2', 'width': 3})), _vary([1, 1]))
check('reversed', solve(_vary({'selector': '3-1', 'width': 3})), _vary(None))
check('zero', solve(_vary({'selector': '0', 'width': 3})), _vary(None))
check('outside', solve(_vary({'selector': '4', 'width': 3})), _vary(None))
check('bad range', solve(_vary({'selector': '1-2-3', 'width': 3})), _vary(None))
check('empty', solve(_vary({'selector': '', 'width': 3})), _vary(None))
check('variable width', solve(_vary({'selector': '1,*', 'width': 4})), _vary([0, 1, 2, 3]))
check('variant selector width', solve({'selector':'1,*','width':N+2}), list(range(N+2)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for token in data['selector'].split(','):
        if token == '*':
            out.extend(i for i in range(data['width']) if i not in out)
            continue
        parts = token.split('-')
        if len(parts) not in (1,2) or any(not p.isascii() or not p.isdecimal() for p in parts): return None
        start, end = int(parts[0]), int(parts[-1])
        if not 1 <= start <= end <= data['width']: return None
        out.extend(range(max(start-2,0), end))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ordered', solve(_vary({'selector': '3,1', 'width': 3})), _vary([2, 0]))
check('range', solve(_vary({'selector': '2-4', 'width': 4})), _vary([1, 2, 3]))
check('wildcard', solve(_vary({'selector': '2,*', 'width': 3})), _vary([1, 0, 2]))
check('duplicate', solve(_vary({'selector': '2,2', 'width': 3})), _vary([1, 1]))
check('reversed', solve(_vary({'selector': '3-1', 'width': 3})), _vary(None))
check('zero', solve(_vary({'selector': '0', 'width': 3})), _vary(None))
check('outside', solve(_vary({'selector': '4', 'width': 3})), _vary(None))
check('bad range', solve(_vary({'selector': '1-2-3', 'width': 3})), _vary(None))
check('empty', solve(_vary({'selector': '', 'width': 3})), _vary(None))
check('variable width', solve(_vary({'selector': '1,*', 'width': 4})), _vary([0, 1, 2, 3]))
check('variant selector width', solve({'selector':'1,*','width':N+2}), list(range(N+2)))
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 an ordered comma column selector against width. Decimal selectors are one based, ranges a-b include both endpoints, and * adds every column not selected earlier. Explicit duplicate selections are retained. Reject malformed, reversed or out-of-bound numeric ranges. Return zero-based physical indexes.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for token in data['selector'].split(','):
        if token == '*':
            out.extend(i for i in range(data['width']) if i not in out)
            continue
        parts = token.split('-')
        if len(parts) not in (1,2) or any(not p.isascii() or not p.isdecimal() for p in parts): return None
        start, end = int(parts[0]), int(parts[-1])
        if not 1 <= start <= end <= data['width']: return None
        out.extend(range(start-1, end))
    return list(dict.fromkeys(out))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ordered', solve(_vary({'selector': '3,1', 'width': 3})), _vary([2, 0]))
check('range', solve(_vary({'selector': '2-4', 'width': 4})), _vary([1, 2, 3]))
check('wildcard', solve(_vary({'selector': '2,*', 'width': 3})), _vary([1, 0, 2]))
check('duplicate', solve(_vary({'selector': '2,2', 'width': 3})), _vary([1, 1]))
check('reversed', solve(_vary({'selector': '3-1', 'width': 3})), _vary(None))
check('zero', solve(_vary({'selector': '0', 'width': 3})), _vary(None))
check('outside', solve(_vary({'selector': '4', 'width': 3})), _vary(None))
check('bad range', solve(_vary({'selector': '1-2-3', 'width': 3})), _vary(None))
check('empty', solve(_vary({'selector': '', 'width': 3})), _vary(None))
check('variable width', solve(_vary({'selector': '1,*', 'width': 4})), _vary([0, 1, 2, 3]))
check('variant selector width', solve({'selector':'1,*','width':N+2}), list(range(N+2)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for token in data['selector'].split(','):
        if token == '*':
            out.extend(i for i in range(data['width']) if i not in out)
            continue
        parts = token.split('-')
        if len(parts) not in (1,2) or any(not p.isascii() or not p.isdecimal() for p in parts): return None
        start, end = int(parts[0]), int(parts[-1])
        if not 1 <= start <= end <= data['width']: return None
        out.extend(range(start-1, end))
    return sorted(set(out))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ordered', solve(_vary({'selector': '3,1', 'width': 3})), _vary([2, 0]))
check('range', solve(_vary({'selector': '2-4', 'width': 4})), _vary([1, 2, 3]))
check('wildcard', solve(_vary({'selector': '2,*', 'width': 3})), _vary([1, 0, 2]))
check('duplicate', solve(_vary({'selector': '2,2', 'width': 3})), _vary([1, 1]))
check('reversed', solve(_vary({'selector': '3-1', 'width': 3})), _vary(None))
check('zero', solve(_vary({'selector': '0', 'width': 3})), _vary(None))
check('outside', solve(_vary({'selector': '4', 'width': 3})), _vary(None))
check('bad range', solve(_vary({'selector': '1-2-3', 'width': 3})), _vary(None))
check('empty', solve(_vary({'selector': '', 'width': 3})), _vary(None))
check('variable width', solve(_vary({'selector': '1,*', 'width': 4})), _vary([0, 1, 2, 3]))
check('variant selector width', solve({'selector':'1,*','width':N+2}), list(range(N+2)))
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 an ordered comma column selector against width. Decimal selectors are one based, ranges a-b include both endpoints, and * adds every column not selected earlier. Explicit duplicate selections are retained. Reject malformed, reversed or out-of-bound numeric ranges. Return zero-based physical indexes.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for token in data['selector'].split(','):
        if token == '*':
            out.extend(i for i in range(data['width']) if i not in out)
            continue
        parts = token.split('-')
        if len(parts) not in (1,2) or any(not p.isascii() or not p.isdecimal() for p in parts): return None
        start, end = sorted([int(parts[0]), int(parts[-1])])
        if not 1 <= start <= end <= data['width']: return None
        out.extend(range(start-1, end))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ordered', solve(_vary({'selector': '3,1', 'width': 3})), _vary([2, 0]))
check('range', solve(_vary({'selector': '2-4', 'width': 4})), _vary([1, 2, 3]))
check('wildcard', solve(_vary({'selector': '2,*', 'width': 3})), _vary([1, 0, 2]))
check('duplicate', solve(_vary({'selector': '2,2', 'width': 3})), _vary([1, 1]))
check('reversed', solve(_vary({'selector': '3-1', 'width': 3})), _vary(None))
check('zero', solve(_vary({'selector': '0', 'width': 3})), _vary(None))
check('outside', solve(_vary({'selector': '4', 'width': 3})), _vary(None))
check('bad range', solve(_vary({'selector': '1-2-3', 'width': 3})), _vary(None))
check('empty', solve(_vary({'selector': '', 'width': 3})), _vary(None))
check('variable width', solve(_vary({'selector': '1,*', 'width': 4})), _vary([0, 1, 2, 3]))
check('variant selector width', solve({'selector':'1,*','width':N+2}), list(range(N+2)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for token in data['selector'].split(','):
        if token == '*':
            out.extend(i for i in range(data['width']) if i not in out)
            continue
        parts = token.split('-')
        if len(parts) not in (1,2) or any(not p.isascii() or not p.isdecimal() for p in parts): return None
        start, end = min(int(parts[0]), int(parts[-1])), max(int(parts[0]), int(parts[-1]))
        if not 1 <= start <= end <= data['width']: return None
        out.extend(range(start-1, end))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ordered', solve(_vary({'selector': '3,1', 'width': 3})), _vary([2, 0]))
check('range', solve(_vary({'selector': '2-4', 'width': 4})), _vary([1, 2, 3]))
check('wildcard', solve(_vary({'selector': '2,*', 'width': 3})), _vary([1, 0, 2]))
check('duplicate', solve(_vary({'selector': '2,2', 'width': 3})), _vary([1, 1]))
check('reversed', solve(_vary({'selector': '3-1', 'width': 3})), _vary(None))
check('zero', solve(_vary({'selector': '0', 'width': 3})), _vary(None))
check('outside', solve(_vary({'selector': '4', 'width': 3})), _vary(None))
check('bad range', solve(_vary({'selector': '1-2-3', 'width': 3})), _vary(None))
check('empty', solve(_vary({'selector': '', 'width': 3})), _vary(None))
check('variable width', solve(_vary({'selector': '1,*', 'width': 4})), _vary([0, 1, 2, 3]))
check('variant selector width', solve({'selector':'1,*','width':N+2}), list(range(N+2)))
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 an ordered comma column selector against width. Decimal selectors are one based, ranges a-b include both endpoints, and * adds every column not selected earlier. Explicit duplicate selections are retained. Reject malformed, reversed or out-of-bound numeric ranges. Return zero-based physical indexes.

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):
    raw = data.split(',')
    base = [name if name else 'column' + str(i+1) for i,name in enumerate(raw)]
    reserved, used, out = set(base), set(), []
    for name in base:
        candidate = name
        suffix = 2
        while candidate in used:
            candidate = name + '_' + str(suffix)
            suffix += 1
            while False:
                candidate = name + '_' + str(suffix)
                suffix += 1
        out.append(candidate)
        used.add(candidate)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('duplicates', solve(_vary('@,@,@')), _vary(['@', '@_2', '@_3']))
check('reserved', solve(_vary('a,a,a_2')), _vary(['a', 'a_3', 'a_2']))
check('multiple reserves', solve(_vary('a,a,a_2,a_3')), _vary(['a', 'a_4', 'a_2', 'a_3']))
check('blanks', solve(_vary(',x,')), _vary(['column1', 'x', 'column3']))
check('ordinary', solve(_vary('a,b')), _vary(['a', 'b']))
check('nested base', solve(_vary('a,a,a_2,a_2')), _vary(['a', 'a_3', 'a_2', 'a_2_2']))
check('empty', solve(_vary('')), _vary(['column1']))
check('reserved generated', solve(_vary('column2,,column2')), _vary(['column2', 'column2_2', 'column2_3']))
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):
    raw = data.split(',')
    base = [name if name else 'column' + str(i+1) for i,name in enumerate(raw)]
    reserved, used, out = set(base), set(), []
    for name in base:
        candidate = name
        suffix = 2
        while candidate in used:
            candidate = name + '_' + str(suffix)
            suffix += 1
            while candidate in used:
                candidate = name + '_' + str(suffix)
                suffix += 1
        out.append(candidate)
        used.add(candidate)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('duplicates', solve(_vary('@,@,@')), _vary(['@', '@_2', '@_3']))
check('reserved', solve(_vary('a,a,a_2')), _vary(['a', 'a_3', 'a_2']))
check('multiple reserves', solve(_vary('a,a,a_2,a_3')), _vary(['a', 'a_4', 'a_2', 'a_3']))
check('blanks', solve(_vary(',x,')), _vary(['column1', 'x', 'column3']))
check('ordinary', solve(_vary('a,b')), _vary(['a', 'b']))
check('nested base', solve(_vary('a,a,a_2,a_2')), _vary(['a', 'a_3', 'a_2', 'a_2_2']))
check('empty', solve(_vary('')), _vary(['column1']))
check('reserved generated', solve(_vary('column2,,column2')), _vary(['column2', 'column2_2', 'column2_3']))
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.

Assign unique output names to repeated raw column names. First occurrence keeps its name; later duplicates append _2, _3, etc, skipping names already present anywhere in the raw header and names already assigned. Empty raw names use column<one-based-position> before collision handling. Preserve 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):
    raw = data.split(',')
    base = [name if name else 'column' + str(i+1) for i,name in enumerate(raw)]
    reserved, used, out = set(base), set(), []
    for name in base:
        candidate = name
        suffix = 1
        while candidate in used:
            candidate = name + '_' + str(suffix)
            suffix += 1
            while candidate in reserved:
                candidate = name + '_' + str(suffix)
                suffix += 1
        out.append(candidate)
        used.add(candidate)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('duplicates', solve(_vary('@,@,@')), _vary(['@', '@_2', '@_3']))
check('reserved', solve(_vary('a,a,a_2')), _vary(['a', 'a_3', 'a_2']))
check('multiple reserves', solve(_vary('a,a,a_2,a_3')), _vary(['a', 'a_4', 'a_2', 'a_3']))
check('blanks', solve(_vary(',x,')), _vary(['column1', 'x', 'column3']))
check('ordinary', solve(_vary('a,b')), _vary(['a', 'b']))
check('nested base', solve(_vary('a,a,a_2,a_2')), _vary(['a', 'a_3', 'a_2', 'a_2_2']))
check('empty', solve(_vary('')), _vary(['column1']))
check('reserved generated', solve(_vary('column2,,column2')), _vary(['column2', 'column2_2', 'column2_3']))
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):
    raw = data.split(',')
    base = [name if name else 'column' + str(i+1) for i,name in enumerate(raw)]
    reserved, used, out = set(base), set(), []
    for name in base:
        candidate = name
        suffix = 3
        while candidate in used:
            candidate = name + '_' + str(suffix)
            suffix += 1
            while candidate in reserved:
                candidate = name + '_' + str(suffix)
                suffix += 1
        out.append(candidate)
        used.add(candidate)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('duplicates', solve(_vary('@,@,@')), _vary(['@', '@_2', '@_3']))
check('reserved', solve(_vary('a,a,a_2')), _vary(['a', 'a_3', 'a_2']))
check('multiple reserves', solve(_vary('a,a,a_2,a_3')), _vary(['a', 'a_4', 'a_2', 'a_3']))
check('blanks', solve(_vary(',x,')), _vary(['column1', 'x', 'column3']))
check('ordinary', solve(_vary('a,b')), _vary(['a', 'b']))
check('nested base', solve(_vary('a,a,a_2,a_2')), _vary(['a', 'a_3', 'a_2', 'a_2_2']))
check('empty', solve(_vary('')), _vary(['column1']))
check('reserved generated', solve(_vary('column2,,column2')), _vary(['column2', 'column2_2', 'column2_3']))
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.

Assign unique output names to repeated raw column names. First occurrence keeps its name; later duplicates append _2, _3, etc, skipping names already present anywhere in the raw header and names already assigned. Empty raw names use column<one-based-position> before collision handling. Preserve 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):
    raw = data.split(',')
    base = [name if name else 'column' + str(i) for i,name in enumerate(raw)]
    reserved, used, out = set(base), set(), []
    for name in base:
        candidate = name
        suffix = 2
        while candidate in used:
            candidate = name + '_' + str(suffix)
            suffix += 1
            while candidate in reserved:
                candidate = name + '_' + str(suffix)
                suffix += 1
        out.append(candidate)
        used.add(candidate)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('duplicates', solve(_vary('@,@,@')), _vary(['@', '@_2', '@_3']))
check('reserved', solve(_vary('a,a,a_2')), _vary(['a', 'a_3', 'a_2']))
check('multiple reserves', solve(_vary('a,a,a_2,a_3')), _vary(['a', 'a_4', 'a_2', 'a_3']))
check('blanks', solve(_vary(',x,')), _vary(['column1', 'x', 'column3']))
check('ordinary', solve(_vary('a,b')), _vary(['a', 'b']))
check('nested base', solve(_vary('a,a,a_2,a_2')), _vary(['a', 'a_3', 'a_2', 'a_2_2']))
check('empty', solve(_vary('')), _vary(['column1']))
check('reserved generated', solve(_vary('column2,,column2')), _vary(['column2', 'column2_2', 'column2_3']))
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):
    raw = data.split(',')
    base = [name if name else 'column' + str(len(raw)) for i,name in enumerate(raw)]
    reserved, used, out = set(base), set(), []
    for name in base:
        candidate = name
        suffix = 2
        while candidate in used:
            candidate = name + '_' + str(suffix)
            suffix += 1
            while candidate in reserved:
                candidate = name + '_' + str(suffix)
                suffix += 1
        out.append(candidate)
        used.add(candidate)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('duplicates', solve(_vary('@,@,@')), _vary(['@', '@_2', '@_3']))
check('reserved', solve(_vary('a,a,a_2')), _vary(['a', 'a_3', 'a_2']))
check('multiple reserves', solve(_vary('a,a,a_2,a_3')), _vary(['a', 'a_4', 'a_2', 'a_3']))
check('blanks', solve(_vary(',x,')), _vary(['column1', 'x', 'column3']))
check('ordinary', solve(_vary('a,b')), _vary(['a', 'b']))
check('nested base', solve(_vary('a,a,a_2,a_2')), _vary(['a', 'a_3', 'a_2', 'a_2_2']))
check('empty', solve(_vary('')), _vary(['column1']))
check('reserved generated', solve(_vary('column2,,column2')), _vary(['column2', 'column2_2', 'column2_3']))
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.

Assign unique output names to repeated raw column names. First occurrence keeps its name; later duplicates append _2, _3, etc, skipping names already present anywhere in the raw header and names already assigned. Empty raw names use column<one-based-position> before collision handling. Preserve 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):
    raw = data.split(',')
    base = [name if name else 'column' + str(i+1) for i,name in enumerate(raw)]
    reserved, used, out = set(base), set(), []
    for name in base:
        candidate = name
        suffix = 2
        while candidate in used:
            candidate = name + '_' + str(suffix)
            suffix += 1
            while candidate in reserved:
                candidate = name + '_' + str(suffix)
                suffix += 1
        out.append(candidate)
        used.add(name)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('duplicates', solve(_vary('@,@,@')), _vary(['@', '@_2', '@_3']))
check('reserved', solve(_vary('a,a,a_2')), _vary(['a', 'a_3', 'a_2']))
check('multiple reserves', solve(_vary('a,a,a_2,a_3')), _vary(['a', 'a_4', 'a_2', 'a_3']))
check('blanks', solve(_vary(',x,')), _vary(['column1', 'x', 'column3']))
check('ordinary', solve(_vary('a,b')), _vary(['a', 'b']))
check('nested base', solve(_vary('a,a,a_2,a_2')), _vary(['a', 'a_3', 'a_2', 'a_2_2']))
check('empty', solve(_vary('')), _vary(['column1']))
check('reserved generated', solve(_vary('column2,,column2')), _vary(['column2', 'column2_2', 'column2_3']))
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):
    raw = data.split(',')
    base = [name if name else 'column' + str(i+1) for i,name in enumerate(raw)]
    reserved, used, out = set(base), set(), []
    for name in base:
        candidate = name
        suffix = 2
        while candidate in used:
            candidate = name + '_' + str(suffix)
            suffix += 1
            while candidate in reserved:
                candidate = name + '_' + str(suffix)
                suffix += 1
        out.append(candidate)
        used.add(base[0])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('duplicates', solve(_vary('@,@,@')), _vary(['@', '@_2', '@_3']))
check('reserved', solve(_vary('a,a,a_2')), _vary(['a', 'a_3', 'a_2']))
check('multiple reserves', solve(_vary('a,a,a_2,a_3')), _vary(['a', 'a_4', 'a_2', 'a_3']))
check('blanks', solve(_vary(',x,')), _vary(['column1', 'x', 'column3']))
check('ordinary', solve(_vary('a,b')), _vary(['a', 'b']))
check('nested base', solve(_vary('a,a,a_2,a_2')), _vary(['a', 'a_3', 'a_2', 'a_2_2']))
check('empty', solve(_vary('')), _vary(['column1']))
check('reserved generated', solve(_vary('column2,,column2')), _vary(['column2', 'column2_2', 'column2_3']))
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.

Assign unique output names to repeated raw column names. First occurrence keeps its name; later duplicates append _2, _3, etc, skipping names already present anywhere in the raw header and names already assigned. Empty raw names use column<one-based-position> before collision handling. Preserve 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):
    raw = data.split(',')
    base = [name if name else 'column' + str(i+1) for i,name in enumerate(raw)]
    reserved, used, out = set(base), set(), []
    for name in base:
        candidate = name
        suffix = 2
        while candidate in used:
            candidate = name + '_' + str(suffix)
            suffix += 1
            while candidate in reserved:
                candidate = name + '_' + str(suffix)
                suffix += 1
        out.append(name)
        used.add(candidate)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('duplicates', solve(_vary('@,@,@')), _vary(['@', '@_2', '@_3']))
check('reserved', solve(_vary('a,a,a_2')), _vary(['a', 'a_3', 'a_2']))
check('multiple reserves', solve(_vary('a,a,a_2,a_3')), _vary(['a', 'a_4', 'a_2', 'a_3']))
check('blanks', solve(_vary(',x,')), _vary(['column1', 'x', 'column3']))
check('ordinary', solve(_vary('a,b')), _vary(['a', 'b']))
check('nested base', solve(_vary('a,a,a_2,a_2')), _vary(['a', 'a_3', 'a_2', 'a_2_2']))
check('empty', solve(_vary('')), _vary(['column1']))
check('reserved generated', solve(_vary('column2,,column2')), _vary(['column2', 'column2_2', 'column2_3']))
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):
    raw = data.split(',')
    base = [name if name else 'column' + str(i+1) for i,name in enumerate(raw)]
    reserved, used, out = set(base), set(), []
    for name in base:
        candidate = name
        suffix = 2
        while candidate in used:
            candidate = name + '_' + str(suffix)
            suffix += 1
            while candidate in reserved:
                candidate = name + '_' + str(suffix)
                suffix += 1
        out.append(candidate.split('_')[0])
        used.add(candidate)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('duplicates', solve(_vary('@,@,@')), _vary(['@', '@_2', '@_3']))
check('reserved', solve(_vary('a,a,a_2')), _vary(['a', 'a_3', 'a_2']))
check('multiple reserves', solve(_vary('a,a,a_2,a_3')), _vary(['a', 'a_4', 'a_2', 'a_3']))
check('blanks', solve(_vary(',x,')), _vary(['column1', 'x', 'column3']))
check('ordinary', solve(_vary('a,b')), _vary(['a', 'b']))
check('nested base', solve(_vary('a,a,a_2,a_2')), _vary(['a', 'a_3', 'a_2', 'a_2_2']))
check('empty', solve(_vary('')), _vary(['column1']))
check('reserved generated', solve(_vary('column2,,column2')), _vary(['column2', 'column2_2', 'column2_3']))
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.

Assign unique output names to repeated raw column names. First occurrence keeps its name; later duplicates append _2, _3, etc, skipping names already present anywhere in the raw header and names already assigned. Empty raw names use column<one-based-position> before collision handling. Preserve 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, errors = [], []
    for position,line in enumerate(data['lines']):
        cells = line.split(',')
        if len(cells) != 3:
            if data['mode'] == 'strict': return {'error':position}
            if data['mode'] == 'collect': errors.append([position, cells])
            continue
        rows.append(cells)
    return {'rows':rows, 'errors':errors}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('collect', solve(_vary({'mode': 'collect', 'lines': ['@,a,b', 'x,y', 'c,d,e', 'z']})), _vary({'rows': [['@', 'a', 'b'], ['c', 'd', 'e']], 'errors': [[2, ['x', 'y']], [4, ['z']]]}))
check('strict', solve(_vary({'mode': 'strict', 'lines': ['@,a,b', 'x,y', 'c,d,e']})), _vary({'error': 2}))
check('skip', solve(_vary({'mode': 'skip', 'lines': ['x,y', '@,a,b', 'z']})), _vary({'rows': [['@', 'a', 'b']], 'errors': []}))
check('normal', solve(_vary({'mode': 'strict', 'lines': ['@,a,b']})), _vary({'rows': [['@', 'a', 'b']], 'errors': []}))
check('empty', solve(_vary({'mode': 'collect', 'lines': []})), _vary({'rows': [], 'errors': []}))
check('empty cells', solve(_vary({'mode': 'collect', 'lines': [',,']})), _vary({'rows': [['', '', '']], 'errors': []}))
check('wide', solve(_vary({'mode': 'collect', 'lines': ['a,b,c,d']})), _vary({'rows': [], 'errors': [[1, ['a', 'b', 'c', 'd']]]}))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    rows, errors = [], []
    for position,line in enumerate(data['lines'], 2):
        cells = line.split(',')
        if len(cells) != 3:
            if data['mode'] == 'strict': return {'error':position}
            if data['mode'] == 'collect': errors.append([position, cells])
            continue
        rows.append(cells)
    return {'rows':rows, 'errors':errors}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('collect', solve(_vary({'mode': 'collect', 'lines': ['@,a,b', 'x,y', 'c,d,e', 'z']})), _vary({'rows': [['@', 'a', 'b'], ['c', 'd', 'e']], 'errors': [[2, ['x', 'y']], [4, ['z']]]}))
check('strict', solve(_vary({'mode': 'strict', 'lines': ['@,a,b', 'x,y', 'c,d,e']})), _vary({'error': 2}))
check('skip', solve(_vary({'mode': 'skip', 'lines': ['x,y', '@,a,b', 'z']})), _vary({'rows': [['@', 'a', 'b']], 'errors': []}))
check('normal', solve(_vary({'mode': 'strict', 'lines': ['@,a,b']})), _vary({'rows': [['@', 'a', 'b']], 'errors': []}))
check('empty', solve(_vary({'mode': 'collect', 'lines': []})), _vary({'rows': [], 'errors': []}))
check('empty cells', solve(_vary({'mode': 'collect', 'lines': [',,']})), _vary({'rows': [['', '', '']], 'errors': []}))
check('wide', solve(_vary({'mode': 'collect', 'lines': ['a,b,c,d']})), _vary({'rows': [], 'errors': [[1, ['a', 'b', 'c', 'd']]]}))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

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

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    rows, errors = [], []
    for position,line in enumerate(data['lines'], 1):
        cells = line.split(',')
        if len(cells) != 3:
            if data['mode'] == 'strict': return {'error':position}
            if data['mode'] == 'collect': errors.append([position, cells])
            break
        rows.append(cells)
    return {'rows':rows, 'errors':errors}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('collect', solve(_vary({'mode': 'collect', 'lines': ['@,a,b', 'x,y', 'c,d,e', 'z']})), _vary({'rows': [['@', 'a', 'b'], ['c', 'd', 'e']], 'errors': [[2, ['x', 'y']], [4, ['z']]]}))
check('strict', solve(_vary({'mode': 'strict', 'lines': ['@,a,b', 'x,y', 'c,d,e']})), _vary({'error': 2}))
check('skip', solve(_vary({'mode': 'skip', 'lines': ['x,y', '@,a,b', 'z']})), _vary({'rows': [['@', 'a', 'b']], 'errors': []}))
check('normal', solve(_vary({'mode': 'strict', 'lines': ['@,a,b']})), _vary({'rows': [['@', 'a', 'b']], 'errors': []}))
check('empty', solve(_vary({'mode': 'collect', 'lines': []})), _vary({'rows': [], 'errors': []}))
check('empty cells', solve(_vary({'mode': 'collect', 'lines': [',,']})), _vary({'rows': [['', '', '']], 'errors': []}))
check('wide', solve(_vary({'mode': 'collect', 'lines': ['a,b,c,d']})), _vary({'rows': [], 'errors': [[1, ['a', 'b', 'c', 'd']]]}))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    rows, errors = [], []
    for position,line in enumerate(data['lines'], 1):
        cells = line.split(',')
        if len(cells) != 3:
            if data['mode'] == 'strict': return {'error':position}
            if data['mode'] == 'collect': errors.append([position, cells])
            return {'rows':rows, 'errors':errors}
        rows.append(cells)
    return {'rows':rows, 'errors':errors}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('collect', solve(_vary({'mode': 'collect', 'lines': ['@,a,b', 'x,y', 'c,d,e', 'z']})), _vary({'rows': [['@', 'a', 'b'], ['c', 'd', 'e']], 'errors': [[2, ['x', 'y']], [4, ['z']]]}))
check('strict', solve(_vary({'mode': 'strict', 'lines': ['@,a,b', 'x,y', 'c,d,e']})), _vary({'error': 2}))
check('skip', solve(_vary({'mode': 'skip', 'lines': ['x,y', '@,a,b', 'z']})), _vary({'rows': [['@', 'a', 'b']], 'errors': []}))
check('normal', solve(_vary({'mode': 'strict', 'lines': ['@,a,b']})), _vary({'rows': [['@', 'a', 'b']], 'errors': []}))
check('empty', solve(_vary({'mode': 'collect', 'lines': []})), _vary({'rows': [], 'errors': []}))
check('empty cells', solve(_vary({'mode': 'collect', 'lines': [',,']})), _vary({'rows': [['', '', '']], 'errors': []}))
check('wide', solve(_vary({'mode': 'collect', 'lines': ['a,b,c,d']})), _vary({'rows': [], 'errors': [[1, ['a', 'b', 'c', 'd']]]}))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

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

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    rows, errors = [], []
    for position,line in enumerate(data['lines'], 1):
        cells = line.split(',')
        if len(cells) != 3:
            if data['mode'] == 'strict': return {'rows':rows, 'errors':errors}
            if data['mode'] == 'collect': errors.append([position, cells])
            continue
        rows.append(cells)
    return {'rows':rows, 'errors':errors}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('collect', solve(_vary({'mode': 'collect', 'lines': ['@,a,b', 'x,y', 'c,d,e', 'z']})), _vary({'rows': [['@', 'a', 'b'], ['c', 'd', 'e']], 'errors': [[2, ['x', 'y']], [4, ['z']]]}))
check('strict', solve(_vary({'mode': 'strict', 'lines': ['@,a,b', 'x,y', 'c,d,e']})), _vary({'error': 2}))
check('skip', solve(_vary({'mode': 'skip', 'lines': ['x,y', '@,a,b', 'z']})), _vary({'rows': [['@', 'a', 'b']], 'errors': []}))
check('normal', solve(_vary({'mode': 'strict', 'lines': ['@,a,b']})), _vary({'rows': [['@', 'a', 'b']], 'errors': []}))
check('empty', solve(_vary({'mode': 'collect', 'lines': []})), _vary({'rows': [], 'errors': []}))
check('empty cells', solve(_vary({'mode': 'collect', 'lines': [',,']})), _vary({'rows': [['', '', '']], 'errors': []}))
check('wide', solve(_vary({'mode': 'collect', 'lines': ['a,b,c,d']})), _vary({'rows': [], 'errors': [[1, ['a', 'b', 'c', 'd']]]}))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    rows, errors = [], []
    for position,line in enumerate(data['lines'], 1):
        cells = line.split(',')
        if len(cells) != 3:
            if data['mode'] == 'strict': return {'error':len(rows)}
            if data['mode'] == 'collect': errors.append([position, cells])
            continue
        rows.append(cells)
    return {'rows':rows, 'errors':errors}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('collect', solve(_vary({'mode': 'collect', 'lines': ['@,a,b', 'x,y', 'c,d,e', 'z']})), _vary({'rows': [['@', 'a', 'b'], ['c', 'd', 'e']], 'errors': [[2, ['x', 'y']], [4, ['z']]]}))
check('strict', solve(_vary({'mode': 'strict', 'lines': ['@,a,b', 'x,y', 'c,d,e']})), _vary({'error': 2}))
check('skip', solve(_vary({'mode': 'skip', 'lines': ['x,y', '@,a,b', 'z']})), _vary({'rows': [['@', 'a', 'b']], 'errors': []}))
check('normal', solve(_vary({'mode': 'strict', 'lines': ['@,a,b']})), _vary({'rows': [['@', 'a', 'b']], 'errors': []}))
check('empty', solve(_vary({'mode': 'collect', 'lines': []})), _vary({'rows': [], 'errors': []}))
check('empty cells', solve(_vary({'mode': 'collect', 'lines': [',,']})), _vary({'rows': [['', '', '']], 'errors': []}))
check('wide', solve(_vary({'mode': 'collect', 'lines': ['a,b,c,d']})), _vary({'rows': [], 'errors': [[1, ['a', 'b', 'c', 'd']]]}))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

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

split: open-access