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(a, b):
    if not a or not b: return None
    ca,cb=Counter(a),Counter(b)
    points=sorted(set(ca)|set(cb))
    pa=pb=Fraction(0)
    area=Fraction(0)
    for i,x in enumerate(points[:-1]):
        pa+=Fraction(ca[x],len(a))
        pb+=Fraction(cb[x],len(b))
        area+=abs(pa-pb)*(points[i+1]-x+1)
    return str(area)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([0, 0, 9], [1, 4])), '17/6')
check('regression 2', solve(*([2], [7])), '5')
check('regression 3', solve(*([1, 2], [1, 2])), '0')
check('regression 4', solve(*([], [1])), None)
check('regression 5', solve(*([-8, -1, 4], [-3, 9, 9])), '20/3')
check('regression 6', solve(*([0, 2, 8], [0, 8])), '4/3')
check('regression 7', solve(*([0, 10], [4, 6])), '4')
check("variable transport span",solve([0],[N]),str(N))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(a, b):
    if not a or not b: return None
    ca,cb=Counter(a),Counter(b)
    points=sorted(set(ca)|set(cb))
    pa=pb=Fraction(0)
    area=Fraction(0)
    for i,x in enumerate(points[:-1]):
        pa+=Fraction(ca[x],len(a))
        pb+=Fraction(cb[x],len(b))
        area+=abs(pa-pb)*max(0,points[i+1]-x-1)
    return str(area)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([0, 0, 9], [1, 4])), '17/6')
check('regression 2', solve(*([2], [7])), '5')
check('regression 3', solve(*([1, 2], [1, 2])), '0')
check('regression 4', solve(*([], [1])), None)
check('regression 5', solve(*([-8, -1, 4], [-3, 9, 9])), '20/3')
check('regression 6', solve(*([0, 2, 8], [0, 8])), '4/3')
check('regression 7', solve(*([0, 10], [4, 6])), '4')
check("variable transport span",solve([0],[N]),str(N))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

For nonempty integer samples with equal total probability after separate normalization, return integral of absolute CDF difference over the real line as a Fraction string. Empty either side returns None.

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(a, b):
    if not a or not b: return None
    ca,cb=Counter(a),Counter(b)
    points=sorted(set(ca)|set(cb))
    pa=pb=Fraction(0)
    area=Fraction(0)
    for i,x in enumerate(points[:-1]):
        pa+=Fraction(ca[x],len(a))
        pb+=Fraction(cb[x],len(b))
        area+=abs(pa-pb)*(points[i+1]-x)
    return str(area/max(1,points[-1]-points[0]))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([0, 0, 9], [1, 4])), '17/6')
check('regression 2', solve(*([2], [7])), '5')
check('regression 3', solve(*([1, 2], [1, 2])), '0')
check('regression 4', solve(*([], [1])), None)
check('regression 5', solve(*([-8, -1, 4], [-3, 9, 9])), '20/3')
check('regression 6', solve(*([0, 2, 8], [0, 8])), '4/3')
check('regression 7', solve(*([0, 10], [4, 6])), '4')
check("variable transport span",solve([0],[N]),str(N))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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(a, b):
    if not a or not b: return None
    ca,cb=Counter(a),Counter(b)
    points=sorted(set(ca)|set(cb))
    pa=pb=Fraction(0)
    area=Fraction(0)
    for i,x in enumerate(points[:-1]):
        pa+=Fraction(ca[x],len(a))
        pb+=Fraction(cb[x],len(b))
        area+=abs(pa-pb)*(points[i+1]-x)
    return str(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, 0, 9], [1, 4])), '17/6')
check('regression 2', solve(*([2], [7])), '5')
check('regression 3', solve(*([1, 2], [1, 2])), '0')
check('regression 4', solve(*([], [1])), None)
check('regression 5', solve(*([-8, -1, 4], [-3, 9, 9])), '20/3')
check('regression 6', solve(*([0, 2, 8], [0, 8])), '4/3')
check('regression 7', solve(*([0, 10], [4, 6])), '4')
check("variable transport span",solve([0],[N]),str(N))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

For nonempty integer samples with equal total probability after separate normalization, return integral of absolute CDF difference over the real line as a Fraction string. Empty either side returns None.

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):
    n=0
    mean=m2=Fraction(0)
    for op,x in events:
        if op=="add":
            new_n=n+1
            delta=x-mean
            new_mean=mean+delta/new_n
            m2+=delta*delta
            mean=new_mean
            n=new_n
        else:
            new_n=n-1
            if new_n==0:
                n=0
                mean=m2=Fraction(0)
                continue
            new_mean=(n*mean-x)/new_n
            m2-=(x-mean)*(x-new_mean)
            mean=new_mean
            n=new_n
    return [n,str(mean),str(m2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('add', -3), ('add', 8), ('remove', -3)],)), [1, '8', '0'])
check('regression 2', solve(*([('add', 6), ('remove', 6)],)), [0, '0', '0'])
check('regression 3', solve(*([('add', 1), ('add', 4), ('add', 8), ('remove', 4)],)), [2, '9/2', '49/2'])
check('regression 4', solve(*([('add', -5), ('remove', -5), ('add', 9)],)), [1, '9', '0'])
check('regression 5', solve(*([],)), [0, '0', '0'])
check('regression 6', solve(*([('add', 2), ('add', 2), ('remove', 2)],)), [1, '2', '0'])
check('regression 7', solve(*([('add', 0), ('add', 4), ('add', 9), ('add', -1), ('remove', 0), ('remove', 9)],)), [2, '3/2', '25/2'])
check('regression 8', solve(*([('add', 3), ('add', 8)],)), [2, '11/2', '25/2'])
check('regression 9', solve(*([('add', 1), ('add', 6), ('add', 9), ('remove', 1)],)), [2, '15/2', '9/2'])
check("variable removal",solve([("add",0),("add",N),("add",3*N),("remove",N)]),[2,str(Fraction(3*N,2)),str(Fraction(9*N*N,2))])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events):
    n=0
    mean=m2=Fraction(0)
    for op,x in events:
        if op=="add":
            new_n=n+1
            delta=x-mean
            new_mean=mean+delta/new_n
            m2+=(x-new_mean)**2
            mean=new_mean
            n=new_n
        else:
            new_n=n-1
            if new_n==0:
                n=0
                mean=m2=Fraction(0)
                continue
            new_mean=(n*mean-x)/new_n
            m2-=(x-mean)*(x-new_mean)
            mean=new_mean
            n=new_n
    return [n,str(mean),str(m2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('add', -3), ('add', 8), ('remove', -3)],)), [1, '8', '0'])
check('regression 2', solve(*([('add', 6), ('remove', 6)],)), [0, '0', '0'])
check('regression 3', solve(*([('add', 1), ('add', 4), ('add', 8), ('remove', 4)],)), [2, '9/2', '49/2'])
check('regression 4', solve(*([('add', -5), ('remove', -5), ('add', 9)],)), [1, '9', '0'])
check('regression 5', solve(*([],)), [0, '0', '0'])
check('regression 6', solve(*([('add', 2), ('add', 2), ('remove', 2)],)), [1, '2', '0'])
check('regression 7', solve(*([('add', 0), ('add', 4), ('add', 9), ('add', -1), ('remove', 0), ('remove', 9)],)), [2, '3/2', '25/2'])
check('regression 8', solve(*([('add', 3), ('add', 8)],)), [2, '11/2', '25/2'])
check('regression 9', solve(*([('add', 1), ('add', 6), ('add', 9), ('remove', 1)],)), [2, '15/2', '9/2'])
check("variable removal",solve([("add",0),("add",N),("add",3*N),("remove",N)]),[2,str(Fraction(3*N,2)),str(Fraction(9*N*N,2))])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

Process add/remove integer observations; each removal names one active equal-valued observation. Maintain [count, exact mean, unnormalised squared central scatter]. Empty state is [0,"0","0"].

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):
    n=0
    mean=m2=Fraction(0)
    for op,x in events:
        if op=="add":
            new_n=n+1
            delta=x-mean
            new_mean=mean+delta/max(1,n)
            m2+=delta*(x-new_mean)
            mean=new_mean
            n=new_n
        else:
            new_n=n-1
            if new_n==0:
                n=0
                mean=m2=Fraction(0)
                continue
            new_mean=(n*mean-x)/new_n
            m2-=(x-mean)*(x-new_mean)
            mean=new_mean
            n=new_n
    return [n,str(mean),str(m2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('add', -3), ('add', 8), ('remove', -3)],)), [1, '8', '0'])
check('regression 2', solve(*([('add', 6), ('remove', 6)],)), [0, '0', '0'])
check('regression 3', solve(*([('add', 1), ('add', 4), ('add', 8), ('remove', 4)],)), [2, '9/2', '49/2'])
check('regression 4', solve(*([('add', -5), ('remove', -5), ('add', 9)],)), [1, '9', '0'])
check('regression 5', solve(*([],)), [0, '0', '0'])
check('regression 6', solve(*([('add', 2), ('add', 2), ('remove', 2)],)), [1, '2', '0'])
check('regression 7', solve(*([('add', 0), ('add', 4), ('add', 9), ('add', -1), ('remove', 0), ('remove', 9)],)), [2, '3/2', '25/2'])
check('regression 8', solve(*([('add', 3), ('add', 8)],)), [2, '11/2', '25/2'])
check('regression 9', solve(*([('add', 1), ('add', 6), ('add', 9), ('remove', 1)],)), [2, '15/2', '9/2'])
check("variable removal",solve([("add",0),("add",N),("add",3*N),("remove",N)]),[2,str(Fraction(3*N,2)),str(Fraction(9*N*N,2))])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events):
    n=0
    mean=m2=Fraction(0)
    for op,x in events:
        if op=="add":
            new_n=n+1
            delta=x-mean
            new_mean=mean+delta/(new_n+1)
            m2+=delta*(x-new_mean)
            mean=new_mean
            n=new_n
        else:
            new_n=n-1
            if new_n==0:
                n=0
                mean=m2=Fraction(0)
                continue
            new_mean=(n*mean-x)/new_n
            m2-=(x-mean)*(x-new_mean)
            mean=new_mean
            n=new_n
    return [n,str(mean),str(m2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('add', -3), ('add', 8), ('remove', -3)],)), [1, '8', '0'])
check('regression 2', solve(*([('add', 6), ('remove', 6)],)), [0, '0', '0'])
check('regression 3', solve(*([('add', 1), ('add', 4), ('add', 8), ('remove', 4)],)), [2, '9/2', '49/2'])
check('regression 4', solve(*([('add', -5), ('remove', -5), ('add', 9)],)), [1, '9', '0'])
check('regression 5', solve(*([],)), [0, '0', '0'])
check('regression 6', solve(*([('add', 2), ('add', 2), ('remove', 2)],)), [1, '2', '0'])
check('regression 7', solve(*([('add', 0), ('add', 4), ('add', 9), ('add', -1), ('remove', 0), ('remove', 9)],)), [2, '3/2', '25/2'])
check('regression 8', solve(*([('add', 3), ('add', 8)],)), [2, '11/2', '25/2'])
check('regression 9', solve(*([('add', 1), ('add', 6), ('add', 9), ('remove', 1)],)), [2, '15/2', '9/2'])
check("variable removal",solve([("add",0),("add",N),("add",3*N),("remove",N)]),[2,str(Fraction(3*N,2)),str(Fraction(9*N*N,2))])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

Process add/remove integer observations; each removal names one active equal-valued observation. Maintain [count, exact mean, unnormalised squared central scatter]. Empty state is [0,"0","0"].

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):
    n=0
    mean=m2=Fraction(0)
    for op,x in events:
        if op=="add":
            new_n=n+1
            delta=x-mean
            new_mean=mean+delta/new_n
            m2+=delta*(x-new_mean)
            mean=new_mean
            n=new_n
        else:
            new_n=n-1
            if new_n==0:
                n=0
                mean=m2=Fraction(0)
                continue
            new_mean=(n*mean+x)/new_n
            m2-=(x-mean)*(x-new_mean)
            mean=new_mean
            n=new_n
    return [n,str(mean),str(m2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('add', -3), ('add', 8), ('remove', -3)],)), [1, '8', '0'])
check('regression 2', solve(*([('add', 6), ('remove', 6)],)), [0, '0', '0'])
check('regression 3', solve(*([('add', 1), ('add', 4), ('add', 8), ('remove', 4)],)), [2, '9/2', '49/2'])
check('regression 4', solve(*([('add', -5), ('remove', -5), ('add', 9)],)), [1, '9', '0'])
check('regression 5', solve(*([],)), [0, '0', '0'])
check('regression 6', solve(*([('add', 2), ('add', 2), ('remove', 2)],)), [1, '2', '0'])
check('regression 7', solve(*([('add', 0), ('add', 4), ('add', 9), ('add', -1), ('remove', 0), ('remove', 9)],)), [2, '3/2', '25/2'])
check('regression 8', solve(*([('add', 3), ('add', 8)],)), [2, '11/2', '25/2'])
check('regression 9', solve(*([('add', 1), ('add', 6), ('add', 9), ('remove', 1)],)), [2, '15/2', '9/2'])
check("variable removal",solve([("add",0),("add",N),("add",3*N),("remove",N)]),[2,str(Fraction(3*N,2)),str(Fraction(9*N*N,2))])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events):
    n=0
    mean=m2=Fraction(0)
    for op,x in events:
        if op=="add":
            new_n=n+1
            delta=x-mean
            new_mean=mean+delta/new_n
            m2+=delta*(x-new_mean)
            mean=new_mean
            n=new_n
        else:
            new_n=n-1
            if new_n==0:
                n=0
                mean=m2=Fraction(0)
                continue
            new_mean=(n*mean-abs(x))/new_n
            m2-=(x-mean)*(x-new_mean)
            mean=new_mean
            n=new_n
    return [n,str(mean),str(m2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('add', -3), ('add', 8), ('remove', -3)],)), [1, '8', '0'])
check('regression 2', solve(*([('add', 6), ('remove', 6)],)), [0, '0', '0'])
check('regression 3', solve(*([('add', 1), ('add', 4), ('add', 8), ('remove', 4)],)), [2, '9/2', '49/2'])
check('regression 4', solve(*([('add', -5), ('remove', -5), ('add', 9)],)), [1, '9', '0'])
check('regression 5', solve(*([],)), [0, '0', '0'])
check('regression 6', solve(*([('add', 2), ('add', 2), ('remove', 2)],)), [1, '2', '0'])
check('regression 7', solve(*([('add', 0), ('add', 4), ('add', 9), ('add', -1), ('remove', 0), ('remove', 9)],)), [2, '3/2', '25/2'])
check('regression 8', solve(*([('add', 3), ('add', 8)],)), [2, '11/2', '25/2'])
check('regression 9', solve(*([('add', 1), ('add', 6), ('add', 9), ('remove', 1)],)), [2, '15/2', '9/2'])
check("variable removal",solve([("add",0),("add",N),("add",3*N),("remove",N)]),[2,str(Fraction(3*N,2)),str(Fraction(9*N*N,2))])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

Process add/remove integer observations; each removal names one active equal-valued observation. Maintain [count, exact mean, unnormalised squared central scatter]. Empty state is [0,"0","0"].

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):
    n=0
    mean=m2=Fraction(0)
    for op,x in events:
        if op=="add":
            new_n=n+1
            delta=x-mean
            new_mean=mean+delta/new_n
            m2+=delta*(x-new_mean)
            mean=new_mean
            n=new_n
        else:
            new_n=n-1
            if new_n==0:
                n=0
                mean=m2=Fraction(0)
                continue
            new_mean=(n*mean-x)/n
            m2-=(x-mean)*(x-new_mean)
            mean=new_mean
            n=new_n
    return [n,str(mean),str(m2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('add', -3), ('add', 8), ('remove', -3)],)), [1, '8', '0'])
check('regression 2', solve(*([('add', 6), ('remove', 6)],)), [0, '0', '0'])
check('regression 3', solve(*([('add', 1), ('add', 4), ('add', 8), ('remove', 4)],)), [2, '9/2', '49/2'])
check('regression 4', solve(*([('add', -5), ('remove', -5), ('add', 9)],)), [1, '9', '0'])
check('regression 5', solve(*([],)), [0, '0', '0'])
check('regression 6', solve(*([('add', 2), ('add', 2), ('remove', 2)],)), [1, '2', '0'])
check('regression 7', solve(*([('add', 0), ('add', 4), ('add', 9), ('add', -1), ('remove', 0), ('remove', 9)],)), [2, '3/2', '25/2'])
check('regression 8', solve(*([('add', 3), ('add', 8)],)), [2, '11/2', '25/2'])
check('regression 9', solve(*([('add', 1), ('add', 6), ('add', 9), ('remove', 1)],)), [2, '15/2', '9/2'])
check("variable removal",solve([("add",0),("add",N),("add",3*N),("remove",N)]),[2,str(Fraction(3*N,2)),str(Fraction(9*N*N,2))])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events):
    n=0
    mean=m2=Fraction(0)
    for op,x in events:
        if op=="add":
            new_n=n+1
            delta=x-mean
            new_mean=mean+delta/new_n
            m2+=delta*(x-new_mean)
            mean=new_mean
            n=new_n
        else:
            new_n=n-1
            if new_n==0:
                n=0
                mean=m2=Fraction(0)
                continue
            new_mean=(new_n*mean-x)/new_n
            m2-=(x-mean)*(x-new_mean)
            mean=new_mean
            n=new_n
    return [n,str(mean),str(m2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('add', -3), ('add', 8), ('remove', -3)],)), [1, '8', '0'])
check('regression 2', solve(*([('add', 6), ('remove', 6)],)), [0, '0', '0'])
check('regression 3', solve(*([('add', 1), ('add', 4), ('add', 8), ('remove', 4)],)), [2, '9/2', '49/2'])
check('regression 4', solve(*([('add', -5), ('remove', -5), ('add', 9)],)), [1, '9', '0'])
check('regression 5', solve(*([],)), [0, '0', '0'])
check('regression 6', solve(*([('add', 2), ('add', 2), ('remove', 2)],)), [1, '2', '0'])
check('regression 7', solve(*([('add', 0), ('add', 4), ('add', 9), ('add', -1), ('remove', 0), ('remove', 9)],)), [2, '3/2', '25/2'])
check('regression 8', solve(*([('add', 3), ('add', 8)],)), [2, '11/2', '25/2'])
check('regression 9', solve(*([('add', 1), ('add', 6), ('add', 9), ('remove', 1)],)), [2, '15/2', '9/2'])
check("variable removal",solve([("add",0),("add",N),("add",3*N),("remove",N)]),[2,str(Fraction(3*N,2)),str(Fraction(9*N*N,2))])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

Process add/remove integer observations; each removal names one active equal-valued observation. Maintain [count, exact mean, unnormalised squared central scatter]. Empty state is [0,"0","0"].

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):
    n=0
    mean=m2=Fraction(0)
    for op,x in events:
        if op=="add":
            new_n=n+1
            delta=x-mean
            new_mean=mean+delta/new_n
            m2+=delta*(x-new_mean)
            mean=new_mean
            n=new_n
        else:
            new_n=n-1
            if new_n==0:
                n=0
                mean=m2=Fraction(0)
                continue
            new_mean=(n*mean-x)/new_n
            m2+=(x-mean)*(x-new_mean)
            mean=new_mean
            n=new_n
    return [n,str(mean),str(m2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('add', -3), ('add', 8), ('remove', -3)],)), [1, '8', '0'])
check('regression 2', solve(*([('add', 6), ('remove', 6)],)), [0, '0', '0'])
check('regression 3', solve(*([('add', 1), ('add', 4), ('add', 8), ('remove', 4)],)), [2, '9/2', '49/2'])
check('regression 4', solve(*([('add', -5), ('remove', -5), ('add', 9)],)), [1, '9', '0'])
check('regression 5', solve(*([],)), [0, '0', '0'])
check('regression 6', solve(*([('add', 2), ('add', 2), ('remove', 2)],)), [1, '2', '0'])
check('regression 7', solve(*([('add', 0), ('add', 4), ('add', 9), ('add', -1), ('remove', 0), ('remove', 9)],)), [2, '3/2', '25/2'])
check('regression 8', solve(*([('add', 3), ('add', 8)],)), [2, '11/2', '25/2'])
check('regression 9', solve(*([('add', 1), ('add', 6), ('add', 9), ('remove', 1)],)), [2, '15/2', '9/2'])
check("variable removal",solve([("add",0),("add",N),("add",3*N),("remove",N)]),[2,str(Fraction(3*N,2)),str(Fraction(9*N*N,2))])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events):
    n=0
    mean=m2=Fraction(0)
    for op,x in events:
        if op=="add":
            new_n=n+1
            delta=x-mean
            new_mean=mean+delta/new_n
            m2+=delta*(x-new_mean)
            mean=new_mean
            n=new_n
        else:
            new_n=n-1
            if new_n==0:
                n=0
                mean=m2=Fraction(0)
                continue
            new_mean=(n*mean-x)/new_n
            m2=abs(m2-(x-mean)*(x-new_mean))+(x-mean)**2
            mean=new_mean
            n=new_n
    return [n,str(mean),str(m2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('add', -3), ('add', 8), ('remove', -3)],)), [1, '8', '0'])
check('regression 2', solve(*([('add', 6), ('remove', 6)],)), [0, '0', '0'])
check('regression 3', solve(*([('add', 1), ('add', 4), ('add', 8), ('remove', 4)],)), [2, '9/2', '49/2'])
check('regression 4', solve(*([('add', -5), ('remove', -5), ('add', 9)],)), [1, '9', '0'])
check('regression 5', solve(*([],)), [0, '0', '0'])
check('regression 6', solve(*([('add', 2), ('add', 2), ('remove', 2)],)), [1, '2', '0'])
check('regression 7', solve(*([('add', 0), ('add', 4), ('add', 9), ('add', -1), ('remove', 0), ('remove', 9)],)), [2, '3/2', '25/2'])
check('regression 8', solve(*([('add', 3), ('add', 8)],)), [2, '11/2', '25/2'])
check('regression 9', solve(*([('add', 1), ('add', 6), ('add', 9), ('remove', 1)],)), [2, '15/2', '9/2'])
check("variable removal",solve([("add",0),("add",N),("add",3*N),("remove",N)]),[2,str(Fraction(3*N,2)),str(Fraction(9*N*N,2))])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

Process add/remove integer observations; each removal names one active equal-valued observation. Maintain [count, exact mean, unnormalised squared central scatter]. Empty state is [0,"0","0"].

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):
    n=0
    mean=m2=Fraction(0)
    for op,x in events:
        if op=="add":
            new_n=n+1
            delta=x-mean
            new_mean=mean+delta/new_n
            m2+=delta*(x-new_mean)
            mean=new_mean
            n=new_n
        else:
            new_n=n-1
            if new_n==0:
                n=0
                mean=m2=Fraction(0)
                continue
            new_mean=(n*mean-x)/new_n
            m2-=(x-mean)**2
            mean=new_mean
            n=new_n
    return [n,str(mean),str(m2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('add', -3), ('add', 8), ('remove', -3)],)), [1, '8', '0'])
check('regression 2', solve(*([('add', 6), ('remove', 6)],)), [0, '0', '0'])
check('regression 3', solve(*([('add', 1), ('add', 4), ('add', 8), ('remove', 4)],)), [2, '9/2', '49/2'])
check('regression 4', solve(*([('add', -5), ('remove', -5), ('add', 9)],)), [1, '9', '0'])
check('regression 5', solve(*([],)), [0, '0', '0'])
check('regression 6', solve(*([('add', 2), ('add', 2), ('remove', 2)],)), [1, '2', '0'])
check('regression 7', solve(*([('add', 0), ('add', 4), ('add', 9), ('add', -1), ('remove', 0), ('remove', 9)],)), [2, '3/2', '25/2'])
check('regression 8', solve(*([('add', 3), ('add', 8)],)), [2, '11/2', '25/2'])
check('regression 9', solve(*([('add', 1), ('add', 6), ('add', 9), ('remove', 1)],)), [2, '15/2', '9/2'])
check("variable removal",solve([("add",0),("add",N),("add",3*N),("remove",N)]),[2,str(Fraction(3*N,2)),str(Fraction(9*N*N,2))])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events):
    n=0
    mean=m2=Fraction(0)
    for op,x in events:
        if op=="add":
            new_n=n+1
            delta=x-mean
            new_mean=mean+delta/new_n
            m2+=delta*(x-new_mean)
            mean=new_mean
            n=new_n
        else:
            new_n=n-1
            if new_n==0:
                n=0
                mean=m2=Fraction(0)
                continue
            new_mean=(n*mean-x)/new_n
            m2-=(x-new_mean)**2
            mean=new_mean
            n=new_n
    return [n,str(mean),str(m2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('add', -3), ('add', 8), ('remove', -3)],)), [1, '8', '0'])
check('regression 2', solve(*([('add', 6), ('remove', 6)],)), [0, '0', '0'])
check('regression 3', solve(*([('add', 1), ('add', 4), ('add', 8), ('remove', 4)],)), [2, '9/2', '49/2'])
check('regression 4', solve(*([('add', -5), ('remove', -5), ('add', 9)],)), [1, '9', '0'])
check('regression 5', solve(*([],)), [0, '0', '0'])
check('regression 6', solve(*([('add', 2), ('add', 2), ('remove', 2)],)), [1, '2', '0'])
check('regression 7', solve(*([('add', 0), ('add', 4), ('add', 9), ('add', -1), ('remove', 0), ('remove', 9)],)), [2, '3/2', '25/2'])
check('regression 8', solve(*([('add', 3), ('add', 8)],)), [2, '11/2', '25/2'])
check('regression 9', solve(*([('add', 1), ('add', 6), ('add', 9), ('remove', 1)],)), [2, '15/2', '9/2'])
check("variable removal",solve([("add",0),("add",N),("add",3*N),("remove",N)]),[2,str(Fraction(3*N,2)),str(Fraction(9*N*N,2))])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

Process add/remove integer observations; each removal names one active equal-valued observation. Maintain [count, exact mean, unnormalised squared central scatter]. Empty state is [0,"0","0"].

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):
    n=0
    mean=m2=Fraction(0)
    for op,x in events:
        if op=="add":
            new_n=n+1
            delta=x-mean
            new_mean=mean+delta/new_n
            m2+=delta*(x-new_mean)
            mean=new_mean
            n=new_n
        else:
            new_n=n-1
            if new_n<=1:
                n=0
                mean=m2=Fraction(0)
                continue
            new_mean=(n*mean-x)/new_n
            m2-=(x-mean)*(x-new_mean)
            mean=new_mean
            n=new_n
    return [n,str(mean),str(m2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('add', -3), ('add', 8), ('remove', -3)],)), [1, '8', '0'])
check('regression 2', solve(*([('add', 6), ('remove', 6)],)), [0, '0', '0'])
check('regression 3', solve(*([('add', 1), ('add', 4), ('add', 8), ('remove', 4)],)), [2, '9/2', '49/2'])
check('regression 4', solve(*([('add', -5), ('remove', -5), ('add', 9)],)), [1, '9', '0'])
check('regression 5', solve(*([],)), [0, '0', '0'])
check('regression 6', solve(*([('add', 2), ('add', 2), ('remove', 2)],)), [1, '2', '0'])
check('regression 7', solve(*([('add', 0), ('add', 4), ('add', 9), ('add', -1), ('remove', 0), ('remove', 9)],)), [2, '3/2', '25/2'])
check('regression 8', solve(*([('add', 3), ('add', 8)],)), [2, '11/2', '25/2'])
check('regression 9', solve(*([('add', 1), ('add', 6), ('add', 9), ('remove', 1)],)), [2, '15/2', '9/2'])
check("variable removal",solve([("add",0),("add",N),("add",3*N),("remove",N)]),[2,str(Fraction(3*N,2)),str(Fraction(9*N*N,2))])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events):
    n=0
    mean=m2=Fraction(0)
    for op,x in events:
        if op=="add":
            new_n=n+1
            delta=x-mean
            new_mean=mean+delta/new_n
            m2+=delta*(x-new_mean)
            mean=new_mean
            n=new_n
        else:
            new_n=n-1
            if new_n==0:
                n=0
                m2=Fraction(0)
                continue
            new_mean=(n*mean-x)/new_n
            m2-=(x-mean)*(x-new_mean)
            mean=new_mean
            n=new_n
    return [n,str(mean),str(m2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('add', -3), ('add', 8), ('remove', -3)],)), [1, '8', '0'])
check('regression 2', solve(*([('add', 6), ('remove', 6)],)), [0, '0', '0'])
check('regression 3', solve(*([('add', 1), ('add', 4), ('add', 8), ('remove', 4)],)), [2, '9/2', '49/2'])
check('regression 4', solve(*([('add', -5), ('remove', -5), ('add', 9)],)), [1, '9', '0'])
check('regression 5', solve(*([],)), [0, '0', '0'])
check('regression 6', solve(*([('add', 2), ('add', 2), ('remove', 2)],)), [1, '2', '0'])
check('regression 7', solve(*([('add', 0), ('add', 4), ('add', 9), ('add', -1), ('remove', 0), ('remove', 9)],)), [2, '3/2', '25/2'])
check('regression 8', solve(*([('add', 3), ('add', 8)],)), [2, '11/2', '25/2'])
check('regression 9', solve(*([('add', 1), ('add', 6), ('add', 9), ('remove', 1)],)), [2, '15/2', '9/2'])
check("variable removal",solve([("add",0),("add",N),("add",3*N),("remove",N)]),[2,str(Fraction(3*N,2)),str(Fraction(9*N*N,2))])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

Process add/remove integer observations; each removal names one active equal-valued observation. Maintain [count, exact mean, unnormalised squared central scatter]. Empty state is [0,"0","0"].

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):
    n=0
    mean=m2=Fraction(0)
    for op,x in events:
        if op=="add":
            new_n=n+1
            delta=x-mean
            new_mean=mean+delta/new_n
            m2+=delta*(x-new_mean)
            mean=new_mean
            n=new_n
        else:
            new_n=n+1
            if new_n==0:
                n=0
                mean=m2=Fraction(0)
                continue
            new_mean=(n*mean-x)/new_n
            m2-=(x-mean)*(x-new_mean)
            mean=new_mean
            n=new_n
    return [n,str(mean),str(m2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('add', -3), ('add', 8), ('remove', -3)],)), [1, '8', '0'])
check('regression 2', solve(*([('add', 6), ('remove', 6)],)), [0, '0', '0'])
check('regression 3', solve(*([('add', 1), ('add', 4), ('add', 8), ('remove', 4)],)), [2, '9/2', '49/2'])
check('regression 4', solve(*([('add', -5), ('remove', -5), ('add', 9)],)), [1, '9', '0'])
check('regression 5', solve(*([],)), [0, '0', '0'])
check('regression 6', solve(*([('add', 2), ('add', 2), ('remove', 2)],)), [1, '2', '0'])
check('regression 7', solve(*([('add', 0), ('add', 4), ('add', 9), ('add', -1), ('remove', 0), ('remove', 9)],)), [2, '3/2', '25/2'])
check('regression 8', solve(*([('add', 3), ('add', 8)],)), [2, '11/2', '25/2'])
check('regression 9', solve(*([('add', 1), ('add', 6), ('add', 9), ('remove', 1)],)), [2, '15/2', '9/2'])
check("variable removal",solve([("add",0),("add",N),("add",3*N),("remove",N)]),[2,str(Fraction(3*N,2)),str(Fraction(9*N*N,2))])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events):
    n=0
    mean=m2=Fraction(0)
    for op,x in events:
        if op=="add":
            new_n=n+1
            delta=x-mean
            new_mean=mean+delta/new_n
            m2+=delta*(x-new_mean)
            mean=new_mean
            n=new_n
        else:
            new_n=n
            if new_n==0:
                n=0
                mean=m2=Fraction(0)
                continue
            new_mean=(n*mean-x)/new_n
            m2-=(x-mean)*(x-new_mean)
            mean=new_mean
            n=new_n
    return [n,str(mean),str(m2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('add', -3), ('add', 8), ('remove', -3)],)), [1, '8', '0'])
check('regression 2', solve(*([('add', 6), ('remove', 6)],)), [0, '0', '0'])
check('regression 3', solve(*([('add', 1), ('add', 4), ('add', 8), ('remove', 4)],)), [2, '9/2', '49/2'])
check('regression 4', solve(*([('add', -5), ('remove', -5), ('add', 9)],)), [1, '9', '0'])
check('regression 5', solve(*([],)), [0, '0', '0'])
check('regression 6', solve(*([('add', 2), ('add', 2), ('remove', 2)],)), [1, '2', '0'])
check('regression 7', solve(*([('add', 0), ('add', 4), ('add', 9), ('add', -1), ('remove', 0), ('remove', 9)],)), [2, '3/2', '25/2'])
check('regression 8', solve(*([('add', 3), ('add', 8)],)), [2, '11/2', '25/2'])
check('regression 9', solve(*([('add', 1), ('add', 6), ('add', 9), ('remove', 1)],)), [2, '15/2', '9/2'])
check("variable removal",solve([("add",0),("add",N),("add",3*N),("remove",N)]),[2,str(Fraction(3*N,2)),str(Fraction(9*N*N,2))])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

Process add/remove integer observations; each removal names one active equal-valued observation. Maintain [count, exact mean, unnormalised squared central scatter]. Empty state is [0,"0","0"].

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):
    n=0
    mean=m2=Fraction(0)
    for op,x in events:
        if op=="add":
            new_n=n+1
            delta=x-mean
            new_mean=mean+delta/new_n
            m2=delta*(x-new_mean)
            mean=new_mean
            n=new_n
        else:
            new_n=n-1
            if new_n==0:
                n=0
                mean=m2=Fraction(0)
                continue
            new_mean=(n*mean-x)/new_n
            m2-=(x-mean)*(x-new_mean)
            mean=new_mean
            n=new_n
    return [n,str(mean),str(m2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('add', -3), ('add', 8), ('remove', -3)],)), [1, '8', '0'])
check('regression 2', solve(*([('add', 6), ('remove', 6)],)), [0, '0', '0'])
check('regression 3', solve(*([('add', 1), ('add', 4), ('add', 8), ('remove', 4)],)), [2, '9/2', '49/2'])
check('regression 4', solve(*([('add', -5), ('remove', -5), ('add', 9)],)), [1, '9', '0'])
check('regression 5', solve(*([],)), [0, '0', '0'])
check('regression 6', solve(*([('add', 2), ('add', 2), ('remove', 2)],)), [1, '2', '0'])
check('regression 7', solve(*([('add', 0), ('add', 4), ('add', 9), ('add', -1), ('remove', 0), ('remove', 9)],)), [2, '3/2', '25/2'])
check('regression 8', solve(*([('add', 3), ('add', 8)],)), [2, '11/2', '25/2'])
check('regression 9', solve(*([('add', 1), ('add', 6), ('add', 9), ('remove', 1)],)), [2, '15/2', '9/2'])
check("variable removal",solve([("add",0),("add",N),("add",3*N),("remove",N)]),[2,str(Fraction(3*N,2)),str(Fraction(9*N*N,2))])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events):
    n=0
    mean=m2=Fraction(0)
    for op,x in events:
        if op=="add":
            new_n=n+1
            delta=x-mean
            new_mean=mean+delta/new_n
            m2=max(m2,delta*(x-new_mean))
            mean=new_mean
            n=new_n
        else:
            new_n=n-1
            if new_n==0:
                n=0
                mean=m2=Fraction(0)
                continue
            new_mean=(n*mean-x)/new_n
            m2-=(x-mean)*(x-new_mean)
            mean=new_mean
            n=new_n
    return [n,str(mean),str(m2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('add', -3), ('add', 8), ('remove', -3)],)), [1, '8', '0'])
check('regression 2', solve(*([('add', 6), ('remove', 6)],)), [0, '0', '0'])
check('regression 3', solve(*([('add', 1), ('add', 4), ('add', 8), ('remove', 4)],)), [2, '9/2', '49/2'])
check('regression 4', solve(*([('add', -5), ('remove', -5), ('add', 9)],)), [1, '9', '0'])
check('regression 5', solve(*([],)), [0, '0', '0'])
check('regression 6', solve(*([('add', 2), ('add', 2), ('remove', 2)],)), [1, '2', '0'])
check('regression 7', solve(*([('add', 0), ('add', 4), ('add', 9), ('add', -1), ('remove', 0), ('remove', 9)],)), [2, '3/2', '25/2'])
check('regression 8', solve(*([('add', 3), ('add', 8)],)), [2, '11/2', '25/2'])
check('regression 9', solve(*([('add', 1), ('add', 6), ('add', 9), ('remove', 1)],)), [2, '15/2', '9/2'])
check("variable removal",solve([("add",0),("add",N),("add",3*N),("remove",N)]),[2,str(Fraction(3*N,2)),str(Fraction(9*N*N,2))])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

Process add/remove integer observations; each removal names one active equal-valued observation. Maintain [count, exact mean, unnormalised squared central scatter]. Empty state is [0,"0","0"].

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):
    n=0
    mean=m2=Fraction(0)
    for op,x in events:
        if op=="add":
            new_n=n+1
            delta=x-mean
            new_mean=mean+delta/new_n
            m2+=delta*(x-new_mean)
            mean=new_mean
            n=new_n
        else:
            new_n=n-1
            if new_n==0:
                n=0
                mean=m2=Fraction(0)
                continue
            new_mean=(n*mean-x)/new_n
            m2=Fraction(0)
            mean=new_mean
            n=new_n
    return [n,str(mean),str(m2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('add', -3), ('add', 8), ('remove', -3)],)), [1, '8', '0'])
check('regression 2', solve(*([('add', 6), ('remove', 6)],)), [0, '0', '0'])
check('regression 3', solve(*([('add', 1), ('add', 4), ('add', 8), ('remove', 4)],)), [2, '9/2', '49/2'])
check('regression 4', solve(*([('add', -5), ('remove', -5), ('add', 9)],)), [1, '9', '0'])
check('regression 5', solve(*([],)), [0, '0', '0'])
check('regression 6', solve(*([('add', 2), ('add', 2), ('remove', 2)],)), [1, '2', '0'])
check('regression 7', solve(*([('add', 0), ('add', 4), ('add', 9), ('add', -1), ('remove', 0), ('remove', 9)],)), [2, '3/2', '25/2'])
check('regression 8', solve(*([('add', 3), ('add', 8)],)), [2, '11/2', '25/2'])
check('regression 9', solve(*([('add', 1), ('add', 6), ('add', 9), ('remove', 1)],)), [2, '15/2', '9/2'])
check("variable removal",solve([("add",0),("add",N),("add",3*N),("remove",N)]),[2,str(Fraction(3*N,2)),str(Fraction(9*N*N,2))])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events):
    n=0
    mean=m2=Fraction(0)
    for op,x in events:
        if op=="add":
            new_n=n+1
            delta=x-mean
            new_mean=mean+delta/new_n
            m2+=delta*(x-new_mean)
            mean=new_mean
            n=new_n
        else:
            new_n=n-1
            if new_n==0:
                n=0
                mean=m2=Fraction(0)
                continue
            new_mean=(n*mean-x)/new_n
            m2=abs(x-new_mean)
            mean=new_mean
            n=new_n
    return [n,str(mean),str(m2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('add', -3), ('add', 8), ('remove', -3)],)), [1, '8', '0'])
check('regression 2', solve(*([('add', 6), ('remove', 6)],)), [0, '0', '0'])
check('regression 3', solve(*([('add', 1), ('add', 4), ('add', 8), ('remove', 4)],)), [2, '9/2', '49/2'])
check('regression 4', solve(*([('add', -5), ('remove', -5), ('add', 9)],)), [1, '9', '0'])
check('regression 5', solve(*([],)), [0, '0', '0'])
check('regression 6', solve(*([('add', 2), ('add', 2), ('remove', 2)],)), [1, '2', '0'])
check('regression 7', solve(*([('add', 0), ('add', 4), ('add', 9), ('add', -1), ('remove', 0), ('remove', 9)],)), [2, '3/2', '25/2'])
check('regression 8', solve(*([('add', 3), ('add', 8)],)), [2, '11/2', '25/2'])
check('regression 9', solve(*([('add', 1), ('add', 6), ('add', 9), ('remove', 1)],)), [2, '15/2', '9/2'])
check("variable removal",solve([("add",0),("add",N),("add",3*N),("remove",N)]),[2,str(Fraction(3*N,2)),str(Fraction(9*N*N,2))])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

Process add/remove integer observations; each removal names one active equal-valued observation. Maintain [count, exact mean, unnormalised squared central scatter]. Empty state is [0,"0","0"].

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(xs, p, q):
    if not xs: return None
    alpha=Fraction(p,q)
    y=Fraction(0)
    for x in xs[1:]:
        y=alpha*x+(1-alpha)*y
    return str(y)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([2, 8, 4], 1, 2)), '9/2')
check('regression 2', solve(*([], 1, 2)), None)
check('regression 3', solve(*([7], 1, 3)), '7')
check('regression 4', solve(*([2, 9], 0, 1)), '2')
check('regression 5', solve(*([3, 8, 1], 1, 1)), '1')
check('regression 6', solve(*([-3, 5, -2], 2, 3)), '-5/9')
check('regression 7', solve(*([0, 0, 8], 1, 4)), '2')
check("variable impulse",solve([0,N,0],1,2),str(Fraction(N,4)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(xs, p, q):
    if not xs: return None
    alpha=Fraction(p,q)
    y=alpha*xs[0]
    for x in xs[1:]:
        y=alpha*x+(1-alpha)*y
    return str(y)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([2, 8, 4], 1, 2)), '9/2')
check('regression 2', solve(*([], 1, 2)), None)
check('regression 3', solve(*([7], 1, 3)), '7')
check('regression 4', solve(*([2, 9], 0, 1)), '2')
check('regression 5', solve(*([3, 8, 1], 1, 1)), '1')
check('regression 6', solve(*([-3, 5, -2], 2, 3)), '-5/9')
check('regression 7', solve(*([0, 0, 8], 1, 4)), '2')
check("variable impulse",solve([0,N,0],1,2),str(Fraction(N,4)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

For 0<=p<=q and q>0, initialise the recursive level to the first observation and update y=(p/q)*x+(1-p/q)*y for each later observation. Empty input returns None; 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(xs, p, q):
    if not xs: return None
    alpha=Fraction(p,q)
    y=Fraction(xs[0])
    for x in xs[1:]:
        y=alpha*x+alpha*y
    return str(y)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([2, 8, 4], 1, 2)), '9/2')
check('regression 2', solve(*([], 1, 2)), None)
check('regression 3', solve(*([7], 1, 3)), '7')
check('regression 4', solve(*([2, 9], 0, 1)), '2')
check('regression 5', solve(*([3, 8, 1], 1, 1)), '1')
check('regression 6', solve(*([-3, 5, -2], 2, 3)), '-5/9')
check('regression 7', solve(*([0, 0, 8], 1, 4)), '2')
check("variable impulse",solve([0,N,0],1,2),str(Fraction(N,4)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(xs, p, q):
    if not xs: return None
    alpha=Fraction(p,q)
    y=Fraction(xs[0])
    for x in xs[1:]:
        y=alpha*x+y
    return str(y)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([2, 8, 4], 1, 2)), '9/2')
check('regression 2', solve(*([], 1, 2)), None)
check('regression 3', solve(*([7], 1, 3)), '7')
check('regression 4', solve(*([2, 9], 0, 1)), '2')
check('regression 5', solve(*([3, 8, 1], 1, 1)), '1')
check('regression 6', solve(*([-3, 5, -2], 2, 3)), '-5/9')
check('regression 7', solve(*([0, 0, 8], 1, 4)), '2')
check("variable impulse",solve([0,N,0],1,2),str(Fraction(N,4)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

For 0<=p<=q and q>0, initialise the recursive level to the first observation and update y=(p/q)*x+(1-p/q)*y for each later observation. Empty input returns None; 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(xs, p, q):
    if not xs: return None
    alpha=Fraction(p,q)
    y=Fraction(xs[0])
    for x in xs[1:]:
        y=(1-alpha)*x+alpha*y
    return str(y)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([2, 8, 4], 1, 2)), '9/2')
check('regression 2', solve(*([], 1, 2)), None)
check('regression 3', solve(*([7], 1, 3)), '7')
check('regression 4', solve(*([2, 9], 0, 1)), '2')
check('regression 5', solve(*([3, 8, 1], 1, 1)), '1')
check('regression 6', solve(*([-3, 5, -2], 2, 3)), '-5/9')
check('regression 7', solve(*([0, 0, 8], 1, 4)), '2')
check("variable impulse",solve([0,N,0],1,2),str(Fraction(N,4)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(xs, p, q):
    if not xs: return None
    alpha=Fraction(p,q)
    y=Fraction(xs[0])
    for x in xs[1:]:
        y=alpha*(x+y)
    return str(y)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([2, 8, 4], 1, 2)), '9/2')
check('regression 2', solve(*([], 1, 2)), None)
check('regression 3', solve(*([7], 1, 3)), '7')
check('regression 4', solve(*([2, 9], 0, 1)), '2')
check('regression 5', solve(*([3, 8, 1], 1, 1)), '1')
check('regression 6', solve(*([-3, 5, -2], 2, 3)), '-5/9')
check('regression 7', solve(*([0, 0, 8], 1, 4)), '2')
check("variable impulse",solve([0,N,0],1,2),str(Fraction(N,4)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

For 0<=p<=q and q>0, initialise the recursive level to the first observation and update y=(p/q)*x+(1-p/q)*y for each later observation. Empty input returns None; 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(xs, p, q):
    if not xs: return None
    alpha=Fraction(p,q)
    y=Fraction(xs[0])
    for x in xs[1:]:
        y=alpha*x+(1-alpha)*xs[0]
    return str(y)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([2, 8, 4], 1, 2)), '9/2')
check('regression 2', solve(*([], 1, 2)), None)
check('regression 3', solve(*([7], 1, 3)), '7')
check('regression 4', solve(*([2, 9], 0, 1)), '2')
check('regression 5', solve(*([3, 8, 1], 1, 1)), '1')
check('regression 6', solve(*([-3, 5, -2], 2, 3)), '-5/9')
check('regression 7', solve(*([0, 0, 8], 1, 4)), '2')
check("variable impulse",solve([0,N,0],1,2),str(Fraction(N,4)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(xs, p, q):
    if not xs: return None
    alpha=Fraction(p,q)
    y=Fraction(xs[0])
    for x in xs[1:]:
        y=alpha*x+(1-alpha)*xs[-1]
    return str(y)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([2, 8, 4], 1, 2)), '9/2')
check('regression 2', solve(*([], 1, 2)), None)
check('regression 3', solve(*([7], 1, 3)), '7')
check('regression 4', solve(*([2, 9], 0, 1)), '2')
check('regression 5', solve(*([3, 8, 1], 1, 1)), '1')
check('regression 6', solve(*([-3, 5, -2], 2, 3)), '-5/9')
check('regression 7', solve(*([0, 0, 8], 1, 4)), '2')
check("variable impulse",solve([0,N,0],1,2),str(Fraction(N,4)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

For 0<=p<=q and q>0, initialise the recursive level to the first observation and update y=(p/q)*x+(1-p/q)*y for each later observation. Empty input returns None; 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(xs, p, q):
    if not xs: return None
    alpha=Fraction(p,q)
    y=Fraction(xs[0])
    for x in xs[1:]:
        y=alpha*(alpha*x+(1-alpha)*y)
    return str(y)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([2, 8, 4], 1, 2)), '9/2')
check('regression 2', solve(*([], 1, 2)), None)
check('regression 3', solve(*([7], 1, 3)), '7')
check('regression 4', solve(*([2, 9], 0, 1)), '2')
check('regression 5', solve(*([3, 8, 1], 1, 1)), '1')
check('regression 6', solve(*([-3, 5, -2], 2, 3)), '-5/9')
check('regression 7', solve(*([0, 0, 8], 1, 4)), '2')
check("variable impulse",solve([0,N,0],1,2),str(Fraction(N,4)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(xs, p, q):
    if not xs: return None
    alpha=Fraction(p,q)
    y=Fraction(xs[0])
    for x in xs[1:]:
        y=(alpha*x+(1-alpha)*y)/(1+alpha)
    return str(y)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([2, 8, 4], 1, 2)), '9/2')
check('regression 2', solve(*([], 1, 2)), None)
check('regression 3', solve(*([7], 1, 3)), '7')
check('regression 4', solve(*([2, 9], 0, 1)), '2')
check('regression 5', solve(*([3, 8, 1], 1, 1)), '1')
check('regression 6', solve(*([-3, 5, -2], 2, 3)), '-5/9')
check('regression 7', solve(*([0, 0, 8], 1, 4)), '2')
check("variable impulse",solve([0,N,0],1,2),str(Fraction(N,4)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

For 0<=p<=q and q>0, initialise the recursive level to the first observation and update y=(p/q)*x+(1-p/q)*y for each later observation. Empty input returns None; 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(xs, p, q):
    if not xs: return None
    alpha=Fraction(p,q)
    y=Fraction(xs[0])
    for x in reversed(xs[1:]):
        y=alpha*x+(1-alpha)*y
    return str(y)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([2, 8, 4], 1, 2)), '9/2')
check('regression 2', solve(*([], 1, 2)), None)
check('regression 3', solve(*([7], 1, 3)), '7')
check('regression 4', solve(*([2, 9], 0, 1)), '2')
check('regression 5', solve(*([3, 8, 1], 1, 1)), '1')
check('regression 6', solve(*([-3, 5, -2], 2, 3)), '-5/9')
check('regression 7', solve(*([0, 0, 8], 1, 4)), '2')
check("variable impulse",solve([0,N,0],1,2),str(Fraction(N,4)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(xs, p, q):
    if not xs: return None
    alpha=Fraction(p,q)
    y=Fraction(xs[0])
    for x in sorted(xs[1:]):
        y=alpha*x+(1-alpha)*y
    return str(y)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([2, 8, 4], 1, 2)), '9/2')
check('regression 2', solve(*([], 1, 2)), None)
check('regression 3', solve(*([7], 1, 3)), '7')
check('regression 4', solve(*([2, 9], 0, 1)), '2')
check('regression 5', solve(*([3, 8, 1], 1, 1)), '1')
check('regression 6', solve(*([-3, 5, -2], 2, 3)), '-5/9')
check('regression 7', solve(*([0, 0, 8], 1, 4)), '2')
check("variable impulse",solve([0,N,0],1,2),str(Fraction(N,4)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

For 0<=p<=q and q>0, initialise the recursive level to the first observation and update y=(p/q)*x+(1-p/q)*y for each later observation. Empty input returns None; 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(xs, p, q):
    if not xs: return None
    alpha=p//q
    y=Fraction(xs[0])
    for x in xs[1:]:
        y=alpha*x+(1-alpha)*y
    return str(y)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([2, 8, 4], 1, 2)), '9/2')
check('regression 2', solve(*([], 1, 2)), None)
check('regression 3', solve(*([7], 1, 3)), '7')
check('regression 4', solve(*([2, 9], 0, 1)), '2')
check('regression 5', solve(*([3, 8, 1], 1, 1)), '1')
check('regression 6', solve(*([-3, 5, -2], 2, 3)), '-5/9')
check('regression 7', solve(*([0, 0, 8], 1, 4)), '2')
check("variable impulse",solve([0,N,0],1,2),str(Fraction(N,4)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(xs, p, q):
    if not xs: return None
    alpha=round(Fraction(p,q))
    y=Fraction(xs[0])
    for x in xs[1:]:
        y=alpha*x+(1-alpha)*y
    return str(y)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([2, 8, 4], 1, 2)), '9/2')
check('regression 2', solve(*([], 1, 2)), None)
check('regression 3', solve(*([7], 1, 3)), '7')
check('regression 4', solve(*([2, 9], 0, 1)), '2')
check('regression 5', solve(*([3, 8, 1], 1, 1)), '1')
check('regression 6', solve(*([-3, 5, -2], 2, 3)), '-5/9')
check('regression 7', solve(*([0, 0, 8], 1, 4)), '2')
check("variable impulse",solve([0,N,0],1,2),str(Fraction(N,4)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

For 0<=p<=q and q>0, initialise the recursive level to the first observation and update y=(p/q)*x+(1-p/q)*y for each later observation. Empty input returns None; 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(xs, p, q):
    if not xs: return None
    alpha=Fraction(p,q)
    y=Fraction(xs[0])
    for x in xs[1:]:
        y=Fraction(int(alpha*x+(1-alpha)*y))
    return str(y)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([2, 8, 4], 1, 2)), '9/2')
check('regression 2', solve(*([], 1, 2)), None)
check('regression 3', solve(*([7], 1, 3)), '7')
check('regression 4', solve(*([2, 9], 0, 1)), '2')
check('regression 5', solve(*([3, 8, 1], 1, 1)), '1')
check('regression 6', solve(*([-3, 5, -2], 2, 3)), '-5/9')
check('regression 7', solve(*([0, 0, 8], 1, 4)), '2')
check("variable impulse",solve([0,N,0],1,2),str(Fraction(N,4)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(xs, p, q):
    if not xs: return None
    alpha=Fraction(p,q)
    y=Fraction(xs[0])
    for x in xs[1:]:
        y=Fraction(round(alpha*x+(1-alpha)*y))
    return str(y)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([2, 8, 4], 1, 2)), '9/2')
check('regression 2', solve(*([], 1, 2)), None)
check('regression 3', solve(*([7], 1, 3)), '7')
check('regression 4', solve(*([2, 9], 0, 1)), '2')
check('regression 5', solve(*([3, 8, 1], 1, 1)), '1')
check('regression 6', solve(*([-3, 5, -2], 2, 3)), '-5/9')
check('regression 7', solve(*([0, 0, 8], 1, 4)), '2')
check("variable impulse",solve([0,N,0],1,2),str(Fraction(N,4)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

For 0<=p<=q and q>0, initialise the recursive level to the first observation and update y=(p/q)*x+(1-p/q)*y for each later observation. Empty input returns None; 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(xs, p, q):
    if not xs: return None
    alpha=Fraction(p,q)
    y=Fraction(xs[0])
    for x in xs[1:-1]:
        y=alpha*x+(1-alpha)*y
    return str(y)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([2, 8, 4], 1, 2)), '9/2')
check('regression 2', solve(*([], 1, 2)), None)
check('regression 3', solve(*([7], 1, 3)), '7')
check('regression 4', solve(*([2, 9], 0, 1)), '2')
check('regression 5', solve(*([3, 8, 1], 1, 1)), '1')
check('regression 6', solve(*([-3, 5, -2], 2, 3)), '-5/9')
check('regression 7', solve(*([0, 0, 8], 1, 4)), '2')
check("variable impulse",solve([0,N,0],1,2),str(Fraction(N,4)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(xs, p, q):
    if not xs: return None
    alpha=Fraction(p,q)
    y=Fraction(xs[0])
    for x in xs[2:]:
        y=alpha*x+(1-alpha)*y
    return str(y)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([2, 8, 4], 1, 2)), '9/2')
check('regression 2', solve(*([], 1, 2)), None)
check('regression 3', solve(*([7], 1, 3)), '7')
check('regression 4', solve(*([2, 9], 0, 1)), '2')
check('regression 5', solve(*([3, 8, 1], 1, 1)), '1')
check('regression 6', solve(*([-3, 5, -2], 2, 3)), '-5/9')
check('regression 7', solve(*([0, 0, 8], 1, 4)), '2')
check("variable impulse",solve([0,N,0],1,2),str(Fraction(N,4)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

For 0<=p<=q and q>0, initialise the recursive level to the first observation and update y=(p/q)*x+(1-p/q)*y for each later observation. Empty input returns None; 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(xs, p, q):
    if not xs: return None
    alpha=Fraction(p,q)
    y=Fraction(xs[0])
    for x in xs[1:]:
        y=alpha*x+(1-alpha)*y
    return str(sum(alpha*(1-alpha)**(len(xs)-1-i)*x for i,x in enumerate(xs))/(1-(1-alpha)**len(xs))) if alpha else str(Fraction(sum(xs),len(xs)))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([2, 8, 4], 1, 2)), '9/2')
check('regression 2', solve(*([], 1, 2)), None)
check('regression 3', solve(*([7], 1, 3)), '7')
check('regression 4', solve(*([2, 9], 0, 1)), '2')
check('regression 5', solve(*([3, 8, 1], 1, 1)), '1')
check('regression 6', solve(*([-3, 5, -2], 2, 3)), '-5/9')
check('regression 7', solve(*([0, 0, 8], 1, 4)), '2')
check("variable impulse",solve([0,N,0],1,2),str(Fraction(N,4)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(xs, p, q):
    if not xs: return None
    alpha=Fraction(p,q)
    y=Fraction(xs[0])
    for x in xs[1:]:
        y=alpha*x+(1-alpha)*y
    return str(Fraction(sum(xs),len(xs)))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([2, 8, 4], 1, 2)), '9/2')
check('regression 2', solve(*([], 1, 2)), None)
check('regression 3', solve(*([7], 1, 3)), '7')
check('regression 4', solve(*([2, 9], 0, 1)), '2')
check('regression 5', solve(*([3, 8, 1], 1, 1)), '1')
check('regression 6', solve(*([-3, 5, -2], 2, 3)), '-5/9')
check('regression 7', solve(*([0, 0, 8], 1, 4)), '2')
check("variable impulse",solve([0,N,0],1,2),str(Fraction(N,4)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

For 0<=p<=q and q>0, initialise the recursive level to the first observation and update y=(p/q)*x+(1-p/q)*y for each later observation. Empty input returns None; 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 enumerate(v for t,v in events):
        if t>now: continue
        out+=Fraction(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 sorted(events,reverse=True):
        t=now
        if t>now: continue
        out+=Fraction(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)
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(value,now-t+1)
    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-min([now]+[u for u,v in events])))
    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(value,2**(now-max([u for u,v in events if u<=now] or [now])))
    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)
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-1: continue
        out+=Fraction(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:
        t=min(t,now)
        out+=Fraction(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: t=now-1
        out+=Fraction(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 dict(events).items():
        if t>now: continue
        out+=Fraction(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 set(events):
        if t>now: continue
        out+=Fraction(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)
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(round(Fraction(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+1))
    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(value,2**max(0,now-t-1))
    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