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

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

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

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

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

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

prompt:
North-east-down positions are labeled as east-north-up.

Convert integer local NED [north,east,down] to ENU [east,north,up] with coincident origins.

split: open-access


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

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

N = 1
observations = []
def solve(t, q):
    return [-t[0],-t[1]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('quarter turn', solve([N,2*N],1), [-2*N,N])
check('negative quarter', solve([N,2*N],-1), [2*N,-N])
check('identity', solve([N,2*N],0), [-N,-2*N])
check('half turn', solve([N,2*N],2), [N,2*N])
check('origin', solve([0,0],1), [0,0])
check('full turns', solve([N,-N],5), [N,N])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

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

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

N = 1
observations = []
def solve(t, q):
    return list(rot([-t[0],-t[1]],q))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('quarter turn', solve([N,2*N],1), [-2*N,N])
check('negative quarter', solve([N,2*N],-1), [2*N,-N])
check('identity', solve([N,2*N],0), [-N,-2*N])
check('half turn', solve([N,2*N],2), [N,2*N])
check('origin', solve([0,0],1), [0,0])
check('full turns', solve([N,-N],5), [N,N])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
An inverse sensor pose negates translation in the wrong frame.

Pose maps child to parent by p_parent=R(q)*p_child+t. Return inverse translation for integer t and quarter-turn q.

split: open-access


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

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

N = 1
observations = []
def solve(v, q, t, kind):
    r=rot(v,q)
    return [r[i]+t[i] for i in range(2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('translated direction', solve([N,0],1,[N,2*N],"direction"), [0,N])
check('translated point', solve([N,0],1,[N,2*N],"point"), [N,3*N])
check('point origin', solve([0,0],0,[N,-N],"point"), [N,-N])
check('zero direction', solve([0,0],0,[N,-N],"direction"), [0,0])
check('pure rotation', solve([N,2*N],2,[0,0],"point"), [-N,-2*N])
check('negative rotation', solve([N,2*N],-1,[N,N],"direction"), [2*N,-N])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

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

N = 1
observations = []
def solve(v, q, t, kind):
    return list(rot(v,q))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('translated direction', solve([N,0],1,[N,2*N],"direction"), [0,N])
check('translated point', solve([N,0],1,[N,2*N],"point"), [N,3*N])
check('point origin', solve([0,0],0,[N,-N],"point"), [N,-N])
check('zero direction', solve([0,0],0,[N,-N],"direction"), [0,0])
check('pure rotation', solve([N,2*N],2,[0,0],"point"), [-N,-2*N])
check('negative rotation', solve([N,2*N],-1,[N,N],"direction"), [2*N,-N])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A rigid transform translates a direction vector.

kind is point or direction; transform integer 2D v by quarter-turn q and translation t. Return a list.

split: open-access


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

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

N = 1
observations = []
def solve(a, qa, b, qb):
    return [a[i]+b[i] for i in range(2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rotated mount', solve([N,N],1,[N,0],0), [N,2*N])
check('child orientation irrelevant', solve([N,N],0,[N,0],1), [2*N,N])
check('half turn parent', solve([N,N],2,[N,2*N],1), [0,-N])
check('zero mount', solve([N,N],1,[0,0],3), [N,N])
check('world origin', solve([0,0],-1,[N,2*N],2), [2*N,-N])
check('identity chain', solve([N,-N],0,[2*N,N],0), [3*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

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

N = 1
observations = []
def solve(a, qa, b, qb):
    r=rot(b,qb)
    return [a[i]+r[i] for i in range(2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rotated mount', solve([N,N],1,[N,0],0), [N,2*N])
check('child orientation irrelevant', solve([N,N],0,[N,0],1), [2*N,N])
check('half turn parent', solve([N,N],2,[N,2*N],1), [0,-N])
check('zero mount', solve([N,N],1,[0,0],3), [N,N])
check('world origin', solve([0,0],-1,[N,2*N],2), [2*N,-N])
check('identity chain', solve([N,-N],0,[2*N,N],0), [3*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:
A mounted sensor offset is added in the world frame.

Given parent world translation a and quarter-turn heading qa, and child translation b in parent coordinates with heading qb, return child world translation. qb does not affect its own origin.

split: open-access


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

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

N = 1
observations = []
def solve(v,w,r):
    return v
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('forward lever', solve([0,0],2,[N,0]), [0,2*N])
check('left lever', solve([0,0],2,[0,N]), [-2*N,0])
check('translation and rotation', solve([N,N],-1,[N,2*N]), [3*N,0])
check('zero angular', solve([N,-N],0,[N,N]), [N,-N])
check('zero lever', solve([N,-N],3,[0,0]), [N,-N])
check('negative lever', solve([0,0],-2,[-N,-N]), [-2*N,2*N])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

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

N = 1
observations = []
def solve(v,w,r):
    return [v[0]+w*r[1],v[1]-w*r[0]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('forward lever', solve([0,0],2,[N,0]), [0,2*N])
check('left lever', solve([0,0],2,[0,N]), [-2*N,0])
check('translation and rotation', solve([N,N],-1,[N,2*N]), [3*N,0])
check('zero angular', solve([N,-N],0,[N,N]), [N,-N])
check('zero lever', solve([N,-N],3,[0,0]), [N,-N])
check('negative lever', solve([0,0],-2,[-N,-N]), [-2*N,2*N])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A shifted velocity reference omits angular motion of the lever arm.

In a shared planar frame, v is origin velocity, w is signed angular velocity, r goes from origin to target point. Return target velocity v+[-w*ry,w*rx].

split: open-access


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

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

N = 1
observations = []
def solve(force,tau,r):
    return tau
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('transverse force', solve([0,2],0,[N,0]), -2*N)
check('other axis', solve([2,0],0,[0,N]), 2*N)
check('existing torque', solve([1,2],3*N,[N,N]), 2*N)
check('same origin', solve([1,2],N,[0,0]), N)
check('zero force', solve([0,0],N,[N,N]), N)
check('parallel force', solve([1,1],N,[N,N]), N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

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

N = 1
observations = []
def solve(force,tau,r):
    return tau+r[0]*force[1]-r[1]*force[0]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('transverse force', solve([0,2],0,[N,0]), -2*N)
check('other axis', solve([2,0],0,[0,N]), 2*N)
check('existing torque', solve([1,2],3*N,[N,N]), 2*N)
check('same origin', solve([1,2],N,[0,0]), N)
check('zero force', solve([0,0],N,[N,N]), N)
check('parallel force', solve([1,1],N,[N,N]), N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A force torque is transferred to a new origin with the wrong moment arm.

In a common planar basis, return torque about new origin: tau_new=tau_old-(rx*fy-ry*fx). Force and r are integer pairs.

split: open-access


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

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

N = 1
observations = []
def solve(q):
    return q
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('identity', solve([0,0,0,1]), [1,0,0,0])
check('x half turn', solve([1,0,0,0]), [0,1,0,0])
check('y half turn', solve([0,1,0,0]), [0,0,1,0])
check('z half turn', solve([0,0,1,0]), [0,0,0,1])
check('scaled wire value', solve([N,2*N,3*N,4*N]), [4*N,N,2*N,3*N])
check('negative representation', solve([-N,0,N,-N]), [-N,-N,0,N])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

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

N = 1
observations = []
def solve(q):
    return list(reversed(q))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('identity', solve([0,0,0,1]), [1,0,0,0])
check('x half turn', solve([1,0,0,0]), [0,1,0,0])
check('y half turn', solve([0,1,0,0]), [0,0,1,0])
check('z half turn', solve([0,0,1,0]), [0,0,0,1])
check('scaled wire value', solve([N,2*N,3*N,4*N]), [4*N,N,2*N,3*N])
check('negative representation', solve([-N,0,N,-N]), [-N,-N,0,N])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A scalar-last quaternion is read by a scalar-first adapter.

Convert a four-element xyzw quaternion representation to wxyz without changing signs, magnitude, or axis order. This adapter does not normalize or choose equivalent quaternion signs.

split: open-access


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

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

N = 1
observations = []
def solve(a,b,c):
    return [[a,c],[c,b]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('correlated', solve(4*N,9*N,2*N), [[9*N,-2*N],[-2*N,4*N]])
check('negative correlation', solve(4*N,9*N,-2*N), [[9*N,2*N],[2*N,4*N]])
check('diagonal', solve(N,2*N,0), [[2*N,0],[0,N]])
check('isotropic', solve(N,N,0), [[N,0],[0,N]])
check('zero uncertainty', solve(0,0,0), [[0,0],[0,0]])
check('rank one', solve(N,N,N), [[N,-N],[-N,N]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

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

N = 1
observations = []
def solve(a,b,c):
    return [[b,c],[c,a]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('correlated', solve(4*N,9*N,2*N), [[9*N,-2*N],[-2*N,4*N]])
check('negative correlation', solve(4*N,9*N,-2*N), [[9*N,2*N],[2*N,4*N]])
check('diagonal', solve(N,2*N,0), [[2*N,0],[0,N]])
check('isotropic', solve(N,N,0), [[N,0],[0,N]])
check('zero uncertainty', solve(0,0,0), [[0,0],[0,0]])
check('rank one', solve(N,N,N), [[N,-N],[-N,N]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Frame conversion drops the sign of cross-axis covariance.

A symmetric 2D covariance [[a,c],[c,b]] in x,y is converted to coordinates [-y,x]. Return [[b,-c],[-c,a]]. Inputs are positive semidefinite.

split: open-access


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

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

N = 1
observations = []
def solve(translation,is_static,sample_time,requested_time):
    return translation if sample_time==requested_time else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('old static calibration', solve([N,0],True,0,100+N), [N,0])
check('stale dynamic', solve([N,0],False,0,100+N), None)
check('exact dynamic', solve([N,N],False,N,N), [N,N])
check('future dynamic', solve([N,0],False,N+1,N), None)
check('static earlier query', solve([N,-N],True,100+N,0), [N,-N])
check('zero time dynamic', solve([0,0],False,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

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

N = 1
observations = []
def solve(translation,is_static,sample_time,requested_time):
    return translation
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('old static calibration', solve([N,0],True,0,100+N), [N,0])
check('stale dynamic', solve([N,0],False,0,100+N), None)
check('exact dynamic', solve([N,N],False,N,N), [N,N])
check('future dynamic', solve([N,0],False,N+1,N), None)
check('static earlier query', solve([N,-N],True,100+N,0), [N,-N])
check('zero time dynamic', solve([0,0],False,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 static mounting transform expires like a sampled pose.

Return translation if an edge is static or its sample_time equals requested_time; otherwise None. No interpolation or extrapolation is permitted for dynamic edges.

split: open-access


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

N = 1
observations = []
def solve(x, source, target, offset):
    return [x, target]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('forward', solve(N, "A", "B", 10), [N+10,"B"])
check('reverse', solve(N, "B", "A", 10), [N-10,"A"])
check('already B', solve(N, "B", "B", 10), [N,"B"])
check('already A', solve(N, "A", "A", 10), [N,"A"])
check('zero calibration', solve(N, "A", "B", 0), [N,"B"])
check('negative calibration', solve(N, "A", "B", -3), [N-3,"B"])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(x, source, target, offset):
    return [x + (offset if target == 'B' else -offset), target]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('forward', solve(N, "A", "B", 10), [N+10,"B"])
check('reverse', solve(N, "B", "A", 10), [N-10,"A"])
check('already B', solve(N, "B", "B", 10), [N,"B"])
check('already A', solve(N, "A", "A", 10), [N,"A"])
check('zero calibration', solve(N, "A", "B", 0), [N,"B"])
check('negative calibration', solve(N, "A", "B", -3), [N-3,"B"])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A frame label is changed without transforming its coordinates.

Toy one-axis catalog adapter: transform offset maps source A to B; reverse mapping subtracts it; identical frames preserve x. Frames are A or B.

split: open-access


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

N = 1
observations = []
def solve(value, unit):
    return value % 360
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('hour input', solve(N, "hours"), 15*N)
check('degree input', solve(N, "degrees"), N)
check('one full day', solve(24, "hours"), 0)
check('negative hour', solve(-N, "hours"), 360-15*N)
check('degree wrap', solve(360+N, "degrees"), N)
check('zero', solve(0, "hours"), 0)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(value, unit):
    return value * 15 % 360
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('hour input', solve(N, "hours"), 15*N)
check('degree input', solve(N, "degrees"), N)
check('one full day', solve(24, "hours"), 0)
check('negative hour', solve(-N, "hours"), 360-15*N)
check('degree wrap', solve(360+N, "degrees"), N)
check('zero', solve(0, "hours"), 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 right-ascension adapter ignores the declared hours unit.

Return toy RA in degrees modulo 360; unit is hours or degrees; one hour is stipulated as 15 degrees.

split: open-access


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

N = 1
observations = []
def solve(sign, d, m, s):
    return d*3600+m*60+s
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('southern zero degree', solve("-", 0, N, 2), -60*N-2)
check('southern whole degree', solve("-", N, 0, 0), -3600*N)
check('southern fraction', solve("-", N, 1, 2), -3600*N-62)
check('north', solve("+", N, 1, 2), 3600*N+62)
check('origin', solve("-", 0, 0, 0), 0)
check('last minute', solve("-", 0, 59, 59), -3599)
print(json.dumps({"observations": observations, "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(sign, d, m, s):
    return (-d if sign == '-' else d)*3600+m*60+s
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('southern zero degree', solve("-", 0, N, 2), -60*N-2)
check('southern whole degree', solve("-", N, 0, 0), -3600*N)
check('southern fraction', solve("-", N, 1, 2), -3600*N-62)
check('north', solve("+", N, 1, 2), 3600*N+62)
check('origin', solve("-", 0, 0, 0), 0)
check('last minute', solve("-", 0, 59, 59), -3599)
print(json.dumps({"observations": observations, "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 negative-zero declination loses its hemisphere.

Input sign is + or -, d is nonnegative degrees, m and s are 0..59; return signed arcseconds including when d is zero.

split: open-access


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

N = 1
observations = []
def solve(ra, p, c, dt, convention):
    return ra+p*dt
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('projected motion', solve(N, 6, 0.5, 2, "projected"), N+24)
check('raw motion', solve(N, 6, 0.5, 2, "raw"), N+12)
check('singularity', solve(N, 6, 0, 2, "projected"), None)
check('equatorial factor', solve(N, 6, 1, 2, "projected"), N+12)
check('back propagation', solve(N, 6, 0.5, -1, "projected"), N-12)
check('stationary', solve(N, 0, 0.5, 2, "projected"), 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(ra, p, c, dt, convention):
    return None if convention == 'projected' and c == 0 else ra+p*(c if convention == 'projected' else 1)*dt
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('projected motion', solve(N, 6, 0.5, 2, "projected"), N+24)
check('raw motion', solve(N, 6, 0.5, 2, "raw"), N+12)
check('singularity', solve(N, 6, 0, 2, "projected"), None)
check('equatorial factor', solve(N, 6, 1, 2, "projected"), N+12)
check('back propagation', solve(N, 6, 0.5, -1, "projected"), N-12)
check('stationary', solve(N, 0, 0.5, 2, "projected"), 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 projected catalog motion is propagated as raw coordinate motion.

Stipulated linear RA adapter: raw rate is p/c for projected convention and p for raw convention. c=0 with projected rate yields None. No spherical integration claimed.

split: open-access


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

N = 1
observations = []
def solve(x, rate, ref, observed, target):
    return x+rate*(target-observed)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('different provenance', solve(N, 2, 10, 12, 15), N+10)
check('at reference', solve(N, 2, 10, 12, 10), N)
check('backward', solve(N, 2, 10, 12, 8), N-4)
check('zero reference', solve(N, 2, 0, 3, 5), N+10)
check('static', solve(N, 0, 10, 12, 15), N)
check('observation equals target', solve(N, 2, 10, 15, 15), N+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(x, rate, ref, observed, target):
    return x+rate*target
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('different provenance', solve(N, 2, 10, 12, 15), N+10)
check('at reference', solve(N, 2, 10, 12, 10), N)
check('backward', solve(N, 2, 10, 12, 8), N-4)
check('zero reference', solve(N, 2, 0, 3, 5), N+10)
check('static', solve(N, 0, 10, 12, 15), N)
check('observation equals target', solve(N, 2, 10, 15, 15), N+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:
Propagation confuses a catalog reference epoch with its observation epoch.

Toy linear catalog: position x is defined at reference epoch ref; observed is provenance only; return x+rate*(target-ref). Epochs are arbitrary integer model ticks.

split: open-access


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

N = 1
observations = []
def solve(direction, distance):
    return [v*(distance if distance is not None else 1) for v in direction]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unknown', solve([1,0,0], None), None)
check('explicit zero', solve([1,0,0], 0), [0,0,0])
check('known radial', solve([1,0,0], N), [N,0,0])
check('other axis', solve([0,1,0], N), [0,N,0])
check('signed direction', solve([-1,0,0], N), [-N,0,0])
check('fractional distance', solve([0,0,1], 0.5), [0,0,0.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(direction, distance):
    return [v*distance for v in direction] if distance else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unknown', solve([1,0,0], None), None)
check('explicit zero', solve([1,0,0], 0), [0,0,0])
check('known radial', solve([1,0,0], N), [N,0,0])
check('other axis', solve([0,1,0], N), [0,N,0])
check('signed direction', solve([-1,0,0], N), [-N,0,0])
check('fractional distance', solve([0,0,1], 0.5), [0,0,0.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:
An absent catalog distance becomes a fabricated spatial point.

Toy catalog projection: direction is a three-number vector; distance None means unknown and returns None; all nonnegative numeric distances including zero produce componentwise products.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(f, rest, mode):
    return str(Fraction(rest-f,f))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('radio redshift', solve(N, 2*N, "radio"), '1/2')
check('optical redshift', solve(N, 2*N, "optical"), '1')
check('radio blueshift', solve(2*N, N, "radio"), '-1')
check('optical blueshift', solve(2*N, N, "optical"), '-1/2')
check('zero shift', solve(N, N, "radio"), '0')
check('nonbinary ratio', solve(2*N, 3*N, "optical"), '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(f, rest, mode):
    return str(Fraction(rest-f,rest))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('radio redshift', solve(N, 2*N, "radio"), '1/2')
check('optical redshift', solve(N, 2*N, "optical"), '1')
check('radio blueshift', solve(2*N, N, "radio"), '-1')
check('optical blueshift', solve(2*N, N, "optical"), '-1/2')
check('zero shift', solve(N, N, "radio"), '0')
check('nonbinary ratio', solve(2*N, 3*N, "optical"), '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:
Radio and optical velocity conventions use different frequency denominators.

Positive integer frequencies f and rest; mode radio or optical. Return reduced rational v/c string: (rest-f)/rest for radio, (rest-f)/f for optical. This tests convention conversion, not a relativistic physical speed.

split: open-access


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

N = 1
observations = []
def solve(delta, matrix, scale, mode):
    return [scale[i]*sum(matrix[i][j]*delta[j] for j in range(2)) for i in range(2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('CD includes scale', solve([N,2], [[2,1],[1,3]], [5,7], "CD"), [2*N+2,N+6])
check('PC needs row scales', solve([N,2], [[2,1],[1,3]], [5,7], "PC"), [10*N+10,7*N+42])
check('reference pixel', solve([0,0], [[2,1],[1,3]], [5,7], "PC"), [0,0])
check('unit scales', solve([N,2], [[2,1],[1,3]], [1,1], "PC"), [2*N+2,N+6])
check('negative axis scale', solve([N,2], [[1,0],[0,1]], [-2,3], "PC"), [-2*N,6])
check('CD ignores stale scale', solve([N,2], [[1,0],[0,1]], [0,0], "CD"), [N,2])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(delta, matrix, scale, mode):
    return [sum(matrix[i][j]*delta[j] for j in range(2)) for i in range(2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('CD includes scale', solve([N,2], [[2,1],[1,3]], [5,7], "CD"), [2*N+2,N+6])
check('PC needs row scales', solve([N,2], [[2,1],[1,3]], [5,7], "PC"), [10*N+10,7*N+42])
check('reference pixel', solve([0,0], [[2,1],[1,3]], [5,7], "PC"), [0,0])
check('unit scales', solve([N,2], [[2,1],[1,3]], [1,1], "PC"), [2*N+2,N+6])
check('negative axis scale', solve([N,2], [[1,0],[0,1]], [-2,3], "PC"), [-2*N,6])
check('CD ignores stale scale', solve([N,2], [[1,0],[0,1]], [0,0], "CD"), [N,2])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A FITS CD matrix receives the CDELT axis scale a second time.

Reduced two-axis linear FITS WCS model: delta is pixel offset, matrix is CD or PC according to mode. CD maps directly; PC requires output-row scaling by scale. Return two intermediate world coordinates, before sky projection.

split: open-access


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

N = 1
observations = []
def solve(u, v, a, b, sx, sy):
    return [sx*u+a*(sx*u)**2+b*(sx*u)*(sy*v),sy*v]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('square and cross distortion', solve(N,2,1,1,3,4), [3*(N+N*N+2*N),8])
check('cross term only', solve(N,2,0,1,3,4), [9*N,8])
check('square only', solve(N,0,1,0,3,4), [3*(N+N*N),0])
check('reference origin', solve(0,0,1,1,3,4), [0,0])
check('identity transform', solve(N,2,1,1,1,1), [N+N*N+2*N,2])
check('no distortion', solve(N,-2,0,0,3,4), [3*N,-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(u, v, a, b, sx, sy):
    return [sx*(u+a*u*u)+b*(sx*u)*(sy*v),sy*v]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('square and cross distortion', solve(N,2,1,1,3,4), [3*(N+N*N+2*N),8])
check('cross term only', solve(N,2,0,1,3,4), [9*N,8])
check('square only', solve(N,0,1,0,3,4), [3*(N+N*N),0])
check('reference origin', solve(0,0,1,1,3,4), [0,0])
check('identity transform', solve(N,2,1,1,1,1), [N+N*N+2*N,2])
check('no distortion', solve(N,-2,0,0,3,4), [3*N,-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:
SIP distortion is evaluated after the linear WCS transform.

Reduced SIP model for reference-relative pixel offsets u,v: corrected pair (u+a*u*u+b*u*v,v), followed by diagonal linear matrix (sx,sy). Return intermediate coordinates, no sky projection or full SIP implementation.

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, b, c):
    return str(Fraction(m+b))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('both redshift terms', solve(N,2*N,10*N), str(Fraction(16*N,5)))
check('opposing terms', solve(N,-2*N,10*N), str(Fraction(-6*N,5)))
check('zero correction', solve(N,0,10*N), str(N))
check('zero measured', solve(0,N,10*N), str(N))
check('both zero', solve(0,0,10*N), '0')
check('both negative', solve(-N,-2*N,10*N), str(Fraction(-14*N,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
from fractions import Fraction
N = 1
observations = []
def solve(m, b, c):
    return str(Fraction(m+b)/(1+Fraction(m*b,c*c)))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('both redshift terms', solve(N,2*N,10*N), str(Fraction(16*N,5)))
check('opposing terms', solve(N,-2*N,10*N), str(Fraction(-6*N,5)))
check('zero correction', solve(N,0,10*N), str(N))
check('zero measured', solve(0,N,10*N), str(N))
check('both zero', solve(0,0,10*N), '0')
check('both negative', solve(-N,-2*N,10*N), str(Fraction(-14*N,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:
Optical barycentric velocity correction omits the redshift cross term.

Toy exact optical-velocity correction: positive rational speed constant c, measured m and correction b. Return rational string m+b+m*b/c; inputs avoid the singular denominator in the deliberately wrong relativistic attempt. No barycentric correction is computed here.

split: open-access


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

N = 1
observations = []
def solve(route, prohibited):
    return any(route[i:i+2] == prohibited[-2:] for i in range(len(route)-1))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
a,b,c,x = N, N+10, N+20, N+30
check('whole maneuver', solve([a,b,c],[a,b,c]), True)
check('unrelated approach', solve([x,b,c],[a,b,c]), False)
check('maneuver inside itinerary', solve([x,a,b,c,x],[a,b,c]), True)
check('separated roads', solve([a,x,b,c],[a,b,c]), False)
check('route too short', solve([b,c],[a,b,c]), False)
check('reverse order', solve([c,b,a],[a,b,c]), False)
check('empty route', solve([],[a,b,c]), False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(route, prohibited):
    return route == prohibited
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
a,b,c,x = N, N+10, N+20, N+30
check('whole maneuver', solve([a,b,c],[a,b,c]), True)
check('unrelated approach', solve([x,b,c],[a,b,c]), False)
check('maneuver inside itinerary', solve([x,a,b,c,x],[a,b,c]), True)
check('separated roads', solve([a,x,b,c],[a,b,c]), False)
check('route too short', solve([b,c],[a,b,c]), False)
check('reverse order', solve([c,b,a],[a,b,c]), False)
check('empty route', solve([],[a,b,c]), False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A via-way prohibition blocks unrelated approaches in the controlled route-policy fixture.

Return whether a nonempty road-ID prohibition occurs contiguously anywhere in a road sequence.

split: open-access


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

N = 1
observations = []
def solve(incoming, outgoing, rules):
    return outgoing in [b for a,b in rules] if rules else True
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
a,b,c,x = N,N+10,N+20,N+30
rules = [(a,b),(a,c)]
check('first permitted', solve(a,b,rules), True)
check('second permitted', solve(a,c,rules), True)
check('restricted wrong exit', solve(a,x,rules), False)
check('unrelated incoming', solve(x,x,rules), True)
check('no rules', solve(a,x,[]), True)
check('other approach rules', solve(x,c,[(a,b),(x,c)]), True)
check('other approach denied', solve(x,b,[(a,b),(x,c)]), False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(incoming, outgoing, rules):
    for a,b in rules:
        if a == incoming:
            return outgoing == b
    return True
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
a,b,c,x = N,N+10,N+20,N+30
rules = [(a,b),(a,c)]
check('first permitted', solve(a,b,rules), True)
check('second permitted', solve(a,c,rules), True)
check('restricted wrong exit', solve(a,x,rules), False)
check('unrelated incoming', solve(x,x,rules), True)
check('no rules', solve(a,x,[]), True)
check('other approach rules', solve(x,c,[(a,b),(x,c)]), True)
check('other approach denied', solve(x,b,[(a,b),(x,c)]), False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
An only-turn rule leaks onto other incoming roads in the controlled route-policy fixture.

Rules are pairs of incoming and permitted outgoing IDs. For one incoming road matching rules form a union; an unmatched approach permits all exits.

split: open-access


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

N = 1
observations = []
def solve(access, zone, origin, destination):
    return access != 'closed'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
z = [N,N+1]
check('through traffic denied', solve('destination',z,N+9,N+10), False)
check('local arrival', solve('destination',z,N+9,N), True)
check('local departure', solve('destination',z,N,N+9), True)
check('internal trip', solve('destination',z,N,N+1), True)
check('public road', solve('public',z,N+9,N+10), True)
check('closed overrides local', solve('closed',z,N,N), False)
check('empty zone', solve('destination',[],N,N), False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(access, zone, origin, destination):
    return access == 'public' or (access == 'destination' and destination in zone)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
z = [N,N+1]
check('through traffic denied', solve('destination',z,N+9,N+10), False)
check('local arrival', solve('destination',z,N+9,N), True)
check('local departure', solve('destination',z,N,N+9), True)
check('internal trip', solve('destination',z,N,N+1), True)
check('public road', solve('public',z,N+9,N+10), True)
check('closed overrides local', solve('closed',z,N,N), False)
check('empty zone', solve('destination',[],N,N), False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A destination-only road becomes a through-road shortcut in the controlled route-policy fixture.

For this zone model public roads always permit travel, closed roads never do, and destination roads require origin or destination in the supplied zone.

split: open-access


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

N = 1
observations = []
def solve(height, margin, clearance):
    return clearance is None or height <= clearance
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
h = 200 + N
check('unknown survey', solve(h,10,None), False)
check('margin omitted', solve(h,10,h+5), False)
check('exact threshold', solve(h,10,h+10), True)
check('above threshold', solve(h,10,h+11), True)
check('physical collision', solve(h,0,h-1), False)
check('zero margin equality', solve(h,0,h), 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(height, margin, clearance):
    return clearance is not None and height + margin < clearance
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
h = 200 + N
check('unknown survey', solve(h,10,None), False)
check('margin omitted', solve(h,10,h+5), False)
check('exact threshold', solve(h,10,h+10), True)
check('above threshold', solve(h,10,h+11), True)
check('physical collision', solve(h,0,h-1), False)
check('zero margin equality', solve(h,0,h), True)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A vehicle is admitted without sufficient surveyed clearance in the controlled route-policy fixture.

All dimensions are integer centimeters. Unknown clearance is None and rejects travel; equality with height plus margin permits travel.

split: open-access


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

N = 1
observations = []
def solve(current, target, links):
    return any(b == target for a,b in links)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
a,b,c = N,N+10,N+20
links = [(a,b),(c,c)]
check('listed transition', solve(a,b,links), True)
check('wrong source lane', solve(c,b,links), False)
check('reverse link absent', solve(b,a,links), False)
check('explicit self link', solve(c,c,links), True)
check('implicit self link denied', solve(a,a,links), False)
check('empty connectivity', solve(a,b,[]), False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(current, target, links):
    return (current,target) in links or (target,current) in links
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
a,b,c = N,N+10,N+20
links = [(a,b),(c,c)]
check('listed transition', solve(a,b,links), True)
check('wrong source lane', solve(c,b,links), False)
check('reverse link absent', solve(b,a,links), False)
check('explicit self link', solve(c,c,links), True)
check('implicit self link denied', solve(a,a,links), False)
check('empty connectivity', solve(a,b,[]), False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Lane guidance invents a connection to an exit lane in the controlled route-policy fixture.

Return whether a directed lane transition exists; identity transitions are allowed only if explicitly present.

split: open-access


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

N = 1
observations = []
def solve(arms, selected):
    for i,(name,allowed,public) in enumerate(arms):
        if name == selected:
            return i+1
    return None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
a,b,c,d = N,N+10,N+20,N+30
arms = [(a,False,True),(b,True,True),(c,True,False),(d,True,True)]
check('entrance excluded', solve(arms,b), 1)
check('private legal exit counted', solve(arms,c), 2)
check('later exit ordinal', solve(arms,d), 3)
check('forbidden selected arm', solve(arms,a), None)
check('unknown arm', solve(arms,N+40), None)
check('empty roundabout', solve([],a), None)
check('first arm legal', solve([(a,True,True)],a), 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(arms, selected):
    count = 0
    for name,allowed,public in arms:
        count += bool(allowed and public)
        if name == selected:
            return count if allowed and public else None
    return None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
a,b,c,d = N,N+10,N+20,N+30
arms = [(a,False,True),(b,True,True),(c,True,False),(d,True,True)]
check('entrance excluded', solve(arms,b), 1)
check('private legal exit counted', solve(arms,c), 2)
check('later exit ordinal', solve(arms,d), 3)
check('forbidden selected arm', solve(arms,a), None)
check('unknown arm', solve(arms,N+40), None)
check('empty roundabout', solve([],a), None)
check('first arm legal', solve([(a,True,True)],a), 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:
Roundabout instructions count entrances as exits in the controlled route-policy fixture.

Arms are ordered after entry as (ID, may_exit, public). Return one-based legal-exit ordinal for a legal selected arm, or None for an absent or forbidden arm.

split: open-access


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

N = 1
observations = []
def solve(segments):
    return not segments or all(kind != 'road_toll' or fee == 0 for kind,fee in [segments[0],segments[-1]])
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('interior toll', solve([('free',0),('road_toll',N),('free',0)]), False)
check('ferry fare is distinct', solve([('ferry',N)]), True)
check('zero toll', solve([('road_toll',0)]), True)
check('first segment toll', solve([('road_toll',N),('free',0)]), False)
check('last segment toll', solve([('free',0),('road_toll',N)]), False)
check('empty route', solve([]), True)
check('all free', solve([('free',0)]*N), True)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(segments):
    return all(fee == 0 for kind,fee in segments)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('interior toll', solve([('free',0),('road_toll',N),('free',0)]), False)
check('ferry fare is distinct', solve([('ferry',N)]), True)
check('zero toll', solve([('road_toll',0)]), True)
check('first segment toll', solve([('road_toll',N),('free',0)]), False)
check('last segment toll', solve([('free',0),('road_toll',N)]), False)
check('empty route', solve([]), True)
check('all free', solve([('free',0)]*N), True)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Toll avoidance checks only the route endpoints in the controlled route-policy fixture.

Segments are (kind, charge_in_cents), with kind road_toll, ferry, or free. Return whether a route satisfies avoidance of positive road tolls; an empty route satisfies it.

split: open-access


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

N = 1
observations = []
def solve(entry, duration, direction, windows):
    return any(a <= entry < b and d == direction for a,b,d in windows)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
t = N*100
w = [(t,t+10,'east'),(t+10,t+20,'west')]
check('finish at switch', solve(t+5,5,'east',w), True)
check('overrun switch', solve(t+5,6,'east',w), False)
check('new direction at boundary', solve(t+10,1,'west',w), True)
check('old direction at boundary', solve(t+10,1,'east',w), False)
check('before window', solve(t-1,1,'east',w), False)
check('whole window', solve(t,10,'east',w), True)
check('no allocation', solve(t,1,'east',[]), False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(entry, duration, direction, windows):
    return any(a <= entry and entry + duration < b and d == direction for a,b,d in windows)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
t = N*100
w = [(t,t+10,'east'),(t+10,t+20,'west')]
check('finish at switch', solve(t+5,5,'east',w), True)
check('overrun switch', solve(t+5,6,'east',w), False)
check('new direction at boundary', solve(t+10,1,'west',w), True)
check('old direction at boundary', solve(t+10,1,'east',w), False)
check('before window', solve(t-1,1,'east',w), False)
check('whole window', solve(t,10,'east',w), True)
check('no allocation', solve(t,1,'east',[]), False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A reversible lane is used after its direction changes in the controlled route-policy fixture.

Windows are nonoverlapping (start,end,direction) on an absolute integer timeline. Entry is inclusive and exit may equal end; travel duration is positive.

split: open-access


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

N = 1
observations = []
def solve(candidates, deck, mode):
    return min(candidates, key=lambda c:(c[1],c[0]))[0] if candidates else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
c = [('bridge',0,N+1,['car']),('walk',1,N,['walk']),('road',2,N,['car'])]
check('deck and mode', solve(c,N,'car'), 'road')
check('pedestrian deck', solve(c,N,'walk'), 'walk')
check('bridge deck', solve(c,N+1,'car'), 'bridge')
check('missing mode', solve(c,N,'bike'), None)
check('missing deck', solve(c,N+2,'car'), None)
check('empty candidates', solve([],N,'car'), None)
check('stable tie', solve([('z',N,N,['car']),('a',N,N,['car'])],N,'car'), '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(candidates, deck, mode):
    eligible = [c for c in candidates if c[2] == deck]
    return min(eligible,key=lambda c:(c[1],c[0]))[0] if eligible else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
c = [('bridge',0,N+1,['car']),('walk',1,N,['walk']),('road',2,N,['car'])]
check('deck and mode', solve(c,N,'car'), 'road')
check('pedestrian deck', solve(c,N,'walk'), 'walk')
check('bridge deck', solve(c,N+1,'car'), 'bridge')
check('missing mode', solve(c,N,'bike'), None)
check('missing deck', solve(c,N+2,'car'), None)
check('empty candidates', solve([],N,'car'), None)
check('stable tie', solve([('z',N,N,['car']),('a',N,N,['car'])],N,'car'), '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:
Map matching snaps a waypoint onto an inaccessible bridge deck in the controlled route-policy fixture.

Candidates are (ID, nonnegative integer distance, deck, modes). Return the closest ID matching the known deck and requested mode, or None. Ties use lexicographic ID.

split: open-access


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

N = 1
observations = []
def solve(direction, driving_side, curb, road_id, waypoint_road_id):
    return road_id == waypoint_road_id
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
# Vary approach order without changing the explicitly named physical-side oracle.
d = 'east' if N % 2 else 'west'
side = 'south' if N % 2 else 'north'
other = 'north' if N % 2 else 'south'
check('right-driving served curb', solve(d,'right',side,N,N), True)
check('right-driving opposite curb', solve(d,'right',other,N,N), False)
check('left-driving served curb', solve(d,'left',other,N,N), True)
check('left-driving opposite curb', solve(d,'left',side,N,N), False)
check('unrestricted curb', solve(d,'left','either',N,N), True)
check('different road', solve(d,'right',side,N,N+1), False)
check('different road unrestricted', solve(d,'left','either',N,N+1), False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(direction, driving_side, curb, road_id, waypoint_road_id):
    return road_id == waypoint_road_id and (curb == 'either' or curb == ('south' if direction == 'east' else 'north'))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
# Vary approach order without changing the explicitly named physical-side oracle.
d = 'east' if N % 2 else 'west'
side = 'south' if N % 2 else 'north'
other = 'north' if N % 2 else 'south'
check('right-driving served curb', solve(d,'right',side,N,N), True)
check('right-driving opposite curb', solve(d,'right',other,N,N), False)
check('left-driving served curb', solve(d,'left',other,N,N), True)
check('left-driving opposite curb', solve(d,'left',side,N,N), False)
check('unrestricted curb', solve(d,'left','either',N,N), True)
check('different road', solve(d,'right',side,N,N+1), False)
check('different road unrestricted', solve(d,'left','either',N,N+1), False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A curbside waypoint accepts arrival from the wrong carriageway in the controlled route-policy fixture.

This straight east-west two-carriageway model has north/south curbs. A right-driving eastbound vehicle serves south; westbound serves north. Left-driving reverses this. either permits either curb.

split: open-access


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

N = 1
observations = []
def solve(start, end, wraps, modulus):
    return (end-start) % modulus
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('multiple wraps', solve(8, 2, N+1, 10), 10*(N+1)-6)
check('wrap ending above start', solve(2, 5, N, 10), 10*N+3)
check('ordinary increment', solve(2, 5, 0, 10), 3)
check('one wrap', solve(9, 1, 1, 10), 2)
check('stationary counter', solve(5, 5, 0, 10), 0)
check('full revolution', solve(5, 5, 1, 10), 10)
check('contradiction', solve(9, 1, 0, 10), 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, wraps, modulus):
    return end-start + (modulus if end < start else 0)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('multiple wraps', solve(8, 2, N+1, 10), 10*(N+1)-6)
check('wrap ending above start', solve(2, 5, N, 10), 10*N+3)
check('ordinary increment', solve(2, 5, 0, 10), 3)
check('one wrap', solve(9, 1, 1, 10), 2)
check('stationary counter', solve(5, 5, 0, 10), 0)
check('full revolution', solve(5, 5, 1, 10), 10)
check('contradiction', solve(9, 1, 0, 10), 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 register delta loses complete counter revolutions.

Given consecutive readings in [0, modulus) and a nonnegative wrap-count increment, return energy = end-start+wraps*modulus. Inconsistent negative energy returns None. Wrap count is authoritative, including multiple revolutions.

split: open-access


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

N = 1
observations = []
def solve(phases):
    v=sum(phases)
    return [max(v,0),max(-v,0)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('simultaneous directions', solve([3*N,-2*N,0]), [3*N,2*N])
check('balanced phases', solve([N,-N]), [N,N])
check('all import', solve([N,2*N]), [3*N,0])
check('all export', solve([-N,-2*N]), [0,3*N])
check('idle', solve([0,0,0]), [0,0])
check('single export', solve([-N]), [0,N])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(phases):
    return [sum(abs(v) for v in phases),0]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('simultaneous directions', solve([3*N,-2*N,0]), [3*N,2*N])
check('balanced phases', solve([N,-N]), [N,N])
check('all import', solve([N,2*N]), [3*N,0])
check('all export', solve([-N,-2*N]), [0,3*N])
check('idle', solve([0,0,0]), [0,0])
check('single export', solve([-N]), [0,N])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Per-phase direction registers are collapsed before settlement.

For signed simultaneous phase energies, positive means import. Return [sum of positive phases, absolute sum of negative phases]. The modeled meter records import and export separately without cross-phase netting.

split: open-access


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

N = 1
observations = []
def solve(rows):
    return max(sum(i-e for i,e in rows),0)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('export cannot cross intervals', solve([[3*N,0],[0,2*N]]), 3*N)
check('within interval credit', solve([[3*N,N]]), 2*N)
check('balanced interval', solve([[N,N]]), 0)
check('export only', solve([[0,N]]), 0)
check('import only', solve([[N,0]]), N)
check('empty period', 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 sum(i for i,e in rows)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('export cannot cross intervals', solve([[3*N,0],[0,2*N]]), 3*N)
check('within interval credit', solve([[3*N,N]]), 2*N)
check('balanced interval', solve([[N,N]]), 0)
check('export only', solve([[0,N]]), 0)
check('import only', solve([[N,0]]), N)
check('empty period', 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:
Export in one interval erases import from another.

Input rows are [import, export] nonnegative energy per settlement interval. Net each row first, then return total positive net import. Export credits are separate and cannot offset another interval.

split: open-access


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

N = 1
observations = []
def solve(rows, boundary, low, high):
    return sum(e*(low if end < boundary else high) for end,e in rows)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ends at transition', solve([[10,N]],10,2,7),2*N)
check('starts at transition', solve([[11,N]],10,2,7),7*N)
check('strictly earlier', solve([[8,N]],10,2,7),2*N)
check('mixed intervals', solve([[9,N],[10,N],[11,N]],10,2,7),11*N)
check('empty', solve([],10,2,7),0)
check('zero priced period', solve([[10,N]],10,0,7),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, boundary, low, high):
    return sum(e*(low if end == boundary else high) for end,e in rows)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ends at transition', solve([[10,N]],10,2,7),2*N)
check('starts at transition', solve([[11,N]],10,2,7),7*N)
check('strictly earlier', solve([[8,N]],10,2,7),2*N)
check('mixed intervals', solve([[9,N],[10,N],[11,N]],10,2,7),11*N)
check('empty', solve([],10,2,7),0)
check('zero priced period', solve([[10,N]],10,0,7),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 interval end label selects the next tariff period.

Rows [end, energy] represent one-slot intervals (end-1,end]. A tariff changes at boundary b: intervals starting below b cost low, others high. Return integer charge; all labels and boundaries are integer slots.

split: open-access


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

N = 1
observations = []
def solve(rows):
    return [sum(e or 0 for q,e in rows),True]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('missing alongside actual', solve([['actual',N],['missing',None]]),[N,False])
check('measured zero', solve([['actual',0]]),[0,True])
check('all missing', solve([['missing',None]]),[0,False])
check('ordinary actual', solve([['actual',N]]),[N,True])
check('zero mixed with energy', solve([['actual',0],['actual',N]]),[N,True])
check('empty complete by convention', solve([]),[0,True])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(rows):
    return [sum(e or 0 for q,e in rows),all(e for q,e in rows)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('missing alongside actual', solve([['actual',N],['missing',None]]),[N,False])
check('measured zero', solve([['actual',0]]),[0,True])
check('all missing', solve([['missing',None]]),[0,False])
check('ordinary actual', solve([['actual',N]]),[N,True])
check('zero mixed with energy', solve([['actual',0],['actual',N]]),[N,True])
check('empty complete by convention', solve([]),[0,True])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A missing interval is reported as measured zero consumption.

Rows [quality, energy] use actual or missing. Missing energy is None. Return [sum of actual energy, complete], where complete is true exactly when no missing interval exists. A measured zero is valid.

split: open-access


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

N = 1
observations = []
def solve(rows):
    return sum(max(col) for col in zip(*rows)) if rows else 0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('noncoincident peaks', solve([[5*N,N],[N,5*N]]),6*N)
check('coincident loads', solve([[3*N,4*N]]),7*N)
check('one feeder', solve([[N],[2*N]]),2*N)
check('idle site', solve([[0,0]]),0)
check('no intervals', solve([]),0)
check('smaller feeders together beat peak', solve([[5*N,0],[3*N,3*N]]),6*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(rows):
    return max((max(row) for row in rows),default=0)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('noncoincident peaks', solve([[5*N,N],[N,5*N]]),6*N)
check('coincident loads', solve([[3*N,4*N]]),7*N)
check('one feeder', solve([[N],[2*N]]),2*N)
check('idle site', solve([[0,0]]),0)
check('no intervals', solve([]),0)
check('smaller feeders together beat peak', solve([[5*N,0],[3*N,3*N]]),6*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:
Independent feeder peaks inflate the site demand register.

Rows contain simultaneous nonnegative demand from each feeder for equal intervals. Return the maximum site sum over rows, or zero for no intervals. Rows are rectangular and nonempty.

split: open-access


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

N = 1
observations = []
def solve(samples, k):
    return max((sum(samples[i:i+k]) for i in range(0,len(samples),k)),default=None)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('trailing spike excluded', solve([N,N,10*N],2),2*N)
check('rolling peak is not block peak', solve([0,5*N,5*N,0],2),5*N)
check('exact block', solve([N,2*N],2),3*N)
check('no complete block', solve([N],2),None)
check('empty', solve([],2),None)
check('unit blocks', solve([N,3*N,2*N],1),3*N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(samples, k):
    return max((sum(samples[i:i+k]) for i in range(len(samples)-k+1)),default=None)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('trailing spike excluded', solve([N,N,10*N],2),2*N)
check('rolling peak is not block peak', solve([0,5*N,5*N,0],2),5*N)
check('exact block', solve([N,2*N],2),3*N)
check('no complete block', solve([N],2),None)
check('empty', solve([],2),None)
check('unit blocks', solve([N,3*N,2*N],1),3*N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Partial demand blocks compete with complete tariff blocks.

Integer samples are equal-duration energy slots grouped into anchored blocks of width k. Return largest complete block energy sum. Ignore trailing partial block; return None if none complete. This models fixed blocks, not rolling windows.

split: open-access


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

N = 1
observations = []
def solve(rows):
    return sum(max(q,0) for p,q in rows)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('export quadrant excluded', solve([[-N,4*N]]),0)
check('zero active excluded', solve([[0,4*N]]),0)
check('import inductive included', solve([[N,4*N]]),4*N)
check('negative reactive excluded', solve([[N,-4*N]]),0)
check('mixed quadrants', solve([[N,N],[-N,N],[0,N],[N,-N]]),N)
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(rows):
    return sum(max(q,0) for p,q in rows if p>=0)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('export quadrant excluded', solve([[-N,4*N]]),0)
check('zero active excluded', solve([[0,4*N]]),0)
check('import inductive included', solve([[N,4*N]]),4*N)
check('negative reactive excluded', solve([[N,-4*N]]),0)
check('mixed quadrants', solve([[N,N],[-N,N],[0,N],[N,-N]]),N)
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:
Reactive export quadrants are charged to the import register.

Rows [active, reactive] are signed interval energies. Return positive reactive energy only from strictly positive active-import rows. Active zero belongs to no import quadrant. This is an explicit simplified quadrant tariff.

split: open-access


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

N = 1
observations = []
def solve(lots, period, need):
    out=[]
    for expiry,energy in sorted(lots):
        used=min(need,energy); need-=used
        if energy>used: out.append([expiry,energy-used])
    return [need,out]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('expired credit', solve([[1,N]],2,N),[N,[]])
check('oldest spent first', solve([[3,N],[2,N]],2,N),[0,[[3,N]]])
check('inclusive expiry', solve([[2,N]],2,N),[0,[]])
check('partial credit', solve([[2,3*N]],2,N),[0,[[2,2*N]]])
check('uncovered import', solve([[2,N]],2,3*N),[2*N,[]])
check('zero import still expires lots', solve([[1,N],[3,N]],2,0),[0,[[3,N]]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(lots, period, need):
    out=[]
    for expiry,energy in sorted(lots,reverse=True):
        if expiry<period: continue
        used=min(need,energy); need-=used
        if energy>used: out.append([expiry,energy-used])
    return [need,sorted(out)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('expired credit', solve([[1,N]],2,N),[N,[]])
check('oldest spent first', solve([[3,N],[2,N]],2,N),[0,[[3,N]]])
check('inclusive expiry', solve([[2,N]],2,N),[0,[]])
check('partial credit', solve([[2,3*N]],2,N),[0,[[2,2*N]]])
check('uncovered import', solve([[2,N]],2,3*N),[2*N,[]])
check('zero import still expires lots', solve([[1,N],[3,N]],2,0),[0,[[3,N]]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Expired export-credit lots reduce current import charges.

Lots [expiry_period, energy] are export credits. At billing period p, keep only expiry>=p, consume oldest-expiring lots first against nonnegative import need, and return [uncovered need, remaining energy by ascending expiry]. Expired lots vanish; zero remainders are omitted.

split: open-access


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

N = 1
observations = []
def solve(rows):
    return rows[-1][1]-rows[0][1] if rows else 0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('high replacement baseline', solve([['a',N],['a',2*N],['b',100*N],['b',103*N]]),4*N)
check('low replacement baseline', solve([['a',100*N],['a',102*N],['b',0],['b',N]]),3*N)
check('one meter', solve([['a',N],['a',4*N]]),3*N)
check('baseline only', solve([['a',N]]),0)
check('exchange without deltas', solve([['a',N],['b',10*N]]),0)
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(rows):
    return sum(max(b[1]-a[1],0) for a,b in zip(rows,rows[1:]))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('high replacement baseline', solve([['a',N],['a',2*N],['b',100*N],['b',103*N]]),4*N)
check('low replacement baseline', solve([['a',100*N],['a',102*N],['b',0],['b',N]]),3*N)
check('one meter', solve([['a',N],['a',4*N]]),3*N)
check('baseline only', solve([['a',N]]),0)
check('exchange without deltas', solve([['a',N],['b',10*N]]),0)
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:
A replacement meter opening register becomes billed energy.

Rows [meter_id, cumulative] are chronological readings. Each meter identifier appears in one contiguous run. Return sum of within-meter consecutive increases; first reading of each meter is a baseline. Readings never decrease within a meter.

split: open-access


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

N = 1
observations = []
def solve(initial, incoming, outgoing):
    return initial + incoming // 2 - outgoing // 2
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('withdrawal', solve(20*N, 0, 4*N), 16*N)
check('charge', solve(20*N, 8*N, 0), 24*N)
check('both', solve(20*N, 8*N, 4*N), 20*N)
check('empty', solve(0, 0, 0), 0)
check('odd withdrawal', solve(20*N, 2, 3), 20*N-2)
check('full withdrawal', solve(20*N, 0, 20*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(initial, incoming, outgoing):
    return initial + (incoming - outgoing) // 2
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('withdrawal', solve(20*N, 0, 4*N), 16*N)
check('charge', solve(20*N, 8*N, 0), 24*N)
check('both', solve(20*N, 8*N, 4*N), 20*N)
check('empty', solve(0, 0, 0), 0)
check('odd withdrawal', solve(20*N, 2, 3), 20*N-2)
check('full withdrawal', solve(20*N, 0, 20*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:
A shared efficiency transform shrinks both incoming and outgoing charge.

Return initial plus half of incoming minus outgoing; incoming is even, all balances remain nonnegative.

split: open-access


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

N = 1
observations = []
def solve(charge, old_capacity, new_capacity):
    return charge * new_capacity // old_capacity
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('upward', solve(4*N, 10*N, 20*N), 4*N)
check('downward no clip', solve(4*N, 10*N, 8*N), 4*N)
check('clip', solve(9*N, 10*N, 6*N), 6*N)
check('empty', solve(0, 10*N, 20*N), 0)
check('unchanged', solve(7*N, 10*N, 10*N), 7*N)
check('zero capacity', solve(7*N, 10*N, 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(charge, old_capacity, new_capacity):
    return min(charge, new_capacity) if new_capacity < old_capacity else charge * new_capacity // old_capacity
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('upward', solve(4*N, 10*N, 20*N), 4*N)
check('downward no clip', solve(4*N, 10*N, 8*N), 4*N)
check('clip', solve(9*N, 10*N, 6*N), 6*N)
check('empty', solve(0, 10*N, 20*N), 0)
check('unchanged', solve(7*N, 10*N, 10*N), 7*N)
check('zero capacity', solve(7*N, 10*N, 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:
Capacity recalibration preserves a displayed fraction instead of stored inventory.

Return absolute stored integer charge after replacing the capacity estimate; cap at new capacity. Old capacity is positive and charge lies within it.

split: open-access


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

N = 1
observations = []
def solve(cells, request):
    d = min(request, sum(cells))
    return [d, [c-d for c in cells]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unequal', solve([2*N,8*N], 5*N), [2*N,[0,6*N]])
check('empty cell', solve([0,8*N], N), [0,[0,8*N]])
check('equal', solve([4*N,4*N], 3*N), [3*N,[N,N]])
check('single', solve([4*N], 8*N), [4*N,[0]])
check('no request', solve([2*N,8*N], 0), [0,[2*N,8*N]])
check('three cells', solve([9*N,3*N,7*N], 8*N), [3*N,[6*N,0,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(cells, request):
    d = min(request, sum(cells)//len(cells))
    return [d, [c-d for c in cells]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unequal', solve([2*N,8*N], 5*N), [2*N,[0,6*N]])
check('empty cell', solve([0,8*N], N), [0,[0,8*N]])
check('equal', solve([4*N,4*N], 3*N), [3*N,[N,N]])
check('single', solve([4*N], 8*N), [4*N,[0]])
check('no request', solve([2*N,8*N], 0), [0,[2*N,8*N]])
check('three cells', solve([9*N,3*N,7*N], 8*N), [3*N,[6*N,0,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:
Series discharge is allowed to draw the sum of individual cell inventories.

For a nonempty list of nonnegative cell charge inventories and nonnegative request, return delivered charge and remaining cells; series cells each supply the delivered amount.

split: open-access


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

N = 1
observations = []
def solve(modules, removed):
    return sum(v[0] for v in modules.values()) - modules[removed][1]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('low module', solve({'a':[N,10*N],'b':[8*N,10*N]}, 'a'), 8*N)
check('high module', solve({'a':[N,10*N],'b':[8*N,10*N]}, 'b'), N)
check('only module', solve({'a':[N,10*N]}, 'a'), 0)
check('empty removed', solve({'a':[0,10*N],'b':[8*N,10*N]}, 'a'), 8*N)
check('equal', solve({'a':[N,10*N],'b':[N,10*N]}, 'a'), N)
check('three', solve({'a':[N,10*N],'b':[2*N,10*N],'c':[7*N,10*N]}, 'b'), 8*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(modules, removed):
    return sum(v[0] for v in modules.values()) * (len(modules)-1)//len(modules)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('low module', solve({'a':[N,10*N],'b':[8*N,10*N]}, 'a'), 8*N)
check('high module', solve({'a':[N,10*N],'b':[8*N,10*N]}, 'b'), N)
check('only module', solve({'a':[N,10*N]}, 'a'), 0)
check('empty removed', solve({'a':[0,10*N],'b':[8*N,10*N]}, 'a'), 8*N)
check('equal', solve({'a':[N,10*N],'b':[N,10*N]}, 'a'), N)
check('three', solve({'a':[N,10*N],'b':[2*N,10*N],'c':[7*N,10*N]}, 'b'), 8*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:
Pack removal subtracts module capacity instead of that module inventory.

Modules map unique identifiers to [charge,capacity]. Return total remaining charge after removing an existing identifier.

split: open-access


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

N = 1
observations = []
def solve(deltas):
    return max(0,-sum(deltas))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('round trip', solve([10*N,-10*N]), 10*N)
check('charge only', solve([3*N,2*N]), 0)
check('discharge only', solve([-3*N,-2*N]), 5*N)
check('empty', solve([]), 0)
check('mixed', solve([-3*N,9*N,-4*N]), 7*N)
check('zeros', solve([0,-N,0,N]), N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(deltas):
    return sum(abs(x) for x in deltas)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('round trip', solve([10*N,-10*N]), 10*N)
check('charge only', solve([3*N,2*N]), 0)
check('discharge only', solve([-3*N,-2*N]), 5*N)
check('empty', solve([]), 0)
check('mixed', solve([-3*N,9*N,-4*N]), 7*N)
check('zeros', solve([0,-N,0,N]), N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Opposite direction transfers cancel before discharge throughput is counted.

Return discharge throughput units for signed charge deltas; positive means charging, negative discharging. This is the numerator of a discharge-only equivalent-cycle metric.

split: open-access


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

N = 1
observations = []
def solve(charge, reserve, request):
    d=min(request,charge)
    return [d, max(0,charge-d-reserve)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('floor', solve(10*N,3*N,10*N), [7*N,3*N])
check('no request', solve(10*N,3*N,0), [0,10*N])
check('under reserve', solve(2*N,3*N,N), [0,2*N])
check('no reserve', solve(10*N,0,4*N), [4*N,6*N])
check('partial', solve(10*N,3*N,2*N), [2*N,8*N])
check('empty', solve(0,3*N,N), [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(charge, reserve, request):
    d=min(request,max(0,charge-reserve))
    return [d,max(0,charge-d-reserve)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('floor', solve(10*N,3*N,10*N), [7*N,3*N])
check('no request', solve(10*N,3*N,0), [0,10*N])
check('under reserve', solve(2*N,3*N,N), [0,2*N])
check('no reserve', solve(10*N,0,4*N), [4*N,6*N])
check('partial', solve(10*N,3*N,2*N), [2*N,8*N])
check('empty', solve(0,3*N,N), [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:
The protected reserve is subtracted from stored inventory even without delivery.

Return [delivered,remaining] for nonnegative inventory, request, reserve; reserve limits access but does not delete stored charge.

split: open-access


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

N = 1
observations = []
def solve(initial, capacity, deltas):
    return min(capacity,max(0,initial+sum(deltas)))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('overflow then drain', solve(9*N,10*N,[5*N,-3*N]), 7*N)
check('underflow then fill', solve(N,10*N,[-5*N,3*N]), 3*N)
check('no events', solve(4*N,10*N,[]), 4*N)
check('ordinary', solve(4*N,10*N,[N,-2*N]), 3*N)
check('zero capacity', solve(0,0,[N,-N]), 0)
check('multiple clipping', solve(5*N,10*N,[20*N,-30*N,4*N]), 4*N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(initial, capacity, deltas):
    q=initial
    for d in deltas:
        q=min(capacity,q+d)
    return max(0,q)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('overflow then drain', solve(9*N,10*N,[5*N,-3*N]), 7*N)
check('underflow then fill', solve(N,10*N,[-5*N,3*N]), 3*N)
check('no events', solve(4*N,10*N,[]), 4*N)
check('ordinary', solve(4*N,10*N,[N,-2*N]), 3*N)
check('zero capacity', solve(0,0,[N,-N]), 0)
check('multiple clipping', solve(5*N,10*N,[20*N,-30*N,4*N]), 4*N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Only the final event sum is clipped to capacity.

Return final inventory after ordered signed transfer attempts; each event independently clips the inventory to [0,capacity].

split: open-access


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

N = 1
observations = []
def solve(charge, start, times):
    return max(0,charge-len(times))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeated timestamp', solve(20*N,0,[N,N,2*N]), 18*N)
check('one observation', solve(20*N,0,[3*N]), 17*N)
check('no observation', solve(20*N,0,[]), 20*N)
check('zero interval', solve(20*N,N,[N,N]), 20*N)
check('offset clock', solve(20*N,10*N,[11*N,13*N]), 17*N)
check('exhaustion', solve(N,0,[2*N,4*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(charge, start, times):
    for t in times:
        charge=max(0,charge-(t-start))
    return charge
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeated timestamp', solve(20*N,0,[N,N,2*N]), 18*N)
check('one observation', solve(20*N,0,[3*N]), 17*N)
check('no observation', solve(20*N,0,[]), 20*N)
check('zero interval', solve(20*N,N,[N,N]), 20*N)
check('offset clock', solve(20*N,10*N,[11*N,13*N]), 17*N)
check('exhaustion', solve(N,0,[2*N,4*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:
Repeated observations accumulate loss regardless of elapsed model time.

Return final charge under a constant integer loss of one unit per tick and ordered observation timestamps at or after start; settle each elapsed interval once, floor at zero.

split: open-access