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

N = 1
observations = []
def solve(left, right, p, strand):
    return [left,p-left]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
l=10*N;r=l+8
check('plus near right',solve(l,r,l+7,'+'),[r,-1])
check('minus tie',solve(l,r,l+4,'-'),[r,4])
check('plus tie',solve(l,r,l+4,'+'),[l,4])
check('plus near left',solve(l,r,l+1,'+'),[l,1])
check('minus near left',solve(l,r,l+1,'-'),[l,-1])
check('minus near right',solve(l,r,l+7,'-'),[r,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(left, right, p, strand):
    anchor=left if p-left <= right-p else right
    return [anchor,(p-anchor)*(1 if strand=='+' else -1)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
l=10*N;r=l+8
check('plus near right',solve(l,r,l+7,'+'),[r,-1])
check('minus tie',solve(l,r,l+4,'-'),[r,4])
check('plus tie',solve(l,r,l+4,'+'),[l,4])
check('plus near left',solve(l,r,l+1,'+'),[l,1])
check('minus near left',solve(l,r,l+1,'-'),[l,-1])
check('minus near right',solve(l,r,l+7,'-'),[r,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:
Intronic coordinate ties choose the wrong transcript anchor.

For reference base p strictly inside the intron between exon-end base left and exon-start base right, return [anchor,signed distance]; upstream transcript boundary wins ties.

split: open-access


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

N = 1
observations = []
def solve(ops, start, pos):
    q=0;r=start
    for op,size in ops:
     if op=='M':
      if q <= pos < q+size: return r+pos-q
      q+=size;r+=size
     elif op=='I':
      if q <= pos < q+size: return None
      q+=size
     elif op=='D': r+=0
    return None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
o=[('M',2),('D',N+2),('M',3)]
check('after deletion',solve(o,100,2),104+N)
check('later base',solve(o,100,4),106+N)
check('first base',solve(o,100,0),100)
check('before deletion',solve(o,100,1),101)
check('past end',solve(o,100,5),None)
check('negative base',solve(o,100,-1),None)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

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

N = 1
observations = []
def solve(ops, start, pos):
    q=0;r=start
    for op,size in ops:
     if op=='M':
      if q <= pos < q+size: return r+pos-q
      q+=size;r+=size
     elif op=='I':
      if q <= pos < q+size: return None
      q+=size
     elif op=='D': r+=1
    return None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
o=[('M',2),('D',N+2),('M',3)]
check('after deletion',solve(o,100,2),104+N)
check('later base',solve(o,100,4),106+N)
check('first base',solve(o,100,0),100)
check('before deletion',solve(o,100,1),101)
check('past end',solve(o,100,5),None)
check('negative base',solve(o,100,-1),None)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Reference deletions fail to advance alignment position.

Map a zero-based query base through M/I/D operation lengths; inserted and absent query bases return None.

split: open-access


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

N = 1
observations = []
def solve(ops, start, pos):
    q=0;r=start
    for op,size in ops:
     if op=='M':
      if q <= pos < q+size: return r+pos-q
      q+=size;r+=size
     elif op=='I':
      if q <= pos < q+size: return r
      q+=size
     elif op=='D': r+=size
    return None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
o=[('M',2),('I',N+1),('M',3)]
check('first inserted',solve(o,50,2),None)
check('last inserted',solve(o,50,N+2),None)
check('first downstream',solve(o,50,N+3),52)
check('last downstream',solve(o,50,N+5),54)
check('before insertion',solve(o,50,1),51)
check('past end',solve(o,50,N+6),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(ops, start, pos):
    q=0;r=start
    for op,size in ops:
     if op=='M':
      if q <= pos < q+size: return r+pos-q
      q+=size;r+=size
     elif op=='I':
      if q <= pos < q+size: return None
      q+=0
     elif op=='D': r+=size
    return None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
o=[('M',2),('I',N+1),('M',3)]
check('first inserted',solve(o,50,2),None)
check('last inserted',solve(o,50,N+2),None)
check('first downstream',solve(o,50,N+3),52)
check('last downstream',solve(o,50,N+5),54)
check('before insertion',solve(o,50,1),51)
check('past end',solve(o,50,N+6),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:
Inserted query bases acquire fabricated reference coordinates.

Map query bases through M/I/D; query insertion bases have no reference coordinate.

split: open-access


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

N = 1
observations = []
def solve(hits):
    return hits[0] if hits else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('conflicting positions',solve([['a',N],['a',N+1]]),None)
check('redundant chains',solve([['a',N],['a',N]]),['a',N])
check('different contigs',solve([['a',N],['b',N]]),None)
check('single hit',solve([['b',N]]),['b',N])
check('no hit',solve([]),None)
check('three agreeing',solve([['a',N]]*3),['a',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(hits):
    return hits[0] if len(hits)==1 else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('conflicting positions',solve([['a',N],['a',N+1]]),None)
check('redundant chains',solve([['a',N],['a',N]]),['a',N])
check('different contigs',solve([['a',N],['b',N]]),None)
check('single hit',solve([['b',N]]),['b',N])
check('no hit',solve([]),None)
check('three agreeing',solve([['a',N]]*3),['a',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:
Lifted coordinates discard ambiguous chain mappings.

Synthetic chain hits are [contig,base] mappings for one source base; return the unique destination pair or None.

split: open-access


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

N = 1
observations = []
def solve(start, end, pos):
    return [pos//3,pos%3]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
s=N+4;e=s+9
check('coding origin',solve(s,e,s),[0,0])
check('second codon',solve(s,e,s+3),[1,0])
check('within codon',solve(s,e,s+5),[1,2])
check('last coding base',solve(s,e,e-1),[2,2])
check('upstream untranslated',solve(s,e,s-1),None)
check('downstream untranslated',solve(s,e,e),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(start, end, pos):
    return [(pos-start)//3,(pos-start)%3] if pos>=start else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
s=N+4;e=s+9
check('coding origin',solve(s,e,s),[0,0])
check('second codon',solve(s,e,s+3),[1,0])
check('within codon',solve(s,e,s+5),[1,2])
check('last coding base',solve(s,e,e-1),[2,2])
check('upstream untranslated',solve(s,e,s-1),None)
check('downstream untranslated',solve(s,e,e),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:
Coding coordinates include untranslated transcript prefix.

For half-open coding transcript range [start,end), return [zero-based codon,within-codon offset]; outside coding range return None.

split: open-access


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

N = 1
observations = []
def solve(lengths):
    return sum(lengths)%3
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('one carried base',solve([3*N+1]),2)
check('two carried bases',solve([3*N+2]),1)
check('aligned exon',solve([3*N]),0)
check('no preceding exon',solve([]),0)
check('multiple segments',solve([3*N+1,4]),1)
check('split closes codon',solve([3*N+1,2]),0)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(lengths):
    return 3-sum(lengths)%3
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('one carried base',solve([3*N+1]),2)
check('two carried bases',solve([3*N+2]),1)
check('aligned exon',solve([3*N]),0)
check('no preceding exon',solve([]),0)
check('multiple segments',solve([3*N+1,4]),1)
check('split closes codon',solve([3*N+1,2]),0)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
CDS exon phase mistakes remaining bases for consumed bases.

Given lengths of preceding coding segments in transcript order, report GFF-like leading completion phase (3-total modulo 3) modulo 3. This model assumes the initial segment starts on a codon boundary.

split: open-access


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

N = 1
observations = []
def solve(rows):
    return round(sum(y/p for y,p in rows)/sum(1/p for y,p in rows),8) if rows else 0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unequal probabilities',solve([(N,0.5),(2*N,0.25)]),10*N)
check('single expanded unit',solve([(3*N,0.25)]),12*N)
check('census',solve([(N,1),(2*N,1)]),3*N)
check('zero valued sampled unit',solve([(0,0.5),(N,0.5)]),2*N)
check('signed contribution',solve([(-N,0.5),(N,1)]),-N)
check('empty sample',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

N = 1
observations = []
def solve(rows):
    return round(len(rows)*sum(y/p for y,p in rows)/sum(1/p for y,p in rows),8) if rows else 0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unequal probabilities',solve([(N,0.5),(2*N,0.25)]),10*N)
check('single expanded unit',solve([(3*N,0.25)]),12*N)
check('census',solve([(N,1),(2*N,1)]),3*N)
check('zero valued sampled unit',solve([(0,0.5),(N,0.5)]),2*N)
check('signed contribution',solve([(-N,0.5),(N,1)]),-N)
check('empty sample',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:
Normalizing inclusion weights changes a population total.

Rows are (value, positive inclusion probability <= 1); return the estimated population total rounded to eight decimals; empty sample totals zero.

split: open-access


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

N = 1
observations = []
def solve(rows):
    return round(sum(y/q for y,p,q in rows),8)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('two half stages',solve([(N,0.5,0.5)]),4*N)
check('certain primary',solve([(N,1,0.25)]),4*N)
check('certain secondary',solve([(N,0.25,1)]),4*N)
check('census both',solve([(N,1,1)]),N)
check('heterogeneous paths',solve([(N,0.5,0.25),(N,1,0.5)]),10*N)
check('no observed units',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

N = 1
observations = []
def solve(rows):
    return round(sum(y/min(1,p+q) for y,p,q in rows),8)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('two half stages',solve([(N,0.5,0.5)]),4*N)
check('certain primary',solve([(N,1,0.25)]),4*N)
check('certain secondary',solve([(N,0.25,1)]),4*N)
check('census both',solve([(N,1,1)]),N)
check('heterogeneous paths',solve([(N,0.5,0.25),(N,1,0.5)]),10*N)
check('no observed units',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:
Marginal weights omit the first sampling stage.

Rows are (value, primary probability, conditional secondary probability), both probabilities in (0,1]; return the total rounded to eight decimals.

split: open-access


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

N = 1
observations = []
def solve(strata):
    return sum(sum(v) for size,v in strata)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('disproportionate allocation',solve([(10,[N]),(2,[3*N,3*N])]),16*N)
check('single stratum expansion',solve([(8,[N,3*N])]),16*N)
check('census strata',solve([(1,[N]),(2,[2*N,4*N])]),7*N)
check('empty zero stratum',solve([(0,[]),(4,[N])]),4*N)
check('unobserved positive stratum',solve([(3,[])]),None)
check('empty frame',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

N = 1
observations = []
def solve(strata):
    values=[x for size,v in strata for x in v]
    return round(sum(size for size,v in strata)*sum(values)/len(values),8) if values else 0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('disproportionate allocation',solve([(10,[N]),(2,[3*N,3*N])]),16*N)
check('single stratum expansion',solve([(8,[N,3*N])]),16*N)
check('census strata',solve([(1,[N]),(2,[2*N,4*N])]),7*N)
check('empty zero stratum',solve([(0,[]),(4,[N])]),4*N)
check('unobserved positive stratum',solve([(3,[])]),None)
check('empty frame',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:
Pooling a disproportionate stratified sample changes expansion totals.

Strata are (known population count, nonempty sampled values); zero-population strata may have empty samples. Return None for an unsampled positive stratum; otherwise rounded total.

split: open-access


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

N = 1
observations = []
def solve(rows, domain_size):
    d=[(y,w) for y,w,in_domain in rows if in_domain]
    return round(sum(y*w for y,w in d)/len(d),8) if d else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('known domain denominator',solve([(2*N,2,True),(99,10,False)],8),N/2)
check('no sampled domain members',solve([(N,1,False)],4),0)
check('zero population domain',solve([],0),None)
check('census domain',solve([(N,1,True),(3*N,1,True)],2),2*N)
check('unequal weighted members',solve([(N,2,True),(2*N,4,True)],5),2*N)
check('outside values do not contribute',solve([(0,4,True),(100*N,2,False)],8),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(rows, domain_size):
    d=[(y,w) for y,w,in_domain in rows if in_domain]
    return round(sum(y*w for y,w in d)/sum(w for y,w in d),8) if d else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('known domain denominator',solve([(2*N,2,True),(99,10,False)],8),N/2)
check('no sampled domain members',solve([(N,1,False)],4),0)
check('zero population domain',solve([],0),None)
check('census domain',solve([(N,1,True),(3*N,1,True)],2),2*N)
check('unequal weighted members',solve([(N,2,True),(2*N,4,True)],5),2*N)
check('outside values do not contribute',solve([(0,4,True),(100*N,2,False)],8),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:
Domain filtering silently changes the target denominator.

Rows are (value, inverse-inclusion weight, in-domain boolean); domain_size is a known nonnegative population count. Return HT domain total/domain_size, or None when size is zero, rounded to eight decimals.

split: open-access


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

N = 1
observations = []
def solve(rows):
    total=sum(w for c,w,r in rows); observed=sum(w for c,w,r in rows if r)
    return [round(w*total/observed,8) for c,w,r in rows if r] if observed else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unequal weights within cell',solve([('a',N,True),('a',3*N,False)]),[4*N])
check('different cell response',solve([('a',N,True),('a',N,False),('b',N,True)]),[2*N,N])
check('all response',solve([('a',N,True),('b',2*N,True)]),[N,2*N])
check('cell has no response',solve([('a',N,True),('b',N,False)]),None)
check('preserve respondent proportions',solve([('a',N,True),('a',3*N,True),('a',4*N,False)]),[2*N,6*N])
check('empty frame',solve([]),[])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(rows):
    if any(not any(r for c,w,r in rows if c==cell) for cell in {c for c,w,r in rows}): return None
    return [round(w*sum(c==cell for c,v,r in rows)/sum(c==cell and r for c,v,r in rows),8) for cell,w,r in rows if r]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unequal weights within cell',solve([('a',N,True),('a',3*N,False)]),[4*N])
check('different cell response',solve([('a',N,True),('a',N,False),('b',N,True)]),[2*N,N])
check('all response',solve([('a',N,True),('b',2*N,True)]),[N,2*N])
check('cell has no response',solve([('a',N,True),('b',N,False)]),None)
check('preserve respondent proportions',solve([('a',N,True),('a',3*N,True),('a',4*N,False)]),[2*N,6*N])
check('empty frame',solve([]),[])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A global response adjustment transfers weight across response cells.

Rows are (cell, positive base weight, responded boolean). Return adjusted respondent weights in row order; return None if any represented cell has zero respondents. Empty input returns empty list.

split: open-access


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

N = 1
observations = []
def solve(rows, margins):
    return [round(margins[c]/sum(k==c for k,v in rows),8) for c,w in rows]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unequal base weights',solve([('a',N),('a',3*N)],{'a':8*N}),[2*N,6*N])
check('separate margins',solve([('a',N),('b',N)],{'a':2*N,'b':6*N}),[2*N,6*N])
check('already calibrated',solve([('a',N),('a',3*N)],{'a':4*N}),[N,3*N])
check('single observation',solve([('a',N)],{'a':7*N}),[7*N])
check('row order preserved',solve([('b',N),('a',N),('b',3*N)],{'a':2*N,'b':8*N}),[2*N,2*N,6*N])
check('empty cells',solve([],{}),[])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(rows, margins):
    total=sum(margins.values()); base=sum(w for c,w in rows)
    return [round(w*total/base,8) for c,w in rows]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unequal base weights',solve([('a',N),('a',3*N)],{'a':8*N}),[2*N,6*N])
check('separate margins',solve([('a',N),('b',N)],{'a':2*N,'b':6*N}),[2*N,6*N])
check('already calibrated',solve([('a',N),('a',3*N)],{'a':4*N}),[N,3*N])
check('single observation',solve([('a',N)],{'a':7*N}),[7*N])
check('row order preserved',solve([('b',N),('a',N),('b',3*N)],{'a':2*N,'b':8*N}),[2*N,2*N,6*N])
check('empty cells',solve([],{}),[])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Calibration matches record counts rather than population margins.

Rows are (cell,positive base weight); margins give positive population totals for exactly the represented cells. Return weights in input order rounded to eight decimals; empty inputs return empty list.

split: open-access


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

N = 1
observations = []
def solve(s2, n, population):
    return round(s2/n,8)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('half population',solve(8*N,2,4),2*N)
check('census zero uncertainty',solve(8*N,4,4),0)
check('quarter population',solve(8*N,2,8),3*N)
check('zero dispersion',solve(0,2,8),0)
check('one draw modeled variance',solve(4*N,1,2),2*N)
check('three quarters',solve(12*N,3,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

N = 1
observations = []
def solve(s2, n, population):
    return round((1-n/population)**2*s2/n,8)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('half population',solve(8*N,2,4),2*N)
check('census zero uncertainty',solve(8*N,4,4),0)
check('quarter population',solve(8*N,2,8),3*N)
check('zero dispersion',solve(0,2,8),0)
check('one draw modeled variance',solve(4*N,1,2),2*N)
check('three quarters',solve(12*N,3,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:
A census retains sampling variance.

Inputs are nonnegative sample variance s2, integers 1<=n<=population. Return variance of SRS without-replacement mean, rounded to eight decimals; s2 is supplied rather than estimated here.

split: open-access


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

N = 1
observations = []
def solve(rows):
    return len(rows)-len({h for h,p in rows})
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('secondary records repeated',solve([('a',N),('a',N),('a',N+1)]),1)
check('labels reused across strata',solve([('a',N),('a',N+1),('b',N),('b',N+1)]),2)
check('lonely PSU stratum',solve([('a',N),('a',N)]),0)
check('empty sample',solve([]),0)
check('one stratum three PSUs',solve([('a',N),('a',N+1),('a',N+2)]),2)
check('mixed counts',solve([('a',N),('b',N),('b',N+1),('b',N+1)]),1)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(rows):
    return len({p for h,p in rows})-len({h for h,p in rows})
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('secondary records repeated',solve([('a',N),('a',N),('a',N+1)]),1)
check('labels reused across strata',solve([('a',N),('a',N+1),('b',N),('b',N+1)]),2)
check('lonely PSU stratum',solve([('a',N),('a',N)]),0)
check('empty sample',solve([]),0)
check('one stratum three PSUs',solve([('a',N),('a',N+1),('a',N+2)]),2)
check('mixed counts',solve([('a',N),('b',N),('b',N+1),('b',N+1)]),1)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Secondary records inflate survey variance degrees of freedom.

Rows are (stratum, PSU label) for noncertainty strata; labels are unique only within a stratum. Return sum_h(number of distinct sampled PSUs_h - 1), with empty input zero.

split: open-access


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

N = 1
observations = []
def solve(full, replicates, rho):
    return round(sum((r-full)**2 for r in replicates)/len(replicates),8)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('half shrinkage',solve(N,[N-1,N+1],0.5),4)
check('common displacement',solve(N,[N+1,N+1],0.5),4)
check('ordinary BRR boundary',solve(N,[N-2,N+2],0),4)
check('identical full replicates',solve(N,[N,N],0.5),0)
check('asymmetric deviations',solve(N,[N,N+2],0.5),8)
check('quarter residual scale',solve(N,[N-1,N+1],0.75),16)
print(json.dumps({"observations": observations, "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(full, replicates, rho):
    center=sum(replicates)/len(replicates)
    return round(sum((r-center)**2 for r in replicates)/(len(replicates)*(1-rho)**2),8)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('half shrinkage',solve(N,[N-1,N+1],0.5),4)
check('common displacement',solve(N,[N+1,N+1],0.5),4)
check('ordinary BRR boundary',solve(N,[N-2,N+2],0),4)
check('identical full replicates',solve(N,[N,N],0.5),0)
check('asymmetric deviations',solve(N,[N,N+2],0.5),8)
check('quarter residual scale',solve(N,[N-1,N+1],0.75),16)
print(json.dumps({"observations": observations, "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:
Fay replicate shrinkage understates variance.

replicates are nonempty estimates; rho lies in [0,1). Return Fay BRR variance using the supplied full estimate as center, rounded to eight decimals.

split: open-access


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

N = 1
observations = []
def solve(draws):
    unique={u:(y,p) for u,y,p in draws}
    return round(sum(y/p for y,p in unique.values())/len(unique),8) if unique else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unequal repeat multiplicity',solve([('a',N,0.5),('a',N,0.5),('b',4*N,0.5)]),4*N)
check('same unit twice',solve([('a',N,0.25),('a',N,0.25)]),4*N)
check('single draw',solve([('a',N,0.25)]),4*N)
check('different unique draws',solve([('a',N,0.5),('b',3*N,0.5)]),4*N)
check('zero valued draw counts',solve([('a',0,0.5),('a',0,0.5),('b',3*N,0.5)]),2*N)
check('no draws',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(draws):
    return round(sum(y/p for u,y,p in draws)/len({u for u,y,p in draws}),8) if draws else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unequal repeat multiplicity',solve([('a',N,0.5),('a',N,0.5),('b',4*N,0.5)]),4*N)
check('same unit twice',solve([('a',N,0.25),('a',N,0.25)]),4*N)
check('single draw',solve([('a',N,0.25)]),4*N)
check('different unique draws',solve([('a',N,0.5),('b',3*N,0.5)]),4*N)
check('zero valued draw counts',solve([('a',0,0.5),('a',0,0.5),('b',3*N,0.5)]),2*N)
check('no draws',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:
Deduplicating repeated PPS draws changes the estimator.

draws are (unit identifier,value,positive draw probability); repeated unit entries have identical value and probability. Return Hansen-Hurwitz population total rounded to eight decimals, or None for no draws.

split: open-access


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

N = 1
observations = []
def solve(rows):
    groups = [[r[2] for r in rows if r[1] == a] for a in (0,1)]
    return None if not all(groups) else sum(groups[1])/len(groups[1])-sum(groups[0])/len(groups[0])
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('crossovers', solve([[0,0,0],[0,1,4*N],[1,0,2*N],[1,1,6*N]]), 2*N)
check('compliance', solve([[0,0,N],[1,1,3*N]]), 2*N)
check('all cross', solve([[0,1,N],[1,0,4*N]]), 3*N)
check('empty', solve([]), None)
check('missing control', solve([[1,0,N]]), None)
check('zero effect', solve([[0,1,N],[1,1,N]]), 0)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(rows):
    groups = [[r[2] for r in rows if r[0] == a and r[0] == r[1]] for a in (0,1)]
    return None if not all(groups) else sum(groups[1])/len(groups[1])-sum(groups[0])/len(groups[0])
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('crossovers', solve([[0,0,0],[0,1,4*N],[1,0,2*N],[1,1,6*N]]), 2*N)
check('compliance', solve([[0,0,N],[1,1,3*N]]), 2*N)
check('all cross', solve([[0,1,N],[1,0,4*N]]), 3*N)
check('empty', solve([]), None)
check('missing control', solve([[1,0,N]]), None)
check('zero effect', solve([[0,1,N],[1,1,N]]), 0)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Intention-to-treat groups are rebuilt from received treatment.

Rows are [assignment, received, outcome]. Return assigned-arm mean difference or None if either assigned arm is absent.

split: open-access


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

N = 1
observations = []
def solve(rows, target):
    return sum(r[2]-r[1] for r in rows)/len(rows) if rows else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ATT membership', solve([[1,0,2*N],[0,0,8*N]], 'ATT'), 2*N)
check('ATE', solve([[1,0,2*N],[0,0,8*N]], 'ATE'), 5*N)
check('negative treated', solve([[1,3*N,N],[0,0,N]], 'ATT'), -2*N)
check('no treated', solve([[0,0,N]], 'ATT'), None)
check('empty', solve([], 'ATE'), None)
check('null effect treated', solve([[1,N,N]], 'ATT'), 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(rows, target):
    chosen = [r for r in rows if target == 'ATE' or r[2] > r[1]]
    return sum(r[2]-r[1] for r in chosen)/len(chosen) if chosen else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ATT membership', solve([[1,0,2*N],[0,0,8*N]], 'ATT'), 2*N)
check('ATE', solve([[1,0,2*N],[0,0,8*N]], 'ATE'), 5*N)
check('negative treated', solve([[1,3*N,N],[0,0,N]], 'ATT'), -2*N)
check('no treated', solve([[0,0,N]], 'ATT'), None)
check('empty', solve([], 'ATE'), None)
check('null effect treated', solve([[1,N,N]], 'ATT'), 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 ATT request silently averages untreated potential outcomes.

Rows [treated,y0,y1] contain both synthetic potential outcomes. target is ATT or ATE; return the target average y1-y0, None for an empty target.

split: open-access


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

N = 1
observations = []
def solve(candidates, assigned_at):
    return sorted(r[0] for r in candidates)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('late baseline', solve([['x','baseline',N+1]], N), [])
check('proper baseline', solve([['x','baseline',N-1]], N), ['x'])
check('same instant', solve([['x','baseline',N]], N), [])
check('mediator', solve([['m','mediator',N-1]], N), [])
check('empty', solve([], N), [])
check('mixed', solve([['z','baseline',N-2],['a','baseline',N-1],['y','outcome',N+2]], N), ['a','z'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(candidates, assigned_at):
    return sorted(r[0] for r in candidates if r[1] == 'baseline')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('late baseline', solve([['x','baseline',N+1]], N), [])
check('proper baseline', solve([['x','baseline',N-1]], N), ['x'])
check('same instant', solve([['x','baseline',N]], N), [])
check('mediator', solve([['m','mediator',N-1]], N), [])
check('empty', solve([], N), [])
check('mixed', solve([['z','baseline',N-2],['a','baseline',N-1],['y','outcome',N+2]], N), ['a','z'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Post-assignment covariates enter a prespecified baseline adjustment set.

Candidates [name,role,time] have roles baseline, mediator, or outcome. Return sorted baseline names measured strictly before assignment time.

split: open-access


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

N = 1
observations = []
def solve(rows, target):
    return [] if {r[1] for r in rows} == {0,1} else sorted(target)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('separated arms', solve([['a',0],['b',1]], ['a','b']), ['a','b'])
check('absent target', solve([['a',0],['a',1]], ['a','b']), ['b'])
check('supported', solve([['a',0],['a',1]], ['a']), [])
check('empty target', solve([['a',0]], []), [])
check('empty study', solve([], ['a']), ['a'])
check('duplicate rows', solve([['a',0]]*N, ['a']), ['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(rows, target):
    observed = {r[0] for r in rows}
    return sorted(s for s in target if s in observed and {a for t,a in rows if t == s} != {0,1})
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('separated arms', solve([['a',0],['b',1]], ['a','b']), ['a','b'])
check('absent target', solve([['a',0],['a',1]], ['a','b']), ['b'])
check('supported', solve([['a',0],['a',1]], ['a']), [])
check('empty target', solve([['a',0]], []), [])
check('empty study', solve([], ['a']), ['a'])
check('duplicate rows', solve([['a',0]]*N, ['a']), ['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:
Global treatment overlap conceals an unsupported target stratum.

Rows [stratum,arm] encode observed design support. Return target strata lacking either arm, sorted. Multiplicity is irrelevant.

split: open-access


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

N = 1
observations = []
def solve(rows):
    return []
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unequal conflict', solve([['a',0]]*(N+1)+[['a',1]]), ['a'])
check('balanced conflict', solve([['a',0],['a',1]]), ['a'])
check('all treated', solve([['a',1]]*N), [])
check('all control', solve([['a',0]]*N), [])
check('two clusters', solve([['a',0],['b',1]]), [])
check('empty', solve([]), [])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(rows):
    clusters = {c for c,a in rows}
    return sorted(c for c in clusters if sum(a for k,a in rows if k == c)*2 == sum(k == c for k,a in rows))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unequal conflict', solve([['a',0]]*(N+1)+[['a',1]]), ['a'])
check('balanced conflict', solve([['a',0],['a',1]]), ['a'])
check('all treated', solve([['a',1]]*N), [])
check('all control', solve([['a',0]]*N), [])
check('two clusters', solve([['a',0],['b',1]]), [])
check('empty', solve([]), [])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Cluster randomization accepts contradictory unit assignments.

Rows [cluster,arm] use arms 0 and 1. Return sorted clusters violating the cluster-level assignment design.

split: open-access


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

N = 1
observations = []
def solve(unit, neighbors, assignment):
    return [assignment[unit], sum(assignment[n] for n in neighbors)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('self exposure', solve('a', ['a'], {'a':1}), [1,0])
check('duplicate peers', solve('a', ['b']*(N+1), {'a':0,'b':1}), [0,1])
check('untreated peer', solve('a', ['b'], {'a':1,'b':0}), [1,0])
check('empty peers', solve('a', [], {'a':0}), [0,0])
check('mixed', solve('a', ['a','b','b','c'], {'a':1,'b':1,'c':0}), [1,1])
check('two peers', solve('a', ['b','c'], {'a':0,'b':1,'c':1}), [0,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(unit, neighbors, assignment):
    return [assignment[unit], sum(assignment[n] for n in neighbors if n != unit)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('self exposure', solve('a', ['a'], {'a':1}), [1,0])
check('duplicate peers', solve('a', ['b']*(N+1), {'a':0,'b':1}), [0,1])
check('untreated peer', solve('a', ['b'], {'a':1,'b':0}), [1,0])
check('empty peers', solve('a', [], {'a':0}), [0,0])
check('mixed', solve('a', ['a','b','b','c'], {'a':1,'b':1,'c':0}), [1,1])
check('two peers', solve('a', ['b','c'], {'a':0,'b':1,'c':1}), [0,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:
Exposure mapping includes the focal unit as its own peer.

Assignment maps unit names to 0/1; neighbors may repeat and contain self. Return [own arm, number of unique treated other neighbors]. All names exist.

split: open-access


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

N = 1
observations = []
def solve(means):
    y0,y1,d0,d1 = means
    return (y1-y0)/d1 if d1 else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nonzero baseline', solve([0,N,0.25,0.75]), 2*N)
check('reversed instrument', solve([N,0,0.75,0.25]), 2*N)
check('no first stage', solve([0,N,0.5,0.5]), None)
check('zero uptake', solve([0,N,0,0]), None)
check('null reduced form', solve([N,N,0,1]), 0)
check('negative ratio', solve([N,0,0,1]), -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(means):
    y0,y1,d0,d1 = means
    return (y1-y0)/abs(d1-d0) if d1 != d0 else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nonzero baseline', solve([0,N,0.25,0.75]), 2*N)
check('reversed instrument', solve([N,0,0.75,0.25]), 2*N)
check('no first stage', solve([0,N,0.5,0.5]), None)
check('zero uptake', solve([0,N,0,0]), None)
check('null reduced form', solve([N,N,0,1]), 0)
check('negative ratio', solve([N,0,0,1]), -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 synthetic Wald ratio divides by uptake level instead of uptake contrast.

Input [meanY0,meanY1,meanD0,meanD1] describes a supplied synthetic IV design; return its Wald ratio, None when first stage is zero. No identification assumptions are inferred.

split: open-access


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

N = 1
observations = []
def solve(cells):
    return cells[1]-cells[3]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('baseline imbalance', solve([10*N,15*N,2*N,5*N]), 2*N)
check('common shock', solve([N,3*N,0,2*N]), 0)
check('no change', solve([N,N,0,0]), 0)
check('negative effect', solve([0,N,0,3*N]), -2*N)
check('no control change', solve([0,N,2*N,2*N]), N)
check('all zero', solve([0,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(cells):
    return cells[1]-cells[0]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('baseline imbalance', solve([10*N,15*N,2*N,5*N]), 2*N)
check('common shock', solve([N,3*N,0,2*N]), 0)
check('no change', solve([N,N,0,0]), 0)
check('negative effect', solve([0,N,0,3*N]), -2*N)
check('no control change', solve([0,N,2*N,2*N]), N)
check('all zero', solve([0,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:
A two-period design subtracts levels instead of changes.

Input [treated_pre,treated_post,control_pre,control_post] defines a synthetic two-period contrast. Return (treated_post-treated_pre)-(control_post-control_pre); this arithmetic alone does not assert parallel trends.

split: open-access


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

N = 1
observations = []
def solve(rows):
    history = {}
    result = []
    for subject, period, assigned, received, washed_out in sorted(rows):
        if washed_out:
            history[subject] = None
        result.append([subject, period, history.get(subject)])
        if assigned is not None:
            history[subject] = assigned
    return result
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('actual receipt overrides assignment', solve([['s',N,'A','B',False],['s',N+1,'A','A',False]]), [['s',N,None],['s',N+1,'B']])
check('untreated period preserves carryover', solve([['s',N,'A','A',False],['s',N+1,None,None,False],['s',N+2,'B','B',False]]), [['s',N,None],['s',N+1,'A'],['s',N+2,'A']])
check('washout clears before current receipt', solve([['s',N,'A','A',False],['s',N+1,'B','B',True],['s',N+2,None,None,False]]), [['s',N,None],['s',N+1,None],['s',N+2,'B']])
check('subjects have independent histories', solve([['s',N,'A','A',False],['t',N,'B','B',False],['s',N+1,None,None,False],['t',N+1,None,None,False]]), [['s',N,None],['s',N+1,'A'],['t',N,None],['t',N+1,'B']])
check('input order does not determine history', solve([['s',N+1,'B','B',False],['s',N,'A','A',False]]), [['s',N,None],['s',N+1,'A']])
check('no prior receipt means no carryover', solve([['s',N,'A',None,False],['s',N+1,'B','B',False]]), [['s',N,None],['s',N+1,None]])
check('empty design', solve([]), [])
check('washout without new receipt remains clear', solve([['s',N,'A','A',False],['s',N+1,None,None,True],['s',N+2,'B','B',False]]), [['s',N,None],['s',N+1,None],['s',N+2,None]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(rows):
    history = {}
    result = []
    for subject, period, assigned, received, washed_out in sorted(rows):
        if washed_out:
            history[subject] = None
        result.append([subject, period, history.get(subject)])
        history[subject] = received
    return result
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('actual receipt overrides assignment', solve([['s',N,'A','B',False],['s',N+1,'A','A',False]]), [['s',N,None],['s',N+1,'B']])
check('untreated period preserves carryover', solve([['s',N,'A','A',False],['s',N+1,None,None,False],['s',N+2,'B','B',False]]), [['s',N,None],['s',N+1,'A'],['s',N+2,'A']])
check('washout clears before current receipt', solve([['s',N,'A','A',False],['s',N+1,'B','B',True],['s',N+2,None,None,False]]), [['s',N,None],['s',N+1,None],['s',N+2,'B']])
check('subjects have independent histories', solve([['s',N,'A','A',False],['t',N,'B','B',False],['s',N+1,None,None,False],['t',N+1,None,None,False]]), [['s',N,None],['s',N+1,'A'],['t',N,None],['t',N+1,'B']])
check('input order does not determine history', solve([['s',N+1,'B','B',False],['s',N,'A','A',False]]), [['s',N,None],['s',N+1,'A']])
check('no prior receipt means no carryover', solve([['s',N,'A',None,False],['s',N+1,'B','B',False]]), [['s',N,None],['s',N+1,None]])
check('empty design', solve([]), [])
check('washout without new receipt remains clear', solve([['s',N,'A','A',False],['s',N+1,None,None,True],['s',N+2,'B','B',False]]), [['s',N,None],['s',N+1,None],['s',N+2,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 carryover covariate follows assigned treatment or disappears during an untreated period without a documented washout.

Rows [subject,period,assigned,received,washed_out] have unique subject-period pairs. Treatments are A/B or None. The synthetic protocol defines carryover as the most recent actually received treatment since the last documented washout, persisting through untreated periods. Return sorted [subject,period,carryover] rows, with carryover evaluated before current receipt and after current washout. This is a categorical design encoding, not a pharmacokinetic claim.

split: open-access


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

N = 1
observations = []
def solve(entry, exit, start):
    return [exit-entry,0] if start is None else [0,exit-entry]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('initiates during', solve(N, N+10, N+4), [4,6])
check('already treated', solve(N, N+10, N-1), [0,10])
check('never treated', solve(N, N+10, None), [10,0])
check('future treatment', solve(N, N+10, N+11), [10,0])
check('at exit', solve(N, N+10, N+10), [10,0])
check('empty followup', solve(N, N, N), [0,0])
check('at entry', solve(N, N+10, N), [0,10])
print(json.dumps({"observations": observations, "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(entry, exit, start):
    if start is None or start < entry or start >= exit:
        return [exit-entry,0]
    return [start-entry,exit-start]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('initiates during', solve(N, N+10, N+4), [4,6])
check('already treated', solve(N, N+10, N-1), [0,10])
check('never treated', solve(N, N+10, None), [10,0])
check('future treatment', solve(N, N+10, N+11), [10,0])
check('at exit', solve(N, N+10, N+10), [10,0])
check('empty followup', solve(N, N, N), [0,0])
check('at entry', solve(N, N+10, N), [0,10])
print(json.dumps({"observations": observations, "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:
Ever-treated labeling allocates pre-initiation time to treatment.

Integer entry <= exit bounds half-open follow-up. start is treatment initiation or None; treatment persists. Return [unexposed duration, exposed duration].

split: open-access


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

N = 1
observations = []
def solve(bids, reserve):
    return max(bids) if bids and max(bids)>=reserve else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reserve binds', solve([20+N,2], 10), 10)
check('runner up binds', solve([20,15], 10), 15)
check('single bidder', solve([20], 10), 10)
check('empty', solve([], 10), None)
check('no qualifying bid', solve([9,8], 10), None)
check('equality qualifies', solve([10], 10), 10)
check('zero reserve', solve([7,3], 0), 3)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(bids, reserve):
    return sorted(bids,reverse=True)[1] if len(bids)>1 and max(bids)>=reserve else (0 if bids and max(bids)>=reserve else None)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reserve binds', solve([20+N,2], 10), 10)
check('runner up binds', solve([20,15], 10), 15)
check('single bidder', solve([20], 10), 10)
check('empty', solve([], 10), None)
check('no qualifying bid', solve([9,8], 10), None)
check('equality qualifies', solve([10], 10), 10)
check('zero reserve', solve([7,3], 0), 3)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A reserve-qualified winner pays its own bid.

For nonnegative integer bids and reserve, sell one unit if maximum bid >= reserve; return payment max(reserve, second-highest bid), using zero when no runner-up. No sale returns None.

split: open-access


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

N = 1
observations = []
def solve(bids, supply):
    return None if supply==0 else (sorted(bids,reverse=True)[min(supply,len(bids))-1] if bids else 0)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('interior cutoff', solve([30+N,20,10,5], 2), 10)
check('one supplied', solve([9,7,2], 1), 7)
check('all served', solve([9,7], 2), 0)
check('excess supply', solve([9], 3), 0)
check('empty demand', solve([], 2), 0)
check('zero supply', solve([9], 0), None)
check('tied marginal bids', solve([8,8,8,1], 2), 8)
print(json.dumps({"observations": observations, "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(bids, supply):
    return None if supply==0 else (min(bids) if len(bids)>supply else 0)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('interior cutoff', solve([30+N,20,10,5], 2), 10)
check('one supplied', solve([9,7,2], 1), 7)
check('all served', solve([9,7], 2), 0)
check('excess supply', solve([9], 3), 0)
check('empty demand', solve([], 2), 0)
check('zero supply', solve([9], 0), None)
check('tied marginal bids', solve([8,8,8,1], 2), 8)
print(json.dumps({"observations": observations, "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:
Uniform unit pricing reads the last winner instead of the first loser.

Each integer bid requests one unit. For positive supply, return the first excluded bid as uniform payment, or zero if demand does not exceed supply. Zero supply returns None.

split: open-access


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

N = 1
observations = []
def solve(buy, asks):
    return min((a[1] for a in asks if a[1]<=buy[1]),default=None)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('skip own ask', solve(['a',20+N], [['a',1],['b',8]]), 8)
check('all own', solve(['a',10], [['a',2]]), None)
check('external cheapest', solve(['a',10], [['b',2],['a',3]]), 2)
check('no crossing', solve(['a',1], [['b',2]]), None)
check('empty asks', solve(['a',10], []), None)
check('equal limit', solve(['a',7], [['b',7]]), 7)
print(json.dumps({"observations": observations, "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(buy, asks):
    eligible=sorted([a for a in asks if a[1]<=buy[1]],key=lambda a:a[1])
    return eligible[0][1] if eligible and eligible[0][0]!=buy[0] else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('skip own ask', solve(['a',20+N], [['a',1],['b',8]]), 8)
check('all own', solve(['a',10], [['a',2]]), None)
check('external cheapest', solve(['a',10], [['b',2],['a',3]]), 2)
check('no crossing', solve(['a',1], [['b',2]]), None)
check('empty asks', solve(['a',10], []), None)
check('equal limit', solve(['a',7], [['b',7]]), 7)
print(json.dumps({"observations": observations, "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 buy order matches its own owner.

For one buy [owner, limit] and asks [owner, price], return the cheapest differently owned ask price <= limit, or None. Input order breaks equal prices.

split: open-access


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

N = 1
observations = []
def solve(sizes, capacity):
    result=[]
    for i,size in enumerate(sizes):
     if capacity>0:
      result.append(i); capacity-=min(size,capacity)
    return result
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('skip oversized first', solve([10+N,2,1], 3), [1,2])
check('exact capacity', solve([2,3], 5), [0,1])
check('later smaller fits', solve([3,4,1], 4), [0,2])
check('no capacity', solve([1], 0), [])
check('empty', solve([], 5), [])
check('all too large', solve([5,6], 4), [])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(sizes, capacity):
    result=[]
    for i,size in enumerate(sizes):
     if size>capacity: break
     result.append(i); capacity-=size
    return result
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('skip oversized first', solve([10+N,2,1], 3), [1,2])
check('exact capacity', solve([2,3], 5), [0,1])
check('later smaller fits', solve([3,4,1], 4), [0,2])
check('no capacity', solve([1], 0), [])
check('empty', solve([], 5), [])
check('all too large', solve([5,6], 4), [])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A block request receives a forbidden partial allocation.

Process positive block sizes in submitted priority order. Accept a whole block if it fits remaining nonnegative capacity; otherwise skip it. Return accepted input indices.

split: open-access


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

N = 1
observations = []
def solve(rows):
    return [p for p,q in rows]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('multi-unit fill', solve([[10+N,3],[5,0]]), [(10+N)*3,0])
check('single unit', solve([[9,1]]), [9])
check('zero price', solve([[0,5]]), [0])
check('no rows', solve([]), [])
check('several fills', solve([[3,2],[4,5]]), [6,20])
check('all unfilled', solve([[7,0],[8,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(rows):
    return [p if q else 0 for p,q in rows]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('multi-unit fill', solve([[10+N,3],[5,0]]), [(10+N)*3,0])
check('single unit', solve([[9,1]]), [9])
check('zero price', solve([[0,5]]), [0])
check('no rows', solve([]), [])
check('several fills', solve([[3,2],[4,5]]), [6,20])
check('all unfilled', solve([[7,0],[8,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:
Pay-as-bid settlement treats every fill as one unit.

Given [bid-price, filled-units] rows of nonnegative integers, return each order charge price*filled-units; zero fill pays zero.

split: open-access


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

N = 1
observations = []
def solve(offers):
    used=set(); result=[]
    for i,(owner,items,value) in sorted(enumerate(offers),key=lambda x:-x[1][2]):
     if not used.intersection(items): result.append(i); used.update(items)
    return result
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('later better exclusive offer', solve([['a',['x'],2],['a',['y'],10+N],['b',['x'],3]]), [1,2])
check('disjoint same bidder', solve([['a',['x'],9],['a',['y'],8]]), [0])
check('overlapping items', solve([['a',['x'],9],['b',['x'],8]]), [0])
check('different owners disjoint', solve([['a',['x'],9],['b',['y'],8]]), [0,1])
check('stable ties', solve([['a',['x'],8],['b',['x'],8]]), [0])
check('no offers', solve([]), [])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(offers):
    seen=set(); retained=[]
    for i,o in enumerate(offers):
     if o[0] not in seen: retained.append((i,o)); seen.add(o[0])
    used=set(); result=[]
    for i,(owner,items,value) in sorted(retained,key=lambda x:-x[1][2]):
     if not used.intersection(items): result.append(i); used.update(items)
    return result
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('later better exclusive offer', solve([['a',['x'],2],['a',['y'],10+N],['b',['x'],3]]), [1,2])
check('disjoint same bidder', solve([['a',['x'],9],['a',['y'],8]]), [0])
check('overlapping items', solve([['a',['x'],9],['b',['x'],8]]), [0])
check('different owners disjoint', solve([['a',['x'],9],['b',['y'],8]]), [0,1])
check('stable ties', solve([['a',['x'],8],['b',['x'],8]]), [0])
check('no offers', solve([]), [])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
One bidder wins two mutually exclusive package offers.

Process [bidder, item-list, value] offers by descending value, stable on ties. Accept only if its bidder has not won and none of its items are used. Return accepted original indices. This is a greedy policy, not optimal welfare.

split: open-access


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

N = 1
observations = []
def solve(buy, sell):
    return min(buy[1],sell[1]) if buy[0]>sell[0] else 0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('equal limit', solve([10+N,3], [10+N,4]), 3)
check('strict cross', solve([12,5], [10,2]), 2)
check('no cross', solve([9,3], [10,3]), 0)
check('zero buy size', solve([10,0], [9,3]), 0)
check('zero sell size', solve([10,4], [9,0]), 0)
check('zero price', solve([0,2], [0,5]), 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(buy, sell):
    return min(buy[1],sell[1]) if buy[0]==sell[0] else 0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('equal limit', solve([10+N,3], [10+N,4]), 3)
check('strict cross', solve([12,5], [10,2]), 2)
check('no cross', solve([9,3], [10,3]), 0)
check('zero buy size', solve([10,0], [9,3]), 0)
check('zero sell size', solve([10,4], [9,0]), 0)
check('zero price', solve([0,2], [0,5]), 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:
Equal-price buy and sell limits fail to cross.

Return executable volume min(buy quantity, sell quantity) when buy limit >= sell limit, else zero. All inputs nonnegative integers.

split: open-access


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

N = 1
observations = []
def solve(requests, capacity):
    return [capacity*q//sum(requests) for q in requests]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('largest remainder is not first', solve([N,3*N], 2), [1,1])
check('strict larger remainder later', solve([1,2], 1), [0,1])
check('multiple residual units', solve([1,1,1], 2), [1,1,0])
check('zero capacity', solve([1,2], 0), [0,0])
check('full capacity', solve([2,3], 5), [2,3])
check('single bidder', solve([5], 3), [3])
check('empty', 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

N = 1
observations = []
def solve(requests, capacity):
    if not requests: return []
    result=[capacity*q//sum(requests) for q in requests]
    result[0]+=capacity-sum(result)
    return result
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('largest remainder is not first', solve([N,3*N], 2), [1,1])
check('strict larger remainder later', solve([1,2], 1), [0,1])
check('multiple residual units', solve([1,1,1], 2), [1,1,0])
check('zero capacity', solve([1,2], 0), [0,0])
check('full capacity', solve([2,3], 5), [2,3])
check('single bidder', solve([5], 3), [3])
check('empty', 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:
Marginal pro-rata allocation loses residual units.

For positive integer requests and capacity between zero and their sum, floor proportional shares then give one remaining unit to each largest fractional remainder, breaking ties by input order. Empty requests require zero capacity.

split: open-access


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

N = 1
observations = []
def solve(rows):
    return max(rows,key=lambda r:r[1])[0] if rows else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('balance tie breaker', solve([[N,10,4],[N+1,4,4]]), N+1)
check('volume before balance', solve([[1,2,2],[2,9,5]]), 2)
check('lowest final tie', solve([[5,4,4],[3,4,4]]), 3)
check('empty', solve([]), None)
check('single', solve([[7,0,0]]), 7)
check('supply shortage', solve([[1,20,1],[2,4,3]]), 2)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(rows):
    return min(rows,key=lambda r:(-min(r[1],r[2]),r[0]))[0] if rows else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('balance tie breaker', solve([[N,10,4],[N+1,4,4]]), N+1)
check('volume before balance', solve([[1,2,2],[2,9,5]]), 2)
check('lowest final tie', solve([[5,4,4],[3,4,4]]), 3)
check('empty', solve([]), None)
check('single', solve([[7,0,0]]), 7)
check('supply shortage', solve([[1,20,1],[2,4,3]]), 2)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Call clearing chooses peak demand instead of executable volume.

Given candidate rows [price,demand,supply], choose maximum min(demand,supply), then minimum abs(demand-supply), then lowest price. Empty rows return None.

split: open-access


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

N = 1
observations = []
def solve(size, minimum, opposing):
    return min(size,sum(q for q in opposing if q>=minimum))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('aggregate meets minimum', solve(10+N, 5, [2,3]), 5)
check('below minimum', solve(10, 5, [2,2]), 0)
check('one adequate opponent', solve(10, 5, [7]), 7)
check('empty book', solve(10, 5, []), 0)
check('cap requested size', solve(6, 5, [4,4]), 6)
check('exact requested minimum', solve(5, 5, [2,3,9]), 5)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(size, minimum, opposing):
    return min(size,sum(opposing))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('aggregate meets minimum', solve(10+N, 5, [2,3]), 5)
check('below minimum', solve(10, 5, [2,2]), 0)
check('one adequate opponent', solve(10, 5, [7]), 7)
check('empty book', solve(10, 5, []), 0)
check('cap requested size', solve(6, 5, [4,4]), 6)
check('exact requested minimum', solve(5, 5, [2,3,9]), 5)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A minimum-fill order is rejected despite sufficient aggregate counterparties.

For a buy size, minimum fill and already-price-compatible opposing sizes, aggregate available size; execute min(size,total) only if it is at least minimum, otherwise zero. Size >= minimum >=1; opposing sizes positive.

split: open-access


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

N = 1
observations = []
def solve(candidates, ranking):
    return [len(ranking)-1-ranking.index(c) if c in ranking else 0 for c in candidates]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cs = list(range(N+3))
check('single ranked candidate', solve(cs,[0]), [N+2]+[0]*(N+2))
check('empty ranking', solve(cs,[]), [0]*len(cs))
check('two ranked candidates', solve(cs,[1,0]), [N+1,N+2]+[0]*(N+1))
check('complete ranking', solve([0,1,2],[2,0,1]), [1,0,2])
check('single candidate', solve([0],[0]), [0])
check('omitted candidate retains zero', solve([0,1,2,3],[3,2]), [0,0,2,3])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(candidates, ranking):
    full = ranking + [c for c in candidates if c not in ranking]
    return [len(candidates)-1-full.index(c) for c in candidates]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cs = list(range(N+3))
check('single ranked candidate', solve(cs,[0]), [N+2]+[0]*(N+2))
check('empty ranking', solve(cs,[]), [0]*len(cs))
check('two ranked candidates', solve(cs,[1,0]), [N+1,N+2]+[0]*(N+1))
check('complete ranking', solve([0,1,2],[2,0,1]), [1,0,2])
check('single candidate', solve([0],[0]), [0])
check('omitted candidate retains zero', solve([0,1,2,3],[3,2]), [0,0,2,3])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Truncated rankings change the Borda point scale.

For unique candidate names and a unique partial ranking, return scores in candidate order; ranked position i earns m-1-i and omitted candidates earn zero.

split: open-access


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

N = 1
observations = []
def solve(ballots, a, b):
    return sum((r.index(a) if a in r else -1) < (r.index(b) if b in r else -1) for r in ballots)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ranked beats missing', solve([[0]]*N,0,1), N)
check('both missing tie', solve([[]]*N,0,1), 0)
check('missing loses', solve([[1]]*N,0,1), 0)
check('rank order', solve([[1,0],[0,1]],0,1), 1)
check('unrelated rank', solve([[2],[2,0]],0,1), 1)
check('no ballots', solve([],0,1), 0)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(ballots, a, b):
    return sum((r.index(a) if a in r else len(r)) <= (r.index(b) if b in r else len(r)) for r in ballots)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ranked beats missing', solve([[0]]*N,0,1), N)
check('both missing tie', solve([[]]*N,0,1), 0)
check('missing loses', solve([[1]]*N,0,1), 0)
check('rank order', solve([[1,0],[0,1]],0,1), 1)
check('unrelated rank', solve([[2],[2,0]],0,1), 1)
check('no ballots', solve([],0,1), 0)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Two omitted candidates acquire a fictitious pairwise preference.

Return number of partial unique rankings preferring a over b; both omitted are tied, one ranked beats one omitted.

split: open-access


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

N = 1
observations = []
def solve(votes, continuing, total):
    return votes*2 > total
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('exhaustion changes denominator', solve(N+1,2*N+1,4*N+4), True)
check('half is insufficient', solve(N,2*N,3*N), False)
check('empty electorate', solve(0,0,0), False)
check('unanimous continuing', solve(N,N,5*N), True)
check('minority', solve(N,2*N+1,2*N+1), False)
check('one continuing', solve(1,1,2), 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(votes, continuing, total):
    return votes*2 >= continuing
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('exhaustion changes denominator', solve(N+1,2*N+1,4*N+4), True)
check('half is insufficient', solve(N,2*N,3*N), False)
check('empty electorate', solve(0,0,0), False)
check('unanimous continuing', solve(N,N,5*N), True)
check('minority', solve(N,2*N+1,2*N+1), False)
check('one continuing', solve(1,1,2), 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:
Exhausted ballots prevent a continuing-ballot majority.

Given nonnegative candidate count, continuing count and total count with candidate<=continuing<=total, return whether candidate has a strict majority of continuing ballots. Zero continuing ballots have no majority.

split: open-access


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

N = 1
observations = []
def solve(ranking, active):
    return ranking[0] if ranking and ranking[0] in active else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('skip multiple eliminated candidates', solve(list(range(N+3)),[N+2]), N+2)
check('first active remains', solve([0,1,2],[0,2]), 0)
check('one eliminated', solve([0,1],[1]), 1)
check('all eliminated', solve([0,1],[]), None)
check('empty ranking', solve([],[0]), None)
check('active order irrelevant', solve([2,1,0],[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

N = 1
observations = []
def solve(ranking, active):
    r = ranking if ranking and ranking[0] in active else ranking[1:]
    return r[0] if r and r[0] in active else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('skip multiple eliminated candidates', solve(list(range(N+3)),[N+2]), N+2)
check('first active remains', solve([0,1,2],[0,2]), 0)
check('one eliminated', solve([0,1],[1]), 1)
check('all eliminated', solve([0,1],[]), None)
check('empty ranking', solve([],[0]), None)
check('active order irrelevant', solve([2,1,0],[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:
A transferred ranking stops at another eliminated candidate.

For a unique ranking and active candidate set, return first active candidate or None.

split: open-access


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

N = 1
observations = []
def solve(valid, seats):
    return (valid+seats)//(seats+1)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('exact division', solve(6*N,2), 2*N+1)
check('fractional division', solve(6*N+1,2), 2*N+1)
check('zero ballots', solve(0,N), 1)
check('one seat', solve(2*N,1), N+1)
check('more seats than ballots', solve(1,N+2), 1)
check('several seats', solve(20,3), 6)
print(json.dumps({"observations": observations, "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(valid, seats):
    return valid//seats+1
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('exact division', solve(6*N,2), 2*N+1)
check('fractional division', solve(6*N+1,2), 2*N+1)
check('zero ballots', solve(0,N), 1)
check('one seat', solve(2*N,1), N+1)
check('more seats than ballots', solve(1,N+2), 1)
check('several seats', solve(20,3), 6)
print(json.dumps({"observations": observations, "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 exact quotient omits the final quota increment.

For nonnegative integer valid count and positive seats return floor(valid/(seats+1))+1, including when the quotient is integral.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(weights, quota):
    return [str(Fraction(sum(weights)-quota,len(weights))) for w in weights]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unequal incoming values', solve([N,2*N],N), [str(Fraction(2*N,3)),str(Fraction(4*N,3))])
check('zero value retained', solve([0,N,2*N],N), ['0',str(Fraction(2*N,3)),str(Fraction(4*N,3))])
check('no surplus', solve([N,2*N],3*N), ['0','0'])
check('zero quota', solve([N,2*N],0), [str(N),str(2*N)])
check('single ballot', solve([3*N],N), [str(2*N)])
check('equal values', solve([N,N],N), [str(Fraction(N,2))]*2)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(weights, quota):
    return [str(Fraction(sum(weights)-quota,len([w for w in weights if w]))) if w else "0" for w in weights]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unequal incoming values', solve([N,2*N],N), [str(Fraction(2*N,3)),str(Fraction(4*N,3))])
check('zero value retained', solve([0,N,2*N],N), ['0',str(Fraction(2*N,3)),str(Fraction(4*N,3))])
check('no surplus', solve([N,2*N],3*N), ['0','0'])
check('zero quota', solve([N,2*N],0), [str(N),str(2*N)])
check('single ballot', solve([3*N],N), [str(2*N)])
check('equal values', solve([N,N],N), [str(Fraction(N,2))]*2)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Surplus transfer uses ballot count instead of ballot value.

Given nonnegative integer ballot weights with positive total and quota between zero and total, return exact transferred fractions as strings; each weight transfers weight*(total-quota)/total.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(votes, seats):
    out=[0]*len(votes)
    out[max(range(len(votes)),key=lambda i:votes[i])]=seats
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('update seat priority', solve([5*N,2*N],2), [2,0])
check('minority eventually receives seat', solve([5*N,2*N],3), [2,1])
check('equal priorities stable', solve([N,N],3), [2,1])
check('zero seats', solve([N,N],0), [0,0])
check('zero votes', solve([0,N],3), [0,3])
check('single group', solve([N],4), [4])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(votes, seats):
    out=[0]*len(votes)
    for _ in range(seats):
        i=max(range(len(votes)),key=lambda i:Fraction(votes[i],2*out[i]+1))
        out[i]+=1
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('update seat priority', solve([5*N,2*N],2), [2,0])
check('minority eventually receives seat', solve([5*N,2*N],3), [2,1])
check('equal priorities stable', solve([N,N],3), [2,1])
check('zero seats', solve([N,N],0), [0,0])
check('zero votes', solve([0,N],3), [0,3])
check('single group', solve([N],4), [4])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Sequential divisor allocation reuses initial priorities.

Allocate nonnegative seats sequentially by highest exact votes/(awarded+1), resolving equal priorities by earlier index. Votes are nonnegative with positive total.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(m, groups):
    out=['0']*m
    for pos,g in enumerate(groups):
        for c in g: out[c]=str(m-1-pos)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('top tie consumes positions', solve(3,[[0,1],[2]]), ['3/2','3/2','0'])
check('bottom tie', solve(3,[[0],[1,2]]), ['2','1/2','1/2'])
check('all tied varied size', solve(N+1,[list(range(N+1))]), [str(Fraction(N,2))]*(N+1))
check('no ties', solve(3,[[2],[0],[1]]), ['1','0','2'])
check('one candidate', solve(1,[[0]]), ['0'])
check('two distinct ties', solve(4,[[0,2],[1,3]]), ['5/2','1/2','5/2','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(m, groups):
    out=['0']*m; pos=0
    for g in groups:
        for c in g: out[c]=str(m-1-pos)
        pos+=len(g)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('top tie consumes positions', solve(3,[[0,1],[2]]), ['3/2','3/2','0'])
check('bottom tie', solve(3,[[0],[1,2]]), ['2','1/2','1/2'])
check('all tied varied size', solve(N+1,[list(range(N+1))]), [str(Fraction(N,2))]*(N+1))
check('no ties', solve(3,[[2],[0],[1]]), ['1','0','2'])
check('one candidate', solve(1,[[0]]), ['0'])
check('two distinct ties', solve(4,[[0,2],[1,3]]), ['5/2','1/2','5/2','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 tied rank consumes only one scoring position.

Groups partition all m candidates in rank order. Award each member the exact mean of Borda scores m-1-i for occupied positions, returned as strings in candidate order.

split: open-access


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

N = 1
observations = []
def solve(matrix):
    return max(range(len(matrix)),key=lambda i:sum(matrix[i][j]>matrix[j][i] for j in range(len(matrix)) if i!=j))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('three candidate cycle has no winner', solve([[0,N+1,0],[0,0,N+1],[N+1,0,0]]), None)
check('head to head tie disqualifies', solve([[0,N,N+1],[N,0,N+1],[0,0,0]]), None)
check('strict winner need not be first', solve([[0,0,N],[N+1,0,N+1],[0,0,0]]), 1)
check('single candidate', solve([[0]]), 0)
check('all contests tied', solve([[0,N,N],[N,0,N],[N,N,0]]), None)
check('two candidate strict contest', solve([[0,N],[N+1,0]]), 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(matrix):
    return next((i for i in range(len(matrix)) if all(i==j or matrix[i][j]>=matrix[j][i] for j in range(len(matrix)))),None)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('three candidate cycle has no winner', solve([[0,N+1,0],[0,0,N+1],[N+1,0,0]]), None)
check('head to head tie disqualifies', solve([[0,N,N+1],[N,0,N+1],[0,0,0]]), None)
check('strict winner need not be first', solve([[0,0,N],[N+1,0,N+1],[0,0,0]]), 1)
check('single candidate', solve([[0]]), 0)
check('all contests tied', solve([[0,N,N],[N,0,N],[N,N,0]]), None)
check('two candidate strict contest', solve([[0,N],[N+1,0]]), 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:
A plurality of pairwise victories is mistaken for beating every opponent.

Input is a nonempty square matrix of nonnegative head-to-head support counts with zero diagonal. Return the index strictly beating every other index, or None if none exists. A single candidate wins vacuously.

split: open-access


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

N = 1
observations = []
def solve(n, victories):
    return [list(edge) for edge in victories]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
chain=[[i,i+1] for i in range(N+2)]
check('long indirect cycle is rejected', solve(N+3,chain+[[N+2,0]]), chain)
check('acyclic transitive edge remains', solve(3,[[0,1],[1,2],[0,2]]), [[0,1],[1,2],[0,2]])
check('empty victories', solve(N+1,[]), [])
check('reverse contest rejected', solve(2,[[0,1],[1,0]]), [[0,1]])
check('rejected edge cannot affect later reachability', solve(4,[[0,1],[1,2],[2,0],[2,3],[3,0]]), [[0,1],[1,2],[2,3]])
check('disconnected components', solve(4,[[0,1],[2,3]]), [[0,1],[2,3]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(n, victories):
    locked=[]
    for a,b in victories:
        if [b,a] not in locked: locked.append([a,b])
    return locked
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
chain=[[i,i+1] for i in range(N+2)]
check('long indirect cycle is rejected', solve(N+3,chain+[[N+2,0]]), chain)
check('acyclic transitive edge remains', solve(3,[[0,1],[1,2],[0,2]]), [[0,1],[1,2],[0,2]])
check('empty victories', solve(N+1,[]), [])
check('reverse contest rejected', solve(2,[[0,1],[1,0]]), [[0,1]])
check('rejected edge cannot affect later reachability', solve(4,[[0,1],[1,2],[2,0],[2,3],[3,0]]), [[0,1],[1,2],[2,3]])
check('disconnected components', solve(4,[[0,1],[2,3]]), [[0,1],[2,3]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Locking a ranked pair closes an indirect preference cycle.

Given n candidates indexed 0..n-1 and unique directed victories already ordered by strength and a predetermined tie order, return locked edges in processing order. Reject any edge that would introduce a directed cycle. This models only the ranked-pairs locking stage.

split: open-access