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

N = 1
observations = []
def solve(rows):
    return min(rows, key=lambda r:(r[1],r[0]))[0] if rows else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeat bye excluded', solve([(1,0,True),(2,N,False)]), 2)
check('score precedes id', solve([(1,N+1,False),(2,N,False)]), 2)
check('id breaks tie', solve([(3,N,False),(2,N,False)]), 2)
check('empty', solve([]), None)
check('all ineligible', solve([(1,N,True)]), None)
check('single', solve([(8,N,False)]), 8)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(rows):
    eligible=[r for r in rows if not r[2]]
    return min(eligible, key=lambda r:r[0])[0] if eligible else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeat bye excluded', solve([(1,0,True),(2,N,False)]), 2)
check('score precedes id', solve([(1,N+1,False),(2,N,False)]), 2)
check('id breaks tie', solve([(3,N,False),(2,N,False)]), 2)
check('empty', solve([]), None)
check('all ineligible', solve([(1,N,True)]), None)
check('single', solve([(8,N,False)]), 8)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Bye selection ignores prior byes.

Synthetic model: Rows are (id,score,has_prior_bye). Return the eligible id with lowest score then id, or None.

split: open-access


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

N = 1
observations = []
def solve(players, forbidden):
    remaining=list(players)
    pairs=[]
    while remaining:
        a=remaining.pop(0)
        choices=[b for b in remaining if sorted([a,b]) not in forbidden]
        if not choices: return None
        b=choices[0]; remaining.remove(b); pairs.append([a,b])
    return pairs
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('greedy dead end', solve([N,N+1,N+2,N+3], [[N+2,N+3]]), [[N,N+2],[N+1,N+3]])
check('canonical matching', solve([N,N+1,N+2,N+3], []), [[N,N+1],[N+2,N+3]])
check('empty', solve([], []), [])
check('odd count', solve([N], []), None)
check('forbidden pair', solve([N,N+1], [[N,N+1]]), None)
check('single pair', solve([N,N+1], []), [[N,N+1]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

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

N = 1
observations = []
def solve(players, forbidden):
    remaining=list(players)
    pairs=[]
    while remaining:
        a=remaining.pop(0)
        choices=[b for b in remaining if sorted([a,b]) not in forbidden]
        if not choices: return None
        b=choices[-1]; remaining.remove(b); pairs.append([a,b])
    return pairs
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('greedy dead end', solve([N,N+1,N+2,N+3], [[N+2,N+3]]), [[N,N+2],[N+1,N+3]])
check('canonical matching', solve([N,N+1,N+2,N+3], []), [[N,N+1],[N+2,N+3]])
check('empty', solve([], []), [])
check('odd count', solve([N], []), None)
check('forbidden pair', solve([N,N+1], [[N,N+1]]), None)
check('single pair', solve([N,N+1], []), [[N,N+1]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Greedy pairing strands the final entrants.

Synthetic model: Distinct players are sorted ids; forbidden pairs are sorted lists. Return the first complete legal pairing in ascending opponent search order, or None.

split: open-access


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

N = 1
observations = []
def solve(opponents, scores):
    return sum(scores[x] for x in set(opponents))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeat encounter', solve(['a','a'], {'a':N}), 2*N)
check('penalty score', solve(['a'], {'a':-N}), -N)
check('empty', solve([], {}), 0)
check('zero', solve(['a'], {'a':0}), 0)
check('mixed', solve(['a','b','a'], {'a':N,'b':2}), 2*N+2)
check('cancel', solve(['a','b'], {'a':N,'b':-N}), 0)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

evaluation_group: tournament-encounter-score-contribution

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

N = 1
observations = []
def solve(opponents, scores):
    return sum(scores[x] for x in opponents if scores[x]>0)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeat encounter', solve(['a','a'], {'a':N}), 2*N)
check('penalty score', solve(['a'], {'a':-N}), -N)
check('empty', solve([], {}), 0)
check('zero', solve(['a'], {'a':0}), 0)
check('mixed', solve(['a','b','a'], {'a':N,'b':2}), 2*N+2)
check('cancel', solve(['a','b'], {'a':N,'b':-N}), 0)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Opponent tiebreak drops repeat encounters.

Synthetic model: Sum the final integer score of each opponent occurrence; repeats and negative penalty-adjusted scores count.

split: open-access


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

N = 1
observations = []
def solve(scores):
    return sum(x for x in scores if x!=min(scores)) if scores else 0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('tied minimum', solve([N,N,N+2]), 2*N+2)
check('all equal', solve([N,N,N]), 2*N)
check('singleton', solve([N]), 0)
check('empty', solve([]), 0)
check('negative', solve([-N,-N,2]), 2-N)
check('distinct', solve([N,N+1,N+2]), 2*N+3)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(scores):
    return sum(sorted(set(scores))[1:])
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('tied minimum', solve([N,N,N+2]), 2*N+2)
check('all equal', solve([N,N,N]), 2*N)
check('singleton', solve([N]), 0)
check('empty', solve([]), 0)
check('negative', solve([-N,-N,2]), 2-N)
check('distinct', solve([N,N+1,N+2]), 2*N+3)
print(json.dumps({"observations": observations, "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:
Cut tiebreak removes every tied minimum.

Synthetic model: Discard exactly one lowest opponent-score occurrence and sum the rest; empty and singleton lists return zero.

split: open-access


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

N = 1
observations = []
def solve(players, games):
    points={p:0 for p in players}
    for a,b,w in games:
        if a in points and b in points: points[w]+=1
    return sorted(players,key=lambda p:(-points[p],p))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('missing encounter', solve([N,N+1,N+2], [(N,N+1,N)]), None)
check('duplicates hide missing', solve([N,N+1,N+2], [(N,N+1,N)]*3), None)
check('outsider does not fill gap', solve([N,N+1], [(N+2,N+3,N+2)]), None)
check('complete two', solve([N,N+1], [(N,N+1,N+1)]), [N+1,N])
check('singleton', solve([N], []), [N])
check('empty', solve([], []), [])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(players, games):
    points={p:0 for p in players}
    for a,b,w in games:
        if a in points and b in points: points[w]+=1
    if len(games)<len(players)*(len(players)-1)//2: return None
    return sorted(players,key=lambda p:(-points[p],p))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('missing encounter', solve([N,N+1,N+2], [(N,N+1,N)]), None)
check('duplicates hide missing', solve([N,N+1,N+2], [(N,N+1,N)]*3), None)
check('outsider does not fill gap', solve([N,N+1], [(N+2,N+3,N+2)]), None)
check('complete two', solve([N,N+1], [(N,N+1,N+1)]), [N+1,N])
check('singleton', solve([N], []), [N])
check('empty', solve([], []), [])
print(json.dumps({"observations": observations, "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:
Incomplete mini-league produces a head-to-head ranking.

Synthetic model: Games contain distinct endpoints and an endpoint winner. Rank by wins then id only when every unordered pair in players has met; otherwise None. Outside games are ignored.

split: open-access


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

N = 1
observations = []
def solve(results):
    return sum(3 if r=='W' else 0 if r=='L' else 1 for r in results)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('pending', solve(["P"]*N), 0)
check('bye', solve(["B"]*N), 3*N)
check('draw', solve(["D"]*N), N)
check('win', solve(["W"]*N), 3*N)
check('loss', solve(["L"]*N), 0)
check('mixed', solve(["W","D","P","B","L"]*N), 7*N)
check('empty', solve([]), 0)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(results):
    return sum(3 if r=='W' else 1 if r in ('D','B') else 0 for r in results)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('pending', solve(["P"]*N), 0)
check('bye', solve(["B"]*N), 3*N)
check('draw', solve(["D"]*N), N)
check('win', solve(["W"]*N), 3*N)
check('loss', solve(["L"]*N), 0)
check('mixed', solve(["W","D","P","B","L"]*N), 7*N)
check('empty', solve([]), 0)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Unplayed results are credited as draws.

Synthetic model: Result codes W,D,L,P,B award 3,1,0,0,3 points respectively; total all supplied records.

split: open-access


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

N = 1
observations = []
def solve(size, offset):
    return list(range(offset+1,offset+size+1))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('one', solve(1,N), [N+1])
check('two', solve(2,N), [N+1,N+2])
check('four', solve(4,N), [N+1,N+4,N+2,N+3])
check('eight', solve(8,N), [N+1,N+8,N+4,N+5,N+2,N+7,N+3,N+6])
check('zero offset', solve(4,0), [1,4,2,3])
check('negative offset', solve(4,-N), [1-N,4-N,2-N,3-N])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(size, offset):
    return [offset+x for i in range(1,size//2+1) for x in (i,size+1-i)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('one', solve(1,N), [N+1])
check('two', solve(2,N), [N+1,N+2])
check('four', solve(4,N), [N+1,N+4,N+2,N+3])
check('eight', solve(8,N), [N+1,N+8,N+4,N+5,N+2,N+7,N+3,N+6])
check('zero offset', solve(4,0), [1,4,2,3])
check('negative offset', solve(4,-N), [1-N,4-N,2-N,3-N])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Adjacent seed placement makes top seeds meet early.

Synthetic model: For size a positive power of two, start with [1] and repeatedly replace each seed s by [s,2*current_length+1-s]; add offset to each slot label.

split: open-access


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

N = 1
observations = []
def solve(encounters, records):
    return sum(records[p][0] for p in encounters if records[p][1])
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('withdrawn', solve(['a'], {'a':(N,False)}), N)
check('penalty', solve(['a'], {'a':(-N,False)}), -N)
check('active', solve(['a'], {'a':(N,True)}), N)
check('mixed', solve(['a','b'], {'a':(N,False),'b':(2,True)}), N+2)
check('empty', solve([], {}), 0)
check('zero withdrawn', solve(['a'], {'a':(0,False)}), 0)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

evaluation_group: tournament-encounter-score-contribution

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

N = 1
observations = []
def solve(encounters, records):
    return sum(max(0,records[p][0]) for p in encounters)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('withdrawn', solve(['a'], {'a':(N,False)}), N)
check('penalty', solve(['a'], {'a':(-N,False)}), -N)
check('active', solve(['a'], {'a':(N,True)}), N)
check('mixed', solve(['a','b'], {'a':(N,False),'b':(2,True)}), N+2)
check('empty', solve([], {}), 0)
check('zero withdrawn', solve(['a'], {'a':(0,False)}), 0)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Withdrawn opponents disappear from historical tiebreaks.

Synthetic model: Each encounter contributes its opponent final signed score, regardless of the current active flag in (score,active) records.

split: open-access


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

N = 1
observations = []
def solve(history, next_color):
    return abs(history.count('W')-history.count('B')+(1 if next_color=='W' else -1))<=2
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('third same after balance', solve("B"*N+"WW", "W"), False)
check('second allowed', solve("W", "W"), True)
check('empty', solve("", "B"), True)
check('switch', solve("WW", "B"), True)
check('black third', solve("W"*N+"BB", "B"), False)
check('alternating', solve("WB"*N, "W"), True)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(history, next_color):
    return not (history and history[-1]==next_color)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('third same after balance', solve("B"*N+"WW", "W"), False)
check('second allowed', solve("W", "W"), True)
check('empty', solve("", "B"), True)
check('switch', solve("WW", "B"), True)
check('black third', solve("W"*N+"BB", "B"), False)
check('alternating', solve("WB"*N, "W"), True)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Pair orientation checks total balance but misses streak bans.

Synthetic model: Return whether appending W or B avoids a run of three identical colors. Only the final two historical colors matter; total balance is not a rule in this model.

split: open-access


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

N = 1
observations = []
def solve(slots, eligible):
    return [p for p in slots if p in eligible]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('left vacancy', solve([N,N+1], [N+1]), [None,N+1])
check('right vacancy', solve([N,N+1], [N]), [N,None])
check('both vacant', solve([N,N+1], []), [None,None])
check('both eligible', solve([N,N+1], [N,N+1]), [N,N+1])
check('outsider never fills slot', solve([N,N+1], [N+2]), [None,None])
check('empty bracket', solve([], [N]), [])
check('nonadjacent vacancies', solve([N,N+1,N+2,N+3], [N+1,N+3]), [None,N+1,None,N+3])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(slots, eligible):
    return [p if p in eligible else next(iter(sorted(eligible)), None) for p in slots]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('left vacancy', solve([N,N+1], [N+1]), [None,N+1])
check('right vacancy', solve([N,N+1], [N]), [N,None])
check('both vacant', solve([N,N+1], []), [None,None])
check('both eligible', solve([N,N+1], [N,N+1]), [N,N+1])
check('outsider never fills slot', solve([N,N+1], [N+2]), [None,None])
check('empty bracket', solve([], [N]), [])
check('nonadjacent vacancies', solve([N,N+1,N+2,N+3], [N+1,N+3]), [None,N+1,None,N+3])
print(json.dumps({"observations": observations, "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:
Disqualification shifts a bracket replacement into the wrong slot.

Synthetic model: Slots contain distinct qualified player ids in fixed bracket positions. Keep eligible occupants at their original index and replace every ineligible occupant with None; eligibility alone grants no new slot.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(xs):
    return [max(0,sum(xs)),min(0,sum(xs)),xs.count(0)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([3, -2, 0, 3, -4, 0],)), [6, -6, 2])
check('regression 2', solve(*([],)), [0, 0, 0])
check('regression 3', solve(*([0, 0, 0],)), [0, 0, 3])
check('regression 4', solve(*([-8, -2],)), [0, -10, 0])
check('regression 5', solve(*([2, 2, 7],)), [11, 0, 0])
check("variable signed channels", solve([N,-N,0,N]), [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(xs):
    return [abs(sum(xs)), -abs(sum(xs)), xs.count(0)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([3, -2, 0, 3, -4, 0],)), [6, -6, 2])
check('regression 2', solve(*([],)), [0, 0, 0])
check('regression 3', solve(*([0, 0, 0],)), [0, 0, 3])
check('regression 4', solve(*([-8, -2],)), [0, -10, 0])
check('regression 5', solve(*([2, 2, 7],)), [11, 0, 0])
check("variable signed channels", solve([N,-N,0,N]), [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.

Return [positive total, negative total, zero count] for an integer sequence; preserve signs and multiplicity.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(xs):
    return [sum(x for x in xs if x>0),sum(abs(x) for x in xs if x<0),xs.count(0)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([3, -2, 0, 3, -4, 0],)), [6, -6, 2])
check('regression 2', solve(*([],)), [0, 0, 0])
check('regression 3', solve(*([0, 0, 0],)), [0, 0, 3])
check('regression 4', solve(*([-8, -2],)), [0, -10, 0])
check('regression 5', solve(*([2, 2, 7],)), [11, 0, 0])
check("variable signed channels", solve([N,-N,0,N]), [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(xs):
    return [-sum(x for x in xs if x>0),sum(x for x in xs if x<0),xs.count(0)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([3, -2, 0, 3, -4, 0],)), [6, -6, 2])
check('regression 2', solve(*([],)), [0, 0, 0])
check('regression 3', solve(*([0, 0, 0],)), [0, 0, 3])
check('regression 4', solve(*([-8, -2],)), [0, -10, 0])
check('regression 5', solve(*([2, 2, 7],)), [11, 0, 0])
check("variable signed channels", solve([N,-N,0,N]), [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.

Return [positive total, negative total, zero count] for an integer sequence; preserve signs and multiplicity.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(xs):
    return [sum(x for x in set(xs) if x>0),sum(x for x in set(xs) if x<0),xs.count(0)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([3, -2, 0, 3, -4, 0],)), [6, -6, 2])
check('regression 2', solve(*([],)), [0, 0, 0])
check('regression 3', solve(*([0, 0, 0],)), [0, 0, 3])
check('regression 4', solve(*([-8, -2],)), [0, -10, 0])
check('regression 5', solve(*([2, 2, 7],)), [11, 0, 0])
check("variable signed channels", solve([N,-N,0,N]), [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(xs):
    return [sum(x for x in xs if x>0),sum(x for x in set(xs) if x<0),int(0 in xs)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([3, -2, 0, 3, -4, 0],)), [6, -6, 2])
check('regression 2', solve(*([],)), [0, 0, 0])
check('regression 3', solve(*([0, 0, 0],)), [0, 0, 3])
check('regression 4', solve(*([-8, -2],)), [0, -10, 0])
check('regression 5', solve(*([2, 2, 7],)), [11, 0, 0])
check("variable signed channels", solve([N,-N,0,N]), [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.

Return [positive total, negative total, zero count] for an integer sequence; preserve signs and multiplicity.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(xs):
    return [sum(x for x in xs if x>0),sum(x for x in xs if x<0),int(0 in xs)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([3, -2, 0, 3, -4, 0],)), [6, -6, 2])
check('regression 2', solve(*([],)), [0, 0, 0])
check('regression 3', solve(*([0, 0, 0],)), [0, 0, 3])
check('regression 4', solve(*([-8, -2],)), [0, -10, 0])
check('regression 5', solve(*([2, 2, 7],)), [11, 0, 0])
check("variable signed channels", solve([N,-N,0,N]), [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(xs):
    return [sum(x for x in xs if x>0),sum(x for x in xs if x<0),len(set(xs))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([3, -2, 0, 3, -4, 0],)), [6, -6, 2])
check('regression 2', solve(*([],)), [0, 0, 0])
check('regression 3', solve(*([0, 0, 0],)), [0, 0, 3])
check('regression 4', solve(*([-8, -2],)), [0, -10, 0])
check('regression 5', solve(*([2, 2, 7],)), [11, 0, 0])
check("variable signed channels", solve([N,-N,0,N]), [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.

Return [positive total, negative total, zero count] for an integer sequence; preserve signs and multiplicity.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(xs):
    return [next((x for x in reversed(xs) if x>0),0),next((x for x in reversed(xs) if x<0),0),xs.count(0)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([3, -2, 0, 3, -4, 0],)), [6, -6, 2])
check('regression 2', solve(*([],)), [0, 0, 0])
check('regression 3', solve(*([0, 0, 0],)), [0, 0, 3])
check('regression 4', solve(*([-8, -2],)), [0, -10, 0])
check('regression 5', solve(*([2, 2, 7],)), [11, 0, 0])
check("variable signed channels", solve([N,-N,0,N]), [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(xs):
    return [max([0]+xs),min([0]+xs),xs.count(0)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([3, -2, 0, 3, -4, 0],)), [6, -6, 2])
check('regression 2', solve(*([],)), [0, 0, 0])
check('regression 3', solve(*([0, 0, 0],)), [0, 0, 3])
check('regression 4', solve(*([-8, -2],)), [0, -10, 0])
check('regression 5', solve(*([2, 2, 7],)), [11, 0, 0])
check("variable signed channels", solve([N,-N,0,N]), [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.

Return [positive total, negative total, zero count] for an integer sequence; preserve signs and multiplicity.

split: open-access


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

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(xs, anchor):
    return sum(abs(abs(x)-anchor) for x in xs)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([1, 5, 9], 5)), 8)
check('regression 2', solve(*([], 4)), 0)
check('regression 3', solve(*([4, 4], 4)), 0)
check('regression 4', solve(*([-3, -1], 2)), 8)
check('regression 5', solve(*([0, 0, 6], 1)), 7)
check("variable anchor", solve([N-3,N+2,N+2],N),7)
print(json.dumps({"observations": observations, "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.

Return sum(abs(x-anchor)); empty input returns zero. Anchor is supplied, not estimated.

split: open-access


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

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(xs, anchor):
    return abs(sum(xs)-anchor*len(xs))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([1, 5, 9], 5)), 8)
check('regression 2', solve(*([], 4)), 0)
check('regression 3', solve(*([4, 4], 4)), 0)
check('regression 4', solve(*([-3, -1], 2)), 8)
check('regression 5', solve(*([0, 0, 6], 1)), 7)
check("variable anchor", solve([N-3,N+2,N+2],N),7)
print(json.dumps({"observations": observations, "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.

Return sum(abs(x-anchor)); empty input returns zero. Anchor is supplied, not estimated.

split: open-access


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

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(xs, anchor):
    return sum(abs(max(0,x)-anchor) for x in xs)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([1, 5, 9], 5)), 8)
check('regression 2', solve(*([], 4)), 0)
check('regression 3', solve(*([4, 4], 4)), 0)
check('regression 4', solve(*([-3, -1], 2)), 8)
check('regression 5', solve(*([0, 0, 6], 1)), 7)
check("variable anchor", solve([N-3,N+2,N+2],N),7)
print(json.dumps({"observations": observations, "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.

Return sum(abs(x-anchor)); empty input returns zero. Anchor is supplied, not estimated.

split: open-access


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

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(xs, anchor):
    return sum(abs(x-xs[0]) for x in xs) if xs else 0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([1, 5, 9], 5)), 8)
check('regression 2', solve(*([], 4)), 0)
check('regression 3', solve(*([4, 4], 4)), 0)
check('regression 4', solve(*([-3, -1], 2)), 8)
check('regression 5', solve(*([0, 0, 6], 1)), 7)
check("variable anchor", solve([N-3,N+2,N+2],N),7)
print(json.dumps({"observations": observations, "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.

Return sum(abs(x-anchor)); empty input returns zero. Anchor is supplied, not estimated.

split: open-access


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

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(xs, anchor):
    return (max(xs)-min(xs))*len(xs) if xs else 0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([1, 5, 9], 5)), 8)
check('regression 2', solve(*([], 4)), 0)
check('regression 3', solve(*([4, 4], 4)), 0)
check('regression 4', solve(*([-3, -1], 2)), 8)
check('regression 5', solve(*([0, 0, 6], 1)), 7)
check("variable anchor", solve([N-3,N+2,N+2],N),7)
print(json.dumps({"observations": observations, "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.

Return sum(abs(x-anchor)); empty input returns zero. Anchor is supplied, not estimated.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(xs, lo, hi):
    return min(hi,max(lo,sum(xs))) if xs else 0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([-9, 2, 8], 0, 5)), 7)
check('regression 2', solve(*([], 1, 3)), 0)
check('regression 3', solve(*([1, 2, 3], 0, 5)), 6)
check('regression 4', solve(*([-4, -2], -3, -1)), -5)
check('regression 5', solve(*([0, 0, 9], 2, 4)), 8)
check("variable cap", solve([0,N,N*4],1,N+1),2*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(xs, lo, hi):
    return min(hi*len(xs),max(lo*len(xs),sum(xs)))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([-9, 2, 8], 0, 5)), 7)
check('regression 2', solve(*([], 1, 3)), 0)
check('regression 3', solve(*([1, 2, 3], 0, 5)), 6)
check('regression 4', solve(*([-4, -2], -3, -1)), -5)
check('regression 5', solve(*([0, 0, 9], 2, 4)), 8)
check("variable cap", solve([0,N,N*4],1,N+1),2*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.

For lo<=hi, clip each integer contribution into [lo,hi], then sum. Empty is zero.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(xs, lo, hi):
    return sum(x for x in xs if lo<=x<=hi)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([-9, 2, 8], 0, 5)), 7)
check('regression 2', solve(*([], 1, 3)), 0)
check('regression 3', solve(*([1, 2, 3], 0, 5)), 6)
check('regression 4', solve(*([-4, -2], -3, -1)), -5)
check('regression 5', solve(*([0, 0, 9], 2, 4)), 8)
check("variable cap", solve([0,N,N*4],1,N+1),2*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(xs, lo, hi):
    return sum(min(hi,x) for x in xs if x>=lo)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([-9, 2, 8], 0, 5)), 7)
check('regression 2', solve(*([], 1, 3)), 0)
check('regression 3', solve(*([1, 2, 3], 0, 5)), 6)
check('regression 4', solve(*([-4, -2], -3, -1)), -5)
check('regression 5', solve(*([0, 0, 9], 2, 4)), 8)
check("variable cap", solve([0,N,N*4],1,N+1),2*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.

For lo<=hi, clip each integer contribution into [lo,hi], then sum. Empty is zero.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(xs, lo, hi):
    return sum(max(lo,x) for x in xs)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([-9, 2, 8], 0, 5)), 7)
check('regression 2', solve(*([], 1, 3)), 0)
check('regression 3', solve(*([1, 2, 3], 0, 5)), 6)
check('regression 4', solve(*([-4, -2], -3, -1)), -5)
check('regression 5', solve(*([0, 0, 9], 2, 4)), 8)
check("variable cap", solve([0,N,N*4],1,N+1),2*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(xs, lo, hi):
    return min(hi,sum(max(lo,x) for x in xs)) if xs else 0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([-9, 2, 8], 0, 5)), 7)
check('regression 2', solve(*([], 1, 3)), 0)
check('regression 3', solve(*([1, 2, 3], 0, 5)), 6)
check('regression 4', solve(*([-4, -2], -3, -1)), -5)
check('regression 5', solve(*([0, 0, 9], 2, 4)), 8)
check("variable cap", solve([0,N,N*4],1,N+1),2*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.

For lo<=hi, clip each integer contribution into [lo,hi], then sum. Empty is zero.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(xs, lo, hi):
    return sum(min(hi,x) for x in xs)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([-9, 2, 8], 0, 5)), 7)
check('regression 2', solve(*([], 1, 3)), 0)
check('regression 3', solve(*([1, 2, 3], 0, 5)), 6)
check('regression 4', solve(*([-4, -2], -3, -1)), -5)
check('regression 5', solve(*([0, 0, 9], 2, 4)), 8)
check("variable cap", solve([0,N,N*4],1,N+1),2*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(xs, lo, hi):
    return max(lo,sum(min(hi,x) for x in xs)) if xs else 0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([-9, 2, 8], 0, 5)), 7)
check('regression 2', solve(*([], 1, 3)), 0)
check('regression 3', solve(*([1, 2, 3], 0, 5)), 6)
check('regression 4', solve(*([-4, -2], -3, -1)), -5)
check('regression 5', solve(*([0, 0, 9], 2, 4)), 8)
check("variable cap", solve([0,N,N*4],1,N+1),2*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.

For lo<=hi, clip each integer contribution into [lo,hi], then sum. Empty is zero.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(xs, lo, hi):
    return sum(max(-hi,min(hi,x)) for x in xs)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([-9, 2, 8], 0, 5)), 7)
check('regression 2', solve(*([], 1, 3)), 0)
check('regression 3', solve(*([1, 2, 3], 0, 5)), 6)
check('regression 4', solve(*([-4, -2], -3, -1)), -5)
check('regression 5', solve(*([0, 0, 9], 2, 4)), 8)
check("variable cap", solve([0,N,N*4],1,N+1),2*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(xs, lo, hi):
    return sum(max(lo,min(-lo,x)) for x in xs)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([-9, 2, 8], 0, 5)), 7)
check('regression 2', solve(*([], 1, 3)), 0)
check('regression 3', solve(*([1, 2, 3], 0, 5)), 6)
check('regression 4', solve(*([-4, -2], -3, -1)), -5)
check('regression 5', solve(*([0, 0, 9], 2, 4)), 8)
check("variable cap", solve([0,N,N*4],1,N+1),2*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.

For lo<=hi, clip each integer contribution into [lo,hi], then sum. Empty is zero.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(xs, cap):
    return max(0,min(cap,sum(xs)))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([8, -3], 5)), 2)
check('regression 2', solve(*([-4, 3], 5)), 3)
check('regression 3', solve(*([], 5)), 0)
check('regression 4', solve(*([2, 2], 5)), 4)
check('regression 5', solve(*([8, -9, 2], 5)), 2)
check("variable path",solve([N+4,-2],N+1),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(xs, cap):
    return max(0,min(cap,sum(max(-cap,min(cap,x)) for x in xs)))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([8, -3], 5)), 2)
check('regression 2', solve(*([-4, 3], 5)), 3)
check('regression 3', solve(*([], 5)), 0)
check('regression 4', solve(*([2, 2], 5)), 4)
check('regression 5', solve(*([8, -9, 2], 5)), 2)
check("variable path",solve([N+4,-2],N+1),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.

Starting at zero, apply each signed delta and clamp the running balance into [0,cap] after every event. cap is positive.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(xs, cap):
    b=0
    for x in xs: b=min(cap,b+x)
    return b
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([8, -3], 5)), 2)
check('regression 2', solve(*([-4, 3], 5)), 3)
check('regression 3', solve(*([], 5)), 0)
check('regression 4', solve(*([2, 2], 5)), 4)
check('regression 5', solve(*([8, -9, 2], 5)), 2)
check("variable path",solve([N+4,-2],N+1),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(xs, cap):
    b=0
    for x in xs: b=min(cap,b+x)
    return max(0,b)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([8, -3], 5)), 2)
check('regression 2', solve(*([-4, 3], 5)), 3)
check('regression 3', solve(*([], 5)), 0)
check('regression 4', solve(*([2, 2], 5)), 4)
check('regression 5', solve(*([8, -9, 2], 5)), 2)
check("variable path",solve([N+4,-2],N+1),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.

Starting at zero, apply each signed delta and clamp the running balance into [0,cap] after every event. cap is positive.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(xs, cap):
    b=0
    for x in xs: b=max(0,b+x)
    return b
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([8, -3], 5)), 2)
check('regression 2', solve(*([-4, 3], 5)), 3)
check('regression 3', solve(*([], 5)), 0)
check('regression 4', solve(*([2, 2], 5)), 4)
check('regression 5', solve(*([8, -9, 2], 5)), 2)
check("variable path",solve([N+4,-2],N+1),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(xs, cap):
    b=0
    for x in xs: b=max(0,b+x)
    return min(cap,b)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([8, -3], 5)), 2)
check('regression 2', solve(*([-4, 3], 5)), 3)
check('regression 3', solve(*([], 5)), 0)
check('regression 4', solve(*([2, 2], 5)), 4)
check('regression 5', solve(*([8, -9, 2], 5)), 2)
check("variable path",solve([N+4,-2],N+1),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.

Starting at zero, apply each signed delta and clamp the running balance into [0,cap] after every event. cap is positive.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(xs, cap):
    b=0
    for x in sorted(xs): b=max(0,min(cap,b+x))
    return b
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([8, -3], 5)), 2)
check('regression 2', solve(*([-4, 3], 5)), 3)
check('regression 3', solve(*([], 5)), 0)
check('regression 4', solve(*([2, 2], 5)), 4)
check('regression 5', solve(*([8, -9, 2], 5)), 2)
check("variable path",solve([N+4,-2],N+1),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(xs, cap):
    b=0
    for x in sorted(xs,reverse=True): b=max(0,min(cap,b+x))
    return b
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([8, -3], 5)), 2)
check('regression 2', solve(*([-4, 3], 5)), 3)
check('regression 3', solve(*([], 5)), 0)
check('regression 4', solve(*([2, 2], 5)), 4)
check('regression 5', solve(*([8, -9, 2], 5)), 2)
check("variable path",solve([N+4,-2],N+1),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.

Starting at zero, apply each signed delta and clamp the running balance into [0,cap] after every event. cap is positive.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(xs, cap):
    b=0
    for x in xs:
        b=b+x
        b=0 if b<0 or b>cap else b
    return b
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([8, -3], 5)), 2)
check('regression 2', solve(*([-4, 3], 5)), 3)
check('regression 3', solve(*([], 5)), 0)
check('regression 4', solve(*([2, 2], 5)), 4)
check('regression 5', solve(*([8, -9, 2], 5)), 2)
check("variable path",solve([N+4,-2],N+1),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(xs, cap):
    b=0
    for x in xs: b=abs(b+x) if b+x<0 else (2*cap-b-x if b+x>cap else b+x)
    return b
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([8, -3], 5)), 2)
check('regression 2', solve(*([-4, 3], 5)), 3)
check('regression 3', solve(*([], 5)), 0)
check('regression 4', solve(*([2, 2], 5)), 4)
check('regression 5', solve(*([8, -9, 2], 5)), 2)
check("variable path",solve([N+4,-2],N+1),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.

Starting at zero, apply each signed delta and clamp the running balance into [0,cap] after every event. cap is positive.

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):
    n=0
    mean=Fraction(0)
    m2=Fraction(0)
    m3=Fraction(0)
    m4=Fraction(0)
    for xs in blocks:
        if not xs: continue
        b=len(xs)
        u=Fraction(sum(xs),b)
        q2=sum((Fraction(x)-u)**2 for x in xs)
        q3=sum((Fraction(x)-u)**3 for x in xs)
        q4=sum((Fraction(x)-u)**4 for x in xs)
        t=n+b
        d=u-mean
        r4=m4+q4+d**4*n*b*(n*n-n*b+b*b)/t**3+6*d*d*(n*n*q2+b*b*m2)/t**2+4*d*(n*q3-b*m3)/t
        r3=m3+q3+d**3*n*b*(n-b)/t**2+3*d*(n*q2-b*m2)/t
        r2=m2+q2
        mean=mean+d*b/t
        n=t
        m2,m3,m4=r2,r3,r4
    return [n,str(mean),str(m2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[8], [1, 3]],)), [3, '4', '26'])
check('regression 2', solve(*([[1, 3], [8]],)), [3, '4', '26'])
check('regression 3', solve(*([[0, 0], [0]],)), [3, '0', '0'])
check('regression 4', solve(*([],)), [0, '0', '0'])
check('regression 5', solve(*([[2, 2, 2], [], [-1, 5]],)), [5, '2', '18'])
check('regression 6', solve(*([[-4], [1, 3], [7, 9]],)), [5, '16/5', '524/5'])
check("variable repeated symmetric blocks",solve([[0,2]]*N),[2*N,"1",str(2*N)])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(blocks):
    n=0
    mean=Fraction(0)
    m2=Fraction(0)
    m3=Fraction(0)
    m4=Fraction(0)
    for xs in blocks:
        if not xs: continue
        b=len(xs)
        u=Fraction(sum(xs),b)
        q2=sum((Fraction(x)-u)**2 for x in xs)
        q3=sum((Fraction(x)-u)**3 for x in xs)
        q4=sum((Fraction(x)-u)**4 for x in xs)
        t=n+b
        d=u-mean
        r4=m4+q4+d**4*n*b*(n*n-n*b+b*b)/t**3+6*d*d*(n*n*q2+b*b*m2)/t**2+4*d*(n*q3-b*m3)/t
        r3=m3+q3+d**3*n*b*(n-b)/t**2+3*d*(n*q2-b*m2)/t
        r2=m2+q2+abs(d)*n*b/t
        mean=mean+d*b/t
        n=t
        m2,m3,m4=r2,r3,r4
    return [n,str(mean),str(m2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[8], [1, 3]],)), [3, '4', '26'])
check('regression 2', solve(*([[1, 3], [8]],)), [3, '4', '26'])
check('regression 3', solve(*([[0, 0], [0]],)), [3, '0', '0'])
check('regression 4', solve(*([],)), [0, '0', '0'])
check('regression 5', solve(*([[2, 2, 2], [], [-1, 5]],)), [5, '2', '18'])
check('regression 6', solve(*([[-4], [1, 3], [7, 9]],)), [5, '16/5', '524/5'])
check("variable repeated symmetric blocks",solve([[0,2]]*N),[2*N,"1",str(2*N)])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

Merge disjoint integer observation blocks into [count, exact mean, unnormalised central moments through order 2]. Empty blocks are identities; moments are Fraction strings, empty summary is zero.

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):
    n=0
    mean=Fraction(0)
    m2=Fraction(0)
    m3=Fraction(0)
    m4=Fraction(0)
    for xs in blocks:
        if not xs: continue
        b=len(xs)
        u=Fraction(sum(xs),b)
        q2=sum((Fraction(x)-u)**2 for x in xs)
        q3=sum((Fraction(x)-u)**3 for x in xs)
        q4=sum((Fraction(x)-u)**4 for x in xs)
        t=n+b
        d=u-mean
        r4=m4+q4+d**4*n*b*(n*n-n*b+b*b)/t**3+6*d*d*(n*n*q2+b*b*m2)/t**2+4*d*(n*q3-b*m3)/t
        r3=m3+q3+d**3*n*b*(n-b)/t**2+3*d*(n*q2-b*m2)/t
        r2=m2+q2+d*d/2
        mean=mean+d*b/t
        n=t
        m2,m3,m4=r2,r3,r4
    return [n,str(mean),str(m2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[8], [1, 3]],)), [3, '4', '26'])
check('regression 2', solve(*([[1, 3], [8]],)), [3, '4', '26'])
check('regression 3', solve(*([[0, 0], [0]],)), [3, '0', '0'])
check('regression 4', solve(*([],)), [0, '0', '0'])
check('regression 5', solve(*([[2, 2, 2], [], [-1, 5]],)), [5, '2', '18'])
check('regression 6', solve(*([[-4], [1, 3], [7, 9]],)), [5, '16/5', '524/5'])
check("variable repeated symmetric blocks",solve([[0,2]]*N),[2*N,"1",str(2*N)])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(blocks):
    n=0
    mean=Fraction(0)
    m2=Fraction(0)
    m3=Fraction(0)
    m4=Fraction(0)
    for xs in blocks:
        if not xs: continue
        b=len(xs)
        u=Fraction(sum(xs),b)
        q2=sum((Fraction(x)-u)**2 for x in xs)
        q3=sum((Fraction(x)-u)**3 for x in xs)
        q4=sum((Fraction(x)-u)**4 for x in xs)
        t=n+b
        d=u-mean
        r4=m4+q4+d**4*n*b*(n*n-n*b+b*b)/t**3+6*d*d*(n*n*q2+b*b*m2)/t**2+4*d*(n*q3-b*m3)/t
        r3=m3+q3+d**3*n*b*(n-b)/t**2+3*d*(n*q2-b*m2)/t
        r2=m2+q2+d*d*(n+b)/2
        mean=mean+d*b/t
        n=t
        m2,m3,m4=r2,r3,r4
    return [n,str(mean),str(m2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[8], [1, 3]],)), [3, '4', '26'])
check('regression 2', solve(*([[1, 3], [8]],)), [3, '4', '26'])
check('regression 3', solve(*([[0, 0], [0]],)), [3, '0', '0'])
check('regression 4', solve(*([],)), [0, '0', '0'])
check('regression 5', solve(*([[2, 2, 2], [], [-1, 5]],)), [5, '2', '18'])
check('regression 6', solve(*([[-4], [1, 3], [7, 9]],)), [5, '16/5', '524/5'])
check("variable repeated symmetric blocks",solve([[0,2]]*N),[2*N,"1",str(2*N)])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

Merge disjoint integer observation blocks into [count, exact mean, unnormalised central moments through order 2]. Empty blocks are identities; moments are Fraction strings, empty summary is zero.

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):
    n=0
    mean=Fraction(0)
    m2=Fraction(0)
    m3=Fraction(0)
    m4=Fraction(0)
    for xs in blocks:
        if not xs: continue
        b=len(xs)
        u=Fraction(sum(xs),b)
        q2=sum((Fraction(x)-u)**2 for x in xs)
        q3=sum((Fraction(x)-u)**3 for x in xs)
        q4=sum((Fraction(x)-u)**4 for x in xs)
        t=n+b
        d=u-mean
        r4=m4+q4+d**4*n*b*(n*n-n*b+b*b)/t**3+6*d*d*(n*n*q2+b*b*m2)/t**2+4*d*(n*q3-b*m3)/t
        r3=m3+q3+d**3*n*b*(n-b)/t**2+3*d*(n*q2-b*m2)/t
        r2=m2+q2+d*d*n*b/t
        mean=(mean+u)/2 if n else u
        n=t
        m2,m3,m4=r2,r3,r4
    return [n,str(mean),str(m2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[8], [1, 3]],)), [3, '4', '26'])
check('regression 2', solve(*([[1, 3], [8]],)), [3, '4', '26'])
check('regression 3', solve(*([[0, 0], [0]],)), [3, '0', '0'])
check('regression 4', solve(*([],)), [0, '0', '0'])
check('regression 5', solve(*([[2, 2, 2], [], [-1, 5]],)), [5, '2', '18'])
check('regression 6', solve(*([[-4], [1, 3], [7, 9]],)), [5, '16/5', '524/5'])
check("variable repeated symmetric blocks",solve([[0,2]]*N),[2*N,"1",str(2*N)])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(blocks):
    n=0
    mean=Fraction(0)
    m2=Fraction(0)
    m3=Fraction(0)
    m4=Fraction(0)
    for xs in blocks:
        if not xs: continue
        b=len(xs)
        u=Fraction(sum(xs),b)
        q2=sum((Fraction(x)-u)**2 for x in xs)
        q3=sum((Fraction(x)-u)**3 for x in xs)
        q4=sum((Fraction(x)-u)**4 for x in xs)
        t=n+b
        d=u-mean
        r4=m4+q4+d**4*n*b*(n*n-n*b+b*b)/t**3+6*d*d*(n*n*q2+b*b*m2)/t**2+4*d*(n*q3-b*m3)/t
        r3=m3+q3+d**3*n*b*(n-b)/t**2+3*d*(n*q2-b*m2)/t
        r2=m2+q2+d*d*n*b/t
        mean=mean+d*n/t
        n=t
        m2,m3,m4=r2,r3,r4
    return [n,str(mean),str(m2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[8], [1, 3]],)), [3, '4', '26'])
check('regression 2', solve(*([[1, 3], [8]],)), [3, '4', '26'])
check('regression 3', solve(*([[0, 0], [0]],)), [3, '0', '0'])
check('regression 4', solve(*([],)), [0, '0', '0'])
check('regression 5', solve(*([[2, 2, 2], [], [-1, 5]],)), [5, '2', '18'])
check('regression 6', solve(*([[-4], [1, 3], [7, 9]],)), [5, '16/5', '524/5'])
check("variable repeated symmetric blocks",solve([[0,2]]*N),[2*N,"1",str(2*N)])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

Merge disjoint integer observation blocks into [count, exact mean, unnormalised central moments through order 2]. Empty blocks are identities; moments are Fraction strings, empty summary is zero.

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):
    n=0
    mean=Fraction(0)
    m2=Fraction(0)
    m3=Fraction(0)
    m4=Fraction(0)
    for xs in blocks:
        if not xs: continue
        b=len(xs)
        u=Fraction(sum(xs),b)
        q2=sum((Fraction(x)-u)**2 for x in xs)
        q3=sum((Fraction(x)-u)**3 for x in xs)
        q4=sum((Fraction(x)-u)**4 for x in xs)
        t=n+b
        d=u-mean
        r4=m4+q4+d**4*n*b*(n*n-n*b+b*b)/t**3+6*d*d*(n*n*q2+b*b*m2)/t**2+4*d*(n*q3-b*m3)/t
        r3=m3+q3+d**3*n*b*(n-b)/t**2+3*d*(n*q2-b*m2)/t
        r2=q2+d*d*n*b/t
        mean=mean+d*b/t
        n=t
        m2,m3,m4=r2,r3,r4
    return [n,str(mean),str(m2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[8], [1, 3]],)), [3, '4', '26'])
check('regression 2', solve(*([[1, 3], [8]],)), [3, '4', '26'])
check('regression 3', solve(*([[0, 0], [0]],)), [3, '0', '0'])
check('regression 4', solve(*([],)), [0, '0', '0'])
check('regression 5', solve(*([[2, 2, 2], [], [-1, 5]],)), [5, '2', '18'])
check('regression 6', solve(*([[-4], [1, 3], [7, 9]],)), [5, '16/5', '524/5'])
check("variable repeated symmetric blocks",solve([[0,2]]*N),[2*N,"1",str(2*N)])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(blocks):
    n=0
    mean=Fraction(0)
    m2=Fraction(0)
    m3=Fraction(0)
    m4=Fraction(0)
    for xs in blocks:
        if not xs: continue
        b=len(xs)
        u=Fraction(sum(xs),b)
        q2=sum((Fraction(x)-u)**2 for x in xs)
        q3=sum((Fraction(x)-u)**3 for x in xs)
        q4=sum((Fraction(x)-u)**4 for x in xs)
        t=n+b
        d=u-mean
        r4=m4+q4+d**4*n*b*(n*n-n*b+b*b)/t**3+6*d*d*(n*n*q2+b*b*m2)/t**2+4*d*(n*q3-b*m3)/t
        r3=m3+q3+d**3*n*b*(n-b)/t**2+3*d*(n*q2-b*m2)/t
        r2=m2+d*d*n*b/t
        mean=mean+d*b/t
        n=t
        m2,m3,m4=r2,r3,r4
    return [n,str(mean),str(m2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[8], [1, 3]],)), [3, '4', '26'])
check('regression 2', solve(*([[1, 3], [8]],)), [3, '4', '26'])
check('regression 3', solve(*([[0, 0], [0]],)), [3, '0', '0'])
check('regression 4', solve(*([],)), [0, '0', '0'])
check('regression 5', solve(*([[2, 2, 2], [], [-1, 5]],)), [5, '2', '18'])
check('regression 6', solve(*([[-4], [1, 3], [7, 9]],)), [5, '16/5', '524/5'])
check("variable repeated symmetric blocks",solve([[0,2]]*N),[2*N,"1",str(2*N)])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

Merge disjoint integer observation blocks into [count, exact mean, unnormalised central moments through order 2]. Empty blocks are identities; moments are Fraction strings, empty summary is zero.

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):
    n=0
    mean=Fraction(0)
    m2=Fraction(0)
    m3=Fraction(0)
    m4=Fraction(0)
    for xs in blocks:
        if not xs: continue
        b=len(xs)
        u=Fraction(sum(xs),b)
        q2=sum((Fraction(x)-u)**2 for x in xs)
        q3=sum((Fraction(x)-u)**3 for x in xs)
        q4=sum((Fraction(x)-u)**4 for x in xs)
        t=n+b
        d=u-mean
        r4=m4+q4+d**4*n*b*(n*n-n*b+b*b)/t**3+6*d*d*(n*n*q2+b*b*m2)/t**2+4*d*(n*q3-b*m3)/t
        r3=m3+q3+d**3*n*b*(n-b)/t**2+3*d*(n*q2-b*m2)/t
        r2=m2+q2+d*d*t*b/t
        mean=mean+d*b/t
        n=t
        m2,m3,m4=r2,r3,r4
    return [n,str(mean),str(m2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[8], [1, 3]],)), [3, '4', '26'])
check('regression 2', solve(*([[1, 3], [8]],)), [3, '4', '26'])
check('regression 3', solve(*([[0, 0], [0]],)), [3, '0', '0'])
check('regression 4', solve(*([],)), [0, '0', '0'])
check('regression 5', solve(*([[2, 2, 2], [], [-1, 5]],)), [5, '2', '18'])
check('regression 6', solve(*([[-4], [1, 3], [7, 9]],)), [5, '16/5', '524/5'])
check("variable repeated symmetric blocks",solve([[0,2]]*N),[2*N,"1",str(2*N)])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(blocks):
    n=0
    mean=Fraction(0)
    m2=Fraction(0)
    m3=Fraction(0)
    m4=Fraction(0)
    for xs in blocks:
        if not xs: continue
        b=len(xs)
        u=Fraction(sum(xs),b)
        q2=sum((Fraction(x)-u)**2 for x in xs)
        q3=sum((Fraction(x)-u)**3 for x in xs)
        q4=sum((Fraction(x)-u)**4 for x in xs)
        t=n+b
        d=u-mean
        r4=m4+q4+d**4*n*b*(n*n-n*b+b*b)/t**3+6*d*d*(n*n*q2+b*b*m2)/t**2+4*d*(n*q3-b*m3)/t
        r3=m3+q3+d**3*n*b*(n-b)/t**2+3*d*(n*q2-b*m2)/t
        r2=m2+q2+d*d*n*b/(t+b)
        mean=mean+d*b/t
        n=t
        m2,m3,m4=r2,r3,r4
    return [n,str(mean),str(m2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[8], [1, 3]],)), [3, '4', '26'])
check('regression 2', solve(*([[1, 3], [8]],)), [3, '4', '26'])
check('regression 3', solve(*([[0, 0], [0]],)), [3, '0', '0'])
check('regression 4', solve(*([],)), [0, '0', '0'])
check('regression 5', solve(*([[2, 2, 2], [], [-1, 5]],)), [5, '2', '18'])
check('regression 6', solve(*([[-4], [1, 3], [7, 9]],)), [5, '16/5', '524/5'])
check("variable repeated symmetric blocks",solve([[0,2]]*N),[2*N,"1",str(2*N)])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

Merge disjoint integer observation blocks into [count, exact mean, unnormalised central moments through order 2]. Empty blocks are identities; moments are Fraction strings, empty summary is zero.

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):
    n=0
    mean=Fraction(0)
    m2=Fraction(0)
    m3=Fraction(0)
    m4=Fraction(0)
    for xs in blocks:
        if not xs: continue
        b=len(xs)
        u=Fraction(sum(xs),b)
        q2=sum((Fraction(x)-u)**2 for x in xs)
        q3=sum((Fraction(x)-u)**3 for x in xs)
        q4=sum((Fraction(x)-u)**4 for x in xs)
        t=n+b
        d=u-mean
        r4=m4+q4+d**4*n*b*(n*n-n*b+b*b)/t**3+6*d*d*(n*n*q2+b*b*m2)/t**2+4*d*(n*q3-b*m3)/t
        r3=m3+q3+3*d*(n*q2-b*m2)/t
        r2=m2+q2+d*d*n*b/t
        mean=mean+d*b/t
        n=t
        m2,m3,m4=r2,r3,r4
    return [n,str(mean),str(m2),str(m3)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[8], [1, 3]],)), [3, '4', '26', '36'])
check('regression 2', solve(*([[1, 3], [8]],)), [3, '4', '26', '36'])
check('regression 3', solve(*([[0, 0], [0]],)), [3, '0', '0', '0'])
check('regression 4', solve(*([],)), [0, '0', '0', '0'])
check('regression 5', solve(*([[2, 2, 2], [], [-1, 5]],)), [5, '2', '18', '0'])
check('regression 6', solve(*([[-4], [1, 3], [7, 9]],)), [5, '16/5', '524/5', '-3348/25'])
check("variable repeated symmetric blocks",solve([[0,2]]*N),[2*N,"1",str(2*N),"0"])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(blocks):
    n=0
    mean=Fraction(0)
    m2=Fraction(0)
    m3=Fraction(0)
    m4=Fraction(0)
    for xs in blocks:
        if not xs: continue
        b=len(xs)
        u=Fraction(sum(xs),b)
        q2=sum((Fraction(x)-u)**2 for x in xs)
        q3=sum((Fraction(x)-u)**3 for x in xs)
        q4=sum((Fraction(x)-u)**4 for x in xs)
        t=n+b
        d=u-mean
        r4=m4+q4+d**4*n*b*(n*n-n*b+b*b)/t**3+6*d*d*(n*n*q2+b*b*m2)/t**2+4*d*(n*q3-b*m3)/t
        r3=m3+q3+d**3*n*b/t**2+3*d*(n*q2-b*m2)/t
        r2=m2+q2+d*d*n*b/t
        mean=mean+d*b/t
        n=t
        m2,m3,m4=r2,r3,r4
    return [n,str(mean),str(m2),str(m3)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[8], [1, 3]],)), [3, '4', '26', '36'])
check('regression 2', solve(*([[1, 3], [8]],)), [3, '4', '26', '36'])
check('regression 3', solve(*([[0, 0], [0]],)), [3, '0', '0', '0'])
check('regression 4', solve(*([],)), [0, '0', '0', '0'])
check('regression 5', solve(*([[2, 2, 2], [], [-1, 5]],)), [5, '2', '18', '0'])
check('regression 6', solve(*([[-4], [1, 3], [7, 9]],)), [5, '16/5', '524/5', '-3348/25'])
check("variable repeated symmetric blocks",solve([[0,2]]*N),[2*N,"1",str(2*N),"0"])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

Merge disjoint integer observation blocks into [count, exact mean, unnormalised central moments through order 3]. Empty blocks are identities; moments are Fraction strings, empty summary is zero.

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):
    n=0
    mean=Fraction(0)
    m2=Fraction(0)
    m3=Fraction(0)
    m4=Fraction(0)
    for xs in blocks:
        if not xs: continue
        b=len(xs)
        u=Fraction(sum(xs),b)
        q2=sum((Fraction(x)-u)**2 for x in xs)
        q3=sum((Fraction(x)-u)**3 for x in xs)
        q4=sum((Fraction(x)-u)**4 for x in xs)
        t=n+b
        d=u-mean
        r4=m4+q4+d**4*n*b*(n*n-n*b+b*b)/t**3+6*d*d*(n*n*q2+b*b*m2)/t**2+4*d*(n*q3-b*m3)/t
        r3=m3+q3+d**3*n*b*(n-b)/t**2
        r2=m2+q2+d*d*n*b/t
        mean=mean+d*b/t
        n=t
        m2,m3,m4=r2,r3,r4
    return [n,str(mean),str(m2),str(m3)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[8], [1, 3]],)), [3, '4', '26', '36'])
check('regression 2', solve(*([[1, 3], [8]],)), [3, '4', '26', '36'])
check('regression 3', solve(*([[0, 0], [0]],)), [3, '0', '0', '0'])
check('regression 4', solve(*([],)), [0, '0', '0', '0'])
check('regression 5', solve(*([[2, 2, 2], [], [-1, 5]],)), [5, '2', '18', '0'])
check('regression 6', solve(*([[-4], [1, 3], [7, 9]],)), [5, '16/5', '524/5', '-3348/25'])
check("variable repeated symmetric blocks",solve([[0,2]]*N),[2*N,"1",str(2*N),"0"])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(blocks):
    n=0
    mean=Fraction(0)
    m2=Fraction(0)
    m3=Fraction(0)
    m4=Fraction(0)
    for xs in blocks:
        if not xs: continue
        b=len(xs)
        u=Fraction(sum(xs),b)
        q2=sum((Fraction(x)-u)**2 for x in xs)
        q3=sum((Fraction(x)-u)**3 for x in xs)
        q4=sum((Fraction(x)-u)**4 for x in xs)
        t=n+b
        d=u-mean
        r4=m4+q4+d**4*n*b*(n*n-n*b+b*b)/t**3+6*d*d*(n*n*q2+b*b*m2)/t**2+4*d*(n*q3-b*m3)/t
        r3=m3+q3+d**3*n*b*(n-b)/t**2+3*d*(q2-m2)/t
        r2=m2+q2+d*d*n*b/t
        mean=mean+d*b/t
        n=t
        m2,m3,m4=r2,r3,r4
    return [n,str(mean),str(m2),str(m3)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[8], [1, 3]],)), [3, '4', '26', '36'])
check('regression 2', solve(*([[1, 3], [8]],)), [3, '4', '26', '36'])
check('regression 3', solve(*([[0, 0], [0]],)), [3, '0', '0', '0'])
check('regression 4', solve(*([],)), [0, '0', '0', '0'])
check('regression 5', solve(*([[2, 2, 2], [], [-1, 5]],)), [5, '2', '18', '0'])
check('regression 6', solve(*([[-4], [1, 3], [7, 9]],)), [5, '16/5', '524/5', '-3348/25'])
check("variable repeated symmetric blocks",solve([[0,2]]*N),[2*N,"1",str(2*N),"0"])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

Merge disjoint integer observation blocks into [count, exact mean, unnormalised central moments through order 3]. Empty blocks are identities; moments are Fraction strings, empty summary is zero.

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):
    n=0
    mean=Fraction(0)
    m2=Fraction(0)
    m3=Fraction(0)
    m4=Fraction(0)
    for xs in blocks:
        if not xs: continue
        b=len(xs)
        u=Fraction(sum(xs),b)
        q2=sum((Fraction(x)-u)**2 for x in xs)
        q3=sum((Fraction(x)-u)**3 for x in xs)
        q4=sum((Fraction(x)-u)**4 for x in xs)
        t=n+b
        d=u-mean
        r4=m4+q4+d**4*n*b*(n*n-n*b+b*b)/t**3+6*d*d*(n*n*q2+b*b*m2)/t**2+4*d*(n*q3-b*m3)/t
        r3=m3+q3+d**3*n*b*(n-b)/t**2+3*d*(n*q2+b*m2)/t
        r2=m2+q2+d*d*n*b/t
        mean=mean+d*b/t
        n=t
        m2,m3,m4=r2,r3,r4
    return [n,str(mean),str(m2),str(m3)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[8], [1, 3]],)), [3, '4', '26', '36'])
check('regression 2', solve(*([[1, 3], [8]],)), [3, '4', '26', '36'])
check('regression 3', solve(*([[0, 0], [0]],)), [3, '0', '0', '0'])
check('regression 4', solve(*([],)), [0, '0', '0', '0'])
check('regression 5', solve(*([[2, 2, 2], [], [-1, 5]],)), [5, '2', '18', '0'])
check('regression 6', solve(*([[-4], [1, 3], [7, 9]],)), [5, '16/5', '524/5', '-3348/25'])
check("variable repeated symmetric blocks",solve([[0,2]]*N),[2*N,"1",str(2*N),"0"])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(blocks):
    n=0
    mean=Fraction(0)
    m2=Fraction(0)
    m3=Fraction(0)
    m4=Fraction(0)
    for xs in blocks:
        if not xs: continue
        b=len(xs)
        u=Fraction(sum(xs),b)
        q2=sum((Fraction(x)-u)**2 for x in xs)
        q3=sum((Fraction(x)-u)**3 for x in xs)
        q4=sum((Fraction(x)-u)**4 for x in xs)
        t=n+b
        d=u-mean
        r4=m4+q4+d**4*n*b*(n*n-n*b+b*b)/t**3+6*d*d*(n*n*q2+b*b*m2)/t**2+4*d*(n*q3-b*m3)/t
        r3=m3+q3+d**3*n*b*(n-b)/t**2+3*d*(b*q2-n*m2)/t
        r2=m2+q2+d*d*n*b/t
        mean=mean+d*b/t
        n=t
        m2,m3,m4=r2,r3,r4
    return [n,str(mean),str(m2),str(m3)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[8], [1, 3]],)), [3, '4', '26', '36'])
check('regression 2', solve(*([[1, 3], [8]],)), [3, '4', '26', '36'])
check('regression 3', solve(*([[0, 0], [0]],)), [3, '0', '0', '0'])
check('regression 4', solve(*([],)), [0, '0', '0', '0'])
check('regression 5', solve(*([[2, 2, 2], [], [-1, 5]],)), [5, '2', '18', '0'])
check('regression 6', solve(*([[-4], [1, 3], [7, 9]],)), [5, '16/5', '524/5', '-3348/25'])
check("variable repeated symmetric blocks",solve([[0,2]]*N),[2*N,"1",str(2*N),"0"])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

Merge disjoint integer observation blocks into [count, exact mean, unnormalised central moments through order 3]. Empty blocks are identities; moments are Fraction strings, empty summary is zero.

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):
    n=0
    mean=Fraction(0)
    m2=Fraction(0)
    m3=Fraction(0)
    m4=Fraction(0)
    for xs in blocks:
        if not xs: continue
        b=len(xs)
        u=Fraction(sum(xs),b)
        q2=sum((Fraction(x)-u)**2 for x in xs)
        q3=sum((Fraction(x)-u)**3 for x in xs)
        q4=sum((Fraction(x)-u)**4 for x in xs)
        t=n+b
        d=u-mean
        r4=m4+q4+d**4*n*b*(n*n-n*b+b*b)/t**3+6*d*d*(n*n*q2+b*b*m2)/t**2+4*d*(n*q3-b*m3)/t
        r3=m3+q3-d**3*n*b*(n-b)/t**2-3*d*(n*q2-b*m2)/t
        r2=m2+q2+d*d*n*b/t
        mean=mean+d*b/t
        n=t
        m2,m3,m4=r2,r3,r4
    return [n,str(mean),str(m2),str(m3)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[8], [1, 3]],)), [3, '4', '26', '36'])
check('regression 2', solve(*([[1, 3], [8]],)), [3, '4', '26', '36'])
check('regression 3', solve(*([[0, 0], [0]],)), [3, '0', '0', '0'])
check('regression 4', solve(*([],)), [0, '0', '0', '0'])
check('regression 5', solve(*([[2, 2, 2], [], [-1, 5]],)), [5, '2', '18', '0'])
check('regression 6', solve(*([[-4], [1, 3], [7, 9]],)), [5, '16/5', '524/5', '-3348/25'])
check("variable repeated symmetric blocks",solve([[0,2]]*N),[2*N,"1",str(2*N),"0"])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(blocks):
    n=0
    mean=Fraction(0)
    m2=Fraction(0)
    m3=Fraction(0)
    m4=Fraction(0)
    for xs in blocks:
        if not xs: continue
        b=len(xs)
        u=Fraction(sum(xs),b)
        q2=sum((Fraction(x)-u)**2 for x in xs)
        q3=sum((Fraction(x)-u)**3 for x in xs)
        q4=sum((Fraction(x)-u)**4 for x in xs)
        t=n+b
        d=u-mean
        r4=m4+q4+d**4*n*b*(n*n-n*b+b*b)/t**3+6*d*d*(n*n*q2+b*b*m2)/t**2+4*d*(n*q3-b*m3)/t
        r3=m3+q3+abs(d)**3*n*b*(n-b)/t**2+3*abs(d)*(n*q2-b*m2)/t
        r2=m2+q2+d*d*n*b/t
        mean=mean+d*b/t
        n=t
        m2,m3,m4=r2,r3,r4
    return [n,str(mean),str(m2),str(m3)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[8], [1, 3]],)), [3, '4', '26', '36'])
check('regression 2', solve(*([[1, 3], [8]],)), [3, '4', '26', '36'])
check('regression 3', solve(*([[0, 0], [0]],)), [3, '0', '0', '0'])
check('regression 4', solve(*([],)), [0, '0', '0', '0'])
check('regression 5', solve(*([[2, 2, 2], [], [-1, 5]],)), [5, '2', '18', '0'])
check('regression 6', solve(*([[-4], [1, 3], [7, 9]],)), [5, '16/5', '524/5', '-3348/25'])
check("variable repeated symmetric blocks",solve([[0,2]]*N),[2*N,"1",str(2*N),"0"])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

Merge disjoint integer observation blocks into [count, exact mean, unnormalised central moments through order 3]. Empty blocks are identities; moments are Fraction strings, empty summary is zero.

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):
    n=0
    mean=Fraction(0)
    m2=Fraction(0)
    m3=Fraction(0)
    m4=Fraction(0)
    for xs in blocks:
        if not xs: continue
        b=len(xs)
        u=Fraction(sum(xs),b)
        q2=sum((Fraction(x)-u)**2 for x in xs)
        q3=sum((Fraction(x)-u)**3 for x in xs)
        q4=sum((Fraction(x)-u)**4 for x in xs)
        t=n+b
        d=u-mean
        r4=m4+q4+d**4*n*b*(n*n-n*b+b*b)/t**3+6*d*d*(n*n*q2+b*b*m2)/t**2+4*d*(n*q3-b*m3)/t
        r3=m3+q3+d**3*n*b*(n+b)/t**2+3*d*(n*q2-b*m2)/t
        r2=m2+q2+d*d*n*b/t
        mean=mean+d*b/t
        n=t
        m2,m3,m4=r2,r3,r4
    return [n,str(mean),str(m2),str(m3)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[8], [1, 3]],)), [3, '4', '26', '36'])
check('regression 2', solve(*([[1, 3], [8]],)), [3, '4', '26', '36'])
check('regression 3', solve(*([[0, 0], [0]],)), [3, '0', '0', '0'])
check('regression 4', solve(*([],)), [0, '0', '0', '0'])
check('regression 5', solve(*([[2, 2, 2], [], [-1, 5]],)), [5, '2', '18', '0'])
check('regression 6', solve(*([[-4], [1, 3], [7, 9]],)), [5, '16/5', '524/5', '-3348/25'])
check("variable repeated symmetric blocks",solve([[0,2]]*N),[2*N,"1",str(2*N),"0"])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(blocks):
    n=0
    mean=Fraction(0)
    m2=Fraction(0)
    m3=Fraction(0)
    m4=Fraction(0)
    for xs in blocks:
        if not xs: continue
        b=len(xs)
        u=Fraction(sum(xs),b)
        q2=sum((Fraction(x)-u)**2 for x in xs)
        q3=sum((Fraction(x)-u)**3 for x in xs)
        q4=sum((Fraction(x)-u)**4 for x in xs)
        t=n+b
        d=u-mean
        r4=m4+q4+d**4*n*b*(n*n-n*b+b*b)/t**3+6*d*d*(n*n*q2+b*b*m2)/t**2+4*d*(n*q3-b*m3)/t
        r3=m3+q3+d**3*n*b*abs(n-b)/t**2+3*d*(n*q2-b*m2)/t
        r2=m2+q2+d*d*n*b/t
        mean=mean+d*b/t
        n=t
        m2,m3,m4=r2,r3,r4
    return [n,str(mean),str(m2),str(m3)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([[8], [1, 3]],)), [3, '4', '26', '36'])
check('regression 2', solve(*([[1, 3], [8]],)), [3, '4', '26', '36'])
check('regression 3', solve(*([[0, 0], [0]],)), [3, '0', '0', '0'])
check('regression 4', solve(*([],)), [0, '0', '0', '0'])
check('regression 5', solve(*([[2, 2, 2], [], [-1, 5]],)), [5, '2', '18', '0'])
check('regression 6', solve(*([[-4], [1, 3], [7, 9]],)), [5, '16/5', '524/5', '-3348/25'])
check("variable repeated symmetric blocks",solve([[0,2]]*N),[2*N,"1",str(2*N),"0"])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The reduction disagrees with its explicit aggregation oracle.

Merge disjoint integer observation blocks into [count, exact mean, unnormalised central moments through order 3]. Empty blocks are identities; moments are Fraction strings, empty summary is zero.

split: open-access