broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(current, wear, incoming, discharge):
    return wear+discharge
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('new cell', solve('a',10*N,'b',N), N)
check('same cell', solve('a',10*N,'a',N), 11*N)
check('same no flow', solve('a',10*N,'a',0), 10*N)
check('new no flow', solve('a',10*N,'b',0), 0)
check('new unworn', solve('a',0,'b',N), N)
check('same unworn', solve('a',0,'a',N), 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

N = 1
observations = []
def solve(current, wear, incoming, discharge):
    return discharge
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('new cell', solve('a',10*N,'b',N), N)
check('same cell', solve('a',10*N,'a',N), 11*N)
check('same no flow', solve('a',10*N,'a',0), 10*N)
check('new no flow', solve('a',10*N,'b',0), 0)
check('new unworn', solve('a',0,'b',N), N)
check('same unworn', solve('a',0,'a',N), 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 slot stores wear independently of the identity occupying it.

Given current identity and wear, incoming identity, and new discharge amount, return that slot wear: preserve for same identity, reset for different identity, then add discharge.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(donor, receiver, transfer):
    return [donor-transfer,receiver+transfer,0]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('partial', solve(10*N,2*N,4*N), [6*N,4*N,2*N])
check('full', solve(10*N,0,10*N), [0,5*N,5*N])
check('zero', solve(10*N,2*N,0), [10*N,2*N,0])
check('empty', solve(0,0,0), [0,0,0])
check('receiver occupied', solve(8*N,9*N,2*N), [6*N,10*N,N])
check('small transfer', solve(10*N,2*N,2), [10*N-2,2*N+1,1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(donor, receiver, transfer):
    return [donor-transfer//2,receiver+transfer//2,transfer//2]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('partial', solve(10*N,2*N,4*N), [6*N,4*N,2*N])
check('full', solve(10*N,0,10*N), [0,5*N,5*N])
check('zero', solve(10*N,2*N,0), [10*N,2*N,0])
check('empty', solve(0,0,0), [0,0,0])
check('receiver occupied', solve(8*N,9*N,2*N), [6*N,10*N,N])
check('small transfer', solve(10*N,2*N,2), [10*N-2,2*N+1,1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Transfer loss is ignored while moving inventory between cells.

For nonnegative inventories and even transfer no greater than donor inventory, return [donor,receiver,lost]; receiver has no capacity bound in this toy model and receives half the transfer.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(route, completed):
    return next((x for x in route if x not in completed), 'done')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
r = ['wash'] * N + ['coat', 'wash']
check('repeat remains', solve(r, ['wash'] * N), 'coat')
check('post-coating wash remains', solve(r, ['wash'] * N + ['coat']), 'wash')
check('out of sequence', solve(r, ['coat']), 'invalid')
check('complete', solve(r, r), 'done')
check('not started', solve(r, []), 'wash')
check('empty route', solve([], []), 'done')
check('extra operation', solve(r, r + ['wash']), 'invalid')
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

N = 1
observations = []
def solve(route, completed):
    remaining = list(route)
    for x in completed:
        if x not in remaining: return 'invalid'
        remaining.remove(x)
    return remaining[0] if remaining else 'done'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
r = ['wash'] * N + ['coat', 'wash']
check('repeat remains', solve(r, ['wash'] * N), 'coat')
check('post-coating wash remains', solve(r, ['wash'] * N + ['coat']), 'wash')
check('out of sequence', solve(r, ['coat']), 'invalid')
check('complete', solve(r, r), 'done')
check('not started', solve(r, []), 'wash')
check('empty route', solve([], []), 'done')
check('extra operation', solve(r, r + ['wash']), 'invalid')
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:
Repeated route operations are collapsed into one completion.

For ordered operation-name lists, return the next operation, done for a full route, or invalid unless completed is a prefix.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(cycle, records):
    return any(outcome == 'pass' for c, outcome in records)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('old pass invalidated', solve(N, [(N-1, 'pass')]), False)
check('current pass', solve(N, [(N, 'pass')]), True)
check('later failure controls', solve(N, [(N, 'pass'), (N, 'fail')]), False)
check('later passing retest', solve(N, [(N, 'fail'), (N, 'pass')]), True)
check('future evidence ignored', solve(N, [(N+1, 'pass')]), False)
check('no evidence', solve(N, []), False)
check('old failure does not block', solve(N, [(N-1, 'fail'), (N, 'pass')]), True)
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

N = 1
observations = []
def solve(cycle, records):
    return any(c == cycle and outcome == 'pass' for c, outcome in records)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('old pass invalidated', solve(N, [(N-1, 'pass')]), False)
check('current pass', solve(N, [(N, 'pass')]), True)
check('later failure controls', solve(N, [(N, 'pass'), (N, 'fail')]), False)
check('later passing retest', solve(N, [(N, 'fail'), (N, 'pass')]), True)
check('future evidence ignored', solve(N, [(N+1, 'pass')]), False)
check('no evidence', solve(N, []), False)
check('old failure does not block', solve(N, [(N-1, 'fail'), (N, 'pass')]), True)
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:
Inspection evidence survives a rework cycle incorrectly.

Records are chronological (cycle, outcome) pairs. Release iff the last record matching the current cycle is pass.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(parents, lot):
    while parents.get(lot): lot = parents[lot][0]
    return [lot]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
p = {str(i): [str(i-1)] for i in range(1, N+1)}
p['blend'] = [str(N), 'b']
check('both upstream branches', solve(p, 'blend'), ['0', 'b'])
check('chain source', solve(p, str(N)), ['0'])
check('unmapped source', solve(p, 'b'), ['b'])
check('explicit source', solve({'a': []}, 'a'), ['a'])
check('shared source deduplicated', solve({'m': ['x', 'y'], 'x': ['a'], 'y': ['a']}, 'm'), ['a'])
check('direct merge', solve({'m': ['b', 'a']}, 'm'), ['a', 'b'])
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

N = 1
observations = []
def solve(parents, lot):
    return sorted(set(parents.get(lot) or [lot]))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
p = {str(i): [str(i-1)] for i in range(1, N+1)}
p['blend'] = [str(N), 'b']
check('both upstream branches', solve(p, 'blend'), ['0', 'b'])
check('chain source', solve(p, str(N)), ['0'])
check('unmapped source', solve(p, 'b'), ['b'])
check('explicit source', solve({'a': []}, 'a'), ['a'])
check('shared source deduplicated', solve({'m': ['x', 'y'], 'x': ['a'], 'y': ['a']}, 'm'), ['a'])
check('direct merge', solve({'m': ['b', 'a']}, 'm'), ['a', 'b'])
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:
Merged lot genealogy loses one input branch.

Given an acyclic parent mapping, return sorted terminal ancestors of a lot; an unmapped or parentless lot is a source.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(parents, lot, held):
    return lot in held
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
p = {'finish': ['work'], 'work': ['stage-0']}
p.update({'stage-' + str(i): ['stage-' + str(i+1)] for i in range(N)})
p['stage-' + str(N)] = ['raw' + str(N)]
check('intermediate hold', solve(p, 'finish', {'work'}), True)
check('raw hold', solve(p, 'finish', {'raw' + str(N)}), True)
check('finished hold', solve(p, 'finish', {'finish'}), True)
check('unrelated hold', solve(p, 'finish', {'other'}), False)
check('no holds', solve(p, 'finish', set()), False)
check('source hold', solve({}, 'raw', {'raw'}), True)
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

N = 1
observations = []
def solve(parents, lot, held):
    pending = [lot]
    while pending:
        x = pending.pop()
        if parents.get(x): pending.extend(parents[x])
        elif x in held: return True
    return False
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
p = {'finish': ['work'], 'work': ['stage-0']}
p.update({'stage-' + str(i): ['stage-' + str(i+1)] for i in range(N)})
p['stage-' + str(N)] = ['raw' + str(N)]
check('intermediate hold', solve(p, 'finish', {'work'}), True)
check('raw hold', solve(p, 'finish', {'raw' + str(N)}), True)
check('finished hold', solve(p, 'finish', {'finish'}), True)
check('unrelated hold', solve(p, 'finish', {'other'}), False)
check('no holds', solve(p, 'finish', set()), False)
check('source hold', solve({}, 'raw', {'raw'}), True)
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 descendant lot escapes an upstream quality hold.

For an acyclic genealogy and active held-lot set, return whether shipment is blocked by any ancestor or the lot itself.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(routes, frozen, migration):
    return routes[max(routes)] if routes else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
r = {N: ['wash'], N+1: ['wash', 'inspect']}
check('frozen route', solve(r, N, None), ['wash'])
check('explicit migration', solve(r, N, N+1), ['wash', 'inspect'])
check('missing migration', solve(r, N, N+2), None)
check('missing frozen revision', solve(r, N-1, None), None)
check('current frozen', solve(r, N+1, None), ['wash', 'inspect'])
check('no revisions', solve({}, N, None), 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

N = 1
observations = []
def solve(routes, frozen, migration):
    return routes.get(frozen)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
r = {N: ['wash'], N+1: ['wash', 'inspect']}
check('frozen route', solve(r, N, None), ['wash'])
check('explicit migration', solve(r, N, N+1), ['wash', 'inspect'])
check('missing migration', solve(r, N, N+2), None)
check('missing frozen revision', solve(r, N-1, None), None)
check('current frozen', solve(r, N+1, None), ['wash', 'inspect'])
check('no revisions', solve({}, N, None), 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:
An in-process lot silently adopts a revised route.

Given a revision-to-route mapping, frozen revision and optional migration revision, return that exact route or None if absent. No fallback is allowed.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(approvals, lot, operation, cycle):
    return any(a == lot for a, o, lo, hi in approvals)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
a = [('lot', 'wash-2', N, N+2)]
check('first approved cycle', solve(a, 'lot', 'wash-2', N), True)
check('last approved cycle', solve(a, 'lot', 'wash-2', N+2), True)
check('expired deviation', solve(a, 'lot', 'wash-2', N+3), False)
check('too early', solve(a, 'lot', 'wash-2', N-1), False)
check('different occurrence', solve(a, 'lot', 'wash-1', N), False)
check('different lot', solve(a, 'other', 'wash-2', N), False)
check('no approvals', solve([], 'lot', 'wash-2', N), False)
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

N = 1
observations = []
def solve(approvals, lot, operation, cycle):
    return any(a == lot and o == operation for a, o, lo, hi in approvals)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
a = [('lot', 'wash-2', N, N+2)]
check('first approved cycle', solve(a, 'lot', 'wash-2', N), True)
check('last approved cycle', solve(a, 'lot', 'wash-2', N+2), True)
check('expired deviation', solve(a, 'lot', 'wash-2', N+3), False)
check('too early', solve(a, 'lot', 'wash-2', N-1), False)
check('different occurrence', solve(a, 'lot', 'wash-1', N), False)
check('different lot', solve(a, 'other', 'wash-2', N), False)
check('no approvals', solve([], 'lot', 'wash-2', N), False)
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 deviation approval leaks to another operation.

Approvals are (lot, operation occurrence, first cycle, last cycle). Return true iff an approval matches lot and occurrence and contains the requested cycle.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(records, fixture, operation, revision, time):
    return any(f == fixture for f, o, r, end in records)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
q = [('jig', 'drill', N, 10*N)]
check('qualified dispatch', solve(q, 'jig', 'drill', N, 10*N-1), True)
check('expiration instant', solve(q, 'jig', 'drill', N, 10*N), False)
check('obsolete recipe', solve(q, 'jig', 'drill', N+1, 0), False)
check('wrong operation', solve(q, 'jig', 'mill', N, 0), False)
check('wrong fixture', solve(q, 'other', 'drill', N, 0), False)
check('empty records', solve([], 'jig', 'drill', N, 0), False)
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

N = 1
observations = []
def solve(records, fixture, operation, revision, time):
    return any(f == fixture and o == operation and time < end for f, o, r, end in records)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
q = [('jig', 'drill', N, 10*N)]
check('qualified dispatch', solve(q, 'jig', 'drill', N, 10*N-1), True)
check('expiration instant', solve(q, 'jig', 'drill', N, 10*N), False)
check('obsolete recipe', solve(q, 'jig', 'drill', N+1, 0), False)
check('wrong operation', solve(q, 'jig', 'mill', N, 0), False)
check('wrong fixture', solve(q, 'other', 'drill', N, 0), False)
check('empty records', solve([], 'jig', 'drill', N, 0), False)
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:
Tool qualification for one operation authorizes another.

Qualifications are (fixture, operation, recipe revision, valid until). Dispatch time must be strictly less than valid until.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(records, cycle):
    return len(records) >= 2
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('separate people', solve([('a', 'operator', N), ('b', 'witness', N)], N), True)
check('same person', solve([('a', 'operator', N), ('a', 'witness', N)], N), False)
check('stale witness', solve([('a', 'operator', N), ('b', 'witness', N-1)], N), False)
check('two operators', solve([('a', 'operator', N), ('b', 'operator', N)], N), False)
check('only one signature', solve([('a', 'operator', N)], N), False)
check('none', solve([], N), False)
check('irrelevant history', solve([('a', 'operator', N), ('b', 'witness', N), ('c', 'witness', N-1)], N), True)
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

N = 1
observations = []
def solve(records, cycle):
    return any(p != q and r == 'operator' and s == 'witness' for p, r, c in records for q, s, d in records)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('separate people', solve([('a', 'operator', N), ('b', 'witness', N)], N), True)
check('same person', solve([('a', 'operator', N), ('a', 'witness', N)], N), False)
check('stale witness', solve([('a', 'operator', N), ('b', 'witness', N-1)], N), False)
check('two operators', solve([('a', 'operator', N), ('b', 'operator', N)], N), False)
check('only one signature', solve([('a', 'operator', N)], N), False)
check('none', solve([], N), False)
check('irrelevant history', solve([('a', 'operator', N), ('b', 'witness', N), ('c', 'witness', N-1)], N), True)
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:
One operator satisfies both release signatures.

Signatures are (person, role, cycle). Return true iff current cycle has an operator and a witness who are different people.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(active, samples):
    return sum(ok for cavity, ok in samples) >= len(active)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
a = list(range(N+1))
good = [(i, True) for i in a]
check('complete cavity coverage', solve(a, good), True)
check('duplicates hide missing cavity', solve(a, [(0, True)] * (N+1)), False)
check('later cavity failure', solve(a, good + [(N, False)]), False)
check('successful retest', solve(a, [(N, False)] + good), True)
check('inactive failure ignored', solve(a, good + [(N+2, False)]), True)
check('no active cavities', solve([], []), True)
check('no samples', solve(a, []), False)
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

N = 1
observations = []
def solve(active, samples):
    return all(any(c == cavity and ok for c, ok in samples) for cavity in active)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
a = list(range(N+1))
good = [(i, True) for i in a]
check('complete cavity coverage', solve(a, good), True)
check('duplicates hide missing cavity', solve(a, [(0, True)] * (N+1)), False)
check('later cavity failure', solve(a, good + [(N, False)]), False)
check('successful retest', solve(a, [(N, False)] + good), True)
check('inactive failure ignored', solve(a, good + [(N+2, False)]), True)
check('no active cavities', solve([], []), True)
check('no samples', solve(a, []), False)
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:
Duplicate samples mask an unqualified mold cavity.

Active cavity IDs are unique. Chronological samples are (cavity, passed) pairs. Gate opens iff each active cavity latest sample passes; inactive cavities are irrelevant.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(events, product):
    return any(kind == 'clear' for kind, target in events)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
p = 'product-' + str(N)
check('fresh correct clearance', solve([('clear', p)], p), True)
check('clearance consumed by run', solve([('clear', p)] + [('run', p)] * N, p), False)
check('wrong target', solve([('clear', 'other')], p), False)
check('new clearance after run', solve([('clear', p), ('run', p), ('clear', p)], p), True)
check('most recent target controls', solve([('clear', p), ('clear', 'other')], p), False)
check('no clearance', solve([], p), False)
check('run alone', solve([('run', p)], p), False)
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

N = 1
observations = []
def solve(events, product):
    clears = [target for kind, target in events if kind == 'clear']
    return bool(clears) and clears[-1] == product
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
p = 'product-' + str(N)
check('fresh correct clearance', solve([('clear', p)], p), True)
check('clearance consumed by run', solve([('clear', p)] + [('run', p)] * N, p), False)
check('wrong target', solve([('clear', 'other')], p), False)
check('new clearance after run', solve([('clear', p), ('run', p), ('clear', p)], p), True)
check('most recent target controls', solve([('clear', p), ('clear', 'other')], p), False)
check('no clearance', solve([], p), False)
check('run alone', solve([('run', p)], p), False)
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 line clearance survives an intervening product run.

Chronological events are (clear or run, product) pairs. A requested start is permitted only if the last event is clear for that requested product.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
import math
N = 1
observations = []
def solve(value, steps):
    return str(Fraction(value) * math.prod(f for f, applied in steps))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mixed instrument and manual steps', solve(N, [(2, True), (3, False)]), str(3*N))
check('only applied', solve(N, [(5, True)]), str(N))
check('only pending', solve(N, [(5, False)]), str(5*N))
check('serial pending', solve(N, [(2, False), (3, False)]), str(6*N))
check('no history', solve(N, []), str(N))
check('zero concentration', solve(0, [(2, True), (3, False)]), '0')
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
from fractions import Fraction
import math
N = 1
observations = []
def solve(value, steps):
    return str(Fraction(value) if any(applied for f, applied in steps) else Fraction(value) * math.prod(f for f, applied in steps))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mixed instrument and manual steps', solve(N, [(2, True), (3, False)]), str(3*N))
check('only applied', solve(N, [(5, True)]), str(N))
check('only pending', solve(N, [(5, False)]), str(5*N))
check('serial pending', solve(N, [(2, False), (3, False)]), str(6*N))
check('no history', solve(N, []), str(N))
check('zero concentration', solve(0, [(2, True), (3, False)]), '0')
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:
Already-applied dilution steps are multiplied again.

Return the Fraction string for value multiplied by each positive integer factor whose applied flag is false. Empty history preserves value.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(signal, blank, dilution):
    return str(Fraction(signal)*dilution-Fraction(blank))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('blank scales with aliquot', solve(str(5*N), str(N), 3), str(12*N))
check('negative blank correction retained', solve(str(N), str(2*N), 4), str(-4*N))
check('blank equality', solve(str(N), str(N), 5), '0')
check('undiluted sample', solve(str(3*N), str(N), 1), str(2*N))
check('zero blank', solve(str(N), '0', 3), str(3*N))
check('fractional blank', solve('1', '1/2', 3), '3/2')
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(signal, blank, dilution):
    return str(max(Fraction(0), Fraction(signal)-Fraction(blank))*dilution)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('blank scales with aliquot', solve(str(5*N), str(N), 3), str(12*N))
check('negative blank correction retained', solve(str(N), str(2*N), 4), str(-4*N))
check('blank equality', solve(str(N), str(N), 5), '0')
check('undiluted sample', solve(str(3*N), str(N), 1), str(2*N))
check('zero blank', solve(str(N), '0', 3), str(3*N))
check('fractional blank', solve('1', '1/2', 3), '3/2')
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Aliquot blank is subtracted after dilution correction.

Return signed (signal - aliquot_blank) * dilution as a Fraction string. Signals are rational strings and dilution is positive. Negative results remain reportable in this model.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(kind, value, limit, dilution):
    return [kind, limit if kind == "LT" else value*dilution]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('diluted nondetect', solve('LT', 0, N, 4), ['LT',4*N])
check('quantified result', solve('EQ', 7*N, N, 4), ['EQ',28*N])
check('undiluted nondetect', solve('LT', 0, N, 1), ['LT',N])
check('zero quantified result', solve('EQ', 0, N, 2), ['EQ',0])
check('placeholder ignored', solve('LT', 999, N, 2), ['LT',2*N])
check('value at limit stays quantified', solve('EQ', N, N, 3), ['EQ',3*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

N = 1
observations = []
def solve(kind, value, limit, dilution):
    return [kind, limit*dilution]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('diluted nondetect', solve('LT', 0, N, 4), ['LT',4*N])
check('quantified result', solve('EQ', 7*N, N, 4), ['EQ',28*N])
check('undiluted nondetect', solve('LT', 0, N, 1), ['LT',N])
check('zero quantified result', solve('EQ', 0, N, 2), ['EQ',0])
check('placeholder ignored', solve('LT', 999, N, 2), ['LT',2*N])
check('value at limit stays quantified', solve('EQ', N, N, 3), ['EQ',3*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:
Diluted censored reports retain an aliquot detection limit.

For kind LT return [LT, limit*dilution]; for EQ return [EQ, value*dilution]. Numeric fields are integers, dilution positive, and LT ignores value.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(records, lot, matrix):
    return next((s for l,m,s in records if l == lot), None)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
r = [('A','water',N),('A','soil',N+2),('B','soil',N+4)]
check('same lot different matrix', solve(r,'A','soil'), N+2)
check('same matrix different lot', solve(r,'B','soil'), N+4)
check('missing pair', solve(r,'B','water'), None)
check('first exact pair', solve(r,'A','water'), N)
check('unknown lot', solve(r,'C','soil'), None)
check('empty calibration table', solve([], 'A','water'), 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

N = 1
observations = []
def solve(records, lot, matrix):
    return next((s for l,m,s in records if m == matrix), None)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
r = [('A','water',N),('A','soil',N+2),('B','soil',N+4)]
check('same lot different matrix', solve(r,'A','soil'), N+2)
check('same matrix different lot', solve(r,'B','soil'), N+4)
check('missing pair', solve(r,'B','water'), None)
check('first exact pair', solve(r,'A','water'), N)
check('unknown lot', solve(r,'C','soil'), None)
check('empty calibration table', solve([], 'A','water'), 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:
Calibration lookup borrows coefficients from another matrix.

Given unique [lot,matrix,slope] records, return the slope for an exact pair or None. No fallback between lots or matrices.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(knots, signal):
    if signal < knots[0][1] or signal > knots[-1][1]:
        return None
    for (x0,y0),(x1,y1) in zip(knots,knots[1:]):
        if signal <= x1:
            return str(Fraction(x0)+Fraction((signal-y0)*(x1-x0),y1-y0))
    return str(knots[-1][0])
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
k=[(0,0),(2*N,4*N),(4*N,12*N)]
check('second segment midpoint', solve(k,8*N), str(3*N))
check('first segment midpoint', solve(k,2*N), str(N))
check('interior knot', solve(k,4*N), str(2*N))
check('upper endpoint', solve(k,12*N), str(4*N))
check('lower endpoint', solve(k,0), '0')
check('below calibration rejected', solve(k,-1), None)
check('above calibration rejected', solve(k,12*N+1), 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
from fractions import Fraction
N = 1
observations = []
def solve(knots, signal):
    if signal < knots[0][1] or signal > knots[-1][1]:
        return None
    (x0,y0),(x1,y1) = knots[:2]
    return str(Fraction(x0)+Fraction((signal-y0)*(x1-x0),y1-y0))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
k=[(0,0),(2*N,4*N),(4*N,12*N)]
check('second segment midpoint', solve(k,8*N), str(3*N))
check('first segment midpoint', solve(k,2*N), str(N))
check('interior knot', solve(k,4*N), str(2*N))
check('upper endpoint', solve(k,12*N), str(4*N))
check('lower endpoint', solve(k,0), '0')
check('below calibration rejected', solve(k,-1), None)
check('above calibration rejected', solve(k,12*N+1), 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:
Piecewise inverse calibration chooses segments by concentration.

Knots are strictly increasing concentration and signal integer pairs. Return exact Fraction concentration for an in-range signal; otherwise None. At least two knots.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(replicates):
    return str(Fraction(sum(v for v, ok in replicates),len(replicates))) if replicates else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rejected replicate excluded', solve([(N,True),(9*N,False)]), str(N))
check('accepted zero retained', solve([(0,True),(2*N,True)]), str(N))
check('all rejected', solve([(N,False)]), None)
check('only zero accepted', solve([(0,True)]), '0')
check('empty replicate set', solve([]), None)
check('signed accepted replicates', solve([(-N,True),(N,True),(8*N,False)]), '0')
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
from fractions import Fraction
N = 1
observations = []
def solve(replicates):
    values=[v for v,ok in replicates if ok and v]
    return str(Fraction(sum(values),len(values))) if values else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rejected replicate excluded', solve([(N,True),(9*N,False)]), str(N))
check('accepted zero retained', solve([(0,True),(2*N,True)]), str(N))
check('all rejected', solve([(N,False)]), None)
check('only zero accepted', solve([(0,True)]), '0')
check('empty replicate set', solve([]), None)
check('signed accepted replicates', solve([(-N,True),(N,True),(8*N,False)]), '0')
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:
Rejected replicate values enter a report average.

Return exact Fraction mean of [integer value, accepted boolean] replicates that are accepted, or None if none qualify.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(measured, baseline, sample_volume, spike_volume, spike_concentration):
    return str(Fraction(100*(measured-baseline),spike_concentration))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('complete recovery with added volume', solve(4*N,2*N,2,2,6*N), '100')
check('different spike volume', solve(4*N,2*N,3,3,6*N), '100')
check('half recovery', solve(3*N,2*N,2,2,8*N), '50')
check('zero recovered amount', solve(N,2*N,2,2,6*N), '0')
check('unit spike volume', solve(4*N,2*N,1,1,6*N), '100')
check('negative recovery retained', solve(0,2*N,2,2,4*N), '-50')
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
from fractions import Fraction
N = 1
observations = []
def solve(measured, baseline, sample_volume, spike_volume, spike_concentration):
    return str(Fraction(100*(measured*(sample_volume+spike_volume)-baseline*sample_volume),spike_concentration))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('complete recovery with added volume', solve(4*N,2*N,2,2,6*N), '100')
check('different spike volume', solve(4*N,2*N,3,3,6*N), '100')
check('half recovery', solve(3*N,2*N,2,2,8*N), '50')
check('zero recovered amount', solve(N,2*N,2,2,6*N), '0')
check('unit spike volume', solve(4*N,2*N,1,1,6*N), '100')
check('negative recovery retained', solve(0,2*N,2,2,4*N), '-50')
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:
Spike recovery subtracts an undiluted baseline from a diluted sample.

Return exact percent recovery: 100*(measured*(sample_volume+spike_volume)-baseline*sample_volume)/(spike_concentration*spike_volume). Positive volumes and spike concentration; all values integers.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(injections):
    previous=0
    out=[]
    for kind,raw in injections:
        if kind == 'sample':
            out.append(str(Fraction(raw)-Fraction(previous,10)))
            previous=raw
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('wash residual becomes predecessor', solve([('sample',100*N),('wash',10*N),('sample',20*N)]), [str(100*N),str(19*N)])
check('wash first', solve([('wash',10*N),('sample',20*N)]), [str(19*N)])
check('consecutive samples', solve([('sample',10*N),('sample',20*N)]), [str(10*N),str(19*N)])
check('last of multiple washes', solve([('wash',100*N),('wash',10*N),('sample',20*N)]), [str(19*N)])
check('only wash emits no report', solve([('wash',10*N)]), [])
check('empty run', solve([]), [])
check('first sample uncorrected', solve([('sample',N)]), [str(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
from fractions import Fraction
N = 1
observations = []
def solve(injections):
    previous=0
    out=[]
    for kind,raw in injections:
        if kind == 'sample':
            out.append(str(Fraction(raw)-Fraction(previous,10)))
            previous=raw
        else:
            previous=0
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('wash residual becomes predecessor', solve([('sample',100*N),('wash',10*N),('sample',20*N)]), [str(100*N),str(19*N)])
check('wash first', solve([('wash',10*N),('sample',20*N)]), [str(19*N)])
check('consecutive samples', solve([('sample',10*N),('sample',20*N)]), [str(10*N),str(19*N)])
check('last of multiple washes', solve([('wash',100*N),('wash',10*N),('sample',20*N)]), [str(19*N)])
check('only wash emits no report', solve([('wash',10*N)]), [])
check('empty run', solve([]), [])
check('first sample uncorrected', solve([('sample',N)]), [str(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:
Carryover correction skips an intervening wash injection.

For chronological [kind,raw] injections, subtract one tenth of the preceding raw injection from sample signals. First predecessor is zero. Washes emit nothing but update predecessor. Return Fraction strings; kinds sample or wash.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from decimal import Decimal, ROUND_HALF_UP
N = 1
observations = []
def solve(value, limit):
    v=Decimal(value)
    display=v.quantize(Decimal('0.1'),rounding=ROUND_HALF_UP)
    return ['Q' if display >= Decimal(limit) else 'BELOW',str(display)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rounds up to limit but remains below', solve(f'{N}.96',str(N+1)), ['BELOW',f'{N+1}.0'])
check('exact limit qualifies', solve(str(N),str(N)), ['Q',f'{N}.0'])
check('above limit qualifies', solve(f'{N}.04',str(N)), ['Q',f'{N}.0'])
check('well below limit', solve('0.1',str(N)), ['BELOW','0.1'])
check('zero at zero threshold', solve('0','0'), ['Q','0.0'])
check('rounding tie formatting', solve(f'{N}.05',str(N)), ['Q',f'{N}.1'])
check('supported upper value boundary', solve('1000000000000','1000000000000'), ['Q','1000000000000.0'])
check('six-place rounding across upper display boundary', solve('999999999999.999999','1000000000000'), ['BELOW','1000000000000.0'])
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
from decimal import Decimal, ROUND_HALF_UP
N = 1
observations = []
def solve(value, limit):
    v=Decimal(value)
    display=v.quantize(Decimal('0.1'),rounding=ROUND_HALF_UP)
    return ['Q' if v > Decimal(limit) else 'BELOW',str(display)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rounds up to limit but remains below', solve(f'{N}.96',str(N+1)), ['BELOW',f'{N+1}.0'])
check('exact limit qualifies', solve(str(N),str(N)), ['Q',f'{N}.0'])
check('above limit qualifies', solve(f'{N}.04',str(N)), ['Q',f'{N}.0'])
check('well below limit', solve('0.1',str(N)), ['BELOW','0.1'])
check('zero at zero threshold', solve('0','0'), ['Q','0.0'])
check('rounding tie formatting', solve(f'{N}.05',str(N)), ['Q',f'{N}.1'])
check('supported upper value boundary', solve('1000000000000','1000000000000'), ['Q','1000000000000.0'])
check('six-place rounding across upper display boundary', solve('999999999999.999999','1000000000000'), ['BELOW','1000000000000.0'])
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:
Rounding moves an unquantifiable result above the reporting threshold.

Return [Q or BELOW, value rounded to one decimal using ROUND_HALF_UP]. Q means exact value >= limit. Inputs are ordinary unsigned base-ten decimal strings without exponent notation, at most six fractional digits, and numeric values from zero through 1000000000000 inclusive. Inputs outside this bounded synthetic model are not supported.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(value, upper, dilution, saturated, invalid):
    return ['INVALID',None] if invalid else ['EQ',value*dilution]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('saturation reports bound', solve(999,10*N,2,True,False), ['GT',20*N])
check('invalid saturation is unusable', solve(999,10*N,2,True,True), ['INVALID',None])
check('ordinary valid value', solve(N,10*N,3,False,False), ['EQ',3*N])
check('ordinary invalid acquisition', solve(N,10*N,3,False,True), ['INVALID',None])
check('zero value valid', solve(0,10*N,1,False,False), ['EQ',0])
check('undiluted saturation', solve(0,10*N,1,True,False), ['GT',10*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

N = 1
observations = []
def solve(value, upper, dilution, saturated, invalid):
    if saturated:
        return ['GT',upper*dilution]
    return ['INVALID',None] if invalid else ['EQ',value*dilution]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('saturation reports bound', solve(999,10*N,2,True,False), ['GT',20*N])
check('invalid saturation is unusable', solve(999,10*N,2,True,True), ['INVALID',None])
check('ordinary valid value', solve(N,10*N,3,False,False), ['EQ',3*N])
check('ordinary invalid acquisition', solve(N,10*N,3,False,True), ['INVALID',None])
check('zero value valid', solve(0,10*N,1,False,False), ['EQ',0])
check('undiluted saturation', solve(0,10*N,1,True,False), ['GT',10*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:
Saturated instrument output is published as a precise value.

Return [INVALID,None] if invalid flag true; otherwise [GT, upper*dilution] if saturated; otherwise [EQ,value*dilution]. All numeric inputs integers, dilution positive.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(element, isotope):
    return [element, None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('varying isotope', solve('C', 12+N), ['C',12+N])
check('unspecified', solve('C', None), ['C',None])
check('zero sentinel', solve('X', 0), ['X',0])
check('hydrogen isotope', solve('H', 2), ['H',2])
check('different element', solve('N', 15), ['N',15])
check('large label', solve('X', 100+N), ['X',100+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

N = 1
observations = []
def solve(element, isotope):
    return [element, isotope or None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('varying isotope', solve('C', 12+N), ['C',12+N])
check('unspecified', solve('C', None), ['C',None])
check('zero sentinel', solve('X', 0), ['X',0])
check('hydrogen isotope', solve('H', 2), ['H',2])
check('different element', solve('N', 15), ['N',15])
check('large label', solve('X', 100+N), ['X',100+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:
Explicit isotope labels disappear from atom keys.

Return [element, isotope] exactly; None means unspecified and integer zero means an explicit model sentinel.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(atom, bonds):
    return sum(atom in b[:2] for b in bonds)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('double', solve(N, [[N,N+1,2]]), 2)
check('triple', solve(N, [[N,N+1,3]]), 3)
check('single', solve(N, [[N,N+1,1]]), 1)
check('isolated', solve(N, []), 0)
check('mixed', solve(N, [[N,N+1,3],[N+2,N,1]]), 4)
check('unrelated', solve(N, [[N+1,N+2,2]]), 0)
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

N = 1
observations = []
def solve(atom, bonds):
    return sum(min(order,2) for a,b,order in bonds if atom in (a,b))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('double', solve(N, [[N,N+1,2]]), 2)
check('triple', solve(N, [[N,N+1,3]]), 3)
check('single', solve(N, [[N,N+1,1]]), 1)
check('isolated', solve(N, []), 0)
check('mixed', solve(N, [[N,N+1,3],[N+2,N,1]]), 4)
check('unrelated', solve(N, [[N+1,N+2,2]]), 0)
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:
Neighbor count replaces encoded bond order.

For an atom ID, sum integer orders 1..3 of incident undirected bonds [a,b,order]; unique endpoints and no self bonds. This is an order sum, not inferred valence.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(kind, a, b):
    return [kind,min(a,b),max(a,b)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reverse dative', solve('dative', N+2,N), ['dative',N+2,N])
check('forward dative', solve('dative',N,N+2), ['dative',N,N+2])
check('reverse covalent', solve('covalent',N+2,N), ['covalent',N,N+2])
check('forward covalent', solve('covalent',N,N+2), ['covalent',N,N+2])
check('zero donor', solve('dative',0,N), ['dative',0,N])
check('zero covalent endpoint', solve('covalent',N,0), ['covalent',0,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

N = 1
observations = []
def solve(kind, a, b):
    return [kind,a,b]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reverse dative', solve('dative', N+2,N), ['dative',N+2,N])
check('forward dative', solve('dative',N,N+2), ['dative',N,N+2])
check('reverse covalent', solve('covalent',N+2,N), ['covalent',N,N+2])
check('forward covalent', solve('covalent',N,N+2), ['covalent',N,N+2])
check('zero donor', solve('dative',0,N), ['dative',0,N])
check('zero covalent endpoint', solve('covalent',N,0), ['covalent',0,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:
Dative donor and acceptor swap during canonicalization.

Return [kind,a,b]; kind dative preserves donor a and acceptor b, kind covalent sorts numeric endpoint IDs.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(old, new, sign):
    return sign
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('one swap', solve([N,N+1,N+2,N+3],[N+1,N,N+2,N+3],1), -1)
check('three cycle', solve([N,N+1,N+2,N+3],[N+1,N+2,N,N+3],1), 1)
check('identity', solve([N,N+1,N+2,N+3],[N,N+1,N+2,N+3],-1), -1)
check('double swap', solve([N,N+1,N+2,N+3],[N+1,N,N+3,N+2],-1), -1)
check('four cycle', solve([N,N+1,N+2,N+3],[N+1,N+2,N+3,N],1), -1)
check('reverse order', solve([N,N+1,N+2,N+3],[N+3,N+2,N+1,N],1), 1)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(old, new, sign):
    return -sign if old != new else sign
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('one swap', solve([N,N+1,N+2,N+3],[N+1,N,N+2,N+3],1), -1)
check('three cycle', solve([N,N+1,N+2,N+3],[N+1,N+2,N,N+3],1), 1)
check('identity', solve([N,N+1,N+2,N+3],[N,N+1,N+2,N+3],-1), -1)
check('double swap', solve([N,N+1,N+2,N+3],[N+1,N,N+3,N+2],-1), -1)
check('four cycle', solve([N,N+1,N+2,N+3],[N+1,N+2,N+3,N],1), -1)
check('reverse order', solve([N,N+1,N+2,N+3],[N+3,N+2,N+1,N],1), 1)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Ligand reordering silently flips stored orientation.

Four distinct ligand IDs define a local orientation sign +/-1. Return sign multiplied by permutation parity when old ligand order is changed to new order containing the same IDs.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(left, right, bond, atom_id):
    return left and right
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('bridge between annotated atoms', solve(True,True,False,N), False)
check('explicit partial annotation', solve(True,False,True,N), True)
check('neither atom annotated', solve(False,False,True,N), True)
check('consistent aromatic', solve(True,True,bool(N % 2),N), bool(N % 2))
check('plain bond', solve(False,False,bool(N % 2),N), bool(N % 2))
check('single annotated atom', solve(False,True,False,N), False)
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

N = 1
observations = []
def solve(left, right, bond, atom_id):
    return bond and left and right
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('bridge between annotated atoms', solve(True,True,False,N), False)
check('explicit partial annotation', solve(True,False,True,N), True)
check('neither atom annotated', solve(False,False,True,N), True)
check('consistent aromatic', solve(True,True,bool(N % 2),N), bool(N % 2))
check('plain bond', solve(False,False,bool(N % 2),N), bool(N % 2))
check('single annotated atom', solve(False,True,False,N), False)
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:
Aromatic bond tags are inferred from atom flags.

Return the explicit bond aromatic boolean unchanged. Atom aromatic flags are independent annotations and are never used to infer or override it.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(neighbors, total):
    return neighbors.count("H") + (total or 0)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mixed explicit implicit', solve(['H','C'], N+1), N+1)
check('all explicit', solve(['H','H'], 2), 2)
check('none materialized', solve(['C'], N), N)
check('no annotation', solve(['H','C'], None), 1)
check('zero total', solve([], 0), 0)
check('empty unknown', solve([], None), 0)
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

N = 1
observations = []
def solve(neighbors, total):
    return neighbors.count("H")
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mixed explicit implicit', solve(['H','C'], N+1), N+1)
check('all explicit', solve(['H','H'], 2), 2)
check('none materialized', solve(['C'], N), N)
check('no annotation', solve(['H','C'], None), 1)
check('zero total', solve([], 0), 0)
check('empty unknown', solve([], None), 0)
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:
Materialized hydrogens are counted twice.

Annotation total is either None or total attached hydrogen count including materialized H neighbors. Return total if present, otherwise explicit neighbor H count; counts are nonnegative and present totals are at least explicit count.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(atom):
    return [atom["element"],atom["isotope"],atom["charge"],atom["map"]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mapped ion', solve(dict(element='N',isotope=None,charge=1,map=N)), ['N',None,1])
check('isotope', solve(dict(element='C',isotope=12+N,charge=0,map=0)), ['C',12+N,0])
check('neutral', solve(dict(element='C',isotope=None,charge=0,map=N)), ['C',None,0])
check('negative', solve(dict(element='O',isotope=None,charge=-1,map=N)), ['O',None,-1])
check('unmapped', solve(dict(element='H',isotope=2,charge=0,map=None)), ['H',2,0])
check('both fields', solve(dict(element='X',isotope=N,charge=-2,map=N+9)), ['X',N,-2])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(atom):
    return [atom["element"],None,0]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mapped ion', solve(dict(element='N',isotope=None,charge=1,map=N)), ['N',None,1])
check('isotope', solve(dict(element='C',isotope=12+N,charge=0,map=0)), ['C',12+N,0])
check('neutral', solve(dict(element='C',isotope=None,charge=0,map=N)), ['C',None,0])
check('negative', solve(dict(element='O',isotope=None,charge=-1,map=N)), ['O',None,-1])
check('unmapped', solve(dict(element='H',isotope=2,charge=0,map=None)), ['H',2,0])
check('both fields', solve(dict(element='X',isotope=N,charge=-2,map=N+9)), ['X',N,-2])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Reaction atom map labels contaminate structural keys.

Return [element,isotope,charge] from an atom record; map is a reaction correspondence label and is excluded. Isotope and formal charge remain exact.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(a, b, left, right):
    return [min(a,b),max(a,b),left,right]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reverse anchors', solve(N+1,N,30+N,40+N), [N,N+1,40+N,30+N])
check('forward anchors', solve(N,N+1,30+N,40+N), [N,N+1,30+N,40+N])
check('implicit left', solve(N+1,N,None,40+N), [N,N+1,40+N,None])
check('implicit right', solve(N,N+1,30+N,None), [N,N+1,30+N,None])
check('both implicit', solve(N+1,N,None,None), [N,N+1,None,None])
check('zero ligand ID', solve(N,N+1,0,40+N), [N,N+1,0,40+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

N = 1
observations = []
def solve(a, b, left, right):
    return [min(a,b),max(a,b),right,left]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reverse anchors', solve(N+1,N,30+N,40+N), [N,N+1,40+N,30+N])
check('forward anchors', solve(N,N+1,30+N,40+N), [N,N+1,30+N,40+N])
check('implicit left', solve(N+1,N,None,40+N), [N,N+1,40+N,None])
check('implicit right', solve(N,N+1,30+N,None), [N,N+1,30+N,None])
check('both implicit', solve(N+1,N,None,None), [N,N+1,None,None])
check('zero ligand ID', solve(N,N+1,0,40+N), [N,N+1,0,40+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:
Bond reversal leaves endpoint-specific stereo ligands attached to wrong atoms.

A double bond record [a,b,left_ligand,right_ligand] uses endpoint-relative ligand anchors. Canonicalize a<=b, swapping ligand anchor slots if and only if endpoints reverse.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(fragments):
    return [sum(sum(f) for f in fragments)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('salt fragments', solve([[N],[-N]]), [N,-N])
check('single anion', solve([[-N]]), [-N])
check('neutral fragment', solve([[1,-1]]), [0])
check('empty collection', solve([]), [])
check('empty fragment', solve([[],[-1]]), [0,-1])
check('multiple charged atoms', solve([[N,1],[-1,-N],[0]]), [N+1,-N-1,0])
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

N = 1
observations = []
def solve(fragments):
    return [abs(sum(f)) for f in fragments]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('salt fragments', solve([[N],[-N]]), [N,-N])
check('single anion', solve([[-N]]), [-N])
check('neutral fragment', solve([[1,-1]]), [0])
check('empty collection', solve([]), [])
check('empty fragment', solve([[],[-1]]), [0,-1])
check('multiple charged atoms', solve([[N,1],[-1,-N],[0]]), [N+1,-N-1,0])
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:
Disconnected fragment charges are collapsed into a neutral flag.

Input is an ordered list of molecular fragments, each a list of signed atom formal charges. Return per-fragment signed sums preserving order and empty fragments as zero.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(element, charge, query_element, query_charge):
    return (query_element == "*" or element == query_element) and charge == (query_charge or 0)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('wildcard charge', solve('N',N,'N',None), True)
check('explicit neutral rejects ion', solve('N',N,'N',0), False)
check('neutral matches', solve('N',0,'N',0), True)
check('element mismatch', solve('O',0,'N',None), False)
check('wildcard element exact charge', solve('O',-N,'*',-N), True)
check('wrong signed charge', solve('O',N,'*',-N), False)
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

N = 1
observations = []
def solve(element, charge, query_element, query_charge):
    return (query_element == "*" or element == query_element) and (not query_charge or charge == query_charge)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('wildcard charge', solve('N',N,'N',None), True)
check('explicit neutral rejects ion', solve('N',N,'N',0), False)
check('neutral matches', solve('N',0,'N',0), True)
check('element mismatch', solve('O',0,'N',None), False)
check('wildcard element exact charge', solve('O',-N,'*',-N), True)
check('wrong signed charge', solve('O',N,'*',-N), False)
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:
An unspecified query charge becomes a neutral-only constraint.

Query has element string or * wildcard and charge integer or None wildcard. Match target element and charge conjunctively, with only None disabling charge constraint.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(s):
    return [i for i,c in enumerate(s.upper()) if c in 'acgt']
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('variable prefix', solve('A'*N+'acNnT'), [N,N+1])
check('unknown', solve('nn'), [])
check('uppercase', solve('ACGT'), [])
check('lowercase', solve('acgt'), [0,1,2,3])
check('empty', solve(''), [])
check('interleaved', solve('aNcGt'), [0,2,4])
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

N = 1
observations = []
def solve(s):
    return [i for i,c in enumerate(s) if c.islower()]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('variable prefix', solve('A'*N+'acNnT'), [N,N+1])
check('unknown', solve('nn'), [])
check('uppercase', solve('ACGT'), [])
check('lowercase', solve('acgt'), [0,1,2,3])
check('empty', solve(''), [])
check('interleaved', solve('aNcGt'), [0,2,4])
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:
Case normalization destroys soft-mask positions.

Return zero-based indices of lowercase a,c,g,t only; lowercase n is unknown, not a masked canonical base.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(a,b):
    return a==b
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('variable ambiguity', solve('R'*N,'A'*N), True)
check('incompatible', solve('R','C'), False)
check('unknown possible', solve('N','T'), True)
check('empty', solve('',''), True)
check('length', solve('A','AA'), False)
check('late mismatch', solve('NA','TC'), False)
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

N = 1
observations = []
def solve(a,b):
    m={'A':set('A'),'C':set('C'),'G':set('G'),'T':set('T'),'R':set('AG'),'N':set('ACGT')}
    return len(a)==len(b) and all(m[x]<=m[y] for x,y in zip(a,b))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('variable ambiguity', solve('R'*N,'A'*N), True)
check('incompatible', solve('R','C'), False)
check('unknown possible', solve('N','T'), True)
check('empty', solve('',''), True)
check('length', solve('A','AA'), False)
check('late mismatch', solve('NA','TC'), False)
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:
Ambiguous sequence symbols are compared as literal letters.

For equal-length strings over A,C,G,T,R,N, return whether every aligned pair has intersecting sets; R={A,G}, N={A,C,G,T}. Unequal lengths are false.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(s):
    return s[::-1]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('variable', solve('A'*N+'R'), 'Y'+'T'*N)
check('gap', solve('A-C'), 'G-T')
check('unknown', solve('N'), 'N')
check('empty', solve(''), '')
check('paired', solve('RY'), 'RY')
check('asymmetric', solve('YCA'), 'TGR')
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

N = 1
observations = []
def solve(s):
    return s[::-1].translate(str.maketrans('ACGT','TGCA'))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('variable', solve('A'*N+'R'), 'Y'+'T'*N)
check('gap', solve('A-C'), 'G-T')
check('unknown', solve('N'), 'N')
check('empty', solve(''), '')
check('paired', solve('RY'), 'RY')
check('asymmetric', solve('YCA'), 'TGR')
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:
Reverse complement leaves ambiguity symbols untranslated.

Reverse the string then substitute A:T,T:A,C:G,G:C,R:Y,Y:R,N:N,-:-. Inputs use only this explicit uppercase alphabet.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(records,k):
    s=''.join(records)
    return [s[i:i+k] for i in range(len(s)-k+1)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('variable records', solve(['A'*N,'C'],2), ['AA']*max(0,N-1))
check('empty collection', solve([],2), [])
check('short records', solve(['A','T'],2), [])
check('exact', solve(['AC','GT'],2), ['AC','GT'])
check('unit', solve(['A','','C'],1), ['A','C'])
check('overlap', solve(['ACG'],2), ['AC','CG'])
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

N = 1
observations = []
def solve(records,k):
    s='N'.join(records)
    return [s[i:i+k] for i in range(len(s)-k+1)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('variable records', solve(['A'*N,'C'],2), ['AA']*max(0,N-1))
check('empty collection', solve([],2), [])
check('short records', solve(['A','T'],2), [])
check('exact', solve(['AC','GT'],2), ['AC','GT'])
check('unit', solve(['A','','C'],1), ['A','C'])
check('overlap', solve(['ACG'],2), ['AC','CG'])
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:
K-mer windows span independent sequence records.

Return all length-k windows in record order, then position order, independently per record; k is positive and records contain ACGT only.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(s):
    return min(s,s[::-1])
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('variable', solve('T'*N+'G'), 'C'+'A'*N)
check('single', solve('T'), 'A')
check('palindrome', solve('AT'), 'AT')
check('empty', solve(''), '')
check('complement reverse', solve('GT'), 'AC')
check('already canonical', solve('AAC'), 'AAC')
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

N = 1
observations = []
def solve(s):
    return min(s,s.translate(str.maketrans('ACGT','TGCA')))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('variable', solve('T'*N+'G'), 'C'+'A'*N)
check('single', solve('T'), 'A')
check('palindrome', solve('AT'), 'AT')
check('empty', solve(''), '')
check('complement reverse', solve('GT'), 'AC')
check('already canonical', solve('AAC'), 'AAC')
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:
Strand canonicalization compares a word with its reversal.

Return lexicographic minimum of an ACGT string and its reverse-complement using A:T,C:G. Empty maps to empty.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(a,b):
    a=a.replace('-',''); b=b.replace('-','')
    p=list(zip(a,b))
    return [sum(x==y for x,y in p),len(p)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('variable displaced', solve('A-'*N,'-A'*N), [0,0])
check('match', solve('AC','AC'), [2,2])
check('mismatch', solve('AC','AG'), [1,2])
check('all gaps', solve('--','--'), [0,0])
check('empty', solve('',''), [0,0])
check('mixed', solve('A-CG','AT-G'), [2,2])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(a,b):
    p=[(x,y) for x,y in zip(a,b) if x!='-' or y!='-']
    return [sum(x==y for x,y in p),len(p)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('variable displaced', solve('A-'*N,'-A'*N), [0,0])
check('match', solve('AC','AC'), [2,2])
check('mismatch', solve('AC','AG'), [1,2])
check('all gaps', solve('--','--'), [0,0])
check('empty', solve('',''), [0,0])
check('mixed', solve('A-CG','AT-G'), [2,2])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Removing alignment gaps independently pairs different columns.

For equal-length aligned ACGT- strings, return [matches,compared] considering only columns where neither symbol is a gap.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(s,q,cut):
    return [''.join(c for c,v in zip(s,q) if v>=cut),q]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('variable threshold', solve('ACT',[N-1,N,N+1],N), ['CT',[N,N+1]])
check('empty', solve('',[],2), ['',[]])
check('all removed', solve('AC',[0,1],2), ['',[]])
check('all retained', solve('AC',[2,3],2), ['AC',[2,3]])
check('equality', solve('T',[0],0), ['T',[0]])
check('internal hole', solve('ACT',[5,0,4],3), ['AT',[5,4]])
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

N = 1
observations = []
def solve(s,q,cut):
    return [''.join(c for c,v in zip(s,q) if v>=cut),[v for v in q if v>cut]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('variable threshold', solve('ACT',[N-1,N,N+1],N), ['CT',[N,N+1]])
check('empty', solve('',[],2), ['',[]])
check('all removed', solve('AC',[0,1],2), ['',[]])
check('all retained', solve('AC',[2,3],2), ['AC',[2,3]])
check('equality', solve('T',[0],0), ['T',[0]])
check('internal hole', solve('ACT',[5,0,4],3), ['AT',[5,4]])
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:
Quality filtering separates scores from surviving bases.

Given sequence and same-length integer qualities, return [retained_string,retained_qualities] preserving pairs whose quality is >= cutoff.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(s,k):
    return [s[i:i+k] for i in range(len(s)-k+1)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('variable circle', solve('A'*N+'C',2), ['AA']*(N-1)+['AC','CA'])
check('empty', solve('',1), [])
check('singleton', solve('G',1), ['G'])
check('whole circle', solve('ACG',3), ['ACG','CGA','GAC'])
check('unit', solve('AC',1), ['A','C'])
check('repeated', solve('AA',2), ['AA','AA'])
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

N = 1
observations = []
def solve(s,k):
    t=s+s
    return [t[i:i+k] for i in range(len(t)-k+1)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('variable circle', solve('A'*N+'C',2), ['AA']*(N-1)+['AC','CA'])
check('empty', solve('',1), [])
check('singleton', solve('G',1), ['G'])
check('whole circle', solve('ACG',3), ['ACG','CGA','GAC'])
check('unit', solve('AC',1), ['A','C'])
check('repeated', solve('AA',2), ['AA','AA'])
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:
Circular sequence windows miss the origin-spanning start.

For nonempty ACGT string and 1<=k<=length, return exactly length windows of size k wrapping around origin, in start-index order. Empty returns [].

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(s,kind):
    return s.upper().replace('U','T')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('variable mixed DNA', solve('a'*N+'u','DNA'), None)
check('RNA U', solve('acu','RNA'), 'ACU')
check('RNA T rejected', solve('ACT','RNA'), None)
check('DNA valid', solve('actn','DNA'), 'ACTN')
check('empty', solve('','DNA'), '')
check('invalid', solve('AX','RNA'), 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

N = 1
observations = []
def solve(s,kind):
    return s.upper()
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('variable mixed DNA', solve('a'*N+'u','DNA'), None)
check('RNA U', solve('acu','RNA'), 'ACU')
check('RNA T rejected', solve('ACT','RNA'), None)
check('DNA valid', solve('actn','DNA'), 'ACTN')
check('empty', solve('','DNA'), '')
check('invalid', solve('AX','RNA'), 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:
DNA and RNA normalization silently changes molecule type.

Return uppercase input if every symbol belongs to ACGTN for type DNA or ACGUN for type RNA; otherwise None. Type is DNA or RNA. No cross-type conversion.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(s,k):
    s=s.replace('N','')
    return [s[i:i+k] for i in range(len(s)-k+1)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('variable barrier', solve('A'*N+'NC',2), ['AA']*max(0,N-1))
check('unknown only', solve('NN',1), [])
check('empty', solve('',2), [])
check('too short', solve('A',2), [])
check('valid duplicate', solve('AAA',2), ['AA','AA'])
check('ends', solve('NACN',2), ['AC'])
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

N = 1
observations = []
def solve(s,k):
    s=s.replace('N','A')
    return [s[i:i+k] for i in range(len(s)-k+1)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('variable barrier', solve('A'*N+'NC',2), ['AA']*max(0,N-1))
check('unknown only', solve('NN',1), [])
check('empty', solve('',2), [])
check('too short', solve('A',2), [])
check('valid duplicate', solve('AAA',2), ['AA','AA'])
check('ends', solve('NACN',2), ['AC'])
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:
Unknown bases are deleted before k-mer extraction.

For uppercase ACGTN input, return length-k contiguous windows containing no N, preserving repeats and order; k positive. N breaks eligibility without removing positions.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(exons, strand, offset):
    for a,b in sorted(exons):
     if 0 <= offset < b-a: return a+offset
     offset -= b-a
    return None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
e=[(10*N,10*N+2),(10*N+10,10*N+13)]
check('minus first',solve(e,'-',0),10*N+12)
check('minus junction',solve(e,'-',3),10*N+1)
check('minus last',solve(e,'-',4),10*N)
check('plus first',solve(e,'+',0),10*N)
check('plus junction',solve(e,'+',2),10*N+10)
check('past end',solve(e,'-',5),None)
check('negative',solve(e,'+',-1),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

N = 1
observations = []
def solve(exons, strand, offset):
    for a,b in sorted(exons):
     if 0 <= offset < b-a: return a+offset if strand=='+' else b-1-offset
     offset -= b-a
    return None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
e=[(10*N,10*N+2),(10*N+10,10*N+13)]
check('minus first',solve(e,'-',0),10*N+12)
check('minus junction',solve(e,'-',3),10*N+1)
check('minus last',solve(e,'-',4),10*N)
check('plus first',solve(e,'+',0),10*N)
check('plus junction',solve(e,'+',2),10*N+10)
check('past end',solve(e,'-',5),None)
check('negative',solve(e,'+',-1),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:
Negative-strand transcript offsets visit exons in reference order.

Map zero-based transcript offset across disjoint half-open exons to a reference base; return None outside transcript.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(lead, aligned, trail, start, reverse, pos):
    q=pos-lead
    return start+q if 0<=q<aligned else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
lead=N; aligned=4; trail=N+2; length=lead+aligned+trail
check('reverse first aligned original base',solve(lead,aligned,trail,100,True,trail),103)
check('reverse last aligned original base',solve(lead,aligned,trail,100,True,trail+3),100)
check('reverse preceding clipped base',solve(lead,aligned,trail,100,True,trail-1),None)
check('reverse following clipped base',solve(lead,aligned,trail,100,True,trail+4),None)
check('forward first aligned base',solve(lead,aligned,trail,100,False,lead),100)
check('forward last aligned base',solve(lead,aligned,trail,100,False,lead+3),103)
check('forward leading clip',solve(lead,aligned,trail,100,False,lead-1),None)
check('outside original read',solve(lead,aligned,trail,100,True,length),None)
check('negative original index',solve(lead,aligned,trail,100,True,-1),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

N = 1
observations = []
def solve(lead, aligned, trail, start, reverse, pos):
    q=pos-lead
    if reverse: q=aligned-1-q
    return start+q if 0<=q<aligned else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
lead=N; aligned=4; trail=N+2; length=lead+aligned+trail
check('reverse first aligned original base',solve(lead,aligned,trail,100,True,trail),103)
check('reverse last aligned original base',solve(lead,aligned,trail,100,True,trail+3),100)
check('reverse preceding clipped base',solve(lead,aligned,trail,100,True,trail-1),None)
check('reverse following clipped base',solve(lead,aligned,trail,100,True,trail+4),None)
check('forward first aligned base',solve(lead,aligned,trail,100,False,lead),100)
check('forward last aligned base',solve(lead,aligned,trail,100,False,lead+3),103)
check('forward leading clip',solve(lead,aligned,trail,100,False,lead-1),None)
check('outside original read',solve(lead,aligned,trail,100,True,length),None)
check('negative original index',solve(lead,aligned,trail,100,True,-1),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:
Original read positions map to the wrong reference base after reverse orientation and asymmetric soft clipping.

For a synthetic ungapped alignment with leading/trailing soft clip lengths in alignment orientation, map a zero-based original read index to reference base or None. Query length is lead+aligned+trail. Reverse alignments reverse indexes across the entire query before clipping.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(rows, name):
    return next((c for c,aliases in rows if name==c or name in aliases),None)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
a='contig'+str(N)
r=[(a,['x','shared']),('other',['shared',a]),('third',[])]
check('ambiguous alias',solve(r,'shared'),None)
check('canonical beats alias',solve(r,a),a)
check('unique alias',solve(r,'x'),a)
check('canonical other',solve(r,'other'),'other')
check('canonical without alias',solve(r,'third'),'third')
check('absent',solve(r,'missing'),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

N = 1
observations = []
def solve(rows, name):
    matches=[c for c,a in rows if name==c or name in a]
    return matches[0] if len(matches)==1 else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
a='contig'+str(N)
r=[(a,['x','shared']),('other',['shared',a]),('third',[])]
check('ambiguous alias',solve(r,'shared'),None)
check('canonical beats alias',solve(r,a),a)
check('unique alias',solve(r,'x'),a)
check('canonical other',solve(r,'other'),'other')
check('canonical without alias',solve(r,'third'),'third')
check('absent',solve(r,'missing'),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:
Contig aliases choose an arbitrary reference target.

Names identify canonical contigs; aliases may collide. Exact canonical match wins; ambiguous or absent aliases return None.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(rows, identifier):
    base=identifier.split('.')[0]
    return next((p for k,p in rows if k.split('.')[0]==base),None)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
r=[('TX.2',N),('TX.10',N+10),('TY.1',N+20)]
check('explicit ten',solve(r,'TX.10'),N+10)
check('numeric latest',solve(r,'TX'),N+10)
check('explicit two',solve(r,'TX.2'),N)
check('missing version',solve(r,'TX.3'),None)
check('single model',solve(r,'TY'),N+20)
check('missing base',solve(r,'TZ'),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

N = 1
observations = []
def solve(rows, identifier):
    if '.' in identifier: return dict(rows).get(identifier)
    matches=sorted((k,p) for k,p in rows if k.split('.')[0]==identifier)
    return matches[-1][1] if matches else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
r=[('TX.2',N),('TX.10',N+10),('TY.1',N+20)]
check('explicit ten',solve(r,'TX.10'),N+10)
check('numeric latest',solve(r,'TX'),N+10)
check('explicit two',solve(r,'TX.2'),N)
check('missing version',solve(r,'TX.3'),None)
check('single model',solve(r,'TY'),N+20)
check('missing base',solve(r,'TZ'),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:
Transcript coordinate lookup ignores version pinning.

Return synthetic model offset for a versioned identifier; unversioned lookup uses greatest integer version. Missing explicit versions return None.

split: open-access