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

N = 1
observations = []
def solve(lineup, points, salaries, teams, cap):
    cpt, flex = lineup['CPT'], lineup['FLEX']
    names = [cpt] + flex
    cpt_salary = -(-salaries[cpt] * 3 // 200) * 100
    salary = cpt_salary + sum(salaries[p] for p in flex)
    c = points[cpt] * 3
    cpt_pts = (abs(c) + 1) // 2 * (1 if c >= 0 else -1)
    total = cpt_pts + sum(points[p] for p in flex)
    if len(flex) != 5 or len(set(names)) != 6:
        return {'valid': False, 'reason': 'roster', 'salary': salary, 'points': total}
    if salary > cap:
        return {'valid': False, 'reason': 'cap', 'salary': salary, 'points': total}
    if len({teams[p] for p in flex}) < 2:
        return {'valid': False, 'reason': 'teams', 'salary': salary, 'points': total}
    return {'valid': True, 'reason': None, 'salary': salary, 'points': total}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: two-team requirement',
   [{'CPT': 'c', 'FLEX': ['e', 'h', 'b', 'd', 'f']},
    {'a': 1333, 'b': 1795, 'c': -50, 'd': 723, 'e': 382, 'f': -45, 'g': 61, 'h': -50},
    {'a': 9900, 'b': 9900, 'c': 3300, 'd': 3300, 'e': 3300, 'f': 3300, 'g': 5500, 'h': 3300},
    {'a': 'H', 'b': 'H', 'c': 'A', 'd': 'H', 'e': 'H', 'f': 'H', 'g': 'H', 'h': 'H'}, 28200],
   {'points': 2730, 'reason': None, 'salary': 28100, 'valid': True}),
  ('partial repair probe: two-team requirement',
   [{'CPT': 'g', 'FLEX': ['b', 'a', 'e', 'c', 'd']},
    {'a': 2001, 'b': 225, 'c': 225, 'd': 1333, 'e': 225, 'f': 225, 'g': 1795, 'h': 0},
    {'a': 9900, 'b': 3300, 'c': 9900, 'd': 7100, 'e': 8700, 'f': 10500, 'g': 8700, 'h': 9900},
    {'a': 'H', 'b': 'H', 'c': 'H', 'd': 'A', 'e': 'H', 'f': 'H', 'g': 'H', 'h': 'H'}, 52100],
   {'points': 6702, 'reason': None, 'salary': 52000, 'valid': True}),
  ('second regression',
   [{'CPT': 'a', 'FLEX': ['g', 'd', 'e', 'f', 'h']},
    {'a': 225, 'b': 0, 'c': 1333, 'd': 225, 'e': -50, 'f': 225, 'g': -45, 'h': 1333},
    {'a': 8700, 'b': 5300, 'c': 5500, 'd': 5500, 'e': 8700, 'f': 5500, 'g': 7100, 'h': 7100},
    {'a': 'A', 'b': 'H', 'c': 'H', 'd': 'H', 'e': 'H', 'f': 'H', 'g': 'H', 'h': 'H'}, 50000],
   {'points': 2026, 'reason': None, 'salary': 47000, 'valid': True}),
  ('normal control 1',
   [{'CPT': 'g', 'FLEX': ['g', 'h', 'c', 'e', 'f']},
    {'a': 1795, 'b': 1692, 'c': -45, 'd': -50, 'e': 0, 'f': 1795, 'g': 2759, 'h': 0},
    {'a': 9900, 'b': 9900, 'c': 5500, 'd': 10500, 'e': 3300, 'f': 9900, 'g': 9900, 'h': 5500},
    {'a': 'H', 'b': 'H', 'c': 'A', 'd': 'H', 'e': 'H', 'f': 'H', 'g': 'H', 'h': 'H'}, 48900],
   {'points': 8648, 'reason': 'roster', 'salary': 49000, 'valid': False}),
  ('normal control 2',
   [{'CPT': 'h', 'FLEX': ['g', 'e', 'h', 'b', 'c']},
    {'a': -50, 'b': 1795, 'c': 2077, 'd': -45, 'e': 225, 'f': 2001, 'g': -50, 'h': 1333},
    {'a': 5300, 'b': 3300, 'c': 3300, 'd': 7100, 'e': 8700, 'f': 10500, 'g': 8700, 'h': 5300},
    {'a': 'H', 'b': 'A', 'c': 'H', 'd': 'H', 'e': 'H', 'f': 'A', 'g': 'A', 'h': 'H'}, 37400],
   {'points': 7380, 'reason': 'roster', 'salary': 37300, 'valid': False}),
  ('normal control 3',
   [{'CPT': 'd', 'FLEX': ['c', 'f', 'h', 'd', 'b']},
    {'a': 2001, 'b': -50, 'c': -45, 'd': 1795, 'e': 2001, 'f': 2426, 'g': 2173, 'h': 225},
    {'a': 9900, 'b': 3300, 'c': 5300, 'd': 7100, 'e': 7100, 'f': 5300, 'g': 5500, 'h': 9900},
    {'a': 'H', 'b': 'A', 'c': 'H', 'd': 'H', 'e': 'H', 'f': 'H', 'g': 'H', 'h': 'H'}, 41700],
   {'points': 7044, 'reason': 'roster', 'salary': 41600, 'valid': False}),
  ('normal control 4',
   [{'CPT': 'e', 'FLEX': ['c', 'a', 'f', 'b', 'd']},
    {'a': 2001, 'b': -45, 'c': 1333, 'd': 1333, 'e': 0, 'f': 1333, 'g': 1795, 'h': 1120},
    {'a': 3300, 'b': 9900, 'c': 7100, 'd': 5500, 'e': 9900, 'f': 7100, 'g': 8700, 'h': 9900},
    {'a': 'H', 'b': 'H', 'c': 'A', 'd': 'H', 'e': 'H', 'f': 'H', 'g': 'A', 'h': 'A'}, 47900],
   {'points': 5955, 'reason': None, 'salary': 47800, 'valid': True})],
 [('regression: two-team requirement',
   [{'CPT': 'a', 'FLEX': ['d', 'f', 'b', 'c', 'h']},
    {'a': 1333, 'b': -45, 'c': -45, 'd': 0, 'e': 225, 'f': 2001, 'g': 1795, 'h': 225},
    {'a': 10500, 'b': 7100, 'c': 9900, 'd': 7100, 'e': 3300, 'f': 10500, 'g': 5500, 'h': 5300},
    {'a': 'A', 'b': 'H', 'c': 'H', 'd': 'H', 'e': 'H', 'f': 'H', 'g': 'H', 'h': 'H'}, 55800],
   {'points': 4136, 'reason': None, 'salary': 55700, 'valid': True}),
  ('partial repair probe: two-team requirement',
   [{'CPT': 'e', 'FLEX': ['a', 'd', 'c', 'h', 'g']},
    {'a': 1333, 'b': 225, 'c': 225, 'd': 1795, 'e': 225, 'f': 1333, 'g': -45, 'h': 225},
    {'a': 7100, 'b': 7100, 'c': 7100, 'd': 10500, 'e': 7100, 'f': 8700, 'g': 3300, 'h': 7100},
    {'a': 'H', 'b': 'H', 'c': 'H', 'd': 'H', 'e': 'H', 'f': 'H', 'g': 'A', 'h': 'H'}, 50000],
   {'points': 3871, 'reason': None, 'salary': 45800, 'valid': True}),
  ('second regression',
   [{'CPT': 'e', 'FLEX': ['g', 'b', 'a', 'd', 'c']},
    {'a': 225, 'b': -45, 'c': 2001, 'd': 2001, 'e': -50, 'f': 0, 'g': 225, 'h': 2001},
    {'a': 3300, 'b': 8700, 'c': 3300, 'd': 5500, 'e': 3300, 'f': 8700, 'g': 7100, 'h': 9900},
    {'a': 'H', 'b': 'H', 'c': 'H', 'd': 'H', 'e': 'A', 'f': 'H', 'g': 'H', 'h': 'H'}, 33000],
   {'points': 4332, 'reason': None, 'salary': 32900, 'valid': True}),
  ('normal control 1',
   [{'CPT': 'a', 'FLEX': ['d', 'f', 'a', 'c', 'g']},
    {'a': 2619, 'b': -45, 'c': 2001, 'd': -50, 'e': 0, 'f': 1795, 'g': 0, 'h': -45},
    {'a': 10500, 'b': 7100, 'c': 8700, 'd': 5300, 'e': 8700, 'f': 9900, 'g': 5300, 'h': 5300},
    {'a': 'H', 'b': 'H', 'c': 'H', 'd': 'A', 'e': 'H', 'f': 'H', 'g': 'H', 'h': 'H'}, 50000],
   {'points': 10294, 'reason': 'roster', 'salary': 55500, 'valid': False}),
  ('normal control 2',
   [{'CPT': 'a', 'FLEX': ['h', 'e', 'c', 'b', 'a']},
    {'a': 2001, 'b': -50, 'c': 1795, 'd': 2020, 'e': 2001, 'f': -45, 'g': 2001, 'h': 225},
    {'a': 5500, 'b': 5500, 'c': 8700, 'd': 8700, 'e': 5300, 'f': 9900, 'g': 3300, 'h': 3300},
    {'a': 'A', 'b': 'A', 'c': 'A', 'd': 'A', 'e': 'H', 'f': 'H', 'g': 'H', 'h': 'H'}, 36700],
   {'points': 8974, 'reason': 'roster', 'salary': 36600, 'valid': False}),
  ('normal control 3',
   [{'CPT': 'a', 'FLEX': ['d', 'h', 'b', 'f', 'a']},
    {'a': 2300, 'b': 225, 'c': -50, 'd': 114, 'e': 1333, 'f': 2849, 'g': 2001, 'h': -45},
    {'a': 7100, 'b': 7100, 'c': 5300, 'd': 9900, 'e': 8700, 'f': 7100, 'g': 5300, 'h': 5500},
    {'a': 'H', 'b': 'H', 'c': 'H', 'd': 'A', 'e': 'H', 'f': 'A', 'g': 'H', 'h': 'A'}, 47400],
   {'points': 8893, 'reason': 'roster', 'salary': 47400, 'valid': False}),
  ('normal control 4',
   [{'CPT': 'd', 'FLEX': ['c', 'h', 'a', 'f', 'e']},
    {'a': 225, 'b': 1795, 'c': 2001, 'd': -50, 'e': 472, 'f': 225, 'g': 1333, 'h': 225},
    {'a': 7100, 'b': 7100, 'c': 7100, 'd': 8700, 'e': 7100, 'f': 5300, 'g': 10500, 'h': 5300},
    {'a': 'H', 'b': 'A', 'c': 'A', 'd': 'A', 'e': 'A', 'f': 'H', 'g': 'A', 'h': 'A'}, 50000],
   {'points': 3073, 'reason': None, 'salary': 45000, 'valid': True})],
 [('regression: two-team requirement',
   [{'CPT': 'e', 'FLEX': ['f', 'd', 'c', 'a', 'h']},
    {'a': -50, 'b': 2001, 'c': -50, 'd': 0, 'e': -45, 'f': 2001, 'g': -45, 'h': 1333},
    {'a': 5300, 'b': 8700, 'c': 10500, 'd': 8700, 'e': 5300, 'f': 8700, 'g': 8700, 'h': 5500},
    {'a': 'H', 'b': 'H', 'c': 'H', 'd': 'H', 'e': 'A', 'f': 'H', 'g': 'H', 'h': 'H'}, 50000],
   {'points': 3166, 'reason': None, 'salary': 46700, 'valid': True}),
  ('partial repair probe: two-team requirement',
   [{'CPT': 'd', 'FLEX': ['f', 'g', 'h', 'a', 'e']},
    {'a': -45, 'b': -45, 'c': 2014, 'd': 1795, 'e': 1333, 'f': -50, 'g': 0, 'h': -50},
    {'a': 5500, 'b': 5300, 'c': 7100, 'd': 3300, 'e': 7100, 'f': 5500, 'g': 10500, 'h': 3300},
    {'a': 'H', 'b': 'H', 'c': 'H', 'd': 'H', 'e': 'A', 'f': 'H', 'g': 'H', 'h': 'H'}, 50000],
   {'points': 3881, 'reason': None, 'salary': 36900, 'valid': True}),
  ('second regression',
   [{'CPT': 'c', 'FLEX': ['h', 'f', 'g', 'b', 'a']},
    {'a': -50, 'b': 821, 'c': 225, 'd': 1795, 'e': 1333, 'f': 1333, 'g': 1333, 'h': 2001},
    {'a': 7100, 'b': 10500, 'c': 8700, 'd': 8700, 'e': 8700, 'f': 10500, 'g': 5500, 'h': 5500},
    {'a': 'H', 'b': 'H', 'c': 'A', 'd': 'A', 'e': 'H', 'f': 'H', 'g': 'H', 'h': 'H'}, 52200],
   {'points': 5776, 'reason': None, 'salary': 52200, 'valid': True}),
  ('normal control 1',
   [{'CPT': 'c', 'FLEX': ['b', 'c', 'f', 'a', 'g']},
    {'a': 1795, 'b': 0, 'c': 1795, 'd': 0, 'e': 1795, 'f': 103, 'g': -50, 'h': 1795},
    {'a': 5300, 'b': 10500, 'c': 5300, 'd': 7100, 'e': 3300, 'f': 8700, 'g': 8700, 'h': 5500},
    {'a': 'H', 'b': 'H', 'c': 'H', 'd': 'H', 'e': 'H', 'f': 'H', 'g': 'A', 'h': 'H'}, 46500],
   {'points': 6336, 'reason': 'roster', 'salary': 46500, 'valid': False}),
  ('normal control 2',
   [{'CPT': 'e', 'FLEX': ['e', 'b', 'g', 'd', 'h']},
    {'a': 1660, 'b': 0, 'c': 1684, 'd': 1228, 'e': 1795, 'f': -50, 'g': 2114, 'h': 1775},
    {'a': 3300, 'b': 3300, 'c': 9900, 'd': 9900, 'e': 9900, 'f': 9900, 'g': 8700, 'h': 3300},
    {'a': 'A', 'b': 'H', 'c': 'H', 'd': 'A', 'e': 'H', 'f': 'H', 'g': 'H', 'h': 'H'}, 50100],
   {'points': 9605, 'reason': 'roster', 'salary': 50000, 'valid': False}),
  ('normal control 3',
   [{'CPT': 'd', 'FLEX': ['f', 'h', 'b', 'c', 'd']},
    {'a': 1861, 'b': 104, 'c': 225, 'd': 1333, 'e': 2001, 'f': -45, 'g': -45, 'h': 1795},
    {'a': 3300, 'b': 3300, 'c': 7100, 'd': 9900, 'e': 7100, 'f': 10500, 'g': 8700, 'h': 5300},
    {'a': 'H', 'b': 'A', 'c': 'A', 'd': 'H', 'e': 'H', 'f': 'H', 'g': 'A', 'h': 'H'}, 51100],
   {'points': 5412, 'reason': 'roster', 'salary': 51000, 'valid': False}),
  ('normal control 4',
   [{'CPT': 'h', 'FLEX': ['a', 'f', 'b', 'g', 'c']},
    {'a': 0, 'b': 1333, 'c': 1795, 'd': 1795, 'e': 0, 'f': 2001, 'g': 225, 'h': 225},
    {'a': 9900, 'b': 10500, 'c': 9900, 'd': 8700, 'e': 10500, 'f': 9900, 'g': 5500, 'h': 9900},
    {'a': 'H', 'b': 'H', 'c': 'A', 'd': 'A', 'e': 'H', 'f': 'H', 'g': 'A', 'h': 'A'}, 50000],
   {'points': 5692, 'reason': 'cap', 'salary': 60600, 'valid': False})],
 [('regression: two-team requirement',
   [{'CPT': 'c', 'FLEX': ['d', 'h', 'a', 'e', 'g']},
    {'a': 1333, 'b': 225, 'c': 1333, 'd': 225, 'e': 2911, 'f': 1333, 'g': -50, 'h': 225},
    {'a': 8700, 'b': 5500, 'c': 3300, 'd': 10500, 'e': 5500, 'f': 9900, 'g': 10500, 'h': 8700},
    {'a': 'H', 'b': 'H', 'c': 'A', 'd': 'H', 'e': 'H', 'f': 'H', 'g': 'H', 'h': 'H'}, 50000],
   {'points': 6644, 'reason': None, 'salary': 48900, 'valid': True}),
  ('partial repair probe: two-team requirement',
   [{'CPT': 'd', 'FLEX': ['e', 'f', 'a', 'b', 'h']},
    {'a': 225, 'b': 1795, 'c': -80, 'd': 1333, 'e': 1700, 'f': 0, 'g': 2205, 'h': -50},
    {'a': 7100, 'b': 5300, 'c': 5300, 'd': 7100, 'e': 5300, 'f': 5300, 'g': 10500, 'h': 8700},
    {'a': 'H', 'b': 'H', 'c': 'A', 'd': 'H', 'e': 'H', 'f': 'H', 'g': 'A', 'h': 'A'}, 42500],
   {'points': 5670, 'reason': None, 'salary': 42400, 'valid': True}),
  ('second regression',
   [{'CPT': 'h', 'FLEX': ['a', 'g', 'b', 'd', 'f']},
    {'a': 2001, 'b': -50, 'c': -50, 'd': 1333, 'e': 1333, 'f': 225, 'g': -45, 'h': -45},
    {'a': 9900, 'b': 8700, 'c': 7100, 'd': 7100, 'e': 5500, 'f': 9900, 'g': 10500, 'h': 7100},
    {'a': 'H', 'b': 'H', 'c': 'H', 'd': 'H', 'e': 'H', 'f': 'H', 'g': 'H', 'h': 'A'}, 56800],
   {'points': 3396, 'reason': None, 'salary': 56800, 'valid': True}),
  ('normal control 1',
   [{'CPT': 'a', 'FLEX': ['g', 'h', 'a', 'd', 'f']},
    {'a': -50, 'b': 0, 'c': 225, 'd': 2048, 'e': 0, 'f': 1951, 'g': 1333, 'h': 1795},
    {'a': 10500, 'b': 7100, 'c': 8700, 'd': 3300, 'e': 9900, 'f': 10500, 'g': 10500, 'h': 10500},
    {'a': 'H', 'b': 'A', 'c': 'A', 'd': 'H', 'e': 'A', 'f': 'H', 'g': 'H', 'h': 'A'}, 61200],
   {'points': 7002, 'reason': 'roster', 'salary': 61100, 'valid': False}),
  ('normal control 2',
   [{'CPT': 'h', 'FLEX': ['b', 'h', 'c', 'e', 'g']},
    {'a': -45, 'b': 2001, 'c': 225, 'd': 1333, 'e': -50, 'f': -45, 'g': -50, 'h': 2001},
    {'a': 5500, 'b': 5500, 'c': 5300, 'd': 9900, 'e': 9900, 'f': 5500, 'g': 5300, 'h': 9900},
    {'a': 'H', 'b': 'H', 'c': 'A', 'd': 'H', 'e': 'H', 'f': 'H', 'g': 'H', 'h': 'H'}, 50800],
   {'points': 7129, 'reason': 'roster', 'salary': 50800, 'valid': False}),
  ('normal control 3',
   [{'CPT': 'a', 'FLEX': ['f', 'c', 'e', 'h', 'b']},
    {'a': -45, 'b': 2001, 'c': 2001, 'd': 0, 'e': 2001, 'f': 1795, 'g': 225, 'h': -45},
    {'a': 9900, 'b': 5300, 'c': 9900, 'd': 7100, 'e': 9900, 'f': 8700, 'g': 10500, 'h': 10500},
    {'a': 'H', 'b': 'H', 'c': 'A', 'd': 'A', 'e': 'H', 'f': 'A', 'g': 'H', 'h': 'A'}, 50000],
   {'points': 7685, 'reason': 'cap', 'salary': 59200, 'valid': False}),
  ('normal control 4',
   [{'CPT': 'f', 'FLEX': ['b', 'f', 'a', 'h', 'c']},
    {'a': 1333, 'b': 2001, 'c': 1886, 'd': 1795, 'e': 1390, 'f': 225, 'g': 0, 'h': 225},
    {'a': 10500, 'b': 5300, 'c': 5500, 'd': 8700, 'e': 8700, 'f': 3300, 'g': 7100, 'h': 7100},
    {'a': 'A', 'b': 'H', 'c': 'A', 'd': 'H', 'e': 'H', 'f': 'A', 'g': 'H', 'h': 'A'}, 36600],
   {'points': 6008, 'reason': 'roster', 'salary': 36700, 'valid': False})],
 [('regression: two-team requirement',
   [{'CPT': 'b', 'FLEX': ['h', 'd', 'a', 'g', 'c']},
    {'a': 1652, 'b': 0, 'c': 2001, 'd': 2001, 'e': -50, 'f': 2001, 'g': 0, 'h': -45},
    {'a': 5300, 'b': 8700, 'c': 10500, 'd': 8700, 'e': 5500, 'f': 8700, 'g': 10500, 'h': 5500},
    {'a': 'H', 'b': 'A', 'c': 'H', 'd': 'H', 'e': 'H', 'f': 'H', 'g': 'H', 'h': 'H'}, 53700],
   {'points': 5609, 'reason': None, 'salary': 53600, 'valid': True}),
  ('partial repair probe: two-team requirement',
   [{'CPT': 'g', 'FLEX': ['b', 'd', 'f', 'c', 'h']},
    {'a': 1840, 'b': 1333, 'c': 2671, 'd': -50, 'e': -50, 'f': 2001, 'g': -45, 'h': -45},
    {'a': 7100, 'b': 3300, 'c': 5500, 'd': 10500, 'e': 10500, 'f': 10500, 'g': 8700, 'h': 7100},
    {'a': 'H', 'b': 'H', 'c': 'H', 'd': 'H', 'e': 'H', 'f': 'H', 'g': 'H', 'h': 'A'}, 50000],
   {'points': 5842, 'reason': None, 'salary': 50000, 'valid': True}),
  ('second regression',
   [{'CPT': 'f', 'FLEX': ['a', 'g', 'd', 'e', 'c']},
    {'a': -45, 'b': -50, 'c': 2612, 'd': 225, 'e': 0, 'f': 1333, 'g': -50, 'h': -45},
    {'a': 5500, 'b': 5300, 'c': 10500, 'd': 8700, 'e': 5500, 'f': 10500, 'g': 7100, 'h': 10500},
    {'a': 'A', 'b': 'A', 'c': 'A', 'd': 'A', 'e': 'A', 'f': 'H', 'g': 'A', 'h': 'A'}, 53100],
   {'points': 4742, 'reason': None, 'salary': 53100, 'valid': True}),
  ('normal control 1',
   [{'CPT': 'c', 'FLEX': ['b', 'a', 'd', 'h', 'f']},
    {'a': -50, 'b': 267, 'c': 2001, 'd': 2001, 'e': 225, 'f': -45, 'g': -50, 'h': 0},
    {'a': 7100, 'b': 9900, 'c': 9900, 'd': 8700, 'e': 9900, 'f': 5500, 'g': 9900, 'h': 5300},
    {'a': 'A', 'b': 'H', 'c': 'H', 'd': 'H', 'e': 'H', 'f': 'H', 'g': 'H', 'h': 'H'}, 51400],
   {'points': 5175, 'reason': None, 'salary': 51400, 'valid': True}),
  ('normal control 2',
   [{'CPT': 'b', 'FLEX': ['g', 'e', 'b', 'h', 'c']},
    {'a': 0, 'b': 1333, 'c': 1333, 'd': 2912, 'e': 1333, 'f': 225, 'g': 0, 'h': -50},
    {'a': 5500, 'b': 8700, 'c': 9900, 'd': 5300, 'e': 7100, 'f': 3300, 'g': 5300, 'h': 3300},
    {'a': 'A', 'b': 'A', 'c': 'H', 'd': 'H', 'e': 'A', 'f': 'A', 'g': 'H', 'h': 'H'}, 47400],
   {'points': 5949, 'reason': 'roster', 'salary': 47400, 'valid': False}),
  ('normal control 3',
   [{'CPT': 'b', 'FLEX': ['a', 'e', 'c', 'h', 'f']},
    {'a': 2001, 'b': 1795, 'c': 582, 'd': 1795, 'e': -45, 'f': -45, 'g': -45, 'h': 215},
    {'a': 3300, 'b': 7100, 'c': 9900, 'd': 5300, 'e': 10500, 'f': 7100, 'g': 7100, 'h': 10500},
    {'a': 'H', 'b': 'H', 'c': 'H', 'd': 'A', 'e': 'A', 'f': 'H', 'g': 'A', 'h': 'A'}, 52000],
   {'points': 5401, 'reason': None, 'salary': 52000, 'valid': True}),
  ('normal control 4',
   [{'CPT': 'b', 'FLEX': ['a', 'g', 'e', 'h', 'c']},
    {'a': 1795, 'b': 2582, 'c': 1795, 'd': -45, 'e': -50, 'f': 2001, 'g': 225, 'h': -45},
    {'a': 7100, 'b': 5300, 'c': 7100, 'd': 7100, 'e': 7100, 'f': 10500, 'g': 5300, 'h': 9900},
    {'a': 'A', 'b': 'H', 'c': 'H', 'd': 'H', 'e': 'H', 'f': 'H', 'g': 'H', 'h': 'H'}, 44400],
   {'points': 7593, 'reason': 'cap', 'salary': 44500, 'valid': False})]]
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(lineup, points, salaries, teams, cap):
    cpt, flex = lineup['CPT'], lineup['FLEX']
    names = [cpt] + flex
    cpt_salary = -(-salaries[cpt] * 3 // 200) * 100
    salary = cpt_salary + sum(salaries[p] for p in flex)
    c = points[cpt] * 3
    cpt_pts = (abs(c) + 1) // 2 * (1 if c >= 0 else -1)
    total = cpt_pts + sum(points[p] for p in flex)
    if len(flex) != 5 or len(set(names)) != 6:
        return {'valid': False, 'reason': 'roster', 'salary': salary, 'points': total}
    if salary > cap:
        return {'valid': False, 'reason': 'cap', 'salary': salary, 'points': total}
    if len({teams[p] for p in names[:5]}) < 2:
        return {'valid': False, 'reason': 'teams', 'salary': salary, 'points': total}
    return {'valid': True, 'reason': None, 'salary': salary, 'points': total}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: two-team requirement',
   [{'CPT': 'c', 'FLEX': ['e', 'h', 'b', 'd', 'f']},
    {'a': 1333, 'b': 1795, 'c': -50, 'd': 723, 'e': 382, 'f': -45, 'g': 61, 'h': -50},
    {'a': 9900, 'b': 9900, 'c': 3300, 'd': 3300, 'e': 3300, 'f': 3300, 'g': 5500, 'h': 3300},
    {'a': 'H', 'b': 'H', 'c': 'A', 'd': 'H', 'e': 'H', 'f': 'H', 'g': 'H', 'h': 'H'}, 28200],
   {'points': 2730, 'reason': None, 'salary': 28100, 'valid': True}),
  ('partial repair probe: two-team requirement',
   [{'CPT': 'g', 'FLEX': ['b', 'a', 'e', 'c', 'd']},
    {'a': 2001, 'b': 225, 'c': 225, 'd': 1333, 'e': 225, 'f': 225, 'g': 1795, 'h': 0},
    {'a': 9900, 'b': 3300, 'c': 9900, 'd': 7100, 'e': 8700, 'f': 10500, 'g': 8700, 'h': 9900},
    {'a': 'H', 'b': 'H', 'c': 'H', 'd': 'A', 'e': 'H', 'f': 'H', 'g': 'H', 'h': 'H'}, 52100],
   {'points': 6702, 'reason': None, 'salary': 52000, 'valid': True}),
  ('second regression',
   [{'CPT': 'a', 'FLEX': ['g', 'd', 'e', 'f', 'h']},
    {'a': 225, 'b': 0, 'c': 1333, 'd': 225, 'e': -50, 'f': 225, 'g': -45, 'h': 1333},
    {'a': 8700, 'b': 5300, 'c': 5500, 'd': 5500, 'e': 8700, 'f': 5500, 'g': 7100, 'h': 7100},
    {'a': 'A', 'b': 'H', 'c': 'H', 'd': 'H', 'e': 'H', 'f': 'H', 'g': 'H', 'h': 'H'}, 50000],
   {'points': 2026, 'reason': None, 'salary': 47000, 'valid': True}),
  ('normal control 1',
   [{'CPT': 'g', 'FLEX': ['g', 'h', 'c', 'e', 'f']},
    {'a': 1795, 'b': 1692, 'c': -45, 'd': -50, 'e': 0, 'f': 1795, 'g': 2759, 'h': 0},
    {'a': 9900, 'b': 9900, 'c': 5500, 'd': 10500, 'e': 3300, 'f': 9900, 'g': 9900, 'h': 5500},
    {'a': 'H', 'b': 'H', 'c': 'A', 'd': 'H', 'e': 'H', 'f': 'H', 'g': 'H', 'h': 'H'}, 48900],
   {'points': 8648, 'reason': 'roster', 'salary': 49000, 'valid': False}),
  ('normal control 2',
   [{'CPT': 'h', 'FLEX': ['g', 'e', 'h', 'b', 'c']},
    {'a': -50, 'b': 1795, 'c': 2077, 'd': -45, 'e': 225, 'f': 2001, 'g': -50, 'h': 1333},
    {'a': 5300, 'b': 3300, 'c': 3300, 'd': 7100, 'e': 8700, 'f': 10500, 'g': 8700, 'h': 5300},
    {'a': 'H', 'b': 'A', 'c': 'H', 'd': 'H', 'e': 'H', 'f': 'A', 'g': 'A', 'h': 'H'}, 37400],
   {'points': 7380, 'reason': 'roster', 'salary': 37300, 'valid': False}),
  ('normal control 3',
   [{'CPT': 'd', 'FLEX': ['c', 'f', 'h', 'd', 'b']},
    {'a': 2001, 'b': -50, 'c': -45, 'd': 1795, 'e': 2001, 'f': 2426, 'g': 2173, 'h': 225},
    {'a': 9900, 'b': 3300, 'c': 5300, 'd': 7100, 'e': 7100, 'f': 5300, 'g': 5500, 'h': 9900},
    {'a': 'H', 'b': 'A', 'c': 'H', 'd': 'H', 'e': 'H', 'f': 'H', 'g': 'H', 'h': 'H'}, 41700],
   {'points': 7044, 'reason': 'roster', 'salary': 41600, 'valid': False}),
  ('normal control 4',
   [{'CPT': 'e', 'FLEX': ['c', 'a', 'f', 'b', 'd']},
    {'a': 2001, 'b': -45, 'c': 1333, 'd': 1333, 'e': 0, 'f': 1333, 'g': 1795, 'h': 1120},
    {'a': 3300, 'b': 9900, 'c': 7100, 'd': 5500, 'e': 9900, 'f': 7100, 'g': 8700, 'h': 9900},
    {'a': 'H', 'b': 'H', 'c': 'A', 'd': 'H', 'e': 'H', 'f': 'H', 'g': 'A', 'h': 'A'}, 47900],
   {'points': 5955, 'reason': None, 'salary': 47800, 'valid': True})],
 [('regression: two-team requirement',
   [{'CPT': 'a', 'FLEX': ['d', 'f', 'b', 'c', 'h']},
    {'a': 1333, 'b': -45, 'c': -45, 'd': 0, 'e': 225, 'f': 2001, 'g': 1795, 'h': 225},
    {'a': 10500, 'b': 7100, 'c': 9900, 'd': 7100, 'e': 3300, 'f': 10500, 'g': 5500, 'h': 5300},
    {'a': 'A', 'b': 'H', 'c': 'H', 'd': 'H', 'e': 'H', 'f': 'H', 'g': 'H', 'h': 'H'}, 55800],
   {'points': 4136, 'reason': None, 'salary': 55700, 'valid': True}),
  ('partial repair probe: two-team requirement',
   [{'CPT': 'e', 'FLEX': ['a', 'd', 'c', 'h', 'g']},
    {'a': 1333, 'b': 225, 'c': 225, 'd': 1795, 'e': 225, 'f': 1333, 'g': -45, 'h': 225},
    {'a': 7100, 'b': 7100, 'c': 7100, 'd': 10500, 'e': 7100, 'f': 8700, 'g': 3300, 'h': 7100},
    {'a': 'H', 'b': 'H', 'c': 'H', 'd': 'H', 'e': 'H', 'f': 'H', 'g': 'A', 'h': 'H'}, 50000],
   {'points': 3871, 'reason': None, 'salary': 45800, 'valid': True}),
  ('second regression',
   [{'CPT': 'e', 'FLEX': ['g', 'b', 'a', 'd', 'c']},
    {'a': 225, 'b': -45, 'c': 2001, 'd': 2001, 'e': -50, 'f': 0, 'g': 225, 'h': 2001},
    {'a': 3300, 'b': 8700, 'c': 3300, 'd': 5500, 'e': 3300, 'f': 8700, 'g': 7100, 'h': 9900},
    {'a': 'H', 'b': 'H', 'c': 'H', 'd': 'H', 'e': 'A', 'f': 'H', 'g': 'H', 'h': 'H'}, 33000],
   {'points': 4332, 'reason': None, 'salary': 32900, 'valid': True}),
  ('normal control 1',
   [{'CPT': 'a', 'FLEX': ['d', 'f', 'a', 'c', 'g']},
    {'a': 2619, 'b': -45, 'c': 2001, 'd': -50, 'e': 0, 'f': 1795, 'g': 0, 'h': -45},
    {'a': 10500, 'b': 7100, 'c': 8700, 'd': 5300, 'e': 8700, 'f': 9900, 'g': 5300, 'h': 5300},
    {'a': 'H', 'b': 'H', 'c': 'H', 'd': 'A', 'e': 'H', 'f': 'H', 'g': 'H', 'h': 'H'}, 50000],
   {'points': 10294, 'reason': 'roster', 'salary': 55500, 'valid': False}),
  ('normal control 2',
   [{'CPT': 'a', 'FLEX': ['h', 'e', 'c', 'b', 'a']},
    {'a': 2001, 'b': -50, 'c': 1795, 'd': 2020, 'e': 2001, 'f': -45, 'g': 2001, 'h': 225},
    {'a': 5500, 'b': 5500, 'c': 8700, 'd': 8700, 'e': 5300, 'f': 9900, 'g': 3300, 'h': 3300},
    {'a': 'A', 'b': 'A', 'c': 'A', 'd': 'A', 'e': 'H', 'f': 'H', 'g': 'H', 'h': 'H'}, 36700],
   {'points': 8974, 'reason': 'roster', 'salary': 36600, 'valid': False}),
  ('normal control 3',
   [{'CPT': 'a', 'FLEX': ['d', 'h', 'b', 'f', 'a']},
    {'a': 2300, 'b': 225, 'c': -50, 'd': 114, 'e': 1333, 'f': 2849, 'g': 2001, 'h': -45},
    {'a': 7100, 'b': 7100, 'c': 5300, 'd': 9900, 'e': 8700, 'f': 7100, 'g': 5300, 'h': 5500},
    {'a': 'H', 'b': 'H', 'c': 'H', 'd': 'A', 'e': 'H', 'f': 'A', 'g': 'H', 'h': 'A'}, 47400],
   {'points': 8893, 'reason': 'roster', 'salary': 47400, 'valid': False}),
  ('normal control 4',
   [{'CPT': 'd', 'FLEX': ['c', 'h', 'a', 'f', 'e']},
    {'a': 225, 'b': 1795, 'c': 2001, 'd': -50, 'e': 472, 'f': 225, 'g': 1333, 'h': 225},
    {'a': 7100, 'b': 7100, 'c': 7100, 'd': 8700, 'e': 7100, 'f': 5300, 'g': 10500, 'h': 5300},
    {'a': 'H', 'b': 'A', 'c': 'A', 'd': 'A', 'e': 'A', 'f': 'H', 'g': 'A', 'h': 'A'}, 50000],
   {'points': 3073, 'reason': None, 'salary': 45000, 'valid': True})],
 [('regression: two-team requirement',
   [{'CPT': 'e', 'FLEX': ['f', 'd', 'c', 'a', 'h']},
    {'a': -50, 'b': 2001, 'c': -50, 'd': 0, 'e': -45, 'f': 2001, 'g': -45, 'h': 1333},
    {'a': 5300, 'b': 8700, 'c': 10500, 'd': 8700, 'e': 5300, 'f': 8700, 'g': 8700, 'h': 5500},
    {'a': 'H', 'b': 'H', 'c': 'H', 'd': 'H', 'e': 'A', 'f': 'H', 'g': 'H', 'h': 'H'}, 50000],
   {'points': 3166, 'reason': None, 'salary': 46700, 'valid': True}),
  ('partial repair probe: two-team requirement',
   [{'CPT': 'd', 'FLEX': ['f', 'g', 'h', 'a', 'e']},
    {'a': -45, 'b': -45, 'c': 2014, 'd': 1795, 'e': 1333, 'f': -50, 'g': 0, 'h': -50},
    {'a': 5500, 'b': 5300, 'c': 7100, 'd': 3300, 'e': 7100, 'f': 5500, 'g': 10500, 'h': 3300},
    {'a': 'H', 'b': 'H', 'c': 'H', 'd': 'H', 'e': 'A', 'f': 'H', 'g': 'H', 'h': 'H'}, 50000],
   {'points': 3881, 'reason': None, 'salary': 36900, 'valid': True}),
  ('second regression',
   [{'CPT': 'c', 'FLEX': ['h', 'f', 'g', 'b', 'a']},
    {'a': -50, 'b': 821, 'c': 225, 'd': 1795, 'e': 1333, 'f': 1333, 'g': 1333, 'h': 2001},
    {'a': 7100, 'b': 10500, 'c': 8700, 'd': 8700, 'e': 8700, 'f': 10500, 'g': 5500, 'h': 5500},
    {'a': 'H', 'b': 'H', 'c': 'A', 'd': 'A', 'e': 'H', 'f': 'H', 'g': 'H', 'h': 'H'}, 52200],
   {'points': 5776, 'reason': None, 'salary': 52200, 'valid': True}),
  ('normal control 1',
   [{'CPT': 'c', 'FLEX': ['b', 'c', 'f', 'a', 'g']},
    {'a': 1795, 'b': 0, 'c': 1795, 'd': 0, 'e': 1795, 'f': 103, 'g': -50, 'h': 1795},
    {'a': 5300, 'b': 10500, 'c': 5300, 'd': 7100, 'e': 3300, 'f': 8700, 'g': 8700, 'h': 5500},
    {'a': 'H', 'b': 'H', 'c': 'H', 'd': 'H', 'e': 'H', 'f': 'H', 'g': 'A', 'h': 'H'}, 46500],
   {'points': 6336, 'reason': 'roster', 'salary': 46500, 'valid': False}),
  ('normal control 2',
   [{'CPT': 'e', 'FLEX': ['e', 'b', 'g', 'd', 'h']},
    {'a': 1660, 'b': 0, 'c': 1684, 'd': 1228, 'e': 1795, 'f': -50, 'g': 2114, 'h': 1775},
    {'a': 3300, 'b': 3300, 'c': 9900, 'd': 9900, 'e': 9900, 'f': 9900, 'g': 8700, 'h': 3300},
    {'a': 'A', 'b': 'H', 'c': 'H', 'd': 'A', 'e': 'H', 'f': 'H', 'g': 'H', 'h': 'H'}, 50100],
   {'points': 9605, 'reason': 'roster', 'salary': 50000, 'valid': False}),
  ('normal control 3',
   [{'CPT': 'd', 'FLEX': ['f', 'h', 'b', 'c', 'd']},
    {'a': 1861, 'b': 104, 'c': 225, 'd': 1333, 'e': 2001, 'f': -45, 'g': -45, 'h': 1795},
    {'a': 3300, 'b': 3300, 'c': 7100, 'd': 9900, 'e': 7100, 'f': 10500, 'g': 8700, 'h': 5300},
    {'a': 'H', 'b': 'A', 'c': 'A', 'd': 'H', 'e': 'H', 'f': 'H', 'g': 'A', 'h': 'H'}, 51100],
   {'points': 5412, 'reason': 'roster', 'salary': 51000, 'valid': False}),
  ('normal control 4',
   [{'CPT': 'h', 'FLEX': ['a', 'f', 'b', 'g', 'c']},
    {'a': 0, 'b': 1333, 'c': 1795, 'd': 1795, 'e': 0, 'f': 2001, 'g': 225, 'h': 225},
    {'a': 9900, 'b': 10500, 'c': 9900, 'd': 8700, 'e': 10500, 'f': 9900, 'g': 5500, 'h': 9900},
    {'a': 'H', 'b': 'H', 'c': 'A', 'd': 'A', 'e': 'H', 'f': 'H', 'g': 'A', 'h': 'A'}, 50000],
   {'points': 5692, 'reason': 'cap', 'salary': 60600, 'valid': False})],
 [('regression: two-team requirement',
   [{'CPT': 'c', 'FLEX': ['d', 'h', 'a', 'e', 'g']},
    {'a': 1333, 'b': 225, 'c': 1333, 'd': 225, 'e': 2911, 'f': 1333, 'g': -50, 'h': 225},
    {'a': 8700, 'b': 5500, 'c': 3300, 'd': 10500, 'e': 5500, 'f': 9900, 'g': 10500, 'h': 8700},
    {'a': 'H', 'b': 'H', 'c': 'A', 'd': 'H', 'e': 'H', 'f': 'H', 'g': 'H', 'h': 'H'}, 50000],
   {'points': 6644, 'reason': None, 'salary': 48900, 'valid': True}),
  ('partial repair probe: two-team requirement',
   [{'CPT': 'd', 'FLEX': ['e', 'f', 'a', 'b', 'h']},
    {'a': 225, 'b': 1795, 'c': -80, 'd': 1333, 'e': 1700, 'f': 0, 'g': 2205, 'h': -50},
    {'a': 7100, 'b': 5300, 'c': 5300, 'd': 7100, 'e': 5300, 'f': 5300, 'g': 10500, 'h': 8700},
    {'a': 'H', 'b': 'H', 'c': 'A', 'd': 'H', 'e': 'H', 'f': 'H', 'g': 'A', 'h': 'A'}, 42500],
   {'points': 5670, 'reason': None, 'salary': 42400, 'valid': True}),
  ('second regression',
   [{'CPT': 'h', 'FLEX': ['a', 'g', 'b', 'd', 'f']},
    {'a': 2001, 'b': -50, 'c': -50, 'd': 1333, 'e': 1333, 'f': 225, 'g': -45, 'h': -45},
    {'a': 9900, 'b': 8700, 'c': 7100, 'd': 7100, 'e': 5500, 'f': 9900, 'g': 10500, 'h': 7100},
    {'a': 'H', 'b': 'H', 'c': 'H', 'd': 'H', 'e': 'H', 'f': 'H', 'g': 'H', 'h': 'A'}, 56800],
   {'points': 3396, 'reason': None, 'salary': 56800, 'valid': True}),
  ('normal control 1',
   [{'CPT': 'a', 'FLEX': ['g', 'h', 'a', 'd', 'f']},
    {'a': -50, 'b': 0, 'c': 225, 'd': 2048, 'e': 0, 'f': 1951, 'g': 1333, 'h': 1795},
    {'a': 10500, 'b': 7100, 'c': 8700, 'd': 3300, 'e': 9900, 'f': 10500, 'g': 10500, 'h': 10500},
    {'a': 'H', 'b': 'A', 'c': 'A', 'd': 'H', 'e': 'A', 'f': 'H', 'g': 'H', 'h': 'A'}, 61200],
   {'points': 7002, 'reason': 'roster', 'salary': 61100, 'valid': False}),
  ('normal control 2',
   [{'CPT': 'h', 'FLEX': ['b', 'h', 'c', 'e', 'g']},
    {'a': -45, 'b': 2001, 'c': 225, 'd': 1333, 'e': -50, 'f': -45, 'g': -50, 'h': 2001},
    {'a': 5500, 'b': 5500, 'c': 5300, 'd': 9900, 'e': 9900, 'f': 5500, 'g': 5300, 'h': 9900},
    {'a': 'H', 'b': 'H', 'c': 'A', 'd': 'H', 'e': 'H', 'f': 'H', 'g': 'H', 'h': 'H'}, 50800],
   {'points': 7129, 'reason': 'roster', 'salary': 50800, 'valid': False}),
  ('normal control 3',
   [{'CPT': 'a', 'FLEX': ['f', 'c', 'e', 'h', 'b']},
    {'a': -45, 'b': 2001, 'c': 2001, 'd': 0, 'e': 2001, 'f': 1795, 'g': 225, 'h': -45},
    {'a': 9900, 'b': 5300, 'c': 9900, 'd': 7100, 'e': 9900, 'f': 8700, 'g': 10500, 'h': 10500},
    {'a': 'H', 'b': 'H', 'c': 'A', 'd': 'A', 'e': 'H', 'f': 'A', 'g': 'H', 'h': 'A'}, 50000],
   {'points': 7685, 'reason': 'cap', 'salary': 59200, 'valid': False}),
  ('normal control 4',
   [{'CPT': 'f', 'FLEX': ['b', 'f', 'a', 'h', 'c']},
    {'a': 1333, 'b': 2001, 'c': 1886, 'd': 1795, 'e': 1390, 'f': 225, 'g': 0, 'h': 225},
    {'a': 10500, 'b': 5300, 'c': 5500, 'd': 8700, 'e': 8700, 'f': 3300, 'g': 7100, 'h': 7100},
    {'a': 'A', 'b': 'H', 'c': 'A', 'd': 'H', 'e': 'H', 'f': 'A', 'g': 'H', 'h': 'A'}, 36600],
   {'points': 6008, 'reason': 'roster', 'salary': 36700, 'valid': False})],
 [('regression: two-team requirement',
   [{'CPT': 'b', 'FLEX': ['h', 'd', 'a', 'g', 'c']},
    {'a': 1652, 'b': 0, 'c': 2001, 'd': 2001, 'e': -50, 'f': 2001, 'g': 0, 'h': -45},
    {'a': 5300, 'b': 8700, 'c': 10500, 'd': 8700, 'e': 5500, 'f': 8700, 'g': 10500, 'h': 5500},
    {'a': 'H', 'b': 'A', 'c': 'H', 'd': 'H', 'e': 'H', 'f': 'H', 'g': 'H', 'h': 'H'}, 53700],
   {'points': 5609, 'reason': None, 'salary': 53600, 'valid': True}),
  ('partial repair probe: two-team requirement',
   [{'CPT': 'g', 'FLEX': ['b', 'd', 'f', 'c', 'h']},
    {'a': 1840, 'b': 1333, 'c': 2671, 'd': -50, 'e': -50, 'f': 2001, 'g': -45, 'h': -45},
    {'a': 7100, 'b': 3300, 'c': 5500, 'd': 10500, 'e': 10500, 'f': 10500, 'g': 8700, 'h': 7100},
    {'a': 'H', 'b': 'H', 'c': 'H', 'd': 'H', 'e': 'H', 'f': 'H', 'g': 'H', 'h': 'A'}, 50000],
   {'points': 5842, 'reason': None, 'salary': 50000, 'valid': True}),
  ('second regression',
   [{'CPT': 'f', 'FLEX': ['a', 'g', 'd', 'e', 'c']},
    {'a': -45, 'b': -50, 'c': 2612, 'd': 225, 'e': 0, 'f': 1333, 'g': -50, 'h': -45},
    {'a': 5500, 'b': 5300, 'c': 10500, 'd': 8700, 'e': 5500, 'f': 10500, 'g': 7100, 'h': 10500},
    {'a': 'A', 'b': 'A', 'c': 'A', 'd': 'A', 'e': 'A', 'f': 'H', 'g': 'A', 'h': 'A'}, 53100],
   {'points': 4742, 'reason': None, 'salary': 53100, 'valid': True}),
  ('normal control 1',
   [{'CPT': 'c', 'FLEX': ['b', 'a', 'd', 'h', 'f']},
    {'a': -50, 'b': 267, 'c': 2001, 'd': 2001, 'e': 225, 'f': -45, 'g': -50, 'h': 0},
    {'a': 7100, 'b': 9900, 'c': 9900, 'd': 8700, 'e': 9900, 'f': 5500, 'g': 9900, 'h': 5300},
    {'a': 'A', 'b': 'H', 'c': 'H', 'd': 'H', 'e': 'H', 'f': 'H', 'g': 'H', 'h': 'H'}, 51400],
   {'points': 5175, 'reason': None, 'salary': 51400, 'valid': True}),
  ('normal control 2',
   [{'CPT': 'b', 'FLEX': ['g', 'e', 'b', 'h', 'c']},
    {'a': 0, 'b': 1333, 'c': 1333, 'd': 2912, 'e': 1333, 'f': 225, 'g': 0, 'h': -50},
    {'a': 5500, 'b': 8700, 'c': 9900, 'd': 5300, 'e': 7100, 'f': 3300, 'g': 5300, 'h': 3300},
    {'a': 'A', 'b': 'A', 'c': 'H', 'd': 'H', 'e': 'A', 'f': 'A', 'g': 'H', 'h': 'H'}, 47400],
   {'points': 5949, 'reason': 'roster', 'salary': 47400, 'valid': False}),
  ('normal control 3',
   [{'CPT': 'b', 'FLEX': ['a', 'e', 'c', 'h', 'f']},
    {'a': 2001, 'b': 1795, 'c': 582, 'd': 1795, 'e': -45, 'f': -45, 'g': -45, 'h': 215},
    {'a': 3300, 'b': 7100, 'c': 9900, 'd': 5300, 'e': 10500, 'f': 7100, 'g': 7100, 'h': 10500},
    {'a': 'H', 'b': 'H', 'c': 'H', 'd': 'A', 'e': 'A', 'f': 'H', 'g': 'A', 'h': 'A'}, 52000],
   {'points': 5401, 'reason': None, 'salary': 52000, 'valid': True}),
  ('normal control 4',
   [{'CPT': 'b', 'FLEX': ['a', 'g', 'e', 'h', 'c']},
    {'a': 1795, 'b': 2582, 'c': 1795, 'd': -45, 'e': -50, 'f': 2001, 'g': 225, 'h': -45},
    {'a': 7100, 'b': 5300, 'c': 7100, 'd': 7100, 'e': 7100, 'f': 10500, 'g': 5300, 'h': 9900},
    {'a': 'A', 'b': 'H', 'c': 'H', 'd': 'H', 'e': 'H', 'f': 'H', 'g': 'H', 'h': 'H'}, 44400],
   {'points': 7593, 'reason': 'cap', 'salary': 44500, 'valid': False})]]
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:
Five flex players from one team plus an opposing captain are rejected.

A single-game lineup has one captain and five flex players. The captain costs 1.5x salary rounded up to the next 100 and scores 1.5x points (hundredths, rounded half away from zero). Validation order: exactly five flex players and six distinct names (roster), salary total at most the cap (cap), players from at least two teams (teams). Return validity, first failing reason, salary and points.

split: open-access


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

N = 1
observations = []
def solve(line):
    whole, _, part = line['ip'].partition('.')
    outs = round(float(line['ip']) * 3)
    pts = outs * 100
    pts += line['k'] * 100 - line['h'] * 100 - line['bb'] * 100 - line['er'] * 200
    if line['w']:
        pts += 500
    if line['l']:
        pts -= 300
    if line['sv']:
        pts += 500
    elif line['hld']:
        pts += 300
    if line['bs']:
        pts -= 300
    if outs >= 18 and line['er'] <= 3:
        pts += 300
    return {'outs': outs, 'points': pts}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: innings notation',
   [{'bb': 0,
     'bs': True,
     'er': 5,
     'h': 4,
     'hld': False,
     'ip': '5.2',
     'k': 3,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 17, 'points': 300}),
  ('partial repair probe: innings notation',
   [{'bb': 4,
     'bs': False,
     'er': 2,
     'h': 7,
     'hld': False,
     'ip': '0.1',
     'k': 2,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 1, 'points': -1200}),
  ('second regression',
   [{'bb': 4,
     'bs': False,
     'er': 3,
     'h': 9,
     'hld': False,
     'ip': '6.2',
     'k': 6,
     'l': True,
     'sv': False,
     'w': False}],
   {'outs': 20, 'points': 700}),
  ('normal control 1',
   [{'bb': 0,
     'bs': False,
     'er': 2,
     'h': 6,
     'hld': False,
     'ip': '7',
     'k': 9,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 21, 'points': 2800}),
  ('normal control 2',
   [{'bb': 1,
     'bs': True,
     'er': 4,
     'h': 8,
     'hld': False,
     'ip': '1.0',
     'k': 9,
     'l': True,
     'sv': True,
     'w': False}],
   {'outs': 3, 'points': -600}),
  ('normal control 3',
   [{'bb': 4,
     'bs': False,
     'er': 4,
     'h': 5,
     'hld': True,
     'ip': '1.0',
     'k': 2,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 3, 'points': -900}),
  ('normal control 4',
   [{'bb': 2,
     'bs': False,
     'er': 2,
     'h': 5,
     'hld': False,
     'ip': '7',
     'k': 4,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 21, 'points': 2200})],
 [('regression: innings notation',
   [{'bb': 2,
     'bs': False,
     'er': 4,
     'h': 0,
     'hld': False,
     'ip': '0.1',
     'k': 9,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 1, 'points': 0}),
  ('partial repair probe: innings notation',
   [{'bb': 1,
     'bs': False,
     'er': 3,
     'h': 4,
     'hld': True,
     'ip': '5.2',
     'k': 4,
     'l': False,
     'sv': True,
     'w': False}],
   {'outs': 17, 'points': 1500}),
  ('second regression',
   [{'bb': 0,
     'bs': True,
     'er': 2,
     'h': 9,
     'hld': False,
     'ip': '2.2',
     'k': 6,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 8, 'points': -200}),
  ('normal control 1',
   [{'bb': 3,
     'bs': False,
     'er': 3,
     'h': 1,
     'hld': False,
     'ip': '7',
     'k': 0,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 21, 'points': 1400}),
  ('normal control 2',
   [{'bb': 4,
     'bs': False,
     'er': 5,
     'h': 1,
     'hld': False,
     'ip': '6.0',
     'k': 0,
     'l': False,
     'sv': True,
     'w': False}],
   {'outs': 18, 'points': 800}),
  ('normal control 3',
   [{'bb': 0,
     'bs': True,
     'er': 0,
     'h': 2,
     'hld': True,
     'ip': '7',
     'k': 11,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 21, 'points': 3800}),
  ('normal control 4',
   [{'bb': 3,
     'bs': False,
     'er': 0,
     'h': 6,
     'hld': True,
     'ip': '6.0',
     'k': 8,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 18, 'points': 2300})],
 [('regression: innings notation',
   [{'bb': 4,
     'bs': False,
     'er': 3,
     'h': 3,
     'hld': False,
     'ip': '2.2',
     'k': 9,
     'l': True,
     'sv': False,
     'w': True}],
   {'outs': 8, 'points': 600}),
  ('partial repair probe: innings notation',
   [{'bb': 3,
     'bs': False,
     'er': 3,
     'h': 5,
     'hld': False,
     'ip': '5.2',
     'k': 10,
     'l': False,
     'sv': True,
     'w': False}],
   {'outs': 17, 'points': 1800}),
  ('second regression',
   [{'bb': 2,
     'bs': False,
     'er': 4,
     'h': 5,
     'hld': True,
     'ip': '6.1',
     'k': 8,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 19, 'points': 1500}),
  ('normal control 1',
   [{'bb': 1,
     'bs': False,
     'er': 4,
     'h': 2,
     'hld': False,
     'ip': '1.0',
     'k': 0,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 3, 'points': -300}),
  ('normal control 2',
   [{'bb': 4,
     'bs': True,
     'er': 5,
     'h': 1,
     'hld': False,
     'ip': '6.0',
     'k': 0,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 18, 'points': 500}),
  ('normal control 3',
   [{'bb': 2,
     'bs': False,
     'er': 4,
     'h': 7,
     'hld': False,
     'ip': '6.0',
     'k': 5,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 18, 'points': 600}),
  ('normal control 4',
   [{'bb': 1,
     'bs': False,
     'er': 5,
     'h': 7,
     'hld': True,
     'ip': '1.0',
     'k': 3,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 3, 'points': -900})],
 [('regression: innings notation',
   [{'bb': 2,
     'bs': False,
     'er': 2,
     'h': 6,
     'hld': True,
     'ip': '6.2',
     'k': 4,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 20, 'points': 2300}),
  ('partial repair probe: innings notation',
   [{'bb': 4,
     'bs': False,
     'er': 2,
     'h': 0,
     'hld': True,
     'ip': '5.2',
     'k': 6,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 17, 'points': 1800}),
  ('second regression',
   [{'bb': 1,
     'bs': True,
     'er': 3,
     'h': 9,
     'hld': False,
     'ip': '8.1',
     'k': 2,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 25, 'points': 1600}),
  ('normal control 1',
   [{'bb': 0,
     'bs': False,
     'er': 5,
     'h': 9,
     'hld': True,
     'ip': '1.0',
     'k': 11,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 3, 'points': -200}),
  ('normal control 2',
   [{'bb': 2,
     'bs': False,
     'er': 3,
     'h': 3,
     'hld': False,
     'ip': '5.0',
     'k': 10,
     'l': True,
     'sv': False,
     'w': False}],
   {'outs': 15, 'points': 1100}),
  ('normal control 3',
   [{'bb': 2,
     'bs': False,
     'er': 0,
     'h': 3,
     'hld': False,
     'ip': '7',
     'k': 7,
     'l': False,
     'sv': True,
     'w': True}],
   {'outs': 21, 'points': 3600}),
  ('normal control 4',
   [{'bb': 1,
     'bs': False,
     'er': 5,
     'h': 8,
     'hld': True,
     'ip': '6.0',
     'k': 8,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 18, 'points': 1000})],
 [('regression: innings notation',
   [{'bb': 2,
     'bs': False,
     'er': 2,
     'h': 8,
     'hld': False,
     'ip': '0.1',
     'k': 0,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 1, 'points': -800}),
  ('partial repair probe: innings notation',
   [{'bb': 0,
     'bs': True,
     'er': 3,
     'h': 9,
     'hld': False,
     'ip': '8.1',
     'k': 2,
     'l': True,
     'sv': True,
     'w': True}],
   {'outs': 25, 'points': 1900}),
  ('second regression',
   [{'bb': 4,
     'bs': False,
     'er': 5,
     'h': 6,
     'hld': True,
     'ip': '6.1',
     'k': 8,
     'l': True,
     'sv': True,
     'w': False}],
   {'outs': 19, 'points': 900}),
  ('normal control 1',
   [{'bb': 1,
     'bs': False,
     'er': 2,
     'h': 5,
     'hld': False,
     'ip': '1.0',
     'k': 3,
     'l': False,
     'sv': True,
     'w': False}],
   {'outs': 3, 'points': 100}),
  ('normal control 2',
   [{'bb': 2,
     'bs': False,
     'er': 3,
     'h': 7,
     'hld': True,
     'ip': '1.0',
     'k': 11,
     'l': False,
     'sv': True,
     'w': False}],
   {'outs': 3, 'points': 400}),
  ('normal control 3',
   [{'bb': 0,
     'bs': False,
     'er': 3,
     'h': 6,
     'hld': True,
     'ip': '1.0',
     'k': 11,
     'l': True,
     'sv': False,
     'w': False}],
   {'outs': 3, 'points': 200}),
  ('normal control 4',
   [{'bb': 3,
     'bs': False,
     'er': 4,
     'h': 5,
     'hld': True,
     'ip': '7',
     'k': 9,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 21, 'points': 1700})]]
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):
    whole, _, part = line['ip'].partition('.')
    outs = int(float(line['ip']) * 3)
    pts = outs * 100
    pts += line['k'] * 100 - line['h'] * 100 - line['bb'] * 100 - line['er'] * 200
    if line['w']:
        pts += 500
    if line['l']:
        pts -= 300
    if line['sv']:
        pts += 500
    elif line['hld']:
        pts += 300
    if line['bs']:
        pts -= 300
    if outs >= 18 and line['er'] <= 3:
        pts += 300
    return {'outs': outs, 'points': pts}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: innings notation',
   [{'bb': 0,
     'bs': True,
     'er': 5,
     'h': 4,
     'hld': False,
     'ip': '5.2',
     'k': 3,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 17, 'points': 300}),
  ('partial repair probe: innings notation',
   [{'bb': 4,
     'bs': False,
     'er': 2,
     'h': 7,
     'hld': False,
     'ip': '0.1',
     'k': 2,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 1, 'points': -1200}),
  ('second regression',
   [{'bb': 4,
     'bs': False,
     'er': 3,
     'h': 9,
     'hld': False,
     'ip': '6.2',
     'k': 6,
     'l': True,
     'sv': False,
     'w': False}],
   {'outs': 20, 'points': 700}),
  ('normal control 1',
   [{'bb': 0,
     'bs': False,
     'er': 2,
     'h': 6,
     'hld': False,
     'ip': '7',
     'k': 9,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 21, 'points': 2800}),
  ('normal control 2',
   [{'bb': 1,
     'bs': True,
     'er': 4,
     'h': 8,
     'hld': False,
     'ip': '1.0',
     'k': 9,
     'l': True,
     'sv': True,
     'w': False}],
   {'outs': 3, 'points': -600}),
  ('normal control 3',
   [{'bb': 4,
     'bs': False,
     'er': 4,
     'h': 5,
     'hld': True,
     'ip': '1.0',
     'k': 2,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 3, 'points': -900}),
  ('normal control 4',
   [{'bb': 2,
     'bs': False,
     'er': 2,
     'h': 5,
     'hld': False,
     'ip': '7',
     'k': 4,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 21, 'points': 2200})],
 [('regression: innings notation',
   [{'bb': 2,
     'bs': False,
     'er': 4,
     'h': 0,
     'hld': False,
     'ip': '0.1',
     'k': 9,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 1, 'points': 0}),
  ('partial repair probe: innings notation',
   [{'bb': 1,
     'bs': False,
     'er': 3,
     'h': 4,
     'hld': True,
     'ip': '5.2',
     'k': 4,
     'l': False,
     'sv': True,
     'w': False}],
   {'outs': 17, 'points': 1500}),
  ('second regression',
   [{'bb': 0,
     'bs': True,
     'er': 2,
     'h': 9,
     'hld': False,
     'ip': '2.2',
     'k': 6,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 8, 'points': -200}),
  ('normal control 1',
   [{'bb': 3,
     'bs': False,
     'er': 3,
     'h': 1,
     'hld': False,
     'ip': '7',
     'k': 0,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 21, 'points': 1400}),
  ('normal control 2',
   [{'bb': 4,
     'bs': False,
     'er': 5,
     'h': 1,
     'hld': False,
     'ip': '6.0',
     'k': 0,
     'l': False,
     'sv': True,
     'w': False}],
   {'outs': 18, 'points': 800}),
  ('normal control 3',
   [{'bb': 0,
     'bs': True,
     'er': 0,
     'h': 2,
     'hld': True,
     'ip': '7',
     'k': 11,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 21, 'points': 3800}),
  ('normal control 4',
   [{'bb': 3,
     'bs': False,
     'er': 0,
     'h': 6,
     'hld': True,
     'ip': '6.0',
     'k': 8,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 18, 'points': 2300})],
 [('regression: innings notation',
   [{'bb': 4,
     'bs': False,
     'er': 3,
     'h': 3,
     'hld': False,
     'ip': '2.2',
     'k': 9,
     'l': True,
     'sv': False,
     'w': True}],
   {'outs': 8, 'points': 600}),
  ('partial repair probe: innings notation',
   [{'bb': 3,
     'bs': False,
     'er': 3,
     'h': 5,
     'hld': False,
     'ip': '5.2',
     'k': 10,
     'l': False,
     'sv': True,
     'w': False}],
   {'outs': 17, 'points': 1800}),
  ('second regression',
   [{'bb': 2,
     'bs': False,
     'er': 4,
     'h': 5,
     'hld': True,
     'ip': '6.1',
     'k': 8,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 19, 'points': 1500}),
  ('normal control 1',
   [{'bb': 1,
     'bs': False,
     'er': 4,
     'h': 2,
     'hld': False,
     'ip': '1.0',
     'k': 0,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 3, 'points': -300}),
  ('normal control 2',
   [{'bb': 4,
     'bs': True,
     'er': 5,
     'h': 1,
     'hld': False,
     'ip': '6.0',
     'k': 0,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 18, 'points': 500}),
  ('normal control 3',
   [{'bb': 2,
     'bs': False,
     'er': 4,
     'h': 7,
     'hld': False,
     'ip': '6.0',
     'k': 5,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 18, 'points': 600}),
  ('normal control 4',
   [{'bb': 1,
     'bs': False,
     'er': 5,
     'h': 7,
     'hld': True,
     'ip': '1.0',
     'k': 3,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 3, 'points': -900})],
 [('regression: innings notation',
   [{'bb': 2,
     'bs': False,
     'er': 2,
     'h': 6,
     'hld': True,
     'ip': '6.2',
     'k': 4,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 20, 'points': 2300}),
  ('partial repair probe: innings notation',
   [{'bb': 4,
     'bs': False,
     'er': 2,
     'h': 0,
     'hld': True,
     'ip': '5.2',
     'k': 6,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 17, 'points': 1800}),
  ('second regression',
   [{'bb': 1,
     'bs': True,
     'er': 3,
     'h': 9,
     'hld': False,
     'ip': '8.1',
     'k': 2,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 25, 'points': 1600}),
  ('normal control 1',
   [{'bb': 0,
     'bs': False,
     'er': 5,
     'h': 9,
     'hld': True,
     'ip': '1.0',
     'k': 11,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 3, 'points': -200}),
  ('normal control 2',
   [{'bb': 2,
     'bs': False,
     'er': 3,
     'h': 3,
     'hld': False,
     'ip': '5.0',
     'k': 10,
     'l': True,
     'sv': False,
     'w': False}],
   {'outs': 15, 'points': 1100}),
  ('normal control 3',
   [{'bb': 2,
     'bs': False,
     'er': 0,
     'h': 3,
     'hld': False,
     'ip': '7',
     'k': 7,
     'l': False,
     'sv': True,
     'w': True}],
   {'outs': 21, 'points': 3600}),
  ('normal control 4',
   [{'bb': 1,
     'bs': False,
     'er': 5,
     'h': 8,
     'hld': True,
     'ip': '6.0',
     'k': 8,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 18, 'points': 1000})],
 [('regression: innings notation',
   [{'bb': 2,
     'bs': False,
     'er': 2,
     'h': 8,
     'hld': False,
     'ip': '0.1',
     'k': 0,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 1, 'points': -800}),
  ('partial repair probe: innings notation',
   [{'bb': 0,
     'bs': True,
     'er': 3,
     'h': 9,
     'hld': False,
     'ip': '8.1',
     'k': 2,
     'l': True,
     'sv': True,
     'w': True}],
   {'outs': 25, 'points': 1900}),
  ('second regression',
   [{'bb': 4,
     'bs': False,
     'er': 5,
     'h': 6,
     'hld': True,
     'ip': '6.1',
     'k': 8,
     'l': True,
     'sv': True,
     'w': False}],
   {'outs': 19, 'points': 900}),
  ('normal control 1',
   [{'bb': 1,
     'bs': False,
     'er': 2,
     'h': 5,
     'hld': False,
     'ip': '1.0',
     'k': 3,
     'l': False,
     'sv': True,
     'w': False}],
   {'outs': 3, 'points': 100}),
  ('normal control 2',
   [{'bb': 2,
     'bs': False,
     'er': 3,
     'h': 7,
     'hld': True,
     'ip': '1.0',
     'k': 11,
     'l': False,
     'sv': True,
     'w': False}],
   {'outs': 3, 'points': 400}),
  ('normal control 3',
   [{'bb': 0,
     'bs': False,
     'er': 3,
     'h': 6,
     'hld': True,
     'ip': '1.0',
     'k': 11,
     'l': True,
     'sv': False,
     'w': False}],
   {'outs': 3, 'points': 200}),
  ('normal control 4',
   [{'bb': 3,
     'bs': False,
     'er': 4,
     'h': 5,
     'hld': True,
     'ip': '7',
     'k': 9,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 21, 'points': 1700})]]
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 6.2 inning start is credited with 19 outs instead of 20.

Score a pitching line in hundredths. Innings pitched use baseball notation: "6.2" means six innings and two outs; each out is worth 1 point. Strikeout +1, hit -1, walk -1, earned run -2, win +5, loss -3, save +5, hold +3 (ignored when the line also has a save), blown save -3, quality start (at least 18 outs and at most 3 earned runs) +3. Return outs and points.

split: open-access


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

N = 1
observations = []
def solve(line):
    whole, _, part = line['ip'].partition('.')
    outs = int(whole) * 3 + int(part or 0)
    pts = outs * 100
    pts += line['k'] * 100 - line['h'] * 100 - line['bb'] * 100 - line['er'] * 200
    if line['w']:
        pts += 500
    if line['l']:
        pts -= 300
    if line['sv']:
        pts += 500
    elif line['hld']:
        pts += 300
    if line['bs']:
        pts -= 300
    if outs > 18 and line['er'] <= 3:
        pts += 300
    return {'outs': outs, 'points': pts}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: quality start boundary',
   [{'bb': 0,
     'bs': False,
     'er': 0,
     'h': 9,
     'hld': False,
     'ip': '6.0',
     'k': 10,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 18, 'points': 2200}),
  ('partial repair probe: quality start boundary',
   [{'bb': 2,
     'bs': False,
     'er': 3,
     'h': 6,
     'hld': False,
     'ip': '8.1',
     'k': 10,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 25, 'points': 2400}),
  ('second regression',
   [{'bb': 3,
     'bs': False,
     'er': 0,
     'h': 4,
     'hld': False,
     'ip': '6.0',
     'k': 8,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 18, 'points': 2200}),
  ('normal control 1',
   [{'bb': 2,
     'bs': True,
     'er': 0,
     'h': 2,
     'hld': False,
     'ip': '7',
     'k': 0,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 21, 'points': 1700}),
  ('normal control 2',
   [{'bb': 3,
     'bs': False,
     'er': 0,
     'h': 3,
     'hld': False,
     'ip': '6.2',
     'k': 5,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 20, 'points': 2700}),
  ('normal control 3',
   [{'bb': 3,
     'bs': False,
     'er': 3,
     'h': 8,
     'hld': True,
     'ip': '5.2',
     'k': 5,
     'l': True,
     'sv': False,
     'w': False}],
   {'outs': 17, 'points': 500}),
  ('normal control 4',
   [{'bb': 3,
     'bs': True,
     'er': 4,
     'h': 1,
     'hld': True,
     'ip': '2.2',
     'k': 7,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 8, 'points': 300})],
 [('regression: quality start boundary',
   [{'bb': 4,
     'bs': False,
     'er': 3,
     'h': 7,
     'hld': True,
     'ip': '6.0',
     'k': 1,
     'l': False,
     'sv': True,
     'w': True}],
   {'outs': 18, 'points': 1500}),
  ('partial repair probe: quality start boundary',
   [{'bb': 1,
     'bs': False,
     'er': 3,
     'h': 5,
     'hld': True,
     'ip': '8.1',
     'k': 8,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 25, 'points': 2700}),
  ('second regression',
   [{'bb': 0,
     'bs': False,
     'er': 3,
     'h': 8,
     'hld': True,
     'ip': '7',
     'k': 0,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 21, 'points': 1800}),
  ('normal control 1',
   [{'bb': 4,
     'bs': False,
     'er': 5,
     'h': 3,
     'hld': False,
     'ip': '6.2',
     'k': 6,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 20, 'points': 900}),
  ('normal control 2',
   [{'bb': 2,
     'bs': False,
     'er': 3,
     'h': 7,
     'hld': False,
     'ip': '2.2',
     'k': 3,
     'l': False,
     'sv': True,
     'w': False}],
   {'outs': 8, 'points': 100}),
  ('normal control 3',
   [{'bb': 2,
     'bs': False,
     'er': 0,
     'h': 4,
     'hld': False,
     'ip': '6.2',
     'k': 0,
     'l': True,
     'sv': False,
     'w': True}],
   {'outs': 20, 'points': 1900}),
  ('normal control 4',
   [{'bb': 4,
     'bs': False,
     'er': 5,
     'h': 0,
     'hld': False,
     'ip': '6.0',
     'k': 11,
     'l': False,
     'sv': True,
     'w': False}],
   {'outs': 18, 'points': 2000})],
 [('regression: quality start boundary',
   [{'bb': 1,
     'bs': False,
     'er': 3,
     'h': 4,
     'hld': False,
     'ip': '6.0',
     'k': 7,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 18, 'points': 2200}),
  ('partial repair probe: quality start boundary',
   [{'bb': 0,
     'bs': False,
     'er': 3,
     'h': 1,
     'hld': False,
     'ip': '6.0',
     'k': 4,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 18, 'points': 1800}),
  ('second regression',
   [{'bb': 3,
     'bs': True,
     'er': 3,
     'h': 8,
     'hld': True,
     'ip': '7',
     'k': 9,
     'l': False,
     'sv': True,
     'w': False}],
   {'outs': 21, 'points': 1800}),
  ('normal control 1',
   [{'bb': 3,
     'bs': False,
     'er': 5,
     'h': 3,
     'hld': True,
     'ip': '1.0',
     'k': 2,
     'l': True,
     'sv': False,
     'w': False}],
   {'outs': 3, 'points': -1100}),
  ('normal control 2',
   [{'bb': 0,
     'bs': False,
     'er': 0,
     'h': 5,
     'hld': False,
     'ip': '6.1',
     'k': 11,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 19, 'points': 2800}),
  ('normal control 3',
   [{'bb': 4,
     'bs': False,
     'er': 4,
     'h': 4,
     'hld': False,
     'ip': '6.2',
     'k': 9,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 20, 'points': 1800}),
  ('normal control 4',
   [{'bb': 4,
     'bs': False,
     'er': 5,
     'h': 4,
     'hld': True,
     'ip': '1.0',
     'k': 2,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 3, 'points': -1000})],
 [('regression: quality start boundary',
   [{'bb': 0,
     'bs': False,
     'er': 3,
     'h': 4,
     'hld': False,
     'ip': '6.0',
     'k': 8,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 18, 'points': 1900}),
  ('partial repair probe: quality start boundary',
   [{'bb': 1,
     'bs': False,
     'er': 3,
     'h': 5,
     'hld': True,
     'ip': '8.1',
     'k': 3,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 25, 'points': 2200}),
  ('second regression',
   [{'bb': 1,
     'bs': False,
     'er': 3,
     'h': 0,
     'hld': False,
     'ip': '7',
     'k': 9,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 21, 'points': 2600}),
  ('normal control 1',
   [{'bb': 2,
     'bs': False,
     'er': 0,
     'h': 4,
     'hld': False,
     'ip': '5.0',
     'k': 9,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 15, 'points': 1800}),
  ('normal control 2',
   [{'bb': 1,
     'bs': True,
     'er': 0,
     'h': 2,
     'hld': False,
     'ip': '7',
     'k': 1,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 21, 'points': 1900}),
  ('normal control 3',
   [{'bb': 1,
     'bs': False,
     'er': 4,
     'h': 0,
     'hld': True,
     'ip': '6.2',
     'k': 8,
     'l': False,
     'sv': True,
     'w': False}],
   {'outs': 20, 'points': 2400}),
  ('normal control 4',
   [{'bb': 0,
     'bs': True,
     'er': 0,
     'h': 4,
     'hld': False,
     'ip': '6.2',
     'k': 10,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 20, 'points': 3100})],
 [('regression: quality start boundary',
   [{'bb': 1,
     'bs': False,
     'er': 3,
     'h': 7,
     'hld': True,
     'ip': '6.0',
     'k': 0,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 18, 'points': 1500}),
  ('partial repair probe: quality start boundary',
   [{'bb': 3,
     'bs': False,
     'er': 3,
     'h': 7,
     'hld': False,
     'ip': '6.1',
     'k': 5,
     'l': False,
     'sv': True,
     'w': True}],
   {'outs': 19, 'points': 2100}),
  ('second regression',
   [{'bb': 3,
     'bs': True,
     'er': 3,
     'h': 7,
     'hld': True,
     'ip': '7',
     'k': 0,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 21, 'points': 1300}),
  ('normal control 1',
   [{'bb': 3,
     'bs': False,
     'er': 0,
     'h': 2,
     'hld': False,
     'ip': '1.0',
     'k': 11,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 3, 'points': 900}),
  ('normal control 2',
   [{'bb': 4,
     'bs': False,
     'er': 0,
     'h': 3,
     'hld': False,
     'ip': '1.0',
     'k': 11,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 3, 'points': 1200}),
  ('normal control 3',
   [{'bb': 2,
     'bs': False,
     'er': 0,
     'h': 6,
     'hld': True,
     'ip': '6.1',
     'k': 0,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 19, 'points': 2200}),
  ('normal control 4',
   [{'bb': 2,
     'bs': False,
     'er': 3,
     'h': 2,
     'hld': False,
     'ip': '5.2',
     'k': 2,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 17, 'points': 1400})]]
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):
    whole, _, part = line['ip'].partition('.')
    outs = int(whole) * 3 + int(part or 0)
    pts = outs * 100
    pts += line['k'] * 100 - line['h'] * 100 - line['bb'] * 100 - line['er'] * 200
    if line['w']:
        pts += 500
    if line['l']:
        pts -= 300
    if line['sv']:
        pts += 500
    elif line['hld']:
        pts += 300
    if line['bs']:
        pts -= 300
    if outs >= 18 and line['er'] < 3:
        pts += 300
    return {'outs': outs, 'points': pts}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: quality start boundary',
   [{'bb': 0,
     'bs': False,
     'er': 0,
     'h': 9,
     'hld': False,
     'ip': '6.0',
     'k': 10,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 18, 'points': 2200}),
  ('partial repair probe: quality start boundary',
   [{'bb': 2,
     'bs': False,
     'er': 3,
     'h': 6,
     'hld': False,
     'ip': '8.1',
     'k': 10,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 25, 'points': 2400}),
  ('second regression',
   [{'bb': 3,
     'bs': False,
     'er': 0,
     'h': 4,
     'hld': False,
     'ip': '6.0',
     'k': 8,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 18, 'points': 2200}),
  ('normal control 1',
   [{'bb': 2,
     'bs': True,
     'er': 0,
     'h': 2,
     'hld': False,
     'ip': '7',
     'k': 0,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 21, 'points': 1700}),
  ('normal control 2',
   [{'bb': 3,
     'bs': False,
     'er': 0,
     'h': 3,
     'hld': False,
     'ip': '6.2',
     'k': 5,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 20, 'points': 2700}),
  ('normal control 3',
   [{'bb': 3,
     'bs': False,
     'er': 3,
     'h': 8,
     'hld': True,
     'ip': '5.2',
     'k': 5,
     'l': True,
     'sv': False,
     'w': False}],
   {'outs': 17, 'points': 500}),
  ('normal control 4',
   [{'bb': 3,
     'bs': True,
     'er': 4,
     'h': 1,
     'hld': True,
     'ip': '2.2',
     'k': 7,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 8, 'points': 300})],
 [('regression: quality start boundary',
   [{'bb': 4,
     'bs': False,
     'er': 3,
     'h': 7,
     'hld': True,
     'ip': '6.0',
     'k': 1,
     'l': False,
     'sv': True,
     'w': True}],
   {'outs': 18, 'points': 1500}),
  ('partial repair probe: quality start boundary',
   [{'bb': 1,
     'bs': False,
     'er': 3,
     'h': 5,
     'hld': True,
     'ip': '8.1',
     'k': 8,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 25, 'points': 2700}),
  ('second regression',
   [{'bb': 0,
     'bs': False,
     'er': 3,
     'h': 8,
     'hld': True,
     'ip': '7',
     'k': 0,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 21, 'points': 1800}),
  ('normal control 1',
   [{'bb': 4,
     'bs': False,
     'er': 5,
     'h': 3,
     'hld': False,
     'ip': '6.2',
     'k': 6,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 20, 'points': 900}),
  ('normal control 2',
   [{'bb': 2,
     'bs': False,
     'er': 3,
     'h': 7,
     'hld': False,
     'ip': '2.2',
     'k': 3,
     'l': False,
     'sv': True,
     'w': False}],
   {'outs': 8, 'points': 100}),
  ('normal control 3',
   [{'bb': 2,
     'bs': False,
     'er': 0,
     'h': 4,
     'hld': False,
     'ip': '6.2',
     'k': 0,
     'l': True,
     'sv': False,
     'w': True}],
   {'outs': 20, 'points': 1900}),
  ('normal control 4',
   [{'bb': 4,
     'bs': False,
     'er': 5,
     'h': 0,
     'hld': False,
     'ip': '6.0',
     'k': 11,
     'l': False,
     'sv': True,
     'w': False}],
   {'outs': 18, 'points': 2000})],
 [('regression: quality start boundary',
   [{'bb': 1,
     'bs': False,
     'er': 3,
     'h': 4,
     'hld': False,
     'ip': '6.0',
     'k': 7,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 18, 'points': 2200}),
  ('partial repair probe: quality start boundary',
   [{'bb': 0,
     'bs': False,
     'er': 3,
     'h': 1,
     'hld': False,
     'ip': '6.0',
     'k': 4,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 18, 'points': 1800}),
  ('second regression',
   [{'bb': 3,
     'bs': True,
     'er': 3,
     'h': 8,
     'hld': True,
     'ip': '7',
     'k': 9,
     'l': False,
     'sv': True,
     'w': False}],
   {'outs': 21, 'points': 1800}),
  ('normal control 1',
   [{'bb': 3,
     'bs': False,
     'er': 5,
     'h': 3,
     'hld': True,
     'ip': '1.0',
     'k': 2,
     'l': True,
     'sv': False,
     'w': False}],
   {'outs': 3, 'points': -1100}),
  ('normal control 2',
   [{'bb': 0,
     'bs': False,
     'er': 0,
     'h': 5,
     'hld': False,
     'ip': '6.1',
     'k': 11,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 19, 'points': 2800}),
  ('normal control 3',
   [{'bb': 4,
     'bs': False,
     'er': 4,
     'h': 4,
     'hld': False,
     'ip': '6.2',
     'k': 9,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 20, 'points': 1800}),
  ('normal control 4',
   [{'bb': 4,
     'bs': False,
     'er': 5,
     'h': 4,
     'hld': True,
     'ip': '1.0',
     'k': 2,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 3, 'points': -1000})],
 [('regression: quality start boundary',
   [{'bb': 0,
     'bs': False,
     'er': 3,
     'h': 4,
     'hld': False,
     'ip': '6.0',
     'k': 8,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 18, 'points': 1900}),
  ('partial repair probe: quality start boundary',
   [{'bb': 1,
     'bs': False,
     'er': 3,
     'h': 5,
     'hld': True,
     'ip': '8.1',
     'k': 3,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 25, 'points': 2200}),
  ('second regression',
   [{'bb': 1,
     'bs': False,
     'er': 3,
     'h': 0,
     'hld': False,
     'ip': '7',
     'k': 9,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 21, 'points': 2600}),
  ('normal control 1',
   [{'bb': 2,
     'bs': False,
     'er': 0,
     'h': 4,
     'hld': False,
     'ip': '5.0',
     'k': 9,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 15, 'points': 1800}),
  ('normal control 2',
   [{'bb': 1,
     'bs': True,
     'er': 0,
     'h': 2,
     'hld': False,
     'ip': '7',
     'k': 1,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 21, 'points': 1900}),
  ('normal control 3',
   [{'bb': 1,
     'bs': False,
     'er': 4,
     'h': 0,
     'hld': True,
     'ip': '6.2',
     'k': 8,
     'l': False,
     'sv': True,
     'w': False}],
   {'outs': 20, 'points': 2400}),
  ('normal control 4',
   [{'bb': 0,
     'bs': True,
     'er': 0,
     'h': 4,
     'hld': False,
     'ip': '6.2',
     'k': 10,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 20, 'points': 3100})],
 [('regression: quality start boundary',
   [{'bb': 1,
     'bs': False,
     'er': 3,
     'h': 7,
     'hld': True,
     'ip': '6.0',
     'k': 0,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 18, 'points': 1500}),
  ('partial repair probe: quality start boundary',
   [{'bb': 3,
     'bs': False,
     'er': 3,
     'h': 7,
     'hld': False,
     'ip': '6.1',
     'k': 5,
     'l': False,
     'sv': True,
     'w': True}],
   {'outs': 19, 'points': 2100}),
  ('second regression',
   [{'bb': 3,
     'bs': True,
     'er': 3,
     'h': 7,
     'hld': True,
     'ip': '7',
     'k': 0,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 21, 'points': 1300}),
  ('normal control 1',
   [{'bb': 3,
     'bs': False,
     'er': 0,
     'h': 2,
     'hld': False,
     'ip': '1.0',
     'k': 11,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 3, 'points': 900}),
  ('normal control 2',
   [{'bb': 4,
     'bs': False,
     'er': 0,
     'h': 3,
     'hld': False,
     'ip': '1.0',
     'k': 11,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 3, 'points': 1200}),
  ('normal control 3',
   [{'bb': 2,
     'bs': False,
     'er': 0,
     'h': 6,
     'hld': True,
     'ip': '6.1',
     'k': 0,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 19, 'points': 2200}),
  ('normal control 4',
   [{'bb': 2,
     'bs': False,
     'er': 3,
     'h': 2,
     'hld': False,
     'ip': '5.2',
     'k': 2,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 17, 'points': 1400})]]
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 6.0 inning, 3 earned run start earns no quality-start bonus.

Score a pitching line in hundredths. Innings pitched use baseball notation: "6.2" means six innings and two outs; each out is worth 1 point. Strikeout +1, hit -1, walk -1, earned run -2, win +5, loss -3, save +5, hold +3 (ignored when the line also has a save), blown save -3, quality start (at least 18 outs and at most 3 earned runs) +3. Return outs and points.

split: open-access


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

N = 1
observations = []
def solve(line):
    whole, _, part = line['ip'].partition('.')
    outs = int(whole) * 3 + int(part or 0)
    pts = outs * 100
    pts += line['k'] * 100 - line['h'] * 100 - line['bb'] * 100 - line['er'] * 200
    if line['w']:
        pts += 500
    if line['l']:
        pts -= 300
    if line['sv']:
        pts += 500
    if line['hld']:
        pts += 300
    if line['bs']:
        pts -= 300
    if outs >= 18 and line['er'] <= 3:
        pts += 300
    return {'outs': outs, 'points': pts}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: save and hold exclusivity',
   [{'bb': 0,
     'bs': False,
     'er': 5,
     'h': 2,
     'hld': True,
     'ip': '8.1',
     'k': 1,
     'l': True,
     'sv': True,
     'w': False}],
   {'outs': 25, 'points': 1600}),
  ('partial repair probe: save and hold exclusivity',
   [{'bb': 3,
     'bs': True,
     'er': 5,
     'h': 6,
     'hld': True,
     'ip': '1.0',
     'k': 10,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 3, 'points': -100}),
  ('second regression',
   [{'bb': 3,
     'bs': False,
     'er': 4,
     'h': 4,
     'hld': True,
     'ip': '7.2',
     'k': 0,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 23, 'points': 1600}),
  ('normal control 1',
   [{'bb': 0,
     'bs': False,
     'er': 3,
     'h': 2,
     'hld': True,
     'ip': '6.1',
     'k': 0,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 19, 'points': 1700}),
  ('normal control 2',
   [{'bb': 0,
     'bs': False,
     'er': 0,
     'h': 4,
     'hld': False,
     'ip': '6.1',
     'k': 9,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 19, 'points': 3200}),
  ('normal control 3',
   [{'bb': 3,
     'bs': False,
     'er': 5,
     'h': 7,
     'hld': False,
     'ip': '5.1',
     'k': 7,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 16, 'points': 300}),
  ('normal control 4',
   [{'bb': 3,
     'bs': False,
     'er': 5,
     'h': 2,
     'hld': False,
     'ip': '2.2',
     'k': 7,
     'l': True,
     'sv': False,
     'w': False}],
   {'outs': 8, 'points': -300})],
 [('regression: save and hold exclusivity',
   [{'bb': 2,
     'bs': False,
     'er': 4,
     'h': 8,
     'hld': True,
     'ip': '6.0',
     'k': 11,
     'l': False,
     'sv': True,
     'w': False}],
   {'outs': 18, 'points': 1600}),
  ('partial repair probe: save and hold exclusivity',
   [{'bb': 2,
     'bs': False,
     'er': 4,
     'h': 8,
     'hld': True,
     'ip': '0.1',
     'k': 1,
     'l': False,
     'sv': True,
     'w': False}],
   {'outs': 1, 'points': -1100}),
  ('second regression',
   [{'bb': 2,
     'bs': False,
     'er': 5,
     'h': 5,
     'hld': True,
     'ip': '1.0',
     'k': 4,
     'l': False,
     'sv': True,
     'w': True}],
   {'outs': 3, 'points': 0}),
  ('normal control 1',
   [{'bb': 2,
     'bs': False,
     'er': 5,
     'h': 5,
     'hld': False,
     'ip': '6.0',
     'k': 4,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 18, 'points': 500}),
  ('normal control 2',
   [{'bb': 1,
     'bs': False,
     'er': 4,
     'h': 9,
     'hld': False,
     'ip': '7',
     'k': 7,
     'l': True,
     'sv': False,
     'w': True}],
   {'outs': 21, 'points': 1200}),
  ('normal control 3',
   [{'bb': 3,
     'bs': False,
     'er': 0,
     'h': 6,
     'hld': False,
     'ip': '8.1',
     'k': 1,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 25, 'points': 2500}),
  ('normal control 4',
   [{'bb': 3,
     'bs': False,
     'er': 5,
     'h': 3,
     'hld': False,
     'ip': '8.1',
     'k': 8,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 25, 'points': 1700})],
 [('regression: save and hold exclusivity',
   [{'bb': 2,
     'bs': False,
     'er': 5,
     'h': 9,
     'hld': True,
     'ip': '5.2',
     'k': 2,
     'l': False,
     'sv': True,
     'w': False}],
   {'outs': 17, 'points': 300}),
  ('partial repair probe: save and hold exclusivity',
   [{'bb': 4,
     'bs': False,
     'er': 5,
     'h': 3,
     'hld': True,
     'ip': '5.2',
     'k': 5,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 17, 'points': 1300}),
  ('second regression',
   [{'bb': 3,
     'bs': False,
     'er': 4,
     'h': 3,
     'hld': True,
     'ip': '1.0',
     'k': 7,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 3, 'points': 400}),
  ('normal control 1',
   [{'bb': 0,
     'bs': False,
     'er': 3,
     'h': 6,
     'hld': False,
     'ip': '6.1',
     'k': 10,
     'l': False,
     'sv': True,
     'w': False}],
   {'outs': 19, 'points': 2500}),
  ('normal control 2',
   [{'bb': 0,
     'bs': False,
     'er': 4,
     'h': 5,
     'hld': False,
     'ip': '2.2',
     'k': 6,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 8, 'points': 100}),
  ('normal control 3',
   [{'bb': 0,
     'bs': False,
     'er': 5,
     'h': 5,
     'hld': False,
     'ip': '6.1',
     'k': 7,
     'l': True,
     'sv': False,
     'w': False}],
   {'outs': 19, 'points': 800}),
  ('normal control 4',
   [{'bb': 4,
     'bs': False,
     'er': 3,
     'h': 3,
     'hld': False,
     'ip': '0.1',
     'k': 4,
     'l': False,
     'sv': True,
     'w': True}],
   {'outs': 1, 'points': 200})],
 [('regression: save and hold exclusivity',
   [{'bb': 3,
     'bs': False,
     'er': 5,
     'h': 2,
     'hld': True,
     'ip': '7',
     'k': 10,
     'l': False,
     'sv': True,
     'w': False}],
   {'outs': 21, 'points': 2100}),
  ('partial repair probe: save and hold exclusivity',
   [{'bb': 2,
     'bs': False,
     'er': 3,
     'h': 4,
     'hld': True,
     'ip': '2.2',
     'k': 1,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 8, 'points': 500}),
  ('second regression',
   [{'bb': 4,
     'bs': False,
     'er': 0,
     'h': 1,
     'hld': True,
     'ip': '8.1',
     'k': 0,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 25, 'points': 3100}),
  ('normal control 1',
   [{'bb': 0,
     'bs': False,
     'er': 5,
     'h': 5,
     'hld': False,
     'ip': '6.0',
     'k': 2,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 18, 'points': 500}),
  ('normal control 2',
   [{'bb': 1,
     'bs': False,
     'er': 2,
     'h': 0,
     'hld': False,
     'ip': '6.2',
     'k': 3,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 20, 'points': 2100}),
  ('normal control 3',
   [{'bb': 3,
     'bs': True,
     'er': 3,
     'h': 1,
     'hld': False,
     'ip': '6.2',
     'k': 7,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 20, 'points': 2200}),
  ('normal control 4',
   [{'bb': 3,
     'bs': False,
     'er': 5,
     'h': 7,
     'hld': False,
     'ip': '6.0',
     'k': 8,
     'l': True,
     'sv': False,
     'w': False}],
   {'outs': 18, 'points': 300})],
 [('regression: save and hold exclusivity',
   [{'bb': 4,
     'bs': False,
     'er': 5,
     'h': 4,
     'hld': True,
     'ip': '5.2',
     'k': 2,
     'l': False,
     'sv': True,
     'w': False}],
   {'outs': 17, 'points': 600}),
  ('partial repair probe: save and hold exclusivity',
   [{'bb': 2,
     'bs': False,
     'er': 3,
     'h': 6,
     'hld': True,
     'ip': '5.2',
     'k': 0,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 17, 'points': 1100}),
  ('second regression',
   [{'bb': 2,
     'bs': False,
     'er': 2,
     'h': 4,
     'hld': True,
     'ip': '2.2',
     'k': 2,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 8, 'points': 800}),
  ('normal control 1',
   [{'bb': 2,
     'bs': False,
     'er': 2,
     'h': 4,
     'hld': False,
     'ip': '3.2',
     'k': 8,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 11, 'points': 1400}),
  ('normal control 2',
   [{'bb': 1,
     'bs': False,
     'er': 0,
     'h': 1,
     'hld': False,
     'ip': '7',
     'k': 4,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 21, 'points': 2600}),
  ('normal control 3',
   [{'bb': 1,
     'bs': True,
     'er': 0,
     'h': 4,
     'hld': False,
     'ip': '1.0',
     'k': 0,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 3, 'points': 0}),
  ('normal control 4',
   [{'bb': 1,
     'bs': False,
     'er': 4,
     'h': 3,
     'hld': False,
     'ip': '9.0',
     'k': 4,
     'l': True,
     'sv': False,
     'w': False}],
   {'outs': 27, 'points': 1600})]]
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):
    whole, _, part = line['ip'].partition('.')
    outs = int(whole) * 3 + int(part or 0)
    pts = outs * 100
    pts += line['k'] * 100 - line['h'] * 100 - line['bb'] * 100 - line['er'] * 200
    if line['w']:
        pts += 500
    if line['l']:
        pts -= 300
    if line['sv']:
        pts += 500
    if line['hld'] and not line['w']:
        pts += 300
    if line['bs']:
        pts -= 300
    if outs >= 18 and line['er'] <= 3:
        pts += 300
    return {'outs': outs, 'points': pts}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: save and hold exclusivity',
   [{'bb': 0,
     'bs': False,
     'er': 5,
     'h': 2,
     'hld': True,
     'ip': '8.1',
     'k': 1,
     'l': True,
     'sv': True,
     'w': False}],
   {'outs': 25, 'points': 1600}),
  ('partial repair probe: save and hold exclusivity',
   [{'bb': 3,
     'bs': True,
     'er': 5,
     'h': 6,
     'hld': True,
     'ip': '1.0',
     'k': 10,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 3, 'points': -100}),
  ('second regression',
   [{'bb': 3,
     'bs': False,
     'er': 4,
     'h': 4,
     'hld': True,
     'ip': '7.2',
     'k': 0,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 23, 'points': 1600}),
  ('normal control 1',
   [{'bb': 0,
     'bs': False,
     'er': 3,
     'h': 2,
     'hld': True,
     'ip': '6.1',
     'k': 0,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 19, 'points': 1700}),
  ('normal control 2',
   [{'bb': 0,
     'bs': False,
     'er': 0,
     'h': 4,
     'hld': False,
     'ip': '6.1',
     'k': 9,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 19, 'points': 3200}),
  ('normal control 3',
   [{'bb': 3,
     'bs': False,
     'er': 5,
     'h': 7,
     'hld': False,
     'ip': '5.1',
     'k': 7,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 16, 'points': 300}),
  ('normal control 4',
   [{'bb': 3,
     'bs': False,
     'er': 5,
     'h': 2,
     'hld': False,
     'ip': '2.2',
     'k': 7,
     'l': True,
     'sv': False,
     'w': False}],
   {'outs': 8, 'points': -300})],
 [('regression: save and hold exclusivity',
   [{'bb': 2,
     'bs': False,
     'er': 4,
     'h': 8,
     'hld': True,
     'ip': '6.0',
     'k': 11,
     'l': False,
     'sv': True,
     'w': False}],
   {'outs': 18, 'points': 1600}),
  ('partial repair probe: save and hold exclusivity',
   [{'bb': 2,
     'bs': False,
     'er': 4,
     'h': 8,
     'hld': True,
     'ip': '0.1',
     'k': 1,
     'l': False,
     'sv': True,
     'w': False}],
   {'outs': 1, 'points': -1100}),
  ('second regression',
   [{'bb': 2,
     'bs': False,
     'er': 5,
     'h': 5,
     'hld': True,
     'ip': '1.0',
     'k': 4,
     'l': False,
     'sv': True,
     'w': True}],
   {'outs': 3, 'points': 0}),
  ('normal control 1',
   [{'bb': 2,
     'bs': False,
     'er': 5,
     'h': 5,
     'hld': False,
     'ip': '6.0',
     'k': 4,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 18, 'points': 500}),
  ('normal control 2',
   [{'bb': 1,
     'bs': False,
     'er': 4,
     'h': 9,
     'hld': False,
     'ip': '7',
     'k': 7,
     'l': True,
     'sv': False,
     'w': True}],
   {'outs': 21, 'points': 1200}),
  ('normal control 3',
   [{'bb': 3,
     'bs': False,
     'er': 0,
     'h': 6,
     'hld': False,
     'ip': '8.1',
     'k': 1,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 25, 'points': 2500}),
  ('normal control 4',
   [{'bb': 3,
     'bs': False,
     'er': 5,
     'h': 3,
     'hld': False,
     'ip': '8.1',
     'k': 8,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 25, 'points': 1700})],
 [('regression: save and hold exclusivity',
   [{'bb': 2,
     'bs': False,
     'er': 5,
     'h': 9,
     'hld': True,
     'ip': '5.2',
     'k': 2,
     'l': False,
     'sv': True,
     'w': False}],
   {'outs': 17, 'points': 300}),
  ('partial repair probe: save and hold exclusivity',
   [{'bb': 4,
     'bs': False,
     'er': 5,
     'h': 3,
     'hld': True,
     'ip': '5.2',
     'k': 5,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 17, 'points': 1300}),
  ('second regression',
   [{'bb': 3,
     'bs': False,
     'er': 4,
     'h': 3,
     'hld': True,
     'ip': '1.0',
     'k': 7,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 3, 'points': 400}),
  ('normal control 1',
   [{'bb': 0,
     'bs': False,
     'er': 3,
     'h': 6,
     'hld': False,
     'ip': '6.1',
     'k': 10,
     'l': False,
     'sv': True,
     'w': False}],
   {'outs': 19, 'points': 2500}),
  ('normal control 2',
   [{'bb': 0,
     'bs': False,
     'er': 4,
     'h': 5,
     'hld': False,
     'ip': '2.2',
     'k': 6,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 8, 'points': 100}),
  ('normal control 3',
   [{'bb': 0,
     'bs': False,
     'er': 5,
     'h': 5,
     'hld': False,
     'ip': '6.1',
     'k': 7,
     'l': True,
     'sv': False,
     'w': False}],
   {'outs': 19, 'points': 800}),
  ('normal control 4',
   [{'bb': 4,
     'bs': False,
     'er': 3,
     'h': 3,
     'hld': False,
     'ip': '0.1',
     'k': 4,
     'l': False,
     'sv': True,
     'w': True}],
   {'outs': 1, 'points': 200})],
 [('regression: save and hold exclusivity',
   [{'bb': 3,
     'bs': False,
     'er': 5,
     'h': 2,
     'hld': True,
     'ip': '7',
     'k': 10,
     'l': False,
     'sv': True,
     'w': False}],
   {'outs': 21, 'points': 2100}),
  ('partial repair probe: save and hold exclusivity',
   [{'bb': 2,
     'bs': False,
     'er': 3,
     'h': 4,
     'hld': True,
     'ip': '2.2',
     'k': 1,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 8, 'points': 500}),
  ('second regression',
   [{'bb': 4,
     'bs': False,
     'er': 0,
     'h': 1,
     'hld': True,
     'ip': '8.1',
     'k': 0,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 25, 'points': 3100}),
  ('normal control 1',
   [{'bb': 0,
     'bs': False,
     'er': 5,
     'h': 5,
     'hld': False,
     'ip': '6.0',
     'k': 2,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 18, 'points': 500}),
  ('normal control 2',
   [{'bb': 1,
     'bs': False,
     'er': 2,
     'h': 0,
     'hld': False,
     'ip': '6.2',
     'k': 3,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 20, 'points': 2100}),
  ('normal control 3',
   [{'bb': 3,
     'bs': True,
     'er': 3,
     'h': 1,
     'hld': False,
     'ip': '6.2',
     'k': 7,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 20, 'points': 2200}),
  ('normal control 4',
   [{'bb': 3,
     'bs': False,
     'er': 5,
     'h': 7,
     'hld': False,
     'ip': '6.0',
     'k': 8,
     'l': True,
     'sv': False,
     'w': False}],
   {'outs': 18, 'points': 300})],
 [('regression: save and hold exclusivity',
   [{'bb': 4,
     'bs': False,
     'er': 5,
     'h': 4,
     'hld': True,
     'ip': '5.2',
     'k': 2,
     'l': False,
     'sv': True,
     'w': False}],
   {'outs': 17, 'points': 600}),
  ('partial repair probe: save and hold exclusivity',
   [{'bb': 2,
     'bs': False,
     'er': 3,
     'h': 6,
     'hld': True,
     'ip': '5.2',
     'k': 0,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 17, 'points': 1100}),
  ('second regression',
   [{'bb': 2,
     'bs': False,
     'er': 2,
     'h': 4,
     'hld': True,
     'ip': '2.2',
     'k': 2,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 8, 'points': 800}),
  ('normal control 1',
   [{'bb': 2,
     'bs': False,
     'er': 2,
     'h': 4,
     'hld': False,
     'ip': '3.2',
     'k': 8,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 11, 'points': 1400}),
  ('normal control 2',
   [{'bb': 1,
     'bs': False,
     'er': 0,
     'h': 1,
     'hld': False,
     'ip': '7',
     'k': 4,
     'l': False,
     'sv': False,
     'w': False}],
   {'outs': 21, 'points': 2600}),
  ('normal control 3',
   [{'bb': 1,
     'bs': True,
     'er': 0,
     'h': 4,
     'hld': False,
     'ip': '1.0',
     'k': 0,
     'l': False,
     'sv': False,
     'w': True}],
   {'outs': 3, 'points': 0}),
  ('normal control 4',
   [{'bb': 1,
     'bs': False,
     'er': 4,
     'h': 3,
     'hld': False,
     'ip': '9.0',
     'k': 4,
     'l': True,
     'sv': False,
     'w': False}],
   {'outs': 27, 'points': 1600})]]
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 reliever credited with both a hold flag and a save earns 8 points.

Score a pitching line in hundredths. Innings pitched use baseball notation: "6.2" means six innings and two outs; each out is worth 1 point. Strikeout +1, hit -1, walk -1, earned run -2, win +5, loss -3, save +5, hold +3 (ignored when the line also has a save), blown save -3, quality start (at least 18 outs and at most 3 earned runs) +3. Return outs and points.

split: open-access