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):
    sections, current, needs_header = [], None, False
    for line in data:
        if line.startswith('%'):
            if current is not None and needs_header: return None
            name = line[1:]
            if not name or any(s[0] == name for s in sections): return None
            current = [name, [], []]
            sections.append(current)
            needs_header = True
        elif line == '':
            if needs_header: return None
            current = current
        elif current is None: return None
        elif needs_header:
            current[1] = line.split('\t')
            needs_header = False
        else: current[2].append(line.split('\t'))
    if needs_header: return None
    return sections
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('two sections', solve(_vary(['%one', 'a\tb', '@\tz', '%two', 'x', 'q'])), _vary([['one', ['a', 'b'], [['@', 'z']]], ['two', ['x'], [['q']]]]))
check('section close', solve(_vary(['%one', 'a', 'x', '', 'orphan'])), _vary(None))
check('empty section', solve(_vary(['%one', '%two', 'a'])), _vary(None))
check('missing eof header', solve(_vary(['%one'])), _vary(None))
check('duplicate', solve(_vary(['%one', 'a', '%one', 'b'])), _vary(None))
check('empty name', solve(_vary(['%', 'a'])), _vary(None))
check('normal', solve(_vary(['%one', 'a', '%'])), _vary(None))
check('zero', solve(_vary([])), _vary([]))
check('body control', solve(_vary(['%one', 'a', 'cell', 'two'])), _vary([['one', ['a'], [['cell'], ['two']]]]))
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):
    sections, current, needs_header = [], None, False
    for line in data:
        if line.startswith('%'):
            if current is not None and needs_header: return None
            name = line[1:]
            if not name or any(s[0] == name for s in sections): return None
            current = [name, [], []]
            sections.append(current)
            needs_header = True
        elif line == '':
            if needs_header: return None
            current = sections[-1] if sections else None
        elif current is None: return None
        elif needs_header:
            current[1] = line.split('\t')
            needs_header = False
        else: current[2].append(line.split('\t'))
    if needs_header: return None
    return sections
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('two sections', solve(_vary(['%one', 'a\tb', '@\tz', '%two', 'x', 'q'])), _vary([['one', ['a', 'b'], [['@', 'z']]], ['two', ['x'], [['q']]]]))
check('section close', solve(_vary(['%one', 'a', 'x', '', 'orphan'])), _vary(None))
check('empty section', solve(_vary(['%one', '%two', 'a'])), _vary(None))
check('missing eof header', solve(_vary(['%one'])), _vary(None))
check('duplicate', solve(_vary(['%one', 'a', '%one', 'b'])), _vary(None))
check('empty name', solve(_vary(['%', 'a'])), _vary(None))
check('normal', solve(_vary(['%one', 'a', '%'])), _vary(None))
check('zero', solve(_vary([])), _vary([]))
check('body control', solve(_vary(['%one', 'a', 'cell', 'two'])), _vary([['one', ['a'], [['cell'], ['two']]]]))
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 bounded sectioned TSV stream: @name starts a new table, the next record is its header, subsequent records its data. Names are unique and nonempty. A blank line closes a section; body records outside sections and sections without headers reject. Return ordered [name, header, rows] sections.

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):
    sections, current, needs_header = [], None, False
    for line in data:
        if line.startswith('%'):
            if current is not None and needs_header: return None
            name = line[1:]
            if not name or any(s[0] == name for s in sections): return None
            current = [name, [], []]
            sections.append(current)
            needs_header = True
        elif line == '':
            if needs_header: return None
            current = None
        elif current is None: return None
        elif needs_header:
            current[1] = line.split('\t')
            needs_header = True
        else: current[2].append(line.split('\t'))
    if needs_header: return None
    return sections
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('two sections', solve(_vary(['%one', 'a\tb', '@\tz', '%two', 'x', 'q'])), _vary([['one', ['a', 'b'], [['@', 'z']]], ['two', ['x'], [['q']]]]))
check('section close', solve(_vary(['%one', 'a', 'x', '', 'orphan'])), _vary(None))
check('empty section', solve(_vary(['%one', '%two', 'a'])), _vary(None))
check('missing eof header', solve(_vary(['%one'])), _vary(None))
check('duplicate', solve(_vary(['%one', 'a', '%one', 'b'])), _vary(None))
check('empty name', solve(_vary(['%', 'a'])), _vary(None))
check('normal', solve(_vary(['%one', 'a', '%'])), _vary(None))
check('zero', solve(_vary([])), _vary([]))
check('body control', solve(_vary(['%one', 'a', 'cell', 'two'])), _vary([['one', ['a'], [['cell'], ['two']]]]))
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):
    sections, current, needs_header = [], None, False
    for line in data:
        if line.startswith('%'):
            if current is not None and needs_header: return None
            name = line[1:]
            if not name or any(s[0] == name for s in sections): return None
            current = [name, [], []]
            sections.append(current)
            needs_header = True
        elif line == '':
            if needs_header: return None
            current = None
        elif current is None: return None
        elif needs_header:
            current[1] = line.split('\t')
            needs_header = len(current[1]) == 1
        else: current[2].append(line.split('\t'))
    if needs_header: return None
    return sections
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('two sections', solve(_vary(['%one', 'a\tb', '@\tz', '%two', 'x', 'q'])), _vary([['one', ['a', 'b'], [['@', 'z']]], ['two', ['x'], [['q']]]]))
check('section close', solve(_vary(['%one', 'a', 'x', '', 'orphan'])), _vary(None))
check('empty section', solve(_vary(['%one', '%two', 'a'])), _vary(None))
check('missing eof header', solve(_vary(['%one'])), _vary(None))
check('duplicate', solve(_vary(['%one', 'a', '%one', 'b'])), _vary(None))
check('empty name', solve(_vary(['%', 'a'])), _vary(None))
check('normal', solve(_vary(['%one', 'a', '%'])), _vary(None))
check('zero', solve(_vary([])), _vary([]))
check('body control', solve(_vary(['%one', 'a', 'cell', 'two'])), _vary([['one', ['a'], [['cell'], ['two']]]]))
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 bounded sectioned TSV stream: @name starts a new table, the next record is its header, subsequent records its data. Names are unique and nonempty. A blank line closes a section; body records outside sections and sections without headers reject. Return ordered [name, header, rows] sections.

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):
    sections, current, needs_header = [], None, False
    for line in data:
        if line.startswith('%'):
            if current is not None and needs_header: return None
            name = line[1:]
            if not name or any(s[0] == name for s in sections): return None
            current = [name, [], []]
            sections.append(current)
            needs_header = True
        elif line == '':
            if needs_header: return None
            current = None
        elif current is None: return None
        elif needs_header:
            current[1] = line.split('\t')
            needs_header = False
        else: current[2] = [line.split('\t')]
    if needs_header: return None
    return sections
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('two sections', solve(_vary(['%one', 'a\tb', '@\tz', '%two', 'x', 'q'])), _vary([['one', ['a', 'b'], [['@', 'z']]], ['two', ['x'], [['q']]]]))
check('section close', solve(_vary(['%one', 'a', 'x', '', 'orphan'])), _vary(None))
check('empty section', solve(_vary(['%one', '%two', 'a'])), _vary(None))
check('missing eof header', solve(_vary(['%one'])), _vary(None))
check('duplicate', solve(_vary(['%one', 'a', '%one', 'b'])), _vary(None))
check('empty name', solve(_vary(['%', 'a'])), _vary(None))
check('normal', solve(_vary(['%one', 'a', '%'])), _vary(None))
check('zero', solve(_vary([])), _vary([]))
check('body control', solve(_vary(['%one', 'a', 'cell', 'two'])), _vary([['one', ['a'], [['cell'], ['two']]]]))
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):
    sections, current, needs_header = [], None, False
    for line in data:
        if line.startswith('%'):
            if current is not None and needs_header: return None
            name = line[1:]
            if not name or any(s[0] == name for s in sections): return None
            current = [name, [], []]
            sections.append(current)
            needs_header = True
        elif line == '':
            if needs_header: return None
            current = None
        elif current is None: return None
        elif needs_header:
            current[1] = line.split('\t')
            needs_header = False
        else: current[2].insert(0, line.split('\t'))
    if needs_header: return None
    return sections
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('two sections', solve(_vary(['%one', 'a\tb', '@\tz', '%two', 'x', 'q'])), _vary([['one', ['a', 'b'], [['@', 'z']]], ['two', ['x'], [['q']]]]))
check('section close', solve(_vary(['%one', 'a', 'x', '', 'orphan'])), _vary(None))
check('empty section', solve(_vary(['%one', '%two', 'a'])), _vary(None))
check('missing eof header', solve(_vary(['%one'])), _vary(None))
check('duplicate', solve(_vary(['%one', 'a', '%one', 'b'])), _vary(None))
check('empty name', solve(_vary(['%', 'a'])), _vary(None))
check('normal', solve(_vary(['%one', 'a', '%'])), _vary(None))
check('zero', solve(_vary([])), _vary([]))
check('body control', solve(_vary(['%one', 'a', 'cell', 'two'])), _vary([['one', ['a'], [['cell'], ['two']]]]))
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 bounded sectioned TSV stream: @name starts a new table, the next record is its header, subsequent records its data. Names are unique and nonempty. A blank line closes a section; body records outside sections and sections without headers reject. Return ordered [name, header, rows] sections.

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):
    sections, current, needs_header = [], None, False
    for line in data:
        if line.startswith('%'):
            if current is not None and needs_header: return None
            name = line[1:]
            if not name or any(s[0] == name for s in sections): return None
            current = [name, [], []]
            sections.append(current)
            needs_header = True
        elif line == '':
            if needs_header: return None
            current = None
        elif current is None: return None
        elif needs_header:
            current[1] = line.split('\t')
            needs_header = False
        else: current[2].append(line.split('\t'))
    return sections
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('two sections', solve(_vary(['%one', 'a\tb', '@\tz', '%two', 'x', 'q'])), _vary([['one', ['a', 'b'], [['@', 'z']]], ['two', ['x'], [['q']]]]))
check('section close', solve(_vary(['%one', 'a', 'x', '', 'orphan'])), _vary(None))
check('empty section', solve(_vary(['%one', '%two', 'a'])), _vary(None))
check('missing eof header', solve(_vary(['%one'])), _vary(None))
check('duplicate', solve(_vary(['%one', 'a', '%one', 'b'])), _vary(None))
check('empty name', solve(_vary(['%', 'a'])), _vary(None))
check('normal', solve(_vary(['%one', 'a', '%'])), _vary(None))
check('zero', solve(_vary([])), _vary([]))
check('body control', solve(_vary(['%one', 'a', 'cell', 'two'])), _vary([['one', ['a'], [['cell'], ['two']]]]))
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):
    sections, current, needs_header = [], None, False
    for line in data:
        if line.startswith('%'):
            if current is not None and needs_header: return None
            name = line[1:]
            if not name or any(s[0] == name for s in sections): return None
            current = [name, [], []]
            sections.append(current)
            needs_header = True
        elif line == '':
            if needs_header: return None
            current = None
        elif current is None: return None
        elif needs_header:
            current[1] = line.split('\t')
            needs_header = False
        else: current[2].append(line.split('\t'))
    if needs_header and len(sections) > 1: return None
    return sections
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('two sections', solve(_vary(['%one', 'a\tb', '@\tz', '%two', 'x', 'q'])), _vary([['one', ['a', 'b'], [['@', 'z']]], ['two', ['x'], [['q']]]]))
check('section close', solve(_vary(['%one', 'a', 'x', '', 'orphan'])), _vary(None))
check('empty section', solve(_vary(['%one', '%two', 'a'])), _vary(None))
check('missing eof header', solve(_vary(['%one'])), _vary(None))
check('duplicate', solve(_vary(['%one', 'a', '%one', 'b'])), _vary(None))
check('empty name', solve(_vary(['%', 'a'])), _vary(None))
check('normal', solve(_vary(['%one', 'a', '%'])), _vary(None))
check('zero', solve(_vary([])), _vary([]))
check('body control', solve(_vary(['%one', 'a', 'cell', 'two'])), _vary([['one', ['a'], [['cell'], ['two']]]]))
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 bounded sectioned TSV stream: @name starts a new table, the next record is its header, subsequent records its data. Names are unique and nonempty. A blank line closes a section; body records outside sections and sections without headers reject. Return ordered [name, header, rows] sections.

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):
    upper, lower = [x.split('\t') for x in data]
    if len(upper) != len(lower): return None
    paths, parent = [], None
    for top, leaf in zip(upper, lower):
        parent = top
        if parent is None: return None
        if not leaf: return None
        path = parent + '.' + leaf
        if path in paths: return None
        paths.append(path)
    return paths
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('inherit', solve(_vary(['group\t\tother', '@\tb\tc'])), _vary(['group.@', 'group.b', 'other.c']))
check('initial blank', solve(_vary(['\tgroup', 'a\tb'])), _vary(None))
check('empty leaf', solve(_vary(['group\t', 'a\t'])), _vary(None))
check('duplicate path', solve(_vary(['group\t', 'a\ta'])), _vary(None))
check('unequal', solve(_vary(['group', 'a\tb'])), _vary(None))
check('same leaf new parent', solve(_vary(['x\ty', 'a\ta'])), _vary(['x.a', 'y.a']))
check('normal', solve(_vary(['@', 'a'])), _vary(['@.a']))
check('replace parent', solve(_vary(['x\ty\t', 'a\tb\tc'])), _vary(['x.a', 'y.b', 'y.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):
    upper, lower = [x.split('\t') for x in data]
    if len(upper) != len(lower): return None
    paths, parent = [], None
    for top, leaf in zip(upper, lower):
        if top: parent = upper[0]
        if parent is None: return None
        if not leaf: return None
        path = parent + '.' + leaf
        if path in paths: return None
        paths.append(path)
    return paths
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('inherit', solve(_vary(['group\t\tother', '@\tb\tc'])), _vary(['group.@', 'group.b', 'other.c']))
check('initial blank', solve(_vary(['\tgroup', 'a\tb'])), _vary(None))
check('empty leaf', solve(_vary(['group\t', 'a\t'])), _vary(None))
check('duplicate path', solve(_vary(['group\t', 'a\ta'])), _vary(None))
check('unequal', solve(_vary(['group', 'a\tb'])), _vary(None))
check('same leaf new parent', solve(_vary(['x\ty', 'a\ta'])), _vary(['x.a', 'y.a']))
check('normal', solve(_vary(['@', 'a'])), _vary(['@.a']))
check('replace parent', solve(_vary(['x\ty\t', 'a\tb\tc'])), _vary(['x.a', 'y.b', 'y.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.

Combine two tab-delimited header rows. Blank upper cells inherit the nearest upper label to their left; an initial blank upper label rejects. Lower labels never inherit and must be nonempty. Return unique dotted paths, preserving order. Widths must match.

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):
    upper, lower = [x.split('\t') for x in data]
    if len(upper) != len(lower): return None
    paths, parent = [], None
    for top, leaf in zip(upper, lower):
        if top: parent = top
        if parent is None: parent = next((x for x in upper if x), '')
        if not leaf: return None
        path = parent + '.' + leaf
        if path in paths: return None
        paths.append(path)
    return paths
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('inherit', solve(_vary(['group\t\tother', '@\tb\tc'])), _vary(['group.@', 'group.b', 'other.c']))
check('initial blank', solve(_vary(['\tgroup', 'a\tb'])), _vary(None))
check('empty leaf', solve(_vary(['group\t', 'a\t'])), _vary(None))
check('duplicate path', solve(_vary(['group\t', 'a\ta'])), _vary(None))
check('unequal', solve(_vary(['group', 'a\tb'])), _vary(None))
check('same leaf new parent', solve(_vary(['x\ty', 'a\ta'])), _vary(['x.a', 'y.a']))
check('normal', solve(_vary(['@', 'a'])), _vary(['@.a']))
check('replace parent', solve(_vary(['x\ty\t', 'a\tb\tc'])), _vary(['x.a', 'y.b', 'y.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):
    upper, lower = [x.split('\t') for x in data]
    if len(upper) != len(lower): return None
    paths, parent = [], None
    for top, leaf in zip(upper, lower):
        if top: parent = top
        if parent is None: parent = ''
        if not leaf: return None
        path = parent + '.' + leaf
        if path in paths: return None
        paths.append(path)
    return paths
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('inherit', solve(_vary(['group\t\tother', '@\tb\tc'])), _vary(['group.@', 'group.b', 'other.c']))
check('initial blank', solve(_vary(['\tgroup', 'a\tb'])), _vary(None))
check('empty leaf', solve(_vary(['group\t', 'a\t'])), _vary(None))
check('duplicate path', solve(_vary(['group\t', 'a\ta'])), _vary(None))
check('unequal', solve(_vary(['group', 'a\tb'])), _vary(None))
check('same leaf new parent', solve(_vary(['x\ty', 'a\ta'])), _vary(['x.a', 'y.a']))
check('normal', solve(_vary(['@', 'a'])), _vary(['@.a']))
check('replace parent', solve(_vary(['x\ty\t', 'a\tb\tc'])), _vary(['x.a', 'y.b', 'y.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.

Combine two tab-delimited header rows. Blank upper cells inherit the nearest upper label to their left; an initial blank upper label rejects. Lower labels never inherit and must be nonempty. Return unique dotted paths, preserving order. Widths must match.

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):
    upper, lower = [x.split('\t') for x in data]
    if len(upper) != len(lower): return None
    paths, parent = [], None
    for top, leaf in zip(upper, lower):
        if top: parent = top
        if parent is None: return None
        if not leaf: leaf = parent
        path = parent + '.' + leaf
        if path in paths: return None
        paths.append(path)
    return paths
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('inherit', solve(_vary(['group\t\tother', '@\tb\tc'])), _vary(['group.@', 'group.b', 'other.c']))
check('initial blank', solve(_vary(['\tgroup', 'a\tb'])), _vary(None))
check('empty leaf', solve(_vary(['group\t', 'a\t'])), _vary(None))
check('duplicate path', solve(_vary(['group\t', 'a\ta'])), _vary(None))
check('unequal', solve(_vary(['group', 'a\tb'])), _vary(None))
check('same leaf new parent', solve(_vary(['x\ty', 'a\ta'])), _vary(['x.a', 'y.a']))
check('normal', solve(_vary(['@', 'a'])), _vary(['@.a']))
check('replace parent', solve(_vary(['x\ty\t', 'a\tb\tc'])), _vary(['x.a', 'y.b', 'y.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):
    upper, lower = [x.split('\t') for x in data]
    if len(upper) != len(lower): return None
    paths, parent = [], None
    for top, leaf in zip(upper, lower):
        if top: parent = top
        if parent is None: return None
        if not leaf: leaf = '_'
        path = parent + '.' + leaf
        if path in paths: return None
        paths.append(path)
    return paths
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('inherit', solve(_vary(['group\t\tother', '@\tb\tc'])), _vary(['group.@', 'group.b', 'other.c']))
check('initial blank', solve(_vary(['\tgroup', 'a\tb'])), _vary(None))
check('empty leaf', solve(_vary(['group\t', 'a\t'])), _vary(None))
check('duplicate path', solve(_vary(['group\t', 'a\ta'])), _vary(None))
check('unequal', solve(_vary(['group', 'a\tb'])), _vary(None))
check('same leaf new parent', solve(_vary(['x\ty', 'a\ta'])), _vary(['x.a', 'y.a']))
check('normal', solve(_vary(['@', 'a'])), _vary(['@.a']))
check('replace parent', solve(_vary(['x\ty\t', 'a\tb\tc'])), _vary(['x.a', 'y.b', 'y.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.

Combine two tab-delimited header rows. Blank upper cells inherit the nearest upper label to their left; an initial blank upper label rejects. Lower labels never inherit and must be nonempty. Return unique dotted paths, preserving order. Widths must match.

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):
    upper, lower = [x.split('\t') for x in data]
    if len(upper) != len(lower): return None
    paths, parent = [], None
    for top, leaf in zip(upper, lower):
        if top: parent = top
        if parent is None: return None
        if not leaf: return None
        path = parent + '.' + leaf
        if any(p.rsplit('.', 1)[-1] == leaf for p in paths): return None
        paths.append(path)
    return paths
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('inherit', solve(_vary(['group\t\tother', '@\tb\tc'])), _vary(['group.@', 'group.b', 'other.c']))
check('initial blank', solve(_vary(['\tgroup', 'a\tb'])), _vary(None))
check('empty leaf', solve(_vary(['group\t', 'a\t'])), _vary(None))
check('duplicate path', solve(_vary(['group\t', 'a\ta'])), _vary(None))
check('unequal', solve(_vary(['group', 'a\tb'])), _vary(None))
check('same leaf new parent', solve(_vary(['x\ty', 'a\ta'])), _vary(['x.a', 'y.a']))
check('normal', solve(_vary(['@', 'a'])), _vary(['@.a']))
check('replace parent', solve(_vary(['x\ty\t', 'a\tb\tc'])), _vary(['x.a', 'y.b', 'y.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):
    upper, lower = [x.split('\t') for x in data]
    if len(upper) != len(lower): return None
    paths, parent = [], None
    for top, leaf in zip(upper, lower):
        if top: parent = top
        if parent is None: return None
        if not leaf: return None
        path = parent + '.' + leaf
        if False: return None
        paths.append(path)
    return paths
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('inherit', solve(_vary(['group\t\tother', '@\tb\tc'])), _vary(['group.@', 'group.b', 'other.c']))
check('initial blank', solve(_vary(['\tgroup', 'a\tb'])), _vary(None))
check('empty leaf', solve(_vary(['group\t', 'a\t'])), _vary(None))
check('duplicate path', solve(_vary(['group\t', 'a\ta'])), _vary(None))
check('unequal', solve(_vary(['group', 'a\tb'])), _vary(None))
check('same leaf new parent', solve(_vary(['x\ty', 'a\ta'])), _vary(['x.a', 'y.a']))
check('normal', solve(_vary(['@', 'a'])), _vary(['@.a']))
check('replace parent', solve(_vary(['x\ty\t', 'a\tb\tc'])), _vary(['x.a', 'y.b', 'y.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.

Combine two tab-delimited header rows. Blank upper cells inherit the nearest upper label to their left; an initial blank upper label rejects. Lower labels never inherit and must be nonempty. Return unique dotted paths, preserving order. Widths must match.

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):
    upper, lower = [x.split('\t') for x in data]
    if len(upper) != len(lower): return None
    paths, parent = [], None
    for top, leaf in zip(upper, lower):
        if top: parent = top
        if parent is None: return None
        if not leaf: return None
        path = parent + '.' + leaf
        if path in paths: return None
        paths.append(path)
    return sorted(paths)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('inherit', solve(_vary(['group\t\tother', '@\tb\tc'])), _vary(['group.@', 'group.b', 'other.c']))
check('initial blank', solve(_vary(['\tgroup', 'a\tb'])), _vary(None))
check('empty leaf', solve(_vary(['group\t', 'a\t'])), _vary(None))
check('duplicate path', solve(_vary(['group\t', 'a\ta'])), _vary(None))
check('unequal', solve(_vary(['group', 'a\tb'])), _vary(None))
check('same leaf new parent', solve(_vary(['x\ty', 'a\ta'])), _vary(['x.a', 'y.a']))
check('normal', solve(_vary(['@', 'a'])), _vary(['@.a']))
check('replace parent', solve(_vary(['x\ty\t', 'a\tb\tc'])), _vary(['x.a', 'y.b', 'y.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):
    upper, lower = [x.split('\t') for x in data]
    if len(upper) != len(lower): return None
    paths, parent = [], None
    for top, leaf in zip(upper, lower):
        if top: parent = top
        if parent is None: return None
        if not leaf: return None
        path = parent + '.' + leaf
        if path in paths: return None
        paths.append(path)
    return list(reversed(paths))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('inherit', solve(_vary(['group\t\tother', '@\tb\tc'])), _vary(['group.@', 'group.b', 'other.c']))
check('initial blank', solve(_vary(['\tgroup', 'a\tb'])), _vary(None))
check('empty leaf', solve(_vary(['group\t', 'a\t'])), _vary(None))
check('duplicate path', solve(_vary(['group\t', 'a\ta'])), _vary(None))
check('unequal', solve(_vary(['group', 'a\tb'])), _vary(None))
check('same leaf new parent', solve(_vary(['x\ty', 'a\ta'])), _vary(['x.a', 'y.a']))
check('normal', solve(_vary(['@', 'a'])), _vary(['@.a']))
check('replace parent', solve(_vary(['x\ty\t', 'a\tb\tc'])), _vary(['x.a', 'y.b', 'y.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.

Combine two tab-delimited header rows. Blank upper cells inherit the nearest upper label to their left; an initial blank upper label rejects. Lower labels never inherit and must be nonempty. Return unique dotted paths, preserving order. Widths must match.

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 = [None] * data['width']
    last = -1
    for cell in data['row'].split(',') if data['row'] else []:
        parts = cell.split('=')
        if len(parts) != 2: return None
        index, value = parts
        if not index.isascii() or not index.isdecimal(): return None
        index = int(index)
        if index <= last or index >= data['width']: return None
        out[index] = value
        last = index
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('gaps', solve(_vary({'width': 4, 'row': '0=@,2=z'})), _vary(['@', None, 'z', None]))
check('equals value', solve(_vary({'width': 2, 'row': '1=a=b'})), _vary([None, 'a=b']))
check('empty value', solve(_vary({'width': 2, 'row': '0='})), _vary(['', None]))
check('duplicate', solve(_vary({'width': 2, 'row': '0=x,0=y'})), _vary(None))
check('decreasing', solve(_vary({'width': 3, 'row': '2=x,1=y'})), _vary(None))
check('out of bounds', solve(_vary({'width': 2, 'row': '2=x'})), _vary(None))
check('negative', solve(_vary({'width': 2, 'row': '-1=x'})), _vary(None))
check('Unicode digit', solve(_vary({'width': 2, 'row': '١=x'})), _vary(None))
check('empty row', solve(_vary({'width': 3, 'row': ''})), _vary([None, None, None]))
check('last slot', solve(_vary({'width': 2, 'row': '1=@'})), _vary([None, '@']))
check('malformed', solve(_vary({'width': 2, 'row': '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):
    out = [None] * data['width']
    last = -1
    for cell in data['row'].split(',') if data['row'] else []:
        parts = cell.rsplit('=', 1)
        if len(parts) != 2: return None
        index, value = parts
        if not index.isascii() or not index.isdecimal(): return None
        index = int(index)
        if index <= last or index >= data['width']: return None
        out[index] = value
        last = index
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('gaps', solve(_vary({'width': 4, 'row': '0=@,2=z'})), _vary(['@', None, 'z', None]))
check('equals value', solve(_vary({'width': 2, 'row': '1=a=b'})), _vary([None, 'a=b']))
check('empty value', solve(_vary({'width': 2, 'row': '0='})), _vary(['', None]))
check('duplicate', solve(_vary({'width': 2, 'row': '0=x,0=y'})), _vary(None))
check('decreasing', solve(_vary({'width': 3, 'row': '2=x,1=y'})), _vary(None))
check('out of bounds', solve(_vary({'width': 2, 'row': '2=x'})), _vary(None))
check('negative', solve(_vary({'width': 2, 'row': '-1=x'})), _vary(None))
check('Unicode digit', solve(_vary({'width': 2, 'row': '١=x'})), _vary(None))
check('empty row', solve(_vary({'width': 3, 'row': ''})), _vary([None, None, None]))
check('last slot', solve(_vary({'width': 2, 'row': '1=@'})), _vary([None, '@']))
check('malformed', solve(_vary({'width': 2, 'row': '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.

Parse comma fields index=value into a fixed-width dense row. Indexes are unsigned decimal integers, zero based, strictly increasing and less than width; equal indexes reject. Missing positions remain null. Values may contain equals; empty values are retained.

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 = [None] * data['width']
    last = -1
    for cell in data['row'].split(',') if data['row'] else []:
        parts = cell.split('=', 1)
        if len(parts) != 2: return None
        index, value = parts
        if not index.isdecimal(): return None
        index = int(index)
        if index <= last or index >= data['width']: return None
        out[index] = value
        last = index
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('gaps', solve(_vary({'width': 4, 'row': '0=@,2=z'})), _vary(['@', None, 'z', None]))
check('equals value', solve(_vary({'width': 2, 'row': '1=a=b'})), _vary([None, 'a=b']))
check('empty value', solve(_vary({'width': 2, 'row': '0='})), _vary(['', None]))
check('duplicate', solve(_vary({'width': 2, 'row': '0=x,0=y'})), _vary(None))
check('decreasing', solve(_vary({'width': 3, 'row': '2=x,1=y'})), _vary(None))
check('out of bounds', solve(_vary({'width': 2, 'row': '2=x'})), _vary(None))
check('negative', solve(_vary({'width': 2, 'row': '-1=x'})), _vary(None))
check('Unicode digit', solve(_vary({'width': 2, 'row': '١=x'})), _vary(None))
check('empty row', solve(_vary({'width': 3, 'row': ''})), _vary([None, None, None]))
check('last slot', solve(_vary({'width': 2, 'row': '1=@'})), _vary([None, '@']))
check('malformed', solve(_vary({'width': 2, 'row': '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):
    out = [None] * data['width']
    last = -1
    for cell in data['row'].split(',') if data['row'] else []:
        parts = cell.split('=', 1)
        if len(parts) != 2: return None
        index, value = parts
        if not index.isdecimal() and not index.isascii(): return None
        index = int(index)
        if index <= last or index >= data['width']: return None
        out[index] = value
        last = index
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('gaps', solve(_vary({'width': 4, 'row': '0=@,2=z'})), _vary(['@', None, 'z', None]))
check('equals value', solve(_vary({'width': 2, 'row': '1=a=b'})), _vary([None, 'a=b']))
check('empty value', solve(_vary({'width': 2, 'row': '0='})), _vary(['', None]))
check('duplicate', solve(_vary({'width': 2, 'row': '0=x,0=y'})), _vary(None))
check('decreasing', solve(_vary({'width': 3, 'row': '2=x,1=y'})), _vary(None))
check('out of bounds', solve(_vary({'width': 2, 'row': '2=x'})), _vary(None))
check('negative', solve(_vary({'width': 2, 'row': '-1=x'})), _vary(None))
check('Unicode digit', solve(_vary({'width': 2, 'row': '١=x'})), _vary(None))
check('empty row', solve(_vary({'width': 3, 'row': ''})), _vary([None, None, None]))
check('last slot', solve(_vary({'width': 2, 'row': '1=@'})), _vary([None, '@']))
check('malformed', solve(_vary({'width': 2, 'row': '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.

Parse comma fields index=value into a fixed-width dense row. Indexes are unsigned decimal integers, zero based, strictly increasing and less than width; equal indexes reject. Missing positions remain null. Values may contain equals; empty values are retained.

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 = [None] * data['width']
    last = -1
    for cell in data['row'].split(',') if data['row'] else []:
        parts = cell.split('=', 1)
        if len(parts) != 2: return None
        index, value = parts
        if not index.isascii() or not index.isdecimal(): return None
        index = int(index)
        if index < last or index >= data['width']: return None
        out[index] = value
        last = index
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('gaps', solve(_vary({'width': 4, 'row': '0=@,2=z'})), _vary(['@', None, 'z', None]))
check('equals value', solve(_vary({'width': 2, 'row': '1=a=b'})), _vary([None, 'a=b']))
check('empty value', solve(_vary({'width': 2, 'row': '0='})), _vary(['', None]))
check('duplicate', solve(_vary({'width': 2, 'row': '0=x,0=y'})), _vary(None))
check('decreasing', solve(_vary({'width': 3, 'row': '2=x,1=y'})), _vary(None))
check('out of bounds', solve(_vary({'width': 2, 'row': '2=x'})), _vary(None))
check('negative', solve(_vary({'width': 2, 'row': '-1=x'})), _vary(None))
check('Unicode digit', solve(_vary({'width': 2, 'row': '١=x'})), _vary(None))
check('empty row', solve(_vary({'width': 3, 'row': ''})), _vary([None, None, None]))
check('last slot', solve(_vary({'width': 2, 'row': '1=@'})), _vary([None, '@']))
check('malformed', solve(_vary({'width': 2, 'row': '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):
    out = [None] * data['width']
    last = -1
    for cell in data['row'].split(',') if data['row'] else []:
        parts = cell.split('=', 1)
        if len(parts) != 2: return None
        index, value = parts
        if not index.isascii() or not index.isdecimal(): return None
        index = int(index)
        if index == last or index >= data['width']: return None
        out[index] = value
        last = index
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('gaps', solve(_vary({'width': 4, 'row': '0=@,2=z'})), _vary(['@', None, 'z', None]))
check('equals value', solve(_vary({'width': 2, 'row': '1=a=b'})), _vary([None, 'a=b']))
check('empty value', solve(_vary({'width': 2, 'row': '0='})), _vary(['', None]))
check('duplicate', solve(_vary({'width': 2, 'row': '0=x,0=y'})), _vary(None))
check('decreasing', solve(_vary({'width': 3, 'row': '2=x,1=y'})), _vary(None))
check('out of bounds', solve(_vary({'width': 2, 'row': '2=x'})), _vary(None))
check('negative', solve(_vary({'width': 2, 'row': '-1=x'})), _vary(None))
check('Unicode digit', solve(_vary({'width': 2, 'row': '١=x'})), _vary(None))
check('empty row', solve(_vary({'width': 3, 'row': ''})), _vary([None, None, None]))
check('last slot', solve(_vary({'width': 2, 'row': '1=@'})), _vary([None, '@']))
check('malformed', solve(_vary({'width': 2, 'row': '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.

Parse comma fields index=value into a fixed-width dense row. Indexes are unsigned decimal integers, zero based, strictly increasing and less than width; equal indexes reject. Missing positions remain null. Values may contain equals; empty values are retained.

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 = [None] * data['width']
    last = -1
    for cell in data['row'].split(',') if data['row'] else []:
        parts = cell.split('=', 1)
        if len(parts) != 2: return None
        index, value = parts
        if not index.isascii() or not index.isdecimal(): return None
        index = int(index)
        if index <= last or index >= data['width']: return None
        out[sum(x is not None for x in out)] = value
        last = index
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('gaps', solve(_vary({'width': 4, 'row': '0=@,2=z'})), _vary(['@', None, 'z', None]))
check('equals value', solve(_vary({'width': 2, 'row': '1=a=b'})), _vary([None, 'a=b']))
check('empty value', solve(_vary({'width': 2, 'row': '0='})), _vary(['', None]))
check('duplicate', solve(_vary({'width': 2, 'row': '0=x,0=y'})), _vary(None))
check('decreasing', solve(_vary({'width': 3, 'row': '2=x,1=y'})), _vary(None))
check('out of bounds', solve(_vary({'width': 2, 'row': '2=x'})), _vary(None))
check('negative', solve(_vary({'width': 2, 'row': '-1=x'})), _vary(None))
check('Unicode digit', solve(_vary({'width': 2, 'row': '١=x'})), _vary(None))
check('empty row', solve(_vary({'width': 3, 'row': ''})), _vary([None, None, None]))
check('last slot', solve(_vary({'width': 2, 'row': '1=@'})), _vary([None, '@']))
check('malformed', solve(_vary({'width': 2, 'row': '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):
    out = [None] * data['width']
    last = -1
    for cell in data['row'].split(',') if data['row'] else []:
        parts = cell.split('=', 1)
        if len(parts) != 2: return None
        index, value = parts
        if not index.isascii() or not index.isdecimal(): return None
        index = int(index)
        if index <= last or index >= data['width']: return None
        out[last + 1] = value
        last = index
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('gaps', solve(_vary({'width': 4, 'row': '0=@,2=z'})), _vary(['@', None, 'z', None]))
check('equals value', solve(_vary({'width': 2, 'row': '1=a=b'})), _vary([None, 'a=b']))
check('empty value', solve(_vary({'width': 2, 'row': '0='})), _vary(['', None]))
check('duplicate', solve(_vary({'width': 2, 'row': '0=x,0=y'})), _vary(None))
check('decreasing', solve(_vary({'width': 3, 'row': '2=x,1=y'})), _vary(None))
check('out of bounds', solve(_vary({'width': 2, 'row': '2=x'})), _vary(None))
check('negative', solve(_vary({'width': 2, 'row': '-1=x'})), _vary(None))
check('Unicode digit', solve(_vary({'width': 2, 'row': '١=x'})), _vary(None))
check('empty row', solve(_vary({'width': 3, 'row': ''})), _vary([None, None, None]))
check('last slot', solve(_vary({'width': 2, 'row': '1=@'})), _vary([None, '@']))
check('malformed', solve(_vary({'width': 2, 'row': '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.

Parse comma fields index=value into a fixed-width dense row. Indexes are unsigned decimal integers, zero based, strictly increasing and less than width; equal indexes reject. Missing positions remain null. Values may contain equals; empty values are retained.

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 = [''] * data['width']
    last = -1
    for cell in data['row'].split(',') if data['row'] else []:
        parts = cell.split('=', 1)
        if len(parts) != 2: return None
        index, value = parts
        if not index.isascii() or not index.isdecimal(): return None
        index = int(index)
        if index <= last or index >= data['width']: return None
        out[index] = value
        last = index
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('gaps', solve(_vary({'width': 4, 'row': '0=@,2=z'})), _vary(['@', None, 'z', None]))
check('equals value', solve(_vary({'width': 2, 'row': '1=a=b'})), _vary([None, 'a=b']))
check('empty value', solve(_vary({'width': 2, 'row': '0='})), _vary(['', None]))
check('duplicate', solve(_vary({'width': 2, 'row': '0=x,0=y'})), _vary(None))
check('decreasing', solve(_vary({'width': 3, 'row': '2=x,1=y'})), _vary(None))
check('out of bounds', solve(_vary({'width': 2, 'row': '2=x'})), _vary(None))
check('negative', solve(_vary({'width': 2, 'row': '-1=x'})), _vary(None))
check('Unicode digit', solve(_vary({'width': 2, 'row': '١=x'})), _vary(None))
check('empty row', solve(_vary({'width': 3, 'row': ''})), _vary([None, None, None]))
check('last slot', solve(_vary({'width': 2, 'row': '1=@'})), _vary([None, '@']))
check('malformed', solve(_vary({'width': 2, 'row': '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):
    out = [0] * data['width']
    last = -1
    for cell in data['row'].split(',') if data['row'] else []:
        parts = cell.split('=', 1)
        if len(parts) != 2: return None
        index, value = parts
        if not index.isascii() or not index.isdecimal(): return None
        index = int(index)
        if index <= last or index >= data['width']: return None
        out[index] = value
        last = index
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('gaps', solve(_vary({'width': 4, 'row': '0=@,2=z'})), _vary(['@', None, 'z', None]))
check('equals value', solve(_vary({'width': 2, 'row': '1=a=b'})), _vary([None, 'a=b']))
check('empty value', solve(_vary({'width': 2, 'row': '0='})), _vary(['', None]))
check('duplicate', solve(_vary({'width': 2, 'row': '0=x,0=y'})), _vary(None))
check('decreasing', solve(_vary({'width': 3, 'row': '2=x,1=y'})), _vary(None))
check('out of bounds', solve(_vary({'width': 2, 'row': '2=x'})), _vary(None))
check('negative', solve(_vary({'width': 2, 'row': '-1=x'})), _vary(None))
check('Unicode digit', solve(_vary({'width': 2, 'row': '١=x'})), _vary(None))
check('empty row', solve(_vary({'width': 3, 'row': ''})), _vary([None, None, None]))
check('last slot', solve(_vary({'width': 2, 'row': '1=@'})), _vary([None, '@']))
check('malformed', solve(_vary({'width': 2, 'row': '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.

Parse comma fields index=value into a fixed-width dense row. Indexes are unsigned decimal integers, zero based, strictly increasing and less than width; equal indexes reject. Missing positions remain null. Values may contain equals; empty values are retained.

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['row'].split(','):
        if '*' in cell:
            count, value = cell.split('*', 1)
            if not count.isascii() or not count.isdecimal(): return None
            count = int(count)
            if count <= 0: return None
        else: count, value = 1, cell
        if len(out) + count > data['budget']: return None
        out.append(value)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('expanded', solve(_vary({'row': '2*@,x', 'budget': 3})), _vary(['@', '@', 'x']))
check('star value', solve(_vary({'row': '2*a*b', 'budget': 2})), _vary(['a*b', 'a*b']))
check('empty repeated', solve(_vary({'row': '2*', 'budget': 2})), _vary(['', '']))
check('zero', solve(_vary({'row': '0*x', 'budget': 2})), _vary(None))
check('negative', solve(_vary({'row': '-1*x', 'budget': 2})), _vary(None))
check('aggregate limit', solve(_vary({'row': '2*x,2*y', 'budget': 3})), _vary(None))
check('exact limit', solve(_vary({'row': '3*@', 'budget': 3})), _vary(['@', '@', '@']))
check('ordinary', solve(_vary({'row': '@,z', 'budget': 2})), _vary(['@', 'z']))
check('space value', solve(_vary({'row': ' @ ', 'budget': 1})), _vary([' @ ']))
check('empty field', solve(_vary({'row': '', 'budget': 1})), _vary(['']))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for cell in data['row'].split(','):
        if '*' in cell:
            count, value = cell.split('*', 1)
            if not count.isascii() or not count.isdecimal(): return None
            count = int(count)
            if count <= 0: return None
        else: count, value = 1, cell
        if len(out) + count > data['budget']: return None
        out.extend([value] * max(1, count - 1))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('expanded', solve(_vary({'row': '2*@,x', 'budget': 3})), _vary(['@', '@', 'x']))
check('star value', solve(_vary({'row': '2*a*b', 'budget': 2})), _vary(['a*b', 'a*b']))
check('empty repeated', solve(_vary({'row': '2*', 'budget': 2})), _vary(['', '']))
check('zero', solve(_vary({'row': '0*x', 'budget': 2})), _vary(None))
check('negative', solve(_vary({'row': '-1*x', 'budget': 2})), _vary(None))
check('aggregate limit', solve(_vary({'row': '2*x,2*y', 'budget': 3})), _vary(None))
check('exact limit', solve(_vary({'row': '3*@', 'budget': 3})), _vary(['@', '@', '@']))
check('ordinary', solve(_vary({'row': '@,z', 'budget': 2})), _vary(['@', 'z']))
check('space value', solve(_vary({'row': ' @ ', 'budget': 1})), _vary([' @ ']))
check('empty field', solve(_vary({'row': '', 'budget': 1})), _vary(['']))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

Parse a bounded compact comma row. A field count*value expands value count times; fields lacking star occur once. Count is positive ASCII decimal and cumulative width cannot exceed budget. Split at first star; an empty value is valid. Return expanded cells.

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['row'].split(','):
        if '*' in cell:
            count, value = cell.split('*', 1)
            if not count.isascii() or not count.isdecimal(): return None
            count = int(count)
            if count < 0: return None
        else: count, value = 1, cell
        if len(out) + count > data['budget']: return None
        out.extend([value] * count)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('expanded', solve(_vary({'row': '2*@,x', 'budget': 3})), _vary(['@', '@', 'x']))
check('star value', solve(_vary({'row': '2*a*b', 'budget': 2})), _vary(['a*b', 'a*b']))
check('empty repeated', solve(_vary({'row': '2*', 'budget': 2})), _vary(['', '']))
check('zero', solve(_vary({'row': '0*x', 'budget': 2})), _vary(None))
check('negative', solve(_vary({'row': '-1*x', 'budget': 2})), _vary(None))
check('aggregate limit', solve(_vary({'row': '2*x,2*y', 'budget': 3})), _vary(None))
check('exact limit', solve(_vary({'row': '3*@', 'budget': 3})), _vary(['@', '@', '@']))
check('ordinary', solve(_vary({'row': '@,z', 'budget': 2})), _vary(['@', 'z']))
check('space value', solve(_vary({'row': ' @ ', 'budget': 1})), _vary([' @ ']))
check('empty field', solve(_vary({'row': '', 'budget': 1})), _vary(['']))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for cell in data['row'].split(','):
        if '*' in cell:
            count, value = cell.split('*', 1)
            if not count.isascii() or not count.isdecimal(): return None
            count = int(count)
            if count <= 0: count = 1
        else: count, value = 1, cell
        if len(out) + count > data['budget']: return None
        out.extend([value] * count)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('expanded', solve(_vary({'row': '2*@,x', 'budget': 3})), _vary(['@', '@', 'x']))
check('star value', solve(_vary({'row': '2*a*b', 'budget': 2})), _vary(['a*b', 'a*b']))
check('empty repeated', solve(_vary({'row': '2*', 'budget': 2})), _vary(['', '']))
check('zero', solve(_vary({'row': '0*x', 'budget': 2})), _vary(None))
check('negative', solve(_vary({'row': '-1*x', 'budget': 2})), _vary(None))
check('aggregate limit', solve(_vary({'row': '2*x,2*y', 'budget': 3})), _vary(None))
check('exact limit', solve(_vary({'row': '3*@', 'budget': 3})), _vary(['@', '@', '@']))
check('ordinary', solve(_vary({'row': '@,z', 'budget': 2})), _vary(['@', 'z']))
check('space value', solve(_vary({'row': ' @ ', 'budget': 1})), _vary([' @ ']))
check('empty field', solve(_vary({'row': '', 'budget': 1})), _vary(['']))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

Parse a bounded compact comma row. A field count*value expands value count times; fields lacking star occur once. Count is positive ASCII decimal and cumulative width cannot exceed budget. Split at first star; an empty value is valid. Return expanded cells.

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['row'].split(','):
        if '*' in cell:
            count, value = cell.split('*', 1)
            if not count.isascii() or not count.isdecimal(): return None
            count = int(count)
            if count <= 0: return None
        else: count, value = 1, cell
        if count > data['budget']: return None
        out.extend([value] * count)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('expanded', solve(_vary({'row': '2*@,x', 'budget': 3})), _vary(['@', '@', 'x']))
check('star value', solve(_vary({'row': '2*a*b', 'budget': 2})), _vary(['a*b', 'a*b']))
check('empty repeated', solve(_vary({'row': '2*', 'budget': 2})), _vary(['', '']))
check('zero', solve(_vary({'row': '0*x', 'budget': 2})), _vary(None))
check('negative', solve(_vary({'row': '-1*x', 'budget': 2})), _vary(None))
check('aggregate limit', solve(_vary({'row': '2*x,2*y', 'budget': 3})), _vary(None))
check('exact limit', solve(_vary({'row': '3*@', 'budget': 3})), _vary(['@', '@', '@']))
check('ordinary', solve(_vary({'row': '@,z', 'budget': 2})), _vary(['@', 'z']))
check('space value', solve(_vary({'row': ' @ ', 'budget': 1})), _vary([' @ ']))
check('empty field', solve(_vary({'row': '', 'budget': 1})), _vary(['']))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for cell in data['row'].split(','):
        if '*' in cell:
            count, value = cell.split('*', 1)
            if not count.isascii() or not count.isdecimal(): return None
            count = int(count)
            if count <= 0: return None
        else: count, value = 1, cell
        if len(out) + count >= data['budget']: return None
        out.extend([value] * count)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('expanded', solve(_vary({'row': '2*@,x', 'budget': 3})), _vary(['@', '@', 'x']))
check('star value', solve(_vary({'row': '2*a*b', 'budget': 2})), _vary(['a*b', 'a*b']))
check('empty repeated', solve(_vary({'row': '2*', 'budget': 2})), _vary(['', '']))
check('zero', solve(_vary({'row': '0*x', 'budget': 2})), _vary(None))
check('negative', solve(_vary({'row': '-1*x', 'budget': 2})), _vary(None))
check('aggregate limit', solve(_vary({'row': '2*x,2*y', 'budget': 3})), _vary(None))
check('exact limit', solve(_vary({'row': '3*@', 'budget': 3})), _vary(['@', '@', '@']))
check('ordinary', solve(_vary({'row': '@,z', 'budget': 2})), _vary(['@', 'z']))
check('space value', solve(_vary({'row': ' @ ', 'budget': 1})), _vary([' @ ']))
check('empty field', solve(_vary({'row': '', 'budget': 1})), _vary(['']))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

Parse a bounded compact comma row. A field count*value expands value count times; fields lacking star occur once. Count is positive ASCII decimal and cumulative width cannot exceed budget. Split at first star; an empty value is valid. Return expanded cells.

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['row'].split(','):
        if '*' in cell:
            count, value = cell.rsplit('*', 1)
            if not count.isascii() or not count.isdecimal(): return None
            count = int(count)
            if count <= 0: return None
        else: count, value = 1, cell
        if len(out) + count > data['budget']: return None
        out.extend([value] * count)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('expanded', solve(_vary({'row': '2*@,x', 'budget': 3})), _vary(['@', '@', 'x']))
check('star value', solve(_vary({'row': '2*a*b', 'budget': 2})), _vary(['a*b', 'a*b']))
check('empty repeated', solve(_vary({'row': '2*', 'budget': 2})), _vary(['', '']))
check('zero', solve(_vary({'row': '0*x', 'budget': 2})), _vary(None))
check('negative', solve(_vary({'row': '-1*x', 'budget': 2})), _vary(None))
check('aggregate limit', solve(_vary({'row': '2*x,2*y', 'budget': 3})), _vary(None))
check('exact limit', solve(_vary({'row': '3*@', 'budget': 3})), _vary(['@', '@', '@']))
check('ordinary', solve(_vary({'row': '@,z', 'budget': 2})), _vary(['@', 'z']))
check('space value', solve(_vary({'row': ' @ ', 'budget': 1})), _vary([' @ ']))
check('empty field', solve(_vary({'row': '', 'budget': 1})), _vary(['']))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for cell in data['row'].split(','):
        if '*' in cell:
            count, value = cell.split('*', 1)
            value = value.replace('*', '')
            if not count.isascii() or not count.isdecimal(): return None
            count = int(count)
            if count <= 0: return None
        else: count, value = 1, cell
        if len(out) + count > data['budget']: return None
        out.extend([value] * count)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('expanded', solve(_vary({'row': '2*@,x', 'budget': 3})), _vary(['@', '@', 'x']))
check('star value', solve(_vary({'row': '2*a*b', 'budget': 2})), _vary(['a*b', 'a*b']))
check('empty repeated', solve(_vary({'row': '2*', 'budget': 2})), _vary(['', '']))
check('zero', solve(_vary({'row': '0*x', 'budget': 2})), _vary(None))
check('negative', solve(_vary({'row': '-1*x', 'budget': 2})), _vary(None))
check('aggregate limit', solve(_vary({'row': '2*x,2*y', 'budget': 3})), _vary(None))
check('exact limit', solve(_vary({'row': '3*@', 'budget': 3})), _vary(['@', '@', '@']))
check('ordinary', solve(_vary({'row': '@,z', 'budget': 2})), _vary(['@', 'z']))
check('space value', solve(_vary({'row': ' @ ', 'budget': 1})), _vary([' @ ']))
check('empty field', solve(_vary({'row': '', 'budget': 1})), _vary(['']))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

Parse a bounded compact comma row. A field count*value expands value count times; fields lacking star occur once. Count is positive ASCII decimal and cumulative width cannot exceed budget. Split at first star; an empty value is valid. Return expanded cells.

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['row'].split(','):
        if '*' in cell:
            count, value = cell.split('*', 1)
            if not count.isascii() or not count.isdecimal(): return None
            count = int(count)
            if count <= 0: return None
        else: count, value = 0, cell
        if len(out) + count > data['budget']: return None
        out.extend([value] * count)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('expanded', solve(_vary({'row': '2*@,x', 'budget': 3})), _vary(['@', '@', 'x']))
check('star value', solve(_vary({'row': '2*a*b', 'budget': 2})), _vary(['a*b', 'a*b']))
check('empty repeated', solve(_vary({'row': '2*', 'budget': 2})), _vary(['', '']))
check('zero', solve(_vary({'row': '0*x', 'budget': 2})), _vary(None))
check('negative', solve(_vary({'row': '-1*x', 'budget': 2})), _vary(None))
check('aggregate limit', solve(_vary({'row': '2*x,2*y', 'budget': 3})), _vary(None))
check('exact limit', solve(_vary({'row': '3*@', 'budget': 3})), _vary(['@', '@', '@']))
check('ordinary', solve(_vary({'row': '@,z', 'budget': 2})), _vary(['@', 'z']))
check('space value', solve(_vary({'row': ' @ ', 'budget': 1})), _vary([' @ ']))
check('empty field', solve(_vary({'row': '', 'budget': 1})), _vary(['']))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for cell in data['row'].split(','):
        if '*' in cell:
            count, value = cell.split('*', 1)
            if not count.isascii() or not count.isdecimal(): return None
            count = int(count)
            if count <= 0: return None
        else: count, value = 1, cell.strip()
        if len(out) + count > data['budget']: return None
        out.extend([value] * count)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('expanded', solve(_vary({'row': '2*@,x', 'budget': 3})), _vary(['@', '@', 'x']))
check('star value', solve(_vary({'row': '2*a*b', 'budget': 2})), _vary(['a*b', 'a*b']))
check('empty repeated', solve(_vary({'row': '2*', 'budget': 2})), _vary(['', '']))
check('zero', solve(_vary({'row': '0*x', 'budget': 2})), _vary(None))
check('negative', solve(_vary({'row': '-1*x', 'budget': 2})), _vary(None))
check('aggregate limit', solve(_vary({'row': '2*x,2*y', 'budget': 3})), _vary(None))
check('exact limit', solve(_vary({'row': '3*@', 'budget': 3})), _vary(['@', '@', '@']))
check('ordinary', solve(_vary({'row': '@,z', 'budget': 2})), _vary(['@', 'z']))
check('space value', solve(_vary({'row': ' @ ', 'budget': 1})), _vary([' @ ']))
check('empty field', solve(_vary({'row': '', 'budget': 1})), _vary(['']))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

Parse a bounded compact comma row. A field count*value expands value count times; fields lacking star occur once. Count is positive ASCII decimal and cumulative width cannot exceed budget. Split at first star; an empty value is valid. Return expanded cells.

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 value in data:
        if value is None: field = ''
        elif isinstance(value, bool): field = 'true' if value else 'false'
        elif isinstance(value, int): field = str(value)
        else:
            quote = value in ('NULL', '') or any(c in value for c in ',"\r\n') or value != value.strip(' ') or value.startswith('#')
            field = value.replace('"', '""')
            if quote: field = '"' + field + '"'
        out.append(field)
    return ','.join(out) + '\r\n'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('typed', solve(_vary(['@', None, True, False, 12])), _vary('@,NULL,true,false,12\r\n'))
check('null string', solve(_vary(['NULL', ''])), _vary('"NULL",""\r\n'))
check('comment', solve(_vary(['#@'])), _vary('"#@"\r\n'))
check('spaces', solve(_vary([' @ ', 'x'])), _vary('" @ ",x\r\n'))
check('escape', solve(_vary(['a"b'])), _vary('"a""b"\r\n'))
check('crlf', solve(_vary(['x\r\ny'])), _vary('"x\r\ny"\r\n'))
check('normal', solve(_vary(['@', 'β'])), _vary('@,β\r\n'))
check('empty row', solve(_vary([])), _vary('\r\n'))
check('negative', solve(_vary([-12])), _vary('-12\r\n'))
check('single space', solve(_vary([' '])), _vary('" "\r\n'))
check('trailing space', solve(_vary(['@ '])), _vary('"@ "\r\n'))
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 value in data:
        if value is None: field = '"NULL"'
        elif isinstance(value, bool): field = 'true' if value else 'false'
        elif isinstance(value, int): field = str(value)
        else:
            quote = value in ('NULL', '') or any(c in value for c in ',"\r\n') or value != value.strip(' ') or value.startswith('#')
            field = value.replace('"', '""')
            if quote: field = '"' + field + '"'
        out.append(field)
    return ','.join(out) + '\r\n'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('typed', solve(_vary(['@', None, True, False, 12])), _vary('@,NULL,true,false,12\r\n'))
check('null string', solve(_vary(['NULL', ''])), _vary('"NULL",""\r\n'))
check('comment', solve(_vary(['#@'])), _vary('"#@"\r\n'))
check('spaces', solve(_vary([' @ ', 'x'])), _vary('" @ ",x\r\n'))
check('escape', solve(_vary(['a"b'])), _vary('"a""b"\r\n'))
check('crlf', solve(_vary(['x\r\ny'])), _vary('"x\r\ny"\r\n'))
check('normal', solve(_vary(['@', 'β'])), _vary('@,β\r\n'))
check('empty row', solve(_vary([])), _vary('\r\n'))
check('negative', solve(_vary([-12])), _vary('-12\r\n'))
check('single space', solve(_vary([' '])), _vary('" "\r\n'))
check('trailing space', solve(_vary(['@ '])), _vary('"@ "\r\n'))
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.

Emit typed table cells as one comma row ending CRLF. None is bare NULL; strings equal NULL or empty must be quoted. Booleans are bare true/false, integers bare decimal. Other strings are quoted if they contain comma, quote, newline, CR, leading/trailing space, or begin # (comment protection). Double embedded quotes. Preserve Unicode and cell 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):
    out = []
    for value in data:
        if value is None: field = 'NULL'
        elif isinstance(value, bool): field = str(int(value))
        elif isinstance(value, int): field = str(value)
        else:
            quote = value in ('NULL', '') or any(c in value for c in ',"\r\n') or value != value.strip(' ') or value.startswith('#')
            field = value.replace('"', '""')
            if quote: field = '"' + field + '"'
        out.append(field)
    return ','.join(out) + '\r\n'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('typed', solve(_vary(['@', None, True, False, 12])), _vary('@,NULL,true,false,12\r\n'))
check('null string', solve(_vary(['NULL', ''])), _vary('"NULL",""\r\n'))
check('comment', solve(_vary(['#@'])), _vary('"#@"\r\n'))
check('spaces', solve(_vary([' @ ', 'x'])), _vary('" @ ",x\r\n'))
check('escape', solve(_vary(['a"b'])), _vary('"a""b"\r\n'))
check('crlf', solve(_vary(['x\r\ny'])), _vary('"x\r\ny"\r\n'))
check('normal', solve(_vary(['@', 'β'])), _vary('@,β\r\n'))
check('empty row', solve(_vary([])), _vary('\r\n'))
check('negative', solve(_vary([-12])), _vary('-12\r\n'))
check('single space', solve(_vary([' '])), _vary('" "\r\n'))
check('trailing space', solve(_vary(['@ '])), _vary('"@ "\r\n'))
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 value in data:
        if value is None: field = 'NULL'
        elif isinstance(value, bool): field = str(value)
        elif isinstance(value, int): field = str(value)
        else:
            quote = value in ('NULL', '') or any(c in value for c in ',"\r\n') or value != value.strip(' ') or value.startswith('#')
            field = value.replace('"', '""')
            if quote: field = '"' + field + '"'
        out.append(field)
    return ','.join(out) + '\r\n'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('typed', solve(_vary(['@', None, True, False, 12])), _vary('@,NULL,true,false,12\r\n'))
check('null string', solve(_vary(['NULL', ''])), _vary('"NULL",""\r\n'))
check('comment', solve(_vary(['#@'])), _vary('"#@"\r\n'))
check('spaces', solve(_vary([' @ ', 'x'])), _vary('" @ ",x\r\n'))
check('escape', solve(_vary(['a"b'])), _vary('"a""b"\r\n'))
check('crlf', solve(_vary(['x\r\ny'])), _vary('"x\r\ny"\r\n'))
check('normal', solve(_vary(['@', 'β'])), _vary('@,β\r\n'))
check('empty row', solve(_vary([])), _vary('\r\n'))
check('negative', solve(_vary([-12])), _vary('-12\r\n'))
check('single space', solve(_vary([' '])), _vary('" "\r\n'))
check('trailing space', solve(_vary(['@ '])), _vary('"@ "\r\n'))
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.

Emit typed table cells as one comma row ending CRLF. None is bare NULL; strings equal NULL or empty must be quoted. Booleans are bare true/false, integers bare decimal. Other strings are quoted if they contain comma, quote, newline, CR, leading/trailing space, or begin # (comment protection). Double embedded quotes. Preserve Unicode and cell 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):
    out = []
    for value in data:
        if value is None: field = 'NULL'
        elif isinstance(value, bool): field = 'true' if value else 'false'
        elif isinstance(value, int): field = str(abs(value))
        else:
            quote = value in ('NULL', '') or any(c in value for c in ',"\r\n') or value != value.strip(' ') or value.startswith('#')
            field = value.replace('"', '""')
            if quote: field = '"' + field + '"'
        out.append(field)
    return ','.join(out) + '\r\n'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('typed', solve(_vary(['@', None, True, False, 12])), _vary('@,NULL,true,false,12\r\n'))
check('null string', solve(_vary(['NULL', ''])), _vary('"NULL",""\r\n'))
check('comment', solve(_vary(['#@'])), _vary('"#@"\r\n'))
check('spaces', solve(_vary([' @ ', 'x'])), _vary('" @ ",x\r\n'))
check('escape', solve(_vary(['a"b'])), _vary('"a""b"\r\n'))
check('crlf', solve(_vary(['x\r\ny'])), _vary('"x\r\ny"\r\n'))
check('normal', solve(_vary(['@', 'β'])), _vary('@,β\r\n'))
check('empty row', solve(_vary([])), _vary('\r\n'))
check('negative', solve(_vary([-12])), _vary('-12\r\n'))
check('single space', solve(_vary([' '])), _vary('" "\r\n'))
check('trailing space', solve(_vary(['@ '])), _vary('"@ "\r\n'))
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 value in data:
        if value is None: field = 'NULL'
        elif isinstance(value, bool): field = 'true' if value else 'false'
        elif isinstance(value, int): field = '+' + str(abs(value))
        else:
            quote = value in ('NULL', '') or any(c in value for c in ',"\r\n') or value != value.strip(' ') or value.startswith('#')
            field = value.replace('"', '""')
            if quote: field = '"' + field + '"'
        out.append(field)
    return ','.join(out) + '\r\n'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('typed', solve(_vary(['@', None, True, False, 12])), _vary('@,NULL,true,false,12\r\n'))
check('null string', solve(_vary(['NULL', ''])), _vary('"NULL",""\r\n'))
check('comment', solve(_vary(['#@'])), _vary('"#@"\r\n'))
check('spaces', solve(_vary([' @ ', 'x'])), _vary('" @ ",x\r\n'))
check('escape', solve(_vary(['a"b'])), _vary('"a""b"\r\n'))
check('crlf', solve(_vary(['x\r\ny'])), _vary('"x\r\ny"\r\n'))
check('normal', solve(_vary(['@', 'β'])), _vary('@,β\r\n'))
check('empty row', solve(_vary([])), _vary('\r\n'))
check('negative', solve(_vary([-12])), _vary('-12\r\n'))
check('single space', solve(_vary([' '])), _vary('" "\r\n'))
check('trailing space', solve(_vary(['@ '])), _vary('"@ "\r\n'))
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.

Emit typed table cells as one comma row ending CRLF. None is bare NULL; strings equal NULL or empty must be quoted. Booleans are bare true/false, integers bare decimal. Other strings are quoted if they contain comma, quote, newline, CR, leading/trailing space, or begin # (comment protection). Double embedded quotes. Preserve Unicode and cell order.

split: open-access