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):
    magnitude=1
    negative=zero=0
    for op,x in events:
        if op=="add":
            if x==0: zero+=1
            else:
                magnitude*=x
                negative+=int(x<0)
        else:
            if x==0: zero-=1
            else:
                magnitude//=abs(x)
                negative-=int(x<0)
    return 0 if zero else (-magnitude if negative%2 else magnitude)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('add', 0), ('add', 0)],)), 0)
check('regression 2', solve(*([('add', 0), ('add', -3)],)), 0)
check('regression 3', solve(*([('add', -1), ('add', -2), ('add', -3)],)), -6)
check('regression 4', solve(*([('add', 2), ('add', 0), ('add', -3), ('remove', 0)],)), -6)
check('regression 5', solve(*([('add', 0), ('add', 0), ('remove', 0)],)), 0)
check('regression 6', solve(*([],)), 1)
check('regression 7', solve(*([('add', -2), ('add', -3), ('remove', -2)],)), -3)
check('regression 8', solve(*([('add', 3), ('add', 3), ('remove', 3)],)), 3)
check('regression 9', solve(*([('add', -1), ('remove', -1)],)), 1)
check('regression 10', solve(*([('add', -2), ('add', 5), ('add', -3)],)), 30)
check("variable zero removal",solve([("add",N),("add",0),("add",-2),("remove",0)]),-2*N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events):
    magnitude=1
    negative=zero=0
    for op,x in events:
        if op=="add":
            if x==0: zero+=1
            else:
                magnitude*=max(1,x)
                negative+=int(x<0)
        else:
            if x==0: zero-=1
            else:
                magnitude//=abs(x)
                negative-=int(x<0)
    return 0 if zero else (-magnitude if negative%2 else magnitude)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('add', 0), ('add', 0)],)), 0)
check('regression 2', solve(*([('add', 0), ('add', -3)],)), 0)
check('regression 3', solve(*([('add', -1), ('add', -2), ('add', -3)],)), -6)
check('regression 4', solve(*([('add', 2), ('add', 0), ('add', -3), ('remove', 0)],)), -6)
check('regression 5', solve(*([('add', 0), ('add', 0), ('remove', 0)],)), 0)
check('regression 6', solve(*([],)), 1)
check('regression 7', solve(*([('add', -2), ('add', -3), ('remove', -2)],)), -3)
check('regression 8', solve(*([('add', 3), ('add', 3), ('remove', 3)],)), 3)
check('regression 9', solve(*([('add', -1), ('remove', -1)],)), 1)
check('regression 10', solve(*([('add', -2), ('add', 5), ('add', -3)],)), 30)
check("variable zero removal",solve([("add",N),("add",0),("add",-2),("remove",0)]),-2*N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

Process add/remove integer factors; each removal removes one currently present equal factor. Return the exact product of active factors with empty product one. Preserve zero multiplicity and signed parity while zero factors temporarily hide the nonzero product.

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):
    magnitude=0
    negative=zero=0
    for op,x in events:
        if op=="add":
            if x==0: zero+=1
            else:
                magnitude*=abs(x)
                negative+=int(x<0)
        else:
            if x==0: zero-=1
            else:
                magnitude//=abs(x)
                negative-=int(x<0)
    return 0 if zero else (-magnitude if negative%2 else magnitude)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('add', 0), ('add', 0)],)), 0)
check('regression 2', solve(*([('add', 0), ('add', -3)],)), 0)
check('regression 3', solve(*([('add', -1), ('add', -2), ('add', -3)],)), -6)
check('regression 4', solve(*([('add', 2), ('add', 0), ('add', -3), ('remove', 0)],)), -6)
check('regression 5', solve(*([('add', 0), ('add', 0), ('remove', 0)],)), 0)
check('regression 6', solve(*([],)), 1)
check('regression 7', solve(*([('add', -2), ('add', -3), ('remove', -2)],)), -3)
check('regression 8', solve(*([('add', 3), ('add', 3), ('remove', 3)],)), 3)
check('regression 9', solve(*([('add', -1), ('remove', -1)],)), 1)
check('regression 10', solve(*([('add', -2), ('add', 5), ('add', -3)],)), 30)
check("variable zero removal",solve([("add",N),("add",0),("add",-2),("remove",0)]),-2*N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events):
    magnitude=-1
    negative=zero=0
    for op,x in events:
        if op=="add":
            if x==0: zero+=1
            else:
                magnitude*=abs(x)
                negative+=int(x<0)
        else:
            if x==0: zero-=1
            else:
                magnitude//=abs(x)
                negative-=int(x<0)
    return 0 if zero else (-magnitude if negative%2 else magnitude)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('add', 0), ('add', 0)],)), 0)
check('regression 2', solve(*([('add', 0), ('add', -3)],)), 0)
check('regression 3', solve(*([('add', -1), ('add', -2), ('add', -3)],)), -6)
check('regression 4', solve(*([('add', 2), ('add', 0), ('add', -3), ('remove', 0)],)), -6)
check('regression 5', solve(*([('add', 0), ('add', 0), ('remove', 0)],)), 0)
check('regression 6', solve(*([],)), 1)
check('regression 7', solve(*([('add', -2), ('add', -3), ('remove', -2)],)), -3)
check('regression 8', solve(*([('add', 3), ('add', 3), ('remove', 3)],)), 3)
check('regression 9', solve(*([('add', -1), ('remove', -1)],)), 1)
check('regression 10', solve(*([('add', -2), ('add', 5), ('add', -3)],)), 30)
check("variable zero removal",solve([("add",N),("add",0),("add",-2),("remove",0)]),-2*N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

Process add/remove integer factors; each removal removes one currently present equal factor. Return the exact product of active factors with empty product one. Preserve zero multiplicity and signed parity while zero factors temporarily hide the nonzero product.

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):
    magnitude=1
    negative=zero=0
    for op,x in events:
        if op=="add":
            if x==0: zero+=1
            else:
                magnitude*=abs(x)
                negative+=int(x<0)
        else:
            if x==0: zero-=1
            else:
                magnitude//=abs(x)
                negative-=int(x<0)
    return -magnitude if negative%2 else (0 if zero else magnitude)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('add', 0), ('add', 0)],)), 0)
check('regression 2', solve(*([('add', 0), ('add', -3)],)), 0)
check('regression 3', solve(*([('add', -1), ('add', -2), ('add', -3)],)), -6)
check('regression 4', solve(*([('add', 2), ('add', 0), ('add', -3), ('remove', 0)],)), -6)
check('regression 5', solve(*([('add', 0), ('add', 0), ('remove', 0)],)), 0)
check('regression 6', solve(*([],)), 1)
check('regression 7', solve(*([('add', -2), ('add', -3), ('remove', -2)],)), -3)
check('regression 8', solve(*([('add', 3), ('add', 3), ('remove', 3)],)), 3)
check('regression 9', solve(*([('add', -1), ('remove', -1)],)), 1)
check('regression 10', solve(*([('add', -2), ('add', 5), ('add', -3)],)), 30)
check("variable zero removal",solve([("add",N),("add",0),("add",-2),("remove",0)]),-2*N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events):
    magnitude=1
    negative=zero=0
    for op,x in events:
        if op=="add":
            if x==0: zero+=1
            else:
                magnitude*=abs(x)
                negative+=int(x<0)
        else:
            if x==0: zero-=1
            else:
                magnitude//=abs(x)
                negative-=int(x<0)
    return 0 if zero and not negative else (-magnitude if negative%2 else magnitude)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('add', 0), ('add', 0)],)), 0)
check('regression 2', solve(*([('add', 0), ('add', -3)],)), 0)
check('regression 3', solve(*([('add', -1), ('add', -2), ('add', -3)],)), -6)
check('regression 4', solve(*([('add', 2), ('add', 0), ('add', -3), ('remove', 0)],)), -6)
check('regression 5', solve(*([('add', 0), ('add', 0), ('remove', 0)],)), 0)
check('regression 6', solve(*([],)), 1)
check('regression 7', solve(*([('add', -2), ('add', -3), ('remove', -2)],)), -3)
check('regression 8', solve(*([('add', 3), ('add', 3), ('remove', 3)],)), 3)
check('regression 9', solve(*([('add', -1), ('remove', -1)],)), 1)
check('regression 10', solve(*([('add', -2), ('add', 5), ('add', -3)],)), 30)
check("variable zero removal",solve([("add",N),("add",0),("add",-2),("remove",0)]),-2*N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

Process add/remove integer factors; each removal removes one currently present equal factor. Return the exact product of active factors with empty product one. Preserve zero multiplicity and signed parity while zero factors temporarily hide the nonzero product.

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):
    magnitude=1
    negative=zero=0
    for op,x in events:
        if op=="add":
            if x==0: zero+=1
            else:
                magnitude=abs(x)
                negative+=int(x<0)
        else:
            if x==0: zero-=1
            else:
                magnitude//=abs(x)
                negative-=int(x<0)
    return 0 if zero else (-magnitude if negative%2 else magnitude)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('add', 0), ('add', 0)],)), 0)
check('regression 2', solve(*([('add', 0), ('add', -3)],)), 0)
check('regression 3', solve(*([('add', -1), ('add', -2), ('add', -3)],)), -6)
check('regression 4', solve(*([('add', 2), ('add', 0), ('add', -3), ('remove', 0)],)), -6)
check('regression 5', solve(*([('add', 0), ('add', 0), ('remove', 0)],)), 0)
check('regression 6', solve(*([],)), 1)
check('regression 7', solve(*([('add', -2), ('add', -3), ('remove', -2)],)), -3)
check('regression 8', solve(*([('add', 3), ('add', 3), ('remove', 3)],)), 3)
check('regression 9', solve(*([('add', -1), ('remove', -1)],)), 1)
check('regression 10', solve(*([('add', -2), ('add', 5), ('add', -3)],)), 30)
check("variable zero removal",solve([("add",N),("add",0),("add",-2),("remove",0)]),-2*N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events):
    magnitude=1
    negative=zero=0
    for op,x in events:
        if op=="add":
            if x==0: zero+=1
            else:
                magnitude=max(magnitude,abs(x))
                negative+=int(x<0)
        else:
            if x==0: zero-=1
            else:
                magnitude//=abs(x)
                negative-=int(x<0)
    return 0 if zero else (-magnitude if negative%2 else magnitude)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('add', 0), ('add', 0)],)), 0)
check('regression 2', solve(*([('add', 0), ('add', -3)],)), 0)
check('regression 3', solve(*([('add', -1), ('add', -2), ('add', -3)],)), -6)
check('regression 4', solve(*([('add', 2), ('add', 0), ('add', -3), ('remove', 0)],)), -6)
check('regression 5', solve(*([('add', 0), ('add', 0), ('remove', 0)],)), 0)
check('regression 6', solve(*([],)), 1)
check('regression 7', solve(*([('add', -2), ('add', -3), ('remove', -2)],)), -3)
check('regression 8', solve(*([('add', 3), ('add', 3), ('remove', 3)],)), 3)
check('regression 9', solve(*([('add', -1), ('remove', -1)],)), 1)
check('regression 10', solve(*([('add', -2), ('add', 5), ('add', -3)],)), 30)
check("variable zero removal",solve([("add",N),("add",0),("add",-2),("remove",0)]),-2*N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

Process add/remove integer factors; each removal removes one currently present equal factor. Return the exact product of active factors with empty product one. Preserve zero multiplicity and signed parity while zero factors temporarily hide the nonzero product.

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(blocks):
    total=0
    last=None
    for block in blocks:
        if not block: continue
        total+=sum(a*b for a,b in zip(block,block[1:]))
        if False: total+=last*block[0]
        last=block[-1]
    return total
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[1, 2], [3, 4]],)), 20)
check('regression 2', solve(*([[2], [], [-3], [5]],)), -21)
check('regression 3', solve(*([],)), 0)
check('regression 4', solve(*([[0, 4], [3, 0]],)), 12)
check('regression 5', solve(*([[-2, -1], [3, -4, 5]],)), -33)
check('regression 6', solve(*([[], [7], []],)), 0)
check('regression 7', solve(*([[2, 3, 4]],)), 18)
check("variable interblock product",solve([[N],[N+1]]),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(blocks):
    total=0
    last=None
    for block in blocks:
        if not block: continue
        total+=sum(a*b for a,b in zip(block,block[1:]))
        if last is not None: total+=last+block[0]
        last=block[-1]
    return total
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[1, 2], [3, 4]],)), 20)
check('regression 2', solve(*([[2], [], [-3], [5]],)), -21)
check('regression 3', solve(*([],)), 0)
check('regression 4', solve(*([[0, 4], [3, 0]],)), 12)
check('regression 5', solve(*([[-2, -1], [3, -4, 5]],)), -33)
check('regression 6', solve(*([[], [7], []],)), 0)
check('regression 7', solve(*([[2, 3, 4]],)), 18)
check("variable interblock product",solve([[N],[N+1]]),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.

Concatenate ordered integer blocks logically and sum products of neighboring observations. Empty blocks are identity; there is exactly one cross-boundary product between consecutive nonempty blocks.

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(blocks):
    total=0
    last=None
    for block in blocks:
        if not block: continue
        total+=sum(a*b for a,b in zip(block,block[1:]))
        if last is not None: total+=last*block[-1]
        last=block[-1]
    return total
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[1, 2], [3, 4]],)), 20)
check('regression 2', solve(*([[2], [], [-3], [5]],)), -21)
check('regression 3', solve(*([],)), 0)
check('regression 4', solve(*([[0, 4], [3, 0]],)), 12)
check('regression 5', solve(*([[-2, -1], [3, -4, 5]],)), -33)
check('regression 6', solve(*([[], [7], []],)), 0)
check('regression 7', solve(*([[2, 3, 4]],)), 18)
check("variable interblock product",solve([[N],[N+1]]),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(blocks):
    total=0
    last=None
    for block in blocks:
        if not block: continue
        total+=sum(a*b for a,b in zip(block,block[1:]))
        if last is not None: total+=last*sum(block)
        last=block[-1]
    return total
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[1, 2], [3, 4]],)), 20)
check('regression 2', solve(*([[2], [], [-3], [5]],)), -21)
check('regression 3', solve(*([],)), 0)
check('regression 4', solve(*([[0, 4], [3, 0]],)), 12)
check('regression 5', solve(*([[-2, -1], [3, -4, 5]],)), -33)
check('regression 6', solve(*([[], [7], []],)), 0)
check('regression 7', solve(*([[2, 3, 4]],)), 18)
check("variable interblock product",solve([[N],[N+1]]),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.

Concatenate ordered integer blocks logically and sum products of neighboring observations. Empty blocks are identity; there is exactly one cross-boundary product between consecutive nonempty blocks.

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(blocks):
    total=0
    last=None
    for block in blocks:
        if not block: continue
        total+=sum(a*b for a,b in zip(block,block[1:]))
        if last is not None: total+=last*block[0]
        last=block[0]
    return total
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[1, 2], [3, 4]],)), 20)
check('regression 2', solve(*([[2], [], [-3], [5]],)), -21)
check('regression 3', solve(*([],)), 0)
check('regression 4', solve(*([[0, 4], [3, 0]],)), 12)
check('regression 5', solve(*([[-2, -1], [3, -4, 5]],)), -33)
check('regression 6', solve(*([[], [7], []],)), 0)
check('regression 7', solve(*([[2, 3, 4]],)), 18)
check("variable interblock product",solve([[N],[N+1]]),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(blocks):
    total=0
    last=None
    for block in blocks:
        if not block: continue
        total+=sum(a*b for a,b in zip(block,block[1:]))
        if last is not None: total+=last*block[0]
        last=sum(block)
    return total
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[1, 2], [3, 4]],)), 20)
check('regression 2', solve(*([[2], [], [-3], [5]],)), -21)
check('regression 3', solve(*([],)), 0)
check('regression 4', solve(*([[0, 4], [3, 0]],)), 12)
check('regression 5', solve(*([[-2, -1], [3, -4, 5]],)), -33)
check('regression 6', solve(*([[], [7], []],)), 0)
check('regression 7', solve(*([[2, 3, 4]],)), 18)
check("variable interblock product",solve([[N],[N+1]]),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.

Concatenate ordered integer blocks logically and sum products of neighboring observations. Empty blocks are identity; there is exactly one cross-boundary product between consecutive nonempty blocks.

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(blocks):
    total=0
    last=None
    for block in blocks:
        if not block:
            last=None
            continue
        total+=sum(a*b for a,b in zip(block,block[1:]))
        if last is not None: total+=last*block[0]
        last=block[-1]
    return total
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[1, 2], [3, 4]],)), 20)
check('regression 2', solve(*([[2], [], [-3], [5]],)), -21)
check('regression 3', solve(*([],)), 0)
check('regression 4', solve(*([[0, 4], [3, 0]],)), 12)
check('regression 5', solve(*([[-2, -1], [3, -4, 5]],)), -33)
check('regression 6', solve(*([[], [7], []],)), 0)
check('regression 7', solve(*([[2, 3, 4]],)), 18)
check("variable interblock product",solve([[N],[N+1]]),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(blocks):
    total=0
    last=None
    for block in blocks:
        if not block:
            last=0
            continue
        total+=sum(a*b for a,b in zip(block,block[1:]))
        if last is not None: total+=last*block[0]
        last=block[-1]
    return total
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[1, 2], [3, 4]],)), 20)
check('regression 2', solve(*([[2], [], [-3], [5]],)), -21)
check('regression 3', solve(*([],)), 0)
check('regression 4', solve(*([[0, 4], [3, 0]],)), 12)
check('regression 5', solve(*([[-2, -1], [3, -4, 5]],)), -33)
check('regression 6', solve(*([[], [7], []],)), 0)
check('regression 7', solve(*([[2, 3, 4]],)), 18)
check("variable interblock product",solve([[N],[N+1]]),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.

Concatenate ordered integer blocks logically and sum products of neighboring observations. Empty blocks are identity; there is exactly one cross-boundary product between consecutive nonempty blocks.

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(blocks):
    total=0
    last=None
    for block in blocks:
        if len(block)<2: continue
        total+=sum(a*b for a,b in zip(block,block[1:]))
        if last is not None: total+=last*block[0]
        last=block[-1]
    return total
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[1, 2], [3, 4]],)), 20)
check('regression 2', solve(*([[2], [], [-3], [5]],)), -21)
check('regression 3', solve(*([],)), 0)
check('regression 4', solve(*([[0, 4], [3, 0]],)), 12)
check('regression 5', solve(*([[-2, -1], [3, -4, 5]],)), -33)
check('regression 6', solve(*([[], [7], []],)), 0)
check('regression 7', solve(*([[2, 3, 4]],)), 18)
check("variable interblock product",solve([[N],[N+1]]),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(blocks):
    total=0
    last=None
    for block in blocks:
        if not block: continue
        if len(block)==1:
            last=block[0]
            continue
        total+=sum(a*b for a,b in zip(block,block[1:]))
        if last is not None: total+=last*block[0]
        last=block[-1]
    return total
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[1, 2], [3, 4]],)), 20)
check('regression 2', solve(*([[2], [], [-3], [5]],)), -21)
check('regression 3', solve(*([],)), 0)
check('regression 4', solve(*([[0, 4], [3, 0]],)), 12)
check('regression 5', solve(*([[-2, -1], [3, -4, 5]],)), -33)
check('regression 6', solve(*([[], [7], []],)), 0)
check('regression 7', solve(*([[2, 3, 4]],)), 18)
check("variable interblock product",solve([[N],[N+1]]),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.

Concatenate ordered integer blocks logically and sum products of neighboring observations. Empty blocks are identity; there is exactly one cross-boundary product between consecutive nonempty blocks.

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(blocks):
    total=0
    last=None
    for block in blocks:
        if not block: continue
        total+=sum(a*b for a,b in zip(block,block))
        if last is not None: total+=last*block[0]
        last=block[-1]
    return total
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[1, 2], [3, 4]],)), 20)
check('regression 2', solve(*([[2], [], [-3], [5]],)), -21)
check('regression 3', solve(*([],)), 0)
check('regression 4', solve(*([[0, 4], [3, 0]],)), 12)
check('regression 5', solve(*([[-2, -1], [3, -4, 5]],)), -33)
check('regression 6', solve(*([[], [7], []],)), 0)
check('regression 7', solve(*([[2, 3, 4]],)), 18)
check("variable interblock product",solve([[N],[N+1]]),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(blocks):
    total=0
    last=None
    for block in blocks:
        if not block: continue
        total+=sum(a*b for a,b in zip(block,block[2:]))
        if last is not None: total+=last*block[0]
        last=block[-1]
    return total
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[1, 2], [3, 4]],)), 20)
check('regression 2', solve(*([[2], [], [-3], [5]],)), -21)
check('regression 3', solve(*([],)), 0)
check('regression 4', solve(*([[0, 4], [3, 0]],)), 12)
check('regression 5', solve(*([[-2, -1], [3, -4, 5]],)), -33)
check('regression 6', solve(*([[], [7], []],)), 0)
check('regression 7', solve(*([[2, 3, 4]],)), 18)
check("variable interblock product",solve([[N],[N+1]]),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.

Concatenate ordered integer blocks logically and sum products of neighboring observations. Empty blocks are identity; there is exactly one cross-boundary product between consecutive nonempty blocks.

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(blocks):
    total=0
    last=None
    for block in blocks:
        if not block: continue
        total+=sum(a*b for a,b in zip(block,block[1:]))
        if last is not None: total+=2*last*block[0]
        last=block[-1]
    return total
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[1, 2], [3, 4]],)), 20)
check('regression 2', solve(*([[2], [], [-3], [5]],)), -21)
check('regression 3', solve(*([],)), 0)
check('regression 4', solve(*([[0, 4], [3, 0]],)), 12)
check('regression 5', solve(*([[-2, -1], [3, -4, 5]],)), -33)
check('regression 6', solve(*([[], [7], []],)), 0)
check('regression 7', solve(*([[2, 3, 4]],)), 18)
check("variable interblock product",solve([[N],[N+1]]),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(blocks):
    total=0
    last=None
    for block in blocks:
        if not block: continue
        total+=sum(a*b for a,b in zip(block,block[1:]))
        if last is not None: total+=last*block[0]+block[0]*block[-1]
        last=block[-1]
    return total
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[1, 2], [3, 4]],)), 20)
check('regression 2', solve(*([[2], [], [-3], [5]],)), -21)
check('regression 3', solve(*([],)), 0)
check('regression 4', solve(*([[0, 4], [3, 0]],)), 12)
check('regression 5', solve(*([[-2, -1], [3, -4, 5]],)), -33)
check('regression 6', solve(*([[], [7], []],)), 0)
check('regression 7', solve(*([[2, 3, 4]],)), 18)
check("variable interblock product",solve([[N],[N+1]]),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.

Concatenate ordered integer blocks logically and sum products of neighboring observations. Empty blocks are identity; there is exactly one cross-boundary product between consecutive nonempty blocks.

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(blocks):
    total=0
    last=None
    for block in blocks:
        if not block: continue
        total=sum(a*b for a,b in zip(block,block[1:]))
        if last is not None: total+=last*block[0]
        last=block[-1]
    return total
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[1, 2], [3, 4]],)), 20)
check('regression 2', solve(*([[2], [], [-3], [5]],)), -21)
check('regression 3', solve(*([],)), 0)
check('regression 4', solve(*([[0, 4], [3, 0]],)), 12)
check('regression 5', solve(*([[-2, -1], [3, -4, 5]],)), -33)
check('regression 6', solve(*([[], [7], []],)), 0)
check('regression 7', solve(*([[2, 3, 4]],)), 18)
check("variable interblock product",solve([[N],[N+1]]),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(blocks):
    total=0
    last=None
    for block in blocks:
        if not block: continue
        total=max(total,sum(a*b for a,b in zip(block,block[1:])))
        if last is not None: total+=last*block[0]
        last=block[-1]
    return total
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[1, 2], [3, 4]],)), 20)
check('regression 2', solve(*([[2], [], [-3], [5]],)), -21)
check('regression 3', solve(*([],)), 0)
check('regression 4', solve(*([[0, 4], [3, 0]],)), 12)
check('regression 5', solve(*([[-2, -1], [3, -4, 5]],)), -33)
check('regression 6', solve(*([[], [7], []],)), 0)
check('regression 7', solve(*([[2, 3, 4]],)), 18)
check("variable interblock product",solve([[N],[N+1]]),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.

Concatenate ordered integer blocks logically and sum products of neighboring observations. Empty blocks are identity; there is exactly one cross-boundary product between consecutive nonempty blocks.

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(blocks):
    total=0
    last=None
    for block in blocks:
        if not block: continue
        total+=sum(a*b for a,b in zip(block,block[1:]+block[:1]))
        if last is not None: total+=last*block[0]
        last=block[-1]
    return total
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[1, 2], [3, 4]],)), 20)
check('regression 2', solve(*([[2], [], [-3], [5]],)), -21)
check('regression 3', solve(*([],)), 0)
check('regression 4', solve(*([[0, 4], [3, 0]],)), 12)
check('regression 5', solve(*([[-2, -1], [3, -4, 5]],)), -33)
check('regression 6', solve(*([[], [7], []],)), 0)
check('regression 7', solve(*([[2, 3, 4]],)), 18)
check("variable interblock product",solve([[N],[N+1]]),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(blocks):
    total=0
    last=None
    for block in blocks:
        if not block: continue
        total+=sum(a*b for a,b in zip(block,block[1:]+[1]))
        if last is not None: total+=last*block[0]
        last=block[-1]
    return total
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[1, 2], [3, 4]],)), 20)
check('regression 2', solve(*([[2], [], [-3], [5]],)), -21)
check('regression 3', solve(*([],)), 0)
check('regression 4', solve(*([[0, 4], [3, 0]],)), 12)
check('regression 5', solve(*([[-2, -1], [3, -4, 5]],)), -33)
check('regression 6', solve(*([[], [7], []],)), 0)
check('regression 7', solve(*([[2, 3, 4]],)), 18)
check("variable interblock product",solve([[N],[N+1]]),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.

Concatenate ordered integer blocks logically and sum products of neighboring observations. Empty blocks are identity; there is exactly one cross-boundary product between consecutive nonempty blocks.

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(blocks):
    total=0
    last=None
    for block in blocks:
        if not block: continue
        total+=sum(max(0,a*b) for a,b in zip(block,block[1:]))
        if last is not None: total+=last*block[0]
        last=block[-1]
    return total
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[1, 2], [3, 4]],)), 20)
check('regression 2', solve(*([[2], [], [-3], [5]],)), -21)
check('regression 3', solve(*([],)), 0)
check('regression 4', solve(*([[0, 4], [3, 0]],)), 12)
check('regression 5', solve(*([[-2, -1], [3, -4, 5]],)), -33)
check('regression 6', solve(*([[], [7], []],)), 0)
check('regression 7', solve(*([[2, 3, 4]],)), 18)
check("variable interblock product",solve([[N],[N+1]]),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(blocks):
    total=0
    last=None
    for block in blocks:
        if not block: continue
        total+=sum(abs(a*b) for a,b in zip(block,block[1:]))
        if last is not None: total+=last*block[0]
        last=block[-1]
    return total
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[1, 2], [3, 4]],)), 20)
check('regression 2', solve(*([[2], [], [-3], [5]],)), -21)
check('regression 3', solve(*([],)), 0)
check('regression 4', solve(*([[0, 4], [3, 0]],)), 12)
check('regression 5', solve(*([[-2, -1], [3, -4, 5]],)), -33)
check('regression 6', solve(*([[], [7], []],)), 0)
check('regression 7', solve(*([[2, 3, 4]],)), 18)
check("variable interblock product",solve([[N],[N+1]]),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.

Concatenate ordered integer blocks logically and sum products of neighboring observations. Empty blocks are identity; there is exactly one cross-boundary product between consecutive nonempty blocks.

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(bins):
    groups={}
    for pn,pd,positive,negative in bins:
        p=Fraction(pn,pd)
        old=groups.get(p,(0,0))
        groups[p]=(old[0]+positive,old[1]+negative)
    n=sum(a+b for a,b in groups.values())
    if not n: return None
    base=Fraction(sum(a for a,b in groups.values()),n)
    reliability=resolution=Fraction(0)
    for p,(a,b) in groups.items():
        k=a+b
        if not k: continue
        rate=Fraction(a,k)
        reliability+=Fraction(1,len(groups))*(p-rate)**2
        resolution+=Fraction(1,len(groups))*(rate-base)**2
    return [str(reliability),str(resolution),str(base*(1-base))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(1, 4, 1, 3), (3, 4, 3, 1)],)), ['0', '1/16', '1/4'])
check('regression 2', solve(*([(1, 2, 3, 1), (1, 2, 0, 2), (1, 1, 2, 0)],)), ['0', '3/64', '15/64'])
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([(0, 1, 0, 4), (1, 1, 4, 0)],)), ['0', '1/4', '1/4'])
check('regression 5', solve(*([(1, 3, 0, 0), (2, 3, 2, 3)],)), ['16/225', '0', '6/25'])
check('regression 6', solve(*([(1, 5, 4, 1), (4, 5, 1, 2)],)), ['23/75', '49/960', '15/64'])
check('regression 7', solve(*([(0, 1, 0, 2)],)), ['0', '0', '0'])
check("variable forecast count",solve([(0,1,0,N),(1,1,N,0)]),["0","1/4","1/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(bins):
    groups={}
    for pn,pd,positive,negative in bins:
        p=Fraction(pn,pd)
        old=groups.get(p,(0,0))
        groups[p]=(old[0]+positive,old[1]+negative)
    n=sum(a+b for a,b in groups.values())
    if not n: return None
    base=Fraction(sum(a for a,b in groups.values()),n)
    reliability=resolution=Fraction(0)
    for p,(a,b) in groups.items():
        k=a+b
        if not k: continue
        rate=Fraction(a,k)
        reliability+=Fraction(k,len(groups))*(p-rate)**2
        resolution+=Fraction(k,len(groups))*(rate-base)**2
    return [str(reliability),str(resolution),str(base*(1-base))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(1, 4, 1, 3), (3, 4, 3, 1)],)), ['0', '1/16', '1/4'])
check('regression 2', solve(*([(1, 2, 3, 1), (1, 2, 0, 2), (1, 1, 2, 0)],)), ['0', '3/64', '15/64'])
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([(0, 1, 0, 4), (1, 1, 4, 0)],)), ['0', '1/4', '1/4'])
check('regression 5', solve(*([(1, 3, 0, 0), (2, 3, 2, 3)],)), ['16/225', '0', '6/25'])
check('regression 6', solve(*([(1, 5, 4, 1), (4, 5, 1, 2)],)), ['23/75', '49/960', '15/64'])
check('regression 7', solve(*([(0, 1, 0, 2)],)), ['0', '0', '0'])
check("variable forecast count",solve([(0,1,0,N),(1,1,N,0)]),["0","1/4","1/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.

Each [forecast numerator, positive denominator, positive outcome count, negative outcome count] describes binary observations with forecast in [0,1]. Merge identical rational forecasts. Return exact [reliability,resolution,uncertainty] Brier decomposition components. Empty total returns None; zero-size groups contribute nothing.

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(bins):
    groups={}
    for pn,pd,positive,negative in bins:
        p=Fraction(pn,pd)
        old=groups.get(p,(0,0))
        groups[p]=(old[0]+positive,old[1]+negative)
    n=sum(a+b for a,b in groups.values())
    if not n: return None
    base=Fraction(sum(a for a,b in groups.values()),n)
    reliability=resolution=Fraction(0)
    for p,(a,b) in groups.items():
        k=a+b
        if not k: continue
        rate=Fraction(a,k)
        reliability+=Fraction(k,n)*(p-base)**2
        resolution+=Fraction(k,n)*(rate-base)**2
    return [str(reliability),str(resolution),str(base*(1-base))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(1, 4, 1, 3), (3, 4, 3, 1)],)), ['0', '1/16', '1/4'])
check('regression 2', solve(*([(1, 2, 3, 1), (1, 2, 0, 2), (1, 1, 2, 0)],)), ['0', '3/64', '15/64'])
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([(0, 1, 0, 4), (1, 1, 4, 0)],)), ['0', '1/4', '1/4'])
check('regression 5', solve(*([(1, 3, 0, 0), (2, 3, 2, 3)],)), ['16/225', '0', '6/25'])
check('regression 6', solve(*([(1, 5, 4, 1), (4, 5, 1, 2)],)), ['23/75', '49/960', '15/64'])
check('regression 7', solve(*([(0, 1, 0, 2)],)), ['0', '0', '0'])
check("variable forecast count",solve([(0,1,0,N),(1,1,N,0)]),["0","1/4","1/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(bins):
    groups={}
    for pn,pd,positive,negative in bins:
        p=Fraction(pn,pd)
        old=groups.get(p,(0,0))
        groups[p]=(old[0]+positive,old[1]+negative)
    n=sum(a+b for a,b in groups.values())
    if not n: return None
    base=Fraction(sum(a for a,b in groups.values()),n)
    reliability=resolution=Fraction(0)
    for p,(a,b) in groups.items():
        k=a+b
        if not k: continue
        rate=Fraction(a,k)
        reliability+=Fraction(k,n)*(rate-base)**2
        resolution+=Fraction(k,n)*(rate-base)**2
    return [str(reliability),str(resolution),str(base*(1-base))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(1, 4, 1, 3), (3, 4, 3, 1)],)), ['0', '1/16', '1/4'])
check('regression 2', solve(*([(1, 2, 3, 1), (1, 2, 0, 2), (1, 1, 2, 0)],)), ['0', '3/64', '15/64'])
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([(0, 1, 0, 4), (1, 1, 4, 0)],)), ['0', '1/4', '1/4'])
check('regression 5', solve(*([(1, 3, 0, 0), (2, 3, 2, 3)],)), ['16/225', '0', '6/25'])
check('regression 6', solve(*([(1, 5, 4, 1), (4, 5, 1, 2)],)), ['23/75', '49/960', '15/64'])
check('regression 7', solve(*([(0, 1, 0, 2)],)), ['0', '0', '0'])
check("variable forecast count",solve([(0,1,0,N),(1,1,N,0)]),["0","1/4","1/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.

Each [forecast numerator, positive denominator, positive outcome count, negative outcome count] describes binary observations with forecast in [0,1]. Merge identical rational forecasts. Return exact [reliability,resolution,uncertainty] Brier decomposition components. Empty total returns None; zero-size groups contribute nothing.

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(bins):
    groups={}
    for pn,pd,positive,negative in bins:
        p=Fraction(pn,pd)
        old=groups.get(p,(0,0))
        groups[p]=(old[0]+positive,old[1]+negative)
    n=sum(a+b for a,b in groups.values())
    if not n: return None
    base=Fraction(sum(a for a,b in groups.values()),n)
    reliability=resolution=Fraction(0)
    for p,(a,b) in groups.items():
        k=a+b
        if not k: continue
        rate=Fraction(a,k)
        reliability+=Fraction(k,n)*(p-rate)**2
        resolution+=Fraction(k,n)*(rate-p)**2
    return [str(reliability),str(resolution),str(base*(1-base))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(1, 4, 1, 3), (3, 4, 3, 1)],)), ['0', '1/16', '1/4'])
check('regression 2', solve(*([(1, 2, 3, 1), (1, 2, 0, 2), (1, 1, 2, 0)],)), ['0', '3/64', '15/64'])
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([(0, 1, 0, 4), (1, 1, 4, 0)],)), ['0', '1/4', '1/4'])
check('regression 5', solve(*([(1, 3, 0, 0), (2, 3, 2, 3)],)), ['16/225', '0', '6/25'])
check('regression 6', solve(*([(1, 5, 4, 1), (4, 5, 1, 2)],)), ['23/75', '49/960', '15/64'])
check('regression 7', solve(*([(0, 1, 0, 2)],)), ['0', '0', '0'])
check("variable forecast count",solve([(0,1,0,N),(1,1,N,0)]),["0","1/4","1/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(bins):
    groups={}
    for pn,pd,positive,negative in bins:
        p=Fraction(pn,pd)
        old=groups.get(p,(0,0))
        groups[p]=(old[0]+positive,old[1]+negative)
    n=sum(a+b for a,b in groups.values())
    if not n: return None
    base=Fraction(sum(a for a,b in groups.values()),n)
    reliability=resolution=Fraction(0)
    for p,(a,b) in groups.items():
        k=a+b
        if not k: continue
        rate=Fraction(a,k)
        reliability+=Fraction(k,n)*(p-rate)**2
        resolution+=Fraction(k,n)*(p-base)**2
    return [str(reliability),str(resolution),str(base*(1-base))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(1, 4, 1, 3), (3, 4, 3, 1)],)), ['0', '1/16', '1/4'])
check('regression 2', solve(*([(1, 2, 3, 1), (1, 2, 0, 2), (1, 1, 2, 0)],)), ['0', '3/64', '15/64'])
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([(0, 1, 0, 4), (1, 1, 4, 0)],)), ['0', '1/4', '1/4'])
check('regression 5', solve(*([(1, 3, 0, 0), (2, 3, 2, 3)],)), ['16/225', '0', '6/25'])
check('regression 6', solve(*([(1, 5, 4, 1), (4, 5, 1, 2)],)), ['23/75', '49/960', '15/64'])
check('regression 7', solve(*([(0, 1, 0, 2)],)), ['0', '0', '0'])
check("variable forecast count",solve([(0,1,0,N),(1,1,N,0)]),["0","1/4","1/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.

Each [forecast numerator, positive denominator, positive outcome count, negative outcome count] describes binary observations with forecast in [0,1]. Merge identical rational forecasts. Return exact [reliability,resolution,uncertainty] Brier decomposition components. Empty total returns None; zero-size groups contribute nothing.

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(bins):
    groups={}
    for pn,pd,positive,negative in bins:
        p=Fraction(pn,pd)
        old=groups.get(p,(0,0))
        groups[p]=(old[0]+positive,old[1]+negative)
    n=sum(a+b for a,b in groups.values())
    if not n: return None
    base=Fraction(sum(a for a,b in groups.values()),n)
    reliability=resolution=Fraction(0)
    for p,(a,b) in groups.items():
        k=a+b
        if not k: continue
        rate=Fraction(a,k)
        reliability+=Fraction(k,n)*(p-rate)
        resolution+=Fraction(k,n)*(rate-base)**2
    return [str(reliability),str(resolution),str(base*(1-base))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(1, 4, 1, 3), (3, 4, 3, 1)],)), ['0', '1/16', '1/4'])
check('regression 2', solve(*([(1, 2, 3, 1), (1, 2, 0, 2), (1, 1, 2, 0)],)), ['0', '3/64', '15/64'])
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([(0, 1, 0, 4), (1, 1, 4, 0)],)), ['0', '1/4', '1/4'])
check('regression 5', solve(*([(1, 3, 0, 0), (2, 3, 2, 3)],)), ['16/225', '0', '6/25'])
check('regression 6', solve(*([(1, 5, 4, 1), (4, 5, 1, 2)],)), ['23/75', '49/960', '15/64'])
check('regression 7', solve(*([(0, 1, 0, 2)],)), ['0', '0', '0'])
check("variable forecast count",solve([(0,1,0,N),(1,1,N,0)]),["0","1/4","1/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(bins):
    groups={}
    for pn,pd,positive,negative in bins:
        p=Fraction(pn,pd)
        old=groups.get(p,(0,0))
        groups[p]=(old[0]+positive,old[1]+negative)
    n=sum(a+b for a,b in groups.values())
    if not n: return None
    base=Fraction(sum(a for a,b in groups.values()),n)
    reliability=resolution=Fraction(0)
    for p,(a,b) in groups.items():
        k=a+b
        if not k: continue
        rate=Fraction(a,k)
        reliability+=Fraction(k,n)*abs(p-rate)
        resolution+=Fraction(k,n)*(rate-base)**2
    return [str(reliability),str(resolution),str(base*(1-base))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(1, 4, 1, 3), (3, 4, 3, 1)],)), ['0', '1/16', '1/4'])
check('regression 2', solve(*([(1, 2, 3, 1), (1, 2, 0, 2), (1, 1, 2, 0)],)), ['0', '3/64', '15/64'])
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([(0, 1, 0, 4), (1, 1, 4, 0)],)), ['0', '1/4', '1/4'])
check('regression 5', solve(*([(1, 3, 0, 0), (2, 3, 2, 3)],)), ['16/225', '0', '6/25'])
check('regression 6', solve(*([(1, 5, 4, 1), (4, 5, 1, 2)],)), ['23/75', '49/960', '15/64'])
check('regression 7', solve(*([(0, 1, 0, 2)],)), ['0', '0', '0'])
check("variable forecast count",solve([(0,1,0,N),(1,1,N,0)]),["0","1/4","1/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.

Each [forecast numerator, positive denominator, positive outcome count, negative outcome count] describes binary observations with forecast in [0,1]. Merge identical rational forecasts. Return exact [reliability,resolution,uncertainty] Brier decomposition components. Empty total returns None; zero-size groups contribute nothing.

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(bins):
    groups={}
    for pn,pd,positive,negative in bins:
        p=Fraction(pn,pd)
        old=groups.get(p,(0,0))
        groups[p]=(old[0]+positive,old[1]+negative)
    n=sum(a+b for a,b in groups.values())
    if not n: return None
    base=Fraction(sum(a for a,b in groups.values()),n)
    reliability=resolution=Fraction(0)
    for p,(a,b) in groups.items():
        k=a+b
        if not k: continue
        rate=Fraction(a,k)
        reliability+=Fraction(k,n)*(p-rate)**2
        resolution+=Fraction(k,n)*abs(rate-base)
    return [str(reliability),str(resolution),str(base*(1-base))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(1, 4, 1, 3), (3, 4, 3, 1)],)), ['0', '1/16', '1/4'])
check('regression 2', solve(*([(1, 2, 3, 1), (1, 2, 0, 2), (1, 1, 2, 0)],)), ['0', '3/64', '15/64'])
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([(0, 1, 0, 4), (1, 1, 4, 0)],)), ['0', '1/4', '1/4'])
check('regression 5', solve(*([(1, 3, 0, 0), (2, 3, 2, 3)],)), ['16/225', '0', '6/25'])
check('regression 6', solve(*([(1, 5, 4, 1), (4, 5, 1, 2)],)), ['23/75', '49/960', '15/64'])
check('regression 7', solve(*([(0, 1, 0, 2)],)), ['0', '0', '0'])
check("variable forecast count",solve([(0,1,0,N),(1,1,N,0)]),["0","1/4","1/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(bins):
    groups={}
    for pn,pd,positive,negative in bins:
        p=Fraction(pn,pd)
        old=groups.get(p,(0,0))
        groups[p]=(old[0]+positive,old[1]+negative)
    n=sum(a+b for a,b in groups.values())
    if not n: return None
    base=Fraction(sum(a for a,b in groups.values()),n)
    reliability=resolution=Fraction(0)
    for p,(a,b) in groups.items():
        k=a+b
        if not k: continue
        rate=Fraction(a,k)
        reliability+=Fraction(k,n)*(p-rate)**2
        resolution+=Fraction(k,n)*rate-base
    return [str(reliability),str(resolution),str(base*(1-base))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(1, 4, 1, 3), (3, 4, 3, 1)],)), ['0', '1/16', '1/4'])
check('regression 2', solve(*([(1, 2, 3, 1), (1, 2, 0, 2), (1, 1, 2, 0)],)), ['0', '3/64', '15/64'])
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([(0, 1, 0, 4), (1, 1, 4, 0)],)), ['0', '1/4', '1/4'])
check('regression 5', solve(*([(1, 3, 0, 0), (2, 3, 2, 3)],)), ['16/225', '0', '6/25'])
check('regression 6', solve(*([(1, 5, 4, 1), (4, 5, 1, 2)],)), ['23/75', '49/960', '15/64'])
check('regression 7', solve(*([(0, 1, 0, 2)],)), ['0', '0', '0'])
check("variable forecast count",solve([(0,1,0,N),(1,1,N,0)]),["0","1/4","1/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.

Each [forecast numerator, positive denominator, positive outcome count, negative outcome count] describes binary observations with forecast in [0,1]. Merge identical rational forecasts. Return exact [reliability,resolution,uncertainty] Brier decomposition components. Empty total returns None; zero-size groups contribute nothing.

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(bins):
    groups={}
    for pn,pd,positive,negative in bins:
        p=Fraction(pn,pd)
        old=groups.get(p,(0,0))
        groups[p]=(old[0]+positive,old[1]+negative)
    n=sum(a+b for a,b in groups.values())
    if not n: return None
    base=sum((Fraction(a,a+b) for a,b in groups.values() if a+b),Fraction(0))/max(1,sum(a+b>0 for a,b in groups.values()))
    reliability=resolution=Fraction(0)
    for p,(a,b) in groups.items():
        k=a+b
        if not k: continue
        rate=Fraction(a,k)
        reliability+=Fraction(k,n)*(p-rate)**2
        resolution+=Fraction(k,n)*(rate-base)**2
    return [str(reliability),str(resolution),str(base*(1-base))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(1, 4, 1, 3), (3, 4, 3, 1)],)), ['0', '1/16', '1/4'])
check('regression 2', solve(*([(1, 2, 3, 1), (1, 2, 0, 2), (1, 1, 2, 0)],)), ['0', '3/64', '15/64'])
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([(0, 1, 0, 4), (1, 1, 4, 0)],)), ['0', '1/4', '1/4'])
check('regression 5', solve(*([(1, 3, 0, 0), (2, 3, 2, 3)],)), ['16/225', '0', '6/25'])
check('regression 6', solve(*([(1, 5, 4, 1), (4, 5, 1, 2)],)), ['23/75', '49/960', '15/64'])
check('regression 7', solve(*([(0, 1, 0, 2)],)), ['0', '0', '0'])
check("variable forecast count",solve([(0,1,0,N),(1,1,N,0)]),["0","1/4","1/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(bins):
    groups={}
    for pn,pd,positive,negative in bins:
        p=Fraction(pn,pd)
        old=groups.get(p,(0,0))
        groups[p]=(old[0]+positive,old[1]+negative)
    n=sum(a+b for a,b in groups.values())
    if not n: return None
    base=Fraction(sum(a>0 for a,b in groups.values()),max(1,len(groups)))
    reliability=resolution=Fraction(0)
    for p,(a,b) in groups.items():
        k=a+b
        if not k: continue
        rate=Fraction(a,k)
        reliability+=Fraction(k,n)*(p-rate)**2
        resolution+=Fraction(k,n)*(rate-base)**2
    return [str(reliability),str(resolution),str(base*(1-base))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(1, 4, 1, 3), (3, 4, 3, 1)],)), ['0', '1/16', '1/4'])
check('regression 2', solve(*([(1, 2, 3, 1), (1, 2, 0, 2), (1, 1, 2, 0)],)), ['0', '3/64', '15/64'])
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([(0, 1, 0, 4), (1, 1, 4, 0)],)), ['0', '1/4', '1/4'])
check('regression 5', solve(*([(1, 3, 0, 0), (2, 3, 2, 3)],)), ['16/225', '0', '6/25'])
check('regression 6', solve(*([(1, 5, 4, 1), (4, 5, 1, 2)],)), ['23/75', '49/960', '15/64'])
check('regression 7', solve(*([(0, 1, 0, 2)],)), ['0', '0', '0'])
check("variable forecast count",solve([(0,1,0,N),(1,1,N,0)]),["0","1/4","1/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.

Each [forecast numerator, positive denominator, positive outcome count, negative outcome count] describes binary observations with forecast in [0,1]. Merge identical rational forecasts. Return exact [reliability,resolution,uncertainty] Brier decomposition components. Empty total returns None; zero-size groups contribute nothing.

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(bins):
    groups={}
    for pn,pd,positive,negative in bins:
        p=Fraction(pn,pd)
        old=groups.get(p,(0,0))
        groups[p]=(positive,negative)
    n=sum(a+b for a,b in groups.values())
    if not n: return None
    base=Fraction(sum(a for a,b in groups.values()),n)
    reliability=resolution=Fraction(0)
    for p,(a,b) in groups.items():
        k=a+b
        if not k: continue
        rate=Fraction(a,k)
        reliability+=Fraction(k,n)*(p-rate)**2
        resolution+=Fraction(k,n)*(rate-base)**2
    return [str(reliability),str(resolution),str(base*(1-base))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(1, 4, 1, 3), (3, 4, 3, 1)],)), ['0', '1/16', '1/4'])
check('regression 2', solve(*([(1, 2, 3, 1), (1, 2, 0, 2), (1, 1, 2, 0)],)), ['0', '3/64', '15/64'])
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([(0, 1, 0, 4), (1, 1, 4, 0)],)), ['0', '1/4', '1/4'])
check('regression 5', solve(*([(1, 3, 0, 0), (2, 3, 2, 3)],)), ['16/225', '0', '6/25'])
check('regression 6', solve(*([(1, 5, 4, 1), (4, 5, 1, 2)],)), ['23/75', '49/960', '15/64'])
check('regression 7', solve(*([(0, 1, 0, 2)],)), ['0', '0', '0'])
check("variable forecast count",solve([(0,1,0,N),(1,1,N,0)]),["0","1/4","1/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(bins):
    groups={}
    for pn,pd,positive,negative in bins:
        p=Fraction(pn,pd)
        old=groups.get(p,(0,0))
        groups[p]=(max(old[0],positive),max(old[1],negative))
    n=sum(a+b for a,b in groups.values())
    if not n: return None
    base=Fraction(sum(a for a,b in groups.values()),n)
    reliability=resolution=Fraction(0)
    for p,(a,b) in groups.items():
        k=a+b
        if not k: continue
        rate=Fraction(a,k)
        reliability+=Fraction(k,n)*(p-rate)**2
        resolution+=Fraction(k,n)*(rate-base)**2
    return [str(reliability),str(resolution),str(base*(1-base))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(1, 4, 1, 3), (3, 4, 3, 1)],)), ['0', '1/16', '1/4'])
check('regression 2', solve(*([(1, 2, 3, 1), (1, 2, 0, 2), (1, 1, 2, 0)],)), ['0', '3/64', '15/64'])
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([(0, 1, 0, 4), (1, 1, 4, 0)],)), ['0', '1/4', '1/4'])
check('regression 5', solve(*([(1, 3, 0, 0), (2, 3, 2, 3)],)), ['16/225', '0', '6/25'])
check('regression 6', solve(*([(1, 5, 4, 1), (4, 5, 1, 2)],)), ['23/75', '49/960', '15/64'])
check('regression 7', solve(*([(0, 1, 0, 2)],)), ['0', '0', '0'])
check("variable forecast count",solve([(0,1,0,N),(1,1,N,0)]),["0","1/4","1/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.

Each [forecast numerator, positive denominator, positive outcome count, negative outcome count] describes binary observations with forecast in [0,1]. Merge identical rational forecasts. Return exact [reliability,resolution,uncertainty] Brier decomposition components. Empty total returns None; zero-size groups contribute nothing.

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(bins):
    groups={}
    for pn,pd,positive,negative in bins:
        p=Fraction(pn,pd)
        old=groups.get(p,(0,0))
        groups[p]=(old[0]+positive,old[1]+negative)
    n=sum(a+b for a,b in groups.values())
    if not n: return None
    base=Fraction(sum(a for a,b in groups.values()),n)
    reliability=resolution=Fraction(0)
    for p,(a,b) in groups.items():
        k=a+b
        if not k: continue
        rate=Fraction(a,max(1,b))
        reliability+=Fraction(k,n)*(p-rate)**2
        resolution+=Fraction(k,n)*(rate-base)**2
    return [str(reliability),str(resolution),str(base*(1-base))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(1, 4, 1, 3), (3, 4, 3, 1)],)), ['0', '1/16', '1/4'])
check('regression 2', solve(*([(1, 2, 3, 1), (1, 2, 0, 2), (1, 1, 2, 0)],)), ['0', '3/64', '15/64'])
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([(0, 1, 0, 4), (1, 1, 4, 0)],)), ['0', '1/4', '1/4'])
check('regression 5', solve(*([(1, 3, 0, 0), (2, 3, 2, 3)],)), ['16/225', '0', '6/25'])
check('regression 6', solve(*([(1, 5, 4, 1), (4, 5, 1, 2)],)), ['23/75', '49/960', '15/64'])
check('regression 7', solve(*([(0, 1, 0, 2)],)), ['0', '0', '0'])
check("variable forecast count",solve([(0,1,0,N),(1,1,N,0)]),["0","1/4","1/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(bins):
    groups={}
    for pn,pd,positive,negative in bins:
        p=Fraction(pn,pd)
        old=groups.get(p,(0,0))
        groups[p]=(old[0]+positive,old[1]+negative)
    n=sum(a+b for a,b in groups.values())
    if not n: return None
    base=Fraction(sum(a for a,b in groups.values()),n)
    reliability=resolution=Fraction(0)
    for p,(a,b) in groups.items():
        k=a+b
        if not k: continue
        rate=Fraction(a,max(1,a))
        reliability+=Fraction(k,n)*(p-rate)**2
        resolution+=Fraction(k,n)*(rate-base)**2
    return [str(reliability),str(resolution),str(base*(1-base))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(1, 4, 1, 3), (3, 4, 3, 1)],)), ['0', '1/16', '1/4'])
check('regression 2', solve(*([(1, 2, 3, 1), (1, 2, 0, 2), (1, 1, 2, 0)],)), ['0', '3/64', '15/64'])
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([(0, 1, 0, 4), (1, 1, 4, 0)],)), ['0', '1/4', '1/4'])
check('regression 5', solve(*([(1, 3, 0, 0), (2, 3, 2, 3)],)), ['16/225', '0', '6/25'])
check('regression 6', solve(*([(1, 5, 4, 1), (4, 5, 1, 2)],)), ['23/75', '49/960', '15/64'])
check('regression 7', solve(*([(0, 1, 0, 2)],)), ['0', '0', '0'])
check("variable forecast count",solve([(0,1,0,N),(1,1,N,0)]),["0","1/4","1/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.

Each [forecast numerator, positive denominator, positive outcome count, negative outcome count] describes binary observations with forecast in [0,1]. Merge identical rational forecasts. Return exact [reliability,resolution,uncertainty] Brier decomposition components. Empty total returns None; zero-size groups contribute nothing.

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(bins):
    groups={}
    for pn,pd,positive,negative in bins:
        p=Fraction(pn,pd)
        old=groups.get(p,(0,0))
        groups[p]=(old[0]+positive,old[1]+negative)
    n=sum(a+b for a,b in groups.values())
    if not n: return None
    base=Fraction(sum(a for a,b in groups.values()),n)
    reliability=resolution=Fraction(0)
    for p,(a,b) in groups.items():
        k=a+b
        if not k: continue
        rate=Fraction(a,k)
        reliability+=Fraction(k,n)*(p-rate)**2
        resolution+=Fraction(k,n)*(rate-base)**2
    return [str(reliability),str(resolution),str(base*base)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(1, 4, 1, 3), (3, 4, 3, 1)],)), ['0', '1/16', '1/4'])
check('regression 2', solve(*([(1, 2, 3, 1), (1, 2, 0, 2), (1, 1, 2, 0)],)), ['0', '3/64', '15/64'])
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([(0, 1, 0, 4), (1, 1, 4, 0)],)), ['0', '1/4', '1/4'])
check('regression 5', solve(*([(1, 3, 0, 0), (2, 3, 2, 3)],)), ['16/225', '0', '6/25'])
check('regression 6', solve(*([(1, 5, 4, 1), (4, 5, 1, 2)],)), ['23/75', '49/960', '15/64'])
check('regression 7', solve(*([(0, 1, 0, 2)],)), ['0', '0', '0'])
check("variable forecast count",solve([(0,1,0,N),(1,1,N,0)]),["0","1/4","1/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(bins):
    groups={}
    for pn,pd,positive,negative in bins:
        p=Fraction(pn,pd)
        old=groups.get(p,(0,0))
        groups[p]=(old[0]+positive,old[1]+negative)
    n=sum(a+b for a,b in groups.values())
    if not n: return None
    base=Fraction(sum(a for a,b in groups.values()),n)
    reliability=resolution=Fraction(0)
    for p,(a,b) in groups.items():
        k=a+b
        if not k: continue
        rate=Fraction(a,k)
        reliability+=Fraction(k,n)*(p-rate)**2
        resolution+=Fraction(k,n)*(rate-base)**2
    return [str(reliability),str(resolution),str(1-base*base)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(1, 4, 1, 3), (3, 4, 3, 1)],)), ['0', '1/16', '1/4'])
check('regression 2', solve(*([(1, 2, 3, 1), (1, 2, 0, 2), (1, 1, 2, 0)],)), ['0', '3/64', '15/64'])
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([(0, 1, 0, 4), (1, 1, 4, 0)],)), ['0', '1/4', '1/4'])
check('regression 5', solve(*([(1, 3, 0, 0), (2, 3, 2, 3)],)), ['16/225', '0', '6/25'])
check('regression 6', solve(*([(1, 5, 4, 1), (4, 5, 1, 2)],)), ['23/75', '49/960', '15/64'])
check('regression 7', solve(*([(0, 1, 0, 2)],)), ['0', '0', '0'])
check("variable forecast count",solve([(0,1,0,N),(1,1,N,0)]),["0","1/4","1/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.

Each [forecast numerator, positive denominator, positive outcome count, negative outcome count] describes binary observations with forecast in [0,1]. Merge identical rational forecasts. Return exact [reliability,resolution,uncertainty] Brier decomposition components. Empty total returns None; zero-size groups contribute nothing.

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(bins):
    groups={}
    for pn,pd,positive,negative in bins:
        p=Fraction(pn,pd)
        old=groups.get(p,(0,0))
        groups[p]=(old[0]+positive,old[1]+negative)
    n=sum(a+b for a,b in groups.values())
    if not n: return None
    base=Fraction(sum(a for a,b in groups.values()),n)
    reliability=resolution=Fraction(0)
    for p,(a,b) in groups.items():
        k=a+b
        if not k: continue
        rate=Fraction(a,k)
        reliability+=Fraction(k,n)*(p-rate)**2
        resolution+=Fraction(k,n)*(rate-base)**2
    return [str(reliability),str(resolution),str(n*base*(1-base))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(1, 4, 1, 3), (3, 4, 3, 1)],)), ['0', '1/16', '1/4'])
check('regression 2', solve(*([(1, 2, 3, 1), (1, 2, 0, 2), (1, 1, 2, 0)],)), ['0', '3/64', '15/64'])
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([(0, 1, 0, 4), (1, 1, 4, 0)],)), ['0', '1/4', '1/4'])
check('regression 5', solve(*([(1, 3, 0, 0), (2, 3, 2, 3)],)), ['16/225', '0', '6/25'])
check('regression 6', solve(*([(1, 5, 4, 1), (4, 5, 1, 2)],)), ['23/75', '49/960', '15/64'])
check('regression 7', solve(*([(0, 1, 0, 2)],)), ['0', '0', '0'])
check("variable forecast count",solve([(0,1,0,N),(1,1,N,0)]),["0","1/4","1/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(bins):
    groups={}
    for pn,pd,positive,negative in bins:
        p=Fraction(pn,pd)
        old=groups.get(p,(0,0))
        groups[p]=(old[0]+positive,old[1]+negative)
    n=sum(a+b for a,b in groups.values())
    if not n: return None
    base=Fraction(sum(a for a,b in groups.values()),n)
    reliability=resolution=Fraction(0)
    for p,(a,b) in groups.items():
        k=a+b
        if not k: continue
        rate=Fraction(a,k)
        reliability+=Fraction(k,n)*(p-rate)**2
        resolution+=Fraction(k,n)*(rate-base)**2
    return [str(reliability),str(resolution),str(base*(1-base)/n)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(1, 4, 1, 3), (3, 4, 3, 1)],)), ['0', '1/16', '1/4'])
check('regression 2', solve(*([(1, 2, 3, 1), (1, 2, 0, 2), (1, 1, 2, 0)],)), ['0', '3/64', '15/64'])
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([(0, 1, 0, 4), (1, 1, 4, 0)],)), ['0', '1/4', '1/4'])
check('regression 5', solve(*([(1, 3, 0, 0), (2, 3, 2, 3)],)), ['16/225', '0', '6/25'])
check('regression 6', solve(*([(1, 5, 4, 1), (4, 5, 1, 2)],)), ['23/75', '49/960', '15/64'])
check('regression 7', solve(*([(0, 1, 0, 2)],)), ['0', '0', '0'])
check("variable forecast count",solve([(0,1,0,N),(1,1,N,0)]),["0","1/4","1/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.

Each [forecast numerator, positive denominator, positive outcome count, negative outcome count] describes binary observations with forecast in [0,1]. Merge identical rational forecasts. Return exact [reliability,resolution,uncertainty] Brier decomposition components. Empty total returns None; zero-size groups contribute nothing.

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(bins):
    groups={}
    for pn,pd,positive,negative in bins:
        p=Fraction(pn,pd)
        old=groups.get(p,(0,0))
        groups[p]=(old[0]+positive+1,old[1]+negative+1)
    n=sum(a+b for a,b in groups.values())
    if not n: return None
    base=Fraction(sum(a for a,b in groups.values()),n)
    reliability=resolution=Fraction(0)
    for p,(a,b) in groups.items():
        k=a+b
        if not k: continue
        rate=Fraction(a,k)
        reliability+=Fraction(k,n)*(p-rate)**2
        resolution+=Fraction(k,n)*(rate-base)**2
    return [str(reliability),str(resolution),str(base*(1-base))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(1, 4, 1, 3), (3, 4, 3, 1)],)), ['0', '1/16', '1/4'])
check('regression 2', solve(*([(1, 2, 3, 1), (1, 2, 0, 2), (1, 1, 2, 0)],)), ['0', '3/64', '15/64'])
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([(0, 1, 0, 4), (1, 1, 4, 0)],)), ['0', '1/4', '1/4'])
check('regression 5', solve(*([(1, 3, 0, 0), (2, 3, 2, 3)],)), ['16/225', '0', '6/25'])
check('regression 6', solve(*([(1, 5, 4, 1), (4, 5, 1, 2)],)), ['23/75', '49/960', '15/64'])
check('regression 7', solve(*([(0, 1, 0, 2)],)), ['0', '0', '0'])
check("variable forecast count",solve([(0,1,0,N),(1,1,N,0)]),["0","1/4","1/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(bins):
    groups={}
    for pn,pd,positive,negative in bins:
        p=Fraction(pn,pd)
        old=groups.get(p,(0,0))
        groups[p]=(old[0]+max(1,positive),old[1]+max(1,negative))
    n=sum(a+b for a,b in groups.values())
    if not n: return None
    base=Fraction(sum(a for a,b in groups.values()),n)
    reliability=resolution=Fraction(0)
    for p,(a,b) in groups.items():
        k=a+b
        if not k: continue
        rate=Fraction(a,k)
        reliability+=Fraction(k,n)*(p-rate)**2
        resolution+=Fraction(k,n)*(rate-base)**2
    return [str(reliability),str(resolution),str(base*(1-base))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(1, 4, 1, 3), (3, 4, 3, 1)],)), ['0', '1/16', '1/4'])
check('regression 2', solve(*([(1, 2, 3, 1), (1, 2, 0, 2), (1, 1, 2, 0)],)), ['0', '3/64', '15/64'])
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([(0, 1, 0, 4), (1, 1, 4, 0)],)), ['0', '1/4', '1/4'])
check('regression 5', solve(*([(1, 3, 0, 0), (2, 3, 2, 3)],)), ['16/225', '0', '6/25'])
check('regression 6', solve(*([(1, 5, 4, 1), (4, 5, 1, 2)],)), ['23/75', '49/960', '15/64'])
check('regression 7', solve(*([(0, 1, 0, 2)],)), ['0', '0', '0'])
check("variable forecast count",solve([(0,1,0,N),(1,1,N,0)]),["0","1/4","1/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.

Each [forecast numerator, positive denominator, positive outcome count, negative outcome count] describes binary observations with forecast in [0,1]. Merge identical rational forecasts. Return exact [reliability,resolution,uncertainty] Brier decomposition components. Empty total returns None; zero-size groups contribute nothing.

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(bins):
    groups={}
    for pn,pd,positive,negative in bins:
        p=Fraction(pn//pd)
        old=groups.get(p,(0,0))
        groups[p]=(old[0]+positive,old[1]+negative)
    n=sum(a+b for a,b in groups.values())
    if not n: return None
    base=Fraction(sum(a for a,b in groups.values()),n)
    reliability=resolution=Fraction(0)
    for p,(a,b) in groups.items():
        k=a+b
        if not k: continue
        rate=Fraction(a,k)
        reliability+=Fraction(k,n)*(p-rate)**2
        resolution+=Fraction(k,n)*(rate-base)**2
    return [str(reliability),str(resolution),str(base*(1-base))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(1, 4, 1, 3), (3, 4, 3, 1)],)), ['0', '1/16', '1/4'])
check('regression 2', solve(*([(1, 2, 3, 1), (1, 2, 0, 2), (1, 1, 2, 0)],)), ['0', '3/64', '15/64'])
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([(0, 1, 0, 4), (1, 1, 4, 0)],)), ['0', '1/4', '1/4'])
check('regression 5', solve(*([(1, 3, 0, 0), (2, 3, 2, 3)],)), ['16/225', '0', '6/25'])
check('regression 6', solve(*([(1, 5, 4, 1), (4, 5, 1, 2)],)), ['23/75', '49/960', '15/64'])
check('regression 7', solve(*([(0, 1, 0, 2)],)), ['0', '0', '0'])
check("variable forecast count",solve([(0,1,0,N),(1,1,N,0)]),["0","1/4","1/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(bins):
    groups={}
    for pn,pd,positive,negative in bins:
        p=Fraction(round(Fraction(pn,pd)))
        old=groups.get(p,(0,0))
        groups[p]=(old[0]+positive,old[1]+negative)
    n=sum(a+b for a,b in groups.values())
    if not n: return None
    base=Fraction(sum(a for a,b in groups.values()),n)
    reliability=resolution=Fraction(0)
    for p,(a,b) in groups.items():
        k=a+b
        if not k: continue
        rate=Fraction(a,k)
        reliability+=Fraction(k,n)*(p-rate)**2
        resolution+=Fraction(k,n)*(rate-base)**2
    return [str(reliability),str(resolution),str(base*(1-base))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(1, 4, 1, 3), (3, 4, 3, 1)],)), ['0', '1/16', '1/4'])
check('regression 2', solve(*([(1, 2, 3, 1), (1, 2, 0, 2), (1, 1, 2, 0)],)), ['0', '3/64', '15/64'])
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([(0, 1, 0, 4), (1, 1, 4, 0)],)), ['0', '1/4', '1/4'])
check('regression 5', solve(*([(1, 3, 0, 0), (2, 3, 2, 3)],)), ['16/225', '0', '6/25'])
check('regression 6', solve(*([(1, 5, 4, 1), (4, 5, 1, 2)],)), ['23/75', '49/960', '15/64'])
check('regression 7', solve(*([(0, 1, 0, 2)],)), ['0', '0', '0'])
check("variable forecast count",solve([(0,1,0,N),(1,1,N,0)]),["0","1/4","1/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.

Each [forecast numerator, positive denominator, positive outcome count, negative outcome count] describes binary observations with forecast in [0,1]. Merge identical rational forecasts. Return exact [reliability,resolution,uncertainty] Brier decomposition components. Empty total returns None; zero-size groups contribute nothing.

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, width):
    out=[]
    for start in range(0,len(xs),width):
        bucket=xs[start:start+width]
        low=min(range(len(bucket)),key=lambda i:(bucket[i],i))
        high=max(range(len(bucket)),key=lambda i:(bucket[i],-i))
        for i in sorted(set([low,high]),key=lambda i:bucket[i]):
            out.append([start+i,bucket[i]])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([8, 1, 6, 2, 9, 3, 4], 3)), [[0, 8], [1, 1], [3, 2], [4, 9], [6, 4]])
check('regression 2', solve(*([], 2)), [])
check('regression 3', solve(*([3, 3, 3, 1, 1], 3)), [[0, 3], [3, 1]])
check('regression 4', solve(*([-4, -1, -8, 0], 2)), [[0, -4], [1, -1], [2, -8], [3, 0]])
check('regression 5', solve(*([9, 1, 5], 1)), [[0, 9], [1, 1], [2, 5]])
check('regression 6', solve(*([4, 2, 8, 3], 9)), [[1, 2], [2, 8]])
check('regression 7', solve(*([5, 5, 1, 1, 9, 9], 6)), [[2, 1], [4, 9]])
check("variable bucket amplitude",solve([N,0,2*N],3),[[1,0],[2,2*N]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(xs, width):
    out=[]
    for start in range(0,len(xs),width):
        bucket=xs[start:start+width]
        low=min(range(len(bucket)),key=lambda i:(bucket[i],i))
        high=max(range(len(bucket)),key=lambda i:(bucket[i],-i))
        for i in [low,high]:
            out.append([start+i,bucket[i]])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([8, 1, 6, 2, 9, 3, 4], 3)), [[0, 8], [1, 1], [3, 2], [4, 9], [6, 4]])
check('regression 2', solve(*([], 2)), [])
check('regression 3', solve(*([3, 3, 3, 1, 1], 3)), [[0, 3], [3, 1]])
check('regression 4', solve(*([-4, -1, -8, 0], 2)), [[0, -4], [1, -1], [2, -8], [3, 0]])
check('regression 5', solve(*([9, 1, 5], 1)), [[0, 9], [1, 1], [2, 5]])
check('regression 6', solve(*([4, 2, 8, 3], 9)), [[1, 2], [2, 8]])
check('regression 7', solve(*([5, 5, 1, 1, 9, 9], 6)), [[2, 1], [4, 9]])
check("variable bucket amplitude",solve([N,0,2*N],3),[[1,0],[2,2*N]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

For positive integer width, partition numeric observations into consecutive buckets including a final short bucket. Emit each bucket first-occurring minimum and first-occurring maximum once, in original observation order, as [global index,value]. Flat buckets emit one point.

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, width):
    out=[]
    for start in range(0,len(xs),width):
        bucket=xs[start:start+width]
        low=min(range(len(bucket)),key=lambda i:(bucket[i],-i))
        high=max(range(len(bucket)),key=lambda i:(bucket[i],-i))
        for i in sorted(set([low,high])):
            out.append([start+i,bucket[i]])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([8, 1, 6, 2, 9, 3, 4], 3)), [[0, 8], [1, 1], [3, 2], [4, 9], [6, 4]])
check('regression 2', solve(*([], 2)), [])
check('regression 3', solve(*([3, 3, 3, 1, 1], 3)), [[0, 3], [3, 1]])
check('regression 4', solve(*([-4, -1, -8, 0], 2)), [[0, -4], [1, -1], [2, -8], [3, 0]])
check('regression 5', solve(*([9, 1, 5], 1)), [[0, 9], [1, 1], [2, 5]])
check('regression 6', solve(*([4, 2, 8, 3], 9)), [[1, 2], [2, 8]])
check('regression 7', solve(*([5, 5, 1, 1, 9, 9], 6)), [[2, 1], [4, 9]])
check("variable bucket amplitude",solve([N,0,2*N],3),[[1,0],[2,2*N]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(xs, width):
    out=[]
    for start in range(0,len(xs),width):
        bucket=xs[start:start+width]
        low=min(range(len(bucket)),key=lambda i:(abs(bucket[i]),i))
        high=max(range(len(bucket)),key=lambda i:(bucket[i],-i))
        for i in sorted(set([low,high])):
            out.append([start+i,bucket[i]])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([8, 1, 6, 2, 9, 3, 4], 3)), [[0, 8], [1, 1], [3, 2], [4, 9], [6, 4]])
check('regression 2', solve(*([], 2)), [])
check('regression 3', solve(*([3, 3, 3, 1, 1], 3)), [[0, 3], [3, 1]])
check('regression 4', solve(*([-4, -1, -8, 0], 2)), [[0, -4], [1, -1], [2, -8], [3, 0]])
check('regression 5', solve(*([9, 1, 5], 1)), [[0, 9], [1, 1], [2, 5]])
check('regression 6', solve(*([4, 2, 8, 3], 9)), [[1, 2], [2, 8]])
check('regression 7', solve(*([5, 5, 1, 1, 9, 9], 6)), [[2, 1], [4, 9]])
check("variable bucket amplitude",solve([N,0,2*N],3),[[1,0],[2,2*N]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

For positive integer width, partition numeric observations into consecutive buckets including a final short bucket. Emit each bucket first-occurring minimum and first-occurring maximum once, in original observation order, as [global index,value]. Flat buckets emit one point.

split: open-access