broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import datetime as dt
import calendar
N = 1
observations = []
def solve(commenced, diversity, defendants, holidays):
    c = dt.date.fromisoformat(commenced)
    hol = {dt.date.fromisoformat(x) for x in holidays}
    bar = dt.date(c.year + 1, c.month, min(c.day, calendar.monthrange(c.year + 1, c.month)[1]))
    triggers = []
    for name, served, received in defendants:
        s = dt.date.fromisoformat(served)
        r = dt.date.fromisoformat(received) if received else None
        triggers.append(max(s, r) if r else s)
    first = min(triggers)
    out = []
    for (name, served, received), trig in zip(defendants, triggers):
        base = trig
        d = base + dt.timedelta(days=30)
        while d.weekday() >= 5 or d in hol:
            d += dt.timedelta(days=1)
        if True:
            if trig > bar:
                out.append([name, 'barred'])
                continue
            d = min(d, bar)
        out.append([name, d.isoformat()])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: courtesy copy before service',
   ['2024-01-10',
    False,
    [['acme', '2024-03-01', '2024-02-20']],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-04-01']]),
  ('later receipt via agent',
   ['2024-01-10',
    False,
    [['acme', '2024-03-01', '2024-03-06']],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-04-05']]),
  ('later served defendant',
   ['2024-01-10',
    False,
    [['acme', '2024-02-01', None], ['beta', '2024-06-03', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-04'], ['beta', '2024-07-03']]),
  ('later served within 30',
   ['2024-01-10',
    False,
    [['acme', '2024-02-01', None], ['beta', '2024-02-20', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-04'], ['beta', '2024-03-21']]),
  ('federal question late',
   ['2023-01-10',
    False,
    [['acme', '2024-01-05', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-02-05']]),
  ('diversity capped',
   ['2023-01-10',
    True,
    [['acme', '2023-12-20', None]],
    ['2023-01-02',
     '2023-01-16',
     '2023-02-20',
     '2023-05-29',
     '2023-06-19',
     '2023-07-04',
     '2023-09-04',
     '2023-10-09',
     '2023-11-10',
     '2023-11-23',
     '2023-12-25',
     '2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-01-10']]),
  ('diversity barred',
   ['2023-01-10',
    True,
    [['acme', '2024-01-15', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', 'barred']]),
  ('federal question two defendants late',
   ['2023-01-10',
    False,
    [['acme', '2023-02-01', None], ['beta', '2024-01-20', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2023-03-03'], ['beta', '2024-02-20']])],
 [('later served defendant',
   ['2024-01-10',
    False,
    [['acme', '2024-02-01', None], ['beta', '2024-06-03', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-04'], ['beta', '2024-07-03']]),
  ('later served within 30',
   ['2024-01-10',
    False,
    [['acme', '2024-02-01', None], ['beta', '2024-02-20', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-04'], ['beta', '2024-03-21']]),
  ('federal question late',
   ['2023-01-10',
    False,
    [['acme', '2024-01-05', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-02-05']]),
  ('diversity capped',
   ['2023-01-10',
    True,
    [['acme', '2023-12-20', None]],
    ['2023-01-02',
     '2023-01-16',
     '2023-02-20',
     '2023-05-29',
     '2023-06-19',
     '2023-07-04',
     '2023-09-04',
     '2023-10-09',
     '2023-11-10',
     '2023-11-23',
     '2023-12-25',
     '2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-01-10']]),
  ('diversity barred',
   ['2023-01-10',
    True,
    [['acme', '2024-01-15', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', 'barred']]),
  ('diversity served eleven months',
   ['2023-03-15',
    True,
    [['acme', '2024-02-20', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-15']]),
  ('served on anniversary',
   ['2023-03-15',
    True,
    [['acme', '2024-03-15', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-15']]),
  ('federal question two defendants late',
   ['2023-01-10',
    False,
    [['acme', '2023-02-01', None], ['beta', '2024-01-20', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2023-03-03'], ['beta', '2024-02-20']])],
 [('federal question late',
   ['2023-01-10',
    False,
    [['acme', '2024-01-05', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-02-05']]),
  ('diversity capped',
   ['2023-01-10',
    True,
    [['acme', '2023-12-20', None]],
    ['2023-01-02',
     '2023-01-16',
     '2023-02-20',
     '2023-05-29',
     '2023-06-19',
     '2023-07-04',
     '2023-09-04',
     '2023-10-09',
     '2023-11-10',
     '2023-11-23',
     '2023-12-25',
     '2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-01-10']]),
  ('diversity barred',
   ['2023-01-10',
    True,
    [['acme', '2024-01-15', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', 'barred']]),
  ('diversity served eleven months',
   ['2023-03-15',
    True,
    [['acme', '2024-02-20', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-15']]),
  ('served on anniversary',
   ['2023-03-15',
    True,
    [['acme', '2024-03-15', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-15']]),
  ('two defendants diversity',
   ['2023-06-01',
    True,
    [['acme', '2023-07-03', None], ['beta', '2024-05-20', None]],
    ['2023-01-02',
     '2023-01-16',
     '2023-02-20',
     '2023-05-29',
     '2023-06-19',
     '2023-07-04',
     '2023-09-04',
     '2023-10-09',
     '2023-11-10',
     '2023-11-23',
     '2023-12-25',
     '2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2023-08-02'], ['beta', '2024-06-01']]),
  ('deadline lands on holiday',
   ['2024-01-10',
    False,
    [['acme', '2024-05-28', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-06-27']]),
  ('federal question two defendants late',
   ['2023-01-10',
    False,
    [['acme', '2023-02-01', None], ['beta', '2024-01-20', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2023-03-03'], ['beta', '2024-02-20']])],
 [('diversity barred',
   ['2023-01-10',
    True,
    [['acme', '2024-01-15', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', 'barred']]),
  ('diversity served eleven months',
   ['2023-03-15',
    True,
    [['acme', '2024-02-20', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-15']]),
  ('served on anniversary',
   ['2023-03-15',
    True,
    [['acme', '2024-03-15', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-15']]),
  ('two defendants diversity',
   ['2023-06-01',
    True,
    [['acme', '2023-07-03', None], ['beta', '2024-05-20', None]],
    ['2023-01-02',
     '2023-01-16',
     '2023-02-20',
     '2023-05-29',
     '2023-06-19',
     '2023-07-04',
     '2023-09-04',
     '2023-10-09',
     '2023-11-10',
     '2023-11-23',
     '2023-12-25',
     '2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2023-08-02'], ['beta', '2024-06-01']]),
  ('deadline lands on holiday',
   ['2024-01-10',
    False,
    [['acme', '2024-05-28', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-06-27']]),
  ('federal question two defendants late',
   ['2023-01-10',
    False,
    [['acme', '2023-02-01', None], ['beta', '2024-01-20', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2023-03-03'], ['beta', '2024-02-20']]),
  ('diversity before leap day',
   ['2023-03-01',
    True,
    [['acme', '2024-02-10', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-01']])],
 [('served on anniversary',
   ['2023-03-15',
    True,
    [['acme', '2024-03-15', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-15']]),
  ('two defendants diversity',
   ['2023-06-01',
    True,
    [['acme', '2023-07-03', None], ['beta', '2024-05-20', None]],
    ['2023-01-02',
     '2023-01-16',
     '2023-02-20',
     '2023-05-29',
     '2023-06-19',
     '2023-07-04',
     '2023-09-04',
     '2023-10-09',
     '2023-11-10',
     '2023-11-23',
     '2023-12-25',
     '2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2023-08-02'], ['beta', '2024-06-01']]),
  ('deadline lands on holiday',
   ['2024-01-10',
    False,
    [['acme', '2024-05-28', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-06-27']]),
  ('federal question two defendants late',
   ['2023-01-10',
    False,
    [['acme', '2023-02-01', None], ['beta', '2024-01-20', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2023-03-03'], ['beta', '2024-02-20']]),
  ('diversity before leap day',
   ['2023-03-01',
    True,
    [['acme', '2024-02-10', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-01']]),
  ('diversity commenced leap day',
   ['2024-02-29',
    True,
    [['acme', '2025-02-10', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2025-02-28']]),
  ('regression: courtesy copy before service',
   ['2024-01-10',
    False,
    [['acme', '2024-03-01', '2024-02-20']],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-04-01']])]]
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
import datetime as dt
import calendar
N = 1
observations = []
def solve(commenced, diversity, defendants, holidays):
    c = dt.date.fromisoformat(commenced)
    hol = {dt.date.fromisoformat(x) for x in holidays}
    bar = dt.date(c.year + 1, c.month, min(c.day, calendar.monthrange(c.year + 1, c.month)[1]))
    triggers = []
    for name, served, received in defendants:
        s = dt.date.fromisoformat(served)
        r = dt.date.fromisoformat(received) if received else None
        triggers.append(max(s, r) if r else s)
    first = min(triggers)
    out = []
    for (name, served, received), trig in zip(defendants, triggers):
        base = trig
        d = base + dt.timedelta(days=30)
        while d.weekday() >= 5 or d in hol:
            d += dt.timedelta(days=1)
        if diversity or len(defendants) > 1:
            if trig > bar:
                out.append([name, 'barred'])
                continue
            d = min(d, bar)
        out.append([name, d.isoformat()])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: courtesy copy before service',
   ['2024-01-10',
    False,
    [['acme', '2024-03-01', '2024-02-20']],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-04-01']]),
  ('later receipt via agent',
   ['2024-01-10',
    False,
    [['acme', '2024-03-01', '2024-03-06']],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-04-05']]),
  ('later served defendant',
   ['2024-01-10',
    False,
    [['acme', '2024-02-01', None], ['beta', '2024-06-03', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-04'], ['beta', '2024-07-03']]),
  ('later served within 30',
   ['2024-01-10',
    False,
    [['acme', '2024-02-01', None], ['beta', '2024-02-20', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-04'], ['beta', '2024-03-21']]),
  ('federal question late',
   ['2023-01-10',
    False,
    [['acme', '2024-01-05', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-02-05']]),
  ('diversity capped',
   ['2023-01-10',
    True,
    [['acme', '2023-12-20', None]],
    ['2023-01-02',
     '2023-01-16',
     '2023-02-20',
     '2023-05-29',
     '2023-06-19',
     '2023-07-04',
     '2023-09-04',
     '2023-10-09',
     '2023-11-10',
     '2023-11-23',
     '2023-12-25',
     '2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-01-10']]),
  ('diversity barred',
   ['2023-01-10',
    True,
    [['acme', '2024-01-15', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', 'barred']]),
  ('federal question two defendants late',
   ['2023-01-10',
    False,
    [['acme', '2023-02-01', None], ['beta', '2024-01-20', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2023-03-03'], ['beta', '2024-02-20']])],
 [('later served defendant',
   ['2024-01-10',
    False,
    [['acme', '2024-02-01', None], ['beta', '2024-06-03', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-04'], ['beta', '2024-07-03']]),
  ('later served within 30',
   ['2024-01-10',
    False,
    [['acme', '2024-02-01', None], ['beta', '2024-02-20', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-04'], ['beta', '2024-03-21']]),
  ('federal question late',
   ['2023-01-10',
    False,
    [['acme', '2024-01-05', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-02-05']]),
  ('diversity capped',
   ['2023-01-10',
    True,
    [['acme', '2023-12-20', None]],
    ['2023-01-02',
     '2023-01-16',
     '2023-02-20',
     '2023-05-29',
     '2023-06-19',
     '2023-07-04',
     '2023-09-04',
     '2023-10-09',
     '2023-11-10',
     '2023-11-23',
     '2023-12-25',
     '2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-01-10']]),
  ('diversity barred',
   ['2023-01-10',
    True,
    [['acme', '2024-01-15', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', 'barred']]),
  ('diversity served eleven months',
   ['2023-03-15',
    True,
    [['acme', '2024-02-20', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-15']]),
  ('served on anniversary',
   ['2023-03-15',
    True,
    [['acme', '2024-03-15', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-15']]),
  ('federal question two defendants late',
   ['2023-01-10',
    False,
    [['acme', '2023-02-01', None], ['beta', '2024-01-20', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2023-03-03'], ['beta', '2024-02-20']])],
 [('federal question late',
   ['2023-01-10',
    False,
    [['acme', '2024-01-05', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-02-05']]),
  ('diversity capped',
   ['2023-01-10',
    True,
    [['acme', '2023-12-20', None]],
    ['2023-01-02',
     '2023-01-16',
     '2023-02-20',
     '2023-05-29',
     '2023-06-19',
     '2023-07-04',
     '2023-09-04',
     '2023-10-09',
     '2023-11-10',
     '2023-11-23',
     '2023-12-25',
     '2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-01-10']]),
  ('diversity barred',
   ['2023-01-10',
    True,
    [['acme', '2024-01-15', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', 'barred']]),
  ('diversity served eleven months',
   ['2023-03-15',
    True,
    [['acme', '2024-02-20', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-15']]),
  ('served on anniversary',
   ['2023-03-15',
    True,
    [['acme', '2024-03-15', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-15']]),
  ('two defendants diversity',
   ['2023-06-01',
    True,
    [['acme', '2023-07-03', None], ['beta', '2024-05-20', None]],
    ['2023-01-02',
     '2023-01-16',
     '2023-02-20',
     '2023-05-29',
     '2023-06-19',
     '2023-07-04',
     '2023-09-04',
     '2023-10-09',
     '2023-11-10',
     '2023-11-23',
     '2023-12-25',
     '2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2023-08-02'], ['beta', '2024-06-01']]),
  ('deadline lands on holiday',
   ['2024-01-10',
    False,
    [['acme', '2024-05-28', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-06-27']]),
  ('federal question two defendants late',
   ['2023-01-10',
    False,
    [['acme', '2023-02-01', None], ['beta', '2024-01-20', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2023-03-03'], ['beta', '2024-02-20']])],
 [('diversity barred',
   ['2023-01-10',
    True,
    [['acme', '2024-01-15', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', 'barred']]),
  ('diversity served eleven months',
   ['2023-03-15',
    True,
    [['acme', '2024-02-20', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-15']]),
  ('served on anniversary',
   ['2023-03-15',
    True,
    [['acme', '2024-03-15', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-15']]),
  ('two defendants diversity',
   ['2023-06-01',
    True,
    [['acme', '2023-07-03', None], ['beta', '2024-05-20', None]],
    ['2023-01-02',
     '2023-01-16',
     '2023-02-20',
     '2023-05-29',
     '2023-06-19',
     '2023-07-04',
     '2023-09-04',
     '2023-10-09',
     '2023-11-10',
     '2023-11-23',
     '2023-12-25',
     '2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2023-08-02'], ['beta', '2024-06-01']]),
  ('deadline lands on holiday',
   ['2024-01-10',
    False,
    [['acme', '2024-05-28', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-06-27']]),
  ('federal question two defendants late',
   ['2023-01-10',
    False,
    [['acme', '2023-02-01', None], ['beta', '2024-01-20', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2023-03-03'], ['beta', '2024-02-20']]),
  ('diversity before leap day',
   ['2023-03-01',
    True,
    [['acme', '2024-02-10', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-01']])],
 [('served on anniversary',
   ['2023-03-15',
    True,
    [['acme', '2024-03-15', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-15']]),
  ('two defendants diversity',
   ['2023-06-01',
    True,
    [['acme', '2023-07-03', None], ['beta', '2024-05-20', None]],
    ['2023-01-02',
     '2023-01-16',
     '2023-02-20',
     '2023-05-29',
     '2023-06-19',
     '2023-07-04',
     '2023-09-04',
     '2023-10-09',
     '2023-11-10',
     '2023-11-23',
     '2023-12-25',
     '2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2023-08-02'], ['beta', '2024-06-01']]),
  ('deadline lands on holiday',
   ['2024-01-10',
    False,
    [['acme', '2024-05-28', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-06-27']]),
  ('federal question two defendants late',
   ['2023-01-10',
    False,
    [['acme', '2023-02-01', None], ['beta', '2024-01-20', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2023-03-03'], ['beta', '2024-02-20']]),
  ('diversity before leap day',
   ['2023-03-01',
    True,
    [['acme', '2024-02-10', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-01']]),
  ('diversity commenced leap day',
   ['2024-02-29',
    True,
    [['acme', '2025-02-10', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2025-02-28']]),
  ('regression: courtesy copy before service',
   ['2024-01-10',
    False,
    [['acme', '2024-03-01', '2024-02-20']],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-04-01']])]]
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:
The one-year bar is applied to a federal-question case.

Stipulated: each defendant [name, served, received] has 30 days from its own trigger, where the trigger is formal service, or later receipt of the pleading when received (not None) after service; a courtesy copy received before service does not start the clock. A deadline on a weekend or listed holiday moves to the next open day. In diversity cases removal is additionally barred after one year from commencement (anniversary, never moved): the deadline is capped there, and a defendant whose trigger is after the bar gets "barred". Return [[name, deadline or "barred"]].

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import datetime as dt
import calendar
N = 1
observations = []
def solve(commenced, diversity, defendants, holidays):
    c = dt.date.fromisoformat(commenced)
    hol = {dt.date.fromisoformat(x) for x in holidays}
    bar = dt.date(c.year + 1, c.month, min(c.day, calendar.monthrange(c.year + 1, c.month)[1]))
    triggers = []
    for name, served, received in defendants:
        s = dt.date.fromisoformat(served)
        r = dt.date.fromisoformat(received) if received else None
        triggers.append(max(s, r) if r else s)
    first = min(triggers)
    out = []
    for (name, served, received), trig in zip(defendants, triggers):
        base = trig
        d = base + dt.timedelta(days=30)
        while d.weekday() >= 5 or d in hol:
            d += dt.timedelta(days=1)
        if diversity:
            if base > bar - dt.timedelta(days=30):
                out.append([name, 'barred'])
                continue
            d = min(d, bar)
        out.append([name, d.isoformat()])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: courtesy copy before service',
   ['2024-01-10',
    False,
    [['acme', '2024-03-01', '2024-02-20']],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-04-01']]),
  ('later receipt via agent',
   ['2024-01-10',
    False,
    [['acme', '2024-03-01', '2024-03-06']],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-04-05']]),
  ('later served defendant',
   ['2024-01-10',
    False,
    [['acme', '2024-02-01', None], ['beta', '2024-06-03', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-04'], ['beta', '2024-07-03']]),
  ('later served within 30',
   ['2024-01-10',
    False,
    [['acme', '2024-02-01', None], ['beta', '2024-02-20', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-04'], ['beta', '2024-03-21']]),
  ('federal question late',
   ['2023-01-10',
    False,
    [['acme', '2024-01-05', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-02-05']]),
  ('diversity capped',
   ['2023-01-10',
    True,
    [['acme', '2023-12-20', None]],
    ['2023-01-02',
     '2023-01-16',
     '2023-02-20',
     '2023-05-29',
     '2023-06-19',
     '2023-07-04',
     '2023-09-04',
     '2023-10-09',
     '2023-11-10',
     '2023-11-23',
     '2023-12-25',
     '2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-01-10']]),
  ('diversity barred',
   ['2023-01-10',
    True,
    [['acme', '2024-01-15', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', 'barred']]),
  ('served on anniversary',
   ['2023-03-15',
    True,
    [['acme', '2024-03-15', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-15']])],
 [('later served defendant',
   ['2024-01-10',
    False,
    [['acme', '2024-02-01', None], ['beta', '2024-06-03', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-04'], ['beta', '2024-07-03']]),
  ('later served within 30',
   ['2024-01-10',
    False,
    [['acme', '2024-02-01', None], ['beta', '2024-02-20', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-04'], ['beta', '2024-03-21']]),
  ('federal question late',
   ['2023-01-10',
    False,
    [['acme', '2024-01-05', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-02-05']]),
  ('diversity capped',
   ['2023-01-10',
    True,
    [['acme', '2023-12-20', None]],
    ['2023-01-02',
     '2023-01-16',
     '2023-02-20',
     '2023-05-29',
     '2023-06-19',
     '2023-07-04',
     '2023-09-04',
     '2023-10-09',
     '2023-11-10',
     '2023-11-23',
     '2023-12-25',
     '2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-01-10']]),
  ('diversity barred',
   ['2023-01-10',
    True,
    [['acme', '2024-01-15', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', 'barred']]),
  ('diversity served eleven months',
   ['2023-03-15',
    True,
    [['acme', '2024-02-20', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-15']]),
  ('served on anniversary',
   ['2023-03-15',
    True,
    [['acme', '2024-03-15', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-15']])],
 [('federal question late',
   ['2023-01-10',
    False,
    [['acme', '2024-01-05', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-02-05']]),
  ('diversity capped',
   ['2023-01-10',
    True,
    [['acme', '2023-12-20', None]],
    ['2023-01-02',
     '2023-01-16',
     '2023-02-20',
     '2023-05-29',
     '2023-06-19',
     '2023-07-04',
     '2023-09-04',
     '2023-10-09',
     '2023-11-10',
     '2023-11-23',
     '2023-12-25',
     '2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-01-10']]),
  ('diversity barred',
   ['2023-01-10',
    True,
    [['acme', '2024-01-15', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', 'barred']]),
  ('diversity served eleven months',
   ['2023-03-15',
    True,
    [['acme', '2024-02-20', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-15']]),
  ('served on anniversary',
   ['2023-03-15',
    True,
    [['acme', '2024-03-15', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-15']]),
  ('two defendants diversity',
   ['2023-06-01',
    True,
    [['acme', '2023-07-03', None], ['beta', '2024-05-20', None]],
    ['2023-01-02',
     '2023-01-16',
     '2023-02-20',
     '2023-05-29',
     '2023-06-19',
     '2023-07-04',
     '2023-09-04',
     '2023-10-09',
     '2023-11-10',
     '2023-11-23',
     '2023-12-25',
     '2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2023-08-02'], ['beta', '2024-06-01']]),
  ('deadline lands on holiday',
   ['2024-01-10',
    False,
    [['acme', '2024-05-28', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-06-27']])],
 [('diversity barred',
   ['2023-01-10',
    True,
    [['acme', '2024-01-15', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', 'barred']]),
  ('diversity served eleven months',
   ['2023-03-15',
    True,
    [['acme', '2024-02-20', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-15']]),
  ('served on anniversary',
   ['2023-03-15',
    True,
    [['acme', '2024-03-15', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-15']]),
  ('two defendants diversity',
   ['2023-06-01',
    True,
    [['acme', '2023-07-03', None], ['beta', '2024-05-20', None]],
    ['2023-01-02',
     '2023-01-16',
     '2023-02-20',
     '2023-05-29',
     '2023-06-19',
     '2023-07-04',
     '2023-09-04',
     '2023-10-09',
     '2023-11-10',
     '2023-11-23',
     '2023-12-25',
     '2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2023-08-02'], ['beta', '2024-06-01']]),
  ('deadline lands on holiday',
   ['2024-01-10',
    False,
    [['acme', '2024-05-28', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-06-27']]),
  ('federal question two defendants late',
   ['2023-01-10',
    False,
    [['acme', '2023-02-01', None], ['beta', '2024-01-20', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2023-03-03'], ['beta', '2024-02-20']]),
  ('diversity before leap day',
   ['2023-03-01',
    True,
    [['acme', '2024-02-10', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-01']])],
 [('served on anniversary',
   ['2023-03-15',
    True,
    [['acme', '2024-03-15', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-15']]),
  ('two defendants diversity',
   ['2023-06-01',
    True,
    [['acme', '2023-07-03', None], ['beta', '2024-05-20', None]],
    ['2023-01-02',
     '2023-01-16',
     '2023-02-20',
     '2023-05-29',
     '2023-06-19',
     '2023-07-04',
     '2023-09-04',
     '2023-10-09',
     '2023-11-10',
     '2023-11-23',
     '2023-12-25',
     '2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2023-08-02'], ['beta', '2024-06-01']]),
  ('deadline lands on holiday',
   ['2024-01-10',
    False,
    [['acme', '2024-05-28', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-06-27']]),
  ('federal question two defendants late',
   ['2023-01-10',
    False,
    [['acme', '2023-02-01', None], ['beta', '2024-01-20', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2023-03-03'], ['beta', '2024-02-20']]),
  ('diversity before leap day',
   ['2023-03-01',
    True,
    [['acme', '2024-02-10', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-01']]),
  ('diversity commenced leap day',
   ['2024-02-29',
    True,
    [['acme', '2025-02-10', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2025-02-28']]),
  ('regression: courtesy copy before service',
   ['2024-01-10',
    False,
    [['acme', '2024-03-01', '2024-02-20']],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-04-01']])]]
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
import datetime as dt
import calendar
N = 1
observations = []
def solve(commenced, diversity, defendants, holidays):
    c = dt.date.fromisoformat(commenced)
    hol = {dt.date.fromisoformat(x) for x in holidays}
    bar = dt.date(c.year + 1, c.month, min(c.day, calendar.monthrange(c.year + 1, c.month)[1]))
    triggers = []
    for name, served, received in defendants:
        s = dt.date.fromisoformat(served)
        r = dt.date.fromisoformat(received) if received else None
        triggers.append(max(s, r) if r else s)
    first = min(triggers)
    out = []
    for (name, served, received), trig in zip(defendants, triggers):
        base = trig
        d = base + dt.timedelta(days=30)
        while d.weekday() >= 5 or d in hol:
            d += dt.timedelta(days=1)
        if diversity:
            if trig >= bar:
                out.append([name, 'barred'])
                continue
            d = min(d, bar)
        out.append([name, d.isoformat()])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: courtesy copy before service',
   ['2024-01-10',
    False,
    [['acme', '2024-03-01', '2024-02-20']],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-04-01']]),
  ('later receipt via agent',
   ['2024-01-10',
    False,
    [['acme', '2024-03-01', '2024-03-06']],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-04-05']]),
  ('later served defendant',
   ['2024-01-10',
    False,
    [['acme', '2024-02-01', None], ['beta', '2024-06-03', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-04'], ['beta', '2024-07-03']]),
  ('later served within 30',
   ['2024-01-10',
    False,
    [['acme', '2024-02-01', None], ['beta', '2024-02-20', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-04'], ['beta', '2024-03-21']]),
  ('federal question late',
   ['2023-01-10',
    False,
    [['acme', '2024-01-05', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-02-05']]),
  ('diversity capped',
   ['2023-01-10',
    True,
    [['acme', '2023-12-20', None]],
    ['2023-01-02',
     '2023-01-16',
     '2023-02-20',
     '2023-05-29',
     '2023-06-19',
     '2023-07-04',
     '2023-09-04',
     '2023-10-09',
     '2023-11-10',
     '2023-11-23',
     '2023-12-25',
     '2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-01-10']]),
  ('diversity barred',
   ['2023-01-10',
    True,
    [['acme', '2024-01-15', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', 'barred']]),
  ('served on anniversary',
   ['2023-03-15',
    True,
    [['acme', '2024-03-15', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-15']])],
 [('later served defendant',
   ['2024-01-10',
    False,
    [['acme', '2024-02-01', None], ['beta', '2024-06-03', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-04'], ['beta', '2024-07-03']]),
  ('later served within 30',
   ['2024-01-10',
    False,
    [['acme', '2024-02-01', None], ['beta', '2024-02-20', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-04'], ['beta', '2024-03-21']]),
  ('federal question late',
   ['2023-01-10',
    False,
    [['acme', '2024-01-05', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-02-05']]),
  ('diversity capped',
   ['2023-01-10',
    True,
    [['acme', '2023-12-20', None]],
    ['2023-01-02',
     '2023-01-16',
     '2023-02-20',
     '2023-05-29',
     '2023-06-19',
     '2023-07-04',
     '2023-09-04',
     '2023-10-09',
     '2023-11-10',
     '2023-11-23',
     '2023-12-25',
     '2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-01-10']]),
  ('diversity barred',
   ['2023-01-10',
    True,
    [['acme', '2024-01-15', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', 'barred']]),
  ('diversity served eleven months',
   ['2023-03-15',
    True,
    [['acme', '2024-02-20', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-15']]),
  ('served on anniversary',
   ['2023-03-15',
    True,
    [['acme', '2024-03-15', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-15']])],
 [('federal question late',
   ['2023-01-10',
    False,
    [['acme', '2024-01-05', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-02-05']]),
  ('diversity capped',
   ['2023-01-10',
    True,
    [['acme', '2023-12-20', None]],
    ['2023-01-02',
     '2023-01-16',
     '2023-02-20',
     '2023-05-29',
     '2023-06-19',
     '2023-07-04',
     '2023-09-04',
     '2023-10-09',
     '2023-11-10',
     '2023-11-23',
     '2023-12-25',
     '2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-01-10']]),
  ('diversity barred',
   ['2023-01-10',
    True,
    [['acme', '2024-01-15', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', 'barred']]),
  ('diversity served eleven months',
   ['2023-03-15',
    True,
    [['acme', '2024-02-20', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-15']]),
  ('served on anniversary',
   ['2023-03-15',
    True,
    [['acme', '2024-03-15', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-15']]),
  ('two defendants diversity',
   ['2023-06-01',
    True,
    [['acme', '2023-07-03', None], ['beta', '2024-05-20', None]],
    ['2023-01-02',
     '2023-01-16',
     '2023-02-20',
     '2023-05-29',
     '2023-06-19',
     '2023-07-04',
     '2023-09-04',
     '2023-10-09',
     '2023-11-10',
     '2023-11-23',
     '2023-12-25',
     '2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2023-08-02'], ['beta', '2024-06-01']]),
  ('deadline lands on holiday',
   ['2024-01-10',
    False,
    [['acme', '2024-05-28', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-06-27']])],
 [('diversity barred',
   ['2023-01-10',
    True,
    [['acme', '2024-01-15', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', 'barred']]),
  ('diversity served eleven months',
   ['2023-03-15',
    True,
    [['acme', '2024-02-20', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-15']]),
  ('served on anniversary',
   ['2023-03-15',
    True,
    [['acme', '2024-03-15', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-15']]),
  ('two defendants diversity',
   ['2023-06-01',
    True,
    [['acme', '2023-07-03', None], ['beta', '2024-05-20', None]],
    ['2023-01-02',
     '2023-01-16',
     '2023-02-20',
     '2023-05-29',
     '2023-06-19',
     '2023-07-04',
     '2023-09-04',
     '2023-10-09',
     '2023-11-10',
     '2023-11-23',
     '2023-12-25',
     '2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2023-08-02'], ['beta', '2024-06-01']]),
  ('deadline lands on holiday',
   ['2024-01-10',
    False,
    [['acme', '2024-05-28', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-06-27']]),
  ('federal question two defendants late',
   ['2023-01-10',
    False,
    [['acme', '2023-02-01', None], ['beta', '2024-01-20', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2023-03-03'], ['beta', '2024-02-20']]),
  ('diversity before leap day',
   ['2023-03-01',
    True,
    [['acme', '2024-02-10', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-01']])],
 [('served on anniversary',
   ['2023-03-15',
    True,
    [['acme', '2024-03-15', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-15']]),
  ('two defendants diversity',
   ['2023-06-01',
    True,
    [['acme', '2023-07-03', None], ['beta', '2024-05-20', None]],
    ['2023-01-02',
     '2023-01-16',
     '2023-02-20',
     '2023-05-29',
     '2023-06-19',
     '2023-07-04',
     '2023-09-04',
     '2023-10-09',
     '2023-11-10',
     '2023-11-23',
     '2023-12-25',
     '2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2023-08-02'], ['beta', '2024-06-01']]),
  ('deadline lands on holiday',
   ['2024-01-10',
    False,
    [['acme', '2024-05-28', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-06-27']]),
  ('federal question two defendants late',
   ['2023-01-10',
    False,
    [['acme', '2023-02-01', None], ['beta', '2024-01-20', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2023-03-03'], ['beta', '2024-02-20']]),
  ('diversity before leap day',
   ['2023-03-01',
    True,
    [['acme', '2024-02-10', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-03-01']]),
  ('diversity commenced leap day',
   ['2024-02-29',
    True,
    [['acme', '2025-02-10', None]],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2025-02-28']]),
  ('regression: courtesy copy before service',
   ['2024-01-10',
    False,
    [['acme', '2024-03-01', '2024-02-20']],
    ['2024-01-01',
     '2024-01-15',
     '2024-02-19',
     '2024-05-27',
     '2024-06-19',
     '2024-07-04',
     '2024-09-02',
     '2024-10-14',
     '2024-11-11',
     '2024-11-28',
     '2024-12-25']],
   [['acme', '2024-04-01']])]]
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 defendant served eleven months in is reported as barred although removal is still possible until the anniversary.

Stipulated: each defendant [name, served, received] has 30 days from its own trigger, where the trigger is formal service, or later receipt of the pleading when received (not None) after service; a courtesy copy received before service does not start the clock. A deadline on a weekend or listed holiday moves to the next open day. In diversity cases removal is additionally barred after one year from commencement (anniversary, never moved): the deadline is capped there, and a defendant whose trigger is after the bar gets "barred". Return [[name, deadline or "barred"]].

split: open-access


prompt:
An opposition deadline falling on Saturday is reported as Saturday and the reply is computed from it.

Stipulated: the opposition is due 14 days after the motion was served; the reply is due 7 days after the opposition due date, or after actual service of the opposition if it was served earlier. Every computed deadline on a weekend or listed holiday moves to the next open day before it is used as the base of a later deadline. The hearing is compliant when it is at least 7 days after the reply due date. Return [opposition due, reply due, compliant].

split: open-access


prompt:
A late-served opposition pushes the reply deadline back.

Stipulated: the opposition is due 14 days after the motion was served; the reply is due 7 days after the opposition due date, or after actual service of the opposition if it was served earlier. Every computed deadline on a weekend or listed holiday moves to the next open day before it is used as the base of a later deadline. The hearing is compliant when it is at least 7 days after the reply due date. Return [opposition due, reply due, compliant].

split: open-access


prompt:
A hearing exactly seven days after the reply due date is flagged as non-compliant.

Stipulated: the opposition is due 14 days after the motion was served; the reply is due 7 days after the opposition due date, or after actual service of the opposition if it was served earlier. Every computed deadline on a weekend or listed holiday moves to the next open day before it is used as the base of a later deadline. The hearing is compliant when it is at least 7 days after the reply due date. Return [opposition due, reply due, compliant].

split: open-access


prompt:
A later partial-closure entry overwrites an earlier full-day outage for the same day.

Stipulated: closures are [date, start] where start is "all" (full-day outage) or a local "HH:MM" time the office closed early; several entries for one day merge to "all" if any is "all", else the earliest start. A last day is inaccessible for paper or fax filing if closed all day or early before office_close; for electronic filing only a full-day outage counts. If the last day is inaccessible, the period continues to the first later day that is not a weekend, listed holiday or itself inaccessible.

split: open-access


prompt:
An afternoon clerk office closure extends an electronic filing deadline.

Stipulated: closures are [date, start] where start is "all" (full-day outage) or a local "HH:MM" time the office closed early; several entries for one day merge to "all" if any is "all", else the earliest start. A last day is inaccessible for paper or fax filing if closed all day or early before office_close; for electronic filing only a full-day outage counts. If the last day is inaccessible, the period continues to the first later day that is not a weekend, listed holiday or itself inaccessible.

split: open-access


prompt:
A closure recorded at the normal closing time is treated as making the day inaccessible.

Stipulated: closures are [date, start] where start is "all" (full-day outage) or a local "HH:MM" time the office closed early; several entries for one day merge to "all" if any is "all", else the earliest start. A last day is inaccessible for paper or fax filing if closed all day or early before office_close; for electronic filing only a full-day outage counts. If the last day is inaccessible, the period continues to the first later day that is not a weekend, listed holiday or itself inaccessible.

split: open-access


prompt:
When the office stays closed a second day, the deadline lands on that inaccessible day.

Stipulated: closures are [date, start] where start is "all" (full-day outage) or a local "HH:MM" time the office closed early; several entries for one day merge to "all" if any is "all", else the earliest start. A last day is inaccessible for paper or fax filing if closed all day or early before office_close; for electronic filing only a full-day outage counts. If the last day is inaccessible, the period continues to the first later day that is not a weekend, listed holiday or itself inaccessible.

split: open-access


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

N = 1
observations = []
def solve(s):
    s=s.strip()
    parts=s.replace('.',',').split(',')
    if len(parts)!=2: return None
    hms,frac=parts
    fields=hms.split(':')
    if len(fields)!=3: return None
    if not all(p.isdigit() for p in fields) or not frac.isdigit(): return None
    if len(frac)>3: return None
    h,mi,se=int(fields[0]),int(fields[1]),int(fields[2])
    if mi>=60 or se>=60: return None
    ms=int(frac.rjust(3,'0'))
    return h*3600000+mi*60000+se*1000+ms
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: fraction padding', ['00:00:01,5'], 1500), ('regression variant: fraction padding', [' 100:00:00,07'], 360000070), ('partial repair probe: fraction padding', ['02:30:42,5\t'], 9042500), ('partial repair variant: fraction padding', ['10:30:59,12\t'], 37859120), ('boundary control', ['00:00:00,000'], 0), ('boundary control', ['00:60:00,000'], None), ('normal control', ['01:02:03.004'], 3723004), ('normal control', ['100:00:00,000'], 360000000), ('normal control', ['00:61:00;5 \r'], None)], [('regression: fraction padding', [' 00:05:00.5 '], 300500), ('regression variant: fraction padding', [' 100:00:01.50\r'], 360001500), ('partial repair probe: fraction padding', ['00:30:59,12 '], 1859120), ('partial repair variant: fraction padding', ['123:05:01.12\t'], 443101120), ('boundary control', ['01:02:03.004'], 3723004), ('boundary control', ['100:00:00,000'], 360000000), ('normal control', ['123:60:59,5'], None), ('normal control', ['99:00:00.500\r'], 356400500), ('normal control', [' 00:30:60,500'], None)], [('regression: fraction padding', ['02:30:42,5\t'], 9042500), ('regression variant: fraction padding', [' 100:59:59,12'], 363599120), ('partial repair probe: fraction padding', [' 123:59:42,50 '], 446382500), ('partial repair variant: fraction padding', [' 02:30:59,12 '], 9059120), ('boundary control', ['00:59:59,999\r'], 3599999), ('boundary control', ['00:00:00,000'], 0), ('normal control', ['00:00:60.1234 '], None), ('normal control', ['10:61:61. \r'], None), ('normal control', ['00:30:59;12'], None)], [('regression: fraction padding', ['00:30:59,12 '], 1859120), ('regression variant: fraction padding', ['02:59:42,12 '], 10782120), ('partial repair probe: fraction padding', [' 100:00:00,07'], 360000070), ('partial repair variant: fraction padding', [' 100:05:42.50'], 360342500), ('boundary control', ['00:60:00,000'], None), ('boundary control', ['01:02:03.004'], 3723004), ('normal control', ['00:00:60,1234\r'], None), ('normal control', ['00:00:60,07'], None), ('normal control', [' 00:61:42,000'], None)], [('regression: fraction padding', [' 123:59:42,50 '], 446382500), ('regression variant: fraction padding', ['10:30:59,12\t'], 37859120), ('partial repair probe: fraction padding', [' 100:00:01.50\r'], 360001500), ('partial repair variant: fraction padding', ['100:30:00,5'], 361800500), ('boundary control', ['100:00:00,000'], 360000000), ('boundary control', ['00:59:59,999\r'], 3599999), ('normal control', ['01:30:01,500 \r'], 5401500), ('normal control', ['01:05:00,500\r'], 3900500), ('normal control', ['100:30:42,500\r'], 361842500)]]
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(s):
    s=s.strip()
    parts=s.replace('.',',').split(',')
    if len(parts)!=2: return None
    hms,frac=parts
    fields=hms.split(':')
    if len(fields)!=3: return None
    if not all(p.isdigit() for p in fields) or not frac.isdigit(): return None
    if len(frac)>3: return None
    h,mi,se=int(fields[0]),int(fields[1]),int(fields[2])
    if mi>=60 or se>=60: return None
    ms=int(frac)
    return h*3600000+mi*60000+se*1000+ms
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: fraction padding', ['00:00:01,5'], 1500), ('regression variant: fraction padding', [' 100:00:00,07'], 360000070), ('partial repair probe: fraction padding', ['02:30:42,5\t'], 9042500), ('partial repair variant: fraction padding', ['10:30:59,12\t'], 37859120), ('boundary control', ['00:00:00,000'], 0), ('boundary control', ['00:60:00,000'], None), ('normal control', ['01:02:03.004'], 3723004), ('normal control', ['100:00:00,000'], 360000000), ('normal control', ['00:61:00;5 \r'], None)], [('regression: fraction padding', [' 00:05:00.5 '], 300500), ('regression variant: fraction padding', [' 100:00:01.50\r'], 360001500), ('partial repair probe: fraction padding', ['00:30:59,12 '], 1859120), ('partial repair variant: fraction padding', ['123:05:01.12\t'], 443101120), ('boundary control', ['01:02:03.004'], 3723004), ('boundary control', ['100:00:00,000'], 360000000), ('normal control', ['123:60:59,5'], None), ('normal control', ['99:00:00.500\r'], 356400500), ('normal control', [' 00:30:60,500'], None)], [('regression: fraction padding', ['02:30:42,5\t'], 9042500), ('regression variant: fraction padding', [' 100:59:59,12'], 363599120), ('partial repair probe: fraction padding', [' 123:59:42,50 '], 446382500), ('partial repair variant: fraction padding', [' 02:30:59,12 '], 9059120), ('boundary control', ['00:59:59,999\r'], 3599999), ('boundary control', ['00:00:00,000'], 0), ('normal control', ['00:00:60.1234 '], None), ('normal control', ['10:61:61. \r'], None), ('normal control', ['00:30:59;12'], None)], [('regression: fraction padding', ['00:30:59,12 '], 1859120), ('regression variant: fraction padding', ['02:59:42,12 '], 10782120), ('partial repair probe: fraction padding', [' 100:00:00,07'], 360000070), ('partial repair variant: fraction padding', [' 100:05:42.50'], 360342500), ('boundary control', ['00:60:00,000'], None), ('boundary control', ['01:02:03.004'], 3723004), ('normal control', ['00:00:60,1234\r'], None), ('normal control', ['00:00:60,07'], None), ('normal control', [' 00:61:42,000'], None)], [('regression: fraction padding', [' 123:59:42,50 '], 446382500), ('regression variant: fraction padding', ['10:30:59,12\t'], 37859120), ('partial repair probe: fraction padding', [' 100:00:01.50\r'], 360001500), ('partial repair variant: fraction padding', ['100:30:00,5'], 361800500), ('boundary control', ['100:00:00,000'], 360000000), ('boundary control', ['00:59:59,999\r'], 3599999), ('normal control', ['01:30:01,500 \r'], 5401500), ('normal control', ['01:05:00,500\r'], 3900500), ('normal control', ['100:30:42,500\r'], 361842500)]]
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 cue written as 00:00:01,5 starts at 1.005 s instead of 1.5 s.

Parse an SRT timestamp HH:MM:SS,mmm to integer milliseconds. Hours have 2 or more digits, minutes and seconds are below 60, the fraction has 1 to 3 digits and is right-padded (",5" means 500 ms), "." is accepted as the separator, surrounding whitespace (including a CR from CRLF files) is ignored; invalid text returns None.

split: open-access


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

N = 1
observations = []
def solve(s):
    s=s.strip()
    parts=s.split(',')
    if len(parts)!=2: return None
    hms,frac=parts
    fields=hms.split(':')
    if len(fields)!=3: return None
    if not all(p.isdigit() for p in fields) or not frac.isdigit(): return None
    if len(frac)>3: return None
    h,mi,se=int(fields[0]),int(fields[1]),int(fields[2])
    if mi>=60 or se>=60: return None
    ms=int(frac.ljust(3,'0'))
    return h*3600000+mi*60000+se*1000+ms
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: dot separator acceptance', ['01:02:03.004'], 3723004), ('regression variant: dot separator acceptance', ['100:59:42.001\r'], 363582001), ('partial repair probe: dot separator acceptance', ['00:30:59;12'], None), ('partial repair variant: dot separator acceptance', [' 100:00:01.50\r'], 360001500), ('boundary control', ['00:00:00,000'], 0), ('boundary control', ['00:60:00,000'], None), ('normal control', ['00:00:01,5'], 1500), ('normal control', ['100:00:00,000'], 360000000), ('normal control', ['00:61:00;5 \r'], None)], [('regression: dot separator acceptance', ['99:00:00.500\r'], 356400500), ('regression variant: dot separator acceptance', ['01:59:00.500\t'], 7140500), ('partial repair probe: dot separator acceptance', ['00:59:00.000'], 3540000), ('partial repair variant: dot separator acceptance', ['123:59:59.000 \r'], 446399000), ('boundary control', ['00:00:01,5'], 1500), ('boundary control', ['100:00:00,000'], 360000000), ('normal control', ['123:60:59,5'], None), ('normal control', ['99:00:59,001 \r'], 356459001), ('normal control', [' 00:61:01;999\r'], None)], [('regression: dot separator acceptance', ['00:59:00.000'], 3540000), ('regression variant: dot separator acceptance', [' 100:00:01.50\r'], 360001500), ('partial repair probe: dot separator acceptance', [' 10:05:00.000'], 36300000), ('partial repair variant: dot separator acceptance', ['02:00:59;999'], None), ('boundary control', ['00:59:59,999\r'], 3599999), ('boundary control', ['00:00:00,000'], 0), ('normal control', [' 00:00:60,12 '], None), ('normal control', [' 10:00:61.001\r'], None), ('normal control', ['00:00:60,1234\r'], None)], [('regression: dot separator acceptance', [' 10:05:00.000'], 36300000), ('regression variant: dot separator acceptance', ['123:59:59.000 \r'], 446399000), ('partial repair probe: dot separator acceptance', [' 00:05:00.5 '], 300500), ('partial repair variant: dot separator acceptance', ['10:00:42;07'], None), ('boundary control', ['00:60:00,000'], None), ('boundary control', ['00:00:01,5'], 1500), ('normal control', ['00:00:60,07'], None), ('normal control', ['99:60:59,12 \r'], None), ('normal control', ['100:60:60,999 '], None)], [('regression: dot separator acceptance', [' 00:05:00.5 '], 300500), ('regression variant: dot separator acceptance', ['123:05:01.12\t'], 443101120), ('partial repair probe: dot separator acceptance', ['100:59:42.001\r'], 363582001), ('partial repair variant: dot separator acceptance', ['00:00:42;07\r'], None), ('boundary control', ['100:00:00,000'], 360000000), ('boundary control', ['00:59:59,999\r'], 3599999), ('normal control', [' 10:60:61;999'], None), ('normal control', ['02:00:01,1234 \r'], None), ('normal control', ['02:30:42,5\t'], 9042500)]]
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(s):
    s=s.strip()
    parts=s.replace(';',',').split(',')
    if len(parts)!=2: return None
    hms,frac=parts
    fields=hms.split(':')
    if len(fields)!=3: return None
    if not all(p.isdigit() for p in fields) or not frac.isdigit(): return None
    if len(frac)>3: return None
    h,mi,se=int(fields[0]),int(fields[1]),int(fields[2])
    if mi>=60 or se>=60: return None
    ms=int(frac.ljust(3,'0'))
    return h*3600000+mi*60000+se*1000+ms
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: dot separator acceptance', ['01:02:03.004'], 3723004), ('regression variant: dot separator acceptance', ['100:59:42.001\r'], 363582001), ('partial repair probe: dot separator acceptance', ['00:30:59;12'], None), ('partial repair variant: dot separator acceptance', [' 100:00:01.50\r'], 360001500), ('boundary control', ['00:00:00,000'], 0), ('boundary control', ['00:60:00,000'], None), ('normal control', ['00:00:01,5'], 1500), ('normal control', ['100:00:00,000'], 360000000), ('normal control', ['00:61:00;5 \r'], None)], [('regression: dot separator acceptance', ['99:00:00.500\r'], 356400500), ('regression variant: dot separator acceptance', ['01:59:00.500\t'], 7140500), ('partial repair probe: dot separator acceptance', ['00:59:00.000'], 3540000), ('partial repair variant: dot separator acceptance', ['123:59:59.000 \r'], 446399000), ('boundary control', ['00:00:01,5'], 1500), ('boundary control', ['100:00:00,000'], 360000000), ('normal control', ['123:60:59,5'], None), ('normal control', ['99:00:59,001 \r'], 356459001), ('normal control', [' 00:61:01;999\r'], None)], [('regression: dot separator acceptance', ['00:59:00.000'], 3540000), ('regression variant: dot separator acceptance', [' 100:00:01.50\r'], 360001500), ('partial repair probe: dot separator acceptance', [' 10:05:00.000'], 36300000), ('partial repair variant: dot separator acceptance', ['02:00:59;999'], None), ('boundary control', ['00:59:59,999\r'], 3599999), ('boundary control', ['00:00:00,000'], 0), ('normal control', [' 00:00:60,12 '], None), ('normal control', [' 10:00:61.001\r'], None), ('normal control', ['00:00:60,1234\r'], None)], [('regression: dot separator acceptance', [' 10:05:00.000'], 36300000), ('regression variant: dot separator acceptance', ['123:59:59.000 \r'], 446399000), ('partial repair probe: dot separator acceptance', [' 00:05:00.5 '], 300500), ('partial repair variant: dot separator acceptance', ['10:00:42;07'], None), ('boundary control', ['00:60:00,000'], None), ('boundary control', ['00:00:01,5'], 1500), ('normal control', ['00:00:60,07'], None), ('normal control', ['99:60:59,12 \r'], None), ('normal control', ['100:60:60,999 '], None)], [('regression: dot separator acceptance', [' 00:05:00.5 '], 300500), ('regression variant: dot separator acceptance', ['123:05:01.12\t'], 443101120), ('partial repair probe: dot separator acceptance', ['100:59:42.001\r'], 363582001), ('partial repair variant: dot separator acceptance', ['00:00:42;07\r'], None), ('boundary control', ['100:00:00,000'], 360000000), ('boundary control', ['00:59:59,999\r'], 3599999), ('normal control', [' 10:60:61;999'], None), ('normal control', ['02:00:01,1234 \r'], None), ('normal control', ['02:30:42,5\t'], 9042500)]]
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:
Timestamps exported with a period before the milliseconds are rejected as invalid.

Parse an SRT timestamp HH:MM:SS,mmm to integer milliseconds. Hours have 2 or more digits, minutes and seconds are below 60, the fraction has 1 to 3 digits and is right-padded (",5" means 500 ms), "." is accepted as the separator, surrounding whitespace (including a CR from CRLF files) is ignored; invalid text returns None.

split: open-access


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

N = 1
observations = []
def solve(s):
    s=s.strip()
    parts=s.replace('.',',').split(',')
    if len(parts)!=2: return None
    hms,frac=parts
    fields=hms.split(':')
    if len(fields)!=3: return None
    if not all(p.isdigit() for p in fields) or not frac.isdigit(): return None
    if len(frac)>3: return None
    h,mi,se=int(fields[0]),int(fields[1]),int(fields[2])
    if mi>60 or se>60: return None
    ms=int(frac.ljust(3,'0'))
    return h*3600000+mi*60000+se*1000+ms
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: minute and second range', ['00:60:00,000'], None), ('regression variant: minute and second range', ['10:60:60,07 '], None), ('partial repair probe: minute and second range', ['00:00:60,07'], None), ('partial repair variant: minute and second range', ['02:00:60,12\r'], None), ('boundary control', ['00:00:00,000'], 0), ('boundary control', ['00:59:59,999\r'], 3599999), ('normal control', ['00:00:01,5'], 1500), ('normal control', ['100:00:00,000'], 360000000), ('normal control', ['00:61:00;5 \r'], None)], [('regression: minute and second range', ['123:60:59,5'], None), ('regression variant: minute and second range', ['00:00:60,07'], None), ('partial repair probe: minute and second range', [' 02:30:60.500 '], None), ('partial repair variant: minute and second range', ['01:05:60,999 '], None), ('boundary control', ['00:00:01,5'], 1500), ('boundary control', ['100:00:00,000'], 360000000), ('normal control', [' 10:60:42;50\r'], None), ('normal control', ['99:00:59,001 \r'], 356459001), ('normal control', ['00:00:60.1234 '], None)], [('regression: minute and second range', [' 00:30:60,500'], None), ('regression variant: minute and second range', [' 99:60:00.000'], None), ('partial repair probe: minute and second range', ['99:30:60.000'], None), ('partial repair variant: minute and second range', ['99:30:60,001 '], None), ('boundary control', ['01:02:03.004'], 3723004), ('boundary control', ['00:00:00,000'], 0), ('normal control', [' 10:00:61.001\r'], None), ('normal control', ['99:30:00,'], None), ('normal control', [' 00:61:42,000'], None)], [('regression: minute and second range', [' 00:00:60,12 '], None), ('regression variant: minute and second range', ['99:60:59,12 \r'], None), ('partial repair probe: minute and second range', [' 10:30:60,5\r'], None), ('partial repair variant: minute and second range', ['00:59:60,07 '], None), ('boundary control', ['00:59:59,999\r'], 3599999), ('boundary control', ['00:00:01,5'], 1500), ('normal control', [' 10:05:00.000'], 36300000), ('normal control', [' 00:05:00.5 '], 300500), ('normal control', ['123:05:01,001\t'], 443101001)], [('regression: minute and second range', ['123:60:42,999'], None), ('regression variant: minute and second range', ['100:60:60,999 '], None), ('partial repair probe: minute and second range', ['123:00:60.07\t'], None), ('partial repair variant: minute and second range', ['100:05:60,001\t'], None), ('boundary control', ['100:00:00,000'], 360000000), ('boundary control', ['01:02:03.004'], 3723004), ('normal control', ['123:00:61,001 \r'], None), ('normal control', ['100:59:42.001\r'], 363582001), ('normal control', [' 10:30:61;001 '], None)]]
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(s):
    s=s.strip()
    parts=s.replace('.',',').split(',')
    if len(parts)!=2: return None
    hms,frac=parts
    fields=hms.split(':')
    if len(fields)!=3: return None
    if not all(p.isdigit() for p in fields) or not frac.isdigit(): return None
    if len(frac)>3: return None
    h,mi,se=int(fields[0]),int(fields[1]),int(fields[2])
    if mi>=60 or se>60: return None
    ms=int(frac.ljust(3,'0'))
    return h*3600000+mi*60000+se*1000+ms
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: minute and second range', ['00:60:00,000'], None), ('regression variant: minute and second range', ['10:60:60,07 '], None), ('partial repair probe: minute and second range', ['00:00:60,07'], None), ('partial repair variant: minute and second range', ['02:00:60,12\r'], None), ('boundary control', ['00:00:00,000'], 0), ('boundary control', ['00:59:59,999\r'], 3599999), ('normal control', ['00:00:01,5'], 1500), ('normal control', ['100:00:00,000'], 360000000), ('normal control', ['00:61:00;5 \r'], None)], [('regression: minute and second range', ['123:60:59,5'], None), ('regression variant: minute and second range', ['00:00:60,07'], None), ('partial repair probe: minute and second range', [' 02:30:60.500 '], None), ('partial repair variant: minute and second range', ['01:05:60,999 '], None), ('boundary control', ['00:00:01,5'], 1500), ('boundary control', ['100:00:00,000'], 360000000), ('normal control', [' 10:60:42;50\r'], None), ('normal control', ['99:00:59,001 \r'], 356459001), ('normal control', ['00:00:60.1234 '], None)], [('regression: minute and second range', [' 00:30:60,500'], None), ('regression variant: minute and second range', [' 99:60:00.000'], None), ('partial repair probe: minute and second range', ['99:30:60.000'], None), ('partial repair variant: minute and second range', ['99:30:60,001 '], None), ('boundary control', ['01:02:03.004'], 3723004), ('boundary control', ['00:00:00,000'], 0), ('normal control', [' 10:00:61.001\r'], None), ('normal control', ['99:30:00,'], None), ('normal control', [' 00:61:42,000'], None)], [('regression: minute and second range', [' 00:00:60,12 '], None), ('regression variant: minute and second range', ['99:60:59,12 \r'], None), ('partial repair probe: minute and second range', [' 10:30:60,5\r'], None), ('partial repair variant: minute and second range', ['00:59:60,07 '], None), ('boundary control', ['00:59:59,999\r'], 3599999), ('boundary control', ['00:00:01,5'], 1500), ('normal control', [' 10:05:00.000'], 36300000), ('normal control', [' 00:05:00.5 '], 300500), ('normal control', ['123:05:01,001\t'], 443101001)], [('regression: minute and second range', ['123:60:42,999'], None), ('regression variant: minute and second range', ['100:60:60,999 '], None), ('partial repair probe: minute and second range', ['123:00:60.07\t'], None), ('partial repair variant: minute and second range', ['100:05:60,001\t'], None), ('boundary control', ['100:00:00,000'], 360000000), ('boundary control', ['01:02:03.004'], 3723004), ('normal control', ['123:00:61,001 \r'], None), ('normal control', ['100:59:42.001\r'], 363582001), ('normal control', [' 10:30:61;001 '], None)]]
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 malformed timestamp such as 00:60:00,000 is accepted and silently becomes one hour.

Parse an SRT timestamp HH:MM:SS,mmm to integer milliseconds. Hours have 2 or more digits, minutes and seconds are below 60, the fraction has 1 to 3 digits and is right-padded (",5" means 500 ms), "." is accepted as the separator, surrounding whitespace (including a CR from CRLF files) is ignored; invalid text returns None.

split: open-access


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

N = 1
observations = []
def solve(s):
    s=s.strip()
    parts=s.replace('.',',').split(',')
    if len(parts)!=2: return None
    hms,frac=parts
    fields=hms.split(':')
    if len(fields)!=3: return None
    if not all(p.isdigit() for p in fields) or not frac.isdigit(): return None
    if len(frac)!=3: return None
    h,mi,se=int(fields[0]),int(fields[1]),int(fields[2])
    if mi>=60 or se>=60: return None
    ms=int(frac.ljust(3,'0'))
    return h*3600000+mi*60000+se*1000+ms
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: fraction digit limit', ['00:00:01,5'], 1500), ('regression variant: fraction digit limit', [' 100:00:00,07'], 360000070), ('partial repair probe: fraction digit limit', ['00:59:59,999\r'], 3599999), ('partial repair variant: fraction digit limit', ['01:05:00,500\r'], 3900500), ('boundary control', ['00:60:00,000'], None), ('normal control', ['00:61:00;5 \r'], None), ('normal control', ['123:60:59,5'], None), ('normal control', ['99:30:42.1234\r'], None)], [('regression: fraction digit limit', [' 00:05:00.5 '], 300500), ('regression variant: fraction digit limit', [' 100:00:01.50\r'], 360001500), ('partial repair probe: fraction digit limit', ['100:00:00,000'], 360000000), ('partial repair variant: fraction digit limit', ['100:30:42,500\r'], 361842500), ('boundary control', ['00:60:00,000'], None), ('normal control', [' 00:61:01;999\r'], None), ('normal control', ['123:60:42,999'], None), ('normal control', [' 10:00:61.001\r'], None)], [('regression: fraction digit limit', ['02:30:42,5\t'], 9042500), ('regression variant: fraction digit limit', [' 100:59:59,12'], 363599120), ('partial repair probe: fraction digit limit', ['99:00:00.500\r'], 356400500), ('partial repair variant: fraction digit limit', ['123:05:01,001\t'], 443101001), ('boundary control', ['00:60:00,000'], None), ('normal control', ['10:60:60,07 '], None), ('normal control', ['00:00:60,07'], None), ('normal control', [' 00:61:42,000'], None)], [('regression: fraction digit limit', ['00:30:59,12 '], 1859120), ('regression variant: fraction digit limit', ['02:59:42,12 '], 10782120), ('partial repair probe: fraction digit limit', ['99:00:59,001 \r'], 356459001), ('partial repair variant: fraction digit limit', ['100:59:42.001\r'], 363582001), ('boundary control', ['00:60:00,000'], None), ('normal control', ['100:60:60,999 '], None), ('normal control', ['123:00:61,001 \r'], None), ('normal control', [' 99:60:60, '], None)], [('regression: fraction digit limit', [' 123:59:42,50 '], 446382500), ('regression variant: fraction digit limit', ['10:30:59,12\t'], 37859120), ('partial repair probe: fraction digit limit', ['00:59:00.000'], 3540000), ('partial repair variant: fraction digit limit', ['10:05:42,000 '], 36342000), ('boundary control', ['00:60:00,000'], None), ('normal control', [' 100:59:61,50'], None), ('normal control', ['00:61:01;12 \r'], None), ('normal control', [' 00:60:59, '], None)]]
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(s):
    s=s.strip()
    parts=s.replace('.',',').split(',')
    if len(parts)!=2: return None
    hms,frac=parts
    fields=hms.split(':')
    if len(fields)!=3: return None
    if not all(p.isdigit() for p in fields) or not frac.isdigit(): return None
    if len(frac)>=3: return None
    h,mi,se=int(fields[0]),int(fields[1]),int(fields[2])
    if mi>=60 or se>=60: return None
    ms=int(frac.ljust(3,'0'))
    return h*3600000+mi*60000+se*1000+ms
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: fraction digit limit', ['00:00:01,5'], 1500), ('regression variant: fraction digit limit', [' 100:00:00,07'], 360000070), ('partial repair probe: fraction digit limit', ['00:59:59,999\r'], 3599999), ('partial repair variant: fraction digit limit', ['01:05:00,500\r'], 3900500), ('boundary control', ['00:60:00,000'], None), ('normal control', ['00:61:00;5 \r'], None), ('normal control', ['123:60:59,5'], None), ('normal control', ['99:30:42.1234\r'], None)], [('regression: fraction digit limit', [' 00:05:00.5 '], 300500), ('regression variant: fraction digit limit', [' 100:00:01.50\r'], 360001500), ('partial repair probe: fraction digit limit', ['100:00:00,000'], 360000000), ('partial repair variant: fraction digit limit', ['100:30:42,500\r'], 361842500), ('boundary control', ['00:60:00,000'], None), ('normal control', [' 00:61:01;999\r'], None), ('normal control', ['123:60:42,999'], None), ('normal control', [' 10:00:61.001\r'], None)], [('regression: fraction digit limit', ['02:30:42,5\t'], 9042500), ('regression variant: fraction digit limit', [' 100:59:59,12'], 363599120), ('partial repair probe: fraction digit limit', ['99:00:00.500\r'], 356400500), ('partial repair variant: fraction digit limit', ['123:05:01,001\t'], 443101001), ('boundary control', ['00:60:00,000'], None), ('normal control', ['10:60:60,07 '], None), ('normal control', ['00:00:60,07'], None), ('normal control', [' 00:61:42,000'], None)], [('regression: fraction digit limit', ['00:30:59,12 '], 1859120), ('regression variant: fraction digit limit', ['02:59:42,12 '], 10782120), ('partial repair probe: fraction digit limit', ['99:00:59,001 \r'], 356459001), ('partial repair variant: fraction digit limit', ['100:59:42.001\r'], 363582001), ('boundary control', ['00:60:00,000'], None), ('normal control', ['100:60:60,999 '], None), ('normal control', ['123:00:61,001 \r'], None), ('normal control', [' 99:60:60, '], None)], [('regression: fraction digit limit', [' 123:59:42,50 '], 446382500), ('regression variant: fraction digit limit', ['10:30:59,12\t'], 37859120), ('partial repair probe: fraction digit limit', ['00:59:00.000'], 3540000), ('partial repair variant: fraction digit limit', ['10:05:42,000 '], 36342000), ('boundary control', ['00:60:00,000'], None), ('normal control', [' 100:59:61,50'], None), ('normal control', ['00:61:01;12 \r'], None), ('normal control', [' 00:60:59, '], None)]]
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:
Valid short fractions such as ,5 are rejected while the file loads with missing cues.

Parse an SRT timestamp HH:MM:SS,mmm to integer milliseconds. Hours have 2 or more digits, minutes and seconds are below 60, the fraction has 1 to 3 digits and is right-padded (",5" means 500 ms), "." is accepted as the separator, surrounding whitespace (including a CR from CRLF files) is ignored; invalid text returns None.

split: open-access