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(rows):
    groups={}
    for label,error in rows:
        if error is None: continue
        groups.setdefault(label,[]).append(error)
    if not groups: return None
    means=[Fraction(sum(e*e for e in values),len(values)) for values in groups.values()]
    return str(Fraction(sum(e*e for values in groups.values() for e in values),sum(map(len,groups.values()))))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('a', 1), ('a', 2), ('b', 4)],)), '37/4')
check('regression 2', solve(*([('a', 1), ('a', 3), ('b', 4)],)), '21/2')
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([('a', None), ('b', None)],)), None)
check('regression 5', solve(*([('a', 0), ('a', 2), ('b', -3), ('b', 1)],)), '7/2')
check('regression 6', solve(*([('a', 1), ('b', 2), ('b', 2), ('b', 2)],)), '5/2')
check('regression 7', solve(*([('a', None), ('a', 2), ('b', 4)],)), '10')
check('regression 8', solve(*([('A', 1), ('a', 4), ('B', 2)],)), '7')
check("variable group balance",solve([("a",N),("a",-N),("b",2*N)]),str(Fraction(5*N*N,2)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(rows):
    groups={}
    for label,error in rows:
        if error is None: continue
        groups.setdefault(label,[]).append(error)
    if not groups: return None
    means=[Fraction(sum(e*e for e in values),len(values)) for values in groups.values()]
    return str(sum(means)/sum(map(len,groups.values())))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('a', 1), ('a', 2), ('b', 4)],)), '37/4')
check('regression 2', solve(*([('a', 1), ('a', 3), ('b', 4)],)), '21/2')
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([('a', None), ('b', None)],)), None)
check('regression 5', solve(*([('a', 0), ('a', 2), ('b', -3), ('b', 1)],)), '7/2')
check('regression 6', solve(*([('a', 1), ('b', 2), ('b', 2), ('b', 2)],)), '5/2')
check('regression 7', solve(*([('a', None), ('a', 2), ('b', 4)],)), '10')
check('regression 8', solve(*([('A', 1), ('a', 4), ('B', 2)],)), '7')
check("variable group balance",solve([("a",N),("a",-N),("b",2*N)]),str(Fraction(5*N*N,2)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

Rows [group label, integer residual or None] are reduced into mean squared residual per group, then arithmetic mean across observed groups. Missing residuals contribute neither count nor group presence; group labels are case-sensitive. Empty observed population returns None. Exact Fraction string.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(rows):
    groups={}
    for label,error in rows:
        if error is None: continue
        groups.setdefault(label,[]).append(error)
    if not groups: return None
    means=[Fraction(sum(values),len(values))**2 for values in groups.values()]
    return str(sum(means)/len(means))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('a', 1), ('a', 2), ('b', 4)],)), '37/4')
check('regression 2', solve(*([('a', 1), ('a', 3), ('b', 4)],)), '21/2')
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([('a', None), ('b', None)],)), None)
check('regression 5', solve(*([('a', 0), ('a', 2), ('b', -3), ('b', 1)],)), '7/2')
check('regression 6', solve(*([('a', 1), ('b', 2), ('b', 2), ('b', 2)],)), '5/2')
check('regression 7', solve(*([('a', None), ('a', 2), ('b', 4)],)), '10')
check('regression 8', solve(*([('A', 1), ('a', 4), ('B', 2)],)), '7')
check("variable group balance",solve([("a",N),("a",-N),("b",2*N)]),str(Fraction(5*N*N,2)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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(rows):
    groups={}
    for label,error in rows:
        if error is None: continue
        groups.setdefault(label,[]).append(error)
    if not groups: return None
    means=[abs(Fraction(sum(values),len(values))) for values in groups.values()]
    return str(sum(means)/len(means))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('a', 1), ('a', 2), ('b', 4)],)), '37/4')
check('regression 2', solve(*([('a', 1), ('a', 3), ('b', 4)],)), '21/2')
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([('a', None), ('b', None)],)), None)
check('regression 5', solve(*([('a', 0), ('a', 2), ('b', -3), ('b', 1)],)), '7/2')
check('regression 6', solve(*([('a', 1), ('b', 2), ('b', 2), ('b', 2)],)), '5/2')
check('regression 7', solve(*([('a', None), ('a', 2), ('b', 4)],)), '10')
check('regression 8', solve(*([('A', 1), ('a', 4), ('B', 2)],)), '7')
check("variable group balance",solve([("a",N),("a",-N),("b",2*N)]),str(Fraction(5*N*N,2)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

Rows [group label, integer residual or None] are reduced into mean squared residual per group, then arithmetic mean across observed groups. Missing residuals contribute neither count nor group presence; group labels are case-sensitive. Empty observed population returns None. Exact Fraction string.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(rows):
    groups={}
    for label,error in rows:
        if error is None: continue
        groups.setdefault(label,[]).append(error)
    if not groups: return None
    means=[Fraction(sum(e*e for e in values)) for values in groups.values()]
    return str(sum(means)/len(means))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('a', 1), ('a', 2), ('b', 4)],)), '37/4')
check('regression 2', solve(*([('a', 1), ('a', 3), ('b', 4)],)), '21/2')
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([('a', None), ('b', None)],)), None)
check('regression 5', solve(*([('a', 0), ('a', 2), ('b', -3), ('b', 1)],)), '7/2')
check('regression 6', solve(*([('a', 1), ('b', 2), ('b', 2), ('b', 2)],)), '5/2')
check('regression 7', solve(*([('a', None), ('a', 2), ('b', 4)],)), '10')
check('regression 8', solve(*([('A', 1), ('a', 4), ('B', 2)],)), '7')
check("variable group balance",solve([("a",N),("a",-N),("b",2*N)]),str(Fraction(5*N*N,2)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(rows):
    groups={}
    for label,error in rows:
        if error is None: continue
        groups.setdefault(label,[]).append(error)
    if not groups: return None
    means=[Fraction(sum(e*e for e in values),len(groups)) for values in groups.values()]
    return str(sum(means)/len(means))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('a', 1), ('a', 2), ('b', 4)],)), '37/4')
check('regression 2', solve(*([('a', 1), ('a', 3), ('b', 4)],)), '21/2')
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([('a', None), ('b', None)],)), None)
check('regression 5', solve(*([('a', 0), ('a', 2), ('b', -3), ('b', 1)],)), '7/2')
check('regression 6', solve(*([('a', 1), ('b', 2), ('b', 2), ('b', 2)],)), '5/2')
check('regression 7', solve(*([('a', None), ('a', 2), ('b', 4)],)), '10')
check('regression 8', solve(*([('A', 1), ('a', 4), ('B', 2)],)), '7')
check("variable group balance",solve([("a",N),("a",-N),("b",2*N)]),str(Fraction(5*N*N,2)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

Rows [group label, integer residual or None] are reduced into mean squared residual per group, then arithmetic mean across observed groups. Missing residuals contribute neither count nor group presence; group labels are case-sensitive. Empty observed population returns None. Exact Fraction string.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(rows):
    groups={}
    for label,error in rows:
        if error is None: error=0
        groups.setdefault(label,[]).append(error)
    if not groups: return None
    means=[Fraction(sum(e*e for e in values),len(values)) for values in groups.values()]
    return str(sum(means)/len(means))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('a', 1), ('a', 2), ('b', 4)],)), '37/4')
check('regression 2', solve(*([('a', 1), ('a', 3), ('b', 4)],)), '21/2')
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([('a', None), ('b', None)],)), None)
check('regression 5', solve(*([('a', 0), ('a', 2), ('b', -3), ('b', 1)],)), '7/2')
check('regression 6', solve(*([('a', 1), ('b', 2), ('b', 2), ('b', 2)],)), '5/2')
check('regression 7', solve(*([('a', None), ('a', 2), ('b', 4)],)), '10')
check('regression 8', solve(*([('A', 1), ('a', 4), ('B', 2)],)), '7')
check("variable group balance",solve([("a",N),("a",-N),("b",2*N)]),str(Fraction(5*N*N,2)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(rows):
    groups={}
    for label,error in rows:
        if error is None: error=1
        groups.setdefault(label,[]).append(error)
    if not groups: return None
    means=[Fraction(sum(e*e for e in values),len(values)) for values in groups.values()]
    return str(sum(means)/len(means))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('a', 1), ('a', 2), ('b', 4)],)), '37/4')
check('regression 2', solve(*([('a', 1), ('a', 3), ('b', 4)],)), '21/2')
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([('a', None), ('b', None)],)), None)
check('regression 5', solve(*([('a', 0), ('a', 2), ('b', -3), ('b', 1)],)), '7/2')
check('regression 6', solve(*([('a', 1), ('b', 2), ('b', 2), ('b', 2)],)), '5/2')
check('regression 7', solve(*([('a', None), ('a', 2), ('b', 4)],)), '10')
check('regression 8', solve(*([('A', 1), ('a', 4), ('B', 2)],)), '7')
check("variable group balance",solve([("a",N),("a",-N),("b",2*N)]),str(Fraction(5*N*N,2)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

Rows [group label, integer residual or None] are reduced into mean squared residual per group, then arithmetic mean across observed groups. Missing residuals contribute neither count nor group presence; group labels are case-sensitive. Empty observed population returns None. Exact Fraction string.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(rows):
    groups={}
    for label,error in rows:
        if not error: continue
        groups.setdefault(label,[]).append(error)
    if not groups: return None
    means=[Fraction(sum(e*e for e in values),len(values)) for values in groups.values()]
    return str(sum(means)/len(means))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('a', 1), ('a', 2), ('b', 4)],)), '37/4')
check('regression 2', solve(*([('a', 1), ('a', 3), ('b', 4)],)), '21/2')
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([('a', None), ('b', None)],)), None)
check('regression 5', solve(*([('a', 0), ('a', 2), ('b', -3), ('b', 1)],)), '7/2')
check('regression 6', solve(*([('a', 1), ('b', 2), ('b', 2), ('b', 2)],)), '5/2')
check('regression 7', solve(*([('a', None), ('a', 2), ('b', 4)],)), '10')
check('regression 8', solve(*([('A', 1), ('a', 4), ('B', 2)],)), '7')
check("variable group balance",solve([("a",N),("a",-N),("b",2*N)]),str(Fraction(5*N*N,2)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(rows):
    groups={}
    for label,error in rows:
        if error is None or error<=0: continue
        groups.setdefault(label,[]).append(error)
    if not groups: return None
    means=[Fraction(sum(e*e for e in values),len(values)) for values in groups.values()]
    return str(sum(means)/len(means))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('a', 1), ('a', 2), ('b', 4)],)), '37/4')
check('regression 2', solve(*([('a', 1), ('a', 3), ('b', 4)],)), '21/2')
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([('a', None), ('b', None)],)), None)
check('regression 5', solve(*([('a', 0), ('a', 2), ('b', -3), ('b', 1)],)), '7/2')
check('regression 6', solve(*([('a', 1), ('b', 2), ('b', 2), ('b', 2)],)), '5/2')
check('regression 7', solve(*([('a', None), ('a', 2), ('b', 4)],)), '10')
check('regression 8', solve(*([('A', 1), ('a', 4), ('B', 2)],)), '7')
check("variable group balance",solve([("a",N),("a",-N),("b",2*N)]),str(Fraction(5*N*N,2)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

Rows [group label, integer residual or None] are reduced into mean squared residual per group, then arithmetic mean across observed groups. Missing residuals contribute neither count nor group presence; group labels are case-sensitive. Empty observed population returns None. Exact Fraction string.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(rows):
    groups={}
    for label,error in rows:
        if error is None: continue
        groups[label]=[error]
    if not groups: return None
    means=[Fraction(sum(e*e for e in values),len(values)) for values in groups.values()]
    return str(sum(means)/len(means))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('a', 1), ('a', 2), ('b', 4)],)), '37/4')
check('regression 2', solve(*([('a', 1), ('a', 3), ('b', 4)],)), '21/2')
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([('a', None), ('b', None)],)), None)
check('regression 5', solve(*([('a', 0), ('a', 2), ('b', -3), ('b', 1)],)), '7/2')
check('regression 6', solve(*([('a', 1), ('b', 2), ('b', 2), ('b', 2)],)), '5/2')
check('regression 7', solve(*([('a', None), ('a', 2), ('b', 4)],)), '10')
check('regression 8', solve(*([('A', 1), ('a', 4), ('B', 2)],)), '7')
check("variable group balance",solve([("a",N),("a",-N),("b",2*N)]),str(Fraction(5*N*N,2)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(rows):
    groups={}
    for label,error in rows:
        if error is None: continue
        groups.setdefault(label,[error])
    if not groups: return None
    means=[Fraction(sum(e*e for e in values),len(values)) for values in groups.values()]
    return str(sum(means)/len(means))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('a', 1), ('a', 2), ('b', 4)],)), '37/4')
check('regression 2', solve(*([('a', 1), ('a', 3), ('b', 4)],)), '21/2')
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([('a', None), ('b', None)],)), None)
check('regression 5', solve(*([('a', 0), ('a', 2), ('b', -3), ('b', 1)],)), '7/2')
check('regression 6', solve(*([('a', 1), ('b', 2), ('b', 2), ('b', 2)],)), '5/2')
check('regression 7', solve(*([('a', None), ('a', 2), ('b', 4)],)), '10')
check('regression 8', solve(*([('A', 1), ('a', 4), ('B', 2)],)), '7')
check("variable group balance",solve([("a",N),("a",-N),("b",2*N)]),str(Fraction(5*N*N,2)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

Rows [group label, integer residual or None] are reduced into mean squared residual per group, then arithmetic mean across observed groups. Missing residuals contribute neither count nor group presence; group labels are case-sensitive. Empty observed population returns None. Exact Fraction string.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(rows):
    groups={}
    for label,error in rows:
        if error is None: continue
        groups.setdefault(label,[]).append(error)
    if not groups: return None
    values=max(groups.values(),key=len)
    means=[Fraction(sum(e*e for e in values),len(values))]
    return str(sum(means)/len(means))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('a', 1), ('a', 2), ('b', 4)],)), '37/4')
check('regression 2', solve(*([('a', 1), ('a', 3), ('b', 4)],)), '21/2')
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([('a', None), ('b', None)],)), None)
check('regression 5', solve(*([('a', 0), ('a', 2), ('b', -3), ('b', 1)],)), '7/2')
check('regression 6', solve(*([('a', 1), ('b', 2), ('b', 2), ('b', 2)],)), '5/2')
check('regression 7', solve(*([('a', None), ('a', 2), ('b', 4)],)), '10')
check('regression 8', solve(*([('A', 1), ('a', 4), ('B', 2)],)), '7')
check("variable group balance",solve([("a",N),("a",-N),("b",2*N)]),str(Fraction(5*N*N,2)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(rows):
    groups={}
    for label,error in rows:
        if error is None: continue
        groups.setdefault(label,[]).append(error)
    if not groups: return None
    values=min(groups.values(),key=len)
    means=[Fraction(sum(e*e for e in values),len(values))]
    return str(sum(means)/len(means))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('a', 1), ('a', 2), ('b', 4)],)), '37/4')
check('regression 2', solve(*([('a', 1), ('a', 3), ('b', 4)],)), '21/2')
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([('a', None), ('b', None)],)), None)
check('regression 5', solve(*([('a', 0), ('a', 2), ('b', -3), ('b', 1)],)), '7/2')
check('regression 6', solve(*([('a', 1), ('b', 2), ('b', 2), ('b', 2)],)), '5/2')
check('regression 7', solve(*([('a', None), ('a', 2), ('b', 4)],)), '10')
check('regression 8', solve(*([('A', 1), ('a', 4), ('B', 2)],)), '7')
check("variable group balance",solve([("a",N),("a",-N),("b",2*N)]),str(Fraction(5*N*N,2)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

Rows [group label, integer residual or None] are reduced into mean squared residual per group, then arithmetic mean across observed groups. Missing residuals contribute neither count nor group presence; group labels are case-sensitive. Empty observed population returns None. Exact Fraction string.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(rows):
    groups={}
    for label,error in rows:
        if error is None: continue
        groups.setdefault(label,[]).append(error)
    if not groups: return None
    means=[Fraction(sum(e*e for e in values),len(values)) for values in groups.values()]
    return str(max(means))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('a', 1), ('a', 2), ('b', 4)],)), '37/4')
check('regression 2', solve(*([('a', 1), ('a', 3), ('b', 4)],)), '21/2')
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([('a', None), ('b', None)],)), None)
check('regression 5', solve(*([('a', 0), ('a', 2), ('b', -3), ('b', 1)],)), '7/2')
check('regression 6', solve(*([('a', 1), ('b', 2), ('b', 2), ('b', 2)],)), '5/2')
check('regression 7', solve(*([('a', None), ('a', 2), ('b', 4)],)), '10')
check('regression 8', solve(*([('A', 1), ('a', 4), ('B', 2)],)), '7')
check("variable group balance",solve([("a",N),("a",-N),("b",2*N)]),str(Fraction(5*N*N,2)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(rows):
    groups={}
    for label,error in rows:
        if error is None: continue
        groups.setdefault(label,[]).append(error)
    if not groups: return None
    means=[Fraction(sum(e*e for e in values),len(values)) for values in groups.values()]
    return str(min(means))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('a', 1), ('a', 2), ('b', 4)],)), '37/4')
check('regression 2', solve(*([('a', 1), ('a', 3), ('b', 4)],)), '21/2')
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([('a', None), ('b', None)],)), None)
check('regression 5', solve(*([('a', 0), ('a', 2), ('b', -3), ('b', 1)],)), '7/2')
check('regression 6', solve(*([('a', 1), ('b', 2), ('b', 2), ('b', 2)],)), '5/2')
check('regression 7', solve(*([('a', None), ('a', 2), ('b', 4)],)), '10')
check('regression 8', solve(*([('A', 1), ('a', 4), ('B', 2)],)), '7')
check("variable group balance",solve([("a",N),("a",-N),("b",2*N)]),str(Fraction(5*N*N,2)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

Rows [group label, integer residual or None] are reduced into mean squared residual per group, then arithmetic mean across observed groups. Missing residuals contribute neither count nor group presence; group labels are case-sensitive. Empty observed population returns None. Exact Fraction string.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(rows):
    groups={}
    for label,error in rows:
        if error is None: continue
        groups.setdefault(label.lower(),[]).append(error)
    if not groups: return None
    means=[Fraction(sum(e*e for e in values),len(values)) for values in groups.values()]
    return str(sum(means)/len(means))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('a', 1), ('a', 2), ('b', 4)],)), '37/4')
check('regression 2', solve(*([('a', 1), ('a', 3), ('b', 4)],)), '21/2')
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([('a', None), ('b', None)],)), None)
check('regression 5', solve(*([('a', 0), ('a', 2), ('b', -3), ('b', 1)],)), '7/2')
check('regression 6', solve(*([('a', 1), ('b', 2), ('b', 2), ('b', 2)],)), '5/2')
check('regression 7', solve(*([('a', None), ('a', 2), ('b', 4)],)), '10')
check('regression 8', solve(*([('A', 1), ('a', 4), ('B', 2)],)), '7')
check("variable group balance",solve([("a",N),("a",-N),("b",2*N)]),str(Fraction(5*N*N,2)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(rows):
    groups={}
    for label,error in rows:
        if error is None: continue
        groups.setdefault(len(label),[]).append(error)
    if not groups: return None
    means=[Fraction(sum(e*e for e in values),len(values)) for values in groups.values()]
    return str(sum(means)/len(means))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('a', 1), ('a', 2), ('b', 4)],)), '37/4')
check('regression 2', solve(*([('a', 1), ('a', 3), ('b', 4)],)), '21/2')
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([('a', None), ('b', None)],)), None)
check('regression 5', solve(*([('a', 0), ('a', 2), ('b', -3), ('b', 1)],)), '7/2')
check('regression 6', solve(*([('a', 1), ('b', 2), ('b', 2), ('b', 2)],)), '5/2')
check('regression 7', solve(*([('a', None), ('a', 2), ('b', 4)],)), '10')
check('regression 8', solve(*([('A', 1), ('a', 4), ('B', 2)],)), '7')
check("variable group balance",solve([("a",N),("a",-N),("b",2*N)]),str(Fraction(5*N*N,2)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

Rows [group label, integer residual or None] are reduced into mean squared residual per group, then arithmetic mean across observed groups. Missing residuals contribute neither count nor group presence; group labels are case-sensitive. Empty observed population returns None. Exact Fraction string.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(rows):
    groups={}
    for label,error in rows:
        if error is None: continue
        groups.setdefault(label,[]).append(error)
    if not groups: return None
    means=[Fraction(sum(e*e for e in values)//len(values)) for values in groups.values()]
    return str(sum(means)/len(means))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('a', 1), ('a', 2), ('b', 4)],)), '37/4')
check('regression 2', solve(*([('a', 1), ('a', 3), ('b', 4)],)), '21/2')
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([('a', None), ('b', None)],)), None)
check('regression 5', solve(*([('a', 0), ('a', 2), ('b', -3), ('b', 1)],)), '7/2')
check('regression 6', solve(*([('a', 1), ('b', 2), ('b', 2), ('b', 2)],)), '5/2')
check('regression 7', solve(*([('a', None), ('a', 2), ('b', 4)],)), '10')
check('regression 8', solve(*([('A', 1), ('a', 4), ('B', 2)],)), '7')
check("variable group balance",solve([("a",N),("a",-N),("b",2*N)]),str(Fraction(5*N*N,2)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(rows):
    groups={}
    for label,error in rows:
        if error is None: continue
        groups.setdefault(label,[]).append(error)
    if not groups: return None
    means=[Fraction(round(Fraction(sum(e*e for e in values),len(values)))) for values in groups.values()]
    return str(sum(means)/len(means))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('a', 1), ('a', 2), ('b', 4)],)), '37/4')
check('regression 2', solve(*([('a', 1), ('a', 3), ('b', 4)],)), '21/2')
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([('a', None), ('b', None)],)), None)
check('regression 5', solve(*([('a', 0), ('a', 2), ('b', -3), ('b', 1)],)), '7/2')
check('regression 6', solve(*([('a', 1), ('b', 2), ('b', 2), ('b', 2)],)), '5/2')
check('regression 7', solve(*([('a', None), ('a', 2), ('b', 4)],)), '10')
check('regression 8', solve(*([('A', 1), ('a', 4), ('B', 2)],)), '7')
check("variable group balance",solve([("a",N),("a",-N),("b",2*N)]),str(Fraction(5*N*N,2)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

Rows [group label, integer residual or None] are reduced into mean squared residual per group, then arithmetic mean across observed groups. Missing residuals contribute neither count nor group presence; group labels are case-sensitive. Empty observed population returns None. Exact Fraction string.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(blocks, width, queries):
    table=[[0]*width]*3
    for block in blocks:
        for key,weight in block:
            buckets=[key%width,(3*key+1)%width,(key//width)%width]
            for row,col in enumerate(buckets):
                table[row][col]+=weight
    estimates=[]
    for key in queries:
        buckets=[key%width,(3*key+1)%width,(key//width)%width]
        estimates.append(min(table[row][col] for row,col in enumerate(buckets)))
    return [table,estimates]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[(0, 2), (1, 3)], [(4, 1)]], 4, [0, 1, 4, 8])), [[[3, 3, 0, 0], [3, 3, 0, 0], [5, 1, 0, 0]], [3, 3, 1, 0]])
check('regression 2', solve(*([], 3, [0, 1])), [[[0, 0, 0], [0, 0, 0], [0, 0, 0]], [0, 0]])
check('regression 3', solve(*([[(2, 5)], [], [(2, 2)]], 3, [2, 5])), [[[0, 0, 7], [0, 7, 0], [7, 0, 0]], [7, 0]])
check('regression 4', solve(*([[(0, 1), (0, 1)]], 1, [0, 3])), [[[2], [2], [2]], [2, 2]])
check('regression 5', solve(*([[(7, 0), (2, 4), (5, 1)]], 4, [2, 5, 7])), [[[0, 1, 4, 0], [1, 0, 0, 4], [4, 1, 0, 0]], [4, 1, 0]])
check('regression 6', solve(*([[(1, 2)], [(8, 5), (3, 4)]], 5, [1, 8, 3, 13])), [[[0, 2, 0, 9, 0], [9, 0, 0, 0, 2], [6, 5, 0, 0, 0]], [2, 5, 6, 0]])
check("variable sketch contribution",solve([[(0,N)]],2,[0]),[[[N,0],[0,N],[N,0]],[N]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(blocks, width, queries):
    shared=[0]*width
    table=[shared,shared,list(shared)]
    for block in blocks:
        for key,weight in block:
            buckets=[key%width,(3*key+1)%width,(key//width)%width]
            for row,col in enumerate(buckets):
                table[row][col]+=weight
    estimates=[]
    for key in queries:
        buckets=[key%width,(3*key+1)%width,(key//width)%width]
        estimates.append(min(table[row][col] for row,col in enumerate(buckets)))
    return [table,estimates]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[(0, 2), (1, 3)], [(4, 1)]], 4, [0, 1, 4, 8])), [[[3, 3, 0, 0], [3, 3, 0, 0], [5, 1, 0, 0]], [3, 3, 1, 0]])
check('regression 2', solve(*([], 3, [0, 1])), [[[0, 0, 0], [0, 0, 0], [0, 0, 0]], [0, 0]])
check('regression 3', solve(*([[(2, 5)], [], [(2, 2)]], 3, [2, 5])), [[[0, 0, 7], [0, 7, 0], [7, 0, 0]], [7, 0]])
check('regression 4', solve(*([[(0, 1), (0, 1)]], 1, [0, 3])), [[[2], [2], [2]], [2, 2]])
check('regression 5', solve(*([[(7, 0), (2, 4), (5, 1)]], 4, [2, 5, 7])), [[[0, 1, 4, 0], [1, 0, 0, 4], [4, 1, 0, 0]], [4, 1, 0]])
check('regression 6', solve(*([[(1, 2)], [(8, 5), (3, 4)]], 5, [1, 8, 3, 13])), [[[0, 2, 0, 9, 0], [9, 0, 0, 0, 2], [6, 5, 0, 0, 0]], [2, 5, 6, 0]])
check("variable sketch contribution",solve([[(0,N)]],2,[0]),[[[N,0],[0,N],[N,0]],[N]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

A stipulated nonnegative weighted count-min table has exactly three independent rows of positive width, with bucket functions k%w,(3*k+1)%w,(k//w)%w for nonnegative integer keys. Add all block contributions, then estimate each query by the minimum of its three cells. Return [table,estimates]; no probabilistic error guarantee is claimed.

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, width, queries):
    table=[[0]*width for _ in range(3)]
    for block in blocks:
        for key,weight in block:
            buckets=[key%width,(3*key+1)%width,(key//width)%width]
            for row,col in enumerate(buckets):
                table[row][col]=weight
    estimates=[]
    for key in queries:
        buckets=[key%width,(3*key+1)%width,(key//width)%width]
        estimates.append(min(table[row][col] for row,col in enumerate(buckets)))
    return [table,estimates]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[(0, 2), (1, 3)], [(4, 1)]], 4, [0, 1, 4, 8])), [[[3, 3, 0, 0], [3, 3, 0, 0], [5, 1, 0, 0]], [3, 3, 1, 0]])
check('regression 2', solve(*([], 3, [0, 1])), [[[0, 0, 0], [0, 0, 0], [0, 0, 0]], [0, 0]])
check('regression 3', solve(*([[(2, 5)], [], [(2, 2)]], 3, [2, 5])), [[[0, 0, 7], [0, 7, 0], [7, 0, 0]], [7, 0]])
check('regression 4', solve(*([[(0, 1), (0, 1)]], 1, [0, 3])), [[[2], [2], [2]], [2, 2]])
check('regression 5', solve(*([[(7, 0), (2, 4), (5, 1)]], 4, [2, 5, 7])), [[[0, 1, 4, 0], [1, 0, 0, 4], [4, 1, 0, 0]], [4, 1, 0]])
check('regression 6', solve(*([[(1, 2)], [(8, 5), (3, 4)]], 5, [1, 8, 3, 13])), [[[0, 2, 0, 9, 0], [9, 0, 0, 0, 2], [6, 5, 0, 0, 0]], [2, 5, 6, 0]])
check("variable sketch contribution",solve([[(0,N)]],2,[0]),[[[N,0],[0,N],[N,0]],[N]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(blocks, width, queries):
    table=[[0]*width for _ in range(3)]
    for block in blocks:
        for key,weight in block:
            buckets=[key%width,(3*key+1)%width,(key//width)%width]
            for row,col in enumerate(buckets):
                table[row][col]=max(table[row][col],weight)
    estimates=[]
    for key in queries:
        buckets=[key%width,(3*key+1)%width,(key//width)%width]
        estimates.append(min(table[row][col] for row,col in enumerate(buckets)))
    return [table,estimates]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[(0, 2), (1, 3)], [(4, 1)]], 4, [0, 1, 4, 8])), [[[3, 3, 0, 0], [3, 3, 0, 0], [5, 1, 0, 0]], [3, 3, 1, 0]])
check('regression 2', solve(*([], 3, [0, 1])), [[[0, 0, 0], [0, 0, 0], [0, 0, 0]], [0, 0]])
check('regression 3', solve(*([[(2, 5)], [], [(2, 2)]], 3, [2, 5])), [[[0, 0, 7], [0, 7, 0], [7, 0, 0]], [7, 0]])
check('regression 4', solve(*([[(0, 1), (0, 1)]], 1, [0, 3])), [[[2], [2], [2]], [2, 2]])
check('regression 5', solve(*([[(7, 0), (2, 4), (5, 1)]], 4, [2, 5, 7])), [[[0, 1, 4, 0], [1, 0, 0, 4], [4, 1, 0, 0]], [4, 1, 0]])
check('regression 6', solve(*([[(1, 2)], [(8, 5), (3, 4)]], 5, [1, 8, 3, 13])), [[[0, 2, 0, 9, 0], [9, 0, 0, 0, 2], [6, 5, 0, 0, 0]], [2, 5, 6, 0]])
check("variable sketch contribution",solve([[(0,N)]],2,[0]),[[[N,0],[0,N],[N,0]],[N]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

A stipulated nonnegative weighted count-min table has exactly three independent rows of positive width, with bucket functions k%w,(3*k+1)%w,(k//w)%w for nonnegative integer keys. Add all block contributions, then estimate each query by the minimum of its three cells. Return [table,estimates]; no probabilistic error guarantee is claimed.

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, width, queries):
    table=[[0]*width for _ in range(3)]
    for block in blocks:
        for key,weight in block:
            buckets=[key%width,(3*key+1)%width,(key//width)%width]
            for row,col in enumerate(buckets):
                table[row][col]+=1
    estimates=[]
    for key in queries:
        buckets=[key%width,(3*key+1)%width,(key//width)%width]
        estimates.append(min(table[row][col] for row,col in enumerate(buckets)))
    return [table,estimates]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[(0, 2), (1, 3)], [(4, 1)]], 4, [0, 1, 4, 8])), [[[3, 3, 0, 0], [3, 3, 0, 0], [5, 1, 0, 0]], [3, 3, 1, 0]])
check('regression 2', solve(*([], 3, [0, 1])), [[[0, 0, 0], [0, 0, 0], [0, 0, 0]], [0, 0]])
check('regression 3', solve(*([[(2, 5)], [], [(2, 2)]], 3, [2, 5])), [[[0, 0, 7], [0, 7, 0], [7, 0, 0]], [7, 0]])
check('regression 4', solve(*([[(0, 1), (0, 1)]], 1, [0, 3])), [[[2], [2], [2]], [2, 2]])
check('regression 5', solve(*([[(7, 0), (2, 4), (5, 1)]], 4, [2, 5, 7])), [[[0, 1, 4, 0], [1, 0, 0, 4], [4, 1, 0, 0]], [4, 1, 0]])
check('regression 6', solve(*([[(1, 2)], [(8, 5), (3, 4)]], 5, [1, 8, 3, 13])), [[[0, 2, 0, 9, 0], [9, 0, 0, 0, 2], [6, 5, 0, 0, 0]], [2, 5, 6, 0]])
check("variable sketch contribution",solve([[(0,N)]],2,[0]),[[[N,0],[0,N],[N,0]],[N]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(blocks, width, queries):
    table=[[0]*width for _ in range(3)]
    for block in blocks:
        for key,weight in block:
            buckets=[key%width,(3*key+1)%width,(key//width)%width]
            for row,col in enumerate(buckets):
                table[row][col]+=int(weight>0)
    estimates=[]
    for key in queries:
        buckets=[key%width,(3*key+1)%width,(key//width)%width]
        estimates.append(min(table[row][col] for row,col in enumerate(buckets)))
    return [table,estimates]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[(0, 2), (1, 3)], [(4, 1)]], 4, [0, 1, 4, 8])), [[[3, 3, 0, 0], [3, 3, 0, 0], [5, 1, 0, 0]], [3, 3, 1, 0]])
check('regression 2', solve(*([], 3, [0, 1])), [[[0, 0, 0], [0, 0, 0], [0, 0, 0]], [0, 0]])
check('regression 3', solve(*([[(2, 5)], [], [(2, 2)]], 3, [2, 5])), [[[0, 0, 7], [0, 7, 0], [7, 0, 0]], [7, 0]])
check('regression 4', solve(*([[(0, 1), (0, 1)]], 1, [0, 3])), [[[2], [2], [2]], [2, 2]])
check('regression 5', solve(*([[(7, 0), (2, 4), (5, 1)]], 4, [2, 5, 7])), [[[0, 1, 4, 0], [1, 0, 0, 4], [4, 1, 0, 0]], [4, 1, 0]])
check('regression 6', solve(*([[(1, 2)], [(8, 5), (3, 4)]], 5, [1, 8, 3, 13])), [[[0, 2, 0, 9, 0], [9, 0, 0, 0, 2], [6, 5, 0, 0, 0]], [2, 5, 6, 0]])
check("variable sketch contribution",solve([[(0,N)]],2,[0]),[[[N,0],[0,N],[N,0]],[N]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

A stipulated nonnegative weighted count-min table has exactly three independent rows of positive width, with bucket functions k%w,(3*k+1)%w,(k//w)%w for nonnegative integer keys. Add all block contributions, then estimate each query by the minimum of its three cells. Return [table,estimates]; no probabilistic error guarantee is claimed.

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, width, queries):
    table=[[0]*width for _ in range(3)]
    for block in blocks:
        table=[[0]*width for _ in range(3)]
        for key,weight in block:
            buckets=[key%width,(3*key+1)%width,(key//width)%width]
            for row,col in enumerate(buckets):
                table[row][col]+=weight
    estimates=[]
    for key in queries:
        buckets=[key%width,(3*key+1)%width,(key//width)%width]
        estimates.append(min(table[row][col] for row,col in enumerate(buckets)))
    return [table,estimates]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[(0, 2), (1, 3)], [(4, 1)]], 4, [0, 1, 4, 8])), [[[3, 3, 0, 0], [3, 3, 0, 0], [5, 1, 0, 0]], [3, 3, 1, 0]])
check('regression 2', solve(*([], 3, [0, 1])), [[[0, 0, 0], [0, 0, 0], [0, 0, 0]], [0, 0]])
check('regression 3', solve(*([[(2, 5)], [], [(2, 2)]], 3, [2, 5])), [[[0, 0, 7], [0, 7, 0], [7, 0, 0]], [7, 0]])
check('regression 4', solve(*([[(0, 1), (0, 1)]], 1, [0, 3])), [[[2], [2], [2]], [2, 2]])
check('regression 5', solve(*([[(7, 0), (2, 4), (5, 1)]], 4, [2, 5, 7])), [[[0, 1, 4, 0], [1, 0, 0, 4], [4, 1, 0, 0]], [4, 1, 0]])
check('regression 6', solve(*([[(1, 2)], [(8, 5), (3, 4)]], 5, [1, 8, 3, 13])), [[[0, 2, 0, 9, 0], [9, 0, 0, 0, 2], [6, 5, 0, 0, 0]], [2, 5, 6, 0]])
check("variable sketch contribution",solve([[(0,N)]],2,[0]),[[[N,0],[0,N],[N,0]],[N]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(blocks, width, queries):
    table=[[0]*width for _ in range(3)]
    for block in blocks:
        if block: table=[[0]*width for _ in range(3)]
        for key,weight in block:
            buckets=[key%width,(3*key+1)%width,(key//width)%width]
            for row,col in enumerate(buckets):
                table[row][col]+=weight
    estimates=[]
    for key in queries:
        buckets=[key%width,(3*key+1)%width,(key//width)%width]
        estimates.append(min(table[row][col] for row,col in enumerate(buckets)))
    return [table,estimates]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[(0, 2), (1, 3)], [(4, 1)]], 4, [0, 1, 4, 8])), [[[3, 3, 0, 0], [3, 3, 0, 0], [5, 1, 0, 0]], [3, 3, 1, 0]])
check('regression 2', solve(*([], 3, [0, 1])), [[[0, 0, 0], [0, 0, 0], [0, 0, 0]], [0, 0]])
check('regression 3', solve(*([[(2, 5)], [], [(2, 2)]], 3, [2, 5])), [[[0, 0, 7], [0, 7, 0], [7, 0, 0]], [7, 0]])
check('regression 4', solve(*([[(0, 1), (0, 1)]], 1, [0, 3])), [[[2], [2], [2]], [2, 2]])
check('regression 5', solve(*([[(7, 0), (2, 4), (5, 1)]], 4, [2, 5, 7])), [[[0, 1, 4, 0], [1, 0, 0, 4], [4, 1, 0, 0]], [4, 1, 0]])
check('regression 6', solve(*([[(1, 2)], [(8, 5), (3, 4)]], 5, [1, 8, 3, 13])), [[[0, 2, 0, 9, 0], [9, 0, 0, 0, 2], [6, 5, 0, 0, 0]], [2, 5, 6, 0]])
check("variable sketch contribution",solve([[(0,N)]],2,[0]),[[[N,0],[0,N],[N,0]],[N]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

A stipulated nonnegative weighted count-min table has exactly three independent rows of positive width, with bucket functions k%w,(3*k+1)%w,(k//w)%w for nonnegative integer keys. Add all block contributions, then estimate each query by the minimum of its three cells. Return [table,estimates]; no probabilistic error guarantee is claimed.

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, width, queries):
    table=[[0]*width for _ in range(3)]
    for block in blocks:
        for key,weight in block:
            buckets=[key%width,(3*key+1)%width,(key//width)%width]
            for row,col in enumerate(buckets):
                table[row][col]+=weight
    estimates=[]
    for key in queries:
        buckets=[key%width,(3*key+1)%width,(key//width)%width]
        estimates.append(sum(table[row][col] for row,col in enumerate(buckets)))
    return [table,estimates]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[(0, 2), (1, 3)], [(4, 1)]], 4, [0, 1, 4, 8])), [[[3, 3, 0, 0], [3, 3, 0, 0], [5, 1, 0, 0]], [3, 3, 1, 0]])
check('regression 2', solve(*([], 3, [0, 1])), [[[0, 0, 0], [0, 0, 0], [0, 0, 0]], [0, 0]])
check('regression 3', solve(*([[(2, 5)], [], [(2, 2)]], 3, [2, 5])), [[[0, 0, 7], [0, 7, 0], [7, 0, 0]], [7, 0]])
check('regression 4', solve(*([[(0, 1), (0, 1)]], 1, [0, 3])), [[[2], [2], [2]], [2, 2]])
check('regression 5', solve(*([[(7, 0), (2, 4), (5, 1)]], 4, [2, 5, 7])), [[[0, 1, 4, 0], [1, 0, 0, 4], [4, 1, 0, 0]], [4, 1, 0]])
check('regression 6', solve(*([[(1, 2)], [(8, 5), (3, 4)]], 5, [1, 8, 3, 13])), [[[0, 2, 0, 9, 0], [9, 0, 0, 0, 2], [6, 5, 0, 0, 0]], [2, 5, 6, 0]])
check("variable sketch contribution",solve([[(0,N)]],2,[0]),[[[N,0],[0,N],[N,0]],[N]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(blocks, width, queries):
    table=[[0]*width for _ in range(3)]
    for block in blocks:
        for key,weight in block:
            buckets=[key%width,(3*key+1)%width,(key//width)%width]
            for row,col in enumerate(buckets):
                table[row][col]+=weight
    estimates=[]
    for key in queries:
        buckets=[key%width,(3*key+1)%width,(key//width)%width]
        estimates.append(sum(table[row][col] for row,col in enumerate(buckets))//3)
    return [table,estimates]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[(0, 2), (1, 3)], [(4, 1)]], 4, [0, 1, 4, 8])), [[[3, 3, 0, 0], [3, 3, 0, 0], [5, 1, 0, 0]], [3, 3, 1, 0]])
check('regression 2', solve(*([], 3, [0, 1])), [[[0, 0, 0], [0, 0, 0], [0, 0, 0]], [0, 0]])
check('regression 3', solve(*([[(2, 5)], [], [(2, 2)]], 3, [2, 5])), [[[0, 0, 7], [0, 7, 0], [7, 0, 0]], [7, 0]])
check('regression 4', solve(*([[(0, 1), (0, 1)]], 1, [0, 3])), [[[2], [2], [2]], [2, 2]])
check('regression 5', solve(*([[(7, 0), (2, 4), (5, 1)]], 4, [2, 5, 7])), [[[0, 1, 4, 0], [1, 0, 0, 4], [4, 1, 0, 0]], [4, 1, 0]])
check('regression 6', solve(*([[(1, 2)], [(8, 5), (3, 4)]], 5, [1, 8, 3, 13])), [[[0, 2, 0, 9, 0], [9, 0, 0, 0, 2], [6, 5, 0, 0, 0]], [2, 5, 6, 0]])
check("variable sketch contribution",solve([[(0,N)]],2,[0]),[[[N,0],[0,N],[N,0]],[N]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

A stipulated nonnegative weighted count-min table has exactly three independent rows of positive width, with bucket functions k%w,(3*k+1)%w,(k//w)%w for nonnegative integer keys. Add all block contributions, then estimate each query by the minimum of its three cells. Return [table,estimates]; no probabilistic error guarantee is claimed.

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, width, queries):
    table=[[0]*width for _ in range(3)]
    for block in blocks:
        for key,weight in block:
            buckets=[key%width,(3*key+1)%width,(key//width)%width]
            for row,col in enumerate(buckets):
                table[row][col]+=weight
    estimates=[]
    for key in queries:
        buckets=[key%width,(3*key+1)%width,(key//width)%width]
        estimates.append(max(table[row][col] for row,col in enumerate(buckets)))
    return [table,estimates]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[(0, 2), (1, 3)], [(4, 1)]], 4, [0, 1, 4, 8])), [[[3, 3, 0, 0], [3, 3, 0, 0], [5, 1, 0, 0]], [3, 3, 1, 0]])
check('regression 2', solve(*([], 3, [0, 1])), [[[0, 0, 0], [0, 0, 0], [0, 0, 0]], [0, 0]])
check('regression 3', solve(*([[(2, 5)], [], [(2, 2)]], 3, [2, 5])), [[[0, 0, 7], [0, 7, 0], [7, 0, 0]], [7, 0]])
check('regression 4', solve(*([[(0, 1), (0, 1)]], 1, [0, 3])), [[[2], [2], [2]], [2, 2]])
check('regression 5', solve(*([[(7, 0), (2, 4), (5, 1)]], 4, [2, 5, 7])), [[[0, 1, 4, 0], [1, 0, 0, 4], [4, 1, 0, 0]], [4, 1, 0]])
check('regression 6', solve(*([[(1, 2)], [(8, 5), (3, 4)]], 5, [1, 8, 3, 13])), [[[0, 2, 0, 9, 0], [9, 0, 0, 0, 2], [6, 5, 0, 0, 0]], [2, 5, 6, 0]])
check("variable sketch contribution",solve([[(0,N)]],2,[0]),[[[N,0],[0,N],[N,0]],[N]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(blocks, width, queries):
    table=[[0]*width for _ in range(3)]
    for block in blocks:
        for key,weight in block:
            buckets=[key%width,(3*key+1)%width,(key//width)%width]
            for row,col in enumerate(buckets):
                table[row][col]+=weight
    estimates=[]
    for key in queries:
        buckets=[key%width,(3*key+1)%width,(key//width)%width]
        estimates.append(sorted(table[row][col] for row,col in enumerate(buckets))[1])
    return [table,estimates]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[(0, 2), (1, 3)], [(4, 1)]], 4, [0, 1, 4, 8])), [[[3, 3, 0, 0], [3, 3, 0, 0], [5, 1, 0, 0]], [3, 3, 1, 0]])
check('regression 2', solve(*([], 3, [0, 1])), [[[0, 0, 0], [0, 0, 0], [0, 0, 0]], [0, 0]])
check('regression 3', solve(*([[(2, 5)], [], [(2, 2)]], 3, [2, 5])), [[[0, 0, 7], [0, 7, 0], [7, 0, 0]], [7, 0]])
check('regression 4', solve(*([[(0, 1), (0, 1)]], 1, [0, 3])), [[[2], [2], [2]], [2, 2]])
check('regression 5', solve(*([[(7, 0), (2, 4), (5, 1)]], 4, [2, 5, 7])), [[[0, 1, 4, 0], [1, 0, 0, 4], [4, 1, 0, 0]], [4, 1, 0]])
check('regression 6', solve(*([[(1, 2)], [(8, 5), (3, 4)]], 5, [1, 8, 3, 13])), [[[0, 2, 0, 9, 0], [9, 0, 0, 0, 2], [6, 5, 0, 0, 0]], [2, 5, 6, 0]])
check("variable sketch contribution",solve([[(0,N)]],2,[0]),[[[N,0],[0,N],[N,0]],[N]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

A stipulated nonnegative weighted count-min table has exactly three independent rows of positive width, with bucket functions k%w,(3*k+1)%w,(k//w)%w for nonnegative integer keys. Add all block contributions, then estimate each query by the minimum of its three cells. Return [table,estimates]; no probabilistic error guarantee is claimed.

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, width, queries):
    table=[[0]*width for _ in range(3)]
    for block in blocks:
        for key,weight in block:
            buckets=[key%width,(3*key+1)%width,(key//width)%width]
            for row,col in list(enumerate(buckets))[:2]:
                table[row][col]+=weight
    estimates=[]
    for key in queries:
        buckets=[key%width,(3*key+1)%width,(key//width)%width]
        estimates.append(min(table[row][col] for row,col in enumerate(buckets)))
    return [table,estimates]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[(0, 2), (1, 3)], [(4, 1)]], 4, [0, 1, 4, 8])), [[[3, 3, 0, 0], [3, 3, 0, 0], [5, 1, 0, 0]], [3, 3, 1, 0]])
check('regression 2', solve(*([], 3, [0, 1])), [[[0, 0, 0], [0, 0, 0], [0, 0, 0]], [0, 0]])
check('regression 3', solve(*([[(2, 5)], [], [(2, 2)]], 3, [2, 5])), [[[0, 0, 7], [0, 7, 0], [7, 0, 0]], [7, 0]])
check('regression 4', solve(*([[(0, 1), (0, 1)]], 1, [0, 3])), [[[2], [2], [2]], [2, 2]])
check('regression 5', solve(*([[(7, 0), (2, 4), (5, 1)]], 4, [2, 5, 7])), [[[0, 1, 4, 0], [1, 0, 0, 4], [4, 1, 0, 0]], [4, 1, 0]])
check('regression 6', solve(*([[(1, 2)], [(8, 5), (3, 4)]], 5, [1, 8, 3, 13])), [[[0, 2, 0, 9, 0], [9, 0, 0, 0, 2], [6, 5, 0, 0, 0]], [2, 5, 6, 0]])
check("variable sketch contribution",solve([[(0,N)]],2,[0]),[[[N,0],[0,N],[N,0]],[N]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(blocks, width, queries):
    table=[[0]*width for _ in range(3)]
    for block in blocks:
        for key,weight in block:
            buckets=[key%width,(3*key+1)%width,(key//width)%width]
            for row,col in list(enumerate(buckets))[1:]:
                table[row][col]+=weight
    estimates=[]
    for key in queries:
        buckets=[key%width,(3*key+1)%width,(key//width)%width]
        estimates.append(min(table[row][col] for row,col in enumerate(buckets)))
    return [table,estimates]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[(0, 2), (1, 3)], [(4, 1)]], 4, [0, 1, 4, 8])), [[[3, 3, 0, 0], [3, 3, 0, 0], [5, 1, 0, 0]], [3, 3, 1, 0]])
check('regression 2', solve(*([], 3, [0, 1])), [[[0, 0, 0], [0, 0, 0], [0, 0, 0]], [0, 0]])
check('regression 3', solve(*([[(2, 5)], [], [(2, 2)]], 3, [2, 5])), [[[0, 0, 7], [0, 7, 0], [7, 0, 0]], [7, 0]])
check('regression 4', solve(*([[(0, 1), (0, 1)]], 1, [0, 3])), [[[2], [2], [2]], [2, 2]])
check('regression 5', solve(*([[(7, 0), (2, 4), (5, 1)]], 4, [2, 5, 7])), [[[0, 1, 4, 0], [1, 0, 0, 4], [4, 1, 0, 0]], [4, 1, 0]])
check('regression 6', solve(*([[(1, 2)], [(8, 5), (3, 4)]], 5, [1, 8, 3, 13])), [[[0, 2, 0, 9, 0], [9, 0, 0, 0, 2], [6, 5, 0, 0, 0]], [2, 5, 6, 0]])
check("variable sketch contribution",solve([[(0,N)]],2,[0]),[[[N,0],[0,N],[N,0]],[N]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

A stipulated nonnegative weighted count-min table has exactly three independent rows of positive width, with bucket functions k%w,(3*k+1)%w,(k//w)%w for nonnegative integer keys. Add all block contributions, then estimate each query by the minimum of its three cells. Return [table,estimates]; no probabilistic error guarantee is claimed.

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, width, queries):
    table=[[0]*width for _ in range(3)]
    for block in blocks:
        for key,weight in block:
            buckets=[key%width,(3*key+1)%width,(key//width)%width]
            for row,col in enumerate(buckets):
                table[row][col]+=weight
    estimates=[]
    for key in queries:
        buckets=[key%width,(3*key+1)%width,(key//width)%width]
        estimates.append(min(table[(row+1)%3][col] for row,col in enumerate(buckets)))
    return [table,estimates]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[(0, 2), (1, 3)], [(4, 1)]], 4, [0, 1, 4, 8])), [[[3, 3, 0, 0], [3, 3, 0, 0], [5, 1, 0, 0]], [3, 3, 1, 0]])
check('regression 2', solve(*([], 3, [0, 1])), [[[0, 0, 0], [0, 0, 0], [0, 0, 0]], [0, 0]])
check('regression 3', solve(*([[(2, 5)], [], [(2, 2)]], 3, [2, 5])), [[[0, 0, 7], [0, 7, 0], [7, 0, 0]], [7, 0]])
check('regression 4', solve(*([[(0, 1), (0, 1)]], 1, [0, 3])), [[[2], [2], [2]], [2, 2]])
check('regression 5', solve(*([[(7, 0), (2, 4), (5, 1)]], 4, [2, 5, 7])), [[[0, 1, 4, 0], [1, 0, 0, 4], [4, 1, 0, 0]], [4, 1, 0]])
check('regression 6', solve(*([[(1, 2)], [(8, 5), (3, 4)]], 5, [1, 8, 3, 13])), [[[0, 2, 0, 9, 0], [9, 0, 0, 0, 2], [6, 5, 0, 0, 0]], [2, 5, 6, 0]])
check("variable sketch contribution",solve([[(0,N)]],2,[0]),[[[N,0],[0,N],[N,0]],[N]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(blocks, width, queries):
    table=[[0]*width for _ in range(3)]
    for block in blocks:
        for key,weight in block:
            buckets=[key%width,(3*key+1)%width,(key//width)%width]
            for row,col in enumerate(buckets):
                table[row][col]+=weight
    estimates=[]
    for key in queries:
        buckets=[key%width,(3*key+1)%width,(key//width)%width]
        estimates.append(min(table[row][buckets[0]] for row,col in enumerate(buckets)))
    return [table,estimates]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[(0, 2), (1, 3)], [(4, 1)]], 4, [0, 1, 4, 8])), [[[3, 3, 0, 0], [3, 3, 0, 0], [5, 1, 0, 0]], [3, 3, 1, 0]])
check('regression 2', solve(*([], 3, [0, 1])), [[[0, 0, 0], [0, 0, 0], [0, 0, 0]], [0, 0]])
check('regression 3', solve(*([[(2, 5)], [], [(2, 2)]], 3, [2, 5])), [[[0, 0, 7], [0, 7, 0], [7, 0, 0]], [7, 0]])
check('regression 4', solve(*([[(0, 1), (0, 1)]], 1, [0, 3])), [[[2], [2], [2]], [2, 2]])
check('regression 5', solve(*([[(7, 0), (2, 4), (5, 1)]], 4, [2, 5, 7])), [[[0, 1, 4, 0], [1, 0, 0, 4], [4, 1, 0, 0]], [4, 1, 0]])
check('regression 6', solve(*([[(1, 2)], [(8, 5), (3, 4)]], 5, [1, 8, 3, 13])), [[[0, 2, 0, 9, 0], [9, 0, 0, 0, 2], [6, 5, 0, 0, 0]], [2, 5, 6, 0]])
check("variable sketch contribution",solve([[(0,N)]],2,[0]),[[[N,0],[0,N],[N,0]],[N]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

A stipulated nonnegative weighted count-min table has exactly three independent rows of positive width, with bucket functions k%w,(3*k+1)%w,(k//w)%w for nonnegative integer keys. Add all block contributions, then estimate each query by the minimum of its three cells. Return [table,estimates]; no probabilistic error guarantee is claimed.

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, width, queries):
    table=[[0]*width for _ in range(3)]
    for block in blocks:
        for key,weight in set(map(tuple,block)):
            buckets=[key%width,(3*key+1)%width,(key//width)%width]
            for row,col in enumerate(buckets):
                table[row][col]+=weight
    estimates=[]
    for key in queries:
        buckets=[key%width,(3*key+1)%width,(key//width)%width]
        estimates.append(min(table[row][col] for row,col in enumerate(buckets)))
    return [table,estimates]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[(0, 2), (1, 3)], [(4, 1)]], 4, [0, 1, 4, 8])), [[[3, 3, 0, 0], [3, 3, 0, 0], [5, 1, 0, 0]], [3, 3, 1, 0]])
check('regression 2', solve(*([], 3, [0, 1])), [[[0, 0, 0], [0, 0, 0], [0, 0, 0]], [0, 0]])
check('regression 3', solve(*([[(2, 5)], [], [(2, 2)]], 3, [2, 5])), [[[0, 0, 7], [0, 7, 0], [7, 0, 0]], [7, 0]])
check('regression 4', solve(*([[(0, 1), (0, 1)]], 1, [0, 3])), [[[2], [2], [2]], [2, 2]])
check('regression 5', solve(*([[(7, 0), (2, 4), (5, 1)]], 4, [2, 5, 7])), [[[0, 1, 4, 0], [1, 0, 0, 4], [4, 1, 0, 0]], [4, 1, 0]])
check('regression 6', solve(*([[(1, 2)], [(8, 5), (3, 4)]], 5, [1, 8, 3, 13])), [[[0, 2, 0, 9, 0], [9, 0, 0, 0, 2], [6, 5, 0, 0, 0]], [2, 5, 6, 0]])
check("variable sketch contribution",solve([[(0,N)]],2,[0]),[[[N,0],[0,N],[N,0]],[N]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(blocks, width, queries):
    table=[[0]*width for _ in range(3)]
    for block in blocks:
        for key,weight in dict(block).items():
            buckets=[key%width,(3*key+1)%width,(key//width)%width]
            for row,col in enumerate(buckets):
                table[row][col]+=weight
    estimates=[]
    for key in queries:
        buckets=[key%width,(3*key+1)%width,(key//width)%width]
        estimates.append(min(table[row][col] for row,col in enumerate(buckets)))
    return [table,estimates]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[(0, 2), (1, 3)], [(4, 1)]], 4, [0, 1, 4, 8])), [[[3, 3, 0, 0], [3, 3, 0, 0], [5, 1, 0, 0]], [3, 3, 1, 0]])
check('regression 2', solve(*([], 3, [0, 1])), [[[0, 0, 0], [0, 0, 0], [0, 0, 0]], [0, 0]])
check('regression 3', solve(*([[(2, 5)], [], [(2, 2)]], 3, [2, 5])), [[[0, 0, 7], [0, 7, 0], [7, 0, 0]], [7, 0]])
check('regression 4', solve(*([[(0, 1), (0, 1)]], 1, [0, 3])), [[[2], [2], [2]], [2, 2]])
check('regression 5', solve(*([[(7, 0), (2, 4), (5, 1)]], 4, [2, 5, 7])), [[[0, 1, 4, 0], [1, 0, 0, 4], [4, 1, 0, 0]], [4, 1, 0]])
check('regression 6', solve(*([[(1, 2)], [(8, 5), (3, 4)]], 5, [1, 8, 3, 13])), [[[0, 2, 0, 9, 0], [9, 0, 0, 0, 2], [6, 5, 0, 0, 0]], [2, 5, 6, 0]])
check("variable sketch contribution",solve([[(0,N)]],2,[0]),[[[N,0],[0,N],[N,0]],[N]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

A stipulated nonnegative weighted count-min table has exactly three independent rows of positive width, with bucket functions k%w,(3*k+1)%w,(k//w)%w for nonnegative integer keys. Add all block contributions, then estimate each query by the minimum of its three cells. Return [table,estimates]; no probabilistic error guarantee is claimed.

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, width, queries):
    table=[[0]*width for _ in range(3)]
    for block in blocks:
        for key,weight in block:
            buckets=[key%width,(3*key+1)%width,(key//width)%width]
            for row,col in enumerate(buckets):
                table[row][col]+=weight
    estimates=[]
    for key in queries:
        buckets=[key%width,(3*key+1)%width,(key//width)%width]
        estimates.append(min(min(row) for row in table))
    return [table,estimates]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[(0, 2), (1, 3)], [(4, 1)]], 4, [0, 1, 4, 8])), [[[3, 3, 0, 0], [3, 3, 0, 0], [5, 1, 0, 0]], [3, 3, 1, 0]])
check('regression 2', solve(*([], 3, [0, 1])), [[[0, 0, 0], [0, 0, 0], [0, 0, 0]], [0, 0]])
check('regression 3', solve(*([[(2, 5)], [], [(2, 2)]], 3, [2, 5])), [[[0, 0, 7], [0, 7, 0], [7, 0, 0]], [7, 0]])
check('regression 4', solve(*([[(0, 1), (0, 1)]], 1, [0, 3])), [[[2], [2], [2]], [2, 2]])
check('regression 5', solve(*([[(7, 0), (2, 4), (5, 1)]], 4, [2, 5, 7])), [[[0, 1, 4, 0], [1, 0, 0, 4], [4, 1, 0, 0]], [4, 1, 0]])
check('regression 6', solve(*([[(1, 2)], [(8, 5), (3, 4)]], 5, [1, 8, 3, 13])), [[[0, 2, 0, 9, 0], [9, 0, 0, 0, 2], [6, 5, 0, 0, 0]], [2, 5, 6, 0]])
check("variable sketch contribution",solve([[(0,N)]],2,[0]),[[[N,0],[0,N],[N,0]],[N]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(blocks, width, queries):
    table=[[0]*width for _ in range(3)]
    for block in blocks:
        for key,weight in block:
            buckets=[key%width,(3*key+1)%width,(key//width)%width]
            for row,col in enumerate(buckets):
                table[row][col]+=weight
    estimates=[]
    for key in queries:
        buckets=[key%width,(3*key+1)%width,(key//width)%width]
        estimates.append(min(sum(row) for row in table))
    return [table,estimates]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[(0, 2), (1, 3)], [(4, 1)]], 4, [0, 1, 4, 8])), [[[3, 3, 0, 0], [3, 3, 0, 0], [5, 1, 0, 0]], [3, 3, 1, 0]])
check('regression 2', solve(*([], 3, [0, 1])), [[[0, 0, 0], [0, 0, 0], [0, 0, 0]], [0, 0]])
check('regression 3', solve(*([[(2, 5)], [], [(2, 2)]], 3, [2, 5])), [[[0, 0, 7], [0, 7, 0], [7, 0, 0]], [7, 0]])
check('regression 4', solve(*([[(0, 1), (0, 1)]], 1, [0, 3])), [[[2], [2], [2]], [2, 2]])
check('regression 5', solve(*([[(7, 0), (2, 4), (5, 1)]], 4, [2, 5, 7])), [[[0, 1, 4, 0], [1, 0, 0, 4], [4, 1, 0, 0]], [4, 1, 0]])
check('regression 6', solve(*([[(1, 2)], [(8, 5), (3, 4)]], 5, [1, 8, 3, 13])), [[[0, 2, 0, 9, 0], [9, 0, 0, 0, 2], [6, 5, 0, 0, 0]], [2, 5, 6, 0]])
check("variable sketch contribution",solve([[(0,N)]],2,[0]),[[[N,0],[0,N],[N,0]],[N]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

A stipulated nonnegative weighted count-min table has exactly three independent rows of positive width, with bucket functions k%w,(3*k+1)%w,(k//w)%w for nonnegative integer keys. Add all block contributions, then estimate each query by the minimum of its three cells. Return [table,estimates]; no probabilistic error guarantee is claimed.

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(weights, cap):
    if cap<=0 or any(w<0 for w in weights): return None
    ws=[min(w,cap) for w in weights]
    s=sum(ws)
    q=sum(ws)**2
    return str(Fraction(s*s,q)) if q else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([1, 2, 4], 3)), '18/7')
check('regression 2', solve(*([0, 0], 3)), None)
check('regression 3', solve(*([], 4)), None)
check('regression 4', solve(*([2, 2, 2], 9)), '3')
check('regression 5', solve(*([10, 1], 2)), '9/5')
check('regression 6', solve(*([-1, 2], 3)), None)
check('regression 7', solve(*([1, 3], 0)), None)
check('regression 8', solve(*([0, 2, 5, 1], 4)), '7/3')
check("variable effective-size imbalance",solve([N,1],N+1),str(Fraction((N+1)**2,N*N+1)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(weights, cap):
    if cap<=0 or any(w<0 for w in weights): return None
    ws=[min(w,cap) for w in weights]
    s=sum(ws)
    q=sum(ws)
    return str(Fraction(s*s,q)) if q else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([1, 2, 4], 3)), '18/7')
check('regression 2', solve(*([0, 0], 3)), None)
check('regression 3', solve(*([], 4)), None)
check('regression 4', solve(*([2, 2, 2], 9)), '3')
check('regression 5', solve(*([10, 1], 2)), '9/5')
check('regression 6', solve(*([-1, 2], 3)), None)
check('regression 7', solve(*([1, 3], 0)), None)
check('regression 8', solve(*([0, 2, 5, 1], 4)), '7/3')
check("variable effective-size imbalance",solve([N,1],N+1),str(Fraction((N+1)**2,N*N+1)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

For nonnegative integer importance weights and positive integer cap, clip each weight to cap, then return Kish effective size (sum clipped weights)**2/sum squared clipped weights as exact Fraction string. Negative weight, invalid cap, or zero total yields None.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(weights, cap):
    if cap<=0 or any(w<0 for w in weights): return None
    ws=[min(w,cap) for w in weights]
    s=sum(ws)
    q=sum(w*w for w in ws)
    return str(Fraction(s,q)) if q else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([1, 2, 4], 3)), '18/7')
check('regression 2', solve(*([0, 0], 3)), None)
check('regression 3', solve(*([], 4)), None)
check('regression 4', solve(*([2, 2, 2], 9)), '3')
check('regression 5', solve(*([10, 1], 2)), '9/5')
check('regression 6', solve(*([-1, 2], 3)), None)
check('regression 7', solve(*([1, 3], 0)), None)
check('regression 8', solve(*([0, 2, 5, 1], 4)), '7/3')
check("variable effective-size imbalance",solve([N,1],N+1),str(Fraction((N+1)**2,N*N+1)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(weights, cap):
    if cap<=0 or any(w<0 for w in weights): return None
    ws=[min(w,cap) for w in weights]
    s=sum(ws)
    q=sum(w*w for w in ws)
    return str(Fraction(len(ws)*s,q)) if q else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([1, 2, 4], 3)), '18/7')
check('regression 2', solve(*([0, 0], 3)), None)
check('regression 3', solve(*([], 4)), None)
check('regression 4', solve(*([2, 2, 2], 9)), '3')
check('regression 5', solve(*([10, 1], 2)), '9/5')
check('regression 6', solve(*([-1, 2], 3)), None)
check('regression 7', solve(*([1, 3], 0)), None)
check('regression 8', solve(*([0, 2, 5, 1], 4)), '7/3')
check("variable effective-size imbalance",solve([N,1],N+1),str(Fraction((N+1)**2,N*N+1)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

For nonnegative integer importance weights and positive integer cap, clip each weight to cap, then return Kish effective size (sum clipped weights)**2/sum squared clipped weights as exact Fraction string. Negative weight, invalid cap, or zero total yields None.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(weights, cap):
    if cap<=0 or any(w<0 for w in weights): return None
    ws=[min(w,cap) for w in weights]
    s=sum(ws)
    q=sum(w*w for w in ws)
    return str(Fraction(len(ws))) if q else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([1, 2, 4], 3)), '18/7')
check('regression 2', solve(*([0, 0], 3)), None)
check('regression 3', solve(*([], 4)), None)
check('regression 4', solve(*([2, 2, 2], 9)), '3')
check('regression 5', solve(*([10, 1], 2)), '9/5')
check('regression 6', solve(*([-1, 2], 3)), None)
check('regression 7', solve(*([1, 3], 0)), None)
check('regression 8', solve(*([0, 2, 5, 1], 4)), '7/3')
check("variable effective-size imbalance",solve([N,1],N+1),str(Fraction((N+1)**2,N*N+1)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(weights, cap):
    if cap<=0 or any(w<0 for w in weights): return None
    ws=[min(w,cap) for w in weights]
    s=sum(ws)
    q=sum(w*w for w in ws)
    return str(Fraction(sum(w>0 for w in ws))) if q else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([1, 2, 4], 3)), '18/7')
check('regression 2', solve(*([0, 0], 3)), None)
check('regression 3', solve(*([], 4)), None)
check('regression 4', solve(*([2, 2, 2], 9)), '3')
check('regression 5', solve(*([10, 1], 2)), '9/5')
check('regression 6', solve(*([-1, 2], 3)), None)
check('regression 7', solve(*([1, 3], 0)), None)
check('regression 8', solve(*([0, 2, 5, 1], 4)), '7/3')
check("variable effective-size imbalance",solve([N,1],N+1),str(Fraction((N+1)**2,N*N+1)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

For nonnegative integer importance weights and positive integer cap, clip each weight to cap, then return Kish effective size (sum clipped weights)**2/sum squared clipped weights as exact Fraction string. Negative weight, invalid cap, or zero total yields None.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(weights, cap):
    if cap<=0 or any(w<0 for w in weights): return None
    ws=list(weights)
    if sum(ws)>cap: ws=[cap]
    s=sum(ws)
    q=sum(w*w for w in ws)
    return str(Fraction(s*s,q)) if q else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([1, 2, 4], 3)), '18/7')
check('regression 2', solve(*([0, 0], 3)), None)
check('regression 3', solve(*([], 4)), None)
check('regression 4', solve(*([2, 2, 2], 9)), '3')
check('regression 5', solve(*([10, 1], 2)), '9/5')
check('regression 6', solve(*([-1, 2], 3)), None)
check('regression 7', solve(*([1, 3], 0)), None)
check('regression 8', solve(*([0, 2, 5, 1], 4)), '7/3')
check("variable effective-size imbalance",solve([N,1],N+1),str(Fraction((N+1)**2,N*N+1)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(weights, cap):
    if cap<=0 or any(w<0 for w in weights): return None
    ws=[min(sum(weights),cap)] if weights else []
    s=sum(ws)
    q=sum(w*w for w in ws)
    return str(Fraction(s*s,q)) if q else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([1, 2, 4], 3)), '18/7')
check('regression 2', solve(*([0, 0], 3)), None)
check('regression 3', solve(*([], 4)), None)
check('regression 4', solve(*([2, 2, 2], 9)), '3')
check('regression 5', solve(*([10, 1], 2)), '9/5')
check('regression 6', solve(*([-1, 2], 3)), None)
check('regression 7', solve(*([1, 3], 0)), None)
check('regression 8', solve(*([0, 2, 5, 1], 4)), '7/3')
check("variable effective-size imbalance",solve([N,1],N+1),str(Fraction((N+1)**2,N*N+1)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

For nonnegative integer importance weights and positive integer cap, clip each weight to cap, then return Kish effective size (sum clipped weights)**2/sum squared clipped weights as exact Fraction string. Negative weight, invalid cap, or zero total yields None.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(weights, cap):
    if cap<=0 or any(w<0 for w in weights): return None
    ws=[min(w,cap) for w in weights]
    s=sum(weights)
    q=sum(w*w for w in ws)
    return str(Fraction(s*s,q)) if q else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([1, 2, 4], 3)), '18/7')
check('regression 2', solve(*([0, 0], 3)), None)
check('regression 3', solve(*([], 4)), None)
check('regression 4', solve(*([2, 2, 2], 9)), '3')
check('regression 5', solve(*([10, 1], 2)), '9/5')
check('regression 6', solve(*([-1, 2], 3)), None)
check('regression 7', solve(*([1, 3], 0)), None)
check('regression 8', solve(*([0, 2, 5, 1], 4)), '7/3')
check("variable effective-size imbalance",solve([N,1],N+1),str(Fraction((N+1)**2,N*N+1)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(weights, cap):
    if cap<=0 or any(w<0 for w in weights): return None
    ws=[min(w,cap) for w in weights]
    s=sum(min(w,cap*cap) for w in weights)
    q=sum(w*w for w in ws)
    return str(Fraction(s*s,q)) if q else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([1, 2, 4], 3)), '18/7')
check('regression 2', solve(*([0, 0], 3)), None)
check('regression 3', solve(*([], 4)), None)
check('regression 4', solve(*([2, 2, 2], 9)), '3')
check('regression 5', solve(*([10, 1], 2)), '9/5')
check('regression 6', solve(*([-1, 2], 3)), None)
check('regression 7', solve(*([1, 3], 0)), None)
check('regression 8', solve(*([0, 2, 5, 1], 4)), '7/3')
check("variable effective-size imbalance",solve([N,1],N+1),str(Fraction((N+1)**2,N*N+1)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

For nonnegative integer importance weights and positive integer cap, clip each weight to cap, then return Kish effective size (sum clipped weights)**2/sum squared clipped weights as exact Fraction string. Negative weight, invalid cap, or zero total yields None.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(weights, cap):
    if cap<=0 or any(w<0 for w in weights): return None
    ws=[min(w,cap) for w in weights]
    s=sum(ws)
    q=sum(min(w*w,cap) for w in weights)
    return str(Fraction(s*s,q)) if q else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([1, 2, 4], 3)), '18/7')
check('regression 2', solve(*([0, 0], 3)), None)
check('regression 3', solve(*([], 4)), None)
check('regression 4', solve(*([2, 2, 2], 9)), '3')
check('regression 5', solve(*([10, 1], 2)), '9/5')
check('regression 6', solve(*([-1, 2], 3)), None)
check('regression 7', solve(*([1, 3], 0)), None)
check('regression 8', solve(*([0, 2, 5, 1], 4)), '7/3')
check("variable effective-size imbalance",solve([N,1],N+1),str(Fraction((N+1)**2,N*N+1)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(weights, cap):
    if cap<=0 or any(w<0 for w in weights): return None
    ws=[min(w,cap) for w in weights]
    s=sum(ws)
    q=sum(min(w*w,cap*cap) for w in weights)//max(1,cap)
    return str(Fraction(s*s,q)) if q else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([1, 2, 4], 3)), '18/7')
check('regression 2', solve(*([0, 0], 3)), None)
check('regression 3', solve(*([], 4)), None)
check('regression 4', solve(*([2, 2, 2], 9)), '3')
check('regression 5', solve(*([10, 1], 2)), '9/5')
check('regression 6', solve(*([-1, 2], 3)), None)
check('regression 7', solve(*([1, 3], 0)), None)
check('regression 8', solve(*([0, 2, 5, 1], 4)), '7/3')
check("variable effective-size imbalance",solve([N,1],N+1),str(Fraction((N+1)**2,N*N+1)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

For nonnegative integer importance weights and positive integer cap, clip each weight to cap, then return Kish effective size (sum clipped weights)**2/sum squared clipped weights as exact Fraction string. Negative weight, invalid cap, or zero total yields None.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(weights, cap):
    if cap<=0 or any(w<0 for w in weights): return None
    ws=[min(w,cap) for w in weights]
    s=sum(ws)
    q=sum(w*w for w in ws)
    return str(Fraction(q,s*s)) if q else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([1, 2, 4], 3)), '18/7')
check('regression 2', solve(*([0, 0], 3)), None)
check('regression 3', solve(*([], 4)), None)
check('regression 4', solve(*([2, 2, 2], 9)), '3')
check('regression 5', solve(*([10, 1], 2)), '9/5')
check('regression 6', solve(*([-1, 2], 3)), None)
check('regression 7', solve(*([1, 3], 0)), None)
check('regression 8', solve(*([0, 2, 5, 1], 4)), '7/3')
check("variable effective-size imbalance",solve([N,1],N+1),str(Fraction((N+1)**2,N*N+1)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(weights, cap):
    if cap<=0 or any(w<0 for w in weights): return None
    ws=[min(w,cap) for w in weights]
    s=sum(ws)
    q=sum(w*w for w in ws)
    return str(Fraction(s*s-q,s*s)) if q else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([1, 2, 4], 3)), '18/7')
check('regression 2', solve(*([0, 0], 3)), None)
check('regression 3', solve(*([], 4)), None)
check('regression 4', solve(*([2, 2, 2], 9)), '3')
check('regression 5', solve(*([10, 1], 2)), '9/5')
check('regression 6', solve(*([-1, 2], 3)), None)
check('regression 7', solve(*([1, 3], 0)), None)
check('regression 8', solve(*([0, 2, 5, 1], 4)), '7/3')
check("variable effective-size imbalance",solve([N,1],N+1),str(Fraction((N+1)**2,N*N+1)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

For nonnegative integer importance weights and positive integer cap, clip each weight to cap, then return Kish effective size (sum clipped weights)**2/sum squared clipped weights as exact Fraction string. Negative weight, invalid cap, or zero total yields None.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(weights, cap):
    if cap<=0: return None
    weights=[abs(w) for w in weights]
    ws=[min(w,cap) for w in weights]
    s=sum(ws)
    q=sum(w*w for w in ws)
    return str(Fraction(s*s,q)) if q else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([1, 2, 4], 3)), '18/7')
check('regression 2', solve(*([0, 0], 3)), None)
check('regression 3', solve(*([], 4)), None)
check('regression 4', solve(*([2, 2, 2], 9)), '3')
check('regression 5', solve(*([10, 1], 2)), '9/5')
check('regression 6', solve(*([-1, 2], 3)), None)
check('regression 7', solve(*([1, 3], 0)), None)
check('regression 8', solve(*([0, 2, 5, 1], 4)), '7/3')
check("variable effective-size imbalance",solve([N,1],N+1),str(Fraction((N+1)**2,N*N+1)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(weights, cap):
    if cap<=0: return None
    weights=[max(0,w) for w in weights]
    ws=[min(w,cap) for w in weights]
    s=sum(ws)
    q=sum(w*w for w in ws)
    return str(Fraction(s*s,q)) if q else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([1, 2, 4], 3)), '18/7')
check('regression 2', solve(*([0, 0], 3)), None)
check('regression 3', solve(*([], 4)), None)
check('regression 4', solve(*([2, 2, 2], 9)), '3')
check('regression 5', solve(*([10, 1], 2)), '9/5')
check('regression 6', solve(*([-1, 2], 3)), None)
check('regression 7', solve(*([1, 3], 0)), None)
check('regression 8', solve(*([0, 2, 5, 1], 4)), '7/3')
check("variable effective-size imbalance",solve([N,1],N+1),str(Fraction((N+1)**2,N*N+1)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

For nonnegative integer importance weights and positive integer cap, clip each weight to cap, then return Kish effective size (sum clipped weights)**2/sum squared clipped weights as exact Fraction string. Negative weight, invalid cap, or zero total yields None.

split: open-access