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

N = 1
observations = []
def solve(natural, owns):
    result = {parent:list(children) for parent,children in natural.items()}
    for owner,children in owns.items(): result.setdefault(owner, []).extend(children)
    return result
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('same parent explicit order', solve({'p':['a',str(N),'b']}, {'p':['b','a']} ), {'p':[str(N),'b','a']})
check('cross parent move', solve({'p':[str(N)],'q':[]}, {'q':[str(N)]}), {'p':[],'q':[str(N)]})
check('owned suffix', solve({'p':['a','b',str(N)]}, {'p':['a']}), {'p':['b',str(N),'a']})
check('no claims', solve({'p':[str(N)],'q':[]}, {}), {'p':[str(N)],'q':[]})
check('empty claims', solve({'p':[str(N)]}, {'p':[]}), {'p':[str(N)]})
check('leaf becomes owner', solve({'root':['owner',str(N)]}, {'owner':[str(N)]}), {'root':['owner'],'owner':[str(N)]})
check('empty hierarchy', solve({}, {}), {})
print(json.dumps({"observations": observations, "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(natural, owns):
    claimed = {child:owner for owner,children in owns.items() for child in children}
    result = {parent:[child for child in children if child not in claimed or claimed[child] == parent] for parent,children in natural.items()}
    for owner,children in owns.items():
        result.setdefault(owner, [])
        result[owner].extend(child for child in children if child not in result[owner])
    return result
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('same parent explicit order', solve({'p':['a',str(N),'b']}, {'p':['b','a']} ), {'p':[str(N),'b','a']})
check('cross parent move', solve({'p':[str(N)],'q':[]}, {'q':[str(N)]}), {'p':[],'q':[str(N)]})
check('owned suffix', solve({'p':['a','b',str(N)]}, {'p':['a']}), {'p':['b',str(N),'a']})
check('no claims', solve({'p':[str(N)],'q':[]}, {}), {'p':[str(N)],'q':[]})
check('empty claims', solve({'p':[str(N)]}, {'p':[]}), {'p':[str(N)]})
check('leaf becomes owner', solve({'root':['owner',str(N)]}, {'owner':[str(N)]}), {'root':['owner'],'owner':[str(N)]})
check('empty hierarchy', solve({}, {}), {})
print(json.dumps({"observations": observations, "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 explicit ownership edge adds a second copy instead of moving the child.

Input natural maps parent IDs to ordered immediate child IDs, and owns maps owners to ordered claimed IDs. All IDs exist, claims are unique globally, and combined ownership is acyclic. Return parent child lists preserving unclaimed natural order followed by declared owned order. Claimed natural children are reordered into the owned suffix; do not mutate inputs.

split: open-access


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

N = 1
observations = []
def solve(ops):
    env = {}
    for name, kind, value in ops:
        if kind == 'const': env[name] = value
    return env
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty block', solve([]), {})
check('constant assignment', solve([('x','const',N)]), {'x':N})
check('input kills constant', solve([('x','const',N),('x','input',None)]), {})
check('call kills constant', solve([('x','const',N),('x','call',None)]), {})
check('unrelated fact survives', solve([('x','const',N),('y','input',None)]), {'x':N})
check('constant restored', solve([('x','input',None),('x','const',N+1)]), {'x':N+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(ops):
    env = {}
    for name, kind, value in ops:
        if kind == 'const': env[name] = value
        elif kind == 'call': env.pop(name, None)
    return env
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty block', solve([]), {})
check('constant assignment', solve([('x','const',N)]), {'x':N})
check('input kills constant', solve([('x','const',N),('x','input',None)]), {})
check('call kills constant', solve([('x','const',N),('x','call',None)]), {})
check('unrelated fact survives', solve([('x','const',N),('y','input',None)]), {'x':N})
check('constant restored', solve([('x','input',None),('x','const',N+1)]), {'x':N+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:
Constant propagation retains a fact after an unknown assignment.

Interpret assignment facts (name, kind, value); const sets a known integer, input and call invalidate that name. Return final known facts.

split: open-access


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

N = 1
observations = []
def solve(ops):
    return [i for i, live, effect in ops if live]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty', solve([]), [])
check('dead pure', solve([(N,False,'pure')]), [])
check('live pure', solve([(N,True,'pure')]), [N])
check('write', solve([(N,False,'write')]), [N])
check('volatile', solve([(N,False,'volatile')]), [N])
check('trap', solve([(N,False,'trap')]), [N])
check('preserve order', solve([(N,False,'write'),(N+1,False,'pure'),(N+2,True,'pure')]), [N,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(ops):
    return [i for i, live, effect in ops if live or effect == 'write']
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty', solve([]), [])
check('dead pure', solve([(N,False,'pure')]), [])
check('live pure', solve([(N,True,'pure')]), [N])
check('write', solve([(N,False,'write')]), [N])
check('volatile', solve([(N,False,'volatile')]), [N])
check('trap', solve([(N,False,'trap')]), [N])
check('preserve order', solve([(N,False,'write'),(N+1,False,'pure'),(N+2,True,'pure')]), [N,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:
Dead-result elimination deletes a volatile read.

Return retained instruction IDs in order. Instructions have (id, live, effect), where effect is pure, write, volatile or trap; only unused pure operations may be removed.

split: open-access


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

N = 1
observations = []
def solve(op, a, b):
    return [op] + sorted([a,b])
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('add canonical', solve('add',N+1,N), ['add',N,N+1])
check('multiply canonical', solve('mul',N+1,N), ['mul',N,N+1])
check('sub ordered', solve('sub',N+1,N), ['sub',N+1,N])
check('div ordered', solve('div',N+1,N), ['div',N+1,N])
check('equal operands', solve('div',N,N), ['div',N,N])
check('already canonical', solve('add',0,N), ['add',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(op, a, b):
    return [op,a,b] if op == 'sub' else [op] + sorted([a,b])
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('add canonical', solve('add',N+1,N), ['add',N,N+1])
check('multiply canonical', solve('mul',N+1,N), ['mul',N,N+1])
check('sub ordered', solve('sub',N+1,N), ['sub',N+1,N])
check('div ordered', solve('div',N+1,N), ['div',N+1,N])
check('equal operands', solve('div',N,N), ['div',N,N])
check('already canonical', solve('add',0,N), ['add',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:
Expression numbering commutes subtraction operands.

Return an expression key [opcode, operand1, operand2]; add and mul commute, sub and div preserve order. Operands are integer value numbers.

split: open-access


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

N = 1
observations = []
def solve(incoming, pred):
    return incoming[0][1]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('right edge', solve([('left',N),('right',N+1)],'right'), N+1)
check('left edge', solve([('left',N),('right',N+1)],'left'), N)
check('reordered right', solve([('right',N+1),('left',N)],'right'), N+1)
check('reordered left', solve([('right',N+1),('left',N)],'left'), N)
check('single predecessor', solve([('entry',N)],'entry'), N)
check('back edge', solve([('entry',0),('back',N),('exit',N+1)],'back'), 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(incoming, pred):
    return sorted(incoming)[0][1]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('right edge', solve([('left',N),('right',N+1)],'right'), N+1)
check('left edge', solve([('left',N),('right',N+1)],'left'), N)
check('reordered right', solve([('right',N+1),('left',N)],'right'), N+1)
check('reordered left', solve([('right',N+1),('left',N)],'left'), N)
check('single predecessor', solve([('entry',N)],'entry'), N)
check('back edge', solve([('entry',0),('back',N),('exit',N+1)],'back'), 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:
Phi lowering selects operands by block position.

Given incoming (predecessor,value) pairs and a present predecessor label, return that edge value regardless of list order.

split: open-access


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

N = 1
observations = []
def solve(invariant, safe, trips):
    return invariant
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('zero-trip trapping', solve(True,False,0), False)
check('executed trapping', solve(True,False,N), True)
check('safe zero-trip', solve(True,True,0), True)
check('variant safe', solve(False,True,N), False)
check('variant trapping', solve(False,False,N), False)
check('variant skipped', solve(False,False,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(invariant, safe, trips):
    return safe or trips > 0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('zero-trip trapping', solve(True,False,0), False)
check('executed trapping', solve(True,False,N), True)
check('safe zero-trip', solve(True,True,0), True)
check('variant safe', solve(False,True,N), False)
check('variant trapping', solve(False,False,N), False)
check('variant skipped', solve(False,False,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:
Loop invariant motion speculates a trapping operation on a zero-trip loop.

Return whether an operation may hoist: invariant and (safe to speculate or guaranteed executed by this loop).

split: open-access


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

N = 1
observations = []
def solve(value, shift):
    return value >> shift
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('negative nonmultiple', solve(-(2**N+1),N), -1)
check('positive nonmultiple', solve(2**N+1,N), 1)
check('negative exact', solve(-2**N,N), -1)
check('positive exact', solve(2**N,N), 1)
check('zero', solve(0,N), 0)
check('identity shift', solve(-N,0), -N)
check('small negative', solve(-1,N), 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(value, shift):
    return (value + (1 << shift) - 1) >> shift
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('negative nonmultiple', solve(-(2**N+1),N), -1)
check('positive nonmultiple', solve(2**N+1,N), 1)
check('negative exact', solve(-2**N,N), -1)
check('positive exact', solve(2**N,N), 1)
check('zero', solve(0,N), 0)
check('identity shift', solve(-N,0), -N)
check('small negative', solve(-1,N), 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:
Division strength reduction rounds negative dividends downward.

Lower signed mathematical integer division by 2**shift, shift>=0, returning truncation toward zero. No finite-width overflow is modeled.

split: open-access


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

N = 1
observations = []
def solve(base, used):
    return base
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
b = 'tmp' + str(N)
check('no names', solve(b,[]), b)
check('unrelated', solve(b,['other']), b)
check('first collision', solve(b,[b]), b+'_1')
check('second collision', solve(b,[b,b+'_1']), b+'_2')
check('gap reuse', solve(b,[b,b+'_2']), b+'_1')
check('multiple occupied', solve(b,[b,b+'_1',b+'_2']), b+'_3')
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(base, used):
    return base if base not in used else base + '_1'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
b = 'tmp' + str(N)
check('no names', solve(b,[]), b)
check('unrelated', solve(b,['other']), b)
check('first collision', solve(b,[b]), b+'_1')
check('second collision', solve(b,[b,b+'_1']), b+'_2')
check('gap reuse', solve(b,[b,b+'_2']), b+'_1')
check('multiple occupied', solve(b,[b,b+'_1',b+'_2']), b+'_3')
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Inlining chooses a local name already used by the caller.

Return base if unused, otherwise base_1, base_2, etc choosing the first name absent from caller names.

split: open-access


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

N = 1
observations = []
def solve(effect, label):
    return [False, []]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('pure', solve('pure',N), [False,[]])
check('write', solve('write',N), [False,[N]])
check('read', solve('read',N), [False,[N]])
check('zero label read', solve('read',0), [False,[0]])
check('empty label write', solve('write',''), [False,['']])
check('other pure label', solve('pure',N+1), [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(effect, label):
    return [False, [label] if effect == 'write' else []]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('pure', solve('pure',N), [False,[]])
check('write', solve('write',N), [False,[N]])
check('read', solve('read',N), [False,[N]])
check('zero label read', solve('read',0), [False,[0]])
check('empty label write', solve('write',''), [False,['']])
check('other pure label', solve('pure',N+1), [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:
Boolean simplification erases evaluation of an effectful left operand.

Model lowering lhs AND false as [False, trace]; lhs is always evaluated and contributes its effect unless pure. Effect is pure, write or read; label identifies the operation.

split: open-access


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

N = 1
observations = []
def solve(value, writes):
    return value
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('no writes', solve(N,[]), N)
check('disjoint write', solve(N,['no']), N)
check('must alias', solve(N,['must']), None)
check('may alias', solve(N,['may']), None)
check('may after disjoint', solve(N,['no','may']), None)
check('many disjoint', solve(N,['no']*N), N)
check('must after may', solve(N,['may','must']), 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(value, writes):
    return None if 'must' in writes else value
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('no writes', solve(N,[]), N)
check('disjoint write', solve(N,['no']), N)
check('must alias', solve(N,['must']), None)
check('may alias', solve(N,['may']), None)
check('may after disjoint', solve(N,['no','may']), None)
check('many disjoint', solve(N,['no']*N), N)
check('must after may', solve(N,['may','must']), 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:
Store forwarding crosses an intervening may-alias write.

Return candidate value if every intervening write is proven disjoint; otherwise return None meaning retain the load. Alias facts are no, may, or must.

split: open-access


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

N = 1
observations = []
def solve(r1, w1, r2, w2):
    return not (set(w1) & set(r2))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
x = 'r'+str(N)
y = 'r'+str(N+1)
check('empty', solve([],[],[],[]), True)
check('RAW', solve([],[x],[x],[]), False)
check('WAR', solve([x],[],[],[x]), False)
check('WAW', solve([],[x],[],[x]), False)
check('read sharing', solve([x],[],[x],[]), True)
check('disjoint writes', solve([],[x],[],[y]), True)
check('mixed dependence', solve([y],[x],[x],[y]), 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(r1, w1, r2, w2):
    return not ((set(w1) & set(r2)) or (set(r1) & set(w2)))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
x = 'r'+str(N)
y = 'r'+str(N+1)
check('empty', solve([],[],[],[]), True)
check('RAW', solve([],[x],[x],[]), False)
check('WAR', solve([x],[],[],[x]), False)
check('WAW', solve([],[x],[],[x]), False)
check('read sharing', solve([x],[],[x],[]), True)
check('disjoint writes', solve([],[x],[],[y]), True)
check('mixed dependence', solve([y],[x],[x],[y]), 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:
Instruction swapping ignores a write after an earlier read.

Return whether two adjacent pure register instructions can swap; each read/write collection is a set of register names, and any RAW, WAR or WAW conflict forbids swapping. Memory and control effects are excluded.

split: open-access


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

N = 1
observations = []
def solve(a, b):
    if a is None: return b
    if b is None: return a
    return [max(a[0],b[0]), min(a[1],b[1])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('disjoint branches',solve([0,N],[N+2,N+3]),[0,N+3])
check('nested second branch',solve([0,N+4],[1,N+2]),[0,N+4])
check('second expands lower bound',solve([0,N],[-N,0]),[-N,N])
check('left unreachable',solve(None,[N,N]),[N,N])
check('right unreachable',solve([N,N],None),[N,N])
check('both unreachable',solve(None,None),None)
check('identical singleton',solve([N,N],[N,N]),[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(a, b):
    return a if a is not None else b
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('disjoint branches',solve([0,N],[N+2,N+3]),[0,N+3])
check('nested second branch',solve([0,N+4],[1,N+2]),[0,N+4])
check('second expands lower bound',solve([0,N],[-N,0]),[-N,N])
check('left unreachable',solve(None,[N,N]),[N,N])
check('right unreachable',solve([N,N],None),[N,N])
check('both unreachable',solve(None,None),None)
check('identical singleton',solve([N,N],[N,N]),[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:
Joining branch intervals discards a reachable endpoint.

Join two integer closed intervals or None for unreachable; return a list enclosing their union, or None if both are unreachable.

split: open-access


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

N = 1
observations = []
def solve(old, new):
    return [old[0],None if new[1]>old[1] else old[1]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('lower expands alone',solve([0,N],[-N,N]),[None,N])
check('upper expands alone',solve([0,N],[0,N+1]),[0,None])
check('both expand',solve([0,N],[-1,N+1]),[None,None])
check('equal',solve([0,N],[0,N]),[0,N])
check('narrower',solve([-N,N],[0,0]),[-N,N])
check('singleton expands right',solve([N,N],[N,N+1]),[N,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(old, new):
    return [None,None] if new[0]<old[0] or new[1]>old[1] else list(old)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('lower expands alone',solve([0,N],[-N,N]),[None,N])
check('upper expands alone',solve([0,N],[0,N+1]),[0,None])
check('both expand',solve([0,N],[-1,N+1]),[None,None])
check('equal',solve([0,N],[0,N]),[0,N])
check('narrower',solve([-N,N],[0,0]),[-N,N])
check('singleton expands right',solve([N,N],[N,N+1]),[N,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:
Widening retains an escaping lower bound.

Widen finite old and next integer intervals; return [lower,upper], with None representing an unbounded endpoint. Preserve each old bound unless that direction expands.

split: open-access


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

N = 1
observations = []
def solve(preds):
    if not preds: return None
    return sorted(set.intersection(*(set(p or []) for p in preds)))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
x='v'+str(N)
check('dead predecessor ignored',solve([[x],None]),[x])
check('must hold on both',solve([[x,'z'],[x]]),[x])
check('reachable empty loses facts',solve([[x],[]]),[])
check('all dead',solve([None,None]),None)
check('no predecessors',solve([]),None)
check('single reachable',solve([[x]]),[x])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(preds):
    live=[set(p) for p in preds if p is not None]
    return sorted(set.union(*live)) if live else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
x='v'+str(N)
check('dead predecessor ignored',solve([[x],None]),[x])
check('must hold on both',solve([[x,'z'],[x]]),[x])
check('reachable empty loses facts',solve([[x],[]]),[])
check('all dead',solve([None,None]),None)
check('no predecessors',solve([]),None)
check('single reachable',solve([[x]]),[x])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Unreachable predecessors erase definite assignments.

Predecessors are None (unreachable) or lists of definitely assigned variables. Return their reachable intersection sorted; return None when no predecessor is reachable.

split: open-access


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

N = 1
observations = []
def solve(hazards, certificate):
    return [] if certificate else sorted(set(hazards))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
h='sink'+str(N)
check('sql certificate preserves html',solve(['sql',h],'sql'),[h])
check('html certificate preserves sql',solve(['sql',h],h),['sql'])
check('unknown certificate',solve([h],'other'),[h])
check('matching certificate',solve([h],h),[])
check('empty hazards',solve([],h),[])
check('duplicate hazards',solve([h,h,'sql'],'sql'),[h])
print(json.dumps({"observations": observations, "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(hazards, certificate):
    return sorted(set(hazards) & {certificate})
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
h='sink'+str(N)
check('sql certificate preserves html',solve(['sql',h],'sql'),[h])
check('html certificate preserves sql',solve(['sql',h],h),['sql'])
check('unknown certificate',solve([h],'other'),[h])
check('matching certificate',solve([h],h),[])
check('empty hazards',solve([],h),[])
check('duplicate hazards',solve([h,h,'sql'],'sql'),[h])
print(json.dumps({"observations": observations, "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 context-specific sanitizer clears unrelated taint.

Given hazard names and a sanitizer certificate name, remove exactly that name from the hazard set and return sorted remaining names. Unknown certificates remove nothing.

split: open-access


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

N = 1
observations = []
def solve(heap, targets, value):
    out={k:set(v) for k,v in heap.items()}
    for k in set(targets): out[k]={value}
    return {k:sorted(v) for k,v in out.items()}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ambiguous store',solve({'a':[0],'b':[1]},['a','b'],N+2),{'a':[0,N+2],'b':[1,N+2]})
check('definite store',solve({'a':[0]},['a'],N),{'a':[N]})
check('duplicate target is unique',solve({'a':[0]},['a','a'],N),{'a':[N]})
check('no target',solve({'a':[N]},[],0),{'a':[N]})
check('unrelated object',solve({'a':[0],'b':[N]},['a'],1),{'a':[1],'b':[N]})
check('empty heap',solve({},[],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(heap, targets, value):
    out={k:set(v) for k,v in heap.items()}
    for k in set(targets): out[k].add(value)
    return {k:sorted(v) for k,v in out.items()}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ambiguous store',solve({'a':[0],'b':[1]},['a','b'],N+2),{'a':[0,N+2],'b':[1,N+2]})
check('definite store',solve({'a':[0]},['a'],N),{'a':[N]})
check('duplicate target is unique',solve({'a':[0]},['a','a'],N),{'a':[N]})
check('no target',solve({'a':[N]},[],0),{'a':[N]})
check('unrelated object',solve({'a':[0],'b':[N]},['a'],1),{'a':[1],'b':[N]})
check('empty heap',solve({},[],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:
An ambiguous pointer store kills possible old values.

Heap maps allocated object names to possible integer values. Every target must name an allocated object already present in the heap; dangling targets are outside this model. Store a known value through a list of possible targets: unique target replaces, multiple targets union, empty target list changes nothing. Return sorted value lists.

split: open-access


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

N = 1
observations = []
def solve(out, defs, uses):
    return sorted((set(out)|set(uses))-set(defs))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
x='v'+str(N)
check('read modify write',solve([],[x],[x]),[x])
check('overwrite dead incoming',solve([x],[x],[]),[])
check('independent use',solve([],[x],['a']),['a'])
check('passthrough',solve([x],[],[]),[x])
check('empty instruction',solve([],[],[]),[])
check('other live value',solve(['a',x],[x],[x]),['a',x])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(out, defs, uses):
    return sorted(set(out)|set(uses))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
x='v'+str(N)
check('read modify write',solve([],[x],[x]),[x])
check('overwrite dead incoming',solve([x],[x],[]),[])
check('independent use',solve([],[x],['a']),['a'])
check('passthrough',solve([x],[],[]),[x])
check('empty instruction',solve([],[],[]),[])
check('other live value',solve(['a',x],[x],[x]),['a',x])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A definition kills its own incoming operand use.

Return sorted live-in variables for one instruction: uses union (live-out minus definitions). Uses occur before this instruction writes definitions.

split: open-access


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

N = 1
observations = []
def solve(env, summary):
    return dict(env)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('known writer',solve({'a':N,'b':2},['a']),{'a':None,'b':2})
check('pure call',solve({'a':N},[]),{'a':N})
check('unknown call',solve({'a':N,'b':2},None),{'a':None,'b':None})
check('already unknown',solve({'a':None},['a']),{'a':None})
check('outside environment',solve({'a':N},['b']),{'a':N})
check('empty environment',solve({},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(env, summary):
    return {k:None for k in env}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('known writer',solve({'a':N,'b':2},['a']),{'a':None,'b':2})
check('pure call',solve({'a':N},[]),{'a':N})
check('unknown call',solve({'a':N,'b':2},None),{'a':None,'b':None})
check('already unknown',solve({'a':None},['a']),{'a':None})
check('outside environment',solve({'a':N},['b']),{'a':N})
check('empty environment',solve({},None),{})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A call preserves a constant for a modified global.

Environment maps globals to integer constants or None for unknown. Summary is None for unknown effects or a list of may-written globals. Return environment with affected existing bindings set to None.

split: open-access


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

N = 1
observations = []
def solve(a, b):
    return a if a==b else 'T'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('bottom identity left',solve('B',N),N)
check('bottom identity right',solve(N,'B'),N)
check('different constants',solve(N,N+1),'T')
check('same constant',solve(N,N),N)
check('unknown absorbs right',solve(N,'T'),'T')
check('both unreachable',solve('B','B'),'B')
check('unknown absorbs left',solve('T',N),'T')
print(json.dumps({"observations": observations, "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):
    return b if a=='B' else a
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('bottom identity left',solve('B',N),N)
check('bottom identity right',solve(N,'B'),N)
check('different constants',solve(N,N+1),'T')
check('same constant',solve(N,N),N)
check('unknown absorbs right',solve(N,'T'),'T')
check('both unreachable',solve('B','B'),'B')
check('unknown absorbs left',solve('T',N),'T')
print(json.dumps({"observations": observations, "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:
Unreachable input becomes an unknown constant at a join.

Join constant states encoded as strings B (unreachable), T (unknown), or integer constants; return the least upper bound.

split: open-access


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

N = 1
observations = []
def solve(count, edges, seeds):
    facts=[set(x) for x in seeds]
    for a,b in edges: facts[b]|=facts[a]
    return [sorted(x) for x in facts]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
x='d'+str(N)
check('three reverse dependencies',solve(4,[(2,3),(1,2),(0,1)],[[x],[],[],[]]),[[x],[x],[x],[x]])
check('cycle converges',solve(3,[(1,2),(2,0),(0,1)],[[x],[],[]]),[[x],[x],[x]])
check('isolated nodes',solve(2,[],[[x],[]]),[[x],[]])
check('self edge',solve(1,[(0,0)],[[x]]),[[x]])
check('no nodes',solve(0,[],[]),[])
check('union incoming',solve(3,[(0,2),(1,2)],[[x],['a'],[]]),[[x],['a'],['a',x]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(count, edges, seeds):
    facts=[set(x) for x in seeds]
    for _ in range(2):
        for a,b in edges: facts[b]|=facts[a]
    return [sorted(x) for x in facts]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
x='d'+str(N)
check('three reverse dependencies',solve(4,[(2,3),(1,2),(0,1)],[[x],[],[],[]]),[[x],[x],[x],[x]])
check('cycle converges',solve(3,[(1,2),(2,0),(0,1)],[[x],[],[]]),[[x],[x],[x]])
check('isolated nodes',solve(2,[],[[x],[]]),[[x],[]])
check('self edge',solve(1,[(0,0)],[[x]]),[[x]])
check('no nodes',solve(0,[],[]),[])
check('union incoming',solve(3,[(0,2),(1,2)],[[x],['a'],[]]),[[x],['a'],['a',x]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A single dataflow sweep misses facts across backward edges.

Given node count, directed edges, and per-node seed labels, return the sorted labels reachable at each node, including seeds; compute the least union fixed point.

split: open-access


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

N = 1
observations = []
def solve(events):
    disabled=set(); output=[]
    for op,code in events:
        if op=='disable': disabled.add(code)
        elif op=='emit' and code not in disabled: output.append(code)
    return output
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
x='L'+str(N)
check('local ends at exit',solve([('enter',''),('disable',x),('exit',''),('emit',x)]),[x])
check('outer survives exit',solve([('disable',x),('enter',''),('exit',''),('emit',x)]),[])
check('inherit outer',solve([('disable',x),('enter',''),('emit',x),('exit','')]),[])
check('other code unaffected',solve([('disable',x),('emit','other')]),['other'])
check('earlier diagnostic retained',solve([('emit',x),('disable',x),('emit',x)]),[x])
check('empty events',solve([]),[])
print(json.dumps({"observations": observations, "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):
    disabled=set(); output=[]
    for op,code in events:
        if op=='disable': disabled.add(code)
        elif op=='exit': disabled.clear()
        elif op=='emit' and code not in disabled: output.append(code)
    return output
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
x='L'+str(N)
check('local ends at exit',solve([('enter',''),('disable',x),('exit',''),('emit',x)]),[x])
check('outer survives exit',solve([('disable',x),('enter',''),('exit',''),('emit',x)]),[])
check('inherit outer',solve([('disable',x),('enter',''),('emit',x),('exit','')]),[])
check('other code unaffected',solve([('disable',x),('emit','other')]),['other'])
check('earlier diagnostic retained',solve([('emit',x),('disable',x),('emit',x)]),[x])
check('empty events',solve([]),[])
print(json.dumps({"observations": observations, "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 inner lint suppression leaks into a sibling scope.

Process balanced enter/exit, disable(code), and emit(code) events. Disable applies from that point through the current lexical scope and descendants. Return emitted unsuppressed codes in order.

split: open-access


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

N = 1
observations = []
def solve(links, opens):
    return [links-1, links-1 > 0]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('one descriptor retains last unlinked inode', solve(1,1), [0,True])
check('several descriptors retain inode', solve(1,N+1), [0,True])
check('last reference removed', solve(1,0), [0,False])
check('another name retains inode', solve(N+1,0), [N,True])
check('names and descriptor retain inode', solve(N+1,1), [N,True])
check('two links no descriptors', solve(2,0), [1,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(links, opens):
    return [links-1, links-1 > 0 or opens > 1]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('one descriptor retains last unlinked inode', solve(1,1), [0,True])
check('several descriptors retain inode', solve(1,N+1), [0,True])
check('last reference removed', solve(1,0), [0,False])
check('another name retains inode', solve(N+1,0), [N,True])
check('names and descriptor retain inode', solve(N+1,1), [N,True])
check('two links no descriptors', solve(2,0), [1,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:
Unlinking the last name invalidates an open file.

Deterministic in-memory filesystem model. Given initial positive link count and nonnegative open count, remove one link; return [remaining links, whether inode survives].

split: open-access


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

N = 1
observations = []
def solve(text, lengths):
    positions=[0,0]
    out=[]
    for i,k in enumerate(lengths):
     d=i%2; p=positions[d]; out.append(text[p:p+k]); positions[d]+=len(out[-1])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
s='abcdef'+str(N)
check('interleaved duplicate reads',solve(s,[1,1,1,1]),['a','b','c','d'])
check('one read',solve(s,[2]),['ab'])
check('zero length does not advance',solve(s,[0,2,1]),['','ab','c'])
check('EOF clips count',solve(s,[100,1]),[s,''])
check('empty file',solve('',[N,1]),['',''])
check('no reads',solve(s,[]),[])
print(json.dumps({"observations": observations, "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(text, lengths):
    positions=[0,0]
    out=[]
    for i,k in enumerate(lengths):
     d=i%2; p=positions[d]; out.append(text[p:p+k]); positions[d]+=len(out[-1])
     if i==0: positions[1]=positions[0]
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
s='abcdef'+str(N)
check('interleaved duplicate reads',solve(s,[1,1,1,1]),['a','b','c','d'])
check('one read',solve(s,[2]),['ab'])
check('zero length does not advance',solve(s,[0,2,1]),['','ab','c'])
check('EOF clips count',solve(s,[100,1]),[s,''])
check('empty file',solve('',[N,1]),['',''])
check('no reads',solve(s,[]),[])
print(json.dumps({"observations": observations, "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:
Duplicated descriptors advance independent read positions.

Deterministic in-memory filesystem model. Two descriptors are duplicates of one open-file description at offset zero. Return text read by alternating descriptors for nonnegative requested lengths; EOF reads return empty text.

split: open-access


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

N = 1
observations = []
def solve(old, new, aliases):
    return [new,new]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('open target survives replacement',solve('old'+str(N),'new',0),['old'+str(N),'new'])
check('other hardlink survives',solve('old','new',N),['old','new'])
check('empty original file',solve('','new',0),['','new'])
check('empty replacement',solve('old','',0),['old',''])
check('same bytes different identities',solve('same','same',0),['same','same'])
check('both empty',solve('','',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(old, new, aliases):
    return [old if aliases else new,new]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('open target survives replacement',solve('old'+str(N),'new',0),['old'+str(N),'new'])
check('other hardlink survives',solve('old','new',N),['old','new'])
check('empty original file',solve('','new',0),['','new'])
check('empty replacement',solve('old','',0),['old',''])
check('same bytes different identities',solve('same','same',0),['same','same'])
check('both empty',solve('','',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:
Replacing a pathname retargets an already open descriptor.

Deterministic in-memory filesystem model. Open destination containing old, then atomically replace its name with a different inode containing new. Return [open-handle content, pathname content]; aliases counts additional names of old inode.

split: open-access


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

N = 1
observations = []
def solve(requested, mask):
    return requested-mask
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('absent write bit cannot borrow',solve(0o444,0o022),0o444)
check('normal create',solve(0o666,0o022),0o644)
check('full mask',solve(N,0o777),0)
check('no mask',solve(N,0),N)
check('zero requested',solve(0,N),0)
check('execute only survives write mask',solve(0o111,0o222),0o111)
print(json.dumps({"observations": observations, "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(requested, mask):
    return max(0,requested-mask)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('absent write bit cannot borrow',solve(0o444,0o022),0o444)
check('normal create',solve(0o666,0o022),0o644)
check('full mask',solve(N,0o777),0)
check('no mask',solve(N,0),N)
check('zero requested',solve(0,N),0)
check('execute only survives write mask',solve(0o111,0o222),0o111)
print(json.dumps({"observations": observations, "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:
Creation mode subtraction borrows across permission bits.

Deterministic in-memory filesystem model. Return permission bits for a new file from requested and mask integers in 0..511, using requested AND NOT mask.

split: open-access


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

N = 1
observations = []
def solve(mode, owner, group_match, bit):
    return bool(((mode>>6 if owner else 0) | (mode>>3 if group_match else 0) | mode) & bit)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('owner denial cannot fall through',solve(0o004,True,False,4),False)
check('group denial cannot fall through',solve(0o004,False,True,4),False)
check('owner wins despite matching group',solve(0o040,True,True,4),False)
check('owner allowed',solve(0o400,True,False,4),True)
check('other allowed',solve(0o001,False,False,1),True)
check('varying unrelated mode bits',solve(N<<6,False,False,2),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(mode, owner, group_match, bit):
    return bool(max((mode>>6)&7 if owner else 0,(mode>>3)&7 if group_match else 0,mode&7)&bit)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('owner denial cannot fall through',solve(0o004,True,False,4),False)
check('group denial cannot fall through',solve(0o004,False,True,4),False)
check('owner wins despite matching group',solve(0o040,True,True,4),False)
check('owner allowed',solve(0o400,True,False,4),True)
check('other allowed',solve(0o001,False,False,1),True)
check('varying unrelated mode bits',solve(N<<6,False,False,2),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:
Permission evaluation falls through from owner to other.

Deterministic in-memory filesystem model. POSIX-style basic permission model without ACLs or superuser: owner and group_match booleans select one class; bit is 1,2,or4. Return whether selected class grants it.

split: open-access


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

N = 1
observations = []
def solve(ancestors):
    return all(bits & 4 != 0 for bits in ancestors)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('search without listing',solve([1]*N),True)
check('readable but unsearchable',solve([4]),False)
check('blocked ancestor searchable parent',solve([0,1]),False)
check('blocked middle ancestor',solve([7,4,7]),False)
check('all permissions',solve([7]*N),True)
check('no ancestors',solve([]),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(ancestors):
    return not ancestors or bool(ancestors[-1]&1)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('search without listing',solve([1]*N),True)
check('readable but unsearchable',solve([4]),False)
check('blocked ancestor searchable parent',solve([0,1]),False)
check('blocked middle ancestor',solve([7,4,7]),False)
check('all permissions',solve([7]*N),True)
check('no ancestors',solve([]),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:
Readable directories are mistaken for searchable directories.

Deterministic in-memory filesystem model. Given already-selected permission triples 0..7 for each ancestor, return whether a known file name can be traversed. Search bit 1 is needed at every ancestor; listing bit 4 is irrelevant. Empty ancestors succeeds.

split: open-access


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

N = 1
observations = []
def solve(size, cells):
    return [cells[p] for p in sorted(cells) if 0<=p<size]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('leading hole',solve(N+1,{N:65}),[0]*N+[65])
check('internal hole',solve(3,{0:65,2:66}),[65,0,66])
check('trailing hole',solve(3,{0:65}),[65,0,0])
check('all hole',solve(N,{}),[0]*N)
check('empty file',solve(0,{0:65}),[])
check('allocated zero retained',solve(2,{0:0,1:66}),[0,66])
print(json.dumps({"observations": observations, "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(size, cells):
    values=[cells[p] for p in sorted(cells) if 0<=p<size]
    return values+[0]*(size-len(values))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('leading hole',solve(N+1,{N:65}),[0]*N+[65])
check('internal hole',solve(3,{0:65,2:66}),[65,0,66])
check('trailing hole',solve(3,{0:65}),[65,0,0])
check('all hole',solve(N,{}),[0]*N)
check('empty file',solve(0,{0:65}),[])
check('allocated zero retained',solve(2,{0:0,1:66}),[0,66])
print(json.dumps({"observations": observations, "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:
Sparse holes disappear when file bytes are reconstructed.

Deterministic in-memory filesystem model. Logical file has nonnegative size and a map from allocated integer offsets to byte values 0..255. Return all logical bytes as a list; offsets outside size are ignored.

split: open-access


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

N = 1
observations = []
def solve(text, seek, payload):
    return [text[:seek]+'\0'*max(0,seek-len(text))+payload+text[seek+len(payload):],seek+len(payload)] if payload else [text,seek]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('seek to beginning does not overwrite',solve('abc',0,str(N)),['abc'+str(N),4])
check('seek past EOF does not make hole',solve('a',N+3,'b'),['ab',2])
check('seek to EOF',solve('abc',3,'d'),['abcd',4])
check('empty file',solve('',N,'x'),['x',1])
check('empty write leaves offset',solve('abc',N,''),['abc',N])
check('multiple characters appended',solve('abc',1,'XY'),['abcXY',5])
print(json.dumps({"observations": observations, "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(text, seek, payload):
    position = seek if seek < len(text) else len(text)
    return [text[:position]+payload+text[position+len(payload):],position+len(payload)] if payload else [text,seek]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('seek to beginning does not overwrite',solve('abc',0,str(N)),['abc'+str(N),4])
check('seek past EOF does not make hole',solve('a',N+3,'b'),['ab',2])
check('seek to EOF',solve('abc',3,'d'),['abcd',4])
check('empty file',solve('',N,'x'),['x',1])
check('empty write leaves offset',solve('abc',N,''),['abc',N])
check('multiple characters appended',solve('abc',1,'XY'),['abcXY',5])
print(json.dumps({"observations": observations, "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:
Seeking an append descriptor causes an overwrite.

Deterministic in-memory filesystem model. Open a character file in append mode, seek to nonnegative seek, then write payload. Return [contents,new offset]; zero-length payload leaves the sought offset unchanged in this controlled model.

split: open-access


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

N = 1
observations = []
def solve(text, offset, size):
    return [text[:size]+'\0'*max(0,size-len(text)),0]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('shrink below current offset',solve('abcdef',N+6,2),['ab',N+6])
check('truncate to zero retains position',solve('abc',N,0),['',N])
check('growth retains position',solve('a',1,3),['a\0\0',1])
check('same size retains position',solve('abc',2,3),['abc',2])
check('position zero',solve('abc',0,1),['a',0])
check('empty growing file',solve('',N,1),['\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(text, offset, size):
    return [text[:size]+'\0'*max(0,size-len(text)),min(offset,size)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('shrink below current offset',solve('abcdef',N+6,2),['ab',N+6])
check('truncate to zero retains position',solve('abc',N,0),['',N])
check('growth retains position',solve('a',1,3),['a\0\0',1])
check('same size retains position',solve('abc',2,3),['abc',2])
check('position zero',solve('abc',0,1),['a',0])
check('empty growing file',solve('',N,1),['\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:
Truncation rewinds an open file position.

Deterministic in-memory filesystem model. Resize text to nonnegative size, filling growth with null characters, and return [new text, unchanged nonnegative offset].

split: open-access


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

N = 1
observations = []
def solve(entries, name):
    entry=entries.get(name)
    if entry is None: return 'missing'
    if entry[0]=='link': return entries.get(entry[1],['missing'])[0]
    return entry[0]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
name='link'+str(N)
check('dangling link exists',solve({name:['link','absent']},name),'link')
check('link to file remains link',solve({name:['link','f'],'f':['file',None]},name),'link')
check('link to directory remains link',solve({name:['link','d'],'d':['dir',None]},name),'link')
check('ordinary file',solve({'f':['file',None]},'f'),'file')
check('missing entry',solve({},name),'missing')
check('self link does not recurse',solve({name:['link',name]},name),'link')
print(json.dumps({"observations": observations, "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(entries, name):
    entry=entries.get(name)
    if entry is None: return 'missing'
    if entry[0]=='link': return entries.get(entry[1],['link'])[0]
    return entry[0]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
name='link'+str(N)
check('dangling link exists',solve({name:['link','absent']},name),'link')
check('link to file remains link',solve({name:['link','f'],'f':['file',None]},name),'link')
check('link to directory remains link',solve({name:['link','d'],'d':['dir',None]},name),'link')
check('ordinary file',solve({'f':['file',None]},'f'),'file')
check('missing entry',solve({},name),'missing')
check('self link does not recurse',solve({name:['link',name]},name),'link')
print(json.dumps({"observations": observations, "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 dangling symbolic link disappears from metadata results.

Deterministic in-memory filesystem model. entries maps flat names to [kind,target], where kind is file,dir,or link and target is used only for links. Return named entry kind or missing without following any link.

split: open-access


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

N = 1
observations = []
def solve(seed, distance, length):
    return seed + seed[-distance:][:length]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('overlap',solve('ab',2,2*N+1),'ab'+'ab'*N+'a')
check('distance one',solve('x',1,4),'xxxxx')
check('no match',solve('abc',2,0),'abc')
check('partial period',solve('abc',3,2),'abcab')
check('exact period',solve('abc',3,3),'abcabc')
check('suffix period',solve('zab',2,5),'zabababa')
print(json.dumps({"observations": observations, "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(seed, distance, length):
    return seed + seed[-1:] * length
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('overlap',solve('ab',2,2*N+1),'ab'+'ab'*N+'a')
check('distance one',solve('x',1,4),'xxxxx')
check('no match',solve('abc',2,0),'abc')
check('partial period',solve('abc',3,2),'abcab')
check('exact period',solve('abc',3,3),'abcabc')
check('suffix period',solve('zab',2,5),'zabababa')
print(json.dumps({"observations": observations, "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:
LZ match copying freezes the source before expansion.

For a nonempty seed, valid distance into seed, and nonnegative length, append length symbols by repeatedly reading distance symbols behind the growing output.

split: open-access


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

N = 1
observations = []
def solve(history, width, distance):
    return history[-distance] if 1 <= distance <= len(history) else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('expired',solve('a'*(N+3),N,N+1),None)
check('oldest valid',solve('abcdef',3,3),'d')
check('nearest',solve('abc',2,1),'c')
check('before stream',solve('a',5,2),None)
check('zero',solve('abc',2,0),None)
check('empty history',solve('',4,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(history, width, distance):
    return history[-distance] if 1 <= distance < min(width,len(history)) else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('expired',solve('a'*(N+3),N,N+1),None)
check('oldest valid',solve('abcdef',3,3),'d')
check('nearest',solve('abc',2,1),'c')
check('before stream',solve('a',5,2),None)
check('zero',solve('abc',2,0),None)
check('empty history',solve('',4,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:
LZ history keeps references beyond its window.

Return the byte distance behind output only if 1 <= distance <= min(width,len(history)); otherwise return None. Width is positive.

split: open-access


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

N = 1
observations = []
def solve(tokens):
    d={0:'a',1:'b'}; out=[]
    for t in tokens:
        if t[0]=='put': d[t[1]]=t[2]
        elif t[0]=='get': out.append(d.get(t[1],'?'))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('epoch invalidates phrase',solve([['put',2,'a'*N],['clear'],['get',2]]),['?'])
check('literal survives',solve([['clear'],['get',0]]),['a'])
check('phrase before clear',solve([['put',2,'ab'],['get',2]]),['ab'])
check('reassignment after clear',solve([['put',2,'ab'],['clear'],['put',2,'ba'],['get',2]]),['ba'])
check('repeated clears',solve([['clear'],['clear'],['get',1]]),['b'])
check('empty',solve([]),[])
print(json.dumps({"observations": observations, "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(tokens):
    d={0:'a',1:'b'}; out=[]
    for t in tokens:
        if t[0]=='put': d[t[1]]=t[2]
        elif t[0]=='clear': d={}
        else: out.append(d.get(t[1],'?'))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('epoch invalidates phrase',solve([['put',2,'a'*N],['clear'],['get',2]]),['?'])
check('literal survives',solve([['clear'],['get',0]]),['a'])
check('phrase before clear',solve([['put',2,'ab'],['get',2]]),['ab'])
check('reassignment after clear',solve([['put',2,'ab'],['clear'],['put',2,'ba'],['get',2]]),['ba'])
check('repeated clears',solve([['clear'],['clear'],['get',1]]),['b'])
check('empty',solve([]),[])
print(json.dumps({"observations": observations, "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:
Dictionary clear codes retain stale learned phrases.

Toy dictionary starts with {0:a,1:b}. Tokens [put,k,text] add phrases; [clear] restores exactly the literals; [get,k] emits the mapped phrase or ?.

split: open-access


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

N = 1
observations = []
def solve(lengths):
    return {s:i for i,(s,n) in enumerate(sorted(lengths.items(),key=lambda p:(p[1],p[0])))}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('length jump',solve({'a':1,'b':N+2}),{'a':0,'b':2**(N+1)})
check('symbol order differs',solve({'a':2,'z':1}),{'z':0,'a':2})
check('tie order',solve({'b':2,'a':2}),{'a':0,'b':1})
check('empty',solve({}),{})
check('single',solve({'x':3}),{'x':0})
check('complete tree',solve({'a':1,'b':2,'c':2}),{'a':0,'b':2,'c':3})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(lengths):
    out={}; code=0; previous=0
    for s,n in sorted(lengths.items()):
        code = (code << max(0,n-previous))
        out[s]=code; code+=1; previous=n
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('length jump',solve({'a':1,'b':N+2}),{'a':0,'b':2**(N+1)})
check('symbol order differs',solve({'a':2,'z':1}),{'z':0,'a':2})
check('tie order',solve({'b':2,'a':2}),{'a':0,'b':1})
check('empty',solve({}),{})
check('single',solve({'x':3}),{'x':0})
check('complete tree',solve({'a':1,'b':2,'c':2}),{'a':0,'b':2,'c':3})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Canonical Huffman codes advance without shifting at length changes.

Given valid nonzero Huffman lengths keyed by symbol, return integer codes assigned by ascending (length,symbol), incrementing then left-shifting when length grows. Empty input returns {}.

split: open-access


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

N = 1
observations = []
def solve(values, width):
    return list(values)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('cross byte',solve([N,N,N],3),[(N+8*N+64*N)&255,(N+8*N+64*N)>>8])
check('one bit',solve([1],1),[1])
check('empty',solve([],3),[])
check('byte codes',solve([1,255],8),[1,255])
check('full byte',solve([1,2],4),[33])
check('zero tail',solve([0,1,0],4),[16,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(values, width):
    bits=''.join(format(v,'0'+str(width)+'b') for v in values)
    bits += '0' * ((-len(bits))%8)
    return [int(bits[i:i+8],2) for i in range(0,len(bits),8)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('cross byte',solve([N,N,N],3),[(N+8*N+64*N)&255,(N+8*N+64*N)>>8])
check('one bit',solve([1],1),[1])
check('empty',solve([],3),[])
check('byte codes',solve([1,255],8),[1,255])
check('full byte',solve([1,2],4),[33])
check('zero tail',solve([0,1,0],4),[16,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:
Bit reservoir loses codes that cross byte boundaries.

Pack nonnegative values less than 2**width consecutively least-significant-bit first, yielding integer bytes with zero high padding. Width is 1..8.

split: open-access


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

N = 1
observations = []
def solve(data, count):
    return [(v>>j)&1 for v in data for j in range(8)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('valid zero suffix',solve([1],N+1),[1]+[0]*N)
check('no symbols',solve([],0),[])
check('padding can be set',solve([255],1),[1])
check('whole byte',solve([255],8),[1]*8)
check('all zero symbols',solve([0],3),[0,0,0])
check('cross byte',solve([255,1],9),[1]*9)
print(json.dumps({"observations": observations, "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(data, count):
    bits=[(v>>j)&1 for v in data for j in range(8)]
    while bits and bits[-1]==0: bits.pop()
    return bits
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('valid zero suffix',solve([1],N+1),[1]+[0]*N)
check('no symbols',solve([],0),[])
check('padding can be set',solve([255],1),[1])
check('whole byte',solve([255],8),[1]*8)
check('all zero symbols',solve([0],3),[0,0,0])
check('cross byte',solve([255,1],9),[1]*9)
print(json.dumps({"observations": observations, "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:
Padding bits are decoded as extra compressed symbols.

Decode exactly count one-bit symbols from integer bytes in LSB order. Count is valid and padding is ignored.

split: open-access


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

N = 1
observations = []
def solve(blocks):
    out=[]; previous=0
    for block in blocks:
        row=[]
        for d in block: previous+=d; row.append(previous)
        out.append(row)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reset boundary',solve([[N,1],[2,1]]),[[N,N+1],[2,3]])
check('empty',solve([]),[])
check('empty block',solve([[],[1]]),[[],[1]])
check('negative delta',solve([[3,-2]]),[[3,1]])
check('zero delta',solve([[2,0,0]]),[[2,2,2]])
check('singletons',solve([[2],[3]]),[[2],[3]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(blocks):
    return blocks
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reset boundary',solve([[N,1],[2,1]]),[[N,N+1],[2,3]])
check('empty',solve([]),[])
check('empty block',solve([[],[1]]),[[],[1]])
check('negative delta',solve([[3,-2]]),[[3,1]])
check('zero delta',solve([[2,0,0]]),[[2,2,2]])
check('singletons',solve([[2],[3]]),[[2],[3]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Delta decompression carries a predictor across independent blocks.

Each list is an independent delta-coded block whose predictor starts at zero. Return corresponding lists of prefix sums; empty blocks remain empty.

split: open-access


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

N = 1
observations = []
def solve(last, primary):
    rows=['']*len(last)
    for _ in last: rows=sorted(last[i]+rows[i] for i in range(len(last)))
    return rows[0] if rows else ''
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('middle primary',solve('b'+'a'*N,1),'a'*(N-1)+'ba')
check('banana',solve('nnbaaa',3),'banana')
check('first primary',solve('ba',0),'ab')
check('last primary',solve('ba',1),'ba')
check('empty',solve('',0),'')
check('repeated symbol',solve('aaa',2),'aaa')
print(json.dumps({"observations": observations, "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(last, primary):
    rows=['']*len(last)
    for _ in last: rows=sorted(last[i]+rows[i] for i in range(len(last)))
    return rows[-1] if rows else ''
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('middle primary',solve('b'+'a'*N,1),'a'*(N-1)+'ba')
check('banana',solve('nnbaaa',3),'banana')
check('first primary',solve('ba',0),'ab')
check('last primary',solve('ba',1),'ba')
check('empty',solve('',0),'')
check('repeated symbol',solve('aaa',2),'aaa')
print(json.dumps({"observations": observations, "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:
Burrows-Wheeler inversion ignores the primary row.

Invert a toy BWT by reconstructing sorted rotations from the last column and selecting the supplied zero-based primary row. Empty last column yields empty text.

split: open-access


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

N = 1
observations = []
def solve(alphabet, ranks):
    return ''.join(alphabet[i] for i in ranks)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeat front',solve('abc',[2]+[0]*N),'c'*(N+1))
check('empty',solve('abc',[]),'')
check('first',solve('abc',[0]),'a')
check('middle twice',solve('abc',[1,1]),'ba')
check('last twice',solve('abc',[2,2]),'cb')
check('single alphabet',solve('x',[0,0]),'xx')
print(json.dumps({"observations": observations, "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(alphabet, ranks):
    a=list(alphabet); out=''
    for i in ranks:
        s=a.pop(i); out+=s; a.append(s)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeat front',solve('abc',[2]+[0]*N),'c'*(N+1))
check('empty',solve('abc',[]),'')
check('first',solve('abc',[0]),'a')
check('middle twice',solve('abc',[1,1]),'ba')
check('last twice',solve('abc',[2,2]),'cb')
check('single alphabet',solve('x',[0,0]),'xx')
print(json.dumps({"observations": observations, "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:
Move-to-front decoder updates the wrong position.

Decode valid ranks against a unique-symbol alphabet; emit selected symbol and move it to the front after each selection.

split: open-access


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

N = 1
observations = []
def solve(symbol, count, limit):
    return [[min(count,limit),symbol]] if count else []
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('overflow',solve('a',2*N+1,N),[[N,'a'],[N,'a'],[1,'a']] if N>1 else [[1,'a']]*3)
check('exact multiple',solve('x',6,3),[[3,'x'],[3,'x']])
check('empty',solve('x',0,3),[])
check('under limit',solve('x',2,3),[[2,'x']])
check('one packet',solve('x',3,3),[[3,'x']])
check('unit limit',solve('b',2,1),[[1,'b'],[1,'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(symbol, count, limit):
    return [[limit,symbol]]*(count//limit)+[[count%limit,symbol]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('overflow',solve('a',2*N+1,N),[[N,'a'],[N,'a'],[1,'a']] if N>1 else [[1,'a']]*3)
check('exact multiple',solve('x',6,3),[[3,'x'],[3,'x']])
check('empty',solve('x',0,3),[])
check('under limit',solve('x',2,3),[[2,'x']])
check('one packet',solve('x',3,3),[[3,'x']])
check('unit limit',solve('b',2,1),[[1,'b'],[1,'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:
Bounded run packets silently discard overflow.

Encode count repetitions as [count,symbol] packets with positive counts no greater than limit. Emit full limit packets then a nonzero remainder; count zero emits no packets.

split: open-access


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

N = 1
observations = []
def solve(hits, armor):
    return max(0, sum(hits)-armor)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('two blocked hits',solve([N,N],N),0)
check('mixed hit cannot heal',solve([0,N+3],N),3)
check('one hit',solve([N+4],N),4)
check('no attacks',solve([],N),0)
check('unarmored',solve([N,2],0),N+2)
check('all hits blocked',solve([0,N-1],N),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(hits, armor):
    return max(0, sum(h-armor for h in hits))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('two blocked hits',solve([N,N],N),0)
check('mixed hit cannot heal',solve([0,N+3],N),3)
check('one hit',solve([N+4],N),4)
check('no attacks',solve([],N),0)
check('unarmored',solve([N,2],0),N+2)
check('all hits blocked',solve([0,N-1],N),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:
Combining attacks bypasses per-hit armor.

Nonnegative integer hits and armor: return sum of max(0, hit-armor) for each hit.

split: open-access


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

N = 1
observations = []
def solve(hp_a, hp_b, attack_a, attack_b):
    return [max(0,hp_a-(attack_b if hp_b>attack_a else 0)),max(0,hp_b-attack_a)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mutual defeat',solve(N,N,N,N),[0,0])
check('first fighter lethal',solve(N+3,N,N,1),[N+2,0])
check('second fighter lethal',solve(N,N+3,1,N),[0,N+2])
check('zero attacks',solve(N,N,0,0),[N,N])
check('both survive',solve(N+4,N+5,2,3),[N+1,N+3])
check('overkill clamps',solve(N,N,N+8,N+9),[0,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(hp_a, hp_b, attack_a, attack_b):
    return [max(0,hp_a-attack_b),max(0,hp_b-(attack_a if hp_a>attack_b else 0))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mutual defeat',solve(N,N,N,N),[0,0])
check('first fighter lethal',solve(N+3,N,N,1),[N+2,0])
check('second fighter lethal',solve(N,N+3,1,N),[0,N+2])
check('zero attacks',solve(N,N,0,0),[N,N])
check('both survive',solve(N+4,N+5,2,3),[N+1,N+3])
check('overkill clamps',solve(N,N,N+8,N+9),[0,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:
Sequential combat suppresses a defeated fighter’s committed strike.

Both fighters begin alive with positive HP; nonnegative attack values land simultaneously. Return remaining HP clamped at zero.

split: open-access


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

N = 1
observations = []
def solve(initial, events):
    right=initial
    for e in events:
     if e in ('rook_move','rook_capture','king_move'): right=False
     if e in ('rook_return','king_return'): right=True
    return right
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rook returns',solve(True,['rook_move']+['other']*N+['rook_return']),False)
check('king moved',solve(True,['king_move']),False)
check('king returns',solve(True,['king_move','king_return']),False)
check('captured original rook',solve(True,['rook_capture','rook_return']),False)
check('unrelated moves',solve(True,['other']*N),True)
check('absent initial right',solve(False,[]),False)
check('cannot acquire rights',solve(False,['rook_return']),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(initial, events):
    return initial and not any(e in ('rook_move','rook_capture') for e in events)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rook returns',solve(True,['rook_move']+['other']*N+['rook_return']),False)
check('king moved',solve(True,['king_move']),False)
check('king returns',solve(True,['king_move','king_return']),False)
check('captured original rook',solve(True,['rook_capture','rook_return']),False)
check('unrelated moves',solve(True,['other']*N),True)
check('absent initial right',solve(False,[]),False)
check('cannot acquire rights',solve(False,['rook_return']),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:
Returning a rook restores a forfeited castling right.

Given initial right and event strings rook_move, rook_return, rook_capture, king_move, king_return, other, return whether this side retains castling rights; no board attack/path checks are modeled.

split: open-access


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

N = 1
observations = []
def solve(events):
    r=d=0
    for kind,n in events:
     if kind=='apply': r+=n
     elif r>0: d+=1; r-=1
    return [d,r]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('short refresh',solve([['apply',N+3],['apply',1]]),[0,N+3])
check('long refresh',solve([['apply',1],['apply',N+3]]),[0,N+3])
check('expiration',solve([['apply',N]]+[['tick',0]]*(N+2)),[N,0])
check('empty',solve([]),[0,0])
check('zero refresh',solve([['apply',N],['apply',0]]),[0,N])
check('partial duration',solve([['apply',N+2],['tick',0]]),[1,N+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(events):
    r=d=0
    for kind,n in events:
     if kind=='apply': r=n
     elif r>0: d+=1; r-=1
    return [d,r]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('short refresh',solve([['apply',N+3],['apply',1]]),[0,N+3])
check('long refresh',solve([['apply',1],['apply',N+3]]),[0,N+3])
check('expiration',solve([['apply',N]]+[['tick',0]]*(N+2)),[N,0])
check('empty',solve([]),[0,0])
check('zero refresh',solve([['apply',N],['apply',0]]),[0,N])
check('partial duration',solve([['apply',N+2],['tick',0]]),[1,N+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:
Reapplying poison extends a nonstacking effect additively.

Events are [apply,duration] or [tick,0]. Durations are nonnegative. Return [poison damage ticks,remaining duration]; refresh is nonstacking and never shortens.

split: open-access


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

N = 1
observations = []
def solve(alive, current, bonus):
    return current if bonus else next((i for i in [(current+d)%len(alive) for d in range(1,len(alive)+1)] if alive[i]),None)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('dead bonus owner',solve([False]+[True]*N,0,True),1)
check('live bonus owner',solve([True,True],0,True),0)
check('normal next',solve([True,True],0,False),1)
check('skip dead players',solve([True]+[False]*N+[True],0,False),N+1)
check('wrap',solve([True,False,True],2,False),0)
check('no survivors',solve([False]*N,0,True),None)
check('sole survivor',solve([True],0,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

N = 1
observations = []
def solve(alive, current, bonus):
    return next((i for i in [(current+d)%len(alive) for d in range(1,len(alive)+1)] if alive[i]),None)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('dead bonus owner',solve([False]+[True]*N,0,True),1)
check('live bonus owner',solve([True,True],0,True),0)
check('normal next',solve([True,True],0,False),1)
check('skip dead players',solve([True]+[False]*N+[True],0,False),N+1)
check('wrap',solve([True,False,True],2,False),0)
check('no survivors',solve([False]*N,0,True),None)
check('sole survivor',solve([True],0,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:
A queued bonus turn schedules an eliminated player.

Alive is a nonempty bool list, current a valid index, bonus bool. Return current for an eligible bonus, otherwise next alive index circularly, or None if no survivors.

split: open-access


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

N = 1
observations = []
def solve(board):
    if all('.' not in row for row in board): return 'draw'
    lines=list(board)+[''.join(board[r][c] for r in range(3)) for c in range(3)]+[''.join(board[i][i] for i in range(3)),''.join(board[i][2-i] for i in range(3))]
    return next((s[0] for s in lines if s in ('XXX','OOO')),'playing')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
p='X' if N%2 else 'O'
check('last square completes row',solve(['XXX','OOX','OXO']),'X')
check('column winner',solve([p+'..',p+'..',p+'..']),p)
check('main diagonal',solve(['X..','.X.','..X']),'X')
check('other diagonal',solve(['..O','.O.','O..']),'O')
check('draw',solve(['XOX','XOO','OXX']),'draw')
check('empty',solve(['...','...','...']),'playing')
check('unfinished',solve(['X..','...','...']),'playing')
print(json.dumps({"observations": observations, "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(board):
    for s in board:
     if s in ('XXX','OOO'): return s[0]
    return 'draw' if all('.' not in row for row in board) else 'playing'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
p='X' if N%2 else 'O'
check('last square completes row',solve(['XXX','OOX','OXO']),'X')
check('column winner',solve([p+'..',p+'..',p+'..']),p)
check('main diagonal',solve(['X..','.X.','..X']),'X')
check('other diagonal',solve(['..O','.O.','O..']),'O')
check('draw',solve(['XOX','XOO','OXX']),'draw')
check('empty',solve(['...','...','...']),'playing')
check('unfinished',solve(['X..','...','...']),'playing')
print(json.dumps({"observations": observations, "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 full winning board is classified as a draw.

Return X or O for the sole winner on a 3x3 board of X/O/dot; otherwise draw if full, playing if not. Inputs never have both winners.

split: open-access