broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(teams):
    names = sorted(teams)
    n = len(names)
    def value(t, cat):
        d = teams[t]
        if cat in ('hr', 'sb'):
            return Fraction(d[cat])
        if d['outs'] == 0:
            return None
        if cat == 'era':
            return Fraction(d['er'] * 27, d['outs'])
        return Fraction((d['bb'] + d['h']) * 3, d['outs'])
    total = {t: 0 for t in names}
    for cat in ('hr', 'sb', 'era', 'whip'):
        low = cat in ('era', 'whip')
        def key(t):
            v = value(t, cat)
            if v is None:
                return (1, 0)
            return (0, v if low else -v)
        ranked = sorted(names, key=key)
        i = 0
        while i < n:
            j = i
            while j < n and key(ranked[j]) == key(ranked[i]):
                j += 1
            pts2 = 2 * (n - i)
            for t in ranked[i:j]:
                total[t] += pts2
            i = j
    return total
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: tie point sharing',
   [{'R0': {'bb': 2, 'er': 3, 'h': 25, 'hr': 15, 'outs': 60, 'sb': 8},
     'R1': {'bb': 9, 'er': 13, 'h': 6, 'hr': 12, 'outs': 0, 'sb': 8},
     'R2': {'bb': 2, 'er': 6, 'h': 21, 'hr': 10, 'outs': 54, 'sb': 5},
     'R3': {'bb': 6, 'er': 2, 'h': 5, 'hr': 15, 'outs': 0, 'sb': 8},
     'R4': {'bb': 5, 'er': 7, 'h': 12, 'hr': 15, 'outs': 81, 'sb': 8},
     'R5': {'bb': 1, 'er': 14, 'h': 0, 'hr': 10, 'outs': 30, 'sb': 5}}],
   {'R0': 37, 'R1': 21, 'R2': 22, 'R3': 25, 'R4': 39, 'R5': 24}),
  ('partial repair probe: tie point sharing',
   [{'R0': {'bb': 6, 'er': 14, 'h': 22, 'hr': 12, 'outs': 89, 'sb': 5},
     'R1': {'bb': 8, 'er': 14, 'h': 1, 'hr': 15, 'outs': 0, 'sb': 8},
     'R2': {'bb': 10, 'er': 3, 'h': 20, 'hr': 12, 'outs': 54, 'sb': 3},
     'R3': {'bb': 2, 'er': 7, 'h': 7, 'hr': 12, 'outs': 0, 'sb': 8},
     'R4': {'bb': 5, 'er': 14, 'h': 25, 'hr': 15, 'outs': 0, 'sb': 5}}],
   {'R0': 27, 'R1': 26, 'R2': 24, 'R3': 21, 'R4': 22}),
  ('second regression',
   [{'R0': {'bb': 2, 'er': 9, 'h': 18, 'hr': 12, 'outs': 42, 'sb': 3},
     'R1': {'bb': 1, 'er': 9, 'h': 23, 'hr': 15, 'outs': 27, 'sb': 5},
     'R2': {'bb': 5, 'er': 7, 'h': 5, 'hr': 10, 'outs': 54, 'sb': 5}}],
   {'R0': 14, 'R1': 15, 'R2': 19}),
  ('normal control 1',
   [{'R0': {'bb': 0, 'er': 1, 'h': 23, 'hr': 12, 'outs': 4, 'sb': 8},
     'R1': {'bb': 8, 'er': 6, 'h': 7, 'hr': 15, 'outs': 30, 'sb': 3},
     'R2': {'bb': 1, 'er': 12, 'h': 7, 'hr': 10, 'outs': 27, 'sb': 5}}],
   {'R0': 16, 'R1': 18, 'R2': 14}),
  ('normal control 2',
   [{'R0': {'bb': 7, 'er': 2, 'h': 16, 'hr': 15, 'outs': 0, 'sb': 8},
     'R1': {'bb': 3, 'er': 9, 'h': 21, 'hr': 10, 'outs': 30, 'sb': 5},
     'R2': {'bb': 1, 'er': 3, 'h': 23, 'hr': 12, 'outs': 81, 'sb': 3}}],
   {'R0': 16, 'R1': 14, 'R2': 18}),
  ('normal control 3',
   [{'R0': {'bb': 9, 'er': 1, 'h': 12, 'hr': 12, 'outs': 54, 'sb': 5},
     'R1': {'bb': 4, 'er': 1, 'h': 0, 'hr': 10, 'outs': 30, 'sb': 8},
     'R2': {'bb': 2, 'er': 10, 'h': 22, 'hr': 15, 'outs': 30, 'sb': 3}}],
   {'R0': 18, 'R1': 18, 'R2': 12})],
 [('regression: tie point sharing',
   [{'R0': {'bb': 2, 'er': 0, 'h': 11, 'hr': 15, 'outs': 81, 'sb': 5},
     'R1': {'bb': 3, 'er': 9, 'h': 2, 'hr': 12, 'outs': 30, 'sb': 3},
     'R2': {'bb': 10, 'er': 4, 'h': 17, 'hr': 12, 'outs': 24, 'sb': 3},
     'R3': {'bb': 7, 'er': 2, 'h': 11, 'hr': 15, 'outs': 81, 'sb': 3},
     'R4': {'bb': 1, 'er': 0, 'h': 0, 'hr': 10, 'outs': 27, 'sb': 5}}],
   {'R0': 35, 'R1': 17, 'R2': 15, 'R3': 23, 'R4': 30}),
  ('partial repair probe: tie point sharing',
   [{'R0': {'bb': 2, 'er': 13, 'h': 11, 'hr': 12, 'outs': 0, 'sb': 3},
     'R1': {'bb': 0, 'er': 9, 'h': 0, 'hr': 15, 'outs': 27, 'sb': 8},
     'R2': {'bb': 9, 'er': 9, 'h': 13, 'hr': 10, 'outs': 54, 'sb': 5},
     'R3': {'bb': 6, 'er': 14, 'h': 21, 'hr': 10, 'outs': 81, 'sb': 5}}],
   {'R0': 12, 'R1': 28, 'R2': 20, 'R3': 20}),
  ('second regression',
   [{'R0': {'bb': 0, 'er': 5, 'h': 24, 'hr': 10, 'outs': 89, 'sb': 3},
     'R1': {'bb': 10, 'er': 9, 'h': 23, 'hr': 12, 'outs': 0, 'sb': 8},
     'R2': {'bb': 4, 'er': 9, 'h': 4, 'hr': 12, 'outs': 0, 'sb': 8},
     'R3': {'bb': 8, 'er': 1, 'h': 15, 'hr': 12, 'outs': 0, 'sb': 5},
     'R4': {'bb': 4, 'er': 4, 'h': 9, 'hr': 12, 'outs': 30, 'sb': 8}}],
   {'R0': 24, 'R1': 23, 'R2': 23, 'R3': 19, 'R4': 31}),
  ('normal control 1',
   [{'R0': {'bb': 5, 'er': 2, 'h': 19, 'hr': 12, 'outs': 0, 'sb': 5},
     'R1': {'bb': 0, 'er': 13, 'h': 2, 'hr': 15, 'outs': 21, 'sb': 3},
     'R2': {'bb': 4, 'er': 8, 'h': 22, 'hr': 10, 'outs': 54, 'sb': 8}}],
   {'R0': 12, 'R1': 18, 'R2': 18}),
  ('normal control 2',
   [{'R0': {'bb': 3, 'er': 14, 'h': 1, 'hr': 15, 'outs': 81, 'sb': 5},
     'R1': {'bb': 2, 'er': 13, 'h': 22, 'hr': 12, 'outs': 30, 'sb': 3},
     'R2': {'bb': 6, 'er': 14, 'h': 21, 'hr': 10, 'outs': 0, 'sb': 8}}],
   {'R0': 22, 'R1': 14, 'R2': 12}),
  ('normal control 3',
   [{'R0': {'bb': 2, 'er': 0, 'h': 17, 'hr': 15, 'outs': 81, 'sb': 8},
     'R1': {'bb': 6, 'er': 1, 'h': 7, 'hr': 10, 'outs': 81, 'sb': 5},
     'R2': {'bb': 4, 'er': 14, 'h': 16, 'hr': 12, 'outs': 54, 'sb': 3}}],
   {'R0': 22, 'R1': 16, 'R2': 10}),
  ('normal control 4',
   [{'R0': {'bb': 6, 'er': 3, 'h': 25, 'hr': 15, 'outs': 30, 'sb': 5},
     'R1': {'bb': 2, 'er': 11, 'h': 1, 'hr': 10, 'outs': 58, 'sb': 8},
     'R2': {'bb': 5, 'er': 9, 'h': 2, 'hr': 12, 'outs': 27, 'sb': 3}}],
   {'R0': 18, 'R1': 18, 'R2': 12})],
 [('regression: tie point sharing',
   [{'R0': {'bb': 1, 'er': 11, 'h': 22, 'hr': 12, 'outs': 30, 'sb': 5},
     'R1': {'bb': 6, 'er': 9, 'h': 14, 'hr': 12, 'outs': 81, 'sb': 3},
     'R2': {'bb': 8, 'er': 10, 'h': 2, 'hr': 10, 'outs': 54, 'sb': 5},
     'R3': {'bb': 10, 'er': 7, 'h': 19, 'hr': 12, 'outs': 33, 'sb': 8},
     'R4': {'bb': 4, 'er': 2, 'h': 7, 'hr': 15, 'outs': 30, 'sb': 8},
     'R5': {'bb': 0, 'er': 4, 'h': 14, 'hr': 15, 'outs': 54, 'sb': 8}}],
   {'R0': 17, 'R1': 26, 'R2': 25, 'R3': 22, 'R4': 39, 'R5': 39}),
  ('partial repair probe: tie point sharing',
   [{'R0': {'bb': 1, 'er': 13, 'h': 20, 'hr': 10, 'outs': 27, 'sb': 5},
     'R1': {'bb': 8, 'er': 10, 'h': 16, 'hr': 12, 'outs': 0, 'sb': 8},
     'R2': {'bb': 4, 'er': 3, 'h': 11, 'hr': 10, 'outs': 27, 'sb': 8},
     'R3': {'bb': 5, 'er': 5, 'h': 18, 'hr': 10, 'outs': 81, 'sb': 8},
     'R4': {'bb': 5, 'er': 1, 'h': 7, 'hr': 12, 'outs': 81, 'sb': 8},
     'R5': {'bb': 0, 'er': 3, 'h': 25, 'hr': 10, 'outs': 61, 'sb': 5}}],
   {'R0': 16, 'R1': 24, 'R2': 26, 'R3': 32, 'R4': 44, 'R5': 26}),
  ('second regression',
   [{'R0': {'bb': 7, 'er': 13, 'h': 21, 'hr': 12, 'outs': 81, 'sb': 3},
     'R1': {'bb': 2, 'er': 5, 'h': 23, 'hr': 12, 'outs': 69, 'sb': 5},
     'R2': {'bb': 3, 'er': 10, 'h': 13, 'hr': 10, 'outs': 54, 'sb': 8},
     'R3': {'bb': 0, 'er': 5, 'h': 23, 'hr': 10, 'outs': 54, 'sb': 3},
     'R4': {'bb': 0, 'er': 2, 'h': 8, 'hr': 12, 'outs': 81, 'sb': 8},
     'R5': {'bb': 4, 'er': 12, 'h': 24, 'hr': 15, 'outs': 54, 'sb': 5}}],
   {'R0': 25, 'R1': 31, 'R2': 28, 'R3': 18, 'R4': 43, 'R5': 23}),
  ('normal control 1',
   [{'R0': {'bb': 0, 'er': 5, 'h': 15, 'hr': 12, 'outs': 81, 'sb': 8},
     'R1': {'bb': 9, 'er': 2, 'h': 23, 'hr': 15, 'outs': 54, 'sb': 5},
     'R2': {'bb': 9, 'er': 0, 'h': 5, 'hr': 10, 'outs': 0, 'sb': 3}}],
   {'R0': 20, 'R1': 20, 'R2': 8}),
  ('normal control 2',
   [{'R0': {'bb': 0, 'er': 13, 'h': 3, 'hr': 15, 'outs': 30, 'sb': 5},
     'R1': {'bb': 2, 'er': 1, 'h': 16, 'hr': 10, 'outs': 20, 'sb': 8},
     'R2': {'bb': 3, 'er': 2, 'h': 11, 'hr': 12, 'outs': 0, 'sb': 3}}],
   {'R0': 20, 'R1': 18, 'R2': 10}),
  ('normal control 3',
   [{'R0': {'bb': 2, 'er': 6, 'h': 14, 'hr': 12, 'outs': 30, 'sb': 5},
     'R1': {'bb': 8, 'er': 5, 'h': 1, 'hr': 15, 'outs': 27, 'sb': 3},
     'R2': {'bb': 5, 'er': 6, 'h': 16, 'hr': 10, 'outs': 54, 'sb': 8}}],
   {'R0': 12, 'R1': 18, 'R2': 18}),
  ('normal control 4',
   [{'R0': {'bb': 8, 'er': 3, 'h': 24, 'hr': 15, 'outs': 81, 'sb': 8},
     'R1': {'bb': 9, 'er': 8, 'h': 4, 'hr': 12, 'outs': 54, 'sb': 5},
     'R2': {'bb': 10, 'er': 2, 'h': 3, 'hr': 10, 'outs': 30, 'sb': 3}}],
   {'R0': 22, 'R1': 16, 'R2': 10})],
 [('regression: tie point sharing',
   [{'R0': {'bb': 9, 'er': 13, 'h': 21, 'hr': 15, 'outs': 0, 'sb': 3},
     'R1': {'bb': 4, 'er': 11, 'h': 14, 'hr': 10, 'outs': 27, 'sb': 5},
     'R2': {'bb': 8, 'er': 5, 'h': 23, 'hr': 15, 'outs': 81, 'sb': 3},
     'R3': {'bb': 9, 'er': 7, 'h': 3, 'hr': 12, 'outs': 27, 'sb': 8},
     'R4': {'bb': 4, 'er': 11, 'h': 21, 'hr': 12, 'outs': 27, 'sb': 5},
     'R5': {'bb': 0, 'er': 7, 'h': 7, 'hr': 12, 'outs': 30, 'sb': 8}}],
   {'R0': 18, 'R1': 20, 'R2': 36, 'R3': 33, 'R4': 22, 'R5': 39}),
  ('partial repair probe: tie point sharing',
   [{'R0': {'bb': 4, 'er': 7, 'h': 9, 'hr': 15, 'outs': 0, 'sb': 5},
     'R1': {'bb': 2, 'er': 3, 'h': 25, 'hr': 15, 'outs': 30, 'sb': 3},
     'R2': {'bb': 2, 'er': 11, 'h': 4, 'hr': 10, 'outs': 27, 'sb': 5},
     'R3': {'bb': 5, 'er': 11, 'h': 3, 'hr': 12, 'outs': 27, 'sb': 8}}],
   {'R0': 16, 'R1': 21, 'R2': 20, 'R3': 23}),
  ('second regression',
   [{'R0': {'bb': 6, 'er': 8, 'h': 20, 'hr': 12, 'outs': 27, 'sb': 8},
     'R1': {'bb': 6, 'er': 9, 'h': 21, 'hr': 10, 'outs': 27, 'sb': 3},
     'R2': {'bb': 1, 'er': 3, 'h': 9, 'hr': 10, 'outs': 81, 'sb': 8},
     'R3': {'bb': 6, 'er': 8, 'h': 5, 'hr': 10, 'outs': 81, 'sb': 8},
     'R4': {'bb': 2, 'er': 1, 'h': 6, 'hr': 12, 'outs': 30, 'sb': 3}}],
   {'R0': 25, 'R1': 11, 'R2': 30, 'R3': 26, 'R4': 28}),
  ('normal control 1',
   [{'R0': {'bb': 5, 'er': 7, 'h': 2, 'hr': 10, 'outs': 54, 'sb': 8},
     'R1': {'bb': 0, 'er': 5, 'h': 3, 'hr': 15, 'outs': 81, 'sb': 5},
     'R2': {'bb': 4, 'er': 13, 'h': 0, 'hr': 12, 'outs': 0, 'sb': 3}}],
   {'R0': 16, 'R1': 22, 'R2': 10}),
  ('normal control 2',
   [{'R0': {'bb': 6, 'er': 7, 'h': 25, 'hr': 15, 'outs': 30, 'sb': 3},
     'R1': {'bb': 3, 'er': 9, 'h': 10, 'hr': 10, 'outs': 81, 'sb': 8},
     'R2': {'bb': 3, 'er': 0, 'h': 7, 'hr': 12, 'outs': 0, 'sb': 5}}],
   {'R0': 16, 'R1': 20, 'R2': 12}),
  ('normal control 3',
   [{'R0': {'bb': 4, 'er': 8, 'h': 14, 'hr': 12, 'outs': 72, 'sb': 3},
     'R1': {'bb': 6, 'er': 4, 'h': 19, 'hr': 10, 'outs': 89, 'sb': 5},
     'R2': {'bb': 9, 'er': 2, 'h': 11, 'hr': 15, 'outs': 30, 'sb': 8}}],
   {'R0': 14, 'R1': 16, 'R2': 18}),
  ('normal control 4',
   [{'R0': {'bb': 6, 'er': 6, 'h': 22, 'hr': 15, 'outs': 81, 'sb': 8},
     'R1': {'bb': 3, 'er': 8, 'h': 12, 'hr': 12, 'outs': 27, 'sb': 3},
     'R2': {'bb': 6, 'er': 6, 'h': 11, 'hr': 10, 'outs': 30, 'sb': 5}}],
   {'R0': 24, 'R1': 12, 'R2': 12})],
 [('regression: tie point sharing',
   [{'R0': {'bb': 5, 'er': 10, 'h': 5, 'hr': 12, 'outs': 54, 'sb': 5},
     'R1': {'bb': 1, 'er': 5, 'h': 21, 'hr': 15, 'outs': 81, 'sb': 3},
     'R2': {'bb': 9, 'er': 4, 'h': 7, 'hr': 12, 'outs': 0, 'sb': 8},
     'R3': {'bb': 3, 'er': 1, 'h': 23, 'hr': 12, 'outs': 9, 'sb': 8},
     'R4': {'bb': 9, 'er': 0, 'h': 18, 'hr': 10, 'outs': 27, 'sb': 8}}],
   {'R0': 24, 'R1': 28, 'R2': 18, 'R3': 24, 'R4': 26}),
  ('partial repair probe: tie point sharing',
   [{'R0': {'bb': 3, 'er': 14, 'h': 5, 'hr': 10, 'outs': 81, 'sb': 3},
     'R1': {'bb': 9, 'er': 11, 'h': 22, 'hr': 10, 'outs': 0, 'sb': 5},
     'R2': {'bb': 0, 'er': 9, 'h': 1, 'hr': 12, 'outs': 27, 'sb': 5},
     'R3': {'bb': 2, 'er': 2, 'h': 14, 'hr': 12, 'outs': 0, 'sb': 3}}],
   {'R0': 20, 'R1': 16, 'R2': 28, 'R3': 16}),
  ('second regression',
   [{'R0': {'bb': 8, 'er': 13, 'h': 17, 'hr': 12, 'outs': 81, 'sb': 5},
     'R1': {'bb': 8, 'er': 8, 'h': 7, 'hr': 15, 'outs': 54, 'sb': 3},
     'R2': {'bb': 6, 'er': 1, 'h': 24, 'hr': 15, 'outs': 27, 'sb': 5},
     'R3': {'bb': 7, 'er': 1, 'h': 13, 'hr': 12, 'outs': 27, 'sb': 3},
     'R4': {'bb': 3, 'er': 1, 'h': 1, 'hr': 12, 'outs': 27, 'sb': 8},
     'R5': {'bb': 4, 'er': 9, 'h': 6, 'hr': 10, 'outs': 0, 'sb': 8}}],
   {'R0': 25, 'R1': 30, 'R2': 32, 'R3': 25, 'R4': 39, 'R5': 17}),
  ('normal control 1',
   [{'R0': {'bb': 9, 'er': 14, 'h': 24, 'hr': 10, 'outs': 42, 'sb': 5},
     'R1': {'bb': 9, 'er': 9, 'h': 8, 'hr': 15, 'outs': 54, 'sb': 8},
     'R2': {'bb': 9, 'er': 6, 'h': 21, 'hr': 12, 'outs': 30, 'sb': 3}}],
   {'R0': 12, 'R1': 24, 'R2': 12}),
  ('normal control 2',
   [{'R0': {'bb': 6, 'er': 4, 'h': 2, 'hr': 12, 'outs': 81, 'sb': 5},
     'R1': {'bb': 10, 'er': 11, 'h': 4, 'hr': 15, 'outs': 30, 'sb': 8},
     'R2': {'bb': 9, 'er': 4, 'h': 5, 'hr': 10, 'outs': 27, 'sb': 3}}],
   {'R0': 20, 'R1': 18, 'R2': 10}),
  ('normal control 3',
   [{'R0': {'bb': 0, 'er': 11, 'h': 25, 'hr': 10, 'outs': 27, 'sb': 5},
     'R1': {'bb': 1, 'er': 6, 'h': 6, 'hr': 15, 'outs': 81, 'sb': 3},
     'R2': {'bb': 0, 'er': 6, 'h': 24, 'hr': 12, 'outs': 0, 'sb': 8}}],
   {'R0': 14, 'R1': 20, 'R2': 14}),
  ('normal control 4',
   [{'R0': {'bb': 9, 'er': 7, 'h': 3, 'hr': 12, 'outs': 27, 'sb': 8},
     'R1': {'bb': 10, 'er': 10, 'h': 8, 'hr': 10, 'outs': 27, 'sb': 5},
     'R2': {'bb': 1, 'er': 13, 'h': 16, 'hr': 15, 'outs': 81, 'sb': 3}}],
   {'R0': 18, 'R1': 10, 'R2': 20})]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "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
N = 1
observations = []
def solve(teams):
    names = sorted(teams)
    n = len(names)
    def value(t, cat):
        d = teams[t]
        if cat in ('hr', 'sb'):
            return Fraction(d[cat])
        if d['outs'] == 0:
            return None
        if cat == 'era':
            return Fraction(d['er'] * 27, d['outs'])
        return Fraction((d['bb'] + d['h']) * 3, d['outs'])
    total = {t: 0 for t in names}
    for cat in ('hr', 'sb', 'era', 'whip'):
        low = cat in ('era', 'whip')
        def key(t):
            v = value(t, cat)
            if v is None:
                return (1, 0)
            return (0, v if low else -v)
        ranked = sorted(names, key=key)
        i = 0
        while i < n:
            j = i
            while j < n and key(ranked[j]) == key(ranked[i]):
                j += 1
            pts2 = 2 * (n - j + 1)
            for t in ranked[i:j]:
                total[t] += pts2
            i = j
    return total
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: tie point sharing',
   [{'R0': {'bb': 2, 'er': 3, 'h': 25, 'hr': 15, 'outs': 60, 'sb': 8},
     'R1': {'bb': 9, 'er': 13, 'h': 6, 'hr': 12, 'outs': 0, 'sb': 8},
     'R2': {'bb': 2, 'er': 6, 'h': 21, 'hr': 10, 'outs': 54, 'sb': 5},
     'R3': {'bb': 6, 'er': 2, 'h': 5, 'hr': 15, 'outs': 0, 'sb': 8},
     'R4': {'bb': 5, 'er': 7, 'h': 12, 'hr': 15, 'outs': 81, 'sb': 8},
     'R5': {'bb': 1, 'er': 14, 'h': 0, 'hr': 10, 'outs': 30, 'sb': 5}}],
   {'R0': 37, 'R1': 21, 'R2': 22, 'R3': 25, 'R4': 39, 'R5': 24}),
  ('partial repair probe: tie point sharing',
   [{'R0': {'bb': 6, 'er': 14, 'h': 22, 'hr': 12, 'outs': 89, 'sb': 5},
     'R1': {'bb': 8, 'er': 14, 'h': 1, 'hr': 15, 'outs': 0, 'sb': 8},
     'R2': {'bb': 10, 'er': 3, 'h': 20, 'hr': 12, 'outs': 54, 'sb': 3},
     'R3': {'bb': 2, 'er': 7, 'h': 7, 'hr': 12, 'outs': 0, 'sb': 8},
     'R4': {'bb': 5, 'er': 14, 'h': 25, 'hr': 15, 'outs': 0, 'sb': 5}}],
   {'R0': 27, 'R1': 26, 'R2': 24, 'R3': 21, 'R4': 22}),
  ('second regression',
   [{'R0': {'bb': 2, 'er': 9, 'h': 18, 'hr': 12, 'outs': 42, 'sb': 3},
     'R1': {'bb': 1, 'er': 9, 'h': 23, 'hr': 15, 'outs': 27, 'sb': 5},
     'R2': {'bb': 5, 'er': 7, 'h': 5, 'hr': 10, 'outs': 54, 'sb': 5}}],
   {'R0': 14, 'R1': 15, 'R2': 19}),
  ('normal control 1',
   [{'R0': {'bb': 0, 'er': 1, 'h': 23, 'hr': 12, 'outs': 4, 'sb': 8},
     'R1': {'bb': 8, 'er': 6, 'h': 7, 'hr': 15, 'outs': 30, 'sb': 3},
     'R2': {'bb': 1, 'er': 12, 'h': 7, 'hr': 10, 'outs': 27, 'sb': 5}}],
   {'R0': 16, 'R1': 18, 'R2': 14}),
  ('normal control 2',
   [{'R0': {'bb': 7, 'er': 2, 'h': 16, 'hr': 15, 'outs': 0, 'sb': 8},
     'R1': {'bb': 3, 'er': 9, 'h': 21, 'hr': 10, 'outs': 30, 'sb': 5},
     'R2': {'bb': 1, 'er': 3, 'h': 23, 'hr': 12, 'outs': 81, 'sb': 3}}],
   {'R0': 16, 'R1': 14, 'R2': 18}),
  ('normal control 3',
   [{'R0': {'bb': 9, 'er': 1, 'h': 12, 'hr': 12, 'outs': 54, 'sb': 5},
     'R1': {'bb': 4, 'er': 1, 'h': 0, 'hr': 10, 'outs': 30, 'sb': 8},
     'R2': {'bb': 2, 'er': 10, 'h': 22, 'hr': 15, 'outs': 30, 'sb': 3}}],
   {'R0': 18, 'R1': 18, 'R2': 12})],
 [('regression: tie point sharing',
   [{'R0': {'bb': 2, 'er': 0, 'h': 11, 'hr': 15, 'outs': 81, 'sb': 5},
     'R1': {'bb': 3, 'er': 9, 'h': 2, 'hr': 12, 'outs': 30, 'sb': 3},
     'R2': {'bb': 10, 'er': 4, 'h': 17, 'hr': 12, 'outs': 24, 'sb': 3},
     'R3': {'bb': 7, 'er': 2, 'h': 11, 'hr': 15, 'outs': 81, 'sb': 3},
     'R4': {'bb': 1, 'er': 0, 'h': 0, 'hr': 10, 'outs': 27, 'sb': 5}}],
   {'R0': 35, 'R1': 17, 'R2': 15, 'R3': 23, 'R4': 30}),
  ('partial repair probe: tie point sharing',
   [{'R0': {'bb': 2, 'er': 13, 'h': 11, 'hr': 12, 'outs': 0, 'sb': 3},
     'R1': {'bb': 0, 'er': 9, 'h': 0, 'hr': 15, 'outs': 27, 'sb': 8},
     'R2': {'bb': 9, 'er': 9, 'h': 13, 'hr': 10, 'outs': 54, 'sb': 5},
     'R3': {'bb': 6, 'er': 14, 'h': 21, 'hr': 10, 'outs': 81, 'sb': 5}}],
   {'R0': 12, 'R1': 28, 'R2': 20, 'R3': 20}),
  ('second regression',
   [{'R0': {'bb': 0, 'er': 5, 'h': 24, 'hr': 10, 'outs': 89, 'sb': 3},
     'R1': {'bb': 10, 'er': 9, 'h': 23, 'hr': 12, 'outs': 0, 'sb': 8},
     'R2': {'bb': 4, 'er': 9, 'h': 4, 'hr': 12, 'outs': 0, 'sb': 8},
     'R3': {'bb': 8, 'er': 1, 'h': 15, 'hr': 12, 'outs': 0, 'sb': 5},
     'R4': {'bb': 4, 'er': 4, 'h': 9, 'hr': 12, 'outs': 30, 'sb': 8}}],
   {'R0': 24, 'R1': 23, 'R2': 23, 'R3': 19, 'R4': 31}),
  ('normal control 1',
   [{'R0': {'bb': 5, 'er': 2, 'h': 19, 'hr': 12, 'outs': 0, 'sb': 5},
     'R1': {'bb': 0, 'er': 13, 'h': 2, 'hr': 15, 'outs': 21, 'sb': 3},
     'R2': {'bb': 4, 'er': 8, 'h': 22, 'hr': 10, 'outs': 54, 'sb': 8}}],
   {'R0': 12, 'R1': 18, 'R2': 18}),
  ('normal control 2',
   [{'R0': {'bb': 3, 'er': 14, 'h': 1, 'hr': 15, 'outs': 81, 'sb': 5},
     'R1': {'bb': 2, 'er': 13, 'h': 22, 'hr': 12, 'outs': 30, 'sb': 3},
     'R2': {'bb': 6, 'er': 14, 'h': 21, 'hr': 10, 'outs': 0, 'sb': 8}}],
   {'R0': 22, 'R1': 14, 'R2': 12}),
  ('normal control 3',
   [{'R0': {'bb': 2, 'er': 0, 'h': 17, 'hr': 15, 'outs': 81, 'sb': 8},
     'R1': {'bb': 6, 'er': 1, 'h': 7, 'hr': 10, 'outs': 81, 'sb': 5},
     'R2': {'bb': 4, 'er': 14, 'h': 16, 'hr': 12, 'outs': 54, 'sb': 3}}],
   {'R0': 22, 'R1': 16, 'R2': 10}),
  ('normal control 4',
   [{'R0': {'bb': 6, 'er': 3, 'h': 25, 'hr': 15, 'outs': 30, 'sb': 5},
     'R1': {'bb': 2, 'er': 11, 'h': 1, 'hr': 10, 'outs': 58, 'sb': 8},
     'R2': {'bb': 5, 'er': 9, 'h': 2, 'hr': 12, 'outs': 27, 'sb': 3}}],
   {'R0': 18, 'R1': 18, 'R2': 12})],
 [('regression: tie point sharing',
   [{'R0': {'bb': 1, 'er': 11, 'h': 22, 'hr': 12, 'outs': 30, 'sb': 5},
     'R1': {'bb': 6, 'er': 9, 'h': 14, 'hr': 12, 'outs': 81, 'sb': 3},
     'R2': {'bb': 8, 'er': 10, 'h': 2, 'hr': 10, 'outs': 54, 'sb': 5},
     'R3': {'bb': 10, 'er': 7, 'h': 19, 'hr': 12, 'outs': 33, 'sb': 8},
     'R4': {'bb': 4, 'er': 2, 'h': 7, 'hr': 15, 'outs': 30, 'sb': 8},
     'R5': {'bb': 0, 'er': 4, 'h': 14, 'hr': 15, 'outs': 54, 'sb': 8}}],
   {'R0': 17, 'R1': 26, 'R2': 25, 'R3': 22, 'R4': 39, 'R5': 39}),
  ('partial repair probe: tie point sharing',
   [{'R0': {'bb': 1, 'er': 13, 'h': 20, 'hr': 10, 'outs': 27, 'sb': 5},
     'R1': {'bb': 8, 'er': 10, 'h': 16, 'hr': 12, 'outs': 0, 'sb': 8},
     'R2': {'bb': 4, 'er': 3, 'h': 11, 'hr': 10, 'outs': 27, 'sb': 8},
     'R3': {'bb': 5, 'er': 5, 'h': 18, 'hr': 10, 'outs': 81, 'sb': 8},
     'R4': {'bb': 5, 'er': 1, 'h': 7, 'hr': 12, 'outs': 81, 'sb': 8},
     'R5': {'bb': 0, 'er': 3, 'h': 25, 'hr': 10, 'outs': 61, 'sb': 5}}],
   {'R0': 16, 'R1': 24, 'R2': 26, 'R3': 32, 'R4': 44, 'R5': 26}),
  ('second regression',
   [{'R0': {'bb': 7, 'er': 13, 'h': 21, 'hr': 12, 'outs': 81, 'sb': 3},
     'R1': {'bb': 2, 'er': 5, 'h': 23, 'hr': 12, 'outs': 69, 'sb': 5},
     'R2': {'bb': 3, 'er': 10, 'h': 13, 'hr': 10, 'outs': 54, 'sb': 8},
     'R3': {'bb': 0, 'er': 5, 'h': 23, 'hr': 10, 'outs': 54, 'sb': 3},
     'R4': {'bb': 0, 'er': 2, 'h': 8, 'hr': 12, 'outs': 81, 'sb': 8},
     'R5': {'bb': 4, 'er': 12, 'h': 24, 'hr': 15, 'outs': 54, 'sb': 5}}],
   {'R0': 25, 'R1': 31, 'R2': 28, 'R3': 18, 'R4': 43, 'R5': 23}),
  ('normal control 1',
   [{'R0': {'bb': 0, 'er': 5, 'h': 15, 'hr': 12, 'outs': 81, 'sb': 8},
     'R1': {'bb': 9, 'er': 2, 'h': 23, 'hr': 15, 'outs': 54, 'sb': 5},
     'R2': {'bb': 9, 'er': 0, 'h': 5, 'hr': 10, 'outs': 0, 'sb': 3}}],
   {'R0': 20, 'R1': 20, 'R2': 8}),
  ('normal control 2',
   [{'R0': {'bb': 0, 'er': 13, 'h': 3, 'hr': 15, 'outs': 30, 'sb': 5},
     'R1': {'bb': 2, 'er': 1, 'h': 16, 'hr': 10, 'outs': 20, 'sb': 8},
     'R2': {'bb': 3, 'er': 2, 'h': 11, 'hr': 12, 'outs': 0, 'sb': 3}}],
   {'R0': 20, 'R1': 18, 'R2': 10}),
  ('normal control 3',
   [{'R0': {'bb': 2, 'er': 6, 'h': 14, 'hr': 12, 'outs': 30, 'sb': 5},
     'R1': {'bb': 8, 'er': 5, 'h': 1, 'hr': 15, 'outs': 27, 'sb': 3},
     'R2': {'bb': 5, 'er': 6, 'h': 16, 'hr': 10, 'outs': 54, 'sb': 8}}],
   {'R0': 12, 'R1': 18, 'R2': 18}),
  ('normal control 4',
   [{'R0': {'bb': 8, 'er': 3, 'h': 24, 'hr': 15, 'outs': 81, 'sb': 8},
     'R1': {'bb': 9, 'er': 8, 'h': 4, 'hr': 12, 'outs': 54, 'sb': 5},
     'R2': {'bb': 10, 'er': 2, 'h': 3, 'hr': 10, 'outs': 30, 'sb': 3}}],
   {'R0': 22, 'R1': 16, 'R2': 10})],
 [('regression: tie point sharing',
   [{'R0': {'bb': 9, 'er': 13, 'h': 21, 'hr': 15, 'outs': 0, 'sb': 3},
     'R1': {'bb': 4, 'er': 11, 'h': 14, 'hr': 10, 'outs': 27, 'sb': 5},
     'R2': {'bb': 8, 'er': 5, 'h': 23, 'hr': 15, 'outs': 81, 'sb': 3},
     'R3': {'bb': 9, 'er': 7, 'h': 3, 'hr': 12, 'outs': 27, 'sb': 8},
     'R4': {'bb': 4, 'er': 11, 'h': 21, 'hr': 12, 'outs': 27, 'sb': 5},
     'R5': {'bb': 0, 'er': 7, 'h': 7, 'hr': 12, 'outs': 30, 'sb': 8}}],
   {'R0': 18, 'R1': 20, 'R2': 36, 'R3': 33, 'R4': 22, 'R5': 39}),
  ('partial repair probe: tie point sharing',
   [{'R0': {'bb': 4, 'er': 7, 'h': 9, 'hr': 15, 'outs': 0, 'sb': 5},
     'R1': {'bb': 2, 'er': 3, 'h': 25, 'hr': 15, 'outs': 30, 'sb': 3},
     'R2': {'bb': 2, 'er': 11, 'h': 4, 'hr': 10, 'outs': 27, 'sb': 5},
     'R3': {'bb': 5, 'er': 11, 'h': 3, 'hr': 12, 'outs': 27, 'sb': 8}}],
   {'R0': 16, 'R1': 21, 'R2': 20, 'R3': 23}),
  ('second regression',
   [{'R0': {'bb': 6, 'er': 8, 'h': 20, 'hr': 12, 'outs': 27, 'sb': 8},
     'R1': {'bb': 6, 'er': 9, 'h': 21, 'hr': 10, 'outs': 27, 'sb': 3},
     'R2': {'bb': 1, 'er': 3, 'h': 9, 'hr': 10, 'outs': 81, 'sb': 8},
     'R3': {'bb': 6, 'er': 8, 'h': 5, 'hr': 10, 'outs': 81, 'sb': 8},
     'R4': {'bb': 2, 'er': 1, 'h': 6, 'hr': 12, 'outs': 30, 'sb': 3}}],
   {'R0': 25, 'R1': 11, 'R2': 30, 'R3': 26, 'R4': 28}),
  ('normal control 1',
   [{'R0': {'bb': 5, 'er': 7, 'h': 2, 'hr': 10, 'outs': 54, 'sb': 8},
     'R1': {'bb': 0, 'er': 5, 'h': 3, 'hr': 15, 'outs': 81, 'sb': 5},
     'R2': {'bb': 4, 'er': 13, 'h': 0, 'hr': 12, 'outs': 0, 'sb': 3}}],
   {'R0': 16, 'R1': 22, 'R2': 10}),
  ('normal control 2',
   [{'R0': {'bb': 6, 'er': 7, 'h': 25, 'hr': 15, 'outs': 30, 'sb': 3},
     'R1': {'bb': 3, 'er': 9, 'h': 10, 'hr': 10, 'outs': 81, 'sb': 8},
     'R2': {'bb': 3, 'er': 0, 'h': 7, 'hr': 12, 'outs': 0, 'sb': 5}}],
   {'R0': 16, 'R1': 20, 'R2': 12}),
  ('normal control 3',
   [{'R0': {'bb': 4, 'er': 8, 'h': 14, 'hr': 12, 'outs': 72, 'sb': 3},
     'R1': {'bb': 6, 'er': 4, 'h': 19, 'hr': 10, 'outs': 89, 'sb': 5},
     'R2': {'bb': 9, 'er': 2, 'h': 11, 'hr': 15, 'outs': 30, 'sb': 8}}],
   {'R0': 14, 'R1': 16, 'R2': 18}),
  ('normal control 4',
   [{'R0': {'bb': 6, 'er': 6, 'h': 22, 'hr': 15, 'outs': 81, 'sb': 8},
     'R1': {'bb': 3, 'er': 8, 'h': 12, 'hr': 12, 'outs': 27, 'sb': 3},
     'R2': {'bb': 6, 'er': 6, 'h': 11, 'hr': 10, 'outs': 30, 'sb': 5}}],
   {'R0': 24, 'R1': 12, 'R2': 12})],
 [('regression: tie point sharing',
   [{'R0': {'bb': 5, 'er': 10, 'h': 5, 'hr': 12, 'outs': 54, 'sb': 5},
     'R1': {'bb': 1, 'er': 5, 'h': 21, 'hr': 15, 'outs': 81, 'sb': 3},
     'R2': {'bb': 9, 'er': 4, 'h': 7, 'hr': 12, 'outs': 0, 'sb': 8},
     'R3': {'bb': 3, 'er': 1, 'h': 23, 'hr': 12, 'outs': 9, 'sb': 8},
     'R4': {'bb': 9, 'er': 0, 'h': 18, 'hr': 10, 'outs': 27, 'sb': 8}}],
   {'R0': 24, 'R1': 28, 'R2': 18, 'R3': 24, 'R4': 26}),
  ('partial repair probe: tie point sharing',
   [{'R0': {'bb': 3, 'er': 14, 'h': 5, 'hr': 10, 'outs': 81, 'sb': 3},
     'R1': {'bb': 9, 'er': 11, 'h': 22, 'hr': 10, 'outs': 0, 'sb': 5},
     'R2': {'bb': 0, 'er': 9, 'h': 1, 'hr': 12, 'outs': 27, 'sb': 5},
     'R3': {'bb': 2, 'er': 2, 'h': 14, 'hr': 12, 'outs': 0, 'sb': 3}}],
   {'R0': 20, 'R1': 16, 'R2': 28, 'R3': 16}),
  ('second regression',
   [{'R0': {'bb': 8, 'er': 13, 'h': 17, 'hr': 12, 'outs': 81, 'sb': 5},
     'R1': {'bb': 8, 'er': 8, 'h': 7, 'hr': 15, 'outs': 54, 'sb': 3},
     'R2': {'bb': 6, 'er': 1, 'h': 24, 'hr': 15, 'outs': 27, 'sb': 5},
     'R3': {'bb': 7, 'er': 1, 'h': 13, 'hr': 12, 'outs': 27, 'sb': 3},
     'R4': {'bb': 3, 'er': 1, 'h': 1, 'hr': 12, 'outs': 27, 'sb': 8},
     'R5': {'bb': 4, 'er': 9, 'h': 6, 'hr': 10, 'outs': 0, 'sb': 8}}],
   {'R0': 25, 'R1': 30, 'R2': 32, 'R3': 25, 'R4': 39, 'R5': 17}),
  ('normal control 1',
   [{'R0': {'bb': 9, 'er': 14, 'h': 24, 'hr': 10, 'outs': 42, 'sb': 5},
     'R1': {'bb': 9, 'er': 9, 'h': 8, 'hr': 15, 'outs': 54, 'sb': 8},
     'R2': {'bb': 9, 'er': 6, 'h': 21, 'hr': 12, 'outs': 30, 'sb': 3}}],
   {'R0': 12, 'R1': 24, 'R2': 12}),
  ('normal control 2',
   [{'R0': {'bb': 6, 'er': 4, 'h': 2, 'hr': 12, 'outs': 81, 'sb': 5},
     'R1': {'bb': 10, 'er': 11, 'h': 4, 'hr': 15, 'outs': 30, 'sb': 8},
     'R2': {'bb': 9, 'er': 4, 'h': 5, 'hr': 10, 'outs': 27, 'sb': 3}}],
   {'R0': 20, 'R1': 18, 'R2': 10}),
  ('normal control 3',
   [{'R0': {'bb': 0, 'er': 11, 'h': 25, 'hr': 10, 'outs': 27, 'sb': 5},
     'R1': {'bb': 1, 'er': 6, 'h': 6, 'hr': 15, 'outs': 81, 'sb': 3},
     'R2': {'bb': 0, 'er': 6, 'h': 24, 'hr': 12, 'outs': 0, 'sb': 8}}],
   {'R0': 14, 'R1': 20, 'R2': 14}),
  ('normal control 4',
   [{'R0': {'bb': 9, 'er': 7, 'h': 3, 'hr': 12, 'outs': 27, 'sb': 8},
     'R1': {'bb': 10, 'er': 10, 'h': 8, 'hr': 10, 'outs': 27, 'sb': 5},
     'R2': {'bb': 1, 'er': 13, 'h': 16, 'hr': 15, 'outs': 81, 'sb': 3}}],
   {'R0': 18, 'R1': 10, 'R2': 20})]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "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:
Three teams tied in home runs each receive first-place points.

Rotisserie categories HR and SB rank high-to-low; ERA (earned runs x 27 / outs) and WHIP ((walks + hits) x 3 / outs) rank low-to-high using exact ratios. A team with zero outs has no ERA/WHIP and ranks last. With n teams the best rank earns n points and the worst 1; tied teams share the average of the positions they occupy. Return team -> doubled roto points (integers).

split: open-access


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

N = 1
observations = []
def solve(line, bonus):
    line = dict(line, reb=line['dreb'])
    w = {'pts': 10, 'reb': 12, 'ast': 15, 'stl': 30, 'blk': 30, 'tov': -10, 'fg3m': 5}
    score = sum(w[k] * line[k] for k in w)
    doubles = sum(1 for k in ('pts', 'reb', 'ast', 'stl', 'blk') if line[k] >= 10)
    if doubles >= 3:
        score += bonus['td']
    elif doubles == 2:
        score += bonus['dd']
    return score
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: rebound composition',
   [{'ast': 10, 'blk': 10, 'dreb': 5, 'fg3m': 2, 'oreb': 4, 'pts': 10, 'stl': 2, 'tov': 0},
    {'dd': 15, 'td': 30}],
   758),
  ('partial repair probe: rebound composition',
   [{'ast': 10, 'blk': 0, 'dreb': 8, 'fg3m': 5, 'oreb': 5, 'pts': 9, 'stl': 2, 'tov': 2},
    {'dd': 15, 'td': 30}],
   476),
  ('second regression',
   [{'ast': 9, 'blk': 10, 'dreb': 10, 'fg3m': 6, 'oreb': 6, 'pts': 10, 'stl': 1, 'tov': 0},
    {'dd': 15, 'td': 30}],
   817),
  ('normal control 1',
   [{'ast': 11, 'blk': 0, 'dreb': 5, 'fg3m': 1, 'oreb': 0, 'pts': 23, 'stl': 1, 'tov': 3},
    {'dd': 15, 'td': 30}],
   475),
  ('normal control 2',
   [{'ast': 9, 'blk': 2, 'dreb': 10, 'fg3m': 4, 'oreb': 0, 'pts': 11, 'stl': 0, 'tov': 2},
    {'dd': 15, 'td': 30}],
   440),
  ('normal control 3',
   [{'ast': 10, 'blk': 1, 'dreb': 5, 'fg3m': 1, 'oreb': 0, 'pts': 11, 'stl': 0, 'tov': 6},
    {'dd': 15, 'td': 30}],
   310),
  ('normal control 4',
   [{'ast': 9, 'blk': 10, 'dreb': 8, 'fg3m': 1, 'oreb': 0, 'pts': 10, 'stl': 10, 'tov': 5},
    {'dd': 15, 'td': 30}],
   916)],
 [('regression: rebound composition',
   [{'ast': 10, 'blk': 1, 'dreb': 8, 'fg3m': 2, 'oreb': 4, 'pts': 9, 'stl': 2, 'tov': 4},
    {'dd': 15, 'td': 30}],
   459),
  ('partial repair probe: rebound composition',
   [{'ast': 11, 'blk': 11, 'dreb': 9, 'fg3m': 1, 'oreb': 3, 'pts': 40, 'stl': 10, 'tov': 5},
    {'dd': 15, 'td': 30}],
   1324),
  ('second regression',
   [{'ast': 11, 'blk': 2, 'dreb': 8, 'fg3m': 1, 'oreb': 3, 'pts': 10, 'stl': 0, 'tov': 3},
    {'dd': 15, 'td': 30}],
   462),
  ('normal control 1',
   [{'ast': 8, 'blk': 11, 'dreb': 5, 'fg3m': 2, 'oreb': 0, 'pts': 39, 'stl': 0, 'tov': 3},
    {'dd': 15, 'td': 30}],
   895),
  ('normal control 2',
   [{'ast': 11, 'blk': 1, 'dreb': 10, 'fg3m': 4, 'oreb': 0, 'pts': 10, 'stl': 2, 'tov': 5},
    {'dd': 15, 'td': 30}],
   475),
  ('normal control 3',
   [{'ast': 10, 'blk': 0, 'dreb': 9, 'fg3m': 1, 'oreb': 0, 'pts': 10, 'stl': 1, 'tov': 5},
    {'dd': 15, 'td': 30}],
   358),
  ('normal control 4',
   [{'ast': 9, 'blk': 10, 'dreb': 9, 'fg3m': 3, 'oreb': 0, 'pts': 10, 'stl': 2, 'tov': 4},
    {'dd': 15, 'td': 30}],
   693)],
 [('regression: rebound composition',
   [{'ast': 11, 'blk': 11, 'dreb': 4, 'fg3m': 5, 'oreb': 2, 'pts': 10, 'stl': 3, 'tov': 4},
    {'dd': 15, 'td': 30}],
   772),
  ('partial repair probe: rebound composition',
   [{'ast': 11, 'blk': 0, 'dreb': 12, 'fg3m': 0, 'oreb': 3, 'pts': 10, 'stl': 3, 'tov': 1},
    {'dd': 15, 'td': 30}],
   555),
  ('second regression',
   [{'ast': 0, 'blk': 0, 'dreb': 9, 'fg3m': 2, 'oreb': 3, 'pts': 10, 'stl': 1, 'tov': 2},
    {'dd': 15, 'td': 30}],
   279),
  ('normal control 1',
   [{'ast': 11, 'blk': 0, 'dreb': 5, 'fg3m': 6, 'oreb': 0, 'pts': 11, 'stl': 0, 'tov': 3},
    {'dd': 15, 'td': 30}],
   350),
  ('normal control 2',
   [{'ast': 10, 'blk': 1, 'dreb': 8, 'fg3m': 4, 'oreb': 0, 'pts': 11, 'stl': 0, 'tov': 0},
    {'dd': 15, 'td': 30}],
   421),
  ('normal control 3',
   [{'ast': 9, 'blk': 10, 'dreb': 4, 'fg3m': 1, 'oreb': 0, 'pts': 11, 'stl': 2, 'tov': 3},
    {'dd': 15, 'td': 30}],
   643),
  ('normal control 4',
   [{'ast': 10, 'blk': 0, 'dreb': 12, 'fg3m': 0, 'oreb': 0, 'pts': 26, 'stl': 1, 'tov': 3},
    {'dd': 15, 'td': 30}],
   584)],
 [('regression: rebound composition',
   [{'ast': 10, 'blk': 11, 'dreb': 5, 'fg3m': 1, 'oreb': 3, 'pts': 10, 'stl': 1, 'tov': 2},
    {'dd': 15, 'td': 30}],
   721),
  ('partial repair probe: rebound composition',
   [{'ast': 10, 'blk': 10, 'dreb': 4, 'fg3m': 3, 'oreb': 1, 'pts': 10, 'stl': 10, 'tov': 0},
    {'dd': 15, 'td': 30}],
   955),
  ('second regression',
   [{'ast': 13, 'blk': 11, 'dreb': 10, 'fg3m': 1, 'oreb': 6, 'pts': 11, 'stl': 2, 'tov': 5},
    {'dd': 15, 'td': 30}],
   872),
  ('normal control 1',
   [{'ast': 10, 'blk': 2, 'dreb': 5, 'fg3m': 0, 'oreb': 0, 'pts': 9, 'stl': 2, 'tov': 1},
    {'dd': 15, 'td': 30}],
   410),
  ('normal control 2',
   [{'ast': 1, 'blk': 10, 'dreb': 5, 'fg3m': 0, 'oreb': 0, 'pts': 12, 'stl': 1, 'tov': 6},
    {'dd': 15, 'td': 30}],
   480),
  ('normal control 3',
   [{'ast': 9, 'blk': 10, 'dreb': 5, 'fg3m': 4, 'oreb': 0, 'pts': 9, 'stl': 2, 'tov': 2},
    {'dd': 15, 'td': 30}],
   645),
  ('normal control 4',
   [{'ast': 5, 'blk': 11, 'dreb': 8, 'fg3m': 0, 'oreb': 0, 'pts': 9, 'stl': 10, 'tov': 4},
    {'dd': 15, 'td': 30}],
   866)],
 [('regression: rebound composition',
   [{'ast': 6, 'blk': 11, 'dreb': 4, 'fg3m': 1, 'oreb': 3, 'pts': 11, 'stl': 0, 'tov': 2},
    {'dd': 15, 'td': 30}],
   614),
  ('partial repair probe: rebound composition',
   [{'ast': 10, 'blk': 11, 'dreb': 8, 'fg3m': 3, 'oreb': 6, 'pts': 9, 'stl': 1, 'tov': 2},
    {'dd': 15, 'td': 30}],
   793),
  ('second regression',
   [{'ast': 10, 'blk': 10, 'dreb': 9, 'fg3m': 1, 'oreb': 5, 'pts': 9, 'stl': 0, 'tov': 4},
    {'dd': 15, 'td': 30}],
   703),
  ('normal control 1',
   [{'ast': 11, 'blk': 1, 'dreb': 12, 'fg3m': 6, 'oreb': 0, 'pts': 10, 'stl': 10, 'tov': 1},
    {'dd': 15, 'td': 30}],
   789),
  ('normal control 2',
   [{'ast': 8, 'blk': 1, 'dreb': 10, 'fg3m': 6, 'oreb': 0, 'pts': 10, 'stl': 2, 'tov': 3},
    {'dd': 15, 'td': 30}],
   445),
  ('normal control 3',
   [{'ast': 9, 'blk': 11, 'dreb': 4, 'fg3m': 6, 'oreb': 0, 'pts': 8, 'stl': 0, 'tov': 0},
    {'dd': 15, 'td': 30}],
   623),
  ('normal control 4',
   [{'ast': 6, 'blk': 0, 'dreb': 10, 'fg3m': 1, 'oreb': 0, 'pts': 10, 'stl': 3, 'tov': 1},
    {'dd': 15, 'td': 30}],
   410)]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "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(line, bonus):
    line = dict(line, reb=max(line['oreb'], line['dreb']))
    w = {'pts': 10, 'reb': 12, 'ast': 15, 'stl': 30, 'blk': 30, 'tov': -10, 'fg3m': 5}
    score = sum(w[k] * line[k] for k in w)
    doubles = sum(1 for k in ('pts', 'reb', 'ast', 'stl', 'blk') if line[k] >= 10)
    if doubles >= 3:
        score += bonus['td']
    elif doubles == 2:
        score += bonus['dd']
    return score
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: rebound composition',
   [{'ast': 10, 'blk': 10, 'dreb': 5, 'fg3m': 2, 'oreb': 4, 'pts': 10, 'stl': 2, 'tov': 0},
    {'dd': 15, 'td': 30}],
   758),
  ('partial repair probe: rebound composition',
   [{'ast': 10, 'blk': 0, 'dreb': 8, 'fg3m': 5, 'oreb': 5, 'pts': 9, 'stl': 2, 'tov': 2},
    {'dd': 15, 'td': 30}],
   476),
  ('second regression',
   [{'ast': 9, 'blk': 10, 'dreb': 10, 'fg3m': 6, 'oreb': 6, 'pts': 10, 'stl': 1, 'tov': 0},
    {'dd': 15, 'td': 30}],
   817),
  ('normal control 1',
   [{'ast': 11, 'blk': 0, 'dreb': 5, 'fg3m': 1, 'oreb': 0, 'pts': 23, 'stl': 1, 'tov': 3},
    {'dd': 15, 'td': 30}],
   475),
  ('normal control 2',
   [{'ast': 9, 'blk': 2, 'dreb': 10, 'fg3m': 4, 'oreb': 0, 'pts': 11, 'stl': 0, 'tov': 2},
    {'dd': 15, 'td': 30}],
   440),
  ('normal control 3',
   [{'ast': 10, 'blk': 1, 'dreb': 5, 'fg3m': 1, 'oreb': 0, 'pts': 11, 'stl': 0, 'tov': 6},
    {'dd': 15, 'td': 30}],
   310),
  ('normal control 4',
   [{'ast': 9, 'blk': 10, 'dreb': 8, 'fg3m': 1, 'oreb': 0, 'pts': 10, 'stl': 10, 'tov': 5},
    {'dd': 15, 'td': 30}],
   916)],
 [('regression: rebound composition',
   [{'ast': 10, 'blk': 1, 'dreb': 8, 'fg3m': 2, 'oreb': 4, 'pts': 9, 'stl': 2, 'tov': 4},
    {'dd': 15, 'td': 30}],
   459),
  ('partial repair probe: rebound composition',
   [{'ast': 11, 'blk': 11, 'dreb': 9, 'fg3m': 1, 'oreb': 3, 'pts': 40, 'stl': 10, 'tov': 5},
    {'dd': 15, 'td': 30}],
   1324),
  ('second regression',
   [{'ast': 11, 'blk': 2, 'dreb': 8, 'fg3m': 1, 'oreb': 3, 'pts': 10, 'stl': 0, 'tov': 3},
    {'dd': 15, 'td': 30}],
   462),
  ('normal control 1',
   [{'ast': 8, 'blk': 11, 'dreb': 5, 'fg3m': 2, 'oreb': 0, 'pts': 39, 'stl': 0, 'tov': 3},
    {'dd': 15, 'td': 30}],
   895),
  ('normal control 2',
   [{'ast': 11, 'blk': 1, 'dreb': 10, 'fg3m': 4, 'oreb': 0, 'pts': 10, 'stl': 2, 'tov': 5},
    {'dd': 15, 'td': 30}],
   475),
  ('normal control 3',
   [{'ast': 10, 'blk': 0, 'dreb': 9, 'fg3m': 1, 'oreb': 0, 'pts': 10, 'stl': 1, 'tov': 5},
    {'dd': 15, 'td': 30}],
   358),
  ('normal control 4',
   [{'ast': 9, 'blk': 10, 'dreb': 9, 'fg3m': 3, 'oreb': 0, 'pts': 10, 'stl': 2, 'tov': 4},
    {'dd': 15, 'td': 30}],
   693)],
 [('regression: rebound composition',
   [{'ast': 11, 'blk': 11, 'dreb': 4, 'fg3m': 5, 'oreb': 2, 'pts': 10, 'stl': 3, 'tov': 4},
    {'dd': 15, 'td': 30}],
   772),
  ('partial repair probe: rebound composition',
   [{'ast': 11, 'blk': 0, 'dreb': 12, 'fg3m': 0, 'oreb': 3, 'pts': 10, 'stl': 3, 'tov': 1},
    {'dd': 15, 'td': 30}],
   555),
  ('second regression',
   [{'ast': 0, 'blk': 0, 'dreb': 9, 'fg3m': 2, 'oreb': 3, 'pts': 10, 'stl': 1, 'tov': 2},
    {'dd': 15, 'td': 30}],
   279),
  ('normal control 1',
   [{'ast': 11, 'blk': 0, 'dreb': 5, 'fg3m': 6, 'oreb': 0, 'pts': 11, 'stl': 0, 'tov': 3},
    {'dd': 15, 'td': 30}],
   350),
  ('normal control 2',
   [{'ast': 10, 'blk': 1, 'dreb': 8, 'fg3m': 4, 'oreb': 0, 'pts': 11, 'stl': 0, 'tov': 0},
    {'dd': 15, 'td': 30}],
   421),
  ('normal control 3',
   [{'ast': 9, 'blk': 10, 'dreb': 4, 'fg3m': 1, 'oreb': 0, 'pts': 11, 'stl': 2, 'tov': 3},
    {'dd': 15, 'td': 30}],
   643),
  ('normal control 4',
   [{'ast': 10, 'blk': 0, 'dreb': 12, 'fg3m': 0, 'oreb': 0, 'pts': 26, 'stl': 1, 'tov': 3},
    {'dd': 15, 'td': 30}],
   584)],
 [('regression: rebound composition',
   [{'ast': 10, 'blk': 11, 'dreb': 5, 'fg3m': 1, 'oreb': 3, 'pts': 10, 'stl': 1, 'tov': 2},
    {'dd': 15, 'td': 30}],
   721),
  ('partial repair probe: rebound composition',
   [{'ast': 10, 'blk': 10, 'dreb': 4, 'fg3m': 3, 'oreb': 1, 'pts': 10, 'stl': 10, 'tov': 0},
    {'dd': 15, 'td': 30}],
   955),
  ('second regression',
   [{'ast': 13, 'blk': 11, 'dreb': 10, 'fg3m': 1, 'oreb': 6, 'pts': 11, 'stl': 2, 'tov': 5},
    {'dd': 15, 'td': 30}],
   872),
  ('normal control 1',
   [{'ast': 10, 'blk': 2, 'dreb': 5, 'fg3m': 0, 'oreb': 0, 'pts': 9, 'stl': 2, 'tov': 1},
    {'dd': 15, 'td': 30}],
   410),
  ('normal control 2',
   [{'ast': 1, 'blk': 10, 'dreb': 5, 'fg3m': 0, 'oreb': 0, 'pts': 12, 'stl': 1, 'tov': 6},
    {'dd': 15, 'td': 30}],
   480),
  ('normal control 3',
   [{'ast': 9, 'blk': 10, 'dreb': 5, 'fg3m': 4, 'oreb': 0, 'pts': 9, 'stl': 2, 'tov': 2},
    {'dd': 15, 'td': 30}],
   645),
  ('normal control 4',
   [{'ast': 5, 'blk': 11, 'dreb': 8, 'fg3m': 0, 'oreb': 0, 'pts': 9, 'stl': 10, 'tov': 4},
    {'dd': 15, 'td': 30}],
   866)],
 [('regression: rebound composition',
   [{'ast': 6, 'blk': 11, 'dreb': 4, 'fg3m': 1, 'oreb': 3, 'pts': 11, 'stl': 0, 'tov': 2},
    {'dd': 15, 'td': 30}],
   614),
  ('partial repair probe: rebound composition',
   [{'ast': 10, 'blk': 11, 'dreb': 8, 'fg3m': 3, 'oreb': 6, 'pts': 9, 'stl': 1, 'tov': 2},
    {'dd': 15, 'td': 30}],
   793),
  ('second regression',
   [{'ast': 10, 'blk': 10, 'dreb': 9, 'fg3m': 1, 'oreb': 5, 'pts': 9, 'stl': 0, 'tov': 4},
    {'dd': 15, 'td': 30}],
   703),
  ('normal control 1',
   [{'ast': 11, 'blk': 1, 'dreb': 12, 'fg3m': 6, 'oreb': 0, 'pts': 10, 'stl': 10, 'tov': 1},
    {'dd': 15, 'td': 30}],
   789),
  ('normal control 2',
   [{'ast': 8, 'blk': 1, 'dreb': 10, 'fg3m': 6, 'oreb': 0, 'pts': 10, 'stl': 2, 'tov': 3},
    {'dd': 15, 'td': 30}],
   445),
  ('normal control 3',
   [{'ast': 9, 'blk': 11, 'dreb': 4, 'fg3m': 6, 'oreb': 0, 'pts': 8, 'stl': 0, 'tov': 0},
    {'dd': 15, 'td': 30}],
   623),
  ('normal control 4',
   [{'ast': 6, 'blk': 0, 'dreb': 10, 'fg3m': 1, 'oreb': 0, 'pts': 10, 'stl': 3, 'tov': 1},
    {'dd': 15, 'td': 30}],
   410)]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "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:
A big man with 4 offensive and 8 defensive boards misses his double-double.

Score a basketball line in tenths: points 1.0, rebounds (offensive + defensive) 1.2, assists 1.5, steals 3, blocks 3, turnovers -1, threes made 0.5 extra. Count double-digit categories among points, rebounds, assists, steals and blocks; three or more earns only the triple-double bonus, exactly two earns the double-double bonus.

split: open-access


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

N = 1
observations = []
def solve(line, bonus):
    line = dict(line, reb=line['oreb'] + line['dreb'])
    w = {'pts': 10, 'reb': 12, 'ast': 15, 'stl': 30, 'blk': 30, 'tov': -10, 'fg3m': 5}
    score = sum(w[k] * line[k] for k in w)
    doubles = sum(1 for k in ('pts', 'reb', 'ast', 'stl', 'blk') if line[k] > 10)
    if doubles >= 3:
        score += bonus['td']
    elif doubles == 2:
        score += bonus['dd']
    return score
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: double-digit threshold',
   [{'ast': 10, 'blk': 11, 'dreb': 5, 'fg3m': 0, 'oreb': 6, 'pts': 10, 'stl': 1, 'tov': 2},
    {'dd': 15, 'td': 30}],
   752),
  ('partial repair probe: double-digit threshold',
   [{'ast': 11, 'blk': 0, 'dreb': 4, 'fg3m': 1, 'oreb': 6, 'pts': 9, 'stl': 10, 'tov': 1},
    {'dd': 15, 'td': 30}],
   700),
  ('second regression',
   [{'ast': 9, 'blk': 0, 'dreb': 9, 'fg3m': 3, 'oreb': 1, 'pts': 10, 'stl': 2, 'tov': 1},
    {'dd': 15, 'td': 30}],
   435),
  ('normal control 1',
   [{'ast': 9, 'blk': 0, 'dreb': 5, 'fg3m': 2, 'oreb': 4, 'pts': 10, 'stl': 3, 'tov': 1},
    {'dd': 15, 'td': 30}],
   433),
  ('normal control 2',
   [{'ast': 11, 'blk': 1, 'dreb': 9, 'fg3m': 5, 'oreb': 4, 'pts': 11, 'stl': 0, 'tov': 3},
    {'dd': 15, 'td': 30}],
   486),
  ('normal control 3',
   [{'ast': 9, 'blk': 0, 'dreb': 9, 'fg3m': 4, 'oreb': 3, 'pts': 9, 'stl': 1, 'tov': 0},
    {'dd': 15, 'td': 30}],
   419),
  ('normal control 4',
   [{'ast': 3, 'blk': 2, 'dreb': 4, 'fg3m': 2, 'oreb': 4, 'pts': 10, 'stl': 1, 'tov': 3},
    {'dd': 15, 'td': 30}],
   311)],
 [('regression: double-digit threshold',
   [{'ast': 10, 'blk': 10, 'dreb': 8, 'fg3m': 3, 'oreb': 4, 'pts': 9, 'stl': 3, 'tov': 1},
    {'dd': 15, 'td': 30}],
   809),
  ('partial repair probe: double-digit threshold',
   [{'ast': 9, 'blk': 10, 'dreb': 10, 'fg3m': 3, 'oreb': 4, 'pts': 12, 'stl': 1, 'tov': 3},
    {'dd': 15, 'td': 30}],
   768),
  ('second regression',
   [{'ast': 11, 'blk': 1, 'dreb': 5, 'fg3m': 4, 'oreb': 3, 'pts': 10, 'stl': 1, 'tov': 2},
    {'dd': 15, 'td': 30}],
   436),
  ('normal control 1',
   [{'ast': 7, 'blk': 2, 'dreb': 1, 'fg3m': 6, 'oreb': 6, 'pts': 10, 'stl': 3, 'tov': 4},
    {'dd': 15, 'td': 30}],
   429),
  ('normal control 2',
   [{'ast': 9, 'blk': 1, 'dreb': 7, 'fg3m': 2, 'oreb': 4, 'pts': 11, 'stl': 2, 'tov': 5},
    {'dd': 15, 'td': 30}],
   442),
  ('normal control 3',
   [{'ast': 11, 'blk': 2, 'dreb': 4, 'fg3m': 1, 'oreb': 0, 'pts': 9, 'stl': 0, 'tov': 3},
    {'dd': 15, 'td': 30}],
   338),
  ('normal control 4',
   [{'ast': 9, 'blk': 11, 'dreb': 0, 'fg3m': 0, 'oreb': 3, 'pts': 9, 'stl': 2, 'tov': 4},
    {'dd': 15, 'td': 30}],
   611)],
 [('regression: double-digit threshold',
   [{'ast': 11, 'blk': 1, 'dreb': 10, 'fg3m': 1, 'oreb': 3, 'pts': 10, 'stl': 10, 'tov': 0},
    {'dd': 15, 'td': 30}],
   786),
  ('partial repair probe: double-digit threshold',
   [{'ast': 1, 'blk': 11, 'dreb': 4, 'fg3m': 0, 'oreb': 0, 'pts': 10, 'stl': 3, 'tov': 3},
    {'dd': 15, 'td': 30}],
   568),
  ('second regression',
   [{'ast': 10, 'blk': 2, 'dreb': 4, 'fg3m': 2, 'oreb': 3, 'pts': 16, 'stl': 1, 'tov': 4},
    {'dd': 15, 'td': 30}],
   469),
  ('normal control 1',
   [{'ast': 14, 'blk': 0, 'dreb': 8, 'fg3m': 2, 'oreb': 4, 'pts': 38, 'stl': 3, 'tov': 3},
    {'dd': 15, 'td': 30}],
   834),
  ('normal control 2',
   [{'ast': 9, 'blk': 10, 'dreb': 5, 'fg3m': 6, 'oreb': 4, 'pts': 7, 'stl': 3, 'tov': 5},
    {'dd': 15, 'td': 30}],
   683),
  ('normal control 3',
   [{'ast': 7, 'blk': 2, 'dreb': 5, 'fg3m': 0, 'oreb': 2, 'pts': 9, 'stl': 10, 'tov': 6},
    {'dd': 15, 'td': 30}],
   579),
  ('normal control 4',
   [{'ast': 8, 'blk': 1, 'dreb': 5, 'fg3m': 3, 'oreb': 4, 'pts': 9, 'stl': 3, 'tov': 4},
    {'dd': 15, 'td': 30}],
   413)],
 [('regression: double-digit threshold',
   [{'ast': 10, 'blk': 11, 'dreb': 6, 'fg3m': 1, 'oreb': 0, 'pts': 11, 'stl': 3, 'tov': 6},
    {'dd': 15, 'td': 30}],
   727),
  ('partial repair probe: double-digit threshold',
   [{'ast': 10, 'blk': 10, 'dreb': 8, 'fg3m': 2, 'oreb': 5, 'pts': 9, 'stl': 1, 'tov': 4},
    {'dd': 15, 'td': 30}],
   726),
  ('second regression',
   [{'ast': 12, 'blk': 1, 'dreb': 0, 'fg3m': 4, 'oreb': 2, 'pts': 10, 'stl': 2, 'tov': 3},
    {'dd': 15, 'td': 30}],
   399),
  ('normal control 1',
   [{'ast': 11, 'blk': 11, 'dreb': 8, 'fg3m': 1, 'oreb': 6, 'pts': 10, 'stl': 0, 'tov': 4},
    {'dd': 15, 'td': 30}],
   758),
  ('normal control 2',
   [{'ast': 9, 'blk': 2, 'dreb': 4, 'fg3m': 4, 'oreb': 2, 'pts': 10, 'stl': 3, 'tov': 1},
    {'dd': 15, 'td': 30}],
   467),
  ('normal control 3',
   [{'ast': 11, 'blk': 2, 'dreb': 5, 'fg3m': 1, 'oreb': 3, 'pts': 11, 'stl': 1, 'tov': 4},
    {'dd': 15, 'td': 30}],
   441),
  ('normal control 4',
   [{'ast': 11, 'blk': 11, 'dreb': 9, 'fg3m': 0, 'oreb': 6, 'pts': 10, 'stl': 0, 'tov': 3},
    {'dd': 15, 'td': 30}],
   775)],
 [('regression: double-digit threshold',
   [{'ast': 11, 'blk': 11, 'dreb': 4, 'fg3m': 0, 'oreb': 5, 'pts': 10, 'stl': 3, 'tov': 2},
    {'dd': 15, 'td': 30}],
   803),
  ('partial repair probe: double-digit threshold',
   [{'ast': 14, 'blk': 10, 'dreb': 4, 'fg3m': 6, 'oreb': 5, 'pts': 10, 'stl': 3, 'tov': 1},
    {'dd': 15, 'td': 30}],
   858),
  ('second regression',
   [{'ast': 11, 'blk': 0, 'dreb': 5, 'fg3m': 4, 'oreb': 1, 'pts': 10, 'stl': 2, 'tov': 6},
    {'dd': 15, 'td': 30}],
   372),
  ('normal control 1',
   [{'ast': 11, 'blk': 2, 'dreb': 9, 'fg3m': 6, 'oreb': 0, 'pts': 9, 'stl': 1, 'tov': 4},
    {'dd': 15, 'td': 30}],
   443),
  ('normal control 2',
   [{'ast': 11, 'blk': 2, 'dreb': 9, 'fg3m': 1, 'oreb': 3, 'pts': 2, 'stl': 3, 'tov': 1},
    {'dd': 15, 'td': 30}],
   489),
  ('normal control 3',
   [{'ast': 9, 'blk': 0, 'dreb': 4, 'fg3m': 2, 'oreb': 3, 'pts': 9, 'stl': 10, 'tov': 5},
    {'dd': 15, 'td': 30}],
   569),
  ('normal control 4',
   [{'ast': 10, 'blk': 11, 'dreb': 8, 'fg3m': 4, 'oreb': 6, 'pts': 20, 'stl': 3, 'tov': 4},
    {'dd': 15, 'td': 30}],
   948)]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "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(line, bonus):
    line = dict(line, reb=line['oreb'] + line['dreb'])
    w = {'pts': 10, 'reb': 12, 'ast': 15, 'stl': 30, 'blk': 30, 'tov': -10, 'fg3m': 5}
    score = sum(w[k] * line[k] for k in w)
    doubles = sum(1 for k in ('pts', 'reb', 'ast') if line[k] >= 10)
    if doubles >= 3:
        score += bonus['td']
    elif doubles == 2:
        score += bonus['dd']
    return score
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: double-digit threshold',
   [{'ast': 10, 'blk': 11, 'dreb': 5, 'fg3m': 0, 'oreb': 6, 'pts': 10, 'stl': 1, 'tov': 2},
    {'dd': 15, 'td': 30}],
   752),
  ('partial repair probe: double-digit threshold',
   [{'ast': 11, 'blk': 0, 'dreb': 4, 'fg3m': 1, 'oreb': 6, 'pts': 9, 'stl': 10, 'tov': 1},
    {'dd': 15, 'td': 30}],
   700),
  ('second regression',
   [{'ast': 9, 'blk': 0, 'dreb': 9, 'fg3m': 3, 'oreb': 1, 'pts': 10, 'stl': 2, 'tov': 1},
    {'dd': 15, 'td': 30}],
   435),
  ('normal control 1',
   [{'ast': 9, 'blk': 0, 'dreb': 5, 'fg3m': 2, 'oreb': 4, 'pts': 10, 'stl': 3, 'tov': 1},
    {'dd': 15, 'td': 30}],
   433),
  ('normal control 2',
   [{'ast': 11, 'blk': 1, 'dreb': 9, 'fg3m': 5, 'oreb': 4, 'pts': 11, 'stl': 0, 'tov': 3},
    {'dd': 15, 'td': 30}],
   486),
  ('normal control 3',
   [{'ast': 9, 'blk': 0, 'dreb': 9, 'fg3m': 4, 'oreb': 3, 'pts': 9, 'stl': 1, 'tov': 0},
    {'dd': 15, 'td': 30}],
   419),
  ('normal control 4',
   [{'ast': 3, 'blk': 2, 'dreb': 4, 'fg3m': 2, 'oreb': 4, 'pts': 10, 'stl': 1, 'tov': 3},
    {'dd': 15, 'td': 30}],
   311)],
 [('regression: double-digit threshold',
   [{'ast': 10, 'blk': 10, 'dreb': 8, 'fg3m': 3, 'oreb': 4, 'pts': 9, 'stl': 3, 'tov': 1},
    {'dd': 15, 'td': 30}],
   809),
  ('partial repair probe: double-digit threshold',
   [{'ast': 9, 'blk': 10, 'dreb': 10, 'fg3m': 3, 'oreb': 4, 'pts': 12, 'stl': 1, 'tov': 3},
    {'dd': 15, 'td': 30}],
   768),
  ('second regression',
   [{'ast': 11, 'blk': 1, 'dreb': 5, 'fg3m': 4, 'oreb': 3, 'pts': 10, 'stl': 1, 'tov': 2},
    {'dd': 15, 'td': 30}],
   436),
  ('normal control 1',
   [{'ast': 7, 'blk': 2, 'dreb': 1, 'fg3m': 6, 'oreb': 6, 'pts': 10, 'stl': 3, 'tov': 4},
    {'dd': 15, 'td': 30}],
   429),
  ('normal control 2',
   [{'ast': 9, 'blk': 1, 'dreb': 7, 'fg3m': 2, 'oreb': 4, 'pts': 11, 'stl': 2, 'tov': 5},
    {'dd': 15, 'td': 30}],
   442),
  ('normal control 3',
   [{'ast': 11, 'blk': 2, 'dreb': 4, 'fg3m': 1, 'oreb': 0, 'pts': 9, 'stl': 0, 'tov': 3},
    {'dd': 15, 'td': 30}],
   338),
  ('normal control 4',
   [{'ast': 9, 'blk': 11, 'dreb': 0, 'fg3m': 0, 'oreb': 3, 'pts': 9, 'stl': 2, 'tov': 4},
    {'dd': 15, 'td': 30}],
   611)],
 [('regression: double-digit threshold',
   [{'ast': 11, 'blk': 1, 'dreb': 10, 'fg3m': 1, 'oreb': 3, 'pts': 10, 'stl': 10, 'tov': 0},
    {'dd': 15, 'td': 30}],
   786),
  ('partial repair probe: double-digit threshold',
   [{'ast': 1, 'blk': 11, 'dreb': 4, 'fg3m': 0, 'oreb': 0, 'pts': 10, 'stl': 3, 'tov': 3},
    {'dd': 15, 'td': 30}],
   568),
  ('second regression',
   [{'ast': 10, 'blk': 2, 'dreb': 4, 'fg3m': 2, 'oreb': 3, 'pts': 16, 'stl': 1, 'tov': 4},
    {'dd': 15, 'td': 30}],
   469),
  ('normal control 1',
   [{'ast': 14, 'blk': 0, 'dreb': 8, 'fg3m': 2, 'oreb': 4, 'pts': 38, 'stl': 3, 'tov': 3},
    {'dd': 15, 'td': 30}],
   834),
  ('normal control 2',
   [{'ast': 9, 'blk': 10, 'dreb': 5, 'fg3m': 6, 'oreb': 4, 'pts': 7, 'stl': 3, 'tov': 5},
    {'dd': 15, 'td': 30}],
   683),
  ('normal control 3',
   [{'ast': 7, 'blk': 2, 'dreb': 5, 'fg3m': 0, 'oreb': 2, 'pts': 9, 'stl': 10, 'tov': 6},
    {'dd': 15, 'td': 30}],
   579),
  ('normal control 4',
   [{'ast': 8, 'blk': 1, 'dreb': 5, 'fg3m': 3, 'oreb': 4, 'pts': 9, 'stl': 3, 'tov': 4},
    {'dd': 15, 'td': 30}],
   413)],
 [('regression: double-digit threshold',
   [{'ast': 10, 'blk': 11, 'dreb': 6, 'fg3m': 1, 'oreb': 0, 'pts': 11, 'stl': 3, 'tov': 6},
    {'dd': 15, 'td': 30}],
   727),
  ('partial repair probe: double-digit threshold',
   [{'ast': 10, 'blk': 10, 'dreb': 8, 'fg3m': 2, 'oreb': 5, 'pts': 9, 'stl': 1, 'tov': 4},
    {'dd': 15, 'td': 30}],
   726),
  ('second regression',
   [{'ast': 12, 'blk': 1, 'dreb': 0, 'fg3m': 4, 'oreb': 2, 'pts': 10, 'stl': 2, 'tov': 3},
    {'dd': 15, 'td': 30}],
   399),
  ('normal control 1',
   [{'ast': 11, 'blk': 11, 'dreb': 8, 'fg3m': 1, 'oreb': 6, 'pts': 10, 'stl': 0, 'tov': 4},
    {'dd': 15, 'td': 30}],
   758),
  ('normal control 2',
   [{'ast': 9, 'blk': 2, 'dreb': 4, 'fg3m': 4, 'oreb': 2, 'pts': 10, 'stl': 3, 'tov': 1},
    {'dd': 15, 'td': 30}],
   467),
  ('normal control 3',
   [{'ast': 11, 'blk': 2, 'dreb': 5, 'fg3m': 1, 'oreb': 3, 'pts': 11, 'stl': 1, 'tov': 4},
    {'dd': 15, 'td': 30}],
   441),
  ('normal control 4',
   [{'ast': 11, 'blk': 11, 'dreb': 9, 'fg3m': 0, 'oreb': 6, 'pts': 10, 'stl': 0, 'tov': 3},
    {'dd': 15, 'td': 30}],
   775)],
 [('regression: double-digit threshold',
   [{'ast': 11, 'blk': 11, 'dreb': 4, 'fg3m': 0, 'oreb': 5, 'pts': 10, 'stl': 3, 'tov': 2},
    {'dd': 15, 'td': 30}],
   803),
  ('partial repair probe: double-digit threshold',
   [{'ast': 14, 'blk': 10, 'dreb': 4, 'fg3m': 6, 'oreb': 5, 'pts': 10, 'stl': 3, 'tov': 1},
    {'dd': 15, 'td': 30}],
   858),
  ('second regression',
   [{'ast': 11, 'blk': 0, 'dreb': 5, 'fg3m': 4, 'oreb': 1, 'pts': 10, 'stl': 2, 'tov': 6},
    {'dd': 15, 'td': 30}],
   372),
  ('normal control 1',
   [{'ast': 11, 'blk': 2, 'dreb': 9, 'fg3m': 6, 'oreb': 0, 'pts': 9, 'stl': 1, 'tov': 4},
    {'dd': 15, 'td': 30}],
   443),
  ('normal control 2',
   [{'ast': 11, 'blk': 2, 'dreb': 9, 'fg3m': 1, 'oreb': 3, 'pts': 2, 'stl': 3, 'tov': 1},
    {'dd': 15, 'td': 30}],
   489),
  ('normal control 3',
   [{'ast': 9, 'blk': 0, 'dreb': 4, 'fg3m': 2, 'oreb': 3, 'pts': 9, 'stl': 10, 'tov': 5},
    {'dd': 15, 'td': 30}],
   569),
  ('normal control 4',
   [{'ast': 10, 'blk': 11, 'dreb': 8, 'fg3m': 4, 'oreb': 6, 'pts': 20, 'stl': 3, 'tov': 4},
    {'dd': 15, 'td': 30}],
   948)]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "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:
A 10-point, 10-rebound line earns no double-double bonus.

Score a basketball line in tenths: points 1.0, rebounds (offensive + defensive) 1.2, assists 1.5, steals 3, blocks 3, turnovers -1, threes made 0.5 extra. Count double-digit categories among points, rebounds, assists, steals and blocks; three or more earns only the triple-double bonus, exactly two earns the double-double bonus.

split: open-access


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

N = 1
observations = []
def solve(line, bonus):
    line = dict(line, reb=line['oreb'] + line['dreb'])
    w = {'pts': 10, 'reb': 12, 'ast': 15, 'stl': 30, 'blk': 30, 'tov': -10, 'fg3m': 5}
    score = sum(w[k] * line[k] for k in w)
    doubles = sum(1 for k in ('pts', 'reb', 'ast', 'stl', 'blk') if line[k] >= 10)
    if doubles >= 3:
        score += bonus['td']
    if doubles >= 2:
        score += bonus['dd']
    return score
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: bonus exclusivity',
   [{'ast': 5, 'blk': 10, 'dreb': 8, 'fg3m': 0, 'oreb': 3, 'pts': 10, 'stl': 10, 'tov': 0},
    {'dd': 15, 'td': 30}],
   937),
  ('partial repair probe: bonus exclusivity',
   [{'ast': 10, 'blk': 11, 'dreb': 8, 'fg3m': 1, 'oreb': 5, 'pts': 11, 'stl': 10, 'tov': 6},
    {'dd': 15, 'td': 30}],
   1021),
  ('second regression',
   [{'ast': 10, 'blk': 10, 'dreb': 5, 'fg3m': 0, 'oreb': 2, 'pts': 14, 'stl': 3, 'tov': 3},
    {'dd': 15, 'td': 30}],
   764),
  ('normal control 1',
   [{'ast': 9, 'blk': 1, 'dreb': 10, 'fg3m': 2, 'oreb': 4, 'pts': 27, 'stl': 1, 'tov': 0},
    {'dd': 15, 'td': 30}],
   658),
  ('normal control 2',
   [{'ast': 7, 'blk': 0, 'dreb': 8, 'fg3m': 0, 'oreb': 1, 'pts': 10, 'stl': 0, 'tov': 5},
    {'dd': 15, 'td': 30}],
   263),
  ('normal control 3',
   [{'ast': 3, 'blk': 0, 'dreb': 4, 'fg3m': 2, 'oreb': 3, 'pts': 10, 'stl': 0, 'tov': 0},
    {'dd': 15, 'td': 30}],
   239),
  ('normal control 4',
   [{'ast': 10, 'blk': 2, 'dreb': 1, 'fg3m': 6, 'oreb': 5, 'pts': 20, 'stl': 1, 'tov': 4},
    {'dd': 15, 'td': 30}],
   517)],
 [('regression: bonus exclusivity',
   [{'ast': 10, 'blk': 1, 'dreb': 9, 'fg3m': 3, 'oreb': 5, 'pts': 19, 'stl': 2, 'tov': 3},
    {'dd': 15, 'td': 30}],
   613),
  ('partial repair probe: bonus exclusivity',
   [{'ast': 10, 'blk': 1, 'dreb': 8, 'fg3m': 6, 'oreb': 4, 'pts': 10, 'stl': 10, 'tov': 3},
    {'dd': 15, 'td': 30}],
   754),
  ('second regression',
   [{'ast': 11, 'blk': 10, 'dreb': 9, 'fg3m': 5, 'oreb': 1, 'pts': 14, 'stl': 0, 'tov': 6},
    {'dd': 15, 'td': 30}],
   720),
  ('normal control 1',
   [{'ast': 2, 'blk': 2, 'dreb': 9, 'fg3m': 6, 'oreb': 6, 'pts': 21, 'stl': 1, 'tov': 5},
    {'dd': 15, 'td': 30}],
   505),
  ('normal control 2',
   [{'ast': 10, 'blk': 10, 'dreb': 4, 'fg3m': 1, 'oreb': 1, 'pts': 0, 'stl': 1, 'tov': 2},
    {'dd': 15, 'td': 30}],
   540),
  ('normal control 3',
   [{'ast': 0, 'blk': 0, 'dreb': 10, 'fg3m': 3, 'oreb': 2, 'pts': 10, 'stl': 3, 'tov': 4},
    {'dd': 15, 'td': 30}],
   324),
  ('normal control 4',
   [{'ast': 2, 'blk': 1, 'dreb': 7, 'fg3m': 4, 'oreb': 2, 'pts': 11, 'stl': 3, 'tov': 5},
    {'dd': 15, 'td': 30}],
   338)],
 [('regression: bonus exclusivity',
   [{'ast': 10, 'blk': 0, 'dreb': 9, 'fg3m': 3, 'oreb': 1, 'pts': 10, 'stl': 3, 'tov': 1},
    {'dd': 15, 'td': 30}],
   495),
  ('partial repair probe: bonus exclusivity',
   [{'ast': 10, 'blk': 11, 'dreb': 7, 'fg3m': 5, 'oreb': 4, 'pts': 10, 'stl': 3, 'tov': 5},
    {'dd': 15, 'td': 30}],
   807),
  ('second regression',
   [{'ast': 7, 'blk': 10, 'dreb': 5, 'fg3m': 4, 'oreb': 6, 'pts': 36, 'stl': 2, 'tov': 2},
    {'dd': 15, 'td': 30}],
   987),
  ('normal control 1',
   [{'ast': 9, 'blk': 0, 'dreb': 9, 'fg3m': 4, 'oreb': 4, 'pts': 11, 'stl': 2, 'tov': 1},
    {'dd': 15, 'td': 30}],
   486),
  ('normal control 2',
   [{'ast': 11, 'blk': 1, 'dreb': 4, 'fg3m': 2, 'oreb': 1, 'pts': 9, 'stl': 3, 'tov': 2},
    {'dd': 15, 'td': 30}],
   425),
  ('normal control 3',
   [{'ast': 12, 'blk': 1, 'dreb': 8, 'fg3m': 5, 'oreb': 6, 'pts': 9, 'stl': 2, 'tov': 0},
    {'dd': 15, 'td': 30}],
   568),
  ('normal control 4',
   [{'ast': 9, 'blk': 10, 'dreb': 5, 'fg3m': 5, 'oreb': 0, 'pts': 11, 'stl': 3, 'tov': 2},
    {'dd': 15, 'td': 30}],
   715)],
 [('regression: bonus exclusivity',
   [{'ast': 11, 'blk': 10, 'dreb': 9, 'fg3m': 6, 'oreb': 5, 'pts': 14, 'stl': 1, 'tov': 1},
    {'dd': 15, 'td': 30}],
   853),
  ('partial repair probe: bonus exclusivity',
   [{'ast': 10, 'blk': 1, 'dreb': 9, 'fg3m': 3, 'oreb': 5, 'pts': 10, 'stl': 10, 'tov': 0},
    {'dd': 15, 'td': 30}],
   793),
  ('second regression',
   [{'ast': 13, 'blk': 0, 'dreb': 12, 'fg3m': 5, 'oreb': 0, 'pts': 10, 'stl': 1, 'tov': 5},
    {'dd': 15, 'td': 30}],
   474),
  ('normal control 1',
   [{'ast': 10, 'blk': 1, 'dreb': 8, 'fg3m': 0, 'oreb': 0, 'pts': 10, 'stl': 1, 'tov': 0},
    {'dd': 15, 'td': 30}],
   421),
  ('normal control 2',
   [{'ast': 9, 'blk': 1, 'dreb': 2, 'fg3m': 2, 'oreb': 1, 'pts': 10, 'stl': 1, 'tov': 2},
    {'dd': 15, 'td': 30}],
   321),
  ('normal control 3',
   [{'ast': 10, 'blk': 0, 'dreb': 5, 'fg3m': 2, 'oreb': 5, 'pts': 6, 'stl': 1, 'tov': 2},
    {'dd': 15, 'td': 30}],
   365),
  ('normal control 4',
   [{'ast': 9, 'blk': 0, 'dreb': 10, 'fg3m': 2, 'oreb': 2, 'pts': 11, 'stl': 1, 'tov': 2},
    {'dd': 15, 'td': 30}],
   424)],
 [('regression: bonus exclusivity',
   [{'ast': 10, 'blk': 2, 'dreb': 9, 'fg3m': 6, 'oreb': 1, 'pts': 11, 'stl': 1, 'tov': 0},
    {'dd': 15, 'td': 30}],
   530),
  ('partial repair probe: bonus exclusivity',
   [{'ast': 13, 'blk': 11, 'dreb': 10, 'fg3m': 5, 'oreb': 0, 'pts': 10, 'stl': 1, 'tov': 2},
    {'dd': 15, 'td': 30}],
   810),
  ('second regression',
   [{'ast': 11, 'blk': 10, 'dreb': 2, 'fg3m': 1, 'oreb': 3, 'pts': 34, 'stl': 0, 'tov': 0},
    {'dd': 15, 'td': 30}],
   900),
  ('normal control 1',
   [{'ast': 9, 'blk': 11, 'dreb': 4, 'fg3m': 2, 'oreb': 2, 'pts': 11, 'stl': 2, 'tov': 3},
    {'dd': 15, 'td': 30}],
   702),
  ('normal control 2',
   [{'ast': 10, 'blk': 2, 'dreb': 4, 'fg3m': 5, 'oreb': 0, 'pts': 11, 'stl': 1, 'tov': 6},
    {'dd': 15, 'td': 30}],
   378),
  ('normal control 3',
   [{'ast': 11, 'blk': 2, 'dreb': 5, 'fg3m': 4, 'oreb': 4, 'pts': 11, 'stl': 0, 'tov': 5},
    {'dd': 15, 'td': 30}],
   428),
  ('normal control 4',
   [{'ast': 5, 'blk': 1, 'dreb': 10, 'fg3m': 2, 'oreb': 4, 'pts': 10, 'stl': 2, 'tov': 6},
    {'dd': 15, 'td': 30}],
   398)]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "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(line, bonus):
    line = dict(line, reb=line['oreb'] + line['dreb'])
    w = {'pts': 10, 'reb': 12, 'ast': 15, 'stl': 30, 'blk': 30, 'tov': -10, 'fg3m': 5}
    score = sum(w[k] * line[k] for k in w)
    doubles = sum(1 for k in ('pts', 'reb', 'ast', 'stl', 'blk') if line[k] >= 10)
    if doubles >= 3:
        score += bonus['td']
    if doubles == 2 or doubles > 3:
        score += bonus['dd']
    return score
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: bonus exclusivity',
   [{'ast': 5, 'blk': 10, 'dreb': 8, 'fg3m': 0, 'oreb': 3, 'pts': 10, 'stl': 10, 'tov': 0},
    {'dd': 15, 'td': 30}],
   937),
  ('partial repair probe: bonus exclusivity',
   [{'ast': 10, 'blk': 11, 'dreb': 8, 'fg3m': 1, 'oreb': 5, 'pts': 11, 'stl': 10, 'tov': 6},
    {'dd': 15, 'td': 30}],
   1021),
  ('second regression',
   [{'ast': 10, 'blk': 10, 'dreb': 5, 'fg3m': 0, 'oreb': 2, 'pts': 14, 'stl': 3, 'tov': 3},
    {'dd': 15, 'td': 30}],
   764),
  ('normal control 1',
   [{'ast': 9, 'blk': 1, 'dreb': 10, 'fg3m': 2, 'oreb': 4, 'pts': 27, 'stl': 1, 'tov': 0},
    {'dd': 15, 'td': 30}],
   658),
  ('normal control 2',
   [{'ast': 7, 'blk': 0, 'dreb': 8, 'fg3m': 0, 'oreb': 1, 'pts': 10, 'stl': 0, 'tov': 5},
    {'dd': 15, 'td': 30}],
   263),
  ('normal control 3',
   [{'ast': 3, 'blk': 0, 'dreb': 4, 'fg3m': 2, 'oreb': 3, 'pts': 10, 'stl': 0, 'tov': 0},
    {'dd': 15, 'td': 30}],
   239),
  ('normal control 4',
   [{'ast': 10, 'blk': 2, 'dreb': 1, 'fg3m': 6, 'oreb': 5, 'pts': 20, 'stl': 1, 'tov': 4},
    {'dd': 15, 'td': 30}],
   517)],
 [('regression: bonus exclusivity',
   [{'ast': 10, 'blk': 1, 'dreb': 9, 'fg3m': 3, 'oreb': 5, 'pts': 19, 'stl': 2, 'tov': 3},
    {'dd': 15, 'td': 30}],
   613),
  ('partial repair probe: bonus exclusivity',
   [{'ast': 10, 'blk': 1, 'dreb': 8, 'fg3m': 6, 'oreb': 4, 'pts': 10, 'stl': 10, 'tov': 3},
    {'dd': 15, 'td': 30}],
   754),
  ('second regression',
   [{'ast': 11, 'blk': 10, 'dreb': 9, 'fg3m': 5, 'oreb': 1, 'pts': 14, 'stl': 0, 'tov': 6},
    {'dd': 15, 'td': 30}],
   720),
  ('normal control 1',
   [{'ast': 2, 'blk': 2, 'dreb': 9, 'fg3m': 6, 'oreb': 6, 'pts': 21, 'stl': 1, 'tov': 5},
    {'dd': 15, 'td': 30}],
   505),
  ('normal control 2',
   [{'ast': 10, 'blk': 10, 'dreb': 4, 'fg3m': 1, 'oreb': 1, 'pts': 0, 'stl': 1, 'tov': 2},
    {'dd': 15, 'td': 30}],
   540),
  ('normal control 3',
   [{'ast': 0, 'blk': 0, 'dreb': 10, 'fg3m': 3, 'oreb': 2, 'pts': 10, 'stl': 3, 'tov': 4},
    {'dd': 15, 'td': 30}],
   324),
  ('normal control 4',
   [{'ast': 2, 'blk': 1, 'dreb': 7, 'fg3m': 4, 'oreb': 2, 'pts': 11, 'stl': 3, 'tov': 5},
    {'dd': 15, 'td': 30}],
   338)],
 [('regression: bonus exclusivity',
   [{'ast': 10, 'blk': 0, 'dreb': 9, 'fg3m': 3, 'oreb': 1, 'pts': 10, 'stl': 3, 'tov': 1},
    {'dd': 15, 'td': 30}],
   495),
  ('partial repair probe: bonus exclusivity',
   [{'ast': 10, 'blk': 11, 'dreb': 7, 'fg3m': 5, 'oreb': 4, 'pts': 10, 'stl': 3, 'tov': 5},
    {'dd': 15, 'td': 30}],
   807),
  ('second regression',
   [{'ast': 7, 'blk': 10, 'dreb': 5, 'fg3m': 4, 'oreb': 6, 'pts': 36, 'stl': 2, 'tov': 2},
    {'dd': 15, 'td': 30}],
   987),
  ('normal control 1',
   [{'ast': 9, 'blk': 0, 'dreb': 9, 'fg3m': 4, 'oreb': 4, 'pts': 11, 'stl': 2, 'tov': 1},
    {'dd': 15, 'td': 30}],
   486),
  ('normal control 2',
   [{'ast': 11, 'blk': 1, 'dreb': 4, 'fg3m': 2, 'oreb': 1, 'pts': 9, 'stl': 3, 'tov': 2},
    {'dd': 15, 'td': 30}],
   425),
  ('normal control 3',
   [{'ast': 12, 'blk': 1, 'dreb': 8, 'fg3m': 5, 'oreb': 6, 'pts': 9, 'stl': 2, 'tov': 0},
    {'dd': 15, 'td': 30}],
   568),
  ('normal control 4',
   [{'ast': 9, 'blk': 10, 'dreb': 5, 'fg3m': 5, 'oreb': 0, 'pts': 11, 'stl': 3, 'tov': 2},
    {'dd': 15, 'td': 30}],
   715)],
 [('regression: bonus exclusivity',
   [{'ast': 11, 'blk': 10, 'dreb': 9, 'fg3m': 6, 'oreb': 5, 'pts': 14, 'stl': 1, 'tov': 1},
    {'dd': 15, 'td': 30}],
   853),
  ('partial repair probe: bonus exclusivity',
   [{'ast': 10, 'blk': 1, 'dreb': 9, 'fg3m': 3, 'oreb': 5, 'pts': 10, 'stl': 10, 'tov': 0},
    {'dd': 15, 'td': 30}],
   793),
  ('second regression',
   [{'ast': 13, 'blk': 0, 'dreb': 12, 'fg3m': 5, 'oreb': 0, 'pts': 10, 'stl': 1, 'tov': 5},
    {'dd': 15, 'td': 30}],
   474),
  ('normal control 1',
   [{'ast': 10, 'blk': 1, 'dreb': 8, 'fg3m': 0, 'oreb': 0, 'pts': 10, 'stl': 1, 'tov': 0},
    {'dd': 15, 'td': 30}],
   421),
  ('normal control 2',
   [{'ast': 9, 'blk': 1, 'dreb': 2, 'fg3m': 2, 'oreb': 1, 'pts': 10, 'stl': 1, 'tov': 2},
    {'dd': 15, 'td': 30}],
   321),
  ('normal control 3',
   [{'ast': 10, 'blk': 0, 'dreb': 5, 'fg3m': 2, 'oreb': 5, 'pts': 6, 'stl': 1, 'tov': 2},
    {'dd': 15, 'td': 30}],
   365),
  ('normal control 4',
   [{'ast': 9, 'blk': 0, 'dreb': 10, 'fg3m': 2, 'oreb': 2, 'pts': 11, 'stl': 1, 'tov': 2},
    {'dd': 15, 'td': 30}],
   424)],
 [('regression: bonus exclusivity',
   [{'ast': 10, 'blk': 2, 'dreb': 9, 'fg3m': 6, 'oreb': 1, 'pts': 11, 'stl': 1, 'tov': 0},
    {'dd': 15, 'td': 30}],
   530),
  ('partial repair probe: bonus exclusivity',
   [{'ast': 13, 'blk': 11, 'dreb': 10, 'fg3m': 5, 'oreb': 0, 'pts': 10, 'stl': 1, 'tov': 2},
    {'dd': 15, 'td': 30}],
   810),
  ('second regression',
   [{'ast': 11, 'blk': 10, 'dreb': 2, 'fg3m': 1, 'oreb': 3, 'pts': 34, 'stl': 0, 'tov': 0},
    {'dd': 15, 'td': 30}],
   900),
  ('normal control 1',
   [{'ast': 9, 'blk': 11, 'dreb': 4, 'fg3m': 2, 'oreb': 2, 'pts': 11, 'stl': 2, 'tov': 3},
    {'dd': 15, 'td': 30}],
   702),
  ('normal control 2',
   [{'ast': 10, 'blk': 2, 'dreb': 4, 'fg3m': 5, 'oreb': 0, 'pts': 11, 'stl': 1, 'tov': 6},
    {'dd': 15, 'td': 30}],
   378),
  ('normal control 3',
   [{'ast': 11, 'blk': 2, 'dreb': 5, 'fg3m': 4, 'oreb': 4, 'pts': 11, 'stl': 0, 'tov': 5},
    {'dd': 15, 'td': 30}],
   428),
  ('normal control 4',
   [{'ast': 5, 'blk': 1, 'dreb': 10, 'fg3m': 2, 'oreb': 4, 'pts': 10, 'stl': 2, 'tov': 6},
    {'dd': 15, 'td': 30}],
   398)]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "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:
Every triple-double scores 4.5 bonus points instead of 3.

Score a basketball line in tenths: points 1.0, rebounds (offensive + defensive) 1.2, assists 1.5, steals 3, blocks 3, turnovers -1, threes made 0.5 extra. Count double-digit categories among points, rebounds, assists, steals and blocks; three or more earns only the triple-double bonus, exactly two earns the double-double bonus.

split: open-access


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

N = 1
observations = []
def solve(line, bonus):
    line = dict(line, reb=line['oreb'] + line['dreb'])
    w = {'pts': 10, 'reb': 12, 'ast': 15, 'stl': 30, 'blk': 30, 'tov': -10, 'fg3m': 5}
    score = sum(w[k] * line[k] for k in w)
    doubles = sum(1 for k in ('pts', 'reb', 'ast', 'stl', 'blk') if line[k] >= 10)
    if doubles == 3:
        score += bonus['td']
    elif doubles == 2:
        score += bonus['dd']
    return score
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: quadruple-double tier',
   [{'ast': 10, 'blk': 11, 'dreb': 10, 'fg3m': 1, 'oreb': 5, 'pts': 35, 'stl': 10, 'tov': 0},
    {'dd': 15, 'td': 30}],
   1345),
  ('partial repair probe: quadruple-double tier',
   [{'ast': 10, 'blk': 10, 'dreb': 10, 'fg3m': 2, 'oreb': 4, 'pts': 11, 'stl': 3, 'tov': 6},
    {'dd': 15, 'td': 30}],
   798),
  ('second regression',
   [{'ast': 10, 'blk': 11, 'dreb': 9, 'fg3m': 4, 'oreb': 3, 'pts': 21, 'stl': 2, 'tov': 4},
    {'dd': 15, 'td': 30}],
   904),
  ('normal control 1',
   [{'ast': 10, 'blk': 2, 'dreb': 0, 'fg3m': 0, 'oreb': 6, 'pts': 10, 'stl': 0, 'tov': 1},
    {'dd': 15, 'td': 30}],
   387),
  ('normal control 2',
   [{'ast': 11, 'blk': 1, 'dreb': 4, 'fg3m': 2, 'oreb': 2, 'pts': 10, 'stl': 3, 'tov': 5},
    {'dd': 15, 'td': 30}],
   432),
  ('normal control 3',
   [{'ast': 10, 'blk': 2, 'dreb': 9, 'fg3m': 3, 'oreb': 2, 'pts': 1, 'stl': 2, 'tov': 5},
    {'dd': 15, 'td': 30}],
   392),
  ('normal control 4',
   [{'ast': 11, 'blk': 2, 'dreb': 7, 'fg3m': 5, 'oreb': 1, 'pts': 10, 'stl': 0, 'tov': 2},
    {'dd': 15, 'td': 30}],
   441)],
 [('regression: quadruple-double tier',
   [{'ast': 10, 'blk': 0, 'dreb': 10, 'fg3m': 3, 'oreb': 5, 'pts': 10, 'stl': 10, 'tov': 2},
    {'dd': 15, 'td': 30}],
   755),
  ('partial repair probe: quadruple-double tier',
   [{'ast': 11, 'blk': 10, 'dreb': 4, 'fg3m': 6, 'oreb': 0, 'pts': 10, 'stl': 10, 'tov': 2},
    {'dd': 15, 'td': 30}],
   953),
  ('second regression',
   [{'ast': 11, 'blk': 10, 'dreb': 9, 'fg3m': 1, 'oreb': 4, 'pts': 11, 'stl': 3, 'tov': 4},
    {'dd': 15, 'td': 30}],
   816),
  ('normal control 1',
   [{'ast': 10, 'blk': 11, 'dreb': 10, 'fg3m': 5, 'oreb': 1, 'pts': 9, 'stl': 0, 'tov': 6},
    {'dd': 15, 'td': 30}],
   697),
  ('normal control 2',
   [{'ast': 9, 'blk': 1, 'dreb': 9, 'fg3m': 4, 'oreb': 5, 'pts': 9, 'stl': 2, 'tov': 0},
    {'dd': 15, 'td': 30}],
   503),
  ('normal control 3',
   [{'ast': 6, 'blk': 2, 'dreb': 10, 'fg3m': 4, 'oreb': 5, 'pts': 39, 'stl': 1, 'tov': 3},
    {'dd': 15, 'td': 30}],
   755),
  ('normal control 4',
   [{'ast': 9, 'blk': 10, 'dreb': 4, 'fg3m': 0, 'oreb': 3, 'pts': 10, 'stl': 2, 'tov': 4},
    {'dd': 15, 'td': 30}],
   654)],
 [('regression: quadruple-double tier',
   [{'ast': 10, 'blk': 10, 'dreb': 9, 'fg3m': 2, 'oreb': 2, 'pts': 10, 'stl': 1, 'tov': 0},
    {'dd': 15, 'td': 30}],
   752),
  ('partial repair probe: quadruple-double tier',
   [{'ast': 11, 'blk': 2, 'dreb': 5, 'fg3m': 5, 'oreb': 5, 'pts': 11, 'stl': 10, 'tov': 2},
    {'dd': 15, 'td': 30}],
   790),
  ('second regression',
   [{'ast': 11, 'blk': 11, 'dreb': 4, 'fg3m': 6, 'oreb': 1, 'pts': 29, 'stl': 10, 'tov': 5},
    {'dd': 15, 'td': 30}],
   1155),
  ('normal control 1',
   [{'ast': 11, 'blk': 0, 'dreb': 4, 'fg3m': 6, 'oreb': 3, 'pts': 9, 'stl': 0, 'tov': 5},
    {'dd': 15, 'td': 30}],
   319),
  ('normal control 2',
   [{'ast': 6, 'blk': 0, 'dreb': 5, 'fg3m': 3, 'oreb': 2, 'pts': 10, 'stl': 10, 'tov': 2},
    {'dd': 15, 'td': 30}],
   584),
  ('normal control 3',
   [{'ast': 11, 'blk': 10, 'dreb': 5, 'fg3m': 0, 'oreb': 0, 'pts': 9, 'stl': 2, 'tov': 3},
    {'dd': 15, 'td': 30}],
   660),
  ('normal control 4',
   [{'ast': 11, 'blk': 1, 'dreb': 8, 'fg3m': 3, 'oreb': 3, 'pts': 34, 'stl': 0, 'tov': 3},
    {'dd': 15, 'td': 30}],
   682)],
 [('regression: quadruple-double tier',
   [{'ast': 10, 'blk': 2, 'dreb': 10, 'fg3m': 1, 'oreb': 3, 'pts': 10, 'stl': 10, 'tov': 0},
    {'dd': 15, 'td': 30}],
   801),
  ('partial repair probe: quadruple-double tier',
   [{'ast': 10, 'blk': 2, 'dreb': 9, 'fg3m': 4, 'oreb': 6, 'pts': 11, 'stl': 10, 'tov': 2},
    {'dd': 15, 'td': 30}],
   830),
  ('second regression',
   [{'ast': 10, 'blk': 11, 'dreb': 10, 'fg3m': 1, 'oreb': 2, 'pts': 9, 'stl': 10, 'tov': 5},
    {'dd': 15, 'td': 30}],
   999),
  ('normal control 1',
   [{'ast': 10, 'blk': 1, 'dreb': 4, 'fg3m': 2, 'oreb': 5, 'pts': 10, 'stl': 1, 'tov': 1},
    {'dd': 15, 'td': 30}],
   433),
  ('normal control 2',
   [{'ast': 9, 'blk': 10, 'dreb': 10, 'fg3m': 1, 'oreb': 0, 'pts': 11, 'stl': 2, 'tov': 1},
    {'dd': 15, 'td': 30}],
   750),
  ('normal control 3',
   [{'ast': 10, 'blk': 1, 'dreb': 8, 'fg3m': 3, 'oreb': 4, 'pts': 26, 'stl': 2, 'tov': 2},
    {'dd': 15, 'td': 30}],
   669),
  ('normal control 4',
   [{'ast': 10, 'blk': 0, 'dreb': 5, 'fg3m': 3, 'oreb': 4, 'pts': 10, 'stl': 10, 'tov': 5},
    {'dd': 15, 'td': 30}],
   653)],
 [('regression: quadruple-double tier',
   [{'ast': 10, 'blk': 10, 'dreb': 10, 'fg3m': 0, 'oreb': 5, 'pts': 10, 'stl': 1, 'tov': 0},
    {'dd': 15, 'td': 30}],
   790),
  ('partial repair probe: quadruple-double tier',
   [{'ast': 10, 'blk': 11, 'dreb': 8, 'fg3m': 3, 'oreb': 6, 'pts': 11, 'stl': 2, 'tov': 6},
    {'dd': 15, 'td': 30}],
   803),
  ('second regression',
   [{'ast': 11, 'blk': 10, 'dreb': 10, 'fg3m': 5, 'oreb': 0, 'pts': 24, 'stl': 1, 'tov': 6},
    {'dd': 15, 'td': 30}],
   850),
  ('normal control 1',
   [{'ast': 9, 'blk': 2, 'dreb': 5, 'fg3m': 2, 'oreb': 4, 'pts': 11, 'stl': 1, 'tov': 4},
    {'dd': 15, 'td': 30}],
   413),
  ('normal control 2',
   [{'ast': 10, 'blk': 2, 'dreb': 9, 'fg3m': 2, 'oreb': 4, 'pts': 10, 'stl': 0, 'tov': 2},
    {'dd': 15, 'td': 30}],
   486),
  ('normal control 3',
   [{'ast': 10, 'blk': 1, 'dreb': 8, 'fg3m': 5, 'oreb': 3, 'pts': 10, 'stl': 0, 'tov': 4},
    {'dd': 15, 'td': 30}],
   427),
  ('normal control 4',
   [{'ast': 11, 'blk': 0, 'dreb': 10, 'fg3m': 5, 'oreb': 4, 'pts': 10, 'stl': 2, 'tov': 5},
    {'dd': 15, 'td': 30}],
   498)]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "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(line, bonus):
    line = dict(line, reb=line['oreb'] + line['dreb'])
    w = {'pts': 10, 'reb': 12, 'ast': 15, 'stl': 30, 'blk': 30, 'tov': -10, 'fg3m': 5}
    score = sum(w[k] * line[k] for k in w)
    doubles = sum(1 for k in ('pts', 'reb', 'ast', 'stl', 'blk') if line[k] >= 10)
    if doubles == 3:
        score += bonus['td']
    elif doubles >= 2:
        score += bonus['dd']
    return score
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: quadruple-double tier',
   [{'ast': 10, 'blk': 11, 'dreb': 10, 'fg3m': 1, 'oreb': 5, 'pts': 35, 'stl': 10, 'tov': 0},
    {'dd': 15, 'td': 30}],
   1345),
  ('partial repair probe: quadruple-double tier',
   [{'ast': 10, 'blk': 10, 'dreb': 10, 'fg3m': 2, 'oreb': 4, 'pts': 11, 'stl': 3, 'tov': 6},
    {'dd': 15, 'td': 30}],
   798),
  ('second regression',
   [{'ast': 10, 'blk': 11, 'dreb': 9, 'fg3m': 4, 'oreb': 3, 'pts': 21, 'stl': 2, 'tov': 4},
    {'dd': 15, 'td': 30}],
   904),
  ('normal control 1',
   [{'ast': 10, 'blk': 2, 'dreb': 0, 'fg3m': 0, 'oreb': 6, 'pts': 10, 'stl': 0, 'tov': 1},
    {'dd': 15, 'td': 30}],
   387),
  ('normal control 2',
   [{'ast': 11, 'blk': 1, 'dreb': 4, 'fg3m': 2, 'oreb': 2, 'pts': 10, 'stl': 3, 'tov': 5},
    {'dd': 15, 'td': 30}],
   432),
  ('normal control 3',
   [{'ast': 10, 'blk': 2, 'dreb': 9, 'fg3m': 3, 'oreb': 2, 'pts': 1, 'stl': 2, 'tov': 5},
    {'dd': 15, 'td': 30}],
   392),
  ('normal control 4',
   [{'ast': 11, 'blk': 2, 'dreb': 7, 'fg3m': 5, 'oreb': 1, 'pts': 10, 'stl': 0, 'tov': 2},
    {'dd': 15, 'td': 30}],
   441)],
 [('regression: quadruple-double tier',
   [{'ast': 10, 'blk': 0, 'dreb': 10, 'fg3m': 3, 'oreb': 5, 'pts': 10, 'stl': 10, 'tov': 2},
    {'dd': 15, 'td': 30}],
   755),
  ('partial repair probe: quadruple-double tier',
   [{'ast': 11, 'blk': 10, 'dreb': 4, 'fg3m': 6, 'oreb': 0, 'pts': 10, 'stl': 10, 'tov': 2},
    {'dd': 15, 'td': 30}],
   953),
  ('second regression',
   [{'ast': 11, 'blk': 10, 'dreb': 9, 'fg3m': 1, 'oreb': 4, 'pts': 11, 'stl': 3, 'tov': 4},
    {'dd': 15, 'td': 30}],
   816),
  ('normal control 1',
   [{'ast': 10, 'blk': 11, 'dreb': 10, 'fg3m': 5, 'oreb': 1, 'pts': 9, 'stl': 0, 'tov': 6},
    {'dd': 15, 'td': 30}],
   697),
  ('normal control 2',
   [{'ast': 9, 'blk': 1, 'dreb': 9, 'fg3m': 4, 'oreb': 5, 'pts': 9, 'stl': 2, 'tov': 0},
    {'dd': 15, 'td': 30}],
   503),
  ('normal control 3',
   [{'ast': 6, 'blk': 2, 'dreb': 10, 'fg3m': 4, 'oreb': 5, 'pts': 39, 'stl': 1, 'tov': 3},
    {'dd': 15, 'td': 30}],
   755),
  ('normal control 4',
   [{'ast': 9, 'blk': 10, 'dreb': 4, 'fg3m': 0, 'oreb': 3, 'pts': 10, 'stl': 2, 'tov': 4},
    {'dd': 15, 'td': 30}],
   654)],
 [('regression: quadruple-double tier',
   [{'ast': 10, 'blk': 10, 'dreb': 9, 'fg3m': 2, 'oreb': 2, 'pts': 10, 'stl': 1, 'tov': 0},
    {'dd': 15, 'td': 30}],
   752),
  ('partial repair probe: quadruple-double tier',
   [{'ast': 11, 'blk': 2, 'dreb': 5, 'fg3m': 5, 'oreb': 5, 'pts': 11, 'stl': 10, 'tov': 2},
    {'dd': 15, 'td': 30}],
   790),
  ('second regression',
   [{'ast': 11, 'blk': 11, 'dreb': 4, 'fg3m': 6, 'oreb': 1, 'pts': 29, 'stl': 10, 'tov': 5},
    {'dd': 15, 'td': 30}],
   1155),
  ('normal control 1',
   [{'ast': 11, 'blk': 0, 'dreb': 4, 'fg3m': 6, 'oreb': 3, 'pts': 9, 'stl': 0, 'tov': 5},
    {'dd': 15, 'td': 30}],
   319),
  ('normal control 2',
   [{'ast': 6, 'blk': 0, 'dreb': 5, 'fg3m': 3, 'oreb': 2, 'pts': 10, 'stl': 10, 'tov': 2},
    {'dd': 15, 'td': 30}],
   584),
  ('normal control 3',
   [{'ast': 11, 'blk': 10, 'dreb': 5, 'fg3m': 0, 'oreb': 0, 'pts': 9, 'stl': 2, 'tov': 3},
    {'dd': 15, 'td': 30}],
   660),
  ('normal control 4',
   [{'ast': 11, 'blk': 1, 'dreb': 8, 'fg3m': 3, 'oreb': 3, 'pts': 34, 'stl': 0, 'tov': 3},
    {'dd': 15, 'td': 30}],
   682)],
 [('regression: quadruple-double tier',
   [{'ast': 10, 'blk': 2, 'dreb': 10, 'fg3m': 1, 'oreb': 3, 'pts': 10, 'stl': 10, 'tov': 0},
    {'dd': 15, 'td': 30}],
   801),
  ('partial repair probe: quadruple-double tier',
   [{'ast': 10, 'blk': 2, 'dreb': 9, 'fg3m': 4, 'oreb': 6, 'pts': 11, 'stl': 10, 'tov': 2},
    {'dd': 15, 'td': 30}],
   830),
  ('second regression',
   [{'ast': 10, 'blk': 11, 'dreb': 10, 'fg3m': 1, 'oreb': 2, 'pts': 9, 'stl': 10, 'tov': 5},
    {'dd': 15, 'td': 30}],
   999),
  ('normal control 1',
   [{'ast': 10, 'blk': 1, 'dreb': 4, 'fg3m': 2, 'oreb': 5, 'pts': 10, 'stl': 1, 'tov': 1},
    {'dd': 15, 'td': 30}],
   433),
  ('normal control 2',
   [{'ast': 9, 'blk': 10, 'dreb': 10, 'fg3m': 1, 'oreb': 0, 'pts': 11, 'stl': 2, 'tov': 1},
    {'dd': 15, 'td': 30}],
   750),
  ('normal control 3',
   [{'ast': 10, 'blk': 1, 'dreb': 8, 'fg3m': 3, 'oreb': 4, 'pts': 26, 'stl': 2, 'tov': 2},
    {'dd': 15, 'td': 30}],
   669),
  ('normal control 4',
   [{'ast': 10, 'blk': 0, 'dreb': 5, 'fg3m': 3, 'oreb': 4, 'pts': 10, 'stl': 10, 'tov': 5},
    {'dd': 15, 'td': 30}],
   653)],
 [('regression: quadruple-double tier',
   [{'ast': 10, 'blk': 10, 'dreb': 10, 'fg3m': 0, 'oreb': 5, 'pts': 10, 'stl': 1, 'tov': 0},
    {'dd': 15, 'td': 30}],
   790),
  ('partial repair probe: quadruple-double tier',
   [{'ast': 10, 'blk': 11, 'dreb': 8, 'fg3m': 3, 'oreb': 6, 'pts': 11, 'stl': 2, 'tov': 6},
    {'dd': 15, 'td': 30}],
   803),
  ('second regression',
   [{'ast': 11, 'blk': 10, 'dreb': 10, 'fg3m': 5, 'oreb': 0, 'pts': 24, 'stl': 1, 'tov': 6},
    {'dd': 15, 'td': 30}],
   850),
  ('normal control 1',
   [{'ast': 9, 'blk': 2, 'dreb': 5, 'fg3m': 2, 'oreb': 4, 'pts': 11, 'stl': 1, 'tov': 4},
    {'dd': 15, 'td': 30}],
   413),
  ('normal control 2',
   [{'ast': 10, 'blk': 2, 'dreb': 9, 'fg3m': 2, 'oreb': 4, 'pts': 10, 'stl': 0, 'tov': 2},
    {'dd': 15, 'td': 30}],
   486),
  ('normal control 3',
   [{'ast': 10, 'blk': 1, 'dreb': 8, 'fg3m': 5, 'oreb': 3, 'pts': 10, 'stl': 0, 'tov': 4},
    {'dd': 15, 'td': 30}],
   427),
  ('normal control 4',
   [{'ast': 11, 'blk': 0, 'dreb': 10, 'fg3m': 5, 'oreb': 4, 'pts': 10, 'stl': 2, 'tov': 5},
    {'dd': 15, 'td': 30}],
   498)]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "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:
A rare quadruple-double scores no bonus at all.

Score a basketball line in tenths: points 1.0, rebounds (offensive + defensive) 1.2, assists 1.5, steals 3, blocks 3, turnovers -1, threes made 0.5 extra. Count double-digit categories among points, rebounds, assists, steals and blocks; three or more earns only the triple-double bonus, exactly two earns the double-double bonus.

split: open-access


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

N = 1
observations = []
def solve(g):
    ga = g['team_ga']
    saves = g['shots_faced'] - ga
    pts = saves * 2 - ga * 20
    pts += {'W': 40, 'OTL': 10}.get(g['decision'], 0)
    if ga == 0 and g['toi_sec'] >= 3600:
        pts += 30
    return {'saves': saves, 'points': pts}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: empty-net attribution',
   [{'decision': 'OTL', 'empty_net_ga': 1, 'shots_faced': 26, 'team_ga': 1, 'toi_sec': 3540}],
   {'points': 62, 'saves': 26}),
  ('partial repair probe: empty-net attribution',
   [{'decision': 'W', 'empty_net_ga': 2, 'shots_faced': 23, 'team_ga': 5, 'toi_sec': 2400}],
   {'points': 20, 'saves': 20}),
  ('second regression',
   [{'decision': None, 'empty_net_ga': 1, 'shots_faced': 16, 'team_ga': 1, 'toi_sec': 2400}],
   {'points': 32, 'saves': 16}),
  ('normal control 1',
   [{'decision': 'W', 'empty_net_ga': 0, 'shots_faced': 7, 'team_ga': 2, 'toi_sec': 3900}],
   {'points': 10, 'saves': 5}),
  ('normal control 2',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 13, 'team_ga': 0, 'toi_sec': 2675}],
   {'points': 36, 'saves': 13}),
  ('normal control 3',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 26, 'team_ga': 3, 'toi_sec': 3900}],
   {'points': -4, 'saves': 23}),
  ('normal control 4',
   [{'decision': None, 'empty_net_ga': 0, 'shots_faced': 32, 'team_ga': 1, 'toi_sec': 3540}],
   {'points': 42, 'saves': 31})],
 [('regression: empty-net attribution',
   [{'decision': 'W', 'empty_net_ga': 1, 'shots_faced': 34, 'team_ga': 2, 'toi_sec': 3540}],
   {'points': 86, 'saves': 33}),
  ('partial repair probe: empty-net attribution',
   [{'decision': 'OTL', 'empty_net_ga': 2, 'shots_faced': 29, 'team_ga': 4, 'toi_sec': 3900}],
   {'points': 24, 'saves': 27}),
  ('second regression',
   [{'decision': 'L', 'empty_net_ga': 1, 'shots_faced': 18, 'team_ga': 3, 'toi_sec': 3900}],
   {'points': -8, 'saves': 16}),
  ('normal control 1',
   [{'decision': None, 'empty_net_ga': 0, 'shots_faced': 2, 'team_ga': 1, 'toi_sec': 3600}],
   {'points': -18, 'saves': 1}),
  ('normal control 2',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 8, 'team_ga': 1, 'toi_sec': 3599}],
   {'points': 4, 'saves': 7}),
  ('normal control 3',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 16, 'team_ga': 2, 'toi_sec': 3600}],
   {'points': -2, 'saves': 14}),
  ('normal control 4',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 3, 'team_ga': 1, 'toi_sec': 3540}],
   {'points': -6, 'saves': 2})],
 [('regression: empty-net attribution',
   [{'decision': 'L', 'empty_net_ga': 1, 'shots_faced': 38, 'team_ga': 3, 'toi_sec': 2400}],
   {'points': 32, 'saves': 36}),
  ('partial repair probe: empty-net attribution',
   [{'decision': 'L', 'empty_net_ga': 2, 'shots_faced': 39, 'team_ga': 2, 'toi_sec': 3600}],
   {'points': 108, 'saves': 39}),
  ('second regression',
   [{'decision': 'L', 'empty_net_ga': 1, 'shots_faced': 39, 'team_ga': 2, 'toi_sec': 3599}],
   {'points': 56, 'saves': 38}),
  ('normal control 1',
   [{'decision': None, 'empty_net_ga': 0, 'shots_faced': 36, 'team_ga': 2, 'toi_sec': 2400}],
   {'points': 28, 'saves': 34}),
  ('normal control 2',
   [{'decision': 'W', 'empty_net_ga': 0, 'shots_faced': 20, 'team_ga': 5, 'toi_sec': 2400}],
   {'points': -30, 'saves': 15}),
  ('normal control 3',
   [{'decision': 'L', 'empty_net_ga': 0, 'shots_faced': 17, 'team_ga': 2, 'toi_sec': 3600}],
   {'points': -10, 'saves': 15}),
  ('normal control 4',
   [{'decision': 'W', 'empty_net_ga': 0, 'shots_faced': 40, 'team_ga': 0, 'toi_sec': 3600}],
   {'points': 150, 'saves': 40})],
 [('regression: empty-net attribution',
   [{'decision': 'L', 'empty_net_ga': 2, 'shots_faced': 37, 'team_ga': 2, 'toi_sec': 2400}],
   {'points': 74, 'saves': 37}),
  ('partial repair probe: empty-net attribution',
   [{'decision': 'L', 'empty_net_ga': 2, 'shots_faced': 1, 'team_ga': 2, 'toi_sec': 3540}],
   {'points': 2, 'saves': 1}),
  ('second regression',
   [{'decision': None, 'empty_net_ga': 2, 'shots_faced': 7, 'team_ga': 2, 'toi_sec': 3900}],
   {'points': 44, 'saves': 7}),
  ('normal control 1',
   [{'decision': None, 'empty_net_ga': 0, 'shots_faced': 1, 'team_ga': 1, 'toi_sec': 3600}],
   {'points': -20, 'saves': 0}),
  ('normal control 2',
   [{'decision': 'W', 'empty_net_ga': 0, 'shots_faced': 38, 'team_ga': 5, 'toi_sec': 3540}],
   {'points': 6, 'saves': 33}),
  ('normal control 3',
   [{'decision': 'L', 'empty_net_ga': 0, 'shots_faced': 15, 'team_ga': 0, 'toi_sec': 3540}],
   {'points': 30, 'saves': 15}),
  ('normal control 4',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 11, 'team_ga': 0, 'toi_sec': 2400}],
   {'points': 32, 'saves': 11})],
 [('regression: empty-net attribution',
   [{'decision': 'W', 'empty_net_ga': 1, 'shots_faced': 40, 'team_ga': 4, 'toi_sec': 3599}],
   {'points': 54, 'saves': 37}),
  ('partial repair probe: empty-net attribution',
   [{'decision': 'L', 'empty_net_ga': 2, 'shots_faced': 33, 'team_ga': 3, 'toi_sec': 2400}],
   {'points': 44, 'saves': 32}),
  ('second regression',
   [{'decision': 'OTL', 'empty_net_ga': 1, 'shots_faced': 6, 'team_ga': 3, 'toi_sec': 3600}],
   {'points': -22, 'saves': 4}),
  ('normal control 1',
   [{'decision': 'W', 'empty_net_ga': 0, 'shots_faced': 9, 'team_ga': 0, 'toi_sec': 3600}],
   {'points': 88, 'saves': 9}),
  ('normal control 2',
   [{'decision': None, 'empty_net_ga': 0, 'shots_faced': 25, 'team_ga': 0, 'toi_sec': 3599}],
   {'points': 50, 'saves': 25}),
  ('normal control 3',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 17, 'team_ga': 5, 'toi_sec': 2400}],
   {'points': -66, 'saves': 12}),
  ('normal control 4',
   [{'decision': 'W', 'empty_net_ga': 0, 'shots_faced': 6, 'team_ga': 1, 'toi_sec': 3599}],
   {'points': 30, 'saves': 5})]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "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(g):
    ga = g['team_ga'] - (1 if g['empty_net_ga'] else 0)
    saves = g['shots_faced'] - ga
    pts = saves * 2 - ga * 20
    pts += {'W': 40, 'OTL': 10}.get(g['decision'], 0)
    if ga == 0 and g['toi_sec'] >= 3600:
        pts += 30
    return {'saves': saves, 'points': pts}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: empty-net attribution',
   [{'decision': 'OTL', 'empty_net_ga': 1, 'shots_faced': 26, 'team_ga': 1, 'toi_sec': 3540}],
   {'points': 62, 'saves': 26}),
  ('partial repair probe: empty-net attribution',
   [{'decision': 'W', 'empty_net_ga': 2, 'shots_faced': 23, 'team_ga': 5, 'toi_sec': 2400}],
   {'points': 20, 'saves': 20}),
  ('second regression',
   [{'decision': None, 'empty_net_ga': 1, 'shots_faced': 16, 'team_ga': 1, 'toi_sec': 2400}],
   {'points': 32, 'saves': 16}),
  ('normal control 1',
   [{'decision': 'W', 'empty_net_ga': 0, 'shots_faced': 7, 'team_ga': 2, 'toi_sec': 3900}],
   {'points': 10, 'saves': 5}),
  ('normal control 2',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 13, 'team_ga': 0, 'toi_sec': 2675}],
   {'points': 36, 'saves': 13}),
  ('normal control 3',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 26, 'team_ga': 3, 'toi_sec': 3900}],
   {'points': -4, 'saves': 23}),
  ('normal control 4',
   [{'decision': None, 'empty_net_ga': 0, 'shots_faced': 32, 'team_ga': 1, 'toi_sec': 3540}],
   {'points': 42, 'saves': 31})],
 [('regression: empty-net attribution',
   [{'decision': 'W', 'empty_net_ga': 1, 'shots_faced': 34, 'team_ga': 2, 'toi_sec': 3540}],
   {'points': 86, 'saves': 33}),
  ('partial repair probe: empty-net attribution',
   [{'decision': 'OTL', 'empty_net_ga': 2, 'shots_faced': 29, 'team_ga': 4, 'toi_sec': 3900}],
   {'points': 24, 'saves': 27}),
  ('second regression',
   [{'decision': 'L', 'empty_net_ga': 1, 'shots_faced': 18, 'team_ga': 3, 'toi_sec': 3900}],
   {'points': -8, 'saves': 16}),
  ('normal control 1',
   [{'decision': None, 'empty_net_ga': 0, 'shots_faced': 2, 'team_ga': 1, 'toi_sec': 3600}],
   {'points': -18, 'saves': 1}),
  ('normal control 2',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 8, 'team_ga': 1, 'toi_sec': 3599}],
   {'points': 4, 'saves': 7}),
  ('normal control 3',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 16, 'team_ga': 2, 'toi_sec': 3600}],
   {'points': -2, 'saves': 14}),
  ('normal control 4',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 3, 'team_ga': 1, 'toi_sec': 3540}],
   {'points': -6, 'saves': 2})],
 [('regression: empty-net attribution',
   [{'decision': 'L', 'empty_net_ga': 1, 'shots_faced': 38, 'team_ga': 3, 'toi_sec': 2400}],
   {'points': 32, 'saves': 36}),
  ('partial repair probe: empty-net attribution',
   [{'decision': 'L', 'empty_net_ga': 2, 'shots_faced': 39, 'team_ga': 2, 'toi_sec': 3600}],
   {'points': 108, 'saves': 39}),
  ('second regression',
   [{'decision': 'L', 'empty_net_ga': 1, 'shots_faced': 39, 'team_ga': 2, 'toi_sec': 3599}],
   {'points': 56, 'saves': 38}),
  ('normal control 1',
   [{'decision': None, 'empty_net_ga': 0, 'shots_faced': 36, 'team_ga': 2, 'toi_sec': 2400}],
   {'points': 28, 'saves': 34}),
  ('normal control 2',
   [{'decision': 'W', 'empty_net_ga': 0, 'shots_faced': 20, 'team_ga': 5, 'toi_sec': 2400}],
   {'points': -30, 'saves': 15}),
  ('normal control 3',
   [{'decision': 'L', 'empty_net_ga': 0, 'shots_faced': 17, 'team_ga': 2, 'toi_sec': 3600}],
   {'points': -10, 'saves': 15}),
  ('normal control 4',
   [{'decision': 'W', 'empty_net_ga': 0, 'shots_faced': 40, 'team_ga': 0, 'toi_sec': 3600}],
   {'points': 150, 'saves': 40})],
 [('regression: empty-net attribution',
   [{'decision': 'L', 'empty_net_ga': 2, 'shots_faced': 37, 'team_ga': 2, 'toi_sec': 2400}],
   {'points': 74, 'saves': 37}),
  ('partial repair probe: empty-net attribution',
   [{'decision': 'L', 'empty_net_ga': 2, 'shots_faced': 1, 'team_ga': 2, 'toi_sec': 3540}],
   {'points': 2, 'saves': 1}),
  ('second regression',
   [{'decision': None, 'empty_net_ga': 2, 'shots_faced': 7, 'team_ga': 2, 'toi_sec': 3900}],
   {'points': 44, 'saves': 7}),
  ('normal control 1',
   [{'decision': None, 'empty_net_ga': 0, 'shots_faced': 1, 'team_ga': 1, 'toi_sec': 3600}],
   {'points': -20, 'saves': 0}),
  ('normal control 2',
   [{'decision': 'W', 'empty_net_ga': 0, 'shots_faced': 38, 'team_ga': 5, 'toi_sec': 3540}],
   {'points': 6, 'saves': 33}),
  ('normal control 3',
   [{'decision': 'L', 'empty_net_ga': 0, 'shots_faced': 15, 'team_ga': 0, 'toi_sec': 3540}],
   {'points': 30, 'saves': 15}),
  ('normal control 4',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 11, 'team_ga': 0, 'toi_sec': 2400}],
   {'points': 32, 'saves': 11})],
 [('regression: empty-net attribution',
   [{'decision': 'W', 'empty_net_ga': 1, 'shots_faced': 40, 'team_ga': 4, 'toi_sec': 3599}],
   {'points': 54, 'saves': 37}),
  ('partial repair probe: empty-net attribution',
   [{'decision': 'L', 'empty_net_ga': 2, 'shots_faced': 33, 'team_ga': 3, 'toi_sec': 2400}],
   {'points': 44, 'saves': 32}),
  ('second regression',
   [{'decision': 'OTL', 'empty_net_ga': 1, 'shots_faced': 6, 'team_ga': 3, 'toi_sec': 3600}],
   {'points': -22, 'saves': 4}),
  ('normal control 1',
   [{'decision': 'W', 'empty_net_ga': 0, 'shots_faced': 9, 'team_ga': 0, 'toi_sec': 3600}],
   {'points': 88, 'saves': 9}),
  ('normal control 2',
   [{'decision': None, 'empty_net_ga': 0, 'shots_faced': 25, 'team_ga': 0, 'toi_sec': 3599}],
   {'points': 50, 'saves': 25}),
  ('normal control 3',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 17, 'team_ga': 5, 'toi_sec': 2400}],
   {'points': -66, 'saves': 12}),
  ('normal control 4',
   [{'decision': 'W', 'empty_net_ga': 0, 'shots_faced': 6, 'team_ga': 1, 'toi_sec': 3599}],
   {'points': 30, 'saves': 5})]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "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:
A goalie who allowed one goal is charged three after two late empty-netters.

Score a hockey goalie in tenths. Goals against charged to the goalie exclude empty-net goals scored on his team. shots_faced counts only shots the goalie faced, so saves = shots_faced - goalie goals against. Save 0.2, goal against -2, win 4, overtime loss 1, regulation loss 0. A shutout (+3) needs zero goalie goals against and at least 3600 seconds on ice; the decision does not matter.

split: open-access