broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
import math
N = 1
observations = []
def solve(outings, innings_per_game):
    outs = er = 0
    for ip, runs in outings:
        whole, _, part = ip.partition('.')
        part = int(part or 0)
        if part > 2:
            return 'invalid ip ' + ip
        outs += int(whole) * 3 + part
        er += runs
    ip_str = '%d.%d' % (outs // 3, outs % 3)
    if outs == 0:
        return [ip_str, 'INF' if er else '0.00']
    v = Fraction(9 * er * 3, outs)
    cents = math.floor(v * 100 + Fraction(1, 2))
    return [ip_str, '%d.%02d' % (cents // 100, cents % 100)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
    try:
        return solve(*args)
    except Exception as exc:
        return 'raised ' + type(exc).__name__
cases = [[('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: game length scale', ([['9.0', 0], ['5.1', 1], ['1.1', 1]], 9), ['15.2', '1.15']),
  ('regression: game length scale', ([['9.2', 2], ['7.0', 4], ['8.1', 1]], 7), ['25.0', '1.96']),
  ('variant scenario 1', ([['8.0', 2]], 9), ['8.0', '2.25']),
  ('variant scenario 2', ([['3.2', 1]], 9), ['3.2', '2.45'])],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: game length scale', ([['6', 4], ['5.0', 1]], 9), ['11.0', '4.09']),
  ('regression: game length scale', ([['7.0', 2], ['5', 0], ['5.2', 4]], 7), ['17.2', '2.38']),
  ('variant scenario 1', ([['0.1', 0], ['6.0', 3]], 9), ['6.1', '4.26']),
  ('variant scenario 2', ([['2.1', 4], ['5.1', 4], ['6.1', 2], ['3.2', 0]], 9), ['17.2', '5.09'])],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: game length scale', ([['4', 3], ['3.1', 1]], 9), ['7.1', '4.91']),
  ('regression: game length scale', ([['3.2', 4]], 7), ['3.2', '7.64']),
  ('variant scenario 1', ([['6.2', 3], ['4.0', 0], ['5.3', 0], ['6', 3]], 9), 'invalid ip 5.3'),
  ('variant scenario 2', ([['6.1', 4], ['0.2', 2]], 9), ['7.0', '7.71'])],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: game length scale',
   ([['5.2', 4], ['0.1', 1], ['9.0', 1], ['9.0', 4]], 9),
   ['24.0', '3.75']),
  ('regression: game length scale',
   ([['5.0', 2], ['1.0', 4], ['1.2', 3], ['7.0', 4]], 7),
   ['14.2', '6.20']),
  ('variant scenario 1',
   ([['4.1', 3], ['2.0', 2], ['4.0', 2], ['9.2', 4], ['0.2', 2], ['6.3', 3]], 7),
   'invalid ip 6.3'),
  ('variant scenario 2',
   ([['5.2', 0], ['0', 2], ['1.3', 0], ['8.0', 3], ['7.0', 3], ['3.2', 4]], 7),
   'invalid ip 1.3')],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: game length scale', ([['4.2', 1]], 9), ['4.2', '1.93']),
  ('regression: game length scale',
   ([['0.2', 3], ['1', 2], ['9.1', 2], ['2.1', 4], ['6.1', 1], ['2.0', 1]], 7),
   ['21.2', '4.20']),
  ('variant scenario 1',
   ([['3.0', 0], ['8.0', 3], ['8.1', 1], ['5.0', 3], ['4.1', 0], ['7.2', 1]], 9),
   ['36.1', '1.98']),
  ('variant scenario 2', ([['8.2', 4], ['9.1', 0]], 9), ['18.0', '2.00'])]]
for label, args, expected in cases[N - 1]:
    check(label, run(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
import math
N = 1
observations = []
def solve(outings, innings_per_game):
    outs = er = 0
    for ip, runs in outings:
        whole, _, part = ip.partition('.')
        part = int(part or 0)
        if part > 2:
            return 'invalid ip ' + ip
        outs += int(whole) * 3 + part
        er += runs
    ip_str = '%d.%d' % (outs // 3, outs % 3)
    if outs == 0:
        return [ip_str, 'INF' if er else '0.00']
    v = Fraction(innings_per_game * er, outs)
    cents = math.floor(v * 100 + Fraction(1, 2))
    return [ip_str, '%d.%02d' % (cents // 100, cents % 100)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
    try:
        return solve(*args)
    except Exception as exc:
        return 'raised ' + type(exc).__name__
cases = [[('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: game length scale', ([['9.0', 0], ['5.1', 1], ['1.1', 1]], 9), ['15.2', '1.15']),
  ('regression: game length scale', ([['9.2', 2], ['7.0', 4], ['8.1', 1]], 7), ['25.0', '1.96']),
  ('variant scenario 1', ([['8.0', 2]], 9), ['8.0', '2.25']),
  ('variant scenario 2', ([['3.2', 1]], 9), ['3.2', '2.45'])],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: game length scale', ([['6', 4], ['5.0', 1]], 9), ['11.0', '4.09']),
  ('regression: game length scale', ([['7.0', 2], ['5', 0], ['5.2', 4]], 7), ['17.2', '2.38']),
  ('variant scenario 1', ([['0.1', 0], ['6.0', 3]], 9), ['6.1', '4.26']),
  ('variant scenario 2', ([['2.1', 4], ['5.1', 4], ['6.1', 2], ['3.2', 0]], 9), ['17.2', '5.09'])],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: game length scale', ([['4', 3], ['3.1', 1]], 9), ['7.1', '4.91']),
  ('regression: game length scale', ([['3.2', 4]], 7), ['3.2', '7.64']),
  ('variant scenario 1', ([['6.2', 3], ['4.0', 0], ['5.3', 0], ['6', 3]], 9), 'invalid ip 5.3'),
  ('variant scenario 2', ([['6.1', 4], ['0.2', 2]], 9), ['7.0', '7.71'])],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: game length scale',
   ([['5.2', 4], ['0.1', 1], ['9.0', 1], ['9.0', 4]], 9),
   ['24.0', '3.75']),
  ('regression: game length scale',
   ([['5.0', 2], ['1.0', 4], ['1.2', 3], ['7.0', 4]], 7),
   ['14.2', '6.20']),
  ('variant scenario 1',
   ([['4.1', 3], ['2.0', 2], ['4.0', 2], ['9.2', 4], ['0.2', 2], ['6.3', 3]], 7),
   'invalid ip 6.3'),
  ('variant scenario 2',
   ([['5.2', 0], ['0', 2], ['1.3', 0], ['8.0', 3], ['7.0', 3], ['3.2', 4]], 7),
   'invalid ip 1.3')],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: game length scale', ([['4.2', 1]], 9), ['4.2', '1.93']),
  ('regression: game length scale',
   ([['0.2', 3], ['1', 2], ['9.1', 2], ['2.1', 4], ['6.1', 1], ['2.0', 1]], 7),
   ['21.2', '4.20']),
  ('variant scenario 1',
   ([['3.0', 0], ['8.0', 3], ['8.1', 1], ['5.0', 3], ['4.1', 0], ['7.2', 1]], 9),
   ['36.1', '1.98']),
  ('variant scenario 2', ([['8.2', 4], ['9.1', 0]], 9), ['18.0', '2.00'])]]
for label, args, expected in cases[N - 1]:
    check(label, run(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 softball or seven-inning league ERA is computed per nine innings.

Pitching line aggregation. outings rows are [innings_pitched, earned_runs] where innings pitched use baseball notation "6.2" = 6 innings and 2 outs (the digit after the point is 0-2; otherwise return "invalid ip <text>"). Sum outs exactly. ERA = innings_per_game * earned runs / innings, rounded half up to two decimals. Return [total innings "I.O", ERA string]; with zero outs ERA is "INF" if any earned runs else "0.00".

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
import math
N = 1
observations = []
def solve(outings, innings_per_game):
    outs = er = 0
    for ip, runs in outings:
        whole, _, part = ip.partition('.')
        part = int(part or 0)
        if part > 2:
            return 'invalid ip ' + ip
        outs += int(whole) * 3 + part
        er += runs
    ip_str = '%d.%d' % (outs // 3, outs % 3)
    if outs == 0:
        return [ip_str, 'INF' if er else '0.00']
    v = Fraction(innings_per_game * er * 3, outs)
    cents = math.floor(v * 100)
    return [ip_str, '%d.%02d' % (cents // 100, cents % 100)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
    try:
        return solve(*args)
    except Exception as exc:
        return 'raised ' + type(exc).__name__
cases = [[('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: era rounding', ([['8.0', 1]], 9), ['8.0', '1.13']),
  ('variant scenario 1', ([['9.2', 2], ['4.3', 0], ['5.0', 0]], 9), 'invalid ip 4.3'),
  ('variant scenario 2', ([['3.0', 2], ['7.0', 4], ['1.2', 3]], 7), ['11.2', '5.40'])],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: era rounding', ([['7.2', 4]], 9), ['7.2', '4.70']),
  ('regression: era rounding', ([['8.0', 5]], 9), ['8.0', '5.63']),
  ('variant scenario 1', ([['2.0', 0], ['2.2', 1], ['6.0', 1], ['2', 2]], 7), ['12.2', '2.21']),
  ('variant scenario 2', ([['1.1', 4], ['2.2', 4], ['1.2', 4]], 7), ['5.2', '14.82'])],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: era rounding', ([['8.2', 4], ['8.2', 0]], 9), ['17.1', '2.08']),
  ('regression: era rounding',
   ([['3.0', 2], ['1.2', 2], ['8.2', 1], ['3.2', 2], ['4.1', 1]], 7),
   ['21.1', '2.63']),
  ('variant scenario 1', ([['8.1', 3], ['8', 0]], 9), ['16.1', '1.65']),
  ('variant scenario 2', ([['5.3', 0], ['4.1', 4]], 9), 'invalid ip 5.3')],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: era rounding',
   ([['4.0', 2], ['4.0', 1], ['0', 1], ['3.2', 2], ['5.1', 0]], 9),
   ['17.0', '3.18']),
  ('regression: era rounding', ([['1', 0], ['0', 0], ['6.0', 3], ['6.1', 0]], 9), ['13.1', '2.03']),
  ('variant scenario 1',
   ([['9.2', 0], ['7.2', 1], ['8.2', 2], ['4.2', 3], ['5.0', 3]], 9),
   ['35.2', '2.27']),
  ('variant scenario 2', ([['6.1', 4]], 9), ['6.1', '5.68'])],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: era rounding',
   ([['3.2', 2], ['2.2', 1], ['6.0', 2], ['6', 0], ['0.1', 4]], 9),
   ['18.2', '4.34']),
  ('regression: era rounding', ([['8.0', 5]], 9), ['8.0', '5.63']),
  ('variant scenario 1', ([['5.0', 3]], 7), ['5.0', '4.20']),
  ('variant scenario 2', ([['7.0', 1], ['7.0', 0]], 9), ['14.0', '0.64'])]]
for label, args, expected in cases[N - 1]:
    check(label, run(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
from fractions import Fraction
import math
N = 1
observations = []
def solve(outings, innings_per_game):
    outs = er = 0
    for ip, runs in outings:
        whole, _, part = ip.partition('.')
        part = int(part or 0)
        if part > 2:
            return 'invalid ip ' + ip
        outs += int(whole) * 3 + part
        er += runs
    ip_str = '%d.%d' % (outs // 3, outs % 3)
    if outs == 0:
        return [ip_str, 'INF' if er else '0.00']
    v = Fraction(innings_per_game * er * 3, outs)
    cents = round(v * 100)
    return [ip_str, '%d.%02d' % (cents // 100, cents % 100)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
    try:
        return solve(*args)
    except Exception as exc:
        return 'raised ' + type(exc).__name__
cases = [[('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: era rounding', ([['8.0', 1]], 9), ['8.0', '1.13']),
  ('variant scenario 1', ([['9.2', 2], ['4.3', 0], ['5.0', 0]], 9), 'invalid ip 4.3'),
  ('variant scenario 2', ([['3.0', 2], ['7.0', 4], ['1.2', 3]], 7), ['11.2', '5.40'])],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: era rounding', ([['7.2', 4]], 9), ['7.2', '4.70']),
  ('regression: era rounding', ([['8.0', 5]], 9), ['8.0', '5.63']),
  ('variant scenario 1', ([['2.0', 0], ['2.2', 1], ['6.0', 1], ['2', 2]], 7), ['12.2', '2.21']),
  ('variant scenario 2', ([['1.1', 4], ['2.2', 4], ['1.2', 4]], 7), ['5.2', '14.82'])],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: era rounding', ([['8.2', 4], ['8.2', 0]], 9), ['17.1', '2.08']),
  ('regression: era rounding',
   ([['3.0', 2], ['1.2', 2], ['8.2', 1], ['3.2', 2], ['4.1', 1]], 7),
   ['21.1', '2.63']),
  ('variant scenario 1', ([['8.1', 3], ['8', 0]], 9), ['16.1', '1.65']),
  ('variant scenario 2', ([['5.3', 0], ['4.1', 4]], 9), 'invalid ip 5.3')],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: era rounding',
   ([['4.0', 2], ['4.0', 1], ['0', 1], ['3.2', 2], ['5.1', 0]], 9),
   ['17.0', '3.18']),
  ('regression: era rounding', ([['1', 0], ['0', 0], ['6.0', 3], ['6.1', 0]], 9), ['13.1', '2.03']),
  ('variant scenario 1',
   ([['9.2', 0], ['7.2', 1], ['8.2', 2], ['4.2', 3], ['5.0', 3]], 9),
   ['35.2', '2.27']),
  ('variant scenario 2', ([['6.1', 4]], 9), ['6.1', '5.68'])],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: era rounding',
   ([['3.2', 2], ['2.2', 1], ['6.0', 2], ['6', 0], ['0.1', 4]], 9),
   ['18.2', '4.34']),
  ('regression: era rounding', ([['8.0', 5]], 9), ['8.0', '5.63']),
  ('variant scenario 1', ([['5.0', 3]], 7), ['5.0', '4.20']),
  ('variant scenario 2', ([['7.0', 1], ['7.0', 0]], 9), ['14.0', '0.64'])]]
for label, args, expected in cases[N - 1]:
    check(label, run(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:
An ERA of 3.375 is shown as 3.37.

Pitching line aggregation. outings rows are [innings_pitched, earned_runs] where innings pitched use baseball notation "6.2" = 6 innings and 2 outs (the digit after the point is 0-2; otherwise return "invalid ip <text>"). Sum outs exactly. ERA = innings_per_game * earned runs / innings, rounded half up to two decimals. Return [total innings "I.O", ERA string]; with zero outs ERA is "INF" if any earned runs else "0.00".

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
import math
N = 1
observations = []
def solve(outings, innings_per_game):
    outs = er = 0
    for ip, runs in outings:
        whole, _, part = ip.partition('.')
        part = int(part or 0)
        if part > 2:
            return 'invalid ip ' + ip
        outs += int(whole) * 3 + part
        er += runs
    ip_str = '%d.%d' % (outs // 3, outs % 3)
    v = Fraction(innings_per_game * er * 3, outs)
    cents = math.floor(v * 100 + Fraction(1, 2))
    return [ip_str, '%d.%02d' % (cents // 100, cents % 100)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
    try:
        return solve(*args)
    except Exception as exc:
        return 'raised ' + type(exc).__name__
cases = [[('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: zero out guard', ([['0.0', 0]], 9), ['0.0', '0.00']),
  ('regression: zero out guard', ([['0.0', 4]], 9), ['0.0', 'INF']),
  ('variant scenario 1', ([['1.0', 4]], 9), ['1.0', '36.00']),
  ('variant scenario 2', ([['8.0', 2]], 7), ['8.0', '1.75'])],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: zero out guard', ([['0.0', 3]], 7), ['0.0', 'INF']),
  ('variant scenario 1', ([['7.2', 3], ['8.0', 0]], 9), ['15.2', '1.72']),
  ('variant scenario 2', ([['7.1', 2]], 9), ['7.1', '2.45'])],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: zero out guard', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('variant scenario 1',
   ([['9', 1], ['1.0', 1], ['8.2', 4], ['8.3', 2], ['4.3', 1]], 9),
   'invalid ip 8.3'),
  ('variant scenario 2', ([['7.3', 3], ['1.0', 3], ['8.2', 0], ['7.2', 2]], 9), 'invalid ip 7.3')],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: zero out guard', ([['0.0', 1]], 7), ['0.0', 'INF']),
  ('variant scenario 1',
   ([['8.1', 3], ['0.1', 4], ['6.1', 4], ['7.0', 4], ['1', 2]], 9),
   ['23.0', '6.65']),
  ('variant scenario 2', ([['1', 1], ['1.1', 4], ['0.2', 0]], 7), ['3.0', '11.67'])],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: zero out guard', ([['0.0', 1]], 7), ['0.0', 'INF']),
  ('variant scenario 1', ([['3.1', 2], ['4.1', 4]], 9), ['7.2', '7.04']),
  ('variant scenario 2',
   ([['0.1', 0], ['5.2', 2], ['5.1', 1], ['4.1', 4], ['6.3', 1], ['7.1', 0], ['0.1', 1]], 9),
   'invalid ip 6.3')]]
for label, args, expected in cases[N - 1]:
    check(label, run(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
import math
N = 1
observations = []
def solve(outings, innings_per_game):
    outs = er = 0
    for ip, runs in outings:
        whole, _, part = ip.partition('.')
        part = int(part or 0)
        if part > 2:
            return 'invalid ip ' + ip
        outs += int(whole) * 3 + part
        er += runs
    ip_str = '%d.%d' % (outs // 3, outs % 3)
    if outs == 0:
        return [ip_str, '0.00']
    v = Fraction(innings_per_game * er * 3, outs)
    cents = math.floor(v * 100 + Fraction(1, 2))
    return [ip_str, '%d.%02d' % (cents // 100, cents % 100)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
    try:
        return solve(*args)
    except Exception as exc:
        return 'raised ' + type(exc).__name__
cases = [[('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: zero out guard', ([['0.0', 0]], 9), ['0.0', '0.00']),
  ('regression: zero out guard', ([['0.0', 4]], 9), ['0.0', 'INF']),
  ('variant scenario 1', ([['1.0', 4]], 9), ['1.0', '36.00']),
  ('variant scenario 2', ([['8.0', 2]], 7), ['8.0', '1.75'])],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: zero out guard', ([['0.0', 3]], 7), ['0.0', 'INF']),
  ('variant scenario 1', ([['7.2', 3], ['8.0', 0]], 9), ['15.2', '1.72']),
  ('variant scenario 2', ([['7.1', 2]], 9), ['7.1', '2.45'])],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: zero out guard', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('variant scenario 1',
   ([['9', 1], ['1.0', 1], ['8.2', 4], ['8.3', 2], ['4.3', 1]], 9),
   'invalid ip 8.3'),
  ('variant scenario 2', ([['7.3', 3], ['1.0', 3], ['8.2', 0], ['7.2', 2]], 9), 'invalid ip 7.3')],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: zero out guard', ([['0.0', 1]], 7), ['0.0', 'INF']),
  ('variant scenario 1',
   ([['8.1', 3], ['0.1', 4], ['6.1', 4], ['7.0', 4], ['1', 2]], 9),
   ['23.0', '6.65']),
  ('variant scenario 2', ([['1', 1], ['1.1', 4], ['0.2', 0]], 7), ['3.0', '11.67'])],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: zero out guard', ([['0.0', 1]], 7), ['0.0', 'INF']),
  ('variant scenario 1', ([['3.1', 2], ['4.1', 4]], 9), ['7.2', '7.04']),
  ('variant scenario 2',
   ([['0.1', 0], ['5.2', 2], ['5.1', 1], ['4.1', 4], ['6.3', 1], ['7.1', 0], ['0.1', 1]], 9),
   'invalid ip 6.3')]]
for label, args, expected in cases[N - 1]:
    check(label, run(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A reliever who faced batters without recording an out raises a division error or shows 0.00.

Pitching line aggregation. outings rows are [innings_pitched, earned_runs] where innings pitched use baseball notation "6.2" = 6 innings and 2 outs (the digit after the point is 0-2; otherwise return "invalid ip <text>"). Sum outs exactly. ERA = innings_per_game * earned runs / innings, rounded half up to two decimals. Return [total innings "I.O", ERA string]; with zero outs ERA is "INF" if any earned runs else "0.00".

split: open-access


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

N = 1
observations = []
def solve(away, home, scheduled):
    A = sum(away)
    H = sum(home)
    na, nh = len(away), len(home)
    if nh not in (na, na - 1):
        return 'invalid'
    if nh == na - 1:
        if na >= scheduled and H >= A:
            return ['final', 'home', na]
        return ['in progress', None, None]
    if na >= scheduled and A != H:
        return ['final', 'home' if H > A else 'away', na]
    return ['in progress', None, None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
    try:
        return solve(*args)
    except Exception as exc:
        return 'raised ' + type(exc).__name__
cases = [[('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: home lead skip',
   ([1, 1, 0, 0, 0, 0, 0], [1, 1, 0, 1, 0, 1], 7),
   ['final', 'home', 7]),
  ('regression: home lead skip',
   ([1, 2, 3, 3, 2, 0, 0, 0, 0], [0, 2, 1, 2, 1, 1, 3, 1], 7),
   ['in progress', None, None]),
  ('variant scenario 1',
   ([1, 3, 0, 0, 2, 1, 1, 1], [0, 2, 0, 0, 0, 1, 3, 0], 9),
   ['in progress', None, None]),
  ('variant scenario 2', ([1, 0, 0, 0, 0, 2], [3, 0, 1, 2, 3, 0], 9), ['in progress', None, None])],
 [('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: home lead skip',
   ([0, 1, 0, 0, 0, 2, 2], [0, 1, 0, 2, 2, 1], 7),
   ['final', 'home', 7]),
  ('regression: home lead skip',
   ([0, 0, 0, 1, 2, 1, 1, 2, 0, 3, 0], [3, 3, 0, 0, 1, 0, 0, 1, 0, 2], 9),
   ['in progress', None, None]),
  ('variant scenario 1',
   ([2, 0, 2, 1, 3, 0, 0, 3, 1, 0, 0, 0], [0, 0, 0, 0, 3, 0, 1, 1, 0, 2, 3, 3], 9),
   ['final', 'home', 12]),
  ('variant scenario 2',
   ([0, 0, 0, 0, 2, 2, 3, 2, 0, 1], [2, 0, 3, 1, 3, 0, 1, 1, 2, 2], 7),
   ['final', 'home', 10])],
 [('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: home lead skip',
   ([1, 0, 0, 3, 1, 0, 0, 1, 3], [0, 1, 3, 0, 1, 3, 3, 3], 9),
   ['final', 'home', 9]),
  ('regression: home lead skip',
   ([0, 1, 0, 1, 1, 2, 1, 1, 2], [3, 0, 1, 2, 0, 0, 2, 1], 7),
   ['in progress', None, None]),
  ('variant scenario 1', ([2, 2, 2, 1, 1, 3], [0, 0, 2, 1, 0], 9), ['in progress', None, None]),
  ('variant scenario 2', ([1, 3, 0, 1, 0, 0], [0, 0, 1, 0, 0], 7), ['in progress', None, None])],
 [('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: home lead skip',
   ([0, 0, 0, 0, 1, 1, 0, 0, 3], [0, 2, 2, 1, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('regression: home lead skip',
   ([1, 2, 0, 0, 0, 1, 2, 1, 0], [3, 3, 1, 2, 2, 1, 1, 1], 9),
   ['final', 'home', 9]),
  ('variant scenario 1',
   ([1, 1, 0, 1, 1, 1, 0, 1, 0, 0], [0, 2, 3, 1, 2, 0, 3, 1, 1, 3, 1], 9),
   'invalid'),
  ('variant scenario 2',
   ([2, 0, 0, 0, 3, 2, 3, 2], [0, 0, 2, 0, 0, 1, 3, 1], 9),
   ['in progress', None, None])],
 [('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: home lead skip',
   ([0, 0, 3, 0, 0, 0, 3, 0, 0], [0, 0, 0, 0, 2, 2, 3, 0], 9),
   ['final', 'home', 9]),
  ('regression: home lead skip',
   ([1, 1, 1, 3, 3, 2, 1, 0, 1, 0, 2, 0], [0, 0, 0, 3, 3, 3, 0, 3, 0, 2, 1], 9),
   ['in progress', None, None]),
  ('variant scenario 1',
   ([0, 3, 0, 3, 0, 2, 0, 1, 3, 1, 0], [1, 0, 1, 2, 1, 0, 0, 0, 2, 1, 0], 9),
   ['final', 'away', 11]),
  ('variant scenario 2',
   ([1, 0, 2, 1, 1, 2, 0], [3, 1, 0, 0, 1, 0], 7),
   ['in progress', None, None])]]
for label, args, expected in cases[N - 1]:
    check(label, run(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(away, home, scheduled):
    A = sum(away)
    H = sum(home)
    na, nh = len(away), len(home)
    if nh not in (na, na - 1):
        return 'invalid'
    if nh == na - 1:
        if na > scheduled and H > A:
            return ['final', 'home', na]
        return ['in progress', None, None]
    if na >= scheduled and A != H:
        return ['final', 'home' if H > A else 'away', na]
    return ['in progress', None, None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
    try:
        return solve(*args)
    except Exception as exc:
        return 'raised ' + type(exc).__name__
cases = [[('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: home lead skip',
   ([1, 1, 0, 0, 0, 0, 0], [1, 1, 0, 1, 0, 1], 7),
   ['final', 'home', 7]),
  ('regression: home lead skip',
   ([1, 2, 3, 3, 2, 0, 0, 0, 0], [0, 2, 1, 2, 1, 1, 3, 1], 7),
   ['in progress', None, None]),
  ('variant scenario 1',
   ([1, 3, 0, 0, 2, 1, 1, 1], [0, 2, 0, 0, 0, 1, 3, 0], 9),
   ['in progress', None, None]),
  ('variant scenario 2', ([1, 0, 0, 0, 0, 2], [3, 0, 1, 2, 3, 0], 9), ['in progress', None, None])],
 [('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: home lead skip',
   ([0, 1, 0, 0, 0, 2, 2], [0, 1, 0, 2, 2, 1], 7),
   ['final', 'home', 7]),
  ('regression: home lead skip',
   ([0, 0, 0, 1, 2, 1, 1, 2, 0, 3, 0], [3, 3, 0, 0, 1, 0, 0, 1, 0, 2], 9),
   ['in progress', None, None]),
  ('variant scenario 1',
   ([2, 0, 2, 1, 3, 0, 0, 3, 1, 0, 0, 0], [0, 0, 0, 0, 3, 0, 1, 1, 0, 2, 3, 3], 9),
   ['final', 'home', 12]),
  ('variant scenario 2',
   ([0, 0, 0, 0, 2, 2, 3, 2, 0, 1], [2, 0, 3, 1, 3, 0, 1, 1, 2, 2], 7),
   ['final', 'home', 10])],
 [('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: home lead skip',
   ([1, 0, 0, 3, 1, 0, 0, 1, 3], [0, 1, 3, 0, 1, 3, 3, 3], 9),
   ['final', 'home', 9]),
  ('regression: home lead skip',
   ([0, 1, 0, 1, 1, 2, 1, 1, 2], [3, 0, 1, 2, 0, 0, 2, 1], 7),
   ['in progress', None, None]),
  ('variant scenario 1', ([2, 2, 2, 1, 1, 3], [0, 0, 2, 1, 0], 9), ['in progress', None, None]),
  ('variant scenario 2', ([1, 3, 0, 1, 0, 0], [0, 0, 1, 0, 0], 7), ['in progress', None, None])],
 [('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: home lead skip',
   ([0, 0, 0, 0, 1, 1, 0, 0, 3], [0, 2, 2, 1, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('regression: home lead skip',
   ([1, 2, 0, 0, 0, 1, 2, 1, 0], [3, 3, 1, 2, 2, 1, 1, 1], 9),
   ['final', 'home', 9]),
  ('variant scenario 1',
   ([1, 1, 0, 1, 1, 1, 0, 1, 0, 0], [0, 2, 3, 1, 2, 0, 3, 1, 1, 3, 1], 9),
   'invalid'),
  ('variant scenario 2',
   ([2, 0, 0, 0, 3, 2, 3, 2], [0, 0, 2, 0, 0, 1, 3, 1], 9),
   ['in progress', None, None])],
 [('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: home lead skip',
   ([0, 0, 3, 0, 0, 0, 3, 0, 0], [0, 0, 0, 0, 2, 2, 3, 0], 9),
   ['final', 'home', 9]),
  ('regression: home lead skip',
   ([1, 1, 1, 3, 3, 2, 1, 0, 1, 0, 2, 0], [0, 0, 0, 3, 3, 3, 0, 3, 0, 2, 1], 9),
   ['in progress', None, None]),
  ('variant scenario 1',
   ([0, 3, 0, 3, 0, 2, 0, 1, 3, 1, 0], [1, 0, 1, 2, 1, 0, 0, 0, 2, 1, 0], 9),
   ['final', 'away', 11]),
  ('variant scenario 2',
   ([1, 0, 2, 1, 1, 2, 0], [3, 1, 0, 0, 1, 0], 7),
   ['in progress', None, None])]]
for label, args, expected in cases[N - 1]:
    check(label, run(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 game tied after the top of the ninth is declared final.

Game status from a line score. away and home list runs per inning; home has either the same number of entries as away or one fewer (bottom half not yet played), otherwise return "invalid". When home is one short: if at least scheduled innings have started and home leads, the game is final (home wins without batting); otherwise in progress. When equal length: if at least scheduled innings are complete and the score is not tied, the game is final; ties continue into extra innings. Return ["final", "home"/"away", innings] or ["in progress", None, None].

split: open-access


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

N = 1
observations = []
def solve(away, home, scheduled):
    A = sum(away)
    H = sum(home)
    na, nh = len(away), len(home)
    if nh not in (na, na - 1):
        return 'invalid'
    if nh == na - 1:
        if na >= scheduled and H > A:
            return ['final', 'home', na]
        return ['in progress', None, None]
    if na == scheduled and A != H:
        return ['final', 'home' if H > A else 'away', na]
    return ['in progress', None, None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
    try:
        return solve(*args)
    except Exception as exc:
        return 'raised ' + type(exc).__name__
cases = [[('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: extra inning completion',
   ([3, 2, 1, 1, 0, 2, 0, 1, 0], [3, 1, 1, 2, 1, 3, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('regression: extra inning completion',
   ([1, 1, 0, 1, 1, 0, 3, 0], [1, 0, 3, 0, 0, 2, 0, 3], 7),
   ['final', 'home', 8]),
  ('variant scenario 1',
   ([0, 3, 2, 3, 1, 3, 0, 3, 0], [2, 2, 2, 3, 2, 1, 0, 2], 9),
   ['in progress', None, None]),
  ('variant scenario 2',
   ([3, 0, 0, 3, 1, 1, 0], [2, 0, 0, 3, 1, 1, 1], 7),
   ['in progress', None, None])],
 [('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: extra inning completion',
   ([0, 3, 2, 3, 0, 0, 3, 1, 3, 0, 1, 2], [3, 1, 1, 0, 1, 0, 3, 2, 0, 0, 0, 0], 9),
   ['final', 'away', 12]),
  ('regression: extra inning completion',
   ([0, 1, 1, 0, 1, 1, 1, 1, 0], [1, 0, 2, 3, 0, 1, 0, 1, 3], 9),
   ['final', 'home', 9]),
  ('variant scenario 1', ([0, 1, 0, 1, 0, 0], [0, 2, 2, 0, 3, 0], 9), ['in progress', None, None]),
  ('variant scenario 2',
   ([0, 0, 0, 0, 2, 1, 0], [0, 1, 1, 0, 0, 3, 0], 9),
   ['in progress', None, None])],
 [('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: extra inning completion',
   ([0, 1, 0, 3, 0, 0, 0, 1, 1, 1], [0, 2, 0, 0, 0, 0, 0, 3, 1, 0], 7),
   ['final', 'away', 10]),
  ('regression: extra inning completion',
   ([0, 0, 0, 0, 1, 0, 1, 2, 1], [0, 3, 1, 1, 1, 0, 1, 1, 0], 9),
   ['final', 'home', 9]),
  ('variant scenario 1',
   ([2, 3, 2, 0, 3, 1, 0], [0, 0, 1, 0, 1, 3], 9),
   ['in progress', None, None]),
  ('variant scenario 2',
   ([1, 1, 0, 3, 0, 0, 2, 0, 0, 1, 3], [3, 1, 1, 1, 2, 0, 1, 3, 0, 0], 9),
   ['final', 'home', 11])],
 [('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: extra inning completion',
   ([0, 0, 3, 1, 3, 1, 3], [0, 1, 3, 0, 0, 1, 0], 7),
   ['final', 'away', 7]),
  ('regression: extra inning completion',
   ([1, 1, 0, 2, 0, 2, 0, 0, 3, 0, 1], [3, 0, 1, 2, 3, 1, 3, 1, 1, 2, 0], 9),
   ['final', 'home', 11]),
  ('variant scenario 1',
   ([0, 0, 0, 0, 0, 2, 1, 0, 1, 3, 3, 0], [0, 3, 0, 0, 2, 1, 0, 1, 0, 2, 1], 9),
   ['in progress', None, None]),
  ('variant scenario 2',
   ([3, 0, 1, 0, 1, 2, 0, 2, 3, 2], [2, 1, 0, 0, 0, 1, 1, 0, 3, 0], 7),
   ['final', 'away', 10])],
 [('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: extra inning completion',
   ([3, 1, 1, 3, 1, 1, 2, 2], [1, 1, 1, 0, 3, 1, 0, 1], 7),
   ['final', 'away', 8]),
  ('regression: extra inning completion',
   ([0, 3, 1, 1, 2, 3, 1], [1, 2, 3, 0, 0, 0, 2], 7),
   ['final', 'away', 7]),
  ('variant scenario 1',
   ([0, 1, 0, 1, 3, 1, 1, 0, 3, 2, 1, 2], [2, 0, 3, 1, 0, 3, 0, 0, 1, 0, 2], 9),
   ['in progress', None, None]),
  ('variant scenario 2',
   ([2, 0, 1, 0, 1, 0, 2, 1, 3, 1, 2, 0], [1, 0, 0, 1, 1, 0, 0, 0, 0, 1], 9),
   'invalid')]]
for label, args, expected in cases[N - 1]:
    check(label, run(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(away, home, scheduled):
    A = sum(away)
    H = sum(home)
    na, nh = len(away), len(home)
    if nh not in (na, na - 1):
        return 'invalid'
    if nh == na - 1:
        if na >= scheduled and H > A:
            return ['final', 'home', na]
        return ['in progress', None, None]
    if na > scheduled and A != H:
        return ['final', 'home' if H > A else 'away', na]
    return ['in progress', None, None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
    try:
        return solve(*args)
    except Exception as exc:
        return 'raised ' + type(exc).__name__
cases = [[('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: extra inning completion',
   ([3, 2, 1, 1, 0, 2, 0, 1, 0], [3, 1, 1, 2, 1, 3, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('regression: extra inning completion',
   ([1, 1, 0, 1, 1, 0, 3, 0], [1, 0, 3, 0, 0, 2, 0, 3], 7),
   ['final', 'home', 8]),
  ('variant scenario 1',
   ([0, 3, 2, 3, 1, 3, 0, 3, 0], [2, 2, 2, 3, 2, 1, 0, 2], 9),
   ['in progress', None, None]),
  ('variant scenario 2',
   ([3, 0, 0, 3, 1, 1, 0], [2, 0, 0, 3, 1, 1, 1], 7),
   ['in progress', None, None])],
 [('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: extra inning completion',
   ([0, 3, 2, 3, 0, 0, 3, 1, 3, 0, 1, 2], [3, 1, 1, 0, 1, 0, 3, 2, 0, 0, 0, 0], 9),
   ['final', 'away', 12]),
  ('regression: extra inning completion',
   ([0, 1, 1, 0, 1, 1, 1, 1, 0], [1, 0, 2, 3, 0, 1, 0, 1, 3], 9),
   ['final', 'home', 9]),
  ('variant scenario 1', ([0, 1, 0, 1, 0, 0], [0, 2, 2, 0, 3, 0], 9), ['in progress', None, None]),
  ('variant scenario 2',
   ([0, 0, 0, 0, 2, 1, 0], [0, 1, 1, 0, 0, 3, 0], 9),
   ['in progress', None, None])],
 [('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: extra inning completion',
   ([0, 1, 0, 3, 0, 0, 0, 1, 1, 1], [0, 2, 0, 0, 0, 0, 0, 3, 1, 0], 7),
   ['final', 'away', 10]),
  ('regression: extra inning completion',
   ([0, 0, 0, 0, 1, 0, 1, 2, 1], [0, 3, 1, 1, 1, 0, 1, 1, 0], 9),
   ['final', 'home', 9]),
  ('variant scenario 1',
   ([2, 3, 2, 0, 3, 1, 0], [0, 0, 1, 0, 1, 3], 9),
   ['in progress', None, None]),
  ('variant scenario 2',
   ([1, 1, 0, 3, 0, 0, 2, 0, 0, 1, 3], [3, 1, 1, 1, 2, 0, 1, 3, 0, 0], 9),
   ['final', 'home', 11])],
 [('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: extra inning completion',
   ([0, 0, 3, 1, 3, 1, 3], [0, 1, 3, 0, 0, 1, 0], 7),
   ['final', 'away', 7]),
  ('regression: extra inning completion',
   ([1, 1, 0, 2, 0, 2, 0, 0, 3, 0, 1], [3, 0, 1, 2, 3, 1, 3, 1, 1, 2, 0], 9),
   ['final', 'home', 11]),
  ('variant scenario 1',
   ([0, 0, 0, 0, 0, 2, 1, 0, 1, 3, 3, 0], [0, 3, 0, 0, 2, 1, 0, 1, 0, 2, 1], 9),
   ['in progress', None, None]),
  ('variant scenario 2',
   ([3, 0, 1, 0, 1, 2, 0, 2, 3, 2], [2, 1, 0, 0, 0, 1, 1, 0, 3, 0], 7),
   ['final', 'away', 10])],
 [('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: extra inning completion',
   ([3, 1, 1, 3, 1, 1, 2, 2], [1, 1, 1, 0, 3, 1, 0, 1], 7),
   ['final', 'away', 8]),
  ('regression: extra inning completion',
   ([0, 3, 1, 1, 2, 3, 1], [1, 2, 3, 0, 0, 0, 2], 7),
   ['final', 'away', 7]),
  ('variant scenario 1',
   ([0, 1, 0, 1, 3, 1, 1, 0, 3, 2, 1, 2], [2, 0, 3, 1, 0, 3, 0, 0, 1, 0, 2], 9),
   ['in progress', None, None]),
  ('variant scenario 2',
   ([2, 0, 1, 0, 1, 0, 2, 1, 3, 1, 2, 0], [1, 0, 0, 1, 1, 0, 0, 0, 0, 1], 9),
   'invalid')]]
for label, args, expected in cases[N - 1]:
    check(label, run(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 game decided in the tenth inning stays in progress.

Game status from a line score. away and home list runs per inning; home has either the same number of entries as away or one fewer (bottom half not yet played), otherwise return "invalid". When home is one short: if at least scheduled innings have started and home leads, the game is final (home wins without batting); otherwise in progress. When equal length: if at least scheduled innings are complete and the score is not tied, the game is final; ties continue into extra innings. Return ["final", "home"/"away", innings] or ["in progress", None, None].

split: open-access


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

N = 1
observations = []
def solve(away, home, scheduled):
    A = sum(away)
    H = sum(home)
    na, nh = len(away), len(home)
    if nh not in (na, na - 1):
        return 'invalid'
    if nh == na - 1:
        if na >= scheduled and H > A:
            return ['final', 'home', na]
        return ['in progress', None, None]
    if na >= scheduled:
        return ['final', 'home' if H > A else 'away', na]
    return ['in progress', None, None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
    try:
        return solve(*args)
    except Exception as exc:
        return 'raised ' + type(exc).__name__
cases = [[('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: tie continuation',
   ([3, 0, 2, 0, 3, 2, 1, 0, 0, 1, 0, 0], [1, 1, 1, 1, 1, 0, 1, 2, 0, 0, 1, 3], 9),
   ['in progress', None, None]),
  ('variant scenario 1', ([0, 0, 0, 1, 3, 1], [0, 3, 0, 3, 1], 7), ['in progress', None, None]),
  ('variant scenario 2',
   ([0, 0, 0, 3, 0, 1, 2, 0], [1, 1, 0, 2, 3, 2, 2, 3], 7),
   ['final', 'home', 8])],
 [('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: tie continuation',
   ([1, 3, 1, 1, 0, 1, 3, 0, 2], [0, 1, 1, 0, 2, 3, 3, 0, 2], 9),
   ['in progress', None, None]),
  ('variant scenario 1',
   ([0, 0, 1, 3, 0, 1, 1, 0, 2, 0, 0, 3], [0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 12]),
  ('variant scenario 2', ([0, 0, 0, 2, 2, 0, 0], [2, 0, 2, 2, 0], 7), 'invalid')],
 [('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: tie continuation',
   ([0, 0, 3, 2, 0, 1, 0, 2], [1, 1, 0, 0, 3, 1, 0, 2], 7),
   ['in progress', None, None]),
  ('variant scenario 1',
   ([1, 0, 1, 1, 1, 0, 0, 1, 2], [1, 0, 0, 1, 0, 3, 0, 0], 7),
   ['in progress', None, None]),
  ('variant scenario 2', ([1, 0, 1, 3], [0, 0, 2, 2, 1], 7), 'invalid')],
 [('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: tie continuation',
   ([1, 0, 1, 1, 1, 2, 1, 2, 3, 0, 3], [1, 1, 0, 1, 1, 3, 1, 3, 1, 1, 2], 9),
   ['in progress', None, None]),
  ('variant scenario 1', ([0, 1, 2, 0, 1, 0], [2, 0, 3, 0, 0], 9), ['in progress', None, None]),
  ('variant scenario 2',
   ([0, 0, 0, 1, 1, 1, 0, 3, 1], [2, 0, 0, 3, 1, 3, 1, 1, 2], 7),
   ['final', 'home', 9])],
 [('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: tie continuation',
   ([0, 0, 0, 0, 0, 3, 3, 1, 0, 0], [2, 1, 1, 0, 0, 1, 2, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('variant scenario 1', ([0, 0, 1, 0, 1, 1], [3, 2, 3, 0, 0], 9), ['in progress', None, None]),
  ('variant scenario 2', ([0, 3, 0, 0, 1, 0], [1, 1, 1, 0, 1, 2], 7), ['in progress', None, None])]]
for label, args, expected in cases[N - 1]:
    check(label, run(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(away, home, scheduled):
    A = sum(away)
    H = sum(home)
    na, nh = len(away), len(home)
    if nh not in (na, na - 1):
        return 'invalid'
    if nh == na - 1:
        if na >= scheduled and H > A:
            return ['final', 'home', na]
        return ['in progress', None, None]
    if na >= scheduled:
        return ['final', 'home' if H > A else ('away' if A > H else None), na]
    return ['in progress', None, None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
    try:
        return solve(*args)
    except Exception as exc:
        return 'raised ' + type(exc).__name__
cases = [[('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: tie continuation',
   ([3, 0, 2, 0, 3, 2, 1, 0, 0, 1, 0, 0], [1, 1, 1, 1, 1, 0, 1, 2, 0, 0, 1, 3], 9),
   ['in progress', None, None]),
  ('variant scenario 1', ([0, 0, 0, 1, 3, 1], [0, 3, 0, 3, 1], 7), ['in progress', None, None]),
  ('variant scenario 2',
   ([0, 0, 0, 3, 0, 1, 2, 0], [1, 1, 0, 2, 3, 2, 2, 3], 7),
   ['final', 'home', 8])],
 [('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: tie continuation',
   ([1, 3, 1, 1, 0, 1, 3, 0, 2], [0, 1, 1, 0, 2, 3, 3, 0, 2], 9),
   ['in progress', None, None]),
  ('variant scenario 1',
   ([0, 0, 1, 3, 0, 1, 1, 0, 2, 0, 0, 3], [0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 12]),
  ('variant scenario 2', ([0, 0, 0, 2, 2, 0, 0], [2, 0, 2, 2, 0], 7), 'invalid')],
 [('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: tie continuation',
   ([0, 0, 3, 2, 0, 1, 0, 2], [1, 1, 0, 0, 3, 1, 0, 2], 7),
   ['in progress', None, None]),
  ('variant scenario 1',
   ([1, 0, 1, 1, 1, 0, 0, 1, 2], [1, 0, 0, 1, 0, 3, 0, 0], 7),
   ['in progress', None, None]),
  ('variant scenario 2', ([1, 0, 1, 3], [0, 0, 2, 2, 1], 7), 'invalid')],
 [('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: tie continuation',
   ([1, 0, 1, 1, 1, 2, 1, 2, 3, 0, 3], [1, 1, 0, 1, 1, 3, 1, 3, 1, 1, 2], 9),
   ['in progress', None, None]),
  ('variant scenario 1', ([0, 1, 2, 0, 1, 0], [2, 0, 3, 0, 0], 9), ['in progress', None, None]),
  ('variant scenario 2',
   ([0, 0, 0, 1, 1, 1, 0, 3, 1], [2, 0, 0, 3, 1, 3, 1, 1, 2], 7),
   ['final', 'home', 9])],
 [('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: tie continuation',
   ([0, 0, 0, 0, 0, 3, 3, 1, 0, 0], [2, 1, 1, 0, 0, 1, 2, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('variant scenario 1', ([0, 0, 1, 0, 1, 1], [3, 2, 3, 0, 0], 9), ['in progress', None, None]),
  ('variant scenario 2', ([0, 3, 0, 0, 1, 0], [1, 1, 1, 0, 1, 2], 7), ['in progress', None, None])]]
for label, args, expected in cases[N - 1]:
    check(label, run(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 game tied after nine full innings is reported as final.

Game status from a line score. away and home list runs per inning; home has either the same number of entries as away or one fewer (bottom half not yet played), otherwise return "invalid". When home is one short: if at least scheduled innings have started and home leads, the game is final (home wins without batting); otherwise in progress. When equal length: if at least scheduled innings are complete and the score is not tied, the game is final; ties continue into extra innings. Return ["final", "home"/"away", innings] or ["in progress", None, None].

split: open-access


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

N = 1
observations = []
def solve(away, home, scheduled):
    A = sum(away)
    H = sum(home)
    na, nh = len(away), len(home)
    if nh > na:
        return 'invalid'
    if nh == na - 1:
        if na >= scheduled and H > A:
            return ['final', 'home', na]
        return ['in progress', None, None]
    if na >= scheduled and A != H:
        return ['final', 'home' if H > A else 'away', na]
    return ['in progress', None, None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
    try:
        return solve(*args)
    except Exception as exc:
        return 'raised ' + type(exc).__name__
cases = [[('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: line length validation',
   ([2, 0, 0, 0, 1, 1, 3, 3, 2, 1, 1], [1, 3, 0, 1, 0, 1, 1, 3, 1], 9),
   'invalid'),
  ('regression: line length validation',
   ([0, 1, 1, 0, 0, 1, 1, 2, 1, 0], [2, 2, 2, 0, 2, 1, 3, 2, 0, 0, 1], 7),
   'invalid'),
  ('variant scenario 1', ([0, 2, 1, 3, 3, 1], [3, 0, 1, 0, 0, 2], 9), ['in progress', None, None]),
  ('variant scenario 2',
   ([0, 2, 2, 0, 3, 0, 1, 3, 0, 3, 1], [0, 2, 3, 1, 0, 1, 0, 0, 1, 0, 0], 9),
   ['final', 'away', 11])],
 [('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: line length validation',
   ([0, 0, 1, 0, 1, 0, 0, 3], [1, 0, 1, 2, 1, 3], 9),
   'invalid'),
  ('regression: line length validation',
   ([1, 0, 1, 3, 0, 0, 0, 0, 1, 1, 2, 0], [1, 1, 0, 1, 0, 3, 1, 0, 0, 2, 1, 0, 1], 9),
   'invalid'),
  ('variant scenario 1',
   ([2, 1, 2, 3, 0, 1, 1, 0, 0, 0, 0, 1], [2, 1, 0, 2, 2, 0, 2, 1, 0, 1, 1, 2], 9),
   ['final', 'home', 12]),
  ('variant scenario 2',
   ([0, 2, 1, 3, 0, 3, 3], [0, 3, 3, 0, 0, 3, 3], 7),
   ['in progress', None, None])],
 [('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: line length validation',
   ([0, 1, 2, 0, 1, 3, 1, 0, 0, 2], [0, 0, 3, 2, 1, 1, 0, 1, 3, 0, 1], 9),
   'invalid'),
  ('regression: line length validation', ([0, 1, 1, 0, 1, 1], [0, 0, 2, 0], 7), 'invalid'),
  ('variant scenario 1',
   ([3, 0, 3, 1, 0, 0, 0, 0, 1], [1, 0, 3, 0, 3, 2, 0, 0], 7),
   ['final', 'home', 9]),
  ('variant scenario 2', ([0, 0, 1, 0, 3, 0, 0], [0, 3, 2, 3, 3, 0, 0], 7), ['final', 'home', 7])],
 [('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: line length validation',
   ([0, 0, 0, 0, 3, 0, 0, 0, 1, 0], [0, 3, 0, 0, 3, 1, 1, 1], 9),
   'invalid'),
  ('regression: line length validation',
   ([0, 0, 1, 1, 0, 0, 1, 1, 2], [2, 2, 0, 3, 0, 1, 3, 0, 1, 1], 9),
   'invalid'),
  ('variant scenario 1',
   ([1, 2, 0, 1, 1, 0, 0, 1, 0], [1, 0, 1, 1, 1, 1, 3, 0, 0], 9),
   ['final', 'home', 9]),
  ('variant scenario 2',
   ([3, 3, 1, 0, 2, 0, 0, 0], [0, 1, 2, 3, 3, 2, 1], 9),
   ['in progress', None, None])],
 [('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: line length validation',
   ([1, 0, 1, 1, 1, 0, 0, 1, 3, 2, 0, 0], [1, 1, 3, 0, 0, 3, 1, 0, 0, 0], 9),
   'invalid'),
  ('regression: line length validation', ([0, 0, 0, 0, 3, 1], [2, 3, 2, 2, 1, 3, 1], 9), 'invalid'),
  ('variant scenario 1', ([2, 1, 1, 0], [0, 0, 1], 7), ['in progress', None, None]),
  ('variant scenario 2', ([0, 2, 0, 2, 0, 0], [0, 2, 1, 0, 0], 9), ['in progress', None, None])]]
for label, args, expected in cases[N - 1]:
    check(label, run(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(away, home, scheduled):
    A = sum(away)
    H = sum(home)
    na, nh = len(away), len(home)
    if abs(na - nh) > 1:
        return 'invalid'
    if nh == na - 1:
        if na >= scheduled and H > A:
            return ['final', 'home', na]
        return ['in progress', None, None]
    if na >= scheduled and A != H:
        return ['final', 'home' if H > A else 'away', na]
    return ['in progress', None, None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
    try:
        return solve(*args)
    except Exception as exc:
        return 'raised ' + type(exc).__name__
cases = [[('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: line length validation',
   ([2, 0, 0, 0, 1, 1, 3, 3, 2, 1, 1], [1, 3, 0, 1, 0, 1, 1, 3, 1], 9),
   'invalid'),
  ('regression: line length validation',
   ([0, 1, 1, 0, 0, 1, 1, 2, 1, 0], [2, 2, 2, 0, 2, 1, 3, 2, 0, 0, 1], 7),
   'invalid'),
  ('variant scenario 1', ([0, 2, 1, 3, 3, 1], [3, 0, 1, 0, 0, 2], 9), ['in progress', None, None]),
  ('variant scenario 2',
   ([0, 2, 2, 0, 3, 0, 1, 3, 0, 3, 1], [0, 2, 3, 1, 0, 1, 0, 0, 1, 0, 0], 9),
   ['final', 'away', 11])],
 [('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: line length validation',
   ([0, 0, 1, 0, 1, 0, 0, 3], [1, 0, 1, 2, 1, 3], 9),
   'invalid'),
  ('regression: line length validation',
   ([1, 0, 1, 3, 0, 0, 0, 0, 1, 1, 2, 0], [1, 1, 0, 1, 0, 3, 1, 0, 0, 2, 1, 0, 1], 9),
   'invalid'),
  ('variant scenario 1',
   ([2, 1, 2, 3, 0, 1, 1, 0, 0, 0, 0, 1], [2, 1, 0, 2, 2, 0, 2, 1, 0, 1, 1, 2], 9),
   ['final', 'home', 12]),
  ('variant scenario 2',
   ([0, 2, 1, 3, 0, 3, 3], [0, 3, 3, 0, 0, 3, 3], 7),
   ['in progress', None, None])],
 [('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: line length validation',
   ([0, 1, 2, 0, 1, 3, 1, 0, 0, 2], [0, 0, 3, 2, 1, 1, 0, 1, 3, 0, 1], 9),
   'invalid'),
  ('regression: line length validation', ([0, 1, 1, 0, 1, 1], [0, 0, 2, 0], 7), 'invalid'),
  ('variant scenario 1',
   ([3, 0, 3, 1, 0, 0, 0, 0, 1], [1, 0, 3, 0, 3, 2, 0, 0], 7),
   ['final', 'home', 9]),
  ('variant scenario 2', ([0, 0, 1, 0, 3, 0, 0], [0, 3, 2, 3, 3, 0, 0], 7), ['final', 'home', 7])],
 [('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: line length validation',
   ([0, 0, 0, 0, 3, 0, 0, 0, 1, 0], [0, 3, 0, 0, 3, 1, 1, 1], 9),
   'invalid'),
  ('regression: line length validation',
   ([0, 0, 1, 1, 0, 0, 1, 1, 2], [2, 2, 0, 3, 0, 1, 3, 0, 1, 1], 9),
   'invalid'),
  ('variant scenario 1',
   ([1, 2, 0, 1, 1, 0, 0, 1, 0], [1, 0, 1, 1, 1, 1, 3, 0, 0], 9),
   ['final', 'home', 9]),
  ('variant scenario 2',
   ([3, 3, 1, 0, 2, 0, 0, 0], [0, 1, 2, 3, 3, 2, 1], 9),
   ['in progress', None, None])],
 [('control home leads skip bottom ninth',
   ([0, 0, 0, 0, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'home', 9]),
  ('boundary tied after nine',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control away wins in ten',
   ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['final', 'away', 10]),
  ('boundary mid-game', ([1, 0, 0], [0, 0], 9), ['in progress', None, None]),
  ('boundary home trails before bottom ninth',
   ([1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], 9),
   ['in progress', None, None]),
  ('control malformed line', ([1, 0], [0, 0, 0], 9), 'invalid'),
  ('regression: line length validation',
   ([1, 0, 1, 1, 1, 0, 0, 1, 3, 2, 0, 0], [1, 1, 3, 0, 0, 3, 1, 0, 0, 0], 9),
   'invalid'),
  ('regression: line length validation', ([0, 0, 0, 0, 3, 1], [2, 3, 2, 2, 1, 3, 1], 9), 'invalid'),
  ('variant scenario 1', ([2, 1, 1, 0], [0, 0, 1], 7), ['in progress', None, None]),
  ('variant scenario 2', ([0, 2, 0, 2, 0, 0], [0, 2, 1, 0, 0], 9), ['in progress', None, None])]]
for label, args, expected in cases[N - 1]:
    check(label, run(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 line score with two missing home innings or an extra home inning is scored.

Game status from a line score. away and home list runs per inning; home has either the same number of entries as away or one fewer (bottom half not yet played), otherwise return "invalid". When home is one short: if at least scheduled innings have started and home leads, the game is final (home wins without batting); otherwise in progress. When equal length: if at least scheduled innings are complete and the score is not tied, the game is final; ties continue into extra innings. Return ["final", "home"/"away", innings] or ["in progress", None, None].

split: open-access