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

N = 1
observations = []
def solve(g):
    ga = g['team_ga'] - g['empty_net_ga']
    saves = g['shots_faced'] - g['team_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: save derivation',
   [{'decision': 'W', 'empty_net_ga': 2, 'shots_faced': 26, 'team_ga': 4, 'toi_sec': 1645}],
   {'points': 48, 'saves': 24}),
  ('partial repair probe: save derivation',
   [{'decision': 'L', 'empty_net_ga': 2, 'shots_faced': 30, 'team_ga': 2, 'toi_sec': 3600}],
   {'points': 90, 'saves': 30}),
  ('second regression',
   [{'decision': 'OTL', 'empty_net_ga': 2, 'shots_faced': 12, 'team_ga': 5, 'toi_sec': 3900}],
   {'points': -32, 'saves': 9}),
  ('normal control 1',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 30, 'team_ga': 5, 'toi_sec': 3599}],
   {'points': -40, 'saves': 25}),
  ('normal control 2',
   [{'decision': None, 'empty_net_ga': 0, 'shots_faced': 7, 'team_ga': 3, 'toi_sec': 3600}],
   {'points': -52, 'saves': 4}),
  ('normal control 3',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 20, 'team_ga': 5, 'toi_sec': 3600}],
   {'points': -60, 'saves': 15}),
  ('normal control 4',
   [{'decision': 'L', 'empty_net_ga': 0, 'shots_faced': 14, 'team_ga': 0, 'toi_sec': 3540}],
   {'points': 28, 'saves': 14})],
 [('regression: save derivation',
   [{'decision': 'L', 'empty_net_ga': 1, 'shots_faced': 33, 'team_ga': 2, 'toi_sec': 2400}],
   {'points': 44, 'saves': 32}),
  ('partial repair probe: save derivation',
   [{'decision': 'OTL', 'empty_net_ga': 2, 'shots_faced': 9, 'team_ga': 7, 'toi_sec': 3599}],
   {'points': -82, 'saves': 4}),
  ('second regression',
   [{'decision': None, 'empty_net_ga': 2, 'shots_faced': 31, 'team_ga': 4, 'toi_sec': 3900}],
   {'points': 18, 'saves': 29}),
  ('normal control 1',
   [{'decision': 'L', 'empty_net_ga': 0, 'shots_faced': 30, 'team_ga': 5, 'toi_sec': 3599}],
   {'points': -50, 'saves': 25}),
  ('normal control 2',
   [{'decision': 'W', 'empty_net_ga': 0, 'shots_faced': 25, 'team_ga': 1, 'toi_sec': 3900}],
   {'points': 68, 'saves': 24}),
  ('normal control 3',
   [{'decision': 'W', 'empty_net_ga': 0, 'shots_faced': 25, 'team_ga': 3, 'toi_sec': 3599}],
   {'points': 24, 'saves': 22}),
  ('normal control 4',
   [{'decision': 'L', 'empty_net_ga': 0, 'shots_faced': 16, 'team_ga': 5, 'toi_sec': 3599}],
   {'points': -78, 'saves': 11})],
 [('regression: save derivation',
   [{'decision': 'L', 'empty_net_ga': 2, 'shots_faced': 39, 'team_ga': 3, 'toi_sec': 3600}],
   {'points': 56, 'saves': 38}),
  ('partial repair probe: save derivation',
   [{'decision': 'L', 'empty_net_ga': 1, 'shots_faced': 14, 'team_ga': 6, 'toi_sec': 2400}],
   {'points': -82, 'saves': 9}),
  ('second regression',
   [{'decision': None, 'empty_net_ga': 2, 'shots_faced': 21, 'team_ga': 7, 'toi_sec': 2154}],
   {'points': -68, 'saves': 16}),
  ('normal control 1',
   [{'decision': None, 'empty_net_ga': 0, 'shots_faced': 32, 'team_ga': 0, 'toi_sec': 2400}],
   {'points': 64, 'saves': 32}),
  ('normal control 2',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 22, 'team_ga': 1, 'toi_sec': 3900}],
   {'points': 32, 'saves': 21}),
  ('normal control 3',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 29, 'team_ga': 5, 'toi_sec': 3540}],
   {'points': -42, 'saves': 24}),
  ('normal control 4',
   [{'decision': None, 'empty_net_ga': 0, 'shots_faced': 35, 'team_ga': 2, 'toi_sec': 866}],
   {'points': 26, 'saves': 33})],
 [('regression: save derivation',
   [{'decision': None, 'empty_net_ga': 1, 'shots_faced': 26, 'team_ga': 1, 'toi_sec': 3600}],
   {'points': 82, 'saves': 26}),
  ('partial repair probe: save derivation',
   [{'decision': None, 'empty_net_ga': 1, 'shots_faced': 14, 'team_ga': 1, 'toi_sec': 3599}],
   {'points': 28, 'saves': 14}),
  ('second regression',
   [{'decision': 'L', 'empty_net_ga': 1, 'shots_faced': 5, 'team_ga': 1, 'toi_sec': 3600}],
   {'points': 40, 'saves': 5}),
  ('normal control 1',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 28, 'team_ga': 0, 'toi_sec': 3900}],
   {'points': 96, 'saves': 28}),
  ('normal control 2',
   [{'decision': 'W', 'empty_net_ga': 0, 'shots_faced': 30, 'team_ga': 2, 'toi_sec': 3900}],
   {'points': 56, 'saves': 28}),
  ('normal control 3',
   [{'decision': None, 'empty_net_ga': 0, 'shots_faced': 24, 'team_ga': 1, 'toi_sec': 2400}],
   {'points': 26, 'saves': 23}),
  ('normal control 4',
   [{'decision': 'L', 'empty_net_ga': 0, 'shots_faced': 35, 'team_ga': 2, 'toi_sec': 3900}],
   {'points': 26, 'saves': 33})],
 [('regression: save derivation',
   [{'decision': 'OTL', 'empty_net_ga': 2, 'shots_faced': 20, 'team_ga': 2, 'toi_sec': 3600}],
   {'points': 80, 'saves': 20}),
  ('partial repair probe: save derivation',
   [{'decision': 'OTL', 'empty_net_ga': 1, 'shots_faced': 7, 'team_ga': 4, 'toi_sec': 3731}],
   {'points': -42, 'saves': 4}),
  ('second regression',
   [{'decision': 'L', 'empty_net_ga': 1, 'shots_faced': 24, 'team_ga': 1, 'toi_sec': 3540}],
   {'points': 48, 'saves': 24}),
  ('normal control 1',
   [{'decision': 'L', 'empty_net_ga': 0, 'shots_faced': 5, 'team_ga': 2, 'toi_sec': 2400}],
   {'points': -34, 'saves': 3}),
  ('normal control 2',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 18, 'team_ga': 3, 'toi_sec': 807}],
   {'points': -20, 'saves': 15}),
  ('normal control 3',
   [{'decision': None, 'empty_net_ga': 0, 'shots_faced': 5, 'team_ga': 3, 'toi_sec': 1133}],
   {'points': -56, 'saves': 2}),
  ('normal control 4',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 18, 'team_ga': 5, 'toi_sec': 2400}],
   {'points': -64, 'saves': 13})]]
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'] - g['empty_net_ga']
    saves = g['shots_faced'] - ga - g['empty_net_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: save derivation',
   [{'decision': 'W', 'empty_net_ga': 2, 'shots_faced': 26, 'team_ga': 4, 'toi_sec': 1645}],
   {'points': 48, 'saves': 24}),
  ('partial repair probe: save derivation',
   [{'decision': 'L', 'empty_net_ga': 2, 'shots_faced': 30, 'team_ga': 2, 'toi_sec': 3600}],
   {'points': 90, 'saves': 30}),
  ('second regression',
   [{'decision': 'OTL', 'empty_net_ga': 2, 'shots_faced': 12, 'team_ga': 5, 'toi_sec': 3900}],
   {'points': -32, 'saves': 9}),
  ('normal control 1',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 30, 'team_ga': 5, 'toi_sec': 3599}],
   {'points': -40, 'saves': 25}),
  ('normal control 2',
   [{'decision': None, 'empty_net_ga': 0, 'shots_faced': 7, 'team_ga': 3, 'toi_sec': 3600}],
   {'points': -52, 'saves': 4}),
  ('normal control 3',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 20, 'team_ga': 5, 'toi_sec': 3600}],
   {'points': -60, 'saves': 15}),
  ('normal control 4',
   [{'decision': 'L', 'empty_net_ga': 0, 'shots_faced': 14, 'team_ga': 0, 'toi_sec': 3540}],
   {'points': 28, 'saves': 14})],
 [('regression: save derivation',
   [{'decision': 'L', 'empty_net_ga': 1, 'shots_faced': 33, 'team_ga': 2, 'toi_sec': 2400}],
   {'points': 44, 'saves': 32}),
  ('partial repair probe: save derivation',
   [{'decision': 'OTL', 'empty_net_ga': 2, 'shots_faced': 9, 'team_ga': 7, 'toi_sec': 3599}],
   {'points': -82, 'saves': 4}),
  ('second regression',
   [{'decision': None, 'empty_net_ga': 2, 'shots_faced': 31, 'team_ga': 4, 'toi_sec': 3900}],
   {'points': 18, 'saves': 29}),
  ('normal control 1',
   [{'decision': 'L', 'empty_net_ga': 0, 'shots_faced': 30, 'team_ga': 5, 'toi_sec': 3599}],
   {'points': -50, 'saves': 25}),
  ('normal control 2',
   [{'decision': 'W', 'empty_net_ga': 0, 'shots_faced': 25, 'team_ga': 1, 'toi_sec': 3900}],
   {'points': 68, 'saves': 24}),
  ('normal control 3',
   [{'decision': 'W', 'empty_net_ga': 0, 'shots_faced': 25, 'team_ga': 3, 'toi_sec': 3599}],
   {'points': 24, 'saves': 22}),
  ('normal control 4',
   [{'decision': 'L', 'empty_net_ga': 0, 'shots_faced': 16, 'team_ga': 5, 'toi_sec': 3599}],
   {'points': -78, 'saves': 11})],
 [('regression: save derivation',
   [{'decision': 'L', 'empty_net_ga': 2, 'shots_faced': 39, 'team_ga': 3, 'toi_sec': 3600}],
   {'points': 56, 'saves': 38}),
  ('partial repair probe: save derivation',
   [{'decision': 'L', 'empty_net_ga': 1, 'shots_faced': 14, 'team_ga': 6, 'toi_sec': 2400}],
   {'points': -82, 'saves': 9}),
  ('second regression',
   [{'decision': None, 'empty_net_ga': 2, 'shots_faced': 21, 'team_ga': 7, 'toi_sec': 2154}],
   {'points': -68, 'saves': 16}),
  ('normal control 1',
   [{'decision': None, 'empty_net_ga': 0, 'shots_faced': 32, 'team_ga': 0, 'toi_sec': 2400}],
   {'points': 64, 'saves': 32}),
  ('normal control 2',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 22, 'team_ga': 1, 'toi_sec': 3900}],
   {'points': 32, 'saves': 21}),
  ('normal control 3',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 29, 'team_ga': 5, 'toi_sec': 3540}],
   {'points': -42, 'saves': 24}),
  ('normal control 4',
   [{'decision': None, 'empty_net_ga': 0, 'shots_faced': 35, 'team_ga': 2, 'toi_sec': 866}],
   {'points': 26, 'saves': 33})],
 [('regression: save derivation',
   [{'decision': None, 'empty_net_ga': 1, 'shots_faced': 26, 'team_ga': 1, 'toi_sec': 3600}],
   {'points': 82, 'saves': 26}),
  ('partial repair probe: save derivation',
   [{'decision': None, 'empty_net_ga': 1, 'shots_faced': 14, 'team_ga': 1, 'toi_sec': 3599}],
   {'points': 28, 'saves': 14}),
  ('second regression',
   [{'decision': 'L', 'empty_net_ga': 1, 'shots_faced': 5, 'team_ga': 1, 'toi_sec': 3600}],
   {'points': 40, 'saves': 5}),
  ('normal control 1',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 28, 'team_ga': 0, 'toi_sec': 3900}],
   {'points': 96, 'saves': 28}),
  ('normal control 2',
   [{'decision': 'W', 'empty_net_ga': 0, 'shots_faced': 30, 'team_ga': 2, 'toi_sec': 3900}],
   {'points': 56, 'saves': 28}),
  ('normal control 3',
   [{'decision': None, 'empty_net_ga': 0, 'shots_faced': 24, 'team_ga': 1, 'toi_sec': 2400}],
   {'points': 26, 'saves': 23}),
  ('normal control 4',
   [{'decision': 'L', 'empty_net_ga': 0, 'shots_faced': 35, 'team_ga': 2, 'toi_sec': 3900}],
   {'points': 26, 'saves': 33})],
 [('regression: save derivation',
   [{'decision': 'OTL', 'empty_net_ga': 2, 'shots_faced': 20, 'team_ga': 2, 'toi_sec': 3600}],
   {'points': 80, 'saves': 20}),
  ('partial repair probe: save derivation',
   [{'decision': 'OTL', 'empty_net_ga': 1, 'shots_faced': 7, 'team_ga': 4, 'toi_sec': 3731}],
   {'points': -42, 'saves': 4}),
  ('second regression',
   [{'decision': 'L', 'empty_net_ga': 1, 'shots_faced': 24, 'team_ga': 1, 'toi_sec': 3540}],
   {'points': 48, 'saves': 24}),
  ('normal control 1',
   [{'decision': 'L', 'empty_net_ga': 0, 'shots_faced': 5, 'team_ga': 2, 'toi_sec': 2400}],
   {'points': -34, 'saves': 3}),
  ('normal control 2',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 18, 'team_ga': 3, 'toi_sec': 807}],
   {'points': -20, 'saves': 15}),
  ('normal control 3',
   [{'decision': None, 'empty_net_ga': 0, 'shots_faced': 5, 'team_ga': 3, 'toi_sec': 1133}],
   {'points': -56, 'saves': 2}),
  ('normal control 4',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 18, 'team_ga': 5, 'toi_sec': 2400}],
   {'points': -64, 'saves': 13})]]
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:
Save totals drop by one for every empty-net goal.

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


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

N = 1
observations = []
def solve(g):
    ga = g['team_ga'] - g['empty_net_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: shutout playing time',
   [{'decision': None, 'empty_net_ga': 0, 'shots_faced': 3, 'team_ga': 0, 'toi_sec': 3600}],
   {'points': 36, 'saves': 3}),
  ('partial repair probe: shutout playing time',
   [{'decision': 'OTL', 'empty_net_ga': 2, 'shots_faced': 9, 'team_ga': 2, 'toi_sec': 3600}],
   {'points': 58, 'saves': 9}),
  ('second regression',
   [{'decision': 'L', 'empty_net_ga': 0, 'shots_faced': 23, 'team_ga': 0, 'toi_sec': 3600}],
   {'points': 76, 'saves': 23}),
  ('normal control 1',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 15, 'team_ga': 1, 'toi_sec': 2737}],
   {'points': 18, 'saves': 14}),
  ('normal control 2',
   [{'decision': None, 'empty_net_ga': 2, 'shots_faced': 25, 'team_ga': 5, 'toi_sec': 3600}],
   {'points': -16, 'saves': 22}),
  ('normal control 3',
   [{'decision': 'OTL', 'empty_net_ga': 1, 'shots_faced': 42, 'team_ga': 4, 'toi_sec': 3600}],
   {'points': 28, 'saves': 39}),
  ('normal control 4',
   [{'decision': 'L', 'empty_net_ga': 2, 'shots_faced': 26, 'team_ga': 4, 'toi_sec': 3599}],
   {'points': 8, 'saves': 24})],
 [('regression: shutout playing time',
   [{'decision': None, 'empty_net_ga': 0, 'shots_faced': 23, 'team_ga': 0, 'toi_sec': 3600}],
   {'points': 76, 'saves': 23}),
  ('partial repair probe: shutout playing time',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 3, 'team_ga': 0, 'toi_sec': 3900}],
   {'points': 46, 'saves': 3}),
  ('second regression',
   [{'decision': 'W', 'empty_net_ga': 2, 'shots_faced': 27, 'team_ga': 2, 'toi_sec': 3600}],
   {'points': 124, 'saves': 27}),
  ('normal control 1',
   [{'decision': 'L', 'empty_net_ga': 0, 'shots_faced': 6, 'team_ga': 0, 'toi_sec': 3540}],
   {'points': 12, 'saves': 6}),
  ('normal control 2',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 1, 'team_ga': 1, 'toi_sec': 2400}],
   {'points': -10, 'saves': 0}),
  ('normal control 3',
   [{'decision': 'W', 'empty_net_ga': 1, 'shots_faced': 18, 'team_ga': 6, 'toi_sec': 3900}],
   {'points': -34, 'saves': 13}),
  ('normal control 4',
   [{'decision': 'W', 'empty_net_ga': 1, 'shots_faced': 15, 'team_ga': 3, 'toi_sec': 2400}],
   {'points': 26, 'saves': 13})],
 [('regression: shutout playing time',
   [{'decision': 'OTL', 'empty_net_ga': 2, 'shots_faced': 16, 'team_ga': 2, 'toi_sec': 3600}],
   {'points': 72, 'saves': 16}),
  ('partial repair probe: shutout playing time',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 38, 'team_ga': 0, 'toi_sec': 3600}],
   {'points': 116, 'saves': 38}),
  ('second regression',
   [{'decision': 'W', 'empty_net_ga': 0, 'shots_faced': 23, 'team_ga': 0, 'toi_sec': 3600}],
   {'points': 116, 'saves': 23}),
  ('normal control 1',
   [{'decision': None, 'empty_net_ga': 0, 'shots_faced': 34, 'team_ga': 3, 'toi_sec': 3600}],
   {'points': 2, 'saves': 31}),
  ('normal control 2',
   [{'decision': None, 'empty_net_ga': 1, 'shots_faced': 26, 'team_ga': 3, 'toi_sec': 3600}],
   {'points': 8, 'saves': 24}),
  ('normal control 3',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 24, 'team_ga': 2, 'toi_sec': 2400}],
   {'points': 14, 'saves': 22}),
  ('normal control 4',
   [{'decision': 'L', 'empty_net_ga': 1, 'shots_faced': 35, 'team_ga': 1, 'toi_sec': 3283}],
   {'points': 70, 'saves': 35})],
 [('regression: shutout playing time',
   [{'decision': None, 'empty_net_ga': 1, 'shots_faced': 10, 'team_ga': 1, 'toi_sec': 3600}],
   {'points': 50, 'saves': 10}),
  ('partial repair probe: shutout playing time',
   [{'decision': None, 'empty_net_ga': 2, 'shots_faced': 9, 'team_ga': 2, 'toi_sec': 3900}],
   {'points': 48, 'saves': 9}),
  ('second regression',
   [{'decision': 'OTL', 'empty_net_ga': 1, 'shots_faced': 31, 'team_ga': 1, 'toi_sec': 3600}],
   {'points': 102, 'saves': 31}),
  ('normal control 1',
   [{'decision': 'OTL', 'empty_net_ga': 1, 'shots_faced': 6, 'team_ga': 6, 'toi_sec': 681}],
   {'points': -88, 'saves': 1}),
  ('normal control 2',
   [{'decision': 'L', 'empty_net_ga': 1, 'shots_faced': 35, 'team_ga': 4, 'toi_sec': 3540}],
   {'points': 4, 'saves': 32}),
  ('normal control 3',
   [{'decision': None, 'empty_net_ga': 2, 'shots_faced': 19, 'team_ga': 5, 'toi_sec': 3900}],
   {'points': -28, 'saves': 16}),
  ('normal control 4',
   [{'decision': 'W', 'empty_net_ga': 0, 'shots_faced': 29, 'team_ga': 5, 'toi_sec': 3600}],
   {'points': -12, 'saves': 24})],
 [('regression: shutout playing time',
   [{'decision': 'L', 'empty_net_ga': 1, 'shots_faced': 21, 'team_ga': 1, 'toi_sec': 3600}],
   {'points': 72, 'saves': 21}),
  ('partial repair probe: shutout playing time',
   [{'decision': None, 'empty_net_ga': 0, 'shots_faced': 20, 'team_ga': 0, 'toi_sec': 3600}],
   {'points': 70, 'saves': 20}),
  ('second regression',
   [{'decision': 'L', 'empty_net_ga': 1, 'shots_faced': 22, 'team_ga': 1, 'toi_sec': 3600}],
   {'points': 74, 'saves': 22}),
  ('normal control 1',
   [{'decision': None, 'empty_net_ga': 1, 'shots_faced': 10, 'team_ga': 6, 'toi_sec': 3900}],
   {'points': -90, 'saves': 5}),
  ('normal control 2',
   [{'decision': 'L', 'empty_net_ga': 1, 'shots_faced': 20, 'team_ga': 2, 'toi_sec': 3600}],
   {'points': 18, 'saves': 19}),
  ('normal control 3',
   [{'decision': 'L', 'empty_net_ga': 0, 'shots_faced': 27, 'team_ga': 0, 'toi_sec': 2400}],
   {'points': 54, 'saves': 27}),
  ('normal control 4',
   [{'decision': None, 'empty_net_ga': 2, 'shots_faced': 18, 'team_ga': 4, 'toi_sec': 3600}],
   {'points': -8, 'saves': 16})]]
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(g):
    ga = g['team_ga'] - g['empty_net_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 and g['decision'] == 'W':
        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: shutout playing time',
   [{'decision': None, 'empty_net_ga': 0, 'shots_faced': 3, 'team_ga': 0, 'toi_sec': 3600}],
   {'points': 36, 'saves': 3}),
  ('partial repair probe: shutout playing time',
   [{'decision': 'OTL', 'empty_net_ga': 2, 'shots_faced': 9, 'team_ga': 2, 'toi_sec': 3600}],
   {'points': 58, 'saves': 9}),
  ('second regression',
   [{'decision': 'L', 'empty_net_ga': 0, 'shots_faced': 23, 'team_ga': 0, 'toi_sec': 3600}],
   {'points': 76, 'saves': 23}),
  ('normal control 1',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 15, 'team_ga': 1, 'toi_sec': 2737}],
   {'points': 18, 'saves': 14}),
  ('normal control 2',
   [{'decision': None, 'empty_net_ga': 2, 'shots_faced': 25, 'team_ga': 5, 'toi_sec': 3600}],
   {'points': -16, 'saves': 22}),
  ('normal control 3',
   [{'decision': 'OTL', 'empty_net_ga': 1, 'shots_faced': 42, 'team_ga': 4, 'toi_sec': 3600}],
   {'points': 28, 'saves': 39}),
  ('normal control 4',
   [{'decision': 'L', 'empty_net_ga': 2, 'shots_faced': 26, 'team_ga': 4, 'toi_sec': 3599}],
   {'points': 8, 'saves': 24})],
 [('regression: shutout playing time',
   [{'decision': None, 'empty_net_ga': 0, 'shots_faced': 23, 'team_ga': 0, 'toi_sec': 3600}],
   {'points': 76, 'saves': 23}),
  ('partial repair probe: shutout playing time',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 3, 'team_ga': 0, 'toi_sec': 3900}],
   {'points': 46, 'saves': 3}),
  ('second regression',
   [{'decision': 'W', 'empty_net_ga': 2, 'shots_faced': 27, 'team_ga': 2, 'toi_sec': 3600}],
   {'points': 124, 'saves': 27}),
  ('normal control 1',
   [{'decision': 'L', 'empty_net_ga': 0, 'shots_faced': 6, 'team_ga': 0, 'toi_sec': 3540}],
   {'points': 12, 'saves': 6}),
  ('normal control 2',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 1, 'team_ga': 1, 'toi_sec': 2400}],
   {'points': -10, 'saves': 0}),
  ('normal control 3',
   [{'decision': 'W', 'empty_net_ga': 1, 'shots_faced': 18, 'team_ga': 6, 'toi_sec': 3900}],
   {'points': -34, 'saves': 13}),
  ('normal control 4',
   [{'decision': 'W', 'empty_net_ga': 1, 'shots_faced': 15, 'team_ga': 3, 'toi_sec': 2400}],
   {'points': 26, 'saves': 13})],
 [('regression: shutout playing time',
   [{'decision': 'OTL', 'empty_net_ga': 2, 'shots_faced': 16, 'team_ga': 2, 'toi_sec': 3600}],
   {'points': 72, 'saves': 16}),
  ('partial repair probe: shutout playing time',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 38, 'team_ga': 0, 'toi_sec': 3600}],
   {'points': 116, 'saves': 38}),
  ('second regression',
   [{'decision': 'W', 'empty_net_ga': 0, 'shots_faced': 23, 'team_ga': 0, 'toi_sec': 3600}],
   {'points': 116, 'saves': 23}),
  ('normal control 1',
   [{'decision': None, 'empty_net_ga': 0, 'shots_faced': 34, 'team_ga': 3, 'toi_sec': 3600}],
   {'points': 2, 'saves': 31}),
  ('normal control 2',
   [{'decision': None, 'empty_net_ga': 1, 'shots_faced': 26, 'team_ga': 3, 'toi_sec': 3600}],
   {'points': 8, 'saves': 24}),
  ('normal control 3',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 24, 'team_ga': 2, 'toi_sec': 2400}],
   {'points': 14, 'saves': 22}),
  ('normal control 4',
   [{'decision': 'L', 'empty_net_ga': 1, 'shots_faced': 35, 'team_ga': 1, 'toi_sec': 3283}],
   {'points': 70, 'saves': 35})],
 [('regression: shutout playing time',
   [{'decision': None, 'empty_net_ga': 1, 'shots_faced': 10, 'team_ga': 1, 'toi_sec': 3600}],
   {'points': 50, 'saves': 10}),
  ('partial repair probe: shutout playing time',
   [{'decision': None, 'empty_net_ga': 2, 'shots_faced': 9, 'team_ga': 2, 'toi_sec': 3900}],
   {'points': 48, 'saves': 9}),
  ('second regression',
   [{'decision': 'OTL', 'empty_net_ga': 1, 'shots_faced': 31, 'team_ga': 1, 'toi_sec': 3600}],
   {'points': 102, 'saves': 31}),
  ('normal control 1',
   [{'decision': 'OTL', 'empty_net_ga': 1, 'shots_faced': 6, 'team_ga': 6, 'toi_sec': 681}],
   {'points': -88, 'saves': 1}),
  ('normal control 2',
   [{'decision': 'L', 'empty_net_ga': 1, 'shots_faced': 35, 'team_ga': 4, 'toi_sec': 3540}],
   {'points': 4, 'saves': 32}),
  ('normal control 3',
   [{'decision': None, 'empty_net_ga': 2, 'shots_faced': 19, 'team_ga': 5, 'toi_sec': 3900}],
   {'points': -28, 'saves': 16}),
  ('normal control 4',
   [{'decision': 'W', 'empty_net_ga': 0, 'shots_faced': 29, 'team_ga': 5, 'toi_sec': 3600}],
   {'points': -12, 'saves': 24})],
 [('regression: shutout playing time',
   [{'decision': 'L', 'empty_net_ga': 1, 'shots_faced': 21, 'team_ga': 1, 'toi_sec': 3600}],
   {'points': 72, 'saves': 21}),
  ('partial repair probe: shutout playing time',
   [{'decision': None, 'empty_net_ga': 0, 'shots_faced': 20, 'team_ga': 0, 'toi_sec': 3600}],
   {'points': 70, 'saves': 20}),
  ('second regression',
   [{'decision': 'L', 'empty_net_ga': 1, 'shots_faced': 22, 'team_ga': 1, 'toi_sec': 3600}],
   {'points': 74, 'saves': 22}),
  ('normal control 1',
   [{'decision': None, 'empty_net_ga': 1, 'shots_faced': 10, 'team_ga': 6, 'toi_sec': 3900}],
   {'points': -90, 'saves': 5}),
  ('normal control 2',
   [{'decision': 'L', 'empty_net_ga': 1, 'shots_faced': 20, 'team_ga': 2, 'toi_sec': 3600}],
   {'points': 18, 'saves': 19}),
  ('normal control 3',
   [{'decision': 'L', 'empty_net_ga': 0, 'shots_faced': 27, 'team_ga': 0, 'toi_sec': 2400}],
   {'points': 54, 'saves': 27}),
  ('normal control 4',
   [{'decision': None, 'empty_net_ga': 2, 'shots_faced': 18, 'team_ga': 4, 'toi_sec': 3600}],
   {'points': -8, 'saves': 16})]]
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 playing every regulation second of a 1-0 win gets no shutout bonus.

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


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

N = 1
observations = []
def solve(g):
    ga = g['team_ga'] - g['empty_net_ga']
    saves = g['shots_faced'] - ga
    pts = saves * 2 - ga * 20
    pts += {'W': 40}.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: overtime loss decision',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 45, 'team_ga': 5, 'toi_sec': 3599}],
   {'points': -10, 'saves': 40}),
  ('partial repair probe: overtime loss decision',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 39, 'team_ga': 0, 'toi_sec': 3599}],
   {'points': 88, 'saves': 39}),
  ('second regression',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 41, 'team_ga': 3, 'toi_sec': 3540}],
   {'points': 26, 'saves': 38}),
  ('normal control 1',
   [{'decision': 'W', 'empty_net_ga': 2, 'shots_faced': 15, 'team_ga': 3, 'toi_sec': 3600}],
   {'points': 48, 'saves': 14}),
  ('normal control 2',
   [{'decision': 'L', 'empty_net_ga': 1, 'shots_faced': 14, 'team_ga': 1, 'toi_sec': 2750}],
   {'points': 28, 'saves': 14}),
  ('normal control 3',
   [{'decision': None, 'empty_net_ga': 1, 'shots_faced': 14, 'team_ga': 1, 'toi_sec': 3599}],
   {'points': 28, 'saves': 14}),
  ('normal control 4',
   [{'decision': 'W', 'empty_net_ga': 1, 'shots_faced': 37, 'team_ga': 3, 'toi_sec': 2400}],
   {'points': 70, 'saves': 35})],
 [('regression: overtime loss decision',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 3, 'team_ga': 3, 'toi_sec': 3900}],
   {'points': -50, 'saves': 0}),
  ('partial repair probe: overtime loss decision',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 27, 'team_ga': 2, 'toi_sec': 3540}],
   {'points': 20, 'saves': 25}),
  ('second regression',
   [{'decision': 'OTL', 'empty_net_ga': 2, 'shots_faced': 20, 'team_ga': 4, 'toi_sec': 3599}],
   {'points': 6, 'saves': 18}),
  ('normal control 1',
   [{'decision': None, 'empty_net_ga': 0, 'shots_faced': 28, 'team_ga': 3, 'toi_sec': 2400}],
   {'points': -10, 'saves': 25}),
  ('normal control 2',
   [{'decision': 'L', 'empty_net_ga': 0, 'shots_faced': 27, 'team_ga': 3, 'toi_sec': 3540}],
   {'points': -12, 'saves': 24}),
  ('normal control 3',
   [{'decision': None, 'empty_net_ga': 1, 'shots_faced': 15, 'team_ga': 2, 'toi_sec': 2400}],
   {'points': 8, 'saves': 14}),
  ('normal control 4',
   [{'decision': None, 'empty_net_ga': 2, 'shots_faced': 31, 'team_ga': 4, 'toi_sec': 2400}],
   {'points': 18, 'saves': 29})],
 [('regression: overtime loss decision',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 15, 'team_ga': 5, 'toi_sec': 1961}],
   {'points': -70, 'saves': 10}),
  ('partial repair probe: overtime loss decision',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 26, 'team_ga': 1, 'toi_sec': 3600}],
   {'points': 40, 'saves': 25}),
  ('second regression',
   [{'decision': 'OTL', 'empty_net_ga': 1, 'shots_faced': 2, 'team_ga': 1, 'toi_sec': 2400}],
   {'points': 14, 'saves': 2}),
  ('normal control 1',
   [{'decision': 'L', 'empty_net_ga': 0, 'shots_faced': 40, 'team_ga': 0, 'toi_sec': 3900}],
   {'points': 110, 'saves': 40}),
  ('normal control 2',
   [{'decision': 'W', 'empty_net_ga': 1, 'shots_faced': 32, 'team_ga': 6, 'toi_sec': 3599}],
   {'points': -6, 'saves': 27}),
  ('normal control 3',
   [{'decision': 'L', 'empty_net_ga': 2, 'shots_faced': 27, 'team_ga': 3, 'toi_sec': 3599}],
   {'points': 32, 'saves': 26}),
  ('normal control 4',
   [{'decision': 'L', 'empty_net_ga': 0, 'shots_faced': 34, 'team_ga': 3, 'toi_sec': 3599}],
   {'points': 2, 'saves': 31})],
 [('regression: overtime loss decision',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 40, 'team_ga': 5, 'toi_sec': 2400}],
   {'points': -20, 'saves': 35}),
  ('partial repair probe: overtime loss decision',
   [{'decision': 'OTL', 'empty_net_ga': 1, 'shots_faced': 18, 'team_ga': 6, 'toi_sec': 2400}],
   {'points': -64, 'saves': 13}),
  ('second regression',
   [{'decision': 'OTL', 'empty_net_ga': 1, 'shots_faced': 31, 'team_ga': 2, 'toi_sec': 3540}],
   {'points': 50, 'saves': 30}),
  ('normal control 1',
   [{'decision': 'L', 'empty_net_ga': 1, 'shots_faced': 27, 'team_ga': 6, 'toi_sec': 762}],
   {'points': -56, 'saves': 22}),
  ('normal control 2',
   [{'decision': 'L', 'empty_net_ga': 1, 'shots_faced': 33, 'team_ga': 3, 'toi_sec': 3599}],
   {'points': 22, 'saves': 31}),
  ('normal control 3',
   [{'decision': None, 'empty_net_ga': 0, 'shots_faced': 18, 'team_ga': 0, 'toi_sec': 3392}],
   {'points': 36, 'saves': 18}),
  ('normal control 4',
   [{'decision': None, 'empty_net_ga': 2, 'shots_faced': 2, 'team_ga': 2, 'toi_sec': 3900}],
   {'points': 34, 'saves': 2})],
 [('regression: overtime loss decision',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 36, 'team_ga': 3, 'toi_sec': 3715}],
   {'points': 16, 'saves': 33}),
  ('partial repair probe: overtime loss decision',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 8, 'team_ga': 5, 'toi_sec': 2400}],
   {'points': -84, 'saves': 3}),
  ('second regression',
   [{'decision': 'OTL', 'empty_net_ga': 1, 'shots_faced': 19, 'team_ga': 6, 'toi_sec': 2400}],
   {'points': -62, 'saves': 14}),
  ('normal control 1',
   [{'decision': 'L', 'empty_net_ga': 0, 'shots_faced': 40, 'team_ga': 2, 'toi_sec': 3540}],
   {'points': 36, 'saves': 38}),
  ('normal control 2',
   [{'decision': 'L', 'empty_net_ga': 1, 'shots_faced': 12, 'team_ga': 3, 'toi_sec': 2400}],
   {'points': -20, 'saves': 10}),
  ('normal control 3',
   [{'decision': 'W', 'empty_net_ga': 0, 'shots_faced': 7, 'team_ga': 0, 'toi_sec': 3600}],
   {'points': 84, 'saves': 7}),
  ('normal control 4',
   [{'decision': 'L', 'empty_net_ga': 0, 'shots_faced': 23, 'team_ga': 5, 'toi_sec': 3540}],
   {'points': -64, 'saves': 18})]]
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'] - g['empty_net_ga']
    saves = g['shots_faced'] - ga
    pts = saves * 2 - ga * 20
    pts += {'W': 40, 'OT': 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: overtime loss decision',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 45, 'team_ga': 5, 'toi_sec': 3599}],
   {'points': -10, 'saves': 40}),
  ('partial repair probe: overtime loss decision',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 39, 'team_ga': 0, 'toi_sec': 3599}],
   {'points': 88, 'saves': 39}),
  ('second regression',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 41, 'team_ga': 3, 'toi_sec': 3540}],
   {'points': 26, 'saves': 38}),
  ('normal control 1',
   [{'decision': 'W', 'empty_net_ga': 2, 'shots_faced': 15, 'team_ga': 3, 'toi_sec': 3600}],
   {'points': 48, 'saves': 14}),
  ('normal control 2',
   [{'decision': 'L', 'empty_net_ga': 1, 'shots_faced': 14, 'team_ga': 1, 'toi_sec': 2750}],
   {'points': 28, 'saves': 14}),
  ('normal control 3',
   [{'decision': None, 'empty_net_ga': 1, 'shots_faced': 14, 'team_ga': 1, 'toi_sec': 3599}],
   {'points': 28, 'saves': 14}),
  ('normal control 4',
   [{'decision': 'W', 'empty_net_ga': 1, 'shots_faced': 37, 'team_ga': 3, 'toi_sec': 2400}],
   {'points': 70, 'saves': 35})],
 [('regression: overtime loss decision',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 3, 'team_ga': 3, 'toi_sec': 3900}],
   {'points': -50, 'saves': 0}),
  ('partial repair probe: overtime loss decision',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 27, 'team_ga': 2, 'toi_sec': 3540}],
   {'points': 20, 'saves': 25}),
  ('second regression',
   [{'decision': 'OTL', 'empty_net_ga': 2, 'shots_faced': 20, 'team_ga': 4, 'toi_sec': 3599}],
   {'points': 6, 'saves': 18}),
  ('normal control 1',
   [{'decision': None, 'empty_net_ga': 0, 'shots_faced': 28, 'team_ga': 3, 'toi_sec': 2400}],
   {'points': -10, 'saves': 25}),
  ('normal control 2',
   [{'decision': 'L', 'empty_net_ga': 0, 'shots_faced': 27, 'team_ga': 3, 'toi_sec': 3540}],
   {'points': -12, 'saves': 24}),
  ('normal control 3',
   [{'decision': None, 'empty_net_ga': 1, 'shots_faced': 15, 'team_ga': 2, 'toi_sec': 2400}],
   {'points': 8, 'saves': 14}),
  ('normal control 4',
   [{'decision': None, 'empty_net_ga': 2, 'shots_faced': 31, 'team_ga': 4, 'toi_sec': 2400}],
   {'points': 18, 'saves': 29})],
 [('regression: overtime loss decision',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 15, 'team_ga': 5, 'toi_sec': 1961}],
   {'points': -70, 'saves': 10}),
  ('partial repair probe: overtime loss decision',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 26, 'team_ga': 1, 'toi_sec': 3600}],
   {'points': 40, 'saves': 25}),
  ('second regression',
   [{'decision': 'OTL', 'empty_net_ga': 1, 'shots_faced': 2, 'team_ga': 1, 'toi_sec': 2400}],
   {'points': 14, 'saves': 2}),
  ('normal control 1',
   [{'decision': 'L', 'empty_net_ga': 0, 'shots_faced': 40, 'team_ga': 0, 'toi_sec': 3900}],
   {'points': 110, 'saves': 40}),
  ('normal control 2',
   [{'decision': 'W', 'empty_net_ga': 1, 'shots_faced': 32, 'team_ga': 6, 'toi_sec': 3599}],
   {'points': -6, 'saves': 27}),
  ('normal control 3',
   [{'decision': 'L', 'empty_net_ga': 2, 'shots_faced': 27, 'team_ga': 3, 'toi_sec': 3599}],
   {'points': 32, 'saves': 26}),
  ('normal control 4',
   [{'decision': 'L', 'empty_net_ga': 0, 'shots_faced': 34, 'team_ga': 3, 'toi_sec': 3599}],
   {'points': 2, 'saves': 31})],
 [('regression: overtime loss decision',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 40, 'team_ga': 5, 'toi_sec': 2400}],
   {'points': -20, 'saves': 35}),
  ('partial repair probe: overtime loss decision',
   [{'decision': 'OTL', 'empty_net_ga': 1, 'shots_faced': 18, 'team_ga': 6, 'toi_sec': 2400}],
   {'points': -64, 'saves': 13}),
  ('second regression',
   [{'decision': 'OTL', 'empty_net_ga': 1, 'shots_faced': 31, 'team_ga': 2, 'toi_sec': 3540}],
   {'points': 50, 'saves': 30}),
  ('normal control 1',
   [{'decision': 'L', 'empty_net_ga': 1, 'shots_faced': 27, 'team_ga': 6, 'toi_sec': 762}],
   {'points': -56, 'saves': 22}),
  ('normal control 2',
   [{'decision': 'L', 'empty_net_ga': 1, 'shots_faced': 33, 'team_ga': 3, 'toi_sec': 3599}],
   {'points': 22, 'saves': 31}),
  ('normal control 3',
   [{'decision': None, 'empty_net_ga': 0, 'shots_faced': 18, 'team_ga': 0, 'toi_sec': 3392}],
   {'points': 36, 'saves': 18}),
  ('normal control 4',
   [{'decision': None, 'empty_net_ga': 2, 'shots_faced': 2, 'team_ga': 2, 'toi_sec': 3900}],
   {'points': 34, 'saves': 2})],
 [('regression: overtime loss decision',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 36, 'team_ga': 3, 'toi_sec': 3715}],
   {'points': 16, 'saves': 33}),
  ('partial repair probe: overtime loss decision',
   [{'decision': 'OTL', 'empty_net_ga': 0, 'shots_faced': 8, 'team_ga': 5, 'toi_sec': 2400}],
   {'points': -84, 'saves': 3}),
  ('second regression',
   [{'decision': 'OTL', 'empty_net_ga': 1, 'shots_faced': 19, 'team_ga': 6, 'toi_sec': 2400}],
   {'points': -62, 'saves': 14}),
  ('normal control 1',
   [{'decision': 'L', 'empty_net_ga': 0, 'shots_faced': 40, 'team_ga': 2, 'toi_sec': 3540}],
   {'points': 36, 'saves': 38}),
  ('normal control 2',
   [{'decision': 'L', 'empty_net_ga': 1, 'shots_faced': 12, 'team_ga': 3, 'toi_sec': 2400}],
   {'points': -20, 'saves': 10}),
  ('normal control 3',
   [{'decision': 'W', 'empty_net_ga': 0, 'shots_faced': 7, 'team_ga': 0, 'toi_sec': 3600}],
   {'points': 84, 'saves': 7}),
  ('normal control 4',
   [{'decision': 'L', 'empty_net_ga': 0, 'shots_faced': 23, 'team_ga': 5, 'toi_sec': 3540}],
   {'points': -64, 'saves': 18})]]
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:
Goalies lose the overtime-loss point.

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


prompt:
A skater credited with a shootout goal earns 3 extra points.

Score a hockey skater in tenths: goal 3, assist 2, plus/minus 1 per unit (negative allowed), shot on goal 0.4, power-play points (goals plus assists) 0.5 extra each, short-handed points 1 extra each, and a single 2 point hat-trick bonus for three or more goals. Shootout goals (so_g) are not goals and score nothing.

split: open-access


prompt:
Only four-goal games receive the hat-trick bonus.

Score a hockey skater in tenths: goal 3, assist 2, plus/minus 1 per unit (negative allowed), shot on goal 0.4, power-play points (goals plus assists) 0.5 extra each, short-handed points 1 extra each, and a single 2 point hat-trick bonus for three or more goals. Shootout goals (so_g) are not goals and score nothing.

split: open-access


prompt:
A quarterback of the power play with three PP assists gets no extra points.

Score a hockey skater in tenths: goal 3, assist 2, plus/minus 1 per unit (negative allowed), shot on goal 0.4, power-play points (goals plus assists) 0.5 extra each, short-handed points 1 extra each, and a single 2 point hat-trick bonus for three or more goals. Shootout goals (so_g) are not goals and score nothing.

split: open-access


prompt:
A -3 skater gains 3 points.

Score a hockey skater in tenths: goal 3, assist 2, plus/minus 1 per unit (negative allowed), shot on goal 0.4, power-play points (goals plus assists) 0.5 extra each, short-handed points 1 extra each, and a single 2 point hat-trick bonus for three or more goals. Shootout goals (so_g) are not goals and score nothing.

split: open-access


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

N = 1
observations = []
def solve(inn):
    pts = inn['runs'] + inn['fours'] + inn['sixes'] * 2
    if inn['runs'] >= 100:
        pts += 16
    if inn['runs'] >= 50:
        pts += 8
    if inn['runs'] >= 30:
        pts += 4
    if inn['out'] and inn['runs'] == 0 and inn['balls'] >= 1 and inn['role'] != 'BOWL':
        pts -= 2
    if inn['balls'] >= 10 and inn['role'] != 'BOWL':
        r, b = inn['runs'] * 100, inn['balls']
        if r > 170 * b:
            pts += 6
        elif r > 150 * b:
            pts += 4
        elif r >= 130 * b:
            pts += 2
        elif r >= 70 * b:
            pass
        elif r >= 60 * b:
            pts -= 2
        elif r >= 50 * b:
            pts -= 4
        else:
            pts -= 6
    return pts
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: milestone exclusivity',
   [{'balls': 9, 'fours': 17, 'out': True, 'role': 'WK', 'runs': 100, 'sixes': 5}], 143),
  ('partial repair probe: milestone exclusivity',
   [{'balls': 1, 'fours': 3, 'out': True, 'role': 'BAT', 'runs': 96, 'sixes': 12}], 131),
  ('second regression', [{'balls': 60, 'fours': 15, 'out': False, 'role': 'AR', 'runs': 79, 'sixes': 0}],
   104),
  ('normal control 1', [{'balls': 1, 'fours': 2, 'out': False, 'role': 'BAT', 'runs': 30, 'sixes': 3}], 42),
  ('normal control 2', [{'balls': 46, 'fours': 0, 'out': False, 'role': 'BOWL', 'runs': 17, 'sixes': 0}], 17),
  ('normal control 3', [{'balls': 10, 'fours': 4, 'out': False, 'role': 'BOWL', 'runs': 16, 'sixes': 0}], 20),
  ('normal control 4', [{'balls': 9, 'fours': 0, 'out': True, 'role': 'BAT', 'runs': 0, 'sixes': 0}], -2)],
 [('regression: milestone exclusivity',
   [{'balls': 40, 'fours': 10, 'out': True, 'role': 'BAT', 'runs': 53, 'sixes': 2}], 77),
  ('partial repair probe: milestone exclusivity',
   [{'balls': 20, 'fours': 2, 'out': False, 'role': 'BAT', 'runs': 100, 'sixes': 4}], 132),
  ('second regression', [{'balls': 11, 'fours': 0, 'out': True, 'role': 'BOWL', 'runs': 50, 'sixes': 5}], 68),
  ('normal control 1', [{'balls': 20, 'fours': 0, 'out': True, 'role': 'BOWL', 'runs': 0, 'sixes': 0}], 0),
  ('normal control 2', [{'balls': 18, 'fours': 5, 'out': True, 'role': 'BAT', 'runs': 24, 'sixes': 0}], 31),
  ('normal control 3', [{'balls': 11, 'fours': 0, 'out': True, 'role': 'AR', 'runs': 30, 'sixes': 2}], 44),
  ('normal control 4', [{'balls': 9, 'fours': 5, 'out': False, 'role': 'BOWL', 'runs': 30, 'sixes': 0}], 39)],
 [('regression: milestone exclusivity',
   [{'balls': 51, 'fours': 15, 'out': True, 'role': 'BOWL', 'runs': 67, 'sixes': 1}], 92),
  ('partial repair probe: milestone exclusivity',
   [{'balls': 40, 'fours': 11, 'out': True, 'role': 'AR', 'runs': 69, 'sixes': 2}], 98),
  ('second regression', [{'balls': 47, 'fours': 6, 'out': True, 'role': 'AR', 'runs': 62, 'sixes': 5}], 88),
  ('normal control 1', [{'balls': 20, 'fours': 3, 'out': False, 'role': 'BOWL', 'runs': 17, 'sixes': 0}], 20),
  ('normal control 2', [{'balls': 23, 'fours': 4, 'out': False, 'role': 'WK', 'runs': 34, 'sixes': 0}], 44),
  ('normal control 3', [{'balls': 44, 'fours': 0, 'out': True, 'role': 'BOWL', 'runs': 34, 'sixes': 0}], 38),
  ('normal control 4', [{'balls': 20, 'fours': 6, 'out': False, 'role': 'AR', 'runs': 34, 'sixes': 1}], 50)],
 [('regression: milestone exclusivity',
   [{'balls': 23, 'fours': 3, 'out': True, 'role': 'AR', 'runs': 100, 'sixes': 3}], 131),
  ('partial repair probe: milestone exclusivity',
   [{'balls': 38, 'fours': 0, 'out': False, 'role': 'WK', 'runs': 58, 'sixes': 3}], 76),
  ('second regression', [{'balls': 51, 'fours': 3, 'out': False, 'role': 'BOWL', 'runs': 50, 'sixes': 1}],
   63),
  ('normal control 1', [{'balls': 11, 'fours': 6, 'out': False, 'role': 'BAT', 'runs': 29, 'sixes': 0}], 41),
  ('normal control 2', [{'balls': 19, 'fours': 3, 'out': False, 'role': 'BOWL', 'runs': 25, 'sixes': 1}], 30),
  ('normal control 3', [{'balls': 0, 'fours': 0, 'out': True, 'role': 'BOWL', 'runs': 0, 'sixes': 0}], 0),
  ('normal control 4', [{'balls': 20, 'fours': 1, 'out': True, 'role': 'BAT', 'runs': 34, 'sixes': 3}], 49)],
 [('regression: milestone exclusivity',
   [{'balls': 20, 'fours': 24, 'out': True, 'role': 'AR', 'runs': 100, 'sixes': 0}], 146),
  ('partial repair probe: milestone exclusivity',
   [{'balls': 10, 'fours': 18, 'out': True, 'role': 'WK', 'runs': 98, 'sixes': 0}], 130),
  ('second regression', [{'balls': 10, 'fours': 17, 'out': True, 'role': 'BOWL', 'runs': 100, 'sixes': 5}],
   143),
  ('normal control 1', [{'balls': 12, 'fours': 0, 'out': True, 'role': 'BOWL', 'runs': 16, 'sixes': 2}], 20),
  ('normal control 2', [{'balls': 9, 'fours': 0, 'out': False, 'role': 'BOWL', 'runs': 0, 'sixes': 0}], 0),
  ('normal control 3', [{'balls': 11, 'fours': 5, 'out': False, 'role': 'AR', 'runs': 34, 'sixes': 2}], 53),
  ('normal control 4', [{'balls': 47, 'fours': 1, 'out': False, 'role': 'WK', 'runs': 30, 'sixes': 0}], 33)]]
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(inn):
    pts = inn['runs'] + inn['fours'] + inn['sixes'] * 2
    if inn['runs'] >= 100:
        pts += 16
    elif inn['runs'] >= 50:
        pts += 8
    if inn['runs'] >= 30:
        pts += 4
    if inn['out'] and inn['runs'] == 0 and inn['balls'] >= 1 and inn['role'] != 'BOWL':
        pts -= 2
    if inn['balls'] >= 10 and inn['role'] != 'BOWL':
        r, b = inn['runs'] * 100, inn['balls']
        if r > 170 * b:
            pts += 6
        elif r > 150 * b:
            pts += 4
        elif r >= 130 * b:
            pts += 2
        elif r >= 70 * b:
            pass
        elif r >= 60 * b:
            pts -= 2
        elif r >= 50 * b:
            pts -= 4
        else:
            pts -= 6
    return pts
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: milestone exclusivity',
   [{'balls': 9, 'fours': 17, 'out': True, 'role': 'WK', 'runs': 100, 'sixes': 5}], 143),
  ('partial repair probe: milestone exclusivity',
   [{'balls': 1, 'fours': 3, 'out': True, 'role': 'BAT', 'runs': 96, 'sixes': 12}], 131),
  ('second regression', [{'balls': 60, 'fours': 15, 'out': False, 'role': 'AR', 'runs': 79, 'sixes': 0}],
   104),
  ('normal control 1', [{'balls': 1, 'fours': 2, 'out': False, 'role': 'BAT', 'runs': 30, 'sixes': 3}], 42),
  ('normal control 2', [{'balls': 46, 'fours': 0, 'out': False, 'role': 'BOWL', 'runs': 17, 'sixes': 0}], 17),
  ('normal control 3', [{'balls': 10, 'fours': 4, 'out': False, 'role': 'BOWL', 'runs': 16, 'sixes': 0}], 20),
  ('normal control 4', [{'balls': 9, 'fours': 0, 'out': True, 'role': 'BAT', 'runs': 0, 'sixes': 0}], -2)],
 [('regression: milestone exclusivity',
   [{'balls': 40, 'fours': 10, 'out': True, 'role': 'BAT', 'runs': 53, 'sixes': 2}], 77),
  ('partial repair probe: milestone exclusivity',
   [{'balls': 20, 'fours': 2, 'out': False, 'role': 'BAT', 'runs': 100, 'sixes': 4}], 132),
  ('second regression', [{'balls': 11, 'fours': 0, 'out': True, 'role': 'BOWL', 'runs': 50, 'sixes': 5}], 68),
  ('normal control 1', [{'balls': 20, 'fours': 0, 'out': True, 'role': 'BOWL', 'runs': 0, 'sixes': 0}], 0),
  ('normal control 2', [{'balls': 18, 'fours': 5, 'out': True, 'role': 'BAT', 'runs': 24, 'sixes': 0}], 31),
  ('normal control 3', [{'balls': 11, 'fours': 0, 'out': True, 'role': 'AR', 'runs': 30, 'sixes': 2}], 44),
  ('normal control 4', [{'balls': 9, 'fours': 5, 'out': False, 'role': 'BOWL', 'runs': 30, 'sixes': 0}], 39)],
 [('regression: milestone exclusivity',
   [{'balls': 51, 'fours': 15, 'out': True, 'role': 'BOWL', 'runs': 67, 'sixes': 1}], 92),
  ('partial repair probe: milestone exclusivity',
   [{'balls': 40, 'fours': 11, 'out': True, 'role': 'AR', 'runs': 69, 'sixes': 2}], 98),
  ('second regression', [{'balls': 47, 'fours': 6, 'out': True, 'role': 'AR', 'runs': 62, 'sixes': 5}], 88),
  ('normal control 1', [{'balls': 20, 'fours': 3, 'out': False, 'role': 'BOWL', 'runs': 17, 'sixes': 0}], 20),
  ('normal control 2', [{'balls': 23, 'fours': 4, 'out': False, 'role': 'WK', 'runs': 34, 'sixes': 0}], 44),
  ('normal control 3', [{'balls': 44, 'fours': 0, 'out': True, 'role': 'BOWL', 'runs': 34, 'sixes': 0}], 38),
  ('normal control 4', [{'balls': 20, 'fours': 6, 'out': False, 'role': 'AR', 'runs': 34, 'sixes': 1}], 50)],
 [('regression: milestone exclusivity',
   [{'balls': 23, 'fours': 3, 'out': True, 'role': 'AR', 'runs': 100, 'sixes': 3}], 131),
  ('partial repair probe: milestone exclusivity',
   [{'balls': 38, 'fours': 0, 'out': False, 'role': 'WK', 'runs': 58, 'sixes': 3}], 76),
  ('second regression', [{'balls': 51, 'fours': 3, 'out': False, 'role': 'BOWL', 'runs': 50, 'sixes': 1}],
   63),
  ('normal control 1', [{'balls': 11, 'fours': 6, 'out': False, 'role': 'BAT', 'runs': 29, 'sixes': 0}], 41),
  ('normal control 2', [{'balls': 19, 'fours': 3, 'out': False, 'role': 'BOWL', 'runs': 25, 'sixes': 1}], 30),
  ('normal control 3', [{'balls': 0, 'fours': 0, 'out': True, 'role': 'BOWL', 'runs': 0, 'sixes': 0}], 0),
  ('normal control 4', [{'balls': 20, 'fours': 1, 'out': True, 'role': 'BAT', 'runs': 34, 'sixes': 3}], 49)],
 [('regression: milestone exclusivity',
   [{'balls': 20, 'fours': 24, 'out': True, 'role': 'AR', 'runs': 100, 'sixes': 0}], 146),
  ('partial repair probe: milestone exclusivity',
   [{'balls': 10, 'fours': 18, 'out': True, 'role': 'WK', 'runs': 98, 'sixes': 0}], 130),
  ('second regression', [{'balls': 10, 'fours': 17, 'out': True, 'role': 'BOWL', 'runs': 100, 'sixes': 5}],
   143),
  ('normal control 1', [{'balls': 12, 'fours': 0, 'out': True, 'role': 'BOWL', 'runs': 16, 'sixes': 2}], 20),
  ('normal control 2', [{'balls': 9, 'fours': 0, 'out': False, 'role': 'BOWL', 'runs': 0, 'sixes': 0}], 0),
  ('normal control 3', [{'balls': 11, 'fours': 5, 'out': False, 'role': 'AR', 'runs': 34, 'sixes': 2}], 53),
  ('normal control 4', [{'balls': 47, 'fours': 1, 'out': False, 'role': 'WK', 'runs': 30, 'sixes': 0}], 33)]]
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 100-run innings scores 28 milestone points instead of 16.

Score a T20 batting innings: 1 per run, +1 per four, +2 per six; only the highest milestone bonus applies (30+ -> 4, 50+ -> 8, 100+ -> 16). A duck (-2) applies when the batter is out for 0 after facing at least one ball, except for BOWL-role players. Strike-rate bonus for non-BOWL players with at least 10 balls, using exact runs*100 vs balls: >170 +6, >150 +4, >=130 +2, >=70 0, >=60 -2, >=50 -4, below -6.

split: open-access


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

N = 1
observations = []
def solve(inn):
    pts = inn['runs'] + inn['fours'] + inn['sixes'] * 2
    if inn['runs'] >= 100:
        pts += 16
    elif inn['runs'] >= 50:
        pts += 8
    elif inn['runs'] >= 30:
        pts += 4
    if inn['out'] and inn['runs'] == 0 and inn['balls'] >= 1:
        pts -= 2
    if inn['balls'] >= 10 and inn['role'] != 'BOWL':
        r, b = inn['runs'] * 100, inn['balls']
        if r > 170 * b:
            pts += 6
        elif r > 150 * b:
            pts += 4
        elif r >= 130 * b:
            pts += 2
        elif r >= 70 * b:
            pass
        elif r >= 60 * b:
            pts -= 2
        elif r >= 50 * b:
            pts -= 4
        else:
            pts -= 6
    return pts
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: bowler duck exemption',
   [{'balls': 47, 'fours': 0, 'out': True, 'role': 'BOWL', 'runs': 0, 'sixes': 0}], 0),
  ('partial repair probe: bowler duck exemption',
   [{'balls': 22, 'fours': 0, 'out': True, 'role': 'AR', 'runs': 0, 'sixes': 0}], -8),
  ('second regression', [{'balls': 11, 'fours': 0, 'out': True, 'role': 'BOWL', 'runs': 0, 'sixes': 0}], 0),
  ('normal control 1', [{'balls': 41, 'fours': 14, 'out': True, 'role': 'AR', 'runs': 70, 'sixes': 0}], 98),
  ('normal control 2', [{'balls': 1, 'fours': 0, 'out': True, 'role': 'BOWL', 'runs': 29, 'sixes': 3}], 35),
  ('normal control 3', [{'balls': 20, 'fours': 0, 'out': True, 'role': 'BAT', 'runs': 50, 'sixes': 2}], 68),
  ('normal control 4', [{'balls': 47, 'fours': 11, 'out': False, 'role': 'BAT', 'runs': 50, 'sixes': 1}],
   71)],
 [('regression: bowler duck exemption',
   [{'balls': 1, 'fours': 0, 'out': True, 'role': 'BOWL', 'runs': 0, 'sixes': 0}], 0),
  ('partial repair probe: bowler duck exemption',
   [{'balls': 23, 'fours': 0, 'out': True, 'role': 'AR', 'runs': 0, 'sixes': 0}], -8),
  ('second regression', [{'balls': 47, 'fours': 0, 'out': True, 'role': 'AR', 'runs': 0, 'sixes': 0}], -8),
  ('normal control 1', [{'balls': 47, 'fours': 3, 'out': False, 'role': 'BOWL', 'runs': 30, 'sixes': 0}], 37),
  ('normal control 2', [{'balls': 10, 'fours': 8, 'out': False, 'role': 'BAT', 'runs': 34, 'sixes': 0}], 52),
  ('normal control 3', [{'balls': 10, 'fours': 2, 'out': True, 'role': 'AR', 'runs': 29, 'sixes': 0}], 37),
  ('normal control 4', [{'balls': 23, 'fours': 0, 'out': False, 'role': 'WK', 'runs': 0, 'sixes': 0}], -6)],
 [('regression: bowler duck exemption',
   [{'balls': 9, 'fours': 0, 'out': True, 'role': 'BOWL', 'runs': 0, 'sixes': 0}], 0),
  ('partial repair probe: bowler duck exemption',
   [{'balls': 47, 'fours': 0, 'out': True, 'role': 'AR', 'runs': 0, 'sixes': 0}], -8),
  ('second regression', [{'balls': 20, 'fours': 0, 'out': True, 'role': 'BOWL', 'runs': 0, 'sixes': 0}], 0),
  ('normal control 1', [{'balls': 34, 'fours': 14, 'out': True, 'role': 'BAT', 'runs': 58, 'sixes': 0}], 86),
  ('normal control 2', [{'balls': 53, 'fours': 3, 'out': False, 'role': 'AR', 'runs': 91, 'sixes': 1}], 110),
  ('normal control 3', [{'balls': 47, 'fours': 0, 'out': True, 'role': 'BAT', 'runs': 0, 'sixes': 0}], -8),
  ('normal control 4', [{'balls': 47, 'fours': 5, 'out': True, 'role': 'BOWL', 'runs': 71, 'sixes': 8}],
   100)],
 [('regression: bowler duck exemption',
   [{'balls': 1, 'fours': 0, 'out': True, 'role': 'BOWL', 'runs': 0, 'sixes': 0}], 0),
  ('partial repair probe: bowler duck exemption',
   [{'balls': 10, 'fours': 0, 'out': True, 'role': 'AR', 'runs': 0, 'sixes': 0}], -8),
  ('second regression', [{'balls': 20, 'fours': 0, 'out': True, 'role': 'AR', 'runs': 0, 'sixes': 0}], -8),
  ('normal control 1', [{'balls': 10, 'fours': 1, 'out': True, 'role': 'BAT', 'runs': 29, 'sixes': 4}], 44),
  ('normal control 2', [{'balls': 1, 'fours': 1, 'out': True, 'role': 'AR', 'runs': 100, 'sixes': 2}], 121),
  ('normal control 3', [{'balls': 1, 'fours': 0, 'out': False, 'role': 'WK', 'runs': 30, 'sixes': 3}], 40),
  ('normal control 4', [{'balls': 21, 'fours': 7, 'out': False, 'role': 'WK', 'runs': 28, 'sixes': 0}], 37)],
 [('regression: bowler duck exemption',
   [{'balls': 9, 'fours': 0, 'out': True, 'role': 'BOWL', 'runs': 0, 'sixes': 0}], 0),
  ('partial repair probe: bowler duck exemption',
   [{'balls': 9, 'fours': 0, 'out': True, 'role': 'AR', 'runs': 0, 'sixes': 0}], -2),
  ('second regression', [{'balls': 20, 'fours': 0, 'out': True, 'role': 'AR', 'runs': 0, 'sixes': 0}], -8),
  ('normal control 1', [{'balls': 23, 'fours': 11, 'out': False, 'role': 'BAT', 'runs': 51, 'sixes': 1}], 78),
  ('normal control 2', [{'balls': 47, 'fours': 18, 'out': True, 'role': 'BOWL', 'runs': 100, 'sixes': 4}],
   142),
  ('normal control 3', [{'balls': 9, 'fours': 0, 'out': False, 'role': 'AR', 'runs': 30, 'sixes': 5}], 44),
  ('normal control 4', [{'balls': 40, 'fours': 5, 'out': False, 'role': 'WK', 'runs': 34, 'sixes': 2}], 47)]]
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(inn):
    pts = inn['runs'] + inn['fours'] + inn['sixes'] * 2
    if inn['runs'] >= 100:
        pts += 16
    elif inn['runs'] >= 50:
        pts += 8
    elif inn['runs'] >= 30:
        pts += 4
    if inn['out'] and inn['runs'] == 0 and inn['balls'] >= 1 and inn['role'] not in ('BOWL', 'AR'):
        pts -= 2
    if inn['balls'] >= 10 and inn['role'] != 'BOWL':
        r, b = inn['runs'] * 100, inn['balls']
        if r > 170 * b:
            pts += 6
        elif r > 150 * b:
            pts += 4
        elif r >= 130 * b:
            pts += 2
        elif r >= 70 * b:
            pass
        elif r >= 60 * b:
            pts -= 2
        elif r >= 50 * b:
            pts -= 4
        else:
            pts -= 6
    return pts
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: bowler duck exemption',
   [{'balls': 47, 'fours': 0, 'out': True, 'role': 'BOWL', 'runs': 0, 'sixes': 0}], 0),
  ('partial repair probe: bowler duck exemption',
   [{'balls': 22, 'fours': 0, 'out': True, 'role': 'AR', 'runs': 0, 'sixes': 0}], -8),
  ('second regression', [{'balls': 11, 'fours': 0, 'out': True, 'role': 'BOWL', 'runs': 0, 'sixes': 0}], 0),
  ('normal control 1', [{'balls': 41, 'fours': 14, 'out': True, 'role': 'AR', 'runs': 70, 'sixes': 0}], 98),
  ('normal control 2', [{'balls': 1, 'fours': 0, 'out': True, 'role': 'BOWL', 'runs': 29, 'sixes': 3}], 35),
  ('normal control 3', [{'balls': 20, 'fours': 0, 'out': True, 'role': 'BAT', 'runs': 50, 'sixes': 2}], 68),
  ('normal control 4', [{'balls': 47, 'fours': 11, 'out': False, 'role': 'BAT', 'runs': 50, 'sixes': 1}],
   71)],
 [('regression: bowler duck exemption',
   [{'balls': 1, 'fours': 0, 'out': True, 'role': 'BOWL', 'runs': 0, 'sixes': 0}], 0),
  ('partial repair probe: bowler duck exemption',
   [{'balls': 23, 'fours': 0, 'out': True, 'role': 'AR', 'runs': 0, 'sixes': 0}], -8),
  ('second regression', [{'balls': 47, 'fours': 0, 'out': True, 'role': 'AR', 'runs': 0, 'sixes': 0}], -8),
  ('normal control 1', [{'balls': 47, 'fours': 3, 'out': False, 'role': 'BOWL', 'runs': 30, 'sixes': 0}], 37),
  ('normal control 2', [{'balls': 10, 'fours': 8, 'out': False, 'role': 'BAT', 'runs': 34, 'sixes': 0}], 52),
  ('normal control 3', [{'balls': 10, 'fours': 2, 'out': True, 'role': 'AR', 'runs': 29, 'sixes': 0}], 37),
  ('normal control 4', [{'balls': 23, 'fours': 0, 'out': False, 'role': 'WK', 'runs': 0, 'sixes': 0}], -6)],
 [('regression: bowler duck exemption',
   [{'balls': 9, 'fours': 0, 'out': True, 'role': 'BOWL', 'runs': 0, 'sixes': 0}], 0),
  ('partial repair probe: bowler duck exemption',
   [{'balls': 47, 'fours': 0, 'out': True, 'role': 'AR', 'runs': 0, 'sixes': 0}], -8),
  ('second regression', [{'balls': 20, 'fours': 0, 'out': True, 'role': 'BOWL', 'runs': 0, 'sixes': 0}], 0),
  ('normal control 1', [{'balls': 34, 'fours': 14, 'out': True, 'role': 'BAT', 'runs': 58, 'sixes': 0}], 86),
  ('normal control 2', [{'balls': 53, 'fours': 3, 'out': False, 'role': 'AR', 'runs': 91, 'sixes': 1}], 110),
  ('normal control 3', [{'balls': 47, 'fours': 0, 'out': True, 'role': 'BAT', 'runs': 0, 'sixes': 0}], -8),
  ('normal control 4', [{'balls': 47, 'fours': 5, 'out': True, 'role': 'BOWL', 'runs': 71, 'sixes': 8}],
   100)],
 [('regression: bowler duck exemption',
   [{'balls': 1, 'fours': 0, 'out': True, 'role': 'BOWL', 'runs': 0, 'sixes': 0}], 0),
  ('partial repair probe: bowler duck exemption',
   [{'balls': 10, 'fours': 0, 'out': True, 'role': 'AR', 'runs': 0, 'sixes': 0}], -8),
  ('second regression', [{'balls': 20, 'fours': 0, 'out': True, 'role': 'AR', 'runs': 0, 'sixes': 0}], -8),
  ('normal control 1', [{'balls': 10, 'fours': 1, 'out': True, 'role': 'BAT', 'runs': 29, 'sixes': 4}], 44),
  ('normal control 2', [{'balls': 1, 'fours': 1, 'out': True, 'role': 'AR', 'runs': 100, 'sixes': 2}], 121),
  ('normal control 3', [{'balls': 1, 'fours': 0, 'out': False, 'role': 'WK', 'runs': 30, 'sixes': 3}], 40),
  ('normal control 4', [{'balls': 21, 'fours': 7, 'out': False, 'role': 'WK', 'runs': 28, 'sixes': 0}], 37)],
 [('regression: bowler duck exemption',
   [{'balls': 9, 'fours': 0, 'out': True, 'role': 'BOWL', 'runs': 0, 'sixes': 0}], 0),
  ('partial repair probe: bowler duck exemption',
   [{'balls': 9, 'fours': 0, 'out': True, 'role': 'AR', 'runs': 0, 'sixes': 0}], -2),
  ('second regression', [{'balls': 20, 'fours': 0, 'out': True, 'role': 'AR', 'runs': 0, 'sixes': 0}], -8),
  ('normal control 1', [{'balls': 23, 'fours': 11, 'out': False, 'role': 'BAT', 'runs': 51, 'sixes': 1}], 78),
  ('normal control 2', [{'balls': 47, 'fours': 18, 'out': True, 'role': 'BOWL', 'runs': 100, 'sixes': 4}],
   142),
  ('normal control 3', [{'balls': 9, 'fours': 0, 'out': False, 'role': 'AR', 'runs': 30, 'sixes': 5}], 44),
  ('normal control 4', [{'balls': 40, 'fours': 5, 'out': False, 'role': 'WK', 'runs': 34, 'sixes': 2}], 47)]]
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 number-eleven bowler out first ball loses 2 points.

Score a T20 batting innings: 1 per run, +1 per four, +2 per six; only the highest milestone bonus applies (30+ -> 4, 50+ -> 8, 100+ -> 16). A duck (-2) applies when the batter is out for 0 after facing at least one ball, except for BOWL-role players. Strike-rate bonus for non-BOWL players with at least 10 balls, using exact runs*100 vs balls: >170 +6, >150 +4, >=130 +2, >=70 0, >=60 -2, >=50 -4, below -6.

split: open-access


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

N = 1
observations = []
def solve(inn):
    pts = inn['runs'] + inn['fours'] + inn['sixes'] * 2
    if inn['runs'] >= 100:
        pts += 16
    elif inn['runs'] >= 50:
        pts += 8
    elif inn['runs'] >= 30:
        pts += 4
    if inn['runs'] == 0 and inn['balls'] >= 1 and inn['role'] != 'BOWL':
        pts -= 2
    if inn['balls'] >= 10 and inn['role'] != 'BOWL':
        r, b = inn['runs'] * 100, inn['balls']
        if r > 170 * b:
            pts += 6
        elif r > 150 * b:
            pts += 4
        elif r >= 130 * b:
            pts += 2
        elif r >= 70 * b:
            pass
        elif r >= 60 * b:
            pts -= 2
        elif r >= 50 * b:
            pts -= 4
        else:
            pts -= 6
    return pts
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: not-out duck',
   [{'balls': 47, 'fours': 0, 'out': False, 'role': 'BAT', 'runs': 0, 'sixes': 0}], -6),
  ('partial repair probe: not-out duck',
   [{'balls': 26, 'fours': 0, 'out': False, 'role': 'AR', 'runs': 0, 'sixes': 0}], -6),
  ('second regression', [{'balls': 34, 'fours': 0, 'out': False, 'role': 'BAT', 'runs': 0, 'sixes': 0}], -6),
  ('normal control 1', [{'balls': 18, 'fours': 0, 'out': True, 'role': 'WK', 'runs': 31, 'sixes': 5}], 51),
  ('normal control 2', [{'balls': 9, 'fours': 6, 'out': True, 'role': 'AR', 'runs': 51, 'sixes': 4}], 73),
  ('normal control 3', [{'balls': 0, 'fours': 0, 'out': True, 'role': 'BOWL', 'runs': 0, 'sixes': 0}], 0),
  ('normal control 4', [{'balls': 0, 'fours': 0, 'out': True, 'role': 'BAT', 'runs': 0, 'sixes': 0}], 0)],
 [('regression: not-out duck',
   [{'balls': 10, 'fours': 0, 'out': False, 'role': 'BAT', 'runs': 0, 'sixes': 0}], -6),
  ('partial repair probe: not-out duck',
   [{'balls': 23, 'fours': 0, 'out': False, 'role': 'AR', 'runs': 0, 'sixes': 0}], -6),
  ('second regression', [{'balls': 10, 'fours': 0, 'out': False, 'role': 'AR', 'runs': 0, 'sixes': 0}], -6),
  ('normal control 1', [{'balls': 1, 'fours': 6, 'out': True, 'role': 'AR', 'runs': 34, 'sixes': 0}], 44),
  ('normal control 2', [{'balls': 9, 'fours': 8, 'out': False, 'role': 'WK', 'runs': 34, 'sixes': 0}], 46),
  ('normal control 3', [{'balls': 67, 'fours': 7, 'out': False, 'role': 'BOWL', 'runs': 30, 'sixes': 0}], 41),
  ('normal control 4', [{'balls': 47, 'fours': 12, 'out': True, 'role': 'AR', 'runs': 51, 'sixes': 0}], 71)],
 [('regression: not-out duck', [{'balls': 10, 'fours': 0, 'out': False, 'role': 'WK', 'runs': 0, 'sixes': 0}],
   -6),
  ('partial repair probe: not-out duck',
   [{'balls': 10, 'fours': 0, 'out': False, 'role': 'AR', 'runs': 0, 'sixes': 0}], -6),
  ('second regression', [{'balls': 23, 'fours': 0, 'out': False, 'role': 'AR', 'runs': 0, 'sixes': 0}], -6),
  ('normal control 1', [{'balls': 26, 'fours': 2, 'out': False, 'role': 'BAT', 'runs': 40, 'sixes': 0}], 50),
  ('normal control 2', [{'balls': 39, 'fours': 6, 'out': True, 'role': 'AR', 'runs': 59, 'sixes': 3}], 83),
  ('normal control 3', [{'balls': 10, 'fours': 1, 'out': False, 'role': 'BAT', 'runs': 34, 'sixes': 5}], 55),
  ('normal control 4', [{'balls': 47, 'fours': 7, 'out': True, 'role': 'BOWL', 'runs': 80, 'sixes': 1}], 97)],
 [('regression: not-out duck',
   [{'balls': 23, 'fours': 0, 'out': False, 'role': 'BAT', 'runs': 0, 'sixes': 0}], -6),
  ('partial repair probe: not-out duck',
   [{'balls': 11, 'fours': 0, 'out': False, 'role': 'WK', 'runs': 0, 'sixes': 0}], -6),
  ('second regression', [{'balls': 9, 'fours': 0, 'out': False, 'role': 'AR', 'runs': 0, 'sixes': 0}], 0),
  ('normal control 1', [{'balls': 11, 'fours': 0, 'out': True, 'role': 'BAT', 'runs': 50, 'sixes': 5}], 74),
  ('normal control 2', [{'balls': 1, 'fours': 0, 'out': True, 'role': 'BAT', 'runs': 0, 'sixes': 0}], -2),
  ('normal control 3', [{'balls': 47, 'fours': 8, 'out': False, 'role': 'BAT', 'runs': 51, 'sixes': 2}], 71),
  ('normal control 4', [{'balls': 11, 'fours': 4, 'out': False, 'role': 'AR', 'runs': 17, 'sixes': 0}], 25)],
 [('regression: not-out duck', [{'balls': 16, 'fours': 0, 'out': False, 'role': 'WK', 'runs': 0, 'sixes': 0}],
   -6),
  ('partial repair probe: not-out duck',
   [{'balls': 10, 'fours': 0, 'out': False, 'role': 'BAT', 'runs': 0, 'sixes': 0}], -6),
  ('second regression', [{'balls': 14, 'fours': 0, 'out': False, 'role': 'WK', 'runs': 0, 'sixes': 0}], -6),
  ('normal control 1', [{'balls': 10, 'fours': 14, 'out': True, 'role': 'WK', 'runs': 92, 'sixes': 0}], 120),
  ('normal control 2', [{'balls': 1, 'fours': 4, 'out': False, 'role': 'BAT', 'runs': 29, 'sixes': 1}], 35),
  ('normal control 3', [{'balls': 55, 'fours': 7, 'out': True, 'role': 'AR', 'runs': 34, 'sixes': 0}], 43),
  ('normal control 4', [{'balls': 27, 'fours': 7, 'out': False, 'role': 'WK', 'runs': 36, 'sixes': 1}], 51)]]
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(inn):
    pts = inn['runs'] + inn['fours'] + inn['sixes'] * 2
    if inn['runs'] >= 100:
        pts += 16
    elif inn['runs'] >= 50:
        pts += 8
    elif inn['runs'] >= 30:
        pts += 4
    if (inn['out'] or inn['balls'] > 0) and inn['runs'] == 0 and inn['balls'] >= 1 and inn['role'] != 'BOWL':
        pts -= 2
    if inn['balls'] >= 10 and inn['role'] != 'BOWL':
        r, b = inn['runs'] * 100, inn['balls']
        if r > 170 * b:
            pts += 6
        elif r > 150 * b:
            pts += 4
        elif r >= 130 * b:
            pts += 2
        elif r >= 70 * b:
            pass
        elif r >= 60 * b:
            pts -= 2
        elif r >= 50 * b:
            pts -= 4
        else:
            pts -= 6
    return pts
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: not-out duck',
   [{'balls': 47, 'fours': 0, 'out': False, 'role': 'BAT', 'runs': 0, 'sixes': 0}], -6),
  ('partial repair probe: not-out duck',
   [{'balls': 26, 'fours': 0, 'out': False, 'role': 'AR', 'runs': 0, 'sixes': 0}], -6),
  ('second regression', [{'balls': 34, 'fours': 0, 'out': False, 'role': 'BAT', 'runs': 0, 'sixes': 0}], -6),
  ('normal control 1', [{'balls': 18, 'fours': 0, 'out': True, 'role': 'WK', 'runs': 31, 'sixes': 5}], 51),
  ('normal control 2', [{'balls': 9, 'fours': 6, 'out': True, 'role': 'AR', 'runs': 51, 'sixes': 4}], 73),
  ('normal control 3', [{'balls': 0, 'fours': 0, 'out': True, 'role': 'BOWL', 'runs': 0, 'sixes': 0}], 0),
  ('normal control 4', [{'balls': 0, 'fours': 0, 'out': True, 'role': 'BAT', 'runs': 0, 'sixes': 0}], 0)],
 [('regression: not-out duck',
   [{'balls': 10, 'fours': 0, 'out': False, 'role': 'BAT', 'runs': 0, 'sixes': 0}], -6),
  ('partial repair probe: not-out duck',
   [{'balls': 23, 'fours': 0, 'out': False, 'role': 'AR', 'runs': 0, 'sixes': 0}], -6),
  ('second regression', [{'balls': 10, 'fours': 0, 'out': False, 'role': 'AR', 'runs': 0, 'sixes': 0}], -6),
  ('normal control 1', [{'balls': 1, 'fours': 6, 'out': True, 'role': 'AR', 'runs': 34, 'sixes': 0}], 44),
  ('normal control 2', [{'balls': 9, 'fours': 8, 'out': False, 'role': 'WK', 'runs': 34, 'sixes': 0}], 46),
  ('normal control 3', [{'balls': 67, 'fours': 7, 'out': False, 'role': 'BOWL', 'runs': 30, 'sixes': 0}], 41),
  ('normal control 4', [{'balls': 47, 'fours': 12, 'out': True, 'role': 'AR', 'runs': 51, 'sixes': 0}], 71)],
 [('regression: not-out duck', [{'balls': 10, 'fours': 0, 'out': False, 'role': 'WK', 'runs': 0, 'sixes': 0}],
   -6),
  ('partial repair probe: not-out duck',
   [{'balls': 10, 'fours': 0, 'out': False, 'role': 'AR', 'runs': 0, 'sixes': 0}], -6),
  ('second regression', [{'balls': 23, 'fours': 0, 'out': False, 'role': 'AR', 'runs': 0, 'sixes': 0}], -6),
  ('normal control 1', [{'balls': 26, 'fours': 2, 'out': False, 'role': 'BAT', 'runs': 40, 'sixes': 0}], 50),
  ('normal control 2', [{'balls': 39, 'fours': 6, 'out': True, 'role': 'AR', 'runs': 59, 'sixes': 3}], 83),
  ('normal control 3', [{'balls': 10, 'fours': 1, 'out': False, 'role': 'BAT', 'runs': 34, 'sixes': 5}], 55),
  ('normal control 4', [{'balls': 47, 'fours': 7, 'out': True, 'role': 'BOWL', 'runs': 80, 'sixes': 1}], 97)],
 [('regression: not-out duck',
   [{'balls': 23, 'fours': 0, 'out': False, 'role': 'BAT', 'runs': 0, 'sixes': 0}], -6),
  ('partial repair probe: not-out duck',
   [{'balls': 11, 'fours': 0, 'out': False, 'role': 'WK', 'runs': 0, 'sixes': 0}], -6),
  ('second regression', [{'balls': 9, 'fours': 0, 'out': False, 'role': 'AR', 'runs': 0, 'sixes': 0}], 0),
  ('normal control 1', [{'balls': 11, 'fours': 0, 'out': True, 'role': 'BAT', 'runs': 50, 'sixes': 5}], 74),
  ('normal control 2', [{'balls': 1, 'fours': 0, 'out': True, 'role': 'BAT', 'runs': 0, 'sixes': 0}], -2),
  ('normal control 3', [{'balls': 47, 'fours': 8, 'out': False, 'role': 'BAT', 'runs': 51, 'sixes': 2}], 71),
  ('normal control 4', [{'balls': 11, 'fours': 4, 'out': False, 'role': 'AR', 'runs': 17, 'sixes': 0}], 25)],
 [('regression: not-out duck', [{'balls': 16, 'fours': 0, 'out': False, 'role': 'WK', 'runs': 0, 'sixes': 0}],
   -6),
  ('partial repair probe: not-out duck',
   [{'balls': 10, 'fours': 0, 'out': False, 'role': 'BAT', 'runs': 0, 'sixes': 0}], -6),
  ('second regression', [{'balls': 14, 'fours': 0, 'out': False, 'role': 'WK', 'runs': 0, 'sixes': 0}], -6),
  ('normal control 1', [{'balls': 10, 'fours': 14, 'out': True, 'role': 'WK', 'runs': 92, 'sixes': 0}], 120),
  ('normal control 2', [{'balls': 1, 'fours': 4, 'out': False, 'role': 'BAT', 'runs': 29, 'sixes': 1}], 35),
  ('normal control 3', [{'balls': 55, 'fours': 7, 'out': True, 'role': 'AR', 'runs': 34, 'sixes': 0}], 43),
  ('normal control 4', [{'balls': 27, 'fours': 7, 'out': False, 'role': 'WK', 'runs': 36, 'sixes': 1}], 51)]]
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 batter not out on 0 at the end of the innings is docked 2 points.

Score a T20 batting innings: 1 per run, +1 per four, +2 per six; only the highest milestone bonus applies (30+ -> 4, 50+ -> 8, 100+ -> 16). A duck (-2) applies when the batter is out for 0 after facing at least one ball, except for BOWL-role players. Strike-rate bonus for non-BOWL players with at least 10 balls, using exact runs*100 vs balls: >170 +6, >150 +4, >=130 +2, >=70 0, >=60 -2, >=50 -4, below -6.

split: open-access


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

N = 1
observations = []
def solve(inn):
    pts = inn['runs'] + inn['fours'] + inn['sixes'] * 2
    if inn['runs'] >= 100:
        pts += 16
    elif inn['runs'] >= 50:
        pts += 8
    elif inn['runs'] >= 30:
        pts += 4
    if inn['out'] and inn['runs'] == 0 and inn['balls'] >= 1 and inn['role'] != 'BOWL':
        pts -= 2
    if inn['balls'] > 10 and inn['role'] != 'BOWL':
        r, b = inn['runs'] * 100, inn['balls']
        if r > 170 * b:
            pts += 6
        elif r > 150 * b:
            pts += 4
        elif r >= 130 * b:
            pts += 2
        elif r >= 70 * b:
            pass
        elif r >= 60 * b:
            pts -= 2
        elif r >= 50 * b:
            pts -= 4
        else:
            pts -= 6
    return pts
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: strike-rate eligibility',
   [{'balls': 10, 'fours': 0, 'out': True, 'role': 'AR', 'runs': 17, 'sixes': 2}], 25),
  ('partial repair probe: strike-rate eligibility',
   [{'balls': 11, 'fours': 0, 'out': True, 'role': 'BOWL', 'runs': 0, 'sixes': 0}], 0),
  ('second regression', [{'balls': 35, 'fours': 1, 'out': True, 'role': 'BOWL', 'runs': 60, 'sixes': 2}], 73),
  ('normal control 1', [{'balls': 33, 'fours': 9, 'out': False, 'role': 'BAT', 'runs': 57, 'sixes': 3}], 86),
  ('normal control 2', [{'balls': 38, 'fours': 16, 'out': True, 'role': 'WK', 'runs': 65, 'sixes': 0}], 95),
  ('normal control 3', [{'balls': 0, 'fours': 0, 'out': True, 'role': 'WK', 'runs': 0, 'sixes': 0}], 0),
  ('normal control 4', [{'balls': 1, 'fours': 6, 'out': True, 'role': 'BOWL', 'runs': 30, 'sixes': 0}], 40)],
 [('regression: strike-rate eligibility',
   [{'balls': 10, 'fours': 5, 'out': True, 'role': 'BAT', 'runs': 29, 'sixes': 0}], 40),
  ('partial repair probe: strike-rate eligibility',
   [{'balls': 11, 'fours': 3, 'out': True, 'role': 'BOWL', 'runs': 15, 'sixes': 0}], 18),
  ('second regression', [{'balls': 47, 'fours': 10, 'out': False, 'role': 'BOWL', 'runs': 83, 'sixes': 3}],
   107),
  ('normal control 1', [{'balls': 36, 'fours': 6, 'out': True, 'role': 'BOWL', 'runs': 34, 'sixes': 0}], 44),
  ('normal control 2', [{'balls': 9, 'fours': 0, 'out': False, 'role': 'BOWL', 'runs': 17, 'sixes': 1}], 19),
  ('normal control 3', [{'balls': 35, 'fours': 7, 'out': False, 'role': 'AR', 'runs': 46, 'sixes': 2}], 63),
  ('normal control 4', [{'balls': 0, 'fours': 0, 'out': False, 'role': 'BAT', 'runs': 0, 'sixes': 0}], 0)],
 [('regression: strike-rate eligibility',
   [{'balls': 10, 'fours': 5, 'out': False, 'role': 'BAT', 'runs': 51, 'sixes': 2}], 74),
  ('partial repair probe: strike-rate eligibility',
   [{'balls': 37, 'fours': 3, 'out': False, 'role': 'BOWL', 'runs': 52, 'sixes': 0}], 63),
  ('second regression', [{'balls': 47, 'fours': 5, 'out': True, 'role': 'BOWL', 'runs': 94, 'sixes': 9}],
   125),
  ('normal control 1', [{'balls': 1, 'fours': 12, 'out': False, 'role': 'BOWL', 'runs': 51, 'sixes': 0}], 71),
  ('normal control 2', [{'balls': 11, 'fours': 2, 'out': True, 'role': 'AR', 'runs': 17, 'sixes': 0}], 23),
  ('normal control 3', [{'balls': 32, 'fours': 10, 'out': True, 'role': 'AR', 'runs': 70, 'sixes': 0}], 94),
  ('normal control 4', [{'balls': 9, 'fours': 0, 'out': False, 'role': 'WK', 'runs': 30, 'sixes': 5}], 44)],
 [('regression: strike-rate eligibility',
   [{'balls': 10, 'fours': 18, 'out': True, 'role': 'BAT', 'runs': 88, 'sixes': 2}], 124),
  ('partial repair probe: strike-rate eligibility',
   [{'balls': 20, 'fours': 3, 'out': True, 'role': 'BOWL', 'runs': 30, 'sixes': 1}], 39),
  ('second regression', [{'balls': 13, 'fours': 4, 'out': True, 'role': 'BOWL', 'runs': 23, 'sixes': 0}], 27),
  ('normal control 1', [{'balls': 11, 'fours': 3, 'out': True, 'role': 'WK', 'runs': 19, 'sixes': 1}], 30),
  ('normal control 2', [{'balls': 0, 'fours': 0, 'out': False, 'role': 'BAT', 'runs': 0, 'sixes': 0}], 0),
  ('normal control 3', [{'balls': 47, 'fours': 0, 'out': True, 'role': 'AR', 'runs': 29, 'sixes': 4}], 35),
  ('normal control 4', [{'balls': 1, 'fours': 0, 'out': True, 'role': 'BAT', 'runs': 0, 'sixes': 0}], -2)],
 [('regression: strike-rate eligibility',
   [{'balls': 10, 'fours': 16, 'out': True, 'role': 'AR', 'runs': 100, 'sixes': 5}], 148),
  ('partial repair probe: strike-rate eligibility',
   [{'balls': 20, 'fours': 7, 'out': True, 'role': 'BOWL', 'runs': 29, 'sixes': 0}], 36),
  ('second regression', [{'balls': 10, 'fours': 9, 'out': True, 'role': 'AR', 'runs': 51, 'sixes': 1}], 76),
  ('normal control 1', [{'balls': 11, 'fours': 3, 'out': True, 'role': 'WK', 'runs': 33, 'sixes': 3}], 52),
  ('normal control 2', [{'balls': 1, 'fours': 4, 'out': True, 'role': 'WK', 'runs': 29, 'sixes': 2}], 37),
  ('normal control 3', [{'balls': 20, 'fours': 0, 'out': True, 'role': 'AR', 'runs': 0, 'sixes': 0}], -8),
  ('normal control 4', [{'balls': 23, 'fours': 11, 'out': False, 'role': 'BAT', 'runs': 100, 'sixes': 8}],
   149)]]
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(inn):
    pts = inn['runs'] + inn['fours'] + inn['sixes'] * 2
    if inn['runs'] >= 100:
        pts += 16
    elif inn['runs'] >= 50:
        pts += 8
    elif inn['runs'] >= 30:
        pts += 4
    if inn['out'] and inn['runs'] == 0 and inn['balls'] >= 1 and inn['role'] != 'BOWL':
        pts -= 2
    if inn['balls'] >= 10:
        r, b = inn['runs'] * 100, inn['balls']
        if r > 170 * b:
            pts += 6
        elif r > 150 * b:
            pts += 4
        elif r >= 130 * b:
            pts += 2
        elif r >= 70 * b:
            pass
        elif r >= 60 * b:
            pts -= 2
        elif r >= 50 * b:
            pts -= 4
        else:
            pts -= 6
    return pts
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: strike-rate eligibility',
   [{'balls': 10, 'fours': 0, 'out': True, 'role': 'AR', 'runs': 17, 'sixes': 2}], 25),
  ('partial repair probe: strike-rate eligibility',
   [{'balls': 11, 'fours': 0, 'out': True, 'role': 'BOWL', 'runs': 0, 'sixes': 0}], 0),
  ('second regression', [{'balls': 35, 'fours': 1, 'out': True, 'role': 'BOWL', 'runs': 60, 'sixes': 2}], 73),
  ('normal control 1', [{'balls': 33, 'fours': 9, 'out': False, 'role': 'BAT', 'runs': 57, 'sixes': 3}], 86),
  ('normal control 2', [{'balls': 38, 'fours': 16, 'out': True, 'role': 'WK', 'runs': 65, 'sixes': 0}], 95),
  ('normal control 3', [{'balls': 0, 'fours': 0, 'out': True, 'role': 'WK', 'runs': 0, 'sixes': 0}], 0),
  ('normal control 4', [{'balls': 1, 'fours': 6, 'out': True, 'role': 'BOWL', 'runs': 30, 'sixes': 0}], 40)],
 [('regression: strike-rate eligibility',
   [{'balls': 10, 'fours': 5, 'out': True, 'role': 'BAT', 'runs': 29, 'sixes': 0}], 40),
  ('partial repair probe: strike-rate eligibility',
   [{'balls': 11, 'fours': 3, 'out': True, 'role': 'BOWL', 'runs': 15, 'sixes': 0}], 18),
  ('second regression', [{'balls': 47, 'fours': 10, 'out': False, 'role': 'BOWL', 'runs': 83, 'sixes': 3}],
   107),
  ('normal control 1', [{'balls': 36, 'fours': 6, 'out': True, 'role': 'BOWL', 'runs': 34, 'sixes': 0}], 44),
  ('normal control 2', [{'balls': 9, 'fours': 0, 'out': False, 'role': 'BOWL', 'runs': 17, 'sixes': 1}], 19),
  ('normal control 3', [{'balls': 35, 'fours': 7, 'out': False, 'role': 'AR', 'runs': 46, 'sixes': 2}], 63),
  ('normal control 4', [{'balls': 0, 'fours': 0, 'out': False, 'role': 'BAT', 'runs': 0, 'sixes': 0}], 0)],
 [('regression: strike-rate eligibility',
   [{'balls': 10, 'fours': 5, 'out': False, 'role': 'BAT', 'runs': 51, 'sixes': 2}], 74),
  ('partial repair probe: strike-rate eligibility',
   [{'balls': 37, 'fours': 3, 'out': False, 'role': 'BOWL', 'runs': 52, 'sixes': 0}], 63),
  ('second regression', [{'balls': 47, 'fours': 5, 'out': True, 'role': 'BOWL', 'runs': 94, 'sixes': 9}],
   125),
  ('normal control 1', [{'balls': 1, 'fours': 12, 'out': False, 'role': 'BOWL', 'runs': 51, 'sixes': 0}], 71),
  ('normal control 2', [{'balls': 11, 'fours': 2, 'out': True, 'role': 'AR', 'runs': 17, 'sixes': 0}], 23),
  ('normal control 3', [{'balls': 32, 'fours': 10, 'out': True, 'role': 'AR', 'runs': 70, 'sixes': 0}], 94),
  ('normal control 4', [{'balls': 9, 'fours': 0, 'out': False, 'role': 'WK', 'runs': 30, 'sixes': 5}], 44)],
 [('regression: strike-rate eligibility',
   [{'balls': 10, 'fours': 18, 'out': True, 'role': 'BAT', 'runs': 88, 'sixes': 2}], 124),
  ('partial repair probe: strike-rate eligibility',
   [{'balls': 20, 'fours': 3, 'out': True, 'role': 'BOWL', 'runs': 30, 'sixes': 1}], 39),
  ('second regression', [{'balls': 13, 'fours': 4, 'out': True, 'role': 'BOWL', 'runs': 23, 'sixes': 0}], 27),
  ('normal control 1', [{'balls': 11, 'fours': 3, 'out': True, 'role': 'WK', 'runs': 19, 'sixes': 1}], 30),
  ('normal control 2', [{'balls': 0, 'fours': 0, 'out': False, 'role': 'BAT', 'runs': 0, 'sixes': 0}], 0),
  ('normal control 3', [{'balls': 47, 'fours': 0, 'out': True, 'role': 'AR', 'runs': 29, 'sixes': 4}], 35),
  ('normal control 4', [{'balls': 1, 'fours': 0, 'out': True, 'role': 'BAT', 'runs': 0, 'sixes': 0}], -2)],
 [('regression: strike-rate eligibility',
   [{'balls': 10, 'fours': 16, 'out': True, 'role': 'AR', 'runs': 100, 'sixes': 5}], 148),
  ('partial repair probe: strike-rate eligibility',
   [{'balls': 20, 'fours': 7, 'out': True, 'role': 'BOWL', 'runs': 29, 'sixes': 0}], 36),
  ('second regression', [{'balls': 10, 'fours': 9, 'out': True, 'role': 'AR', 'runs': 51, 'sixes': 1}], 76),
  ('normal control 1', [{'balls': 11, 'fours': 3, 'out': True, 'role': 'WK', 'runs': 33, 'sixes': 3}], 52),
  ('normal control 2', [{'balls': 1, 'fours': 4, 'out': True, 'role': 'WK', 'runs': 29, 'sixes': 2}], 37),
  ('normal control 3', [{'balls': 20, 'fours': 0, 'out': True, 'role': 'AR', 'runs': 0, 'sixes': 0}], -8),
  ('normal control 4', [{'balls': 23, 'fours': 11, 'out': False, 'role': 'BAT', 'runs': 100, 'sixes': 8}],
   149)]]
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-ball 25 earns no strike-rate bonus.

Score a T20 batting innings: 1 per run, +1 per four, +2 per six; only the highest milestone bonus applies (30+ -> 4, 50+ -> 8, 100+ -> 16). A duck (-2) applies when the batter is out for 0 after facing at least one ball, except for BOWL-role players. Strike-rate bonus for non-BOWL players with at least 10 balls, using exact runs*100 vs balls: >170 +6, >150 +4, >=130 +2, >=70 0, >=60 -2, >=50 -4, below -6.

split: open-access


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

N = 1
observations = []
def solve(inn):
    pts = inn['runs'] + inn['fours'] + inn['sixes'] * 2
    if inn['runs'] >= 100:
        pts += 16
    elif inn['runs'] >= 50:
        pts += 8
    elif inn['runs'] >= 30:
        pts += 4
    if inn['out'] and inn['runs'] == 0 and inn['balls'] >= 1 and inn['role'] != 'BOWL':
        pts -= 2
    if inn['balls'] >= 10 and inn['role'] != 'BOWL':
        r, b = round(inn['runs'] * 100 / inn['balls']), 1
        if r > 170 * b:
            pts += 6
        elif r > 150 * b:
            pts += 4
        elif r >= 130 * b:
            pts += 2
        elif r >= 70 * b:
            pass
        elif r >= 60 * b:
            pts -= 2
        elif r >= 50 * b:
            pts -= 4
        else:
            pts -= 6
    return pts
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: strike rate exactness',
   [{'balls': 47, 'fours': 16, 'out': False, 'role': 'AR', 'runs': 80, 'sixes': 0}], 110),
  ('partial repair probe: strike rate exactness',
   [{'balls': 57, 'fours': 8, 'out': False, 'role': 'BAT', 'runs': 86, 'sixes': 3}], 112),
  ('second regression', [{'balls': 17, 'fours': 2, 'out': True, 'role': 'WK', 'runs': 29, 'sixes': 0}], 37),
  ('normal control 1', [{'balls': 47, 'fours': 5, 'out': False, 'role': 'BAT', 'runs': 46, 'sixes': 2}], 59),
  ('normal control 2', [{'balls': 70, 'fours': 6, 'out': False, 'role': 'BAT', 'runs': 50, 'sixes': 4}], 72),
  ('normal control 3', [{'balls': 60, 'fours': 0, 'out': False, 'role': 'WK', 'runs': 79, 'sixes': 9}], 107),
  ('normal control 4', [{'balls': 9, 'fours': 4, 'out': False, 'role': 'AR', 'runs': 17, 'sixes': 0}], 21)],
 [('regression: strike rate exactness',
   [{'balls': 44, 'fours': 14, 'out': True, 'role': 'WK', 'runs': 75, 'sixes': 2}], 107),
  ('partial repair probe: strike rate exactness',
   [{'balls': 48, 'fours': 12, 'out': False, 'role': 'AR', 'runs': 82, 'sixes': 4}], 116),
  ('second regression', [{'balls': 57, 'fours': 10, 'out': True, 'role': 'WK', 'runs': 97, 'sixes': 9}], 139),
  ('normal control 1', [{'balls': 23, 'fours': 2, 'out': False, 'role': 'BAT', 'runs': 11, 'sixes': 0}], 7),
  ('normal control 2', [{'balls': 47, 'fours': 7, 'out': True, 'role': 'AR', 'runs': 49, 'sixes': 0}], 60),
  ('normal control 3', [{'balls': 9, 'fours': 8, 'out': True, 'role': 'BAT', 'runs': 70, 'sixes': 1}], 88),
  ('normal control 4', [{'balls': 9, 'fours': 2, 'out': True, 'role': 'BOWL', 'runs': 34, 'sixes': 2}], 44)],
 [('regression: strike rate exactness',
   [{'balls': 54, 'fours': 20, 'out': True, 'role': 'WK', 'runs': 92, 'sixes': 0}], 126),
  ('partial repair probe: strike rate exactness',
   [{'balls': 57, 'fours': 18, 'out': False, 'role': 'BAT', 'runs': 86, 'sixes': 1}], 118),
  ('second regression', [{'balls': 57, 'fours': 5, 'out': False, 'role': 'AR', 'runs': 97, 'sixes': 12}],
   140),
  ('normal control 1', [{'balls': 11, 'fours': 0, 'out': False, 'role': 'BOWL', 'runs': 0, 'sixes': 0}], 0),
  ('normal control 2', [{'balls': 0, 'fours': 0, 'out': True, 'role': 'BOWL', 'runs': 0, 'sixes': 0}], 0),
  ('normal control 3', [{'balls': 11, 'fours': 0, 'out': True, 'role': 'BOWL', 'runs': 34, 'sixes': 3}], 44),
  ('normal control 4', [{'balls': 48, 'fours': 8, 'out': True, 'role': 'BOWL', 'runs': 73, 'sixes': 1}], 91)],
 [('regression: strike rate exactness',
   [{'balls': 47, 'fours': 1, 'out': True, 'role': 'WK', 'runs': 80, 'sixes': 4}], 103),
  ('partial repair probe: strike rate exactness',
   [{'balls': 53, 'fours': 4, 'out': False, 'role': 'WK', 'runs': 80, 'sixes': 9}], 114),
  ('second regression', [{'balls': 59, 'fours': 2, 'out': True, 'role': 'AR', 'runs': 89, 'sixes': 12}], 127),
  ('normal control 1', [{'balls': 20, 'fours': 0, 'out': True, 'role': 'BAT', 'runs': 0, 'sixes': 0}], -8),
  ('normal control 2', [{'balls': 10, 'fours': 5, 'out': True, 'role': 'BAT', 'runs': 29, 'sixes': 1}], 42),
  ('normal control 3', [{'balls': 25, 'fours': 4, 'out': True, 'role': 'BOWL', 'runs': 50, 'sixes': 3}], 68),
  ('normal control 4', [{'balls': 0, 'fours': 0, 'out': True, 'role': 'AR', 'runs': 0, 'sixes': 0}], 0)],
 [('regression: strike rate exactness',
   [{'balls': 27, 'fours': 11, 'out': False, 'role': 'BAT', 'runs': 46, 'sixes': 0}], 67),
  ('partial repair probe: strike rate exactness',
   [{'balls': 41, 'fours': 7, 'out': False, 'role': 'AR', 'runs': 70, 'sixes': 4}], 99),
  ('second regression', [{'balls': 58, 'fours': 0, 'out': True, 'role': 'BAT', 'runs': 99, 'sixes': 5}], 123),
  ('normal control 1', [{'balls': 30, 'fours': 9, 'out': False, 'role': 'BAT', 'runs': 40, 'sixes': 0}], 55),
  ('normal control 2', [{'balls': 10, 'fours': 0, 'out': False, 'role': 'AR', 'runs': 49, 'sixes': 4}], 67),
  ('normal control 3', [{'balls': 0, 'fours': 0, 'out': True, 'role': 'BOWL', 'runs': 0, 'sixes': 0}], 0),
  ('normal control 4', [{'balls': 32, 'fours': 0, 'out': False, 'role': 'AR', 'runs': 0, 'sixes': 0}], -6)]]
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(inn):
    pts = inn['runs'] + inn['fours'] + inn['sixes'] * 2
    if inn['runs'] >= 100:
        pts += 16
    elif inn['runs'] >= 50:
        pts += 8
    elif inn['runs'] >= 30:
        pts += 4
    if inn['out'] and inn['runs'] == 0 and inn['balls'] >= 1 and inn['role'] != 'BOWL':
        pts -= 2
    if inn['balls'] >= 10 and inn['role'] != 'BOWL':
        r, b = inn['runs'] * 100 // inn['balls'], 1
        if r > 170 * b:
            pts += 6
        elif r > 150 * b:
            pts += 4
        elif r >= 130 * b:
            pts += 2
        elif r >= 70 * b:
            pass
        elif r >= 60 * b:
            pts -= 2
        elif r >= 50 * b:
            pts -= 4
        else:
            pts -= 6
    return pts
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: strike rate exactness',
   [{'balls': 47, 'fours': 16, 'out': False, 'role': 'AR', 'runs': 80, 'sixes': 0}], 110),
  ('partial repair probe: strike rate exactness',
   [{'balls': 57, 'fours': 8, 'out': False, 'role': 'BAT', 'runs': 86, 'sixes': 3}], 112),
  ('second regression', [{'balls': 17, 'fours': 2, 'out': True, 'role': 'WK', 'runs': 29, 'sixes': 0}], 37),
  ('normal control 1', [{'balls': 47, 'fours': 5, 'out': False, 'role': 'BAT', 'runs': 46, 'sixes': 2}], 59),
  ('normal control 2', [{'balls': 70, 'fours': 6, 'out': False, 'role': 'BAT', 'runs': 50, 'sixes': 4}], 72),
  ('normal control 3', [{'balls': 60, 'fours': 0, 'out': False, 'role': 'WK', 'runs': 79, 'sixes': 9}], 107),
  ('normal control 4', [{'balls': 9, 'fours': 4, 'out': False, 'role': 'AR', 'runs': 17, 'sixes': 0}], 21)],
 [('regression: strike rate exactness',
   [{'balls': 44, 'fours': 14, 'out': True, 'role': 'WK', 'runs': 75, 'sixes': 2}], 107),
  ('partial repair probe: strike rate exactness',
   [{'balls': 48, 'fours': 12, 'out': False, 'role': 'AR', 'runs': 82, 'sixes': 4}], 116),
  ('second regression', [{'balls': 57, 'fours': 10, 'out': True, 'role': 'WK', 'runs': 97, 'sixes': 9}], 139),
  ('normal control 1', [{'balls': 23, 'fours': 2, 'out': False, 'role': 'BAT', 'runs': 11, 'sixes': 0}], 7),
  ('normal control 2', [{'balls': 47, 'fours': 7, 'out': True, 'role': 'AR', 'runs': 49, 'sixes': 0}], 60),
  ('normal control 3', [{'balls': 9, 'fours': 8, 'out': True, 'role': 'BAT', 'runs': 70, 'sixes': 1}], 88),
  ('normal control 4', [{'balls': 9, 'fours': 2, 'out': True, 'role': 'BOWL', 'runs': 34, 'sixes': 2}], 44)],
 [('regression: strike rate exactness',
   [{'balls': 54, 'fours': 20, 'out': True, 'role': 'WK', 'runs': 92, 'sixes': 0}], 126),
  ('partial repair probe: strike rate exactness',
   [{'balls': 57, 'fours': 18, 'out': False, 'role': 'BAT', 'runs': 86, 'sixes': 1}], 118),
  ('second regression', [{'balls': 57, 'fours': 5, 'out': False, 'role': 'AR', 'runs': 97, 'sixes': 12}],
   140),
  ('normal control 1', [{'balls': 11, 'fours': 0, 'out': False, 'role': 'BOWL', 'runs': 0, 'sixes': 0}], 0),
  ('normal control 2', [{'balls': 0, 'fours': 0, 'out': True, 'role': 'BOWL', 'runs': 0, 'sixes': 0}], 0),
  ('normal control 3', [{'balls': 11, 'fours': 0, 'out': True, 'role': 'BOWL', 'runs': 34, 'sixes': 3}], 44),
  ('normal control 4', [{'balls': 48, 'fours': 8, 'out': True, 'role': 'BOWL', 'runs': 73, 'sixes': 1}], 91)],
 [('regression: strike rate exactness',
   [{'balls': 47, 'fours': 1, 'out': True, 'role': 'WK', 'runs': 80, 'sixes': 4}], 103),
  ('partial repair probe: strike rate exactness',
   [{'balls': 53, 'fours': 4, 'out': False, 'role': 'WK', 'runs': 80, 'sixes': 9}], 114),
  ('second regression', [{'balls': 59, 'fours': 2, 'out': True, 'role': 'AR', 'runs': 89, 'sixes': 12}], 127),
  ('normal control 1', [{'balls': 20, 'fours': 0, 'out': True, 'role': 'BAT', 'runs': 0, 'sixes': 0}], -8),
  ('normal control 2', [{'balls': 10, 'fours': 5, 'out': True, 'role': 'BAT', 'runs': 29, 'sixes': 1}], 42),
  ('normal control 3', [{'balls': 25, 'fours': 4, 'out': True, 'role': 'BOWL', 'runs': 50, 'sixes': 3}], 68),
  ('normal control 4', [{'balls': 0, 'fours': 0, 'out': True, 'role': 'AR', 'runs': 0, 'sixes': 0}], 0)],
 [('regression: strike rate exactness',
   [{'balls': 27, 'fours': 11, 'out': False, 'role': 'BAT', 'runs': 46, 'sixes': 0}], 67),
  ('partial repair probe: strike rate exactness',
   [{'balls': 41, 'fours': 7, 'out': False, 'role': 'AR', 'runs': 70, 'sixes': 4}], 99),
  ('second regression', [{'balls': 58, 'fours': 0, 'out': True, 'role': 'BAT', 'runs': 99, 'sixes': 5}], 123),
  ('normal control 1', [{'balls': 30, 'fours': 9, 'out': False, 'role': 'BAT', 'runs': 40, 'sixes': 0}], 55),
  ('normal control 2', [{'balls': 10, 'fours': 0, 'out': False, 'role': 'AR', 'runs': 49, 'sixes': 4}], 67),
  ('normal control 3', [{'balls': 0, 'fours': 0, 'out': True, 'role': 'BOWL', 'runs': 0, 'sixes': 0}], 0),
  ('normal control 4', [{'balls': 32, 'fours': 0, 'out': False, 'role': 'AR', 'runs': 0, 'sixes': 0}], -6)]]
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 strike rate of 170.4 misses the >170 band.

Score a T20 batting innings: 1 per run, +1 per four, +2 per six; only the highest milestone bonus applies (30+ -> 4, 50+ -> 8, 100+ -> 16). A duck (-2) applies when the batter is out for 0 after facing at least one ball, except for BOWL-role players. Strike-rate bonus for non-BOWL players with at least 10 balls, using exact runs*100 vs balls: >170 +6, >150 +4, >=130 +2, >=70 0, >=60 -2, >=50 -4, below -6.

split: open-access