broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events, now):
    out=Fraction(0)
    for t,value in events:
        if t>now: continue
        out+=Fraction(max(0,value),2**(now-t))
    return str(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(0, 8), (2, 4)], 3)), '3')
check('regression 2', solve(*([], 4)), '0')
check('regression 3', solve(*([(5, 3)], 4)), '0')
check('regression 4', solve(*([(3, -4), (3, 8)], 3)), '4')
check('regression 5', solve(*([(0, 3), (1, 2), (1, 2)], 2)), '11/4')
check('regression 6', solve(*([(-2, 8), (0, -1)], 1)), '1/2')
check('regression 7', solve(*([(4, 9), (0, 16)], 4)), '10')
check("variable age",solve([(0,2**N)],N),"1")
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events, now):
    out=Fraction(0)
    for t,value in events:
        if t>now: continue
        out+=Fraction(abs(value),2**(now-t))
    return str(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(0, 8), (2, 4)], 3)), '3')
check('regression 2', solve(*([], 4)), '0')
check('regression 3', solve(*([(5, 3)], 4)), '0')
check('regression 4', solve(*([(3, -4), (3, 8)], 3)), '4')
check('regression 5', solve(*([(0, 3), (1, 2), (1, 2)], 2)), '11/4')
check('regression 6', solve(*([(-2, 8), (0, -1)], 1)), '1/2')
check('regression 7', solve(*([(4, 9), (0, 16)], 4)), '10')
check("variable age",solve([(0,2**N)],N),"1")
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

Each [integer timestamp, integer contribution] independently contributes value/2**age at integer query now; exclude future events. Same-time events are independent additive contributions. Return exact Fraction string.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events, now):
    out=Fraction(0)
    for t,value in events:
        if t>now: continue
        out+=Fraction(value,2**(now-t))
    return str(out/max(1,sum(t<=now for t,v in events)))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(0, 8), (2, 4)], 3)), '3')
check('regression 2', solve(*([], 4)), '0')
check('regression 3', solve(*([(5, 3)], 4)), '0')
check('regression 4', solve(*([(3, -4), (3, 8)], 3)), '4')
check('regression 5', solve(*([(0, 3), (1, 2), (1, 2)], 2)), '11/4')
check('regression 6', solve(*([(-2, 8), (0, -1)], 1)), '1/2')
check('regression 7', solve(*([(4, 9), (0, 16)], 4)), '10')
check("variable age",solve([(0,2**N)],N),"1")
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events, now):
    out=Fraction(0)
    for t,value in events:
        if t>now: continue
        out+=Fraction(value,2**(now-t))
    return str(out/max(1,len(events)))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(0, 8), (2, 4)], 3)), '3')
check('regression 2', solve(*([], 4)), '0')
check('regression 3', solve(*([(5, 3)], 4)), '0')
check('regression 4', solve(*([(3, -4), (3, 8)], 3)), '4')
check('regression 5', solve(*([(0, 3), (1, 2), (1, 2)], 2)), '11/4')
check('regression 6', solve(*([(-2, 8), (0, -1)], 1)), '1/2')
check('regression 7', solve(*([(4, 9), (0, 16)], 4)), '10')
check("variable age",solve([(0,2**N)],N),"1")
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

Each [integer timestamp, integer contribution] independently contributes value/2**age at integer query now; exclude future events. Same-time events are independent additive contributions. Return exact Fraction string.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events, start, end):
    if end<=start: return None
    changes={}
    for t,value in events:
        changes[t]=value
    points=sorted(set([start,end]+[t for t in changes if start<t<end]))
    area=0
    for left,right in zip(points,points[1:]):
        earlier=[t for t in changes if t<=left]
        value=changes[max(earlier)] if earlier else 0
        area+=value
    return str(Fraction(area,end-start))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(0, 2), (3, 8)], 1, 5)), '5')
check('regression 2', solve(*([], 0, 4)), '0')
check('regression 3', solve(*([(3, 5)], 0, 5)), '2')
check('regression 4', solve(*([(0, 4), (0, 7), (4, 9)], 0, 4)), '7')
check('regression 5', solve(*([(2, -3), (-2, 8), (5, 1)], 0, 7)), '9/7')
check('regression 6', solve(*([(0, 2)], 3, 3)), None)
check('regression 7', solve(*([(0, 1), (1, 10), (2, 2)], 0, 5)), '17/5')
check("variable duration weighting",solve([(0,0),(N,6)],0,N+2),str(Fraction(12,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
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events, start, end):
    if end<=start: return None
    changes={}
    for t,value in events:
        changes[t]=value
    points=sorted(set([start,end]+[t for t in changes if start<t<end]))
    area=0
    for left,right in zip(points,points[1:]):
        earlier=[t for t in changes if t<=left]
        value=changes[max(earlier)] if earlier else 0
        area+=value*(right-left+1)
    return str(Fraction(area,end-start))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(0, 2), (3, 8)], 1, 5)), '5')
check('regression 2', solve(*([], 0, 4)), '0')
check('regression 3', solve(*([(3, 5)], 0, 5)), '2')
check('regression 4', solve(*([(0, 4), (0, 7), (4, 9)], 0, 4)), '7')
check('regression 5', solve(*([(2, -3), (-2, 8), (5, 1)], 0, 7)), '9/7')
check('regression 6', solve(*([(0, 2)], 3, 3)), None)
check('regression 7', solve(*([(0, 1), (1, 10), (2, 2)], 0, 5)), '17/5')
check("variable duration weighting",solve([(0,0),(N,6)],0,N+2),str(Fraction(12,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:
The reduction disagrees with its explicit aggregation oracle.

Events set a right-continuous integer-timestamp level; later-listed events win timestamp ties. Initial level before any event is zero. Return exact average over [start,end), including level carried from earlier history, or None if interval has no duration.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events, start, end):
    if end<=start: return None
    changes={}
    for t,value in events:
        changes[t]=value
    points=sorted(set([start,end]+[t for t in changes if start<t<end]))
    area=0
    for left,right in zip(points,points[1:]):
        earlier=[t for t in changes if t<=right]
        value=changes[max(earlier)] if earlier else 0
        area+=value*(right-left)
    return str(Fraction(area,end-start))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(0, 2), (3, 8)], 1, 5)), '5')
check('regression 2', solve(*([], 0, 4)), '0')
check('regression 3', solve(*([(3, 5)], 0, 5)), '2')
check('regression 4', solve(*([(0, 4), (0, 7), (4, 9)], 0, 4)), '7')
check('regression 5', solve(*([(2, -3), (-2, 8), (5, 1)], 0, 7)), '9/7')
check('regression 6', solve(*([(0, 2)], 3, 3)), None)
check('regression 7', solve(*([(0, 1), (1, 10), (2, 2)], 0, 5)), '17/5')
check("variable duration weighting",solve([(0,0),(N,6)],0,N+2),str(Fraction(12,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
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events, start, end):
    if end<=start: return None
    changes={}
    for t,value in events:
        changes[t]=value
    points=sorted(set([start,end]+[t for t in changes if start<t<end]))
    area=0
    for left,right in zip(points,points[1:]):
        earlier=[t for t in changes if t<=left+1]
        value=changes[max(earlier)] if earlier else 0
        area+=value*(right-left)
    return str(Fraction(area,end-start))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(0, 2), (3, 8)], 1, 5)), '5')
check('regression 2', solve(*([], 0, 4)), '0')
check('regression 3', solve(*([(3, 5)], 0, 5)), '2')
check('regression 4', solve(*([(0, 4), (0, 7), (4, 9)], 0, 4)), '7')
check('regression 5', solve(*([(2, -3), (-2, 8), (5, 1)], 0, 7)), '9/7')
check('regression 6', solve(*([(0, 2)], 3, 3)), None)
check('regression 7', solve(*([(0, 1), (1, 10), (2, 2)], 0, 5)), '17/5')
check("variable duration weighting",solve([(0,0),(N,6)],0,N+2),str(Fraction(12,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:
The reduction disagrees with its explicit aggregation oracle.

Events set a right-continuous integer-timestamp level; later-listed events win timestamp ties. Initial level before any event is zero. Return exact average over [start,end), including level carried from earlier history, or None if interval has no duration.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events, start, end):
    if end<=start: return None
    changes={}
    for t,value in events:
        changes[t]=value
    points=sorted(set([start,end]+[t for t in changes if start<t<end]))
    area=0
    for left,right in zip(points,points[1:]):
        earlier=[t for t in changes if t<left]
        value=changes[max(earlier)] if earlier else 0
        area+=value*(right-left)
    return str(Fraction(area,end-start))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(0, 2), (3, 8)], 1, 5)), '5')
check('regression 2', solve(*([], 0, 4)), '0')
check('regression 3', solve(*([(3, 5)], 0, 5)), '2')
check('regression 4', solve(*([(0, 4), (0, 7), (4, 9)], 0, 4)), '7')
check('regression 5', solve(*([(2, -3), (-2, 8), (5, 1)], 0, 7)), '9/7')
check('regression 6', solve(*([(0, 2)], 3, 3)), None)
check('regression 7', solve(*([(0, 1), (1, 10), (2, 2)], 0, 5)), '17/5')
check("variable duration weighting",solve([(0,0),(N,6)],0,N+2),str(Fraction(12,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
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events, start, end):
    if end<=start: return None
    changes={}
    for t,value in events:
        changes[t]=value
    points=sorted(set([start,end]+[t for t in changes if start<t<end]))
    area=0
    for left,right in zip(points,points[1:]):
        earlier=[t for t in changes if t<=left-1]
        value=changes[max(earlier)] if earlier else 0
        area+=value*(right-left)
    return str(Fraction(area,end-start))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(0, 2), (3, 8)], 1, 5)), '5')
check('regression 2', solve(*([], 0, 4)), '0')
check('regression 3', solve(*([(3, 5)], 0, 5)), '2')
check('regression 4', solve(*([(0, 4), (0, 7), (4, 9)], 0, 4)), '7')
check('regression 5', solve(*([(2, -3), (-2, 8), (5, 1)], 0, 7)), '9/7')
check('regression 6', solve(*([(0, 2)], 3, 3)), None)
check('regression 7', solve(*([(0, 1), (1, 10), (2, 2)], 0, 5)), '17/5')
check("variable duration weighting",solve([(0,0),(N,6)],0,N+2),str(Fraction(12,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:
The reduction disagrees with its explicit aggregation oracle.

Events set a right-continuous integer-timestamp level; later-listed events win timestamp ties. Initial level before any event is zero. Return exact average over [start,end), including level carried from earlier history, or None if interval has no duration.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events, start, end):
    if end<=start: return None
    changes={}
    for t,value in events:
        if t>=start: changes[t]=value
    points=sorted(set([start,end]+[t for t in changes if start<t<end]))
    area=0
    for left,right in zip(points,points[1:]):
        earlier=[t for t in changes if t<=left]
        value=changes[max(earlier)] if earlier else 0
        area+=value*(right-left)
    return str(Fraction(area,end-start))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(0, 2), (3, 8)], 1, 5)), '5')
check('regression 2', solve(*([], 0, 4)), '0')
check('regression 3', solve(*([(3, 5)], 0, 5)), '2')
check('regression 4', solve(*([(0, 4), (0, 7), (4, 9)], 0, 4)), '7')
check('regression 5', solve(*([(2, -3), (-2, 8), (5, 1)], 0, 7)), '9/7')
check('regression 6', solve(*([(0, 2)], 3, 3)), None)
check('regression 7', solve(*([(0, 1), (1, 10), (2, 2)], 0, 5)), '17/5')
check("variable duration weighting",solve([(0,0),(N,6)],0,N+2),str(Fraction(12,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
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events, start, end):
    if end<=start: return None
    changes={}
    for t,value in events:
        if start<=t<=end: changes[t]=value
    points=sorted(set([start,end]+[t for t in changes if start<t<end]))
    area=0
    for left,right in zip(points,points[1:]):
        earlier=[t for t in changes if t<=left]
        value=changes[max(earlier)] if earlier else 0
        area+=value*(right-left)
    return str(Fraction(area,end-start))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(0, 2), (3, 8)], 1, 5)), '5')
check('regression 2', solve(*([], 0, 4)), '0')
check('regression 3', solve(*([(3, 5)], 0, 5)), '2')
check('regression 4', solve(*([(0, 4), (0, 7), (4, 9)], 0, 4)), '7')
check('regression 5', solve(*([(2, -3), (-2, 8), (5, 1)], 0, 7)), '9/7')
check('regression 6', solve(*([(0, 2)], 3, 3)), None)
check('regression 7', solve(*([(0, 1), (1, 10), (2, 2)], 0, 5)), '17/5')
check("variable duration weighting",solve([(0,0),(N,6)],0,N+2),str(Fraction(12,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:
The reduction disagrees with its explicit aggregation oracle.

Events set a right-continuous integer-timestamp level; later-listed events win timestamp ties. Initial level before any event is zero. Return exact average over [start,end), including level carried from earlier history, or None if interval has no duration.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events, start, end):
    if end<=start: return None
    changes={}
    for t,value in events:
        changes[t]=changes.get(t,0)+value
    points=sorted(set([start,end]+[t for t in changes if start<t<end]))
    area=0
    for left,right in zip(points,points[1:]):
        earlier=[t for t in changes if t<=left]
        value=changes[max(earlier)] if earlier else 0
        area+=value*(right-left)
    return str(Fraction(area,end-start))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(0, 2), (3, 8)], 1, 5)), '5')
check('regression 2', solve(*([], 0, 4)), '0')
check('regression 3', solve(*([(3, 5)], 0, 5)), '2')
check('regression 4', solve(*([(0, 4), (0, 7), (4, 9)], 0, 4)), '7')
check('regression 5', solve(*([(2, -3), (-2, 8), (5, 1)], 0, 7)), '9/7')
check('regression 6', solve(*([(0, 2)], 3, 3)), None)
check('regression 7', solve(*([(0, 1), (1, 10), (2, 2)], 0, 5)), '17/5')
check("variable duration weighting",solve([(0,0),(N,6)],0,N+2),str(Fraction(12,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
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events, start, end):
    if end<=start: return None
    changes={}
    for t,value in events:
        changes.setdefault(t,value)
    points=sorted(set([start,end]+[t for t in changes if start<t<end]))
    area=0
    for left,right in zip(points,points[1:]):
        earlier=[t for t in changes if t<=left]
        value=changes[max(earlier)] if earlier else 0
        area+=value*(right-left)
    return str(Fraction(area,end-start))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(0, 2), (3, 8)], 1, 5)), '5')
check('regression 2', solve(*([], 0, 4)), '0')
check('regression 3', solve(*([(3, 5)], 0, 5)), '2')
check('regression 4', solve(*([(0, 4), (0, 7), (4, 9)], 0, 4)), '7')
check('regression 5', solve(*([(2, -3), (-2, 8), (5, 1)], 0, 7)), '9/7')
check('regression 6', solve(*([(0, 2)], 3, 3)), None)
check('regression 7', solve(*([(0, 1), (1, 10), (2, 2)], 0, 5)), '17/5')
check("variable duration weighting",solve([(0,0),(N,6)],0,N+2),str(Fraction(12,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:
The reduction disagrees with its explicit aggregation oracle.

Events set a right-continuous integer-timestamp level; later-listed events win timestamp ties. Initial level before any event is zero. Return exact average over [start,end), including level carried from earlier history, or None if interval has no duration.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events, start, end):
    if end<=start: return None
    changes={}
    for t,value in events:
        changes[t]=value
    points=sorted(set([start,end]+[t for t in changes if start<t<end]))
    area=0
    for left,right in zip(points,points[1:]):
        earlier=[t for t in changes if t<=left]
        value=changes[max(earlier)] if earlier else (changes[min(changes)] if changes else 0)
        area+=value*(right-left)
    return str(Fraction(area,end-start))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(0, 2), (3, 8)], 1, 5)), '5')
check('regression 2', solve(*([], 0, 4)), '0')
check('regression 3', solve(*([(3, 5)], 0, 5)), '2')
check('regression 4', solve(*([(0, 4), (0, 7), (4, 9)], 0, 4)), '7')
check('regression 5', solve(*([(2, -3), (-2, 8), (5, 1)], 0, 7)), '9/7')
check('regression 6', solve(*([(0, 2)], 3, 3)), None)
check('regression 7', solve(*([(0, 1), (1, 10), (2, 2)], 0, 5)), '17/5')
check("variable duration weighting",solve([(0,0),(N,6)],0,N+2),str(Fraction(12,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
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events, start, end):
    if end<=start: return None
    changes={}
    for t,value in events:
        changes[t]=value
    points=sorted(set([start,end]+[t for t in changes if start<t<end]))
    area=0
    for left,right in zip(points,points[1:]):
        earlier=[t for t in changes if t<=left]
        value=changes[max(earlier)] if earlier else (sum(changes.values()) if changes else 0)
        area+=value*(right-left)
    return str(Fraction(area,end-start))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(0, 2), (3, 8)], 1, 5)), '5')
check('regression 2', solve(*([], 0, 4)), '0')
check('regression 3', solve(*([(3, 5)], 0, 5)), '2')
check('regression 4', solve(*([(0, 4), (0, 7), (4, 9)], 0, 4)), '7')
check('regression 5', solve(*([(2, -3), (-2, 8), (5, 1)], 0, 7)), '9/7')
check('regression 6', solve(*([(0, 2)], 3, 3)), None)
check('regression 7', solve(*([(0, 1), (1, 10), (2, 2)], 0, 5)), '17/5')
check("variable duration weighting",solve([(0,0),(N,6)],0,N+2),str(Fraction(12,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:
The reduction disagrees with its explicit aggregation oracle.

Events set a right-continuous integer-timestamp level; later-listed events win timestamp ties. Initial level before any event is zero. Return exact average over [start,end), including level carried from earlier history, or None if interval has no duration.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events, start, end):
    if end<=start: return None
    changes={}
    for t,value in events:
        changes[t]=value
    points=sorted(set([start,end]+[t for t in changes if start<t<end]))
    area=0
    for left,right in zip(points,points[1:]):
        earlier=[t for t in changes if t<=left]
        value=changes[max(earlier)] if earlier else 0
        area+=value*(right-left)
    return str(Fraction(area,max(1,len(points)-1)))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(0, 2), (3, 8)], 1, 5)), '5')
check('regression 2', solve(*([], 0, 4)), '0')
check('regression 3', solve(*([(3, 5)], 0, 5)), '2')
check('regression 4', solve(*([(0, 4), (0, 7), (4, 9)], 0, 4)), '7')
check('regression 5', solve(*([(2, -3), (-2, 8), (5, 1)], 0, 7)), '9/7')
check('regression 6', solve(*([(0, 2)], 3, 3)), None)
check('regression 7', solve(*([(0, 1), (1, 10), (2, 2)], 0, 5)), '17/5')
check("variable duration weighting",solve([(0,0),(N,6)],0,N+2),str(Fraction(12,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
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events, start, end):
    if end<=start: return None
    changes={}
    for t,value in events:
        changes[t]=value
    points=sorted(set([start,end]+[t for t in changes if start<t<end]))
    area=0
    for left,right in zip(points,points[1:]):
        earlier=[t for t in changes if t<=left]
        value=changes[max(earlier)] if earlier else 0
        area+=value*(right-left)
    return str(Fraction(area,max(1,len(events))))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(0, 2), (3, 8)], 1, 5)), '5')
check('regression 2', solve(*([], 0, 4)), '0')
check('regression 3', solve(*([(3, 5)], 0, 5)), '2')
check('regression 4', solve(*([(0, 4), (0, 7), (4, 9)], 0, 4)), '7')
check('regression 5', solve(*([(2, -3), (-2, 8), (5, 1)], 0, 7)), '9/7')
check('regression 6', solve(*([(0, 2)], 3, 3)), None)
check('regression 7', solve(*([(0, 1), (1, 10), (2, 2)], 0, 5)), '17/5')
check("variable duration weighting",solve([(0,0),(N,6)],0,N+2),str(Fraction(12,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:
The reduction disagrees with its explicit aggregation oracle.

Events set a right-continuous integer-timestamp level; later-listed events win timestamp ties. Initial level before any event is zero. Return exact average over [start,end), including level carried from earlier history, or None if interval has no duration.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events, start, end):
    if end<=start: return None
    changes={}
    for t,value in events:
        changes[t]=value
    points=sorted(set([start,end]+[t for t in changes if start<t<end]))
    area=0
    for left,right in zip(points[:-1],points[1:-1]):
        earlier=[t for t in changes if t<=left]
        value=changes[max(earlier)] if earlier else 0
        area+=value*(right-left)
    return str(Fraction(area,end-start))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(0, 2), (3, 8)], 1, 5)), '5')
check('regression 2', solve(*([], 0, 4)), '0')
check('regression 3', solve(*([(3, 5)], 0, 5)), '2')
check('regression 4', solve(*([(0, 4), (0, 7), (4, 9)], 0, 4)), '7')
check('regression 5', solve(*([(2, -3), (-2, 8), (5, 1)], 0, 7)), '9/7')
check('regression 6', solve(*([(0, 2)], 3, 3)), None)
check('regression 7', solve(*([(0, 1), (1, 10), (2, 2)], 0, 5)), '17/5')
check("variable duration weighting",solve([(0,0),(N,6)],0,N+2),str(Fraction(12,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
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events, start, end):
    if end<=start: return None
    changes={}
    for t,value in events:
        changes[t]=value
    points=sorted(set([start,end]+[t for t in changes if start<t<end]))
    area=0
    for left,right in zip(points[1:],points[2:]):
        earlier=[t for t in changes if t<=left]
        value=changes[max(earlier)] if earlier else 0
        area+=value*(right-left)
    return str(Fraction(area,end-start))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(0, 2), (3, 8)], 1, 5)), '5')
check('regression 2', solve(*([], 0, 4)), '0')
check('regression 3', solve(*([(3, 5)], 0, 5)), '2')
check('regression 4', solve(*([(0, 4), (0, 7), (4, 9)], 0, 4)), '7')
check('regression 5', solve(*([(2, -3), (-2, 8), (5, 1)], 0, 7)), '9/7')
check('regression 6', solve(*([(0, 2)], 3, 3)), None)
check('regression 7', solve(*([(0, 1), (1, 10), (2, 2)], 0, 5)), '17/5')
check("variable duration weighting",solve([(0,0),(N,6)],0,N+2),str(Fraction(12,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:
The reduction disagrees with its explicit aggregation oracle.

Events set a right-continuous integer-timestamp level; later-listed events win timestamp ties. Initial level before any event is zero. Return exact average over [start,end), including level carried from earlier history, or None if interval has no duration.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events, start, end):
    if end<=start: return None
    changes={}
    for t,value in events:
        changes[t]=value
    points=sorted(set([start,end]+[t for t in changes if start<t<end]))
    area=0
    for left,right in zip(points,points[1:]):
        earlier=[t for t in changes if t<=left]
        value=changes[max(changes)] if changes else 0
        area+=value*(right-left)
    return str(Fraction(area,end-start))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(0, 2), (3, 8)], 1, 5)), '5')
check('regression 2', solve(*([], 0, 4)), '0')
check('regression 3', solve(*([(3, 5)], 0, 5)), '2')
check('regression 4', solve(*([(0, 4), (0, 7), (4, 9)], 0, 4)), '7')
check('regression 5', solve(*([(2, -3), (-2, 8), (5, 1)], 0, 7)), '9/7')
check('regression 6', solve(*([(0, 2)], 3, 3)), None)
check('regression 7', solve(*([(0, 1), (1, 10), (2, 2)], 0, 5)), '17/5')
check("variable duration weighting",solve([(0,0),(N,6)],0,N+2),str(Fraction(12,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
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events, start, end):
    if end<=start: return None
    changes={}
    for t,value in events:
        changes[t]=value
    points=sorted(set([start,end]+[t for t in changes if start<t<end]))
    area=0
    for left,right in zip(points,points[1:]):
        earlier=[t for t in changes if t<=left]
        value=changes[min(changes)] if changes else 0
        area+=value*(right-left)
    return str(Fraction(area,end-start))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(0, 2), (3, 8)], 1, 5)), '5')
check('regression 2', solve(*([], 0, 4)), '0')
check('regression 3', solve(*([(3, 5)], 0, 5)), '2')
check('regression 4', solve(*([(0, 4), (0, 7), (4, 9)], 0, 4)), '7')
check('regression 5', solve(*([(2, -3), (-2, 8), (5, 1)], 0, 7)), '9/7')
check('regression 6', solve(*([(0, 2)], 3, 3)), None)
check('regression 7', solve(*([(0, 1), (1, 10), (2, 2)], 0, 5)), '17/5')
check("variable duration weighting",solve([(0,0),(N,6)],0,N+2),str(Fraction(12,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:
The reduction disagrees with its explicit aggregation oracle.

Events set a right-continuous integer-timestamp level; later-listed events win timestamp ties. Initial level before any event is zero. Return exact average over [start,end), including level carried from earlier history, or None if interval has no duration.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events, start, end):
    if end<=start: return "0"
    changes={}
    for t,value in events:
        changes[t]=value
    points=sorted(set([start,end]+[t for t in changes if start<t<end]))
    area=0
    for left,right in zip(points,points[1:]):
        earlier=[t for t in changes if t<=left]
        value=changes[max(earlier)] if earlier else 0
        area+=value*(right-left)
    return str(Fraction(area,end-start))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(0, 2), (3, 8)], 1, 5)), '5')
check('regression 2', solve(*([], 0, 4)), '0')
check('regression 3', solve(*([(3, 5)], 0, 5)), '2')
check('regression 4', solve(*([(0, 4), (0, 7), (4, 9)], 0, 4)), '7')
check('regression 5', solve(*([(2, -3), (-2, 8), (5, 1)], 0, 7)), '9/7')
check('regression 6', solve(*([(0, 2)], 3, 3)), None)
check('regression 7', solve(*([(0, 1), (1, 10), (2, 2)], 0, 5)), '17/5')
check("variable duration weighting",solve([(0,0),(N,6)],0,N+2),str(Fraction(12,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
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events, start, end):
    if end<=start: return str(events[-1][1]) if events else "0"
    changes={}
    for t,value in events:
        changes[t]=value
    points=sorted(set([start,end]+[t for t in changes if start<t<end]))
    area=0
    for left,right in zip(points,points[1:]):
        earlier=[t for t in changes if t<=left]
        value=changes[max(earlier)] if earlier else 0
        area+=value*(right-left)
    return str(Fraction(area,end-start))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(0, 2), (3, 8)], 1, 5)), '5')
check('regression 2', solve(*([], 0, 4)), '0')
check('regression 3', solve(*([(3, 5)], 0, 5)), '2')
check('regression 4', solve(*([(0, 4), (0, 7), (4, 9)], 0, 4)), '7')
check('regression 5', solve(*([(2, -3), (-2, 8), (5, 1)], 0, 7)), '9/7')
check('regression 6', solve(*([(0, 2)], 3, 3)), None)
check('regression 7', solve(*([(0, 1), (1, 10), (2, 2)], 0, 5)), '17/5')
check("variable duration weighting",solve([(0,0),(N,6)],0,N+2),str(Fraction(12,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:
The reduction disagrees with its explicit aggregation oracle.

Events set a right-continuous integer-timestamp level; later-listed events win timestamp ties. Initial level before any event is zero. Return exact average over [start,end), including level carried from earlier history, or None if interval has no duration.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(table):
    n=len(table)
    m=len(table[0]) if n else 0
    rows=[sum(r) for r in table]
    cols=[sum(table[i][j] for i in range(n)) for j in range(m)]
    total=sum(rows)
    if not total: return "0"
    stat=Fraction(0)
    for i in range(n):
        for j in range(m):
            expected=Fraction(total,n*m)
            if expected==0: continue
            stat+=(table[i][j]-expected)**2/expected
    return str(stat)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[4, 0], [0, 4]],)), '8')
check('regression 2', solve(*([[2, 3], [4, 6]],)), '0')
check('regression 3', solve(*([],)), '0')
check('regression 4', solve(*([[0, 0], [0, 0]],)), '0')
check('regression 5', solve(*([[2, 0, 1], [3, 4, 0]],)), '30/7')
check('regression 6', solve(*([[0, 0, 0], [1, 2, 3]],)), '0')
check('regression 7', solve(*([[1, 2], [3, 0], [2, 4]],)), '4')
check("variable diagonal mass",solve([[N,0],[0,N]]),str(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
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(table):
    n=len(table)
    m=len(table[0]) if n else 0
    rows=[sum(r) for r in table]
    cols=[sum(table[i][j] for i in range(n)) for j in range(m)]
    total=sum(rows)
    if not total: return "0"
    stat=Fraction(0)
    for i in range(n):
        for j in range(m):
            expected=Fraction(rows[i],m)
            if expected==0: continue
            stat+=(table[i][j]-expected)**2/expected
    return str(stat)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[4, 0], [0, 4]],)), '8')
check('regression 2', solve(*([[2, 3], [4, 6]],)), '0')
check('regression 3', solve(*([],)), '0')
check('regression 4', solve(*([[0, 0], [0, 0]],)), '0')
check('regression 5', solve(*([[2, 0, 1], [3, 4, 0]],)), '30/7')
check('regression 6', solve(*([[0, 0, 0], [1, 2, 3]],)), '0')
check('regression 7', solve(*([[1, 2], [3, 0], [2, 4]],)), '4')
check("variable diagonal mass",solve([[N,0],[0,N]]),str(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:
The reduction disagrees with its explicit aggregation oracle.

For a rectangular nonnegative integer count table, return the Pearson sum of (observed-expected)^2/expected under independence, with expected=row marginal*column marginal/grand total. Zero expected cells contribute zero; empty or zero-total tables return "0". Exact Fraction string; no inferential p-value claim.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(table):
    n=len(table)
    m=len(table[0]) if n else 0
    rows=[sum(r) for r in table]
    cols=[sum(table[i][j] for i in range(n)) for j in range(m)]
    total=sum(rows)
    if not total: return "0"
    stat=Fraction(0)
    for i in range(n):
        for j in range(m):
            expected=Fraction(rows[i]*cols[j])
            if expected==0: continue
            stat+=(table[i][j]-expected)**2/expected
    return str(stat)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[4, 0], [0, 4]],)), '8')
check('regression 2', solve(*([[2, 3], [4, 6]],)), '0')
check('regression 3', solve(*([],)), '0')
check('regression 4', solve(*([[0, 0], [0, 0]],)), '0')
check('regression 5', solve(*([[2, 0, 1], [3, 4, 0]],)), '30/7')
check('regression 6', solve(*([[0, 0, 0], [1, 2, 3]],)), '0')
check('regression 7', solve(*([[1, 2], [3, 0], [2, 4]],)), '4')
check("variable diagonal mass",solve([[N,0],[0,N]]),str(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
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(table):
    n=len(table)
    m=len(table[0]) if n else 0
    rows=[sum(r) for r in table]
    cols=[sum(table[i][j] for i in range(n)) for j in range(m)]
    total=sum(rows)
    if not total: return "0"
    stat=Fraction(0)
    for i in range(n):
        for j in range(m):
            expected=Fraction(rows[i]*cols[j],total*total)
            if expected==0: continue
            stat+=(table[i][j]-expected)**2/expected
    return str(stat)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[4, 0], [0, 4]],)), '8')
check('regression 2', solve(*([[2, 3], [4, 6]],)), '0')
check('regression 3', solve(*([],)), '0')
check('regression 4', solve(*([[0, 0], [0, 0]],)), '0')
check('regression 5', solve(*([[2, 0, 1], [3, 4, 0]],)), '30/7')
check('regression 6', solve(*([[0, 0, 0], [1, 2, 3]],)), '0')
check('regression 7', solve(*([[1, 2], [3, 0], [2, 4]],)), '4')
check("variable diagonal mass",solve([[N,0],[0,N]]),str(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:
The reduction disagrees with its explicit aggregation oracle.

For a rectangular nonnegative integer count table, return the Pearson sum of (observed-expected)^2/expected under independence, with expected=row marginal*column marginal/grand total. Zero expected cells contribute zero; empty or zero-total tables return "0". Exact Fraction string; no inferential p-value claim.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(table):
    n=len(table)
    m=len(table[0]) if n else 0
    rows=[sum(r) for r in table]
    cols=[sum(table[i][j] for i in range(n)) for j in range(m)]
    total=sum(rows)
    if not total: return "0"
    stat=Fraction(0)
    for i in range(n):
        for j in range(m):
            expected=Fraction(rows[i]*cols[j],total)
            if expected==0 or table[i][j]==0: continue
            stat+=(table[i][j]-expected)**2/expected
    return str(stat)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[4, 0], [0, 4]],)), '8')
check('regression 2', solve(*([[2, 3], [4, 6]],)), '0')
check('regression 3', solve(*([],)), '0')
check('regression 4', solve(*([[0, 0], [0, 0]],)), '0')
check('regression 5', solve(*([[2, 0, 1], [3, 4, 0]],)), '30/7')
check('regression 6', solve(*([[0, 0, 0], [1, 2, 3]],)), '0')
check('regression 7', solve(*([[1, 2], [3, 0], [2, 4]],)), '4')
check("variable diagonal mass",solve([[N,0],[0,N]]),str(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
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(table):
    n=len(table)
    m=len(table[0]) if n else 0
    rows=[sum(r) for r in table]
    cols=[sum(table[i][j] for i in range(n)) for j in range(m)]
    total=sum(rows)
    if not total: return "0"
    stat=Fraction(0)
    for i in range(n):
        for j in range(m):
            expected=Fraction(rows[i]*cols[j],total)
            if expected==0 or table[i][j]<=expected: continue
            stat+=(table[i][j]-expected)**2/expected
    return str(stat)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[4, 0], [0, 4]],)), '8')
check('regression 2', solve(*([[2, 3], [4, 6]],)), '0')
check('regression 3', solve(*([],)), '0')
check('regression 4', solve(*([[0, 0], [0, 0]],)), '0')
check('regression 5', solve(*([[2, 0, 1], [3, 4, 0]],)), '30/7')
check('regression 6', solve(*([[0, 0, 0], [1, 2, 3]],)), '0')
check('regression 7', solve(*([[1, 2], [3, 0], [2, 4]],)), '4')
check("variable diagonal mass",solve([[N,0],[0,N]]),str(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:
The reduction disagrees with its explicit aggregation oracle.

For a rectangular nonnegative integer count table, return the Pearson sum of (observed-expected)^2/expected under independence, with expected=row marginal*column marginal/grand total. Zero expected cells contribute zero; empty or zero-total tables return "0". Exact Fraction string; no inferential p-value claim.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(table):
    n=len(table)
    m=len(table[0]) if n else 0
    rows=[sum(r) for r in table]
    cols=[sum(table[i][j] for i in range(n)) for j in range(m)]
    total=sum(rows)
    if not total: return "0"
    stat=Fraction(0)
    for i in range(n):
        for j in range(m):
            expected=Fraction(rows[i]*cols[j],total)
            if expected==0: continue
            stat+=abs(table[i][j]-expected)/expected
    return str(stat)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[4, 0], [0, 4]],)), '8')
check('regression 2', solve(*([[2, 3], [4, 6]],)), '0')
check('regression 3', solve(*([],)), '0')
check('regression 4', solve(*([[0, 0], [0, 0]],)), '0')
check('regression 5', solve(*([[2, 0, 1], [3, 4, 0]],)), '30/7')
check('regression 6', solve(*([[0, 0, 0], [1, 2, 3]],)), '0')
check('regression 7', solve(*([[1, 2], [3, 0], [2, 4]],)), '4')
check("variable diagonal mass",solve([[N,0],[0,N]]),str(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
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(table):
    n=len(table)
    m=len(table[0]) if n else 0
    rows=[sum(r) for r in table]
    cols=[sum(table[i][j] for i in range(n)) for j in range(m)]
    total=sum(rows)
    if not total: return "0"
    stat=Fraction(0)
    for i in range(n):
        for j in range(m):
            expected=Fraction(rows[i]*cols[j],total)
            if expected==0: continue
            stat+=(table[i][j]-expected)/expected
    return str(stat)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[4, 0], [0, 4]],)), '8')
check('regression 2', solve(*([[2, 3], [4, 6]],)), '0')
check('regression 3', solve(*([],)), '0')
check('regression 4', solve(*([[0, 0], [0, 0]],)), '0')
check('regression 5', solve(*([[2, 0, 1], [3, 4, 0]],)), '30/7')
check('regression 6', solve(*([[0, 0, 0], [1, 2, 3]],)), '0')
check('regression 7', solve(*([[1, 2], [3, 0], [2, 4]],)), '4')
check("variable diagonal mass",solve([[N,0],[0,N]]),str(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:
The reduction disagrees with its explicit aggregation oracle.

For a rectangular nonnegative integer count table, return the Pearson sum of (observed-expected)^2/expected under independence, with expected=row marginal*column marginal/grand total. Zero expected cells contribute zero; empty or zero-total tables return "0". Exact Fraction string; no inferential p-value claim.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(table):
    n=len(table)
    m=len(table[0]) if n else 0
    rows=[sum(r) for r in table]
    cols=[sum(table[i][j] for i in range(n)) for j in range(m)]
    total=sum(rows)
    if not total: return "0"
    stat=Fraction(0)
    for i in range(n):
        for j in range(m):
            expected=Fraction(rows[i]*cols[j],total)
            if expected==0: continue
            stat+=(table[i][j]-expected)**2/max(1,table[i][j])
    return str(stat)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[4, 0], [0, 4]],)), '8')
check('regression 2', solve(*([[2, 3], [4, 6]],)), '0')
check('regression 3', solve(*([],)), '0')
check('regression 4', solve(*([[0, 0], [0, 0]],)), '0')
check('regression 5', solve(*([[2, 0, 1], [3, 4, 0]],)), '30/7')
check('regression 6', solve(*([[0, 0, 0], [1, 2, 3]],)), '0')
check('regression 7', solve(*([[1, 2], [3, 0], [2, 4]],)), '4')
check("variable diagonal mass",solve([[N,0],[0,N]]),str(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
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(table):
    n=len(table)
    m=len(table[0]) if n else 0
    rows=[sum(r) for r in table]
    cols=[sum(table[i][j] for i in range(n)) for j in range(m)]
    total=sum(rows)
    if not total: return "0"
    stat=Fraction(0)
    for i in range(n):
        for j in range(m):
            expected=Fraction(rows[i]*cols[j],total)
            if expected==0: continue
            stat+=(table[i][j]-expected)**2/(expected+table[i][j])
    return str(stat)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[4, 0], [0, 4]],)), '8')
check('regression 2', solve(*([[2, 3], [4, 6]],)), '0')
check('regression 3', solve(*([],)), '0')
check('regression 4', solve(*([[0, 0], [0, 0]],)), '0')
check('regression 5', solve(*([[2, 0, 1], [3, 4, 0]],)), '30/7')
check('regression 6', solve(*([[0, 0, 0], [1, 2, 3]],)), '0')
check('regression 7', solve(*([[1, 2], [3, 0], [2, 4]],)), '4')
check("variable diagonal mass",solve([[N,0],[0,N]]),str(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:
The reduction disagrees with its explicit aggregation oracle.

For a rectangular nonnegative integer count table, return the Pearson sum of (observed-expected)^2/expected under independence, with expected=row marginal*column marginal/grand total. Zero expected cells contribute zero; empty or zero-total tables return "0". Exact Fraction string; no inferential p-value claim.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(table):
    n=len(table)
    m=len(table[0]) if n else 0
    rows=[sum(r) for r in table]
    cols=[rows[j%n] for j in range(m)] if n else []
    total=sum(rows)
    if not total: return "0"
    stat=Fraction(0)
    for i in range(n):
        for j in range(m):
            expected=Fraction(rows[i]*cols[j],total)
            if expected==0: continue
            stat+=(table[i][j]-expected)**2/expected
    return str(stat)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[4, 0], [0, 4]],)), '8')
check('regression 2', solve(*([[2, 3], [4, 6]],)), '0')
check('regression 3', solve(*([],)), '0')
check('regression 4', solve(*([[0, 0], [0, 0]],)), '0')
check('regression 5', solve(*([[2, 0, 1], [3, 4, 0]],)), '30/7')
check('regression 6', solve(*([[0, 0, 0], [1, 2, 3]],)), '0')
check('regression 7', solve(*([[1, 2], [3, 0], [2, 4]],)), '4')
check("variable diagonal mass",solve([[N,0],[0,N]]),str(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
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(table):
    n=len(table)
    m=len(table[0]) if n else 0
    rows=[sum(r) for r in table]
    cols=[total if False else sum(rows)//max(1,m) for j in range(m)]
    total=sum(rows)
    if not total: return "0"
    stat=Fraction(0)
    for i in range(n):
        for j in range(m):
            expected=Fraction(rows[i]*cols[j],total)
            if expected==0: continue
            stat+=(table[i][j]-expected)**2/expected
    return str(stat)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[4, 0], [0, 4]],)), '8')
check('regression 2', solve(*([[2, 3], [4, 6]],)), '0')
check('regression 3', solve(*([],)), '0')
check('regression 4', solve(*([[0, 0], [0, 0]],)), '0')
check('regression 5', solve(*([[2, 0, 1], [3, 4, 0]],)), '30/7')
check('regression 6', solve(*([[0, 0, 0], [1, 2, 3]],)), '0')
check('regression 7', solve(*([[1, 2], [3, 0], [2, 4]],)), '4')
check("variable diagonal mass",solve([[N,0],[0,N]]),str(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:
The reduction disagrees with its explicit aggregation oracle.

For a rectangular nonnegative integer count table, return the Pearson sum of (observed-expected)^2/expected under independence, with expected=row marginal*column marginal/grand total. Zero expected cells contribute zero; empty or zero-total tables return "0". Exact Fraction string; no inferential p-value claim.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(table):
    n=len(table)
    m=len(table[0]) if n else 0
    rows=[sum(r) for r in table]
    cols=[sum(table[i][j] for i in range(n)) for j in range(m)]
    total=sum(rows)
    if not total: return "0"
    stat=Fraction(0)
    for i in range(n):
        for j in range(m):
            expected=Fraction(rows[i]*cols[j],total)
            if expected==0: continue
            stat+=(table[i][j]-expected)**2/expected
    return str(stat/max(1,n*m))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[4, 0], [0, 4]],)), '8')
check('regression 2', solve(*([[2, 3], [4, 6]],)), '0')
check('regression 3', solve(*([],)), '0')
check('regression 4', solve(*([[0, 0], [0, 0]],)), '0')
check('regression 5', solve(*([[2, 0, 1], [3, 4, 0]],)), '30/7')
check('regression 6', solve(*([[0, 0, 0], [1, 2, 3]],)), '0')
check('regression 7', solve(*([[1, 2], [3, 0], [2, 4]],)), '4')
check("variable diagonal mass",solve([[N,0],[0,N]]),str(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
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(table):
    n=len(table)
    m=len(table[0]) if n else 0
    rows=[sum(r) for r in table]
    cols=[sum(table[i][j] for i in range(n)) for j in range(m)]
    total=sum(rows)
    if not total: return "0"
    stat=Fraction(0)
    for i in range(n):
        for j in range(m):
            expected=Fraction(rows[i]*cols[j],total)
            if expected==0: continue
            stat+=(table[i][j]-expected)**2/expected
    return str(stat/max(1,(n-1)*(m-1)))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[4, 0], [0, 4]],)), '8')
check('regression 2', solve(*([[2, 3], [4, 6]],)), '0')
check('regression 3', solve(*([],)), '0')
check('regression 4', solve(*([[0, 0], [0, 0]],)), '0')
check('regression 5', solve(*([[2, 0, 1], [3, 4, 0]],)), '30/7')
check('regression 6', solve(*([[0, 0, 0], [1, 2, 3]],)), '0')
check('regression 7', solve(*([[1, 2], [3, 0], [2, 4]],)), '4')
check("variable diagonal mass",solve([[N,0],[0,N]]),str(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:
The reduction disagrees with its explicit aggregation oracle.

For a rectangular nonnegative integer count table, return the Pearson sum of (observed-expected)^2/expected under independence, with expected=row marginal*column marginal/grand total. Zero expected cells contribute zero; empty or zero-total tables return "0". Exact Fraction string; no inferential p-value claim.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(table):
    n=len(table)
    m=len(table[0]) if n else 0
    rows=[sum(r) for r in table]
    cols=[sum(table[i][j] for i in range(n)) for j in range(m)]
    total=sum(rows)
    if not total: return "0"
    stat=Fraction(0)
    for i in range(n):
        for j in range(m):
            expected=Fraction(rows[i]*rows[i],total)
            if expected==0: continue
            stat+=(table[i][j]-expected)**2/expected
    return str(stat)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[4, 0], [0, 4]],)), '8')
check('regression 2', solve(*([[2, 3], [4, 6]],)), '0')
check('regression 3', solve(*([],)), '0')
check('regression 4', solve(*([[0, 0], [0, 0]],)), '0')
check('regression 5', solve(*([[2, 0, 1], [3, 4, 0]],)), '30/7')
check('regression 6', solve(*([[0, 0, 0], [1, 2, 3]],)), '0')
check('regression 7', solve(*([[1, 2], [3, 0], [2, 4]],)), '4')
check("variable diagonal mass",solve([[N,0],[0,N]]),str(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
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(table):
    n=len(table)
    m=len(table[0]) if n else 0
    rows=[sum(r) for r in table]
    cols=[sum(table[i][j] for i in range(n)) for j in range(m)]
    total=sum(rows)
    if not total: return "0"
    stat=Fraction(0)
    for i in range(n):
        for j in range(m):
            expected=Fraction(cols[j]*cols[j],total)
            if expected==0: continue
            stat+=(table[i][j]-expected)**2/expected
    return str(stat)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[4, 0], [0, 4]],)), '8')
check('regression 2', solve(*([[2, 3], [4, 6]],)), '0')
check('regression 3', solve(*([],)), '0')
check('regression 4', solve(*([[0, 0], [0, 0]],)), '0')
check('regression 5', solve(*([[2, 0, 1], [3, 4, 0]],)), '30/7')
check('regression 6', solve(*([[0, 0, 0], [1, 2, 3]],)), '0')
check('regression 7', solve(*([[1, 2], [3, 0], [2, 4]],)), '4')
check("variable diagonal mass",solve([[N,0],[0,N]]),str(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:
The reduction disagrees with its explicit aggregation oracle.

For a rectangular nonnegative integer count table, return the Pearson sum of (observed-expected)^2/expected under independence, with expected=row marginal*column marginal/grand total. Zero expected cells contribute zero; empty or zero-total tables return "0". Exact Fraction string; no inferential p-value claim.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(table):
    n=len(table)
    m=len(table[0]) if n else 0
    rows=[sum(r) for r in table]
    cols=[sum(table[i][j] for i in range(n)) for j in range(m)]
    total=sum(rows)
    if not total: return "0"
    stat=Fraction(0)
    for i in range(n):
        for j in range(m):
            expected=Fraction(rows[i]*cols[j],total)
            if expected==0: continue
            stat=max(stat,(table[i][j]-expected)**2/expected)
    return str(stat)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[4, 0], [0, 4]],)), '8')
check('regression 2', solve(*([[2, 3], [4, 6]],)), '0')
check('regression 3', solve(*([],)), '0')
check('regression 4', solve(*([[0, 0], [0, 0]],)), '0')
check('regression 5', solve(*([[2, 0, 1], [3, 4, 0]],)), '30/7')
check('regression 6', solve(*([[0, 0, 0], [1, 2, 3]],)), '0')
check('regression 7', solve(*([[1, 2], [3, 0], [2, 4]],)), '4')
check("variable diagonal mass",solve([[N,0],[0,N]]),str(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
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(table):
    n=len(table)
    m=len(table[0]) if n else 0
    rows=[sum(r) for r in table]
    cols=[sum(table[i][j] for i in range(n)) for j in range(m)]
    total=sum(rows)
    if not total: return "0"
    stat=Fraction(0)
    for i in range(n):
        for j in range(m):
            expected=Fraction(rows[i]*cols[j],total)
            if expected==0: continue
            stat=(table[i][j]-expected)**2/expected
    return str(stat)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[4, 0], [0, 4]],)), '8')
check('regression 2', solve(*([[2, 3], [4, 6]],)), '0')
check('regression 3', solve(*([],)), '0')
check('regression 4', solve(*([[0, 0], [0, 0]],)), '0')
check('regression 5', solve(*([[2, 0, 1], [3, 4, 0]],)), '30/7')
check('regression 6', solve(*([[0, 0, 0], [1, 2, 3]],)), '0')
check('regression 7', solve(*([[1, 2], [3, 0], [2, 4]],)), '4')
check("variable diagonal mass",solve([[N,0],[0,N]]),str(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:
The reduction disagrees with its explicit aggregation oracle.

For a rectangular nonnegative integer count table, return the Pearson sum of (observed-expected)^2/expected under independence, with expected=row marginal*column marginal/grand total. Zero expected cells contribute zero; empty or zero-total tables return "0". Exact Fraction string; no inferential p-value claim.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(table):
    n=len(table)
    m=len(table[0]) if n else 0
    rows=[sum(r) for r in table]
    cols=[sum(table[i][j] for i in range(n)) for j in range(m)]
    total=sum(rows)
    if not total: return "0"
    stat=Fraction(0)
    for i in range(n):
        for j in range(m):
            expected=Fraction(rows[i]*cols[j],total)
            if expected==0:
                stat+=1
                continue
            stat+=(table[i][j]-expected)**2/expected
    return str(stat)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[4, 0], [0, 4]],)), '8')
check('regression 2', solve(*([[2, 3], [4, 6]],)), '0')
check('regression 3', solve(*([],)), '0')
check('regression 4', solve(*([[0, 0], [0, 0]],)), '0')
check('regression 5', solve(*([[2, 0, 1], [3, 4, 0]],)), '30/7')
check('regression 6', solve(*([[0, 0, 0], [1, 2, 3]],)), '0')
check('regression 7', solve(*([[1, 2], [3, 0], [2, 4]],)), '4')
check("variable diagonal mass",solve([[N,0],[0,N]]),str(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
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(table):
    n=len(table)
    m=len(table[0]) if n else 0
    rows=[sum(r) for r in table]
    cols=[sum(table[i][j] for i in range(n)) for j in range(m)]
    total=sum(rows)
    if not total: return "0"
    stat=Fraction(0)
    for i in range(n):
        for j in range(m):
            expected=Fraction(rows[i]*cols[j],total)
            if expected==0:
                stat+=Fraction(1,max(1,total))
                continue
            stat+=(table[i][j]-expected)**2/expected
    return str(stat)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[4, 0], [0, 4]],)), '8')
check('regression 2', solve(*([[2, 3], [4, 6]],)), '0')
check('regression 3', solve(*([],)), '0')
check('regression 4', solve(*([[0, 0], [0, 0]],)), '0')
check('regression 5', solve(*([[2, 0, 1], [3, 4, 0]],)), '30/7')
check('regression 6', solve(*([[0, 0, 0], [1, 2, 3]],)), '0')
check('regression 7', solve(*([[1, 2], [3, 0], [2, 4]],)), '4')
check("variable diagonal mass",solve([[N,0],[0,N]]),str(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:
The reduction disagrees with its explicit aggregation oracle.

For a rectangular nonnegative integer count table, return the Pearson sum of (observed-expected)^2/expected under independence, with expected=row marginal*column marginal/grand total. Zero expected cells contribute zero; empty or zero-total tables return "0". Exact Fraction string; no inferential p-value claim.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(points):
    concordant=discordant=tx=ty=0
    for i in range(len(points)):
        for j in range(i+1,len(points)):
            dx=points[i][0]-points[j][0]
            dy=points[i][1]-points[j][1]
            if dx: tx+=1
            if dy: ty+=1
            concordant+=int(dx*dy>=0)
            discordant+=int(dx*dy<0)
    if not tx or not ty: return None
    d=concordant-discordant
    return str(Fraction((1 if d>=0 else -1)*d*d,tx*ty))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(1, 1), (2, 2), (3, 3)],)), '1')
check('regression 2', solve(*([(1, 3), (2, 2), (3, 1)],)), '-1')
check('regression 3', solve(*([(1, 1), (1, 2), (2, 2), (3, 1)],)), '-1/20')
check('regression 4', solve(*([],)), None)
check('regression 5', solve(*([(1, 1), (1, 2)],)), None)
check('regression 6', solve(*([(1, 1), (2, 2), (2, 2), (4, 3)],)), '1')
check('regression 7', solve(*([(1, 2), (3, 1), (4, 4), (2, 5)],)), '0')
check("variable discordance direction",solve([(0,N),(N,0)]),"-1")
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(points):
    concordant=discordant=tx=ty=0
    for i in range(len(points)):
        for j in range(i+1,len(points)):
            dx=points[i][0]-points[j][0]
            dy=points[i][1]-points[j][1]
            if dx: tx+=1
            if dy: ty+=1
            concordant+=int(dx==dy)
            discordant+=int(dx*dy<0)
    if not tx or not ty: return None
    d=concordant-discordant
    return str(Fraction((1 if d>=0 else -1)*d*d,tx*ty))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(1, 1), (2, 2), (3, 3)],)), '1')
check('regression 2', solve(*([(1, 3), (2, 2), (3, 1)],)), '-1')
check('regression 3', solve(*([(1, 1), (1, 2), (2, 2), (3, 1)],)), '-1/20')
check('regression 4', solve(*([],)), None)
check('regression 5', solve(*([(1, 1), (1, 2)],)), None)
check('regression 6', solve(*([(1, 1), (2, 2), (2, 2), (4, 3)],)), '1')
check('regression 7', solve(*([(1, 2), (3, 1), (4, 4), (2, 5)],)), '0')
check("variable discordance direction",solve([(0,N),(N,0)]),"-1")
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

For paired ordinal observations return sign(tau_b)*tau_b**2 as an exact Fraction string. Every unordered observation pair contributes its coordinate comparison; normalize signed concordance squared by products of non-tied x/y pair counts. Undefined if either coordinate has no varying pairs.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(points):
    concordant=discordant=tx=ty=0
    for i in range(len(points)):
        for j in range(i+1,len(points)):
            dx=points[i][0]-points[j][0]
            dy=points[i][1]-points[j][1]
            if dx: tx+=1
            if dy: ty+=1
            concordant+=int(dx*dy>0)
            discordant+=int(dx*dy<0)
    if not tx or not ty: return None
    d=concordant+discordant
    return str(Fraction((1 if d>=0 else -1)*d*d,tx*ty))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(1, 1), (2, 2), (3, 3)],)), '1')
check('regression 2', solve(*([(1, 3), (2, 2), (3, 1)],)), '-1')
check('regression 3', solve(*([(1, 1), (1, 2), (2, 2), (3, 1)],)), '-1/20')
check('regression 4', solve(*([],)), None)
check('regression 5', solve(*([(1, 1), (1, 2)],)), None)
check('regression 6', solve(*([(1, 1), (2, 2), (2, 2), (4, 3)],)), '1')
check('regression 7', solve(*([(1, 2), (3, 1), (4, 4), (2, 5)],)), '0')
check("variable discordance direction",solve([(0,N),(N,0)]),"-1")
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(points):
    concordant=discordant=tx=ty=0
    for i in range(len(points)):
        for j in range(i+1,len(points)):
            dx=points[i][0]-points[j][0]
            dy=points[i][1]-points[j][1]
            if dx: tx+=1
            if dy: ty+=1
            concordant+=int(dx*dy>0)
            discordant+=int(dx*dy<0)
    if not tx or not ty: return None
    d=discordant-concordant
    return str(Fraction((1 if d>=0 else -1)*d*d,tx*ty))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(1, 1), (2, 2), (3, 3)],)), '1')
check('regression 2', solve(*([(1, 3), (2, 2), (3, 1)],)), '-1')
check('regression 3', solve(*([(1, 1), (1, 2), (2, 2), (3, 1)],)), '-1/20')
check('regression 4', solve(*([],)), None)
check('regression 5', solve(*([(1, 1), (1, 2)],)), None)
check('regression 6', solve(*([(1, 1), (2, 2), (2, 2), (4, 3)],)), '1')
check('regression 7', solve(*([(1, 2), (3, 1), (4, 4), (2, 5)],)), '0')
check("variable discordance direction",solve([(0,N),(N,0)]),"-1")
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

For paired ordinal observations return sign(tau_b)*tau_b**2 as an exact Fraction string. Every unordered observation pair contributes its coordinate comparison; normalize signed concordance squared by products of non-tied x/y pair counts. Undefined if either coordinate has no varying pairs.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(points):
    concordant=discordant=tx=ty=0
    for i in range(len(points)):
        for j in range(i+1,len(points)):
            dx=points[i][0]-points[j][0]
            dy=points[i][1]-points[j][1]
            if dx: tx+=1
            if dy: ty+=1
            concordant+=int(dx*dy>0)
            discordant+=int(dx*dy<0)
    if not tx or not ty: return None
    d=concordant-discordant
    return str(Fraction(d*d,tx*ty))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(1, 1), (2, 2), (3, 3)],)), '1')
check('regression 2', solve(*([(1, 3), (2, 2), (3, 1)],)), '-1')
check('regression 3', solve(*([(1, 1), (1, 2), (2, 2), (3, 1)],)), '-1/20')
check('regression 4', solve(*([],)), None)
check('regression 5', solve(*([(1, 1), (1, 2)],)), None)
check('regression 6', solve(*([(1, 1), (2, 2), (2, 2), (4, 3)],)), '1')
check('regression 7', solve(*([(1, 2), (3, 1), (4, 4), (2, 5)],)), '0')
check("variable discordance direction",solve([(0,N),(N,0)]),"-1")
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(points):
    concordant=discordant=tx=ty=0
    for i in range(len(points)):
        for j in range(i+1,len(points)):
            dx=points[i][0]-points[j][0]
            dy=points[i][1]-points[j][1]
            if dx: tx+=1
            if dy: ty+=1
            concordant+=int(dx*dy>0)
            discordant+=int(dx*dy<0)
    if not tx or not ty: return None
    d=concordant-discordant
    return str(Fraction(-d*d,tx*ty))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(1, 1), (2, 2), (3, 3)],)), '1')
check('regression 2', solve(*([(1, 3), (2, 2), (3, 1)],)), '-1')
check('regression 3', solve(*([(1, 1), (1, 2), (2, 2), (3, 1)],)), '-1/20')
check('regression 4', solve(*([],)), None)
check('regression 5', solve(*([(1, 1), (1, 2)],)), None)
check('regression 6', solve(*([(1, 1), (2, 2), (2, 2), (4, 3)],)), '1')
check('regression 7', solve(*([(1, 2), (3, 1), (4, 4), (2, 5)],)), '0')
check("variable discordance direction",solve([(0,N),(N,0)]),"-1")
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

For paired ordinal observations return sign(tau_b)*tau_b**2 as an exact Fraction string. Every unordered observation pair contributes its coordinate comparison; normalize signed concordance squared by products of non-tied x/y pair counts. Undefined if either coordinate has no varying pairs.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(points):
    concordant=discordant=tx=ty=0
    for i in range(len(points)):
        for j in range(i+1,len(points)):
            dx=points[i][0]-points[j][0]
            dy=points[i][1]-points[j][1]
            if dx: tx+=1
            if dy: ty+=1
            concordant+=int(dx*dy>0)
            discordant+=int(dx*dy<0)
    if not tx or not ty: return None
    d=concordant-discordant
    return str(Fraction((1 if d>=0 else -1)*d*d,(len(points)*(len(points)-1)//2)**2))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(1, 1), (2, 2), (3, 3)],)), '1')
check('regression 2', solve(*([(1, 3), (2, 2), (3, 1)],)), '-1')
check('regression 3', solve(*([(1, 1), (1, 2), (2, 2), (3, 1)],)), '-1/20')
check('regression 4', solve(*([],)), None)
check('regression 5', solve(*([(1, 1), (1, 2)],)), None)
check('regression 6', solve(*([(1, 1), (2, 2), (2, 2), (4, 3)],)), '1')
check('regression 7', solve(*([(1, 2), (3, 1), (4, 4), (2, 5)],)), '0')
check("variable discordance direction",solve([(0,N),(N,0)]),"-1")
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(points):
    concordant=discordant=tx=ty=0
    for i in range(len(points)):
        for j in range(i+1,len(points)):
            dx=points[i][0]-points[j][0]
            dy=points[i][1]-points[j][1]
            if dx: tx+=1
            if dy: ty+=1
            concordant+=int(dx*dy>0)
            discordant+=int(dx*dy<0)
    if not tx or not ty: return None
    d=concordant-discordant
    return str(Fraction((1 if d>=0 else -1)*d*d,max(1,(concordant+discordant)**2)))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(1, 1), (2, 2), (3, 3)],)), '1')
check('regression 2', solve(*([(1, 3), (2, 2), (3, 1)],)), '-1')
check('regression 3', solve(*([(1, 1), (1, 2), (2, 2), (3, 1)],)), '-1/20')
check('regression 4', solve(*([],)), None)
check('regression 5', solve(*([(1, 1), (1, 2)],)), None)
check('regression 6', solve(*([(1, 1), (2, 2), (2, 2), (4, 3)],)), '1')
check('regression 7', solve(*([(1, 2), (3, 1), (4, 4), (2, 5)],)), '0')
check("variable discordance direction",solve([(0,N),(N,0)]),"-1")
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

For paired ordinal observations return sign(tau_b)*tau_b**2 as an exact Fraction string. Every unordered observation pair contributes its coordinate comparison; normalize signed concordance squared by products of non-tied x/y pair counts. Undefined if either coordinate has no varying pairs.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(points):
    concordant=discordant=tx=ty=0
    for i in range(len(points)):
        for j in range(i+1,len(points)):
            dx=points[i][0]-points[j][0]
            dy=points[i][1]-points[j][1]
            if not dx: tx+=1
            if dy: ty+=1
            concordant+=int(dx*dy>0)
            discordant+=int(dx*dy<0)
    if not tx or not ty: return None
    d=concordant-discordant
    return str(Fraction((1 if d>=0 else -1)*d*d,tx*ty))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(1, 1), (2, 2), (3, 3)],)), '1')
check('regression 2', solve(*([(1, 3), (2, 2), (3, 1)],)), '-1')
check('regression 3', solve(*([(1, 1), (1, 2), (2, 2), (3, 1)],)), '-1/20')
check('regression 4', solve(*([],)), None)
check('regression 5', solve(*([(1, 1), (1, 2)],)), None)
check('regression 6', solve(*([(1, 1), (2, 2), (2, 2), (4, 3)],)), '1')
check('regression 7', solve(*([(1, 2), (3, 1), (4, 4), (2, 5)],)), '0')
check("variable discordance direction",solve([(0,N),(N,0)]),"-1")
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(points):
    concordant=discordant=tx=ty=0
    for i in range(len(points)):
        for j in range(i+1,len(points)):
            dx=points[i][0]-points[j][0]
            dy=points[i][1]-points[j][1]
            tx+=1
            if dy: ty+=1
            concordant+=int(dx*dy>0)
            discordant+=int(dx*dy<0)
    if not tx or not ty: return None
    d=concordant-discordant
    return str(Fraction((1 if d>=0 else -1)*d*d,tx*ty))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(1, 1), (2, 2), (3, 3)],)), '1')
check('regression 2', solve(*([(1, 3), (2, 2), (3, 1)],)), '-1')
check('regression 3', solve(*([(1, 1), (1, 2), (2, 2), (3, 1)],)), '-1/20')
check('regression 4', solve(*([],)), None)
check('regression 5', solve(*([(1, 1), (1, 2)],)), None)
check('regression 6', solve(*([(1, 1), (2, 2), (2, 2), (4, 3)],)), '1')
check('regression 7', solve(*([(1, 2), (3, 1), (4, 4), (2, 5)],)), '0')
check("variable discordance direction",solve([(0,N),(N,0)]),"-1")
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

For paired ordinal observations return sign(tau_b)*tau_b**2 as an exact Fraction string. Every unordered observation pair contributes its coordinate comparison; normalize signed concordance squared by products of non-tied x/y pair counts. Undefined if either coordinate has no varying pairs.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(points):
    concordant=discordant=tx=ty=0
    for i in range(len(points)):
        for j in range(i+1,len(points)):
            dx=points[i][0]-points[j][0]
            dy=points[i][1]-points[j][1]
            if dx: tx+=1
            if dx: ty+=1
            concordant+=int(dx*dy>0)
            discordant+=int(dx*dy<0)
    if not tx or not ty: return None
    d=concordant-discordant
    return str(Fraction((1 if d>=0 else -1)*d*d,tx*ty))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(1, 1), (2, 2), (3, 3)],)), '1')
check('regression 2', solve(*([(1, 3), (2, 2), (3, 1)],)), '-1')
check('regression 3', solve(*([(1, 1), (1, 2), (2, 2), (3, 1)],)), '-1/20')
check('regression 4', solve(*([],)), None)
check('regression 5', solve(*([(1, 1), (1, 2)],)), None)
check('regression 6', solve(*([(1, 1), (2, 2), (2, 2), (4, 3)],)), '1')
check('regression 7', solve(*([(1, 2), (3, 1), (4, 4), (2, 5)],)), '0')
check("variable discordance direction",solve([(0,N),(N,0)]),"-1")
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(points):
    concordant=discordant=tx=ty=0
    for i in range(len(points)):
        for j in range(i+1,len(points)):
            dx=points[i][0]-points[j][0]
            dy=points[i][1]-points[j][1]
            if dx: tx+=1
            if dx and dy: ty+=1
            concordant+=int(dx*dy>0)
            discordant+=int(dx*dy<0)
    if not tx or not ty: return None
    d=concordant-discordant
    return str(Fraction((1 if d>=0 else -1)*d*d,tx*ty))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(1, 1), (2, 2), (3, 3)],)), '1')
check('regression 2', solve(*([(1, 3), (2, 2), (3, 1)],)), '-1')
check('regression 3', solve(*([(1, 1), (1, 2), (2, 2), (3, 1)],)), '-1/20')
check('regression 4', solve(*([],)), None)
check('regression 5', solve(*([(1, 1), (1, 2)],)), None)
check('regression 6', solve(*([(1, 1), (2, 2), (2, 2), (4, 3)],)), '1')
check('regression 7', solve(*([(1, 2), (3, 1), (4, 4), (2, 5)],)), '0')
check("variable discordance direction",solve([(0,N),(N,0)]),"-1")
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

For paired ordinal observations return sign(tau_b)*tau_b**2 as an exact Fraction string. Every unordered observation pair contributes its coordinate comparison; normalize signed concordance squared by products of non-tied x/y pair counts. Undefined if either coordinate has no varying pairs.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(points):
    concordant=discordant=tx=ty=0
    for i in range(len(points)):
        for j in range(i+1,min(i+2,len(points))):
            dx=points[i][0]-points[j][0]
            dy=points[i][1]-points[j][1]
            if dx: tx+=1
            if dy: ty+=1
            concordant+=int(dx*dy>0)
            discordant+=int(dx*dy<0)
    if not tx or not ty: return None
    d=concordant-discordant
    return str(Fraction((1 if d>=0 else -1)*d*d,tx*ty))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(1, 1), (2, 2), (3, 3)],)), '1')
check('regression 2', solve(*([(1, 3), (2, 2), (3, 1)],)), '-1')
check('regression 3', solve(*([(1, 1), (1, 2), (2, 2), (3, 1)],)), '-1/20')
check('regression 4', solve(*([],)), None)
check('regression 5', solve(*([(1, 1), (1, 2)],)), None)
check('regression 6', solve(*([(1, 1), (2, 2), (2, 2), (4, 3)],)), '1')
check('regression 7', solve(*([(1, 2), (3, 1), (4, 4), (2, 5)],)), '0')
check("variable discordance direction",solve([(0,N),(N,0)]),"-1")
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(points):
    concordant=discordant=tx=ty=0
    for i in range(len(points)):
        for j in range(i+2,len(points)):
            dx=points[i][0]-points[j][0]
            dy=points[i][1]-points[j][1]
            if dx: tx+=1
            if dy: ty+=1
            concordant+=int(dx*dy>0)
            discordant+=int(dx*dy<0)
    if not tx or not ty: return None
    d=concordant-discordant
    return str(Fraction((1 if d>=0 else -1)*d*d,tx*ty))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(1, 1), (2, 2), (3, 3)],)), '1')
check('regression 2', solve(*([(1, 3), (2, 2), (3, 1)],)), '-1')
check('regression 3', solve(*([(1, 1), (1, 2), (2, 2), (3, 1)],)), '-1/20')
check('regression 4', solve(*([],)), None)
check('regression 5', solve(*([(1, 1), (1, 2)],)), None)
check('regression 6', solve(*([(1, 1), (2, 2), (2, 2), (4, 3)],)), '1')
check('regression 7', solve(*([(1, 2), (3, 1), (4, 4), (2, 5)],)), '0')
check("variable discordance direction",solve([(0,N),(N,0)]),"-1")
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

For paired ordinal observations return sign(tau_b)*tau_b**2 as an exact Fraction string. Every unordered observation pair contributes its coordinate comparison; normalize signed concordance squared by products of non-tied x/y pair counts. Undefined if either coordinate has no varying pairs.

split: open-access