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):
    parts=data.rsplit('|',1)
    if len(parts)!=2: return None
    payload,token=parts
    if not token.isascii() or not token.isdecimal(): return None
    check=int(token)
    if check>=97: return None
    expected=sum(ord(ch) for ch in payload)%97
    if False: return None
    return payload.split(',')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('comma', solve(_vary('a,b|45')), _vary(['a', 'b']))
check('empty', solve(_vary('|0')), _vary(['']))
check('pipe data', solve(_vary('a|b|28')), _vary(['a|b']))
check('unicode', solve(_vary('é|39')), _vary(['é']))
check('astral checksum', solve(_vary('😀|84')), _vary(['😀']))
check('bad checksum', solve(_vary('a|1')), _vary(None))
check('bad trailer', solve(_vary('a|-1')), _vary(None))
check('unreduced', solve(_vary('a|97')), _vary(None))
check('normal', solve(_vary('z|25')), _vary(['z']))
check('variant checksum width', solve(('x'*N)+'|'+str((120*N)%97)), ['x'*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):
    parts=data.rsplit('|',1)
    if len(parts)!=2: return None
    payload,token=parts
    if not token.isascii() or not token.isdecimal(): return None
    check=int(token)
    if check>=97: return None
    expected=sum(ord(ch) for ch in payload)%97
    if check!=expected and payload=='': return None
    return payload.split(',')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('comma', solve(_vary('a,b|45')), _vary(['a', 'b']))
check('empty', solve(_vary('|0')), _vary(['']))
check('pipe data', solve(_vary('a|b|28')), _vary(['a|b']))
check('unicode', solve(_vary('é|39')), _vary(['é']))
check('astral checksum', solve(_vary('😀|84')), _vary(['😀']))
check('bad checksum', solve(_vary('a|1')), _vary(None))
check('bad trailer', solve(_vary('a|-1')), _vary(None))
check('unreduced', solve(_vary('a|97')), _vary(None))
check('normal', solve(_vary('z|25')), _vary(['z']))
check('variant checksum width', solve(('x'*N)+'|'+str((120*N)%97)), ['x'*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.

Decode rows encoded as comma cells followed by |decimal check. The check is the sum of Unicode code points in the exact comma payload modulo 97; this is only a corruption-detection toy, not cryptographic integrity. Use the last pipe as trailer separator, permitting pipes in cells. Reject malformed or mismatched checks. Return fields.

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=[]; previous=None
    for line in data:
        if line.startswith('R|'):
            token=line[2:]
            if previous is None or not token.isascii() or not token.isdecimal() or int(token)<1: return None
            out.extend([list(previous) for _ in range(int(token)-1)])
        else:
            if '|' in line: return None
            previous=line.split(',')
            out.append(previous)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeat', solve(_vary(['@,x', 'R|2'])), _vary([['@', 'x'], ['@', 'x'], ['@', 'x']]))
check('new source', solve(_vary(['a,b', 'R|1', '@,z', 'R|1'])), _vary([['a', 'b'], ['a', 'b'], ['@', 'z'], ['@', 'z']]))
check('orphan', solve(_vary(['R|2'])), _vary(None))
check('zero', solve(_vary(['a', 'R|0'])), _vary(None))
check('negative', solve(_vary(['a', 'R|-1'])), _vary(None))
check('empty row', solve(_vary(['', 'R|1'])), _vary([[''], ['']]))
check('chained', solve(_vary(['@', 'R|1', 'R|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)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out=[]; previous=None
    for line in data:
        if line.startswith('R|'):
            token=line[2:]
            if previous is None or not token.isascii() or not token.isdecimal() or int(token)<1: return None
            out.extend([list(previous) for _ in range(int(token)+1)])
        else:
            if '|' in line: return None
            previous=line.split(',')
            out.append(previous)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeat', solve(_vary(['@,x', 'R|2'])), _vary([['@', 'x'], ['@', 'x'], ['@', 'x']]))
check('new source', solve(_vary(['a,b', 'R|1', '@,z', 'R|1'])), _vary([['a', 'b'], ['a', 'b'], ['@', 'z'], ['@', 'z']]))
check('orphan', solve(_vary(['R|2'])), _vary(None))
check('zero', solve(_vary(['a', 'R|0'])), _vary(None))
check('negative', solve(_vary(['a', 'R|-1'])), _vary(None))
check('empty row', solve(_vary(['', 'R|1'])), _vary([[''], ['']]))
check('chained', solve(_vary(['@', 'R|1', 'R|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.

Read comma rows, with an R|count control line repeating the most recent data row count additional times. Count must be positive ASCII decimal; controls cannot precede data. Repeated rows do not become a distinct source row. Return independent row values in order; ordinary payloads contain no pipe.

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=[]; previous=None
    for line in data:
        if line.startswith('R|'):
            token=line[2:]
            if previous is None or not token.isascii() or not token.isdecimal() or int(token)<1: return None
            out.extend([list(out[0]) for _ in range(int(token))])
        else:
            if '|' in line: return None
            previous=line.split(',')
            out.append(previous)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeat', solve(_vary(['@,x', 'R|2'])), _vary([['@', 'x'], ['@', 'x'], ['@', 'x']]))
check('new source', solve(_vary(['a,b', 'R|1', '@,z', 'R|1'])), _vary([['a', 'b'], ['a', 'b'], ['@', 'z'], ['@', 'z']]))
check('orphan', solve(_vary(['R|2'])), _vary(None))
check('zero', solve(_vary(['a', 'R|0'])), _vary(None))
check('negative', solve(_vary(['a', 'R|-1'])), _vary(None))
check('empty row', solve(_vary(['', 'R|1'])), _vary([[''], ['']]))
check('chained', solve(_vary(['@', 'R|1', 'R|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=[]; previous=None
    for line in data:
        if line.startswith('R|'):
            token=line[2:]
            if previous is None or not token.isascii() or not token.isdecimal() or int(token)<1: return None
            out.extend([list(out[-1]) if len(out)==1 else list(out[0]) for _ in range(int(token))])
        else:
            if '|' in line: return None
            previous=line.split(',')
            out.append(previous)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeat', solve(_vary(['@,x', 'R|2'])), _vary([['@', 'x'], ['@', 'x'], ['@', 'x']]))
check('new source', solve(_vary(['a,b', 'R|1', '@,z', 'R|1'])), _vary([['a', 'b'], ['a', 'b'], ['@', 'z'], ['@', 'z']]))
check('orphan', solve(_vary(['R|2'])), _vary(None))
check('zero', solve(_vary(['a', 'R|0'])), _vary(None))
check('negative', solve(_vary(['a', 'R|-1'])), _vary(None))
check('empty row', solve(_vary(['', 'R|1'])), _vary([[''], ['']]))
check('chained', solve(_vary(['@', 'R|1', 'R|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.

Read comma rows, with an R|count control line repeating the most recent data row count additional times. Count must be positive ASCII decimal; controls cannot precede data. Repeated rows do not become a distinct source row. Return independent row values in order; ordinary payloads contain no pipe.

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=[]; previous=None
    for line in data:
        if line.startswith('R|'):
            token=line[2:]
            if previous is None or not token.isascii() or not token.isdecimal() or int(token)<1: return None
            out[0:0]=[list(previous) for _ in range(int(token))]
        else:
            if '|' in line: return None
            previous=line.split(',')
            out.append(previous)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeat', solve(_vary(['@,x', 'R|2'])), _vary([['@', 'x'], ['@', 'x'], ['@', 'x']]))
check('new source', solve(_vary(['a,b', 'R|1', '@,z', 'R|1'])), _vary([['a', 'b'], ['a', 'b'], ['@', 'z'], ['@', 'z']]))
check('orphan', solve(_vary(['R|2'])), _vary(None))
check('zero', solve(_vary(['a', 'R|0'])), _vary(None))
check('negative', solve(_vary(['a', 'R|-1'])), _vary(None))
check('empty row', solve(_vary(['', 'R|1'])), _vary([[''], ['']]))
check('chained', solve(_vary(['@', 'R|1', 'R|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=[]; previous=None
    for line in data:
        if line.startswith('R|'):
            token=line[2:]
            if previous is None or not token.isascii() or not token.isdecimal() or int(token)<1: return None
            out=[list(previous) for _ in range(int(token))]+out
        else:
            if '|' in line: return None
            previous=line.split(',')
            out.append(previous)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeat', solve(_vary(['@,x', 'R|2'])), _vary([['@', 'x'], ['@', 'x'], ['@', 'x']]))
check('new source', solve(_vary(['a,b', 'R|1', '@,z', 'R|1'])), _vary([['a', 'b'], ['a', 'b'], ['@', 'z'], ['@', 'z']]))
check('orphan', solve(_vary(['R|2'])), _vary(None))
check('zero', solve(_vary(['a', 'R|0'])), _vary(None))
check('negative', solve(_vary(['a', 'R|-1'])), _vary(None))
check('empty row', solve(_vary(['', 'R|1'])), _vary([[''], ['']]))
check('chained', solve(_vary(['@', 'R|1', 'R|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.

Read comma rows, with an R|count control line repeating the most recent data row count additional times. Count must be positive ASCII decimal; controls cannot precede data. Repeated rows do not become a distinct source row. Return independent row values in order; ordinary payloads contain no pipe.

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=[]; previous=None
    for line in data:
        if line.startswith('R|'):
            token=line[2:]
            if previous is None or not token.isascii() or not token.isdecimal() or int(token)<0: return None
            out.extend([list(previous) for _ in range(int(token))])
        else:
            if '|' in line: return None
            previous=line.split(',')
            out.append(previous)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeat', solve(_vary(['@,x', 'R|2'])), _vary([['@', 'x'], ['@', 'x'], ['@', 'x']]))
check('new source', solve(_vary(['a,b', 'R|1', '@,z', 'R|1'])), _vary([['a', 'b'], ['a', 'b'], ['@', 'z'], ['@', 'z']]))
check('orphan', solve(_vary(['R|2'])), _vary(None))
check('zero', solve(_vary(['a', 'R|0'])), _vary(None))
check('negative', solve(_vary(['a', 'R|-1'])), _vary(None))
check('empty row', solve(_vary(['', 'R|1'])), _vary([[''], ['']]))
check('chained', solve(_vary(['@', 'R|1', 'R|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=[]; previous=None
    for line in data:
        if line.startswith('R|'):
            token=line[2:]
            if previous is None or not token.isascii() or not token.isdecimal() or int(token)<0: return None
            if int(token)==0: continue
            out.extend([list(previous) for _ in range(int(token))])
        else:
            if '|' in line: return None
            previous=line.split(',')
            out.append(previous)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeat', solve(_vary(['@,x', 'R|2'])), _vary([['@', 'x'], ['@', 'x'], ['@', 'x']]))
check('new source', solve(_vary(['a,b', 'R|1', '@,z', 'R|1'])), _vary([['a', 'b'], ['a', 'b'], ['@', 'z'], ['@', 'z']]))
check('orphan', solve(_vary(['R|2'])), _vary(None))
check('zero', solve(_vary(['a', 'R|0'])), _vary(None))
check('negative', solve(_vary(['a', 'R|-1'])), _vary(None))
check('empty row', solve(_vary(['', 'R|1'])), _vary([[''], ['']]))
check('chained', solve(_vary(['@', 'R|1', 'R|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.

Read comma rows, with an R|count control line repeating the most recent data row count additional times. Count must be positive ASCII decimal; controls cannot precede data. Repeated rows do not become a distinct source row. Return independent row values in order; ordinary payloads contain no pipe.

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=[]; previous=None
    for line in data:
        if line.startswith('R|'):
            token=line[2:]
            if previous is None or not token.isascii() or not token.isdecimal() or int(token)<1: return None
            out.extend([list(previous) for _ in range(int(token))])
        else:
            if '|' in line: return None
            previous=line.split(',') if previous is None else previous
            out.append(previous)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeat', solve(_vary(['@,x', 'R|2'])), _vary([['@', 'x'], ['@', 'x'], ['@', 'x']]))
check('new source', solve(_vary(['a,b', 'R|1', '@,z', 'R|1'])), _vary([['a', 'b'], ['a', 'b'], ['@', 'z'], ['@', 'z']]))
check('orphan', solve(_vary(['R|2'])), _vary(None))
check('zero', solve(_vary(['a', 'R|0'])), _vary(None))
check('negative', solve(_vary(['a', 'R|-1'])), _vary(None))
check('empty row', solve(_vary(['', 'R|1'])), _vary([[''], ['']]))
check('chained', solve(_vary(['@', 'R|1', 'R|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=[]; previous=None
    for line in data:
        if line.startswith('R|'):
            token=line[2:]
            if previous is None or not token.isascii() or not token.isdecimal() or int(token)<1: return None
            out.extend([list(previous) for _ in range(int(token))])
        else:
            if '|' in line: return None
            previous=out[0] if out else line.split(',')
            out.append(previous)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeat', solve(_vary(['@,x', 'R|2'])), _vary([['@', 'x'], ['@', 'x'], ['@', 'x']]))
check('new source', solve(_vary(['a,b', 'R|1', '@,z', 'R|1'])), _vary([['a', 'b'], ['a', 'b'], ['@', 'z'], ['@', 'z']]))
check('orphan', solve(_vary(['R|2'])), _vary(None))
check('zero', solve(_vary(['a', 'R|0'])), _vary(None))
check('negative', solve(_vary(['a', 'R|-1'])), _vary(None))
check('empty row', solve(_vary(['', 'R|1'])), _vary([[''], ['']]))
check('chained', solve(_vary(['@', 'R|1', 'R|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.

Read comma rows, with an R|count control line repeating the most recent data row count additional times. Count must be positive ASCII decimal; controls cannot precede data. Repeated rows do not become a distinct source row. Return independent row values in order; ordinary payloads contain no pipe.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    if len(data)!=2 or not data[0].startswith('W|'): return None
    token=data[0][2:]
    if not token.isascii() or not token.isdecimal() or int(token)<1: return None
    width=int(token); cells=data[1].split('|')
    if len(cells)%width: return None
    height=len(cells)//width
    return [[cells[row*width+col] for col in range(width)] for row in range(height)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rectangle', solve(_vary(['W|3', 'a|d|b|e|@|f'])), _vary([['a', 'b', '@'], ['d', 'e', 'f']]))
check('one row', solve(_vary(['W|3', 'a|@|c'])), _vary([['a', '@', 'c']]))
check('one column', solve(_vary(['W|1', '@|b'])), _vary([['@'], ['b']]))
check('empty cell', solve(_vary(['W|1', ''])), _vary([['']]))
check('nondivisible', solve(_vary(['W|2', 'a|b|c'])), _vary(None))
check('zero width', solve(_vary(['W|0', 'a'])), _vary(None))
check('extra line', solve(_vary(['W|1', '@', 'x'])), _vary(None))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    if len(data)!=2 or not data[0].startswith('W|'): return None
    token=data[0][2:]
    if not token.isascii() or not token.isdecimal() or int(token)<1: return None
    width=int(token); cells=data[1].split('|')
    if len(cells)%width: return None
    height=len(cells)//width
    return [[cells[(row*width+col)%len(cells)] for col in range(width)] for row in range(height)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rectangle', solve(_vary(['W|3', 'a|d|b|e|@|f'])), _vary([['a', 'b', '@'], ['d', 'e', 'f']]))
check('one row', solve(_vary(['W|3', 'a|@|c'])), _vary([['a', '@', 'c']]))
check('one column', solve(_vary(['W|1', '@|b'])), _vary([['@'], ['b']]))
check('empty cell', solve(_vary(['W|1', ''])), _vary([['']]))
check('nondivisible', solve(_vary(['W|2', 'a|b|c'])), _vary(None))
check('zero width', solve(_vary(['W|0', 'a'])), _vary(None))
check('extra line', solve(_vary(['W|1', '@', 'x'])), _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.

Decode W|width followed by pipe-separated column-major cells in the second line. Width is a positive ASCII decimal; field count must be divisible by width. The second line empty denotes one empty cell. Return row-major rows, each exactly width cells. This bounded block requires exactly two physical lines.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    if len(data)!=2 or not data[0].startswith('W|'): return None
    token=data[0][2:]
    if not token.isascii() or not token.isdecimal() or int(token)<1: return None
    width=int(token); cells=data[1].split('|')
    if len(cells)%width: return None
    height=min(width,len(cells)//width)
    return [[cells[col*height+row] for col in range(width)] for row in range(height)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rectangle', solve(_vary(['W|3', 'a|d|b|e|@|f'])), _vary([['a', 'b', '@'], ['d', 'e', 'f']]))
check('one row', solve(_vary(['W|3', 'a|@|c'])), _vary([['a', '@', 'c']]))
check('one column', solve(_vary(['W|1', '@|b'])), _vary([['@'], ['b']]))
check('empty cell', solve(_vary(['W|1', ''])), _vary([['']]))
check('nondivisible', solve(_vary(['W|2', 'a|b|c'])), _vary(None))
check('zero width', solve(_vary(['W|0', 'a'])), _vary(None))
check('extra line', solve(_vary(['W|1', '@', 'x'])), _vary(None))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    if len(data)!=2 or not data[0].startswith('W|'): return None
    token=data[0][2:]
    if not token.isascii() or not token.isdecimal() or int(token)<1: return None
    width=int(token); cells=data[1].split('|')
    if len(cells)%width: return None
    height=1
    return [[cells[col*height+row] for col in range(width)] for row in range(height)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rectangle', solve(_vary(['W|3', 'a|d|b|e|@|f'])), _vary([['a', 'b', '@'], ['d', 'e', 'f']]))
check('one row', solve(_vary(['W|3', 'a|@|c'])), _vary([['a', '@', 'c']]))
check('one column', solve(_vary(['W|1', '@|b'])), _vary([['@'], ['b']]))
check('empty cell', solve(_vary(['W|1', ''])), _vary([['']]))
check('nondivisible', solve(_vary(['W|2', 'a|b|c'])), _vary(None))
check('zero width', solve(_vary(['W|0', 'a'])), _vary(None))
check('extra line', solve(_vary(['W|1', '@', 'x'])), _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.

Decode W|width followed by pipe-separated column-major cells in the second line. Width is a positive ASCII decimal; field count must be divisible by width. The second line empty denotes one empty cell. Return row-major rows, each exactly width cells. This bounded block requires exactly two physical lines.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    if len(data)!=2 or not data[0].startswith('W|'): return None
    token=data[0][2:]
    if not token.isascii() or not token.isdecimal() or int(token)<1: return None
    width=int(token); cells=data[1].split('|')
    if len(cells)%width: return None
    height=len(cells)//width
    return [[cells[col*height+row] for col in range(width)] for row in reversed(range(height))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rectangle', solve(_vary(['W|3', 'a|d|b|e|@|f'])), _vary([['a', 'b', '@'], ['d', 'e', 'f']]))
check('one row', solve(_vary(['W|3', 'a|@|c'])), _vary([['a', '@', 'c']]))
check('one column', solve(_vary(['W|1', '@|b'])), _vary([['@'], ['b']]))
check('empty cell', solve(_vary(['W|1', ''])), _vary([['']]))
check('nondivisible', solve(_vary(['W|2', 'a|b|c'])), _vary(None))
check('zero width', solve(_vary(['W|0', 'a'])), _vary(None))
check('extra line', solve(_vary(['W|1', '@', 'x'])), _vary(None))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    if len(data)!=2 or not data[0].startswith('W|'): return None
    token=data[0][2:]
    if not token.isascii() or not token.isdecimal() or int(token)<1: return None
    width=int(token); cells=data[1].split('|')
    if len(cells)%width: return None
    height=len(cells)//width
    return [[cells[col*height+row] for col in range(width)] for row in range(max(0,height-1))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rectangle', solve(_vary(['W|3', 'a|d|b|e|@|f'])), _vary([['a', 'b', '@'], ['d', 'e', 'f']]))
check('one row', solve(_vary(['W|3', 'a|@|c'])), _vary([['a', '@', 'c']]))
check('one column', solve(_vary(['W|1', '@|b'])), _vary([['@'], ['b']]))
check('empty cell', solve(_vary(['W|1', ''])), _vary([['']]))
check('nondivisible', solve(_vary(['W|2', 'a|b|c'])), _vary(None))
check('zero width', solve(_vary(['W|0', 'a'])), _vary(None))
check('extra line', solve(_vary(['W|1', '@', 'x'])), _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.

Decode W|width followed by pipe-separated column-major cells in the second line. Width is a positive ASCII decimal; field count must be divisible by width. The second line empty denotes one empty cell. Return row-major rows, each exactly width cells. This bounded block requires exactly two physical lines.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    if len(data)!=2 or not data[0].startswith('W|'): return None
    token=data[0][2:]
    if not token.isascii() or not token.isdecimal() or int(token)<1: return None
    width=int(token); cells=data[1].split('|')
    if len(cells)%width: return None
    height=len(cells)//width
    return [[cells[col*height+row] for col in reversed(range(width))] for row in range(height)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rectangle', solve(_vary(['W|3', 'a|d|b|e|@|f'])), _vary([['a', 'b', '@'], ['d', 'e', 'f']]))
check('one row', solve(_vary(['W|3', 'a|@|c'])), _vary([['a', '@', 'c']]))
check('one column', solve(_vary(['W|1', '@|b'])), _vary([['@'], ['b']]))
check('empty cell', solve(_vary(['W|1', ''])), _vary([['']]))
check('nondivisible', solve(_vary(['W|2', 'a|b|c'])), _vary(None))
check('zero width', solve(_vary(['W|0', 'a'])), _vary(None))
check('extra line', solve(_vary(['W|1', '@', 'x'])), _vary(None))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    if len(data)!=2 or not data[0].startswith('W|'): return None
    token=data[0][2:]
    if not token.isascii() or not token.isdecimal() or int(token)<1: return None
    width=int(token); cells=data[1].split('|')
    if len(cells)%width: return None
    height=len(cells)//width
    return [[cells[col*height+row] for col in range(max(0,width-1))] for row in range(height)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rectangle', solve(_vary(['W|3', 'a|d|b|e|@|f'])), _vary([['a', 'b', '@'], ['d', 'e', 'f']]))
check('one row', solve(_vary(['W|3', 'a|@|c'])), _vary([['a', '@', 'c']]))
check('one column', solve(_vary(['W|1', '@|b'])), _vary([['@'], ['b']]))
check('empty cell', solve(_vary(['W|1', ''])), _vary([['']]))
check('nondivisible', solve(_vary(['W|2', 'a|b|c'])), _vary(None))
check('zero width', solve(_vary(['W|0', 'a'])), _vary(None))
check('extra line', solve(_vary(['W|1', '@', 'x'])), _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.

Decode W|width followed by pipe-separated column-major cells in the second line. Width is a positive ASCII decimal; field count must be divisible by width. The second line empty denotes one empty cell. Return row-major rows, each exactly width cells. This bounded block requires exactly two physical lines.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    if len(data)!=2 or not data[0].startswith('W|'): return None
    token=data[0][2:]
    if not token.isascii() or not token.isdecimal() or int(token)<1: return None
    width=int(token); cells=data[1].split('|')
    if len(cells)%width: cells=cells[:len(cells)//width*width]
    height=len(cells)//width
    return [[cells[col*height+row] for col in range(width)] for row in range(height)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rectangle', solve(_vary(['W|3', 'a|d|b|e|@|f'])), _vary([['a', 'b', '@'], ['d', 'e', 'f']]))
check('one row', solve(_vary(['W|3', 'a|@|c'])), _vary([['a', '@', 'c']]))
check('one column', solve(_vary(['W|1', '@|b'])), _vary([['@'], ['b']]))
check('empty cell', solve(_vary(['W|1', ''])), _vary([['']]))
check('nondivisible', solve(_vary(['W|2', 'a|b|c'])), _vary(None))
check('zero width', solve(_vary(['W|0', 'a'])), _vary(None))
check('extra line', solve(_vary(['W|1', '@', 'x'])), _vary(None))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    if len(data)!=2 or not data[0].startswith('W|'): return None
    token=data[0][2:]
    if not token.isascii() or not token.isdecimal() or int(token)<1: return None
    width=int(token); cells=data[1].split('|')
    if len(cells)%width: return []
    height=len(cells)//width
    return [[cells[col*height+row] for col in range(width)] for row in range(height)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rectangle', solve(_vary(['W|3', 'a|d|b|e|@|f'])), _vary([['a', 'b', '@'], ['d', 'e', 'f']]))
check('one row', solve(_vary(['W|3', 'a|@|c'])), _vary([['a', '@', 'c']]))
check('one column', solve(_vary(['W|1', '@|b'])), _vary([['@'], ['b']]))
check('empty cell', solve(_vary(['W|1', ''])), _vary([['']]))
check('nondivisible', solve(_vary(['W|2', 'a|b|c'])), _vary(None))
check('zero width', solve(_vary(['W|0', 'a'])), _vary(None))
check('extra line', solve(_vary(['W|1', '@', 'x'])), _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.

Decode W|width followed by pipe-separated column-major cells in the second line. Width is a positive ASCII decimal; field count must be divisible by width. The second line empty denotes one empty cell. Return row-major rows, each exactly width cells. This bounded block requires exactly two physical lines.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out=[]
    for cell in data.split(';'):
        if cell.startswith('{'):
            if not cell.endswith('}'): return None
            inner=cell[1:-1]; mapping=out[-1] if out and isinstance(out[-1],dict) else {}
            for pair in inner.split(',') if inner else []:
                parts=pair.split('=',1)
                if len(parts)!=2 or not parts[0] or parts[0] in mapping: return None
                mapping[parts[0]]=parts[1]
            out.append(mapping)
        else:
            if '{' in cell or '}' in cell: return None
            out.append(cell)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mixed', solve(_vary('@;{a=x,b=y}')), _vary(['@', {'a': 'x', 'b': 'y'}]))
check('empty', solve(_vary('{}')), _vary([{}]))
check('equals value', solve(_vary('{a=x=y}')), _vary([{'a': 'x=y'}]))
check('empty value', solve(_vary('{a=}')), _vary([{'a': ''}]))
check('duplicate', solve(_vary('{a=x,a=y}')), _vary(None))
check('empty key', solve(_vary('{=x}')), _vary(None))
check('scalar equals', solve(_vary('a=x')), _vary(['a=x']))
check('two maps', solve(_vary('{a=@};{a=z}')), _vary([{'a': '@'}, {'a': 'z'}]))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out=[]
    for cell in data.split(';'):
        if cell.startswith('{'):
            if not cell.endswith('}'): return None
            inner=cell[1:-1]; mapping=dict(out[-1]) if out and isinstance(out[-1],dict) else {}
            for pair in inner.split(',') if inner else []:
                parts=pair.split('=',1)
                if len(parts)!=2 or not parts[0] or parts[0] in mapping: return None
                mapping[parts[0]]=parts[1]
            out.append(mapping)
        else:
            if '{' in cell or '}' in cell: return None
            out.append(cell)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mixed', solve(_vary('@;{a=x,b=y}')), _vary(['@', {'a': 'x', 'b': 'y'}]))
check('empty', solve(_vary('{}')), _vary([{}]))
check('equals value', solve(_vary('{a=x=y}')), _vary([{'a': 'x=y'}]))
check('empty value', solve(_vary('{a=}')), _vary([{'a': ''}]))
check('duplicate', solve(_vary('{a=x,a=y}')), _vary(None))
check('empty key', solve(_vary('{=x}')), _vary(None))
check('scalar equals', solve(_vary('a=x')), _vary(['a=x']))
check('two maps', solve(_vary('{a=@};{a=z}')), _vary([{'a': '@'}, {'a': 'z'}]))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

Decode a semicolon-delimited row of map cells enclosed in braces. Inside a map, comma separates entries and first equals separates key and value. Empty braces represent an empty map; empty values are legal, empty or duplicate keys reject. Ordinary scalar cells remain text, even with equals.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out=[]
    for cell in data.split(';'):
        if cell.startswith('{'):
            if not cell.endswith('}'): return None
            inner=cell[1:-1]; mapping={}
            for pair in inner.split(',') if inner else []:
                parts=pair.split('=')
                if len(parts)!=2 or not parts[0] or parts[0] in mapping: return None
                mapping[parts[0]]=parts[1]
            out.append(mapping)
        else:
            if '{' in cell or '}' in cell: return None
            out.append(cell)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mixed', solve(_vary('@;{a=x,b=y}')), _vary(['@', {'a': 'x', 'b': 'y'}]))
check('empty', solve(_vary('{}')), _vary([{}]))
check('equals value', solve(_vary('{a=x=y}')), _vary([{'a': 'x=y'}]))
check('empty value', solve(_vary('{a=}')), _vary([{'a': ''}]))
check('duplicate', solve(_vary('{a=x,a=y}')), _vary(None))
check('empty key', solve(_vary('{=x}')), _vary(None))
check('scalar equals', solve(_vary('a=x')), _vary(['a=x']))
check('two maps', solve(_vary('{a=@};{a=z}')), _vary([{'a': '@'}, {'a': 'z'}]))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out=[]
    for cell in data.split(';'):
        if cell.startswith('{'):
            if not cell.endswith('}'): return None
            inner=cell[1:-1]; mapping={}
            for pair in inner.split(',') if inner else []:
                parts=pair.rsplit('=',1)
                if len(parts)!=2 or not parts[0] or parts[0] in mapping: return None
                mapping[parts[0]]=parts[1]
            out.append(mapping)
        else:
            if '{' in cell or '}' in cell: return None
            out.append(cell)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mixed', solve(_vary('@;{a=x,b=y}')), _vary(['@', {'a': 'x', 'b': 'y'}]))
check('empty', solve(_vary('{}')), _vary([{}]))
check('equals value', solve(_vary('{a=x=y}')), _vary([{'a': 'x=y'}]))
check('empty value', solve(_vary('{a=}')), _vary([{'a': ''}]))
check('duplicate', solve(_vary('{a=x,a=y}')), _vary(None))
check('empty key', solve(_vary('{=x}')), _vary(None))
check('scalar equals', solve(_vary('a=x')), _vary(['a=x']))
check('two maps', solve(_vary('{a=@};{a=z}')), _vary([{'a': '@'}, {'a': 'z'}]))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

Decode a semicolon-delimited row of map cells enclosed in braces. Inside a map, comma separates entries and first equals separates key and value. Empty braces represent an empty map; empty values are legal, empty or duplicate keys reject. Ordinary scalar cells remain text, even with equals.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out=[]
    for cell in data.split(';'):
        if cell.startswith('{'):
            if not cell.endswith('}'): return None
            inner=cell[1:-1]; mapping={}
            for pair in inner.split(',') if inner else []:
                parts=pair.split('=',1)
                if len(parts)!=2 or not parts[0] or parts[0] in mapping: return None
                mapping[parts[1]]=parts[0]
            out.append(mapping)
        else:
            if '{' in cell or '}' in cell: return None
            out.append(cell)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mixed', solve(_vary('@;{a=x,b=y}')), _vary(['@', {'a': 'x', 'b': 'y'}]))
check('empty', solve(_vary('{}')), _vary([{}]))
check('equals value', solve(_vary('{a=x=y}')), _vary([{'a': 'x=y'}]))
check('empty value', solve(_vary('{a=}')), _vary([{'a': ''}]))
check('duplicate', solve(_vary('{a=x,a=y}')), _vary(None))
check('empty key', solve(_vary('{=x}')), _vary(None))
check('scalar equals', solve(_vary('a=x')), _vary(['a=x']))
check('two maps', solve(_vary('{a=@};{a=z}')), _vary([{'a': '@'}, {'a': 'z'}]))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out=[]
    for cell in data.split(';'):
        if cell.startswith('{'):
            if not cell.endswith('}'): return None
            inner=cell[1:-1]; mapping={}
            for pair in inner.split(',') if inner else []:
                parts=pair.split('=',1)
                if len(parts)!=2 or not parts[0] or parts[0] in mapping: return None
                mapping[parts[0]]=parts[0]
            out.append(mapping)
        else:
            if '{' in cell or '}' in cell: return None
            out.append(cell)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mixed', solve(_vary('@;{a=x,b=y}')), _vary(['@', {'a': 'x', 'b': 'y'}]))
check('empty', solve(_vary('{}')), _vary([{}]))
check('equals value', solve(_vary('{a=x=y}')), _vary([{'a': 'x=y'}]))
check('empty value', solve(_vary('{a=}')), _vary([{'a': ''}]))
check('duplicate', solve(_vary('{a=x,a=y}')), _vary(None))
check('empty key', solve(_vary('{=x}')), _vary(None))
check('scalar equals', solve(_vary('a=x')), _vary(['a=x']))
check('two maps', solve(_vary('{a=@};{a=z}')), _vary([{'a': '@'}, {'a': 'z'}]))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

Decode a semicolon-delimited row of map cells enclosed in braces. Inside a map, comma separates entries and first equals separates key and value. Empty braces represent an empty map; empty values are legal, empty or duplicate keys reject. Ordinary scalar cells remain text, even with equals.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out=[]
    for cell in data.split(';'):
        if cell.startswith('{'):
            if not cell.endswith('}'): return None
            inner=cell[1:-1]; mapping={}
            for pair in inner.split(',') if inner else []:
                parts=pair.split('=',1)
                if len(parts)!=2 or not parts[0] or parts[0] in mapping: return None
                mapping[parts[0]]=parts[1]
            out.append(mapping if mapping else [])
        else:
            if '{' in cell or '}' in cell: return None
            out.append(cell)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mixed', solve(_vary('@;{a=x,b=y}')), _vary(['@', {'a': 'x', 'b': 'y'}]))
check('empty', solve(_vary('{}')), _vary([{}]))
check('equals value', solve(_vary('{a=x=y}')), _vary([{'a': 'x=y'}]))
check('empty value', solve(_vary('{a=}')), _vary([{'a': ''}]))
check('duplicate', solve(_vary('{a=x,a=y}')), _vary(None))
check('empty key', solve(_vary('{=x}')), _vary(None))
check('scalar equals', solve(_vary('a=x')), _vary(['a=x']))
check('two maps', solve(_vary('{a=@};{a=z}')), _vary([{'a': '@'}, {'a': 'z'}]))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out=[]
    for cell in data.split(';'):
        if cell.startswith('{'):
            if not cell.endswith('}'): return None
            inner=cell[1:-1]; mapping={}
            for pair in inner.split(',') if inner else []:
                parts=pair.split('=',1)
                if len(parts)!=2 or not parts[0] or parts[0] in mapping: return None
                mapping[parts[0]]=parts[1]
            out.append(mapping if mapping else None)
        else:
            if '{' in cell or '}' in cell: return None
            out.append(cell)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mixed', solve(_vary('@;{a=x,b=y}')), _vary(['@', {'a': 'x', 'b': 'y'}]))
check('empty', solve(_vary('{}')), _vary([{}]))
check('equals value', solve(_vary('{a=x=y}')), _vary([{'a': 'x=y'}]))
check('empty value', solve(_vary('{a=}')), _vary([{'a': ''}]))
check('duplicate', solve(_vary('{a=x,a=y}')), _vary(None))
check('empty key', solve(_vary('{=x}')), _vary(None))
check('scalar equals', solve(_vary('a=x')), _vary(['a=x']))
check('two maps', solve(_vary('{a=@};{a=z}')), _vary([{'a': '@'}, {'a': 'z'}]))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

Decode a semicolon-delimited row of map cells enclosed in braces. Inside a map, comma separates entries and first equals separates key and value. Empty braces represent an empty map; empty values are legal, empty or duplicate keys reject. Ordinary scalar cells remain text, even with equals.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out=[]
    for cell in data.split(';'):
        if cell.startswith('{'):
            if not cell.endswith('}'): return None
            inner=cell[1:-1]; mapping={}
            for pair in inner.split(',') if inner else []:
                parts=pair.split('=',1)
                if len(parts)!=2 or not parts[0] : return None
                mapping[parts[0]]=parts[1]
            out.append(mapping)
        else:
            if '{' in cell or '}' in cell: return None
            out.append(cell)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mixed', solve(_vary('@;{a=x,b=y}')), _vary(['@', {'a': 'x', 'b': 'y'}]))
check('empty', solve(_vary('{}')), _vary([{}]))
check('equals value', solve(_vary('{a=x=y}')), _vary([{'a': 'x=y'}]))
check('empty value', solve(_vary('{a=}')), _vary([{'a': ''}]))
check('duplicate', solve(_vary('{a=x,a=y}')), _vary(None))
check('empty key', solve(_vary('{=x}')), _vary(None))
check('scalar equals', solve(_vary('a=x')), _vary(['a=x']))
check('two maps', solve(_vary('{a=@};{a=z}')), _vary([{'a': '@'}, {'a': 'z'}]))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out=[]
    for cell in data.split(';'):
        if cell.startswith('{'):
            if not cell.endswith('}'): return None
            inner=cell[1:-1]; mapping={}
            for pair in inner.split(',') if inner else []:
                parts=pair.split('=',1)
                if len(parts)!=2 or not parts[0] or (parts[0] in mapping and mapping[parts[0]]==parts[1]): return None
                mapping[parts[0]]=parts[1]
            out.append(mapping)
        else:
            if '{' in cell or '}' in cell: return None
            out.append(cell)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mixed', solve(_vary('@;{a=x,b=y}')), _vary(['@', {'a': 'x', 'b': 'y'}]))
check('empty', solve(_vary('{}')), _vary([{}]))
check('equals value', solve(_vary('{a=x=y}')), _vary([{'a': 'x=y'}]))
check('empty value', solve(_vary('{a=}')), _vary([{'a': ''}]))
check('duplicate', solve(_vary('{a=x,a=y}')), _vary(None))
check('empty key', solve(_vary('{=x}')), _vary(None))
check('scalar equals', solve(_vary('a=x')), _vary(['a=x']))
check('two maps', solve(_vary('{a=@};{a=z}')), _vary([{'a': '@'}, {'a': 'z'}]))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

Decode a semicolon-delimited row of map cells enclosed in braces. Inside a map, comma separates entries and first equals separates key and value. Empty braces represent an empty map; empty values are legal, empty or duplicate keys reject. Ordinary scalar cells remain text, even with equals.

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):
    headers=data['header'].split(','); values=data['row'].split(',')
    if len(headers)!=len(values): return None
    out={}
    for header,value in zip(headers,values):
        path=header.split('.')
        if any(not part for part in path): return None
        node=out
        for part in path[:-1]:
            if part not in node: node[part]={}
            if not isinstance(node[part],dict): return None
            node=out[part] if part in out else node
        if path[-1] in node: return None
        node[path[-1]]=value
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nested', solve(_vary({'header': 'user.name,user.city', 'row': '@,x'})), _vary({'user': {'name': '@', 'city': 'x'}}))
check('two roots', solve(_vary({'header': 'a.x,b.x', 'row': '@,z'})), _vary({'a': {'x': '@'}, 'b': {'x': 'z'}}))
check('scalar conflict', solve(_vary({'header': 'a,a.b', 'row': '@,z'})), _vary(None))
check('parent conflict', solve(_vary({'header': 'a.b,a', 'row': '@,z'})), _vary(None))
check('duplicate', solve(_vary({'header': 'a.b,a.b', 'row': '@,z'})), _vary(None))
check('empty component', solve(_vary({'header': 'a..b', 'row': '@'})), _vary(None))
check('deep', solve(_vary({'header': 'a.b.c', 'row': '@'})), _vary({'a': {'b': {'c': '@'}}}))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    headers=data['header'].split(','); values=data['row'].split(',')
    if len(headers)!=len(values): return None
    out={}
    for header,value in zip(headers,values):
        path=header.split('.')
        if any(not part for part in path): return None
        node=out
        for part in path[:-1]:
            if part not in node: node[part]={}
            if not isinstance(node[part],dict): return None
            node=node
        if path[-1] in node: return None
        node[path[-1]]=value
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nested', solve(_vary({'header': 'user.name,user.city', 'row': '@,x'})), _vary({'user': {'name': '@', 'city': 'x'}}))
check('two roots', solve(_vary({'header': 'a.x,b.x', 'row': '@,z'})), _vary({'a': {'x': '@'}, 'b': {'x': 'z'}}))
check('scalar conflict', solve(_vary({'header': 'a,a.b', 'row': '@,z'})), _vary(None))
check('parent conflict', solve(_vary({'header': 'a.b,a', 'row': '@,z'})), _vary(None))
check('duplicate', solve(_vary({'header': 'a.b,a.b', 'row': '@,z'})), _vary(None))
check('empty component', solve(_vary({'header': 'a..b', 'row': '@'})), _vary(None))
check('deep', solve(_vary({'header': 'a.b.c', 'row': '@'})), _vary({'a': {'b': {'c': '@'}}}))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

Bind comma values to comma headers whose dots denote object paths. Empty path components, duplicate complete paths, or a path that is both leaf and parent reject. Scalar leaves remain text. Header and value counts must match. Return nested dictionaries.

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):
    headers=data['header'].split(','); values=data['row'].split(',')
    if len(headers)!=len(values): return None
    out={}
    for header,value in zip(headers,values):
        path=header.split('.')
        if any(not part for part in path): return None
        node=out
        for part in path[:-1]:
            node[part]={}
            if not isinstance(node[part],dict): return None
            node=node[part]
        if path[-1] in node: return None
        node[path[-1]]=value
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nested', solve(_vary({'header': 'user.name,user.city', 'row': '@,x'})), _vary({'user': {'name': '@', 'city': 'x'}}))
check('two roots', solve(_vary({'header': 'a.x,b.x', 'row': '@,z'})), _vary({'a': {'x': '@'}, 'b': {'x': 'z'}}))
check('scalar conflict', solve(_vary({'header': 'a,a.b', 'row': '@,z'})), _vary(None))
check('parent conflict', solve(_vary({'header': 'a.b,a', 'row': '@,z'})), _vary(None))
check('duplicate', solve(_vary({'header': 'a.b,a.b', 'row': '@,z'})), _vary(None))
check('empty component', solve(_vary({'header': 'a..b', 'row': '@'})), _vary(None))
check('deep', solve(_vary({'header': 'a.b.c', 'row': '@'})), _vary({'a': {'b': {'c': '@'}}}))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    headers=data['header'].split(','); values=data['row'].split(',')
    if len(headers)!=len(values): return None
    out={}
    for header,value in zip(headers,values):
        path=header.split('.')
        if any(not part for part in path): return None
        node=out
        for part in path[:-1]:
            if part in node: node[part]={}
            else: node[part]={}
            if not isinstance(node[part],dict): return None
            node=node[part]
        if path[-1] in node: return None
        node[path[-1]]=value
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nested', solve(_vary({'header': 'user.name,user.city', 'row': '@,x'})), _vary({'user': {'name': '@', 'city': 'x'}}))
check('two roots', solve(_vary({'header': 'a.x,b.x', 'row': '@,z'})), _vary({'a': {'x': '@'}, 'b': {'x': 'z'}}))
check('scalar conflict', solve(_vary({'header': 'a,a.b', 'row': '@,z'})), _vary(None))
check('parent conflict', solve(_vary({'header': 'a.b,a', 'row': '@,z'})), _vary(None))
check('duplicate', solve(_vary({'header': 'a.b,a.b', 'row': '@,z'})), _vary(None))
check('empty component', solve(_vary({'header': 'a..b', 'row': '@'})), _vary(None))
check('deep', solve(_vary({'header': 'a.b.c', 'row': '@'})), _vary({'a': {'b': {'c': '@'}}}))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

Bind comma values to comma headers whose dots denote object paths. Empty path components, duplicate complete paths, or a path that is both leaf and parent reject. Scalar leaves remain text. Header and value counts must match. Return nested dictionaries.

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):
    headers=data['header'].split(','); values=data['row'].split(',')
    if len(headers)!=len(values): return None
    out={}
    for header,value in zip(headers,values):
        path=header.split('.')
        if any(not part for part in path): return None
        node=out
        for part in path[:-1]:
            if part not in node: node[part]={}
            if not isinstance(node[part],dict): return None
            node=node[part]
        if path[-1] in node: return None
        node[header]=value
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nested', solve(_vary({'header': 'user.name,user.city', 'row': '@,x'})), _vary({'user': {'name': '@', 'city': 'x'}}))
check('two roots', solve(_vary({'header': 'a.x,b.x', 'row': '@,z'})), _vary({'a': {'x': '@'}, 'b': {'x': 'z'}}))
check('scalar conflict', solve(_vary({'header': 'a,a.b', 'row': '@,z'})), _vary(None))
check('parent conflict', solve(_vary({'header': 'a.b,a', 'row': '@,z'})), _vary(None))
check('duplicate', solve(_vary({'header': 'a.b,a.b', 'row': '@,z'})), _vary(None))
check('empty component', solve(_vary({'header': 'a..b', 'row': '@'})), _vary(None))
check('deep', solve(_vary({'header': 'a.b.c', 'row': '@'})), _vary({'a': {'b': {'c': '@'}}}))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    headers=data['header'].split(','); values=data['row'].split(',')
    if len(headers)!=len(values): return None
    out={}
    for header,value in zip(headers,values):
        path=header.split('.')
        if any(not part for part in path): return None
        node=out
        for part in path[:-1]:
            if part not in node: node[part]={}
            if not isinstance(node[part],dict): return None
            node=node[part]
        if path[-1] in node: return None
        node[path[0]]=value
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nested', solve(_vary({'header': 'user.name,user.city', 'row': '@,x'})), _vary({'user': {'name': '@', 'city': 'x'}}))
check('two roots', solve(_vary({'header': 'a.x,b.x', 'row': '@,z'})), _vary({'a': {'x': '@'}, 'b': {'x': 'z'}}))
check('scalar conflict', solve(_vary({'header': 'a,a.b', 'row': '@,z'})), _vary(None))
check('parent conflict', solve(_vary({'header': 'a.b,a', 'row': '@,z'})), _vary(None))
check('duplicate', solve(_vary({'header': 'a.b,a.b', 'row': '@,z'})), _vary(None))
check('empty component', solve(_vary({'header': 'a..b', 'row': '@'})), _vary(None))
check('deep', solve(_vary({'header': 'a.b.c', 'row': '@'})), _vary({'a': {'b': {'c': '@'}}}))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

Bind comma values to comma headers whose dots denote object paths. Empty path components, duplicate complete paths, or a path that is both leaf and parent reject. Scalar leaves remain text. Header and value counts must match. Return nested dictionaries.

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):
    headers=data['header'].split(','); values=data['row'].split(',')
    if len(headers)!=len(values): return None
    out={}
    for header,value in zip(headers,values):
        path=header.split('.',1)
        if any(not part for part in path): return None
        node=out
        for part in path[:-1]:
            if part not in node: node[part]={}
            if not isinstance(node[part],dict): return None
            node=node[part]
        if path[-1] in node: return None
        node[path[-1]]=value
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nested', solve(_vary({'header': 'user.name,user.city', 'row': '@,x'})), _vary({'user': {'name': '@', 'city': 'x'}}))
check('two roots', solve(_vary({'header': 'a.x,b.x', 'row': '@,z'})), _vary({'a': {'x': '@'}, 'b': {'x': 'z'}}))
check('scalar conflict', solve(_vary({'header': 'a,a.b', 'row': '@,z'})), _vary(None))
check('parent conflict', solve(_vary({'header': 'a.b,a', 'row': '@,z'})), _vary(None))
check('duplicate', solve(_vary({'header': 'a.b,a.b', 'row': '@,z'})), _vary(None))
check('empty component', solve(_vary({'header': 'a..b', 'row': '@'})), _vary(None))
check('deep', solve(_vary({'header': 'a.b.c', 'row': '@'})), _vary({'a': {'b': {'c': '@'}}}))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    headers=data['header'].split(','); values=data['row'].split(',')
    if len(headers)!=len(values): return None
    out={}
    for header,value in zip(headers,values):
        path=header.rsplit('.',1)
        if any(not part for part in path): return None
        node=out
        for part in path[:-1]:
            if part not in node: node[part]={}
            if not isinstance(node[part],dict): return None
            node=node[part]
        if path[-1] in node: return None
        node[path[-1]]=value
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nested', solve(_vary({'header': 'user.name,user.city', 'row': '@,x'})), _vary({'user': {'name': '@', 'city': 'x'}}))
check('two roots', solve(_vary({'header': 'a.x,b.x', 'row': '@,z'})), _vary({'a': {'x': '@'}, 'b': {'x': 'z'}}))
check('scalar conflict', solve(_vary({'header': 'a,a.b', 'row': '@,z'})), _vary(None))
check('parent conflict', solve(_vary({'header': 'a.b,a', 'row': '@,z'})), _vary(None))
check('duplicate', solve(_vary({'header': 'a.b,a.b', 'row': '@,z'})), _vary(None))
check('empty component', solve(_vary({'header': 'a..b', 'row': '@'})), _vary(None))
check('deep', solve(_vary({'header': 'a.b.c', 'row': '@'})), _vary({'a': {'b': {'c': '@'}}}))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

Bind comma values to comma headers whose dots denote object paths. Empty path components, duplicate complete paths, or a path that is both leaf and parent reject. Scalar leaves remain text. Header and value counts must match. Return nested dictionaries.

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):
    headers=data['header'].split(','); values=data['row'].split(',')
    if len(headers)!=len(values): return None
    out={}
    for header,value in zip(headers,values):
        path=header.split('.')
        if any(not part for part in path): return None
        node=out
        for part in path[:-1]:
            if part not in node: node[part]={}
            if not isinstance(node[part],dict): return None
            node=node[part]
        if path[-1] in node and not isinstance(node[path[-1]],dict): return None
        node[path[-1]]=value
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nested', solve(_vary({'header': 'user.name,user.city', 'row': '@,x'})), _vary({'user': {'name': '@', 'city': 'x'}}))
check('two roots', solve(_vary({'header': 'a.x,b.x', 'row': '@,z'})), _vary({'a': {'x': '@'}, 'b': {'x': 'z'}}))
check('scalar conflict', solve(_vary({'header': 'a,a.b', 'row': '@,z'})), _vary(None))
check('parent conflict', solve(_vary({'header': 'a.b,a', 'row': '@,z'})), _vary(None))
check('duplicate', solve(_vary({'header': 'a.b,a.b', 'row': '@,z'})), _vary(None))
check('empty component', solve(_vary({'header': 'a..b', 'row': '@'})), _vary(None))
check('deep', solve(_vary({'header': 'a.b.c', 'row': '@'})), _vary({'a': {'b': {'c': '@'}}}))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    headers=data['header'].split(','); values=data['row'].split(',')
    if len(headers)!=len(values): return None
    out={}
    for header,value in zip(headers,values):
        path=header.split('.')
        if any(not part for part in path): return None
        node=out
        for part in path[:-1]:
            if part not in node: node[part]={}
            if not isinstance(node[part],dict): return None
            node=node[part]
        if path[-1] in node and isinstance(node[path[-1]],dict): node.pop(path[-1])
        node[path[-1]]=value
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nested', solve(_vary({'header': 'user.name,user.city', 'row': '@,x'})), _vary({'user': {'name': '@', 'city': 'x'}}))
check('two roots', solve(_vary({'header': 'a.x,b.x', 'row': '@,z'})), _vary({'a': {'x': '@'}, 'b': {'x': 'z'}}))
check('scalar conflict', solve(_vary({'header': 'a,a.b', 'row': '@,z'})), _vary(None))
check('parent conflict', solve(_vary({'header': 'a.b,a', 'row': '@,z'})), _vary(None))
check('duplicate', solve(_vary({'header': 'a.b,a.b', 'row': '@,z'})), _vary(None))
check('empty component', solve(_vary({'header': 'a..b', 'row': '@'})), _vary(None))
check('deep', solve(_vary({'header': 'a.b.c', 'row': '@'})), _vary({'a': {'b': {'c': '@'}}}))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

Bind comma values to comma headers whose dots denote object paths. Empty path components, duplicate complete paths, or a path that is both leaf and parent reject. Scalar leaves remain text. Header and value counts must match. Return nested dictionaries.

split: open-access


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

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

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

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

split: open-access


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

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

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

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

split: open-access


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

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

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

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

split: open-access