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

N = 1
observations = []
def solve(lists, offset):
    scores={}
    for hits in lists:
        for ident,score in hits: scores[ident]=scores.get(ident,0)+score
    return sorted(scores,key=lambda ident:(-scores[ident],ident))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('scale irrelevant', solve([[['a',N],['b',1000*N]],[['b',N]]],1),['b','a'])
check('one versus two deep ranks', solve([[['a',100],['x',2],['b',1]],[['y',5],['z',4],['b',1]]],1),['a','b','y','x','z'])
check('lexical ties', solve([[['z',N]],[['a',2*N]]],2),['a','z'])
check('empty lists', solve([[],[]],N),[])
check('single list rank order', solve([[['z',1],['a',100]]],N),['z','a'])
check('same document two lists', solve([[['a',0]],[['a',0]]],N),['a'])
print(json.dumps({"observations": observations, "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(lists, offset):
    from fractions import Fraction
    scores={}
    for hits in lists:
        for rank,(ident,score) in enumerate(hits): scores[ident]=scores.get(ident,0)+Fraction(1,offset+rank)
    return sorted(scores,key=lambda ident:(-scores[ident],ident))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('scale irrelevant', solve([[['a',N],['b',1000*N]],[['b',N]]],1),['b','a'])
check('one versus two deep ranks', solve([[['a',100],['x',2],['b',1]],[['y',5],['z',4],['b',1]]],1),['a','b','y','x','z'])
check('lexical ties', solve([[['z',N]],[['a',2*N]]],2),['a','z'])
check('empty lists', solve([[],[]],N),[])
check('single list rank order', solve([[['z',1],['a',100]]],N),['z','a'])
check('same document two lists', solve([[['a',0]],[['a',0]]],N),['a'])
print(json.dumps({"observations": observations, "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:
Rank fusion uses incomparable raw scores.

Each input list contains unique [id,score] hits in ranked order. Fuse by sum(1/(offset+rank)) using one-based rank; return IDs descending by exact rational fused score, lexical ties. Offset is a positive integer.

split: open-access


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

N = 1
observations = []
def solve(hits, k):
    return [h[0] for h in sorted(hits,key=lambda h:(-h[1],h[0]))[:k] if h[2]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('deep eligible hit', solve([[str(i),100-i,False] for i in range(N+3)]+[['ok',0,True]],1),['ok'])
check('eligible score order', solve([['b',N,True],['a',N+1,True]],2),['a','b'])
check('score ties', solve([['b',N,True],['a',N,True]],1),['a'])
check('zero limit', solve([['a',N,True]],0),[])
check('empty candidates', solve([],N),[])
check('all rejected', solve([['a',N,False]],1),[])
check('short page exhausted', solve([['a',N,True]],5),['a'])
print(json.dumps({"observations": observations, "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(hits, k):
    return [h[0] for h in sorted(hits,key=lambda h:(-h[1],h[0]))[:2*k] if h[2]][:k]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('deep eligible hit', solve([[str(i),100-i,False] for i in range(N+3)]+[['ok',0,True]],1),['ok'])
check('eligible score order', solve([['b',N,True],['a',N+1,True]],2),['a','b'])
check('score ties', solve([['b',N,True],['a',N,True]],1),['a'])
check('zero limit', solve([['a',N,True]],0),[])
check('empty candidates', solve([],N),[])
check('all rejected', solve([['a',N,False]],1),[])
check('short page exhausted', solve([['a',N,True]],5),['a'])
print(json.dumps({"observations": observations, "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:
Filtered search returns an underfilled result page.

Hits are [id,score,eligible], IDs unique. Return the highest ranked k eligible IDs with lexical score ties; k is nonnegative.

split: open-access


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

N = 1
observations = []
def solve(records, term):
    return sorted({ident for ident,revision,tokens in records if term in tokens})
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('replacement removes term', solve([['a',N,['x']],['a',N+1,[]]],'x'),[])
check('replacement adds term', solve([['a',N,[]],['a',N+1,['x']]],'x'),['a'])
check('out of order revisions', solve([['a',N+1,[]],['a',N,['x']]],'x'),[])
check('separate documents', solve([['b',N,['x']],['a',N,['x']]],'x'),['a','b'])
check('unrelated term', solve([['a',N,['y']]],'x'),[])
check('empty index', solve([],'x'),[])
check('unchanged term', solve([['a',N,['x']],['a',N+1,['x']]],'x'),['a'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(records, term):
    latest={}
    for ident,revision,tokens in records:
        if term in tokens and (ident not in latest or revision>latest[ident]): latest[ident]=revision
    return sorted(latest)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('replacement removes term', solve([['a',N,['x']],['a',N+1,[]]],'x'),[])
check('replacement adds term', solve([['a',N,[]],['a',N+1,['x']]],'x'),['a'])
check('out of order revisions', solve([['a',N+1,[]],['a',N,['x']]],'x'),[])
check('separate documents', solve([['b',N,['x']],['a',N,['x']]],'x'),['a','b'])
check('unrelated term', solve([['a',N,['y']]],'x'),[])
check('empty index', solve([],'x'),[])
check('unchanged term', solve([['a',N,['x']],['a',N+1,['x']]],'x'),['a'])
print(json.dumps({"observations": observations, "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:
Old document versions remain searchable after replacement.

Records are [id,revision,tokens], with unique id/revision pairs. Return sorted IDs whose greatest-revision record contains the term. Record order is arbitrary.

split: open-access


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

N = 1
observations = []
def solve(docs, selection, facet):
    counts={}
    for d in docs:
        if all(not vals or d.get(key) in vals for key,vals in selection.items()) and facet in d: counts[d[facet]]=counts.get(d[facet],0)+1
    return sorted([v,c] for v,c in counts.items())
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
docs=[{'color':'red','size':'s'}]*N+[{'color':'blue','size':'s'},{'color':'green','size':'l'}]
check('keep other filters', solve(docs,{'color':['red'],'size':['s']},'color'),[['blue',1],['red',N]])
check('no filters', solve(docs,{},'color'),[['blue',1],['green',1],['red',N]])
check('self filter only', solve(docs,{'color':['red']},'color'),[['blue',1],['green',1],['red',N]])
check('no matching other field', solve(docs,{'size':['xx']},'color'),[])
check('missing facet ignored', solve([{'size':'s'}],{},'color'),[])
check('empty docs', solve([],{},'color'),[])
check('empty selection unrestricted', solve(docs,{'size':[]},'color'),[['blue',1],['green',1],['red',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(docs, selection, facet):
    counts={}
    for d in docs:
        if facet in d: counts[d[facet]]=counts.get(d[facet],0)+1
    return sorted([v,c] for v,c in counts.items())
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
docs=[{'color':'red','size':'s'}]*N+[{'color':'blue','size':'s'},{'color':'green','size':'l'}]
check('keep other filters', solve(docs,{'color':['red'],'size':['s']},'color'),[['blue',1],['red',N]])
check('no filters', solve(docs,{},'color'),[['blue',1],['green',1],['red',N]])
check('self filter only', solve(docs,{'color':['red']},'color'),[['blue',1],['green',1],['red',N]])
check('no matching other field', solve(docs,{'size':['xx']},'color'),[])
check('missing facet ignored', solve([{'size':'s'}],{},'color'),[])
check('empty docs', solve([],{},'color'),[])
check('empty selection unrestricted', solve(docs,{'size':[]},'color'),[['blue',1],['green',1],['red',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:
Active facet selection hides alternative facet counts.

Documents map single-valued dimensions to strings. Selection maps dimensions to allowed values; empty selections impose no constraint. Count requested facet values after all other selected dimensions. Return sorted [value,count] pairs.

split: open-access


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

N = 1
observations = []
def solve(terms, prefix, k):
    return [t for t in sorted(set(terms))[:k] if t.startswith(prefix)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
p='z'+str(N)
check('matching terms past budget', solve(['a','b',p+'b',p+'a'],p,1),[p+'a'])
check('interior false match', solve(['a'+p,p+'x'],p,3),[p+'x'])
check('duplicate dictionary entries', solve([p,p,p+'x'],p,3),[p,p+'x'])
check('empty prefix', solve(['b','a'],'',2),['a','b'])
check('zero budget', solve([p],p,0),[])
check('empty dictionary', solve([],p,3),[])
check('exact token is prefix match', solve([p],p,1),[p])
print(json.dumps({"observations": observations, "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(terms, prefix, k):
    return sorted({t for t in terms if prefix in t})[:k]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
p='z'+str(N)
check('matching terms past budget', solve(['a','b',p+'b',p+'a'],p,1),[p+'a'])
check('interior false match', solve(['a'+p,p+'x'],p,3),[p+'x'])
check('duplicate dictionary entries', solve([p,p,p+'x'],p,3),[p,p+'x'])
check('empty prefix', solve(['b','a'],'',2),['a','b'])
check('zero budget', solve([p],p,0),[])
check('empty dictionary', solve([],p,3),[])
check('exact token is prefix match', solve([p],p,1),[p])
print(json.dumps({"observations": observations, "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:
Prefix expansion applies its budget before finding matching terms.

For an arbitrary token dictionary return at most k distinct lexical terms beginning with prefix. Empty prefix matches all terms; k is nonnegative.

split: open-access


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

N = 1
observations = []
def solve(axis, rows):
    return [r[1] for r in rows][:len(axis)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reversed specimen axis', solve(['b','a'], [('a',N),('b',N+4)]), [N+4,N])
check('missing specimen', solve(['x','a'], [('a',N)]), [None,N])
check('empty axis', solve([], [('a',N)]), [])
check('empty measurements', solve(['a'], []), [None])
check('repeated requested specimen', solve(['a','a'], [('a',N)]), [N,N])
check('irrelevant measurement', solve(['a'], [('z',0),('a',N)]), [N])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(axis, rows):
    d = dict(rows)
    return [d.get(k) for k in sorted(axis)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reversed specimen axis', solve(['b','a'], [('a',N),('b',N+4)]), [N+4,N])
check('missing specimen', solve(['x','a'], [('a',N)]), [None,N])
check('empty axis', solve([], [('a',N)]), [])
check('empty measurements', solve(['a'], []), [None])
check('repeated requested specimen', solve(['a','a'], [('a',N)]), [N,N])
check('irrelevant measurement', solve(['a'], [('z',0),('a',N)]), [N])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Sorting measurements separately reassigns sample values.

For unique measurement IDs, return values in requested ID order, with None for missing IDs.

split: open-access


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

N = 1
observations = []
def solve(left, right):
    return {'paired': sorted(left[:min(len(left),len(right))]), 'orphans': []}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
a='read'+str(N)
check('same size different mates', solve([a,'b'], [a,'c']), {'paired':[a], 'orphans':['b','c']})
check('reordered mates', solve(['b',a], [a,'b']), {'paired':sorted(['b',a]), 'orphans':[]})
check('left orphan', solve([a,'b'], [a]), {'paired':[a], 'orphans':['b']})
check('right orphan', solve([a], [a,'b']), {'paired':[a], 'orphans':['b']})
check('no reads', solve([], []), {'paired':[], 'orphans':[]})
check('no overlap', solve(['a'], ['b']), {'paired':[], 'orphans':['a','b']})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(left, right):
    return {'paired': sorted(left) if len(left)==len(right) else [], 'orphans': sorted(set(left)^set(right))}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
a='read'+str(N)
check('same size different mates', solve([a,'b'], [a,'c']), {'paired':[a], 'orphans':['b','c']})
check('reordered mates', solve(['b',a], [a,'b']), {'paired':sorted(['b',a]), 'orphans':[]})
check('left orphan', solve([a,'b'], [a]), {'paired':[a], 'orphans':['b']})
check('right orphan', solve([a], [a,'b']), {'paired':[a], 'orphans':['b']})
check('no reads', solve([], []), {'paired':[], 'orphans':[]})
check('no overlap', solve(['a'], ['b']), {'paired':[], 'orphans':['a','b']})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Equal read counts hide mismatched mate identities.

Each mate stream has unique read IDs; return paired intersection and symmetric-difference orphan IDs as sorted lists.

split: open-access


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

N = 1
observations = []
def solve(sample, parents):
    return parents.get(sample, sample)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
root='specimen'+str(N)
check('three preparation steps', solve('c', {'c':'b','b':'a','a':root}), root)
check('source specimen', solve(root, {}), root)
check('single aliquot', solve('a', {'a':root}), root)
check('two aliquots', solve('b', {'b':'a','a':root}), root)
check('self cycle', solve('a', {'a':'a'}), 'cycle')
check('multi tube cycle', solve('a', {'a':'b','b':'a'}), 'cycle')
print(json.dumps({"observations": observations, "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(sample, parents):
    return parents.get(parents.get(sample,sample),parents.get(sample,sample))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
root='specimen'+str(N)
check('three preparation steps', solve('c', {'c':'b','b':'a','a':root}), root)
check('source specimen', solve(root, {}), root)
check('single aliquot', solve('a', {'a':root}), root)
check('two aliquots', solve('b', {'b':'a','a':root}), root)
check('self cycle', solve('a', {'a':'a'}), 'cycle')
check('multi tube cycle', solve('a', {'a':'b','b':'a'}), 'cycle')
print(json.dumps({"observations": observations, "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 aliquot is credited to its immediate tube instead of its specimen.

Return the root ID for an acyclic parent mapping; return cycle if a node repeats. Missing parent means a source root.

split: open-access


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

N = 1
observations = []
def solve(stages):
    return sorted(set(stages))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
s='wash'+str(N)
check('repeat wash after extraction', solve([s,'extract',s]), [s,'extract',s])
check('order preserved', solve(['normalize','filter']), ['normalize','filter'])
check('empty process', solve([]), [])
check('one stage', solve([s]), [s])
check('consecutive passes', solve([s,s]), [s,s])
check('reverse sequence', solve(['z','a','z','b']), ['z','a','z','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(stages):
    return list(dict.fromkeys(stages))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
s='wash'+str(N)
check('repeat wash after extraction', solve([s,'extract',s]), [s,'extract',s])
check('order preserved', solve(['normalize','filter']), ['normalize','filter'])
check('empty process', solve([]), [])
check('one stage', solve([s]), [s])
check('consecutive passes', solve([s,s]), [s,s])
check('reverse sequence', solve(['z','a','z','b']), ['z','a','z','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:
A provenance fingerprint erases processing order.

Return the pipeline stage sequence unchanged as the symbolic provenance fingerprint; order and multiplicity matter.

split: open-access


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

N = 1
observations = []
def solve(observed, manifest):
    return min(manifest.items(),key=lambda item:sum(a!=b for a,b in zip(observed,item[0])))[1] if manifest else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
s='specimen'+str(N)
check('equidistant substitution ambiguous', solve('AAAG', {'AAAA':s,'AAAC':'other'}), None)
check('exact wins over near competitor', solve('AAAA', {'AAAC':'other','AAAA':s}), s)
check('unique single substitution', solve('AAAT', {'AAAA':s,'CCCC':'other'}), s)
check('too many substitutions', solve('AATT', {'AAAA':s}), None)
check('empty manifest', solve('AAAA', {}), None)
check('exact singleton', solve('CCCC', {'CCCC':s}), s)
check('tie independent of manifest ordering', solve('AAAG', {'AAAC':'other','AAAA':s}), 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(observed, manifest):
    near=[sample for barcode,sample in manifest.items() if sum(a!=b for a,b in zip(observed,barcode))<=1]
    return near[0] if len(near)==1 else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
s='specimen'+str(N)
check('equidistant substitution ambiguous', solve('AAAG', {'AAAA':s,'AAAC':'other'}), None)
check('exact wins over near competitor', solve('AAAA', {'AAAC':'other','AAAA':s}), s)
check('unique single substitution', solve('AAAT', {'AAAA':s,'CCCC':'other'}), s)
check('too many substitutions', solve('AATT', {'AAAA':s}), None)
check('empty manifest', solve('AAAA', {}), None)
check('exact singleton', solve('CCCC', {'CCCC':s}), s)
check('tie independent of manifest ordering', solve('AAAG', {'AAAC':'other','AAAA':s}), None)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
An ambiguous observed barcode is attributed to the first listed specimen.

Manifest maps unique equal-length DNA barcode strings to specimen IDs. Observed barcode has the same length. Return the specimen at a unique minimum Hamming distance no greater than one, otherwise None. This controlled substitution-only decoder does not model sequencing error probabilities.

split: open-access


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

N = 1
observations = []
def solve(initial, handoffs):
    return handoffs[-1][1] if handoffs else initial
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
lab='lab'+str(N)
check('later sender mismatch', solve('collector', [('collector',lab),('stranger','archive')]), None)
check('initial sender mismatch', solve('collector', [('stranger',lab)]), None)
check('continuous chain', solve('collector', [('collector',lab),(lab,'archive')]), 'archive')
check('no transfer', solve(lab, []), lab)
check('self transfer', solve(lab, [(lab,lab)]), lab)
check('return to origin', solve('collector', [('collector',lab),(lab,'collector')]), 'collector')
check('invalid middle cannot be healed', solve('collector', [('collector',lab),('other','archive'),('archive',lab)]), 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(initial, handoffs):
    if handoffs and handoffs[0][0]!=initial: return None
    return handoffs[-1][1] if handoffs else initial
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
lab='lab'+str(N)
check('later sender mismatch', solve('collector', [('collector',lab),('stranger','archive')]), None)
check('initial sender mismatch', solve('collector', [('stranger',lab)]), None)
check('continuous chain', solve('collector', [('collector',lab),(lab,'archive')]), 'archive')
check('no transfer', solve(lab, []), lab)
check('self transfer', solve(lab, [(lab,lab)]), lab)
check('return to origin', solve('collector', [('collector',lab),(lab,'collector')]), 'collector')
check('invalid middle cannot be healed', solve('collector', [('collector',lab),('other','archive'),('archive',lab)]), 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 specimen is reported at its destination despite a broken handoff chain.

Given initial specimen holder and chronological [sender,recipient] handoffs, return final holder if every sender equals the preceding holder; otherwise None. Empty history preserves initial holder. Names are nonempty strings; self handoffs are permitted.

split: open-access


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

N = 1
observations = []
def solve(requested, manifest):
    return ['control' if i%2==0 else 'treated' for i,_ in enumerate(requested)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
s='blind'+str(N)
check('reordered processing', solve(['b',s], {s:'control','b':'treated'}), ['treated','control'])
check('subset retains assignment', solve(['b'], {s:'control','b':'treated'}), ['treated'])
check('unknown specimen', solve(['x'], {s:'treated'}), ['unassigned'])
check('empty request', solve([], {s:'treated'}), [])
check('empty manifest', solve([s], {}), ['unassigned'])
check('repeat measurement same treatment', solve([s,s], {s:'treated'}), ['treated','treated'])
print(json.dumps({"observations": observations, "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, manifest):
    return (list(manifest.values())+['unassigned']*len(requested))[:len(requested)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
s='blind'+str(N)
check('reordered processing', solve(['b',s], {s:'control','b':'treated'}), ['treated','control'])
check('subset retains assignment', solve(['b'], {s:'control','b':'treated'}), ['treated'])
check('unknown specimen', solve(['x'], {s:'treated'}), ['unassigned'])
check('empty request', solve([], {s:'treated'}), [])
check('empty manifest', solve([s], {}), ['unassigned'])
check('repeat measurement same treatment', solve([s,s], {s:'treated'}), ['treated','treated'])
print(json.dumps({"observations": observations, "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:
Sorting blinded specimen IDs changes treatment assignment.

Return treatment labels in requested specimen order using the immutable manifest, with unassigned for missing IDs.

split: open-access


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

N = 1
observations = []
def solve(slots):
    return all(slots[i]==slots[i+1] for i in range(0,len(slots),2))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('equal adjacent masses do not oppose', solve([N,N,2*N,2*N]), False)
check('opposed pairs balanced', solve([N,2*N,N,2*N]), True)
check('half sums hide pair mismatch', solve([N,2*N,2*N,N]), False)
check('empty rotor positions', solve([0,0,0,0]), True)
check('two slot rotor', solve([N,N]), True)
check('missing counterweight', solve([N,0]), False)
check('six slot opposed loading', solve([N,2*N,0,N,2*N,0]), 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(slots):
    h=len(slots)//2
    return sum(slots[:h])==sum(slots[h:])
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('equal adjacent masses do not oppose', solve([N,N,2*N,2*N]), False)
check('opposed pairs balanced', solve([N,2*N,N,2*N]), True)
check('half sums hide pair mismatch', solve([N,2*N,2*N,N]), False)
check('empty rotor positions', solve([0,0,0,0]), True)
check('two slot rotor', solve([N,N]), True)
check('missing counterweight', solve([N,0]), False)
check('six slot opposed loading', solve([N,2*N,0,N,2*N,0]), True)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A planned opposed-pair rotor load passes despite unmatched opposite tube masses.

Slots are a nonempty even-length list of nonnegative integer effective tube masses, including adapters; zero means empty. Return whether every slot equals its opposite slot at half the slot count. This deliberately conservative opposed-pair acceptance rule is not a general rotor dynamics or instrument safety model.

split: open-access


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

N = 1
observations = []
def solve(rows):
    out={}
    for condition,donor,aliquot in rows: out[condition]=out.get(condition,0)+1
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
d='donor'+str(N)
check('two aliquots one donor', solve([('c',d,'a'),('c',d,'b')]), {'c':1})
check('repeated assay', solve([('c',d,'a'),('c',d,'a')]), {'c':1})
check('two donors', solve([('c',d,'a'),('c','other','b')]), {'c':2})
check('donor spans conditions', solve([('c',d,'a'),('t',d,'b')]), {'c':1,'t':1})
check('empty experiment', solve([]), {})
check('aliquot names local to donor', solve([('c',d,'a'),('c','other','a')]), {'c':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(rows):
    out={}
    for condition,donor,aliquot in rows: out.setdefault(condition,set()).add(aliquot)
    return {k:len(v) for k,v in out.items()}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
d='donor'+str(N)
check('two aliquots one donor', solve([('c',d,'a'),('c',d,'b')]), {'c':1})
check('repeated assay', solve([('c',d,'a'),('c',d,'a')]), {'c':1})
check('two donors', solve([('c',d,'a'),('c','other','b')]), {'c':2})
check('donor spans conditions', solve([('c',d,'a'),('t',d,'b')]), {'c':1,'t':1})
check('empty experiment', solve([]), {})
check('aliquot names local to donor', solve([('c',d,'a'),('c','other','a')]), {'c':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:
Technical repeats inflate biological replicate counts.

Rows are condition, donor, aliquot tuples; return a dictionary of distinct donor counts per condition, including donors shared across conditions independently.

split: open-access


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

N = 1
observations = []
def solve(history, run):
    return list(history)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
r='run'+str(N)
check('reprocessing records both runs', solve(['raw','filter'], r), ['raw','filter',r])
check('initial processing', solve([], r), [r])
check('same run repeated', solve([r], r), [r,r])
check('one previous run', solve(['raw'], r), ['raw',r])
check('order of ancestors retained', solve(['z','a'], r), ['z','a',r])
h=['raw']
solve(h,r)
check('parent provenance immutable', h, ['raw'])
print(json.dumps({"observations": observations, "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, run):
    return [run]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
r='run'+str(N)
check('reprocessing records both runs', solve(['raw','filter'], r), ['raw','filter',r])
check('initial processing', solve([], r), [r])
check('same run repeated', solve([r], r), [r,r])
check('one previous run', solve(['raw'], r), ['raw',r])
check('order of ancestors retained', solve(['z','a'], r), ['z','a',r])
h=['raw']
solve(h,r)
check('parent provenance immutable', h, ['raw'])
print(json.dumps({"observations": observations, "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 reprocessed artifact retains the previous processing provenance.

Return inherited ordered run IDs followed by the current run ID; repeated run IDs represent separate executions and are retained.

split: open-access


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

N = 1
observations = []
def solve(state, delta, low, high):
    return state + delta
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('upper outward', solve(N, 1, -N, N), N)
check('upper inward', solve(N, -1, -N, N), N-1)
check('lower outward', solve(-N, -1, -N, N), -N)
check('lower inward', solve(-N, 1, -N, N), -N+1)
check('inside reaches edge', solve(0, N, -N, N), N)
check('zero increment', solve(0, 0, -N, 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(state, delta, low, high):
    return state if state >= high or state <= low else state + delta
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('upper outward', solve(N, 1, -N, N), N)
check('upper inward', solve(N, -1, -N, N), N-1)
check('lower outward', solve(-N, -1, -N, N), -N)
check('lower inward', solve(-N, 1, -N, N), -N+1)
check('inside reaches edge', solve(0, N, -N, N), N)
check('zero increment', solve(0, 0, -N, 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:
Saturation continues accumulating outward integral action.

One conditional integration step: reject delta when candidate exceeds high and delta>0, or candidate<low and delta<0; otherwise accept candidate. Bounds are inclusive.

split: open-access


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

N = 1
observations = []
def solve(sp, old_sp, y, old_y, gain):
    return gain*((sp-y)-(old_sp-old_y))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('setpoint only', solve(N, 0, 0, 0, 2), 0)
check('both move', solve(N, 0, N, 0, 2), -2*N)
check('measurement rises', solve(0, 0, N, 0, 3), -3*N)
check('measurement falls', solve(0, 0, 0, N, 3), 3*N)
check('stationary', solve(N, N, N, N, 2), 0)
check('disabled gain', solve(N, 0, N, 0, 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(sp, old_sp, y, old_y, gain):
    return 0 if sp != old_sp else -gain*(y-old_y)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('setpoint only', solve(N, 0, 0, 0, 2), 0)
check('both move', solve(N, 0, N, 0, 2), -2*N)
check('measurement rises', solve(0, 0, N, 0, 3), -3*N)
check('measurement falls', solve(0, 0, 0, N, 3), 3*N)
check('stationary', solve(N, N, N, N, 2), 0)
check('disabled gain', solve(N, 0, N, 0, 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:
A setpoint step produces an unwanted derivative kick.

Return the derivative contribution -gain*(measurement-previous_measurement) for unit sample time, independent of setpoint motion.

split: open-access


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

N = 1
observations = []
def solve(on, value, low, high):
    return value >= high
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('hold on', solve(True, N, 0, 4*N), True)
check('hold off', solve(False, 3*N, 0, 4*N), False)
check('upper equality', solve(False, 4*N, 0, 4*N), True)
check('lower equality', solve(True, 0, 0, 4*N), False)
check('above', solve(False, 5*N, 0, 4*N), True)
check('below', solve(True, -N, 0, 4*N), False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(on, value, low, high):
    return value >= ((low+high)//2 if on else high)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('hold on', solve(True, N, 0, 4*N), True)
check('hold off', solve(False, 3*N, 0, 4*N), False)
check('upper equality', solve(False, 4*N, 0, 4*N), True)
check('lower equality', solve(True, 0, 0, 4*N), False)
check('above', solve(False, 5*N, 0, 4*N), True)
check('below', solve(True, -N, 0, 4*N), False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A relay forgets its state inside the hysteresis band.

Schmitt relay with low<high: boundary equality switches; open interval retains previous boolean output.

split: open-access


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

N = 1
observations = []
def solve(manual, proportional, feedforward):
    return manual
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('all active', solve(10*N, 2*N, N), 7*N)
check('no feedforward', solve(10*N, 2*N, 0), 8*N)
check('negative feedforward', solve(0, N, -2*N), N)
check('negative proportional', solve(N, -N, N), N)
check('zero command', solve(0, N, N), -2*N)
check('all zero', solve(0, 0, 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(manual, proportional, feedforward):
    return manual-proportional
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('all active', solve(10*N, 2*N, N), 7*N)
check('no feedforward', solve(10*N, 2*N, 0), 8*N)
check('negative feedforward', solve(0, N, -2*N), N)
check('negative proportional', solve(N, -N, N), N)
check('zero command', solve(0, N, N), -2*N)
check('all zero', solve(0, 0, 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:
Automatic takeover counts proportional action twice.

On takeover set I so P+I+F exactly equals the previous manual command; return I. No output limits are modeled.

split: open-access


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

N = 1
observations = []
def solve(previous, target, rate, dt):
    return previous + max(-rate, min(rate, target-previous))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rise duration', solve(0, 10*N, N, 3), 3*N)
check('fall duration', solve(10*N, 0, N, 3), 7*N)
check('zero elapsed', solve(N, 0, N, 0), N)
check('no overshoot', solve(0, N, N, 3), N)
check('zero rate', solve(N, 10*N, 0, 3), N)
check('hold', solve(N, N, N, 3), N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(previous, target, rate, dt):
    limit = rate*dt if target >= previous else rate
    return previous + max(-limit, min(limit, target-previous))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rise duration', solve(0, 10*N, N, 3), 3*N)
check('fall duration', solve(10*N, 0, N, 3), 7*N)
check('zero elapsed', solve(N, 0, N, 0), N)
check('no overshoot', solve(0, N, N, 3), N)
check('zero rate', solve(N, 10*N, 0, 3), N)
check('hold', solve(N, N, N, 3), N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A command limiter ignores elapsed sample duration.

With nonnegative integer rate and dt, move from previous toward target by at most rate*dt, without overshoot.

split: open-access


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

N = 1
observations = []
def solve(duty, scale, ticks):
    return [int(duty >= scale)]*ticks
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('two thirds', solve(2*N, 3*N, 6), [0,1,1,0,1,1])
check('half duty', solve(N, 2*N, 6), [0,1,0,1,0,1])
check('off', solve(0, N, 4), [0,0,0,0])
check('full', solve(N, N, 4), [1,1,1,1])
check('no ticks', solve(N, 2*N, 0), [])
check('first credit', solve(N, 3*N, 2), [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(duty, scale, ticks):
    credit=0
    out=[]
    for _ in range(ticks):
        credit += duty
        pulse=int(credit>=scale)
        if pulse: credit=0
        out.append(pulse)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('two thirds', solve(2*N, 3*N, 6), [0,1,1,0,1,1])
check('half duty', solve(N, 2*N, 6), [0,1,0,1,0,1])
check('off', solve(0, N, 4), [0,0,0,0])
check('full', solve(N, N, 4), [1,1,1,1])
check('no ticks', solve(N, 2*N, 0), [])
check('first credit', solve(N, 3*N, 2), [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:
Duty modulation discards fractional pulse credit.

Given duty in [0,scale], positive scale and tick count, start credit zero; add duty each tick and emit 1 iff credit>=scale then subtract scale. Return the pulse list.

split: open-access


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

N = 1
observations = []
def solve(x, d):
    return 0 if abs(x)<=d else x
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('positive beyond', solve(3*N, N), 2*N)
check('negative beyond', solve(-3*N, N), -2*N)
check('positive edge', solve(N, N), 0)
check('negative edge', solve(-N, N), 0)
check('center', solve(0, N), 0)
check('zero width', solve(-N, 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(x, d):
    return 0 if abs(x)<=d else x-d
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('positive beyond', solve(3*N, N), 2*N)
check('negative beyond', solve(-3*N, N), -2*N)
check('positive edge', solve(N, N), 0)
check('negative edge', solve(-N, N), 0)
check('center', solve(0, N), 0)
check('zero width', solve(-N, 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:
Removing a dead zone creates a command discontinuity.

For symmetric nonnegative width d, output zero for abs(x)<=d, otherwise sign(x)*(abs(x)-d). This is an unscaled integer dead-zone model.

split: open-access


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

N = 1
observations = []
def solve(on, last, desired, now, dwell):
    return [desired if now-last>=dwell else on, now]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('blocked request', solve(False, N, True, N+1, 3), [False,N])
check('redundant late', solve(False, N, False, N+5, 3), [False,N])
check('exact dwell', solve(False, N, True, N+3, 3), [True,N+3])
check('switch off', solve(True, N, False, N+4, 3), [False,N+4])
check('zero dwell', solve(False, N, True, N, 0), [True,N])
check('same instant unchanged', solve(True, N, True, N, 0), [True,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(on, last, desired, now, dwell):
    return [desired if now-last>=dwell else on, now if desired==on or now-last>=dwell else last]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('blocked request', solve(False, N, True, N+1, 3), [False,N])
check('redundant late', solve(False, N, False, N+5, 3), [False,N])
check('exact dwell', solve(False, N, True, N+3, 3), [True,N+3])
check('switch off', solve(True, N, False, N+4, 3), [False,N+4])
check('zero dwell', solve(False, N, True, N, 0), [True,N])
check('same instant unchanged', solve(True, N, True, N, 0), [True,N])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A blocked switching request restarts the dwell timer.

State is (on,last_switch). At integer now>=last_switch, accept a different desired state iff now-last_switch>=dwell; redundant or blocked requests preserve both fields.

split: open-access


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

N = 1
observations = []
def solve(feedback, feedforward, low, high):
    return max(low,min(high,feedback))+feedforward
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('upper overflow', solve(N, N, -N, N), N)
check('cancel large terms', solve(3*N, -2*N, -N, N), N)
check('lower overflow', solve(-N, -N, -N, N), -N)
check('reverse cancel', solve(-3*N, 2*N, -N, N), -N)
check('zero', solve(0, 0, -N, N), 0)
check('within', solve(N, -N, -2*N, 2*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(feedback, feedforward, low, high):
    return max(low,min(high,max(low,min(high,feedback))+max(low,min(high,feedforward))))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('upper overflow', solve(N, N, -N, N), N)
check('cancel large terms', solve(3*N, -2*N, -N, N), N)
check('lower overflow', solve(-N, -N, -N, N), -N)
check('reverse cancel', solve(-3*N, 2*N, -N, N), -N)
check('zero', solve(0, 0, -N, N), 0)
check('within', solve(N, -N, -2*N, 2*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:
Feedforward escapes the actuator command limit.

Return clamp(feedback+feedforward,low,high) for low<=high; individual terms may exceed bounds.

split: open-access


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

N = 1
observations = []
def solve(queue, command):
    return [command, queue[1:]+[command]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('single delay', solve([0], N), [0,[N]])
check('two delay', solve([N,2*N], 3*N), [N,[2*N,3*N]])
check('negative history', solve([-N,0], N), [-N,[0,N]])
check('zero command', solve([N], 0), [N,[0]])
check('constant stream', solve([N,N], N), [N,[N,N]])
check('long queue', solve([N,0,-N], 2*N), [N,[0,-N,2*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(queue, command):
    updated=queue[1:]+[command]
    return [updated[0],updated]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('single delay', solve([0], N), [0,[N]])
check('two delay', solve([N,2*N], 3*N), [N,[2*N,3*N]])
check('negative history', solve([-N,0], N), [-N,[0,N]])
check('zero command', solve([N], 0), [N,[0]])
check('constant stream', solve([N,N], N), [N,[N,N]])
check('long queue', solve([N,0,-N], 2*N), [N,[0,-N,2*N]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A sampled command delay reads newly written input too early.

A nonempty queue stores pending oldest-first delayed commands; return [output,new_queue] after one tick. Its length is the exact integer sample delay.

split: open-access


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

N = 1
observations = []
def solve(old, trial, slope, alpha, c):
    return trial < old
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('weak decrease', solve(10*N, 9*N, -10*N, 1, 0.5), False)
check('exact sufficient decrease', solve(10*N, 5*N, -10*N, 1, 0.5), True)
check('strong decrease', solve(10, 1, -2, 1, 0.5), True)
check('uphill direction', solve(10, 11, 4, 1, 0.5), False)
check('zero direction', solve(10, 10, 0, 1, 0.5), False)
check('short step', solve(10, 9, -4, 0.5, 0.5), 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(old, trial, slope, alpha, c):
    return trial <= old+c*alpha*slope
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('weak decrease', solve(10*N, 9*N, -10*N, 1, 0.5), False)
check('exact sufficient decrease', solve(10*N, 5*N, -10*N, 1, 0.5), True)
check('strong decrease', solve(10, 1, -2, 1, 0.5), True)
check('uphill direction', solve(10, 11, 4, 1, 0.5), False)
check('zero direction', solve(10, 10, 0, 1, 0.5), False)
check('short step', solve(10, 9, -4, 0.5, 0.5), 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:
Line search accepts decrease without sufficient decrease.

For positive alpha and 0<c<1, accept exactly when slope<0 and trial<=old+c*alpha*slope.

split: open-access


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

N = 1
observations = []
def solve(x, g, lo, hi):
    return g == 0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('lower optimum', solve(0, N, 0, 10), True)
check('lower needs inward step', solve(0, -N, 0, 10), False)
check('upper optimum', solve(10, -N, 0, 10), True)
check('upper needs inward step', solve(10, N, 0, 10), False)
check('interior stationary', solve(5, 0, 0, 10), True)
check('interior moving', solve(5, 1, 0, 10), False)
check('singleton feasible set', solve(3, -N, 3, 3), 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(x, g, lo, hi):
    return g == 0 or x == lo or x == hi
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('lower optimum', solve(0, N, 0, 10), True)
check('lower needs inward step', solve(0, -N, 0, 10), False)
check('upper optimum', solve(10, -N, 0, 10), True)
check('upper needs inward step', solve(10, N, 0, 10), False)
check('interior stationary', solve(5, 0, 0, 10), True)
check('interior moving', solve(5, 1, 0, 10), False)
check('singleton feasible set', solve(3, -N, 3, 3), 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:
Bound constrained termination rejects a valid boundary optimum.

Given feasible scalar x and lo<=hi, return whether the unit-step projected gradient mapping is exactly zero.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(s, y):
    return sum(a*b for a,b in zip(s,y)) != 0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('negative pair', solve([N], [-1]), False)
check('positive pair', solve([N], [1]), True)
check('zero step', solve([0], [N]), False)
check('orthogonal', solve([1,0], [0,N]), False)
check('cancellation', solve([1,1], [N,-N]), False)
check('mixed positive', solve([1,2], [-N,N]), True)
check('mixed negative', solve([2,1], [-N,N]), False)
check('overflow cancellation retains positive curvature', solve([1e308,1e308,N],[2.0,-2.0,1.0]), True)
check('overflow cancellation retains negative curvature', solve([1e308,1e308,N],[2.0,-2.0,-1.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
from fractions import Fraction
N = 1
observations = []
def solve(s, y):
    return abs(sum(a*b for a,b in zip(s,y))) > 0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('negative pair', solve([N], [-1]), False)
check('positive pair', solve([N], [1]), True)
check('zero step', solve([0], [N]), False)
check('orthogonal', solve([1,0], [0,N]), False)
check('cancellation', solve([1,1], [N,-N]), False)
check('mixed positive', solve([1,2], [-N,N]), True)
check('mixed negative', solve([2,1], [-N,N]), False)
check('overflow cancellation retains positive curvature', solve([1e308,1e308,N],[2.0,-2.0,1.0]), True)
check('overflow cancellation retains negative curvature', solve([1e308,1e308,N],[2.0,-2.0,-1.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:
Quasi Newton update admits nonpositive curvature.

Return whether a finite Python integer/float vector pair may enter an undamped BFGS update under the strict curvature condition s dot y>0, evaluated exactly for the represented inputs; equal vector lengths are assumed.

split: open-access


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

N = 1
observations = []
def solve(lower, incumbent, feasible):
    return lower >= incumbent
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('infeasible estimate', solve(10*N, N, False), False)
check('equal bound', solve(N, N, True), True)
check('strictly dominated', solve(N+1, N, True), True)
check('possible improvement', solve(N-1, N, True), False)
check('negative objectives', solve(-N, -N-1, True), True)
check('infeasible equal', solve(N, N, False), 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(lower, incumbent, feasible):
    return feasible and lower > incumbent
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('infeasible estimate', solve(10*N, N, False), False)
check('equal bound', solve(N, N, True), True)
check('strictly dominated', solve(N+1, N, True), True)
check('possible improvement', solve(N-1, N, True), False)
check('negative objectives', solve(-N, -N-1, True), True)
check('infeasible equal', solve(N, N, False), 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:
Branch and bound prunes against an infeasible incumbent.

Minimization, one optimum required: prune iff incumbent is feasible and node lower bound>=incumbent objective.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(rows):
    return min(rows, key=lambda r:r[1]/r[2])[0] if rows else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('negative coefficient', solve([(1,N,-1),(2,2*N,1)]), 2)
check('basis tie', solve([(8,2*N,2),(3,N,1)]), 3)
check('strict minimum', solve([(8,3*N,1),(3,N,1)]), 3)
check('unbounded', solve([(1,N,-1)]), None)
check('degenerate tie', solve([(9,0,1),(2,0,2)]), 2)
check('empty tableau', solve([]), None)
check('nearby large ratios remain distinct', solve([(0,2**54+N,1),(1,2**54+N-1,1)]), 1)
check('tiny positive ratio remains distinct from zero', solve([(0,1e-300,1e300),(1,0,1)]), 1)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(rows):
    eligible=[r for r in rows if r[2]>0]
    return min(eligible,key=lambda r:r[1]/r[2])[0] if eligible else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('negative coefficient', solve([(1,N,-1),(2,2*N,1)]), 2)
check('basis tie', solve([(8,2*N,2),(3,N,1)]), 3)
check('strict minimum', solve([(8,3*N,1),(3,N,1)]), 3)
check('unbounded', solve([(1,N,-1)]), None)
check('degenerate tie', solve([(9,0,1),(2,0,2)]), 2)
check('empty tableau', solve([]), None)
check('nearby large ratios remain distinct', solve([(0,2**54+N,1),(1,2**54+N-1,1)]), 1)
check('tiny positive ratio remains distinct from zero', solve([(0,1e-300,1e300),(1,0,1)]), 1)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Simplex leaving row includes nonlimiting coefficients.

Given finite Python integer/float nonnegative RHS values and nonzero pivot coefficients, return basis index of the minimum exact represented rhs/coefficient over positive coefficients; tie by smallest basis index; None means unbounded.

split: open-access


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

N = 1
observations = []
def solve(residual, old_residual, direction, beta):
    return [r-o+beta*p for r,o,p in zip(residual,old_residual,direction)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nonzero history', solve([N], [2*N], [4*N], 0.5), [3*N])
check('restart', solve([N,-N], [1,1], [9,9], 0), [N,-N])
check('zero residual', solve([0], [N], [2*N], 0.5), [N])
check('orthogonal coordinates', solve([N,0], [0,N], [0,2*N], 0.5), [N,N])
check('negative direction', solve([N], [N], [-2*N], 1), [-N])
check('empty vectors', solve([], [], [], 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(residual, old_residual, direction, beta):
    return [-r+beta*p for r,p in zip(residual,direction)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nonzero history', solve([N], [2*N], [4*N], 0.5), [3*N])
check('restart', solve([N,-N], [1,1], [9,9], 0), [N,-N])
check('zero residual', solve([0], [N], [2*N], 0.5), [N])
check('orthogonal coordinates', solve([N,0], [0,N], [0,2*N], 0.5), [N,N])
check('negative direction', solve([N], [N], [-2*N], 1), [-N])
check('empty vectors', solve([], [], [], 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:
Conjugate gradient search direction uses the residual delta.

Return one CG direction vector given residual b-Ax, old direction and nonnegative beta; lengths agree.

split: open-access


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

N = 1
observations = []
def solve(actual, predicted, eta):
    return actual > 0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('model increase', solve(N, -N, 0.5), False)
check('poor agreement', solve(N, 10*N, 0.5), False)
check('threshold', solve(N, 2*N, 0.5), True)
check('good agreement', solve(2*N, N, 0.5), True)
check('flat model', solve(N, 0, 0.5), False)
check('actual increase', solve(-N, N, 0.5), 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(actual, predicted, eta):
    return predicted != 0 and actual/abs(predicted) >= eta
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('model increase', solve(N, -N, 0.5), False)
check('poor agreement', solve(N, 10*N, 0.5), False)
check('threshold', solve(N, 2*N, 0.5), True)
check('good agreement', solve(2*N, N, 0.5), True)
check('flat model', solve(N, 0, 0.5), False)
check('actual increase', solve(-N, N, 0.5), 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:
Trust region accepts steps with a nondecreasing model.

Accept iff predicted>0 and actual/predicted>=eta, for 0<eta<1; reductions use old-new convention.

split: open-access


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

N = 1
observations = []
def solve(candidates):
    return min(candidates,key=lambda c:c[2]+10*c[1])[0] if candidates else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('feasibility dominates', solve([("a",0,100*N),("b",1,0)]), 'a')
check('infeasible ordering', solve([("a",N,100),("b",2*N,0)]), 'a')
check('objective tiebreak', solve([("a",0,4),("b",0,2)]), 'b')
check('stable ties', solve([("a",N,2),("b",N,2)]), 'a')
check('single candidate', solve([("a",N,-3)]), 'a')
check('no candidates', 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(candidates):
    return min(candidates,key=lambda c:(c[1]>0,c[2]))[0] if candidates else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('feasibility dominates', solve([("a",0,100*N),("b",1,0)]), 'a')
check('infeasible ordering', solve([("a",N,100),("b",2*N,0)]), 'a')
check('objective tiebreak', solve([("a",0,4),("b",0,2)]), 'b')
check('stable ties', solve([("a",N,2),("b",N,2)]), 'a')
check('single candidate', solve([("a",N,-3)]), 'a')
check('no candidates', 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:
Constraint violation is traded away by objective weighting.

Given candidate (name,nonnegative violation,objective) triples, return name minimizing (violation,objective), stable on exact ties; None for empty.

split: open-access


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

N = 1
observations = []
def solve(x, y, a, b):
    return [(a+y)/2,(b+x)/2]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('coupling', solve(0, 0, 4*N, 0), [2*N,N])
check('shifted target', solve(0, 0, 0, 4*N), [0,2*N])
check('initial x discarded', solve(9*N, 0, 0, 0), [0,0])
check('initial y retained', solve(0, 4*N, 0, 0), [2*N,N])
check('fixed point', solve(N,N,N,N), [N,N])
check('signed targets', solve(0,0,-4*N,4*N), [-2*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(x, y, a, b):
    new_y=(b+x)/2
    return [(a+new_y)/2,new_y]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('coupling', solve(0, 0, 4*N, 0), [2*N,N])
check('shifted target', solve(0, 0, 0, 4*N), [0,2*N])
check('initial x discarded', solve(9*N, 0, 0, 0), [0,0])
check('initial y retained', solve(0, 4*N, 0, 0), [2*N,N])
check('fixed point', solve(N,N,N,N), [N,N])
check('signed targets', solve(0,0,-4*N,4*N), [-2*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:
Coordinate descent sweep reads stale coordinates.

For f=(x-a)^2+(y-b)^2+(x-y)^2 perform one exact x-then-y sweep; return [x,y].

split: open-access


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

N = 1
observations = []
def solve(residual, tol, delta, iteration, budget):
    return "converged" if abs(delta)<=tol else ("exhausted" if iteration>=budget else "continue")
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('stagnation with budget', solve(N,0,0,1,10), 'continue')
check('stagnation exhausted', solve(N,0,0,10,10), 'exhausted')
check('residual wins', solve(0,0,N,1,10), 'converged')
check('tolerance boundary', solve(N,N,10*N,10,10), 'converged')
check('unfinished', solve(N,0,N,1,10), 'continue')
check('zero budget', solve(N,0,N,0,0), 'exhausted')
print(json.dumps({"observations": observations, "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(residual, tol, delta, iteration, budget):
    return "converged" if residual<=tol else "exhausted"
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('stagnation with budget', solve(N,0,0,1,10), 'continue')
check('stagnation exhausted', solve(N,0,0,10,10), 'exhausted')
check('residual wins', solve(0,0,N,1,10), 'converged')
check('tolerance boundary', solve(N,N,10*N,10,10), 'converged')
check('unfinished', solve(N,0,N,1,10), 'continue')
check('zero budget', solve(N,0,N,0,0), 'exhausted')
print(json.dumps({"observations": observations, "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:
Iteration exhaustion is reported as convergence.

Nonnegative residual, tolerance, iteration and budget: converged if residual<=tol; otherwise exhausted if iteration>=budget; else continue. Objective delta alone never certifies convergence.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(records, now, window):
    return [i for i,a,r in records if 0 <= now-r <= window]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('delayed stale sample', solve([('a',N,10+N)],10+N,2), [])
check('future clock sample', solve([('a',11+N,10+N)],10+N,2), [])
check('old boundary', solve([('a',8+N,10+N)],10+N,2), ['a'])
check('current acquisition', solve([('a',10+N,10+N)],10+N,0), ['a'])
check('stable order', solve([('b',9+N,10+N),('a',10+N,10+N)],10+N,2), ['b','a'])
check('empty window input', solve([],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
from fractions import Fraction
N = 1
observations = []
def solve(records, now, window):
    return [i for i,a,r in records if now-a <= window]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('delayed stale sample', solve([('a',N,10+N)],10+N,2), [])
check('future clock sample', solve([('a',11+N,10+N)],10+N,2), [])
check('old boundary', solve([('a',8+N,10+N)],10+N,2), ['a'])
check('current acquisition', solve([('a',10+N,10+N)],10+N,0), ['a'])
check('stable order', solve([('b',9+N,10+N),('a',10+N,10+N)],10+N,2), ['b','a'])
check('empty window input', solve([],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:
Delayed sensor samples enter the current fusion window.

Return IDs in input order whose acquisition timestamp is between now-window and now inclusive. Records are (ID, acquired, arrived); window is nonnegative.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(local, offset, reference, tolerance):
    return abs(local-reference) <= tolerance
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fast sensor', solve(10+N,N,10,0), True)
check('slow sensor', solve(10-N,-N,10,0), True)
check('positive boundary', solve(12+N,N,10,2), True)
check('outside association', solve(13+N,N,10,2), False)
check('zero offset', solve(N,0,N,0), True)
check('negative reference time', solve(-10-N,-N,-10,0), 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
from fractions import Fraction
N = 1
observations = []
def solve(local, offset, reference, tolerance):
    return abs(local-abs(offset)-reference) <= tolerance
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fast sensor', solve(10+N,N,10,0), True)
check('slow sensor', solve(10-N,-N,10,0), True)
check('positive boundary', solve(12+N,N,10,2), True)
check('outside association', solve(13+N,N,10,2), False)
check('zero offset', solve(N,0,N,0), True)
check('negative reference time', solve(-10-N,-N,-10,0), 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:
Cross-sensor association rejects simultaneous samples.

Return whether local-offset lies within tolerance of reference; offset equals sensor-local minus reference time and tolerance is nonnegative.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(records):
    return str(sum((Fraction(1,v) for s,q,v in records),Fraction()))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('retransmission', solve([('a',N,2),('a',N,2)]), '1/2')
check('two sensors same sequence', solve([('a',N,2),('b',N,2)]), '1')
check('successive samples', solve([('a',N,2),('a',N+1,2)]), '1')
check('mixed duplicates', solve([('a',N,4),('b',N,4),('a',N,4)]), '1/2')
check('one packet', solve([('a',N,3)]), '1/3')
check('no packet', solve([]), '0')
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(records):
    seen = set(); total = Fraction()
    for s,q,v in records:
        if q not in seen: total += Fraction(1,v); seen.add(q)
    return str(total)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('retransmission', solve([('a',N,2),('a',N,2)]), '1/2')
check('two sensors same sequence', solve([('a',N,2),('b',N,2)]), '1')
check('successive samples', solve([('a',N,2),('a',N+1,2)]), '1')
check('mixed duplicates', solve([('a',N,4),('b',N,4),('a',N,4)]), '1/2')
check('one packet', solve([('a',N,3)]), '1/3')
check('no packet', solve([]), '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:
Retransmission artificially increases measurement information.

Sum inverse variances once per (sensor, sequence), returning a reduced fraction string. Repeated identities have equal positive variance.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(p, r, c):
    return str(Fraction(p*r,p+r))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('positive shared noise', solve(2*N,2*N,N), str(Fraction(3*N,2)))
check('negative correlation', solve(2*N,2*N,-N), str(Fraction(N,2)))
check('independent equal sensors', solve(N,N,0), str(Fraction(N,2)))
check('unequal independent sensors', solve(N,3*N,0), str(Fraction(3*N,4)))
check('unequal shared noise', solve(2*N,5*N,N), str(Fraction(9*N,5)))
check('unequal opposing noise', solve(2*N,5*N,-N), str(N))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(p, r, c):
    return str(Fraction(p*r-c*c,p+r))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('positive shared noise', solve(2*N,2*N,N), str(Fraction(3*N,2)))
check('negative correlation', solve(2*N,2*N,-N), str(Fraction(N,2)))
check('independent equal sensors', solve(N,N,0), str(Fraction(N,2)))
check('unequal independent sensors', solve(N,3*N,0), str(Fraction(3*N,4)))
check('unequal shared noise', solve(2*N,5*N,N), str(Fraction(9*N,5)))
check('unequal opposing noise', solve(2*N,5*N,-N), str(N))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Reported fused uncertainty is smaller than the shared sensor noise.

Given positive p,r and cross covariance c with c*c<p*r and p+r-2*c>0, return exact variance of the minimum-variance unbiased linear combination as a fraction string.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(prior, observed):
    return [str(Fraction(p+(z or 0),2)) for p,z in zip(prior,observed)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('missing y', solve([N,2*N],[3*N,None]), [str(2*N),str(2*N)])
check('observed zero', solve([2*N,4*N],[0,0]), [str(N),str(2*N)])
check('missing x', solve([N,2*N],[None,0]), [str(N),str(N)])
check('both missing', solve([N,-N],[None,None]), [str(N),str(-N)])
check('both observed', solve([N,N],[3*N,5*N]), [str(2*N),str(3*N)])
check('negative observation', solve([N,N],[-3*N,None]), [str(-N),str(N)])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(prior, observed):
    return [str(Fraction(p+z,2)) if z else str(p) for p,z in zip(prior,observed)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('missing y', solve([N,2*N],[3*N,None]), [str(2*N),str(2*N)])
check('observed zero', solve([2*N,4*N],[0,0]), [str(N),str(2*N)])
check('missing x', solve([N,2*N],[None,0]), [str(N),str(N)])
check('both missing', solve([N,-N],[None,None]), [str(N),str(-N)])
check('both observed', solve([N,N],[3*N,5*N]), [str(2*N),str(3*N)])
check('negative observation', solve([N,N],[-3*N,None]), [str(-N),str(N)])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A sensor observing only one axis overwrites the other estimate.

Two-axis scalar-gain model: return each prior component averaged with the corresponding observation if it is not None; otherwise retain prior. Return fraction strings.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(covariance, order):
    return covariance
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unequal uncertainties', solve([[N,0],[0,4*N]],[1,0]), [[4*N,0],[0,N]])
check('cross covariance', solve([[2*N,N],[N,3*N]],[1,0]), [[3*N,N],[N,2*N]])
check('negative cross covariance', solve([[2*N,-N],[-N,3*N]],[1,0]), [[3*N,-N],[-N,2*N]])
check('identity channel order', solve([[N,0],[0,2*N]],[0,1]), [[N,0],[0,2*N]])
check('equal variances', solve([[2*N,N],[N,2*N]],[1,0]), [[2*N,N],[N,2*N]])
check('zero covariance boundary', solve([[0,0],[0,N]],[1,0]), [[N,0],[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
from fractions import Fraction
N = 1
observations = []
def solve(covariance, order):
    return [covariance[i] for i in order]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unequal uncertainties', solve([[N,0],[0,4*N]],[1,0]), [[4*N,0],[0,N]])
check('cross covariance', solve([[2*N,N],[N,3*N]],[1,0]), [[3*N,N],[N,2*N]])
check('negative cross covariance', solve([[2*N,-N],[-N,3*N]],[1,0]), [[3*N,-N],[-N,2*N]])
check('identity channel order', solve([[N,0],[0,2*N]],[0,1]), [[N,0],[0,2*N]])
check('equal variances', solve([[2*N,N],[N,2*N]],[1,0]), [[2*N,N],[N,2*N]])
check('zero covariance boundary', solve([[0,0],[0,N]],[1,0]), [[N,0],[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:
An uncertainty belongs to the wrong sensor channel.

Given a 2x2 measurement covariance in source order and a permutation of [0,1], return covariance in requested channel order.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(residual, p, r, threshold):
    return residual*residual <= threshold*r
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('prediction uncertainty matters', solve(2*N,3*N*N,N*N,1), True)
check('failed dimensional fix', solve(3*N,2*N*N,2*N*N,1), False)
check('negative boundary', solve(-2*N,3*N*N,N*N,1), True)
check('zero innovation', solve(0,N,N,1), True)
check('large rejection', solve(10*N,N,N,1), False)
check('squared threshold convention', solve(4*N,2*N*N,2*N*N,4), 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
from fractions import Fraction
N = 1
observations = []
def solve(residual, p, r, threshold):
    return abs(residual) <= threshold*(p+r)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('prediction uncertainty matters', solve(2*N,3*N*N,N*N,1), True)
check('failed dimensional fix', solve(3*N,2*N*N,2*N*N,1), False)
check('negative boundary', solve(-2*N,3*N*N,N*N,1), True)
check('zero innovation', solve(0,N,N,1), True)
check('large rejection', solve(10*N,N,N,1), False)
check('squared threshold convention', solve(4*N,2*N*N,2*N*N,4), 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:
Plausible measurements are rejected when prediction uncertainty grows.

Scalar independent-noise innovation gate: accept residual squared <= threshold*(p+r). p and r positive integer variances; threshold positive integer squared-Mahalanobis limit.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(p, q, dt):
    return p+q
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('gap spans several ticks', solve(N,2,N+2), 3*N+4)
check('zero elapsed time', solve(N,2,0), N)
check('one tick', solve(N,2,1), N+2)
check('no diffusion', solve(N,0,N+2), N)
check('zero prior variance', solve(0,N,3), 3*N)
check('two ticks', solve(N,N,2), 3*N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(p, q, dt):
    return p+q*dt*dt
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('gap spans several ticks', solve(N,2,N+2), 3*N+4)
check('zero elapsed time', solve(N,2,0), N)
check('one tick', solve(N,2,1), N+2)
check('no diffusion', solve(N,0,N+2), N)
check('zero prior variance', solve(0,N,3), 3*N)
check('two ticks', solve(N,N,2), 3*N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Prediction confidence remains too high after a long acquisition gap.

Scalar random walk with variance rate q: return p+q*dt as an integer; p,q,dt nonnegative. This is diffusion, not acceleration noise.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(x, velocity, age, z):
    return str(Fraction(x+z,2))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('consistent delayed fix', solve(10*N,N,2,8*N), str(10*N))
check('delayed correction', solve(10*N,N,2,6*N), str(9*N))
check('no delay', solve(10*N,N,0,8*N), str(9*N))
check('stationary target', solve(10*N,0,2,8*N), str(9*N))
check('reverse trajectory', solve(10*N,-N,2,12*N), str(10*N))
check('fractional update', solve(N,1,1,0), str(Fraction(N+1,2)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(x, velocity, age, z):
    return str(Fraction(x-velocity*age+z,2))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('consistent delayed fix', solve(10*N,N,2,8*N), str(10*N))
check('delayed correction', solve(10*N,N,2,6*N), str(9*N))
check('no delay', solve(10*N,N,0,8*N), str(9*N))
check('stationary target', solve(10*N,0,2,8*N), str(9*N))
check('reverse trajectory', solve(10*N,-N,2,12*N), str(10*N))
check('fractional update', solve(N,1,1,0), str(Fraction(N+1,2)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A late position fix pulls the present estimate backwards along the trajectory.

Constant known velocity model: x is current position, age nonnegative delay, z delayed position measurement. Return current position after a half-gain historical update and replay, as a fraction string.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(x, r, gain, offset):
    return [gain*x+offset,r]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('gain greater than one', solve(N,N,2,3), [2*N+3,4*N])
check('negative gain', solve(N,N,-3,1), [1-3*N,9*N])
check('offset is deterministic', solve(N,N,1,100*N), [101*N,N])
check('zero gain', solve(N,N,0,7), [7,0])
check('noise free source', solve(N,0,3,N), [4*N,0])
check('negative raw reading', solve(-N,N,2,-N), [-3*N,4*N])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(x, r, gain, offset):
    return [gain*x+offset,abs(gain)*r]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('gain greater than one', solve(N,N,2,3), [2*N+3,4*N])
check('negative gain', solve(N,N,-3,1), [1-3*N,9*N])
check('offset is deterministic', solve(N,N,1,100*N), [101*N,N])
check('zero gain', solve(N,N,0,7), [7,0])
check('noise free source', solve(N,0,3,N), [4*N,0])
check('negative raw reading', solve(-N,N,2,-N), [-3*N,4*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:
Fusion weights change when an equivalent sensor representation changes units.

For affine sensor calibration y=g*x+b with deterministic integer gain and offset, return calibrated mean and variance [g*x+b, g*g*r]. Raw variance r nonnegative.

split: open-access


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

def rot(v, q):
    x,y = v
    return [(x,y),(-y,x),(-x,-y),(y,-x)][q%4]

N = 1
observations = []
def solve(v):
    return v
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('right axis', solve([N,0,0]), [0,-N,0])
check('down axis', solve([0,N,0]), [0,0,-N])
check('forward axis', solve([0,0,N]), [N,0,0])
check('origin', solve([0,0,0]), [0,0,0])
check('mixed', solve([N,2*N,3*N]), [3*N,-N,-2*N])
check('negative axes', solve([-N,-2*N,-3*N]), [-3*N,N,2*N])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

def rot(v, q):
    x,y = v
    return [(x,y),(-y,x),(-x,-y),(y,-x)][q%4]

N = 1
observations = []
def solve(v):
    return [v[2],v[0],v[1]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('right axis', solve([N,0,0]), [0,-N,0])
check('down axis', solve([0,N,0]), [0,0,-N])
check('forward axis', solve([0,0,N]), [N,0,0])
check('origin', solve([0,0,0]), [0,0,0])
check('mixed', solve([N,2*N,3*N]), [3*N,-N,-2*N])
check('negative axes', solve([-N,-2*N,-3*N]), [-3*N,N,2*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:
Optical camera coordinates are mistaken for forward-left-up coordinates.

For integer optical [right,down,forward], return body [forward,left,up] at the same origin.

split: open-access