broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import datetime as dt
import calendar
N = 1
observations = []
def solve(first_due, interval_days, mode, completions, until):
    due = dt.date.fromisoformat(first_due)
    end = dt.date.fromisoformat(until) if until else None
    step = dt.timedelta(days=interval_days)
    for c in completions:
        cd = dt.date.fromisoformat(c)
        if mode == 'regenerate':
            due = cd + step
        else:
            due = due + step
            while due <= cd:
                due += step
        if end is not None and due > end:
            return None
    return due.isoformat()
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: late completion on next due',
   ['2024-01-01', 7, 'schedule', ['2024-01-08'], None],
   '2024-01-15'),
  ('early completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-05'], None], '2024-01-12'),
  ('late completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-20'], None], '2024-01-27'),
  ('out of order schedule', ['2024-01-01', 7, 'schedule', ['2024-01-20', '2024-01-02'], None], '2024-01-22'),
  ('multiple missed schedule', ['2024-01-01', 3, 'schedule', ['2024-01-11'], None], '2024-01-13'),
  ('until exact', ['2024-01-01', 7, 'schedule', ['2024-01-01'], '2024-01-08'], '2024-01-08'),
  ('until passed', ['2024-01-01', 7, 'schedule', ['2024-01-01', '2024-01-08'], '2024-01-10'], None)],
 [('late completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-20'], None], '2024-01-27'),
  ('out of order schedule', ['2024-01-01', 7, 'schedule', ['2024-01-20', '2024-01-02'], None], '2024-01-22'),
  ('multiple missed schedule', ['2024-01-01', 3, 'schedule', ['2024-01-11'], None], '2024-01-13'),
  ('until exact', ['2024-01-01', 7, 'schedule', ['2024-01-01'], '2024-01-08'], '2024-01-08'),
  ('until passed', ['2024-01-01', 7, 'schedule', ['2024-01-01', '2024-01-08'], '2024-01-10'], None),
  ('until regenerate', ['2024-02-01', 10, 'regenerate', ['2024-02-05'], '2024-02-15'], '2024-02-15'),
  ('no completions', ['2024-02-01', 10, 'schedule', [], None], '2024-02-01')],
 [('multiple missed schedule', ['2024-01-01', 3, 'schedule', ['2024-01-11'], None], '2024-01-13'),
  ('until exact', ['2024-01-01', 7, 'schedule', ['2024-01-01'], '2024-01-08'], '2024-01-08'),
  ('until passed', ['2024-01-01', 7, 'schedule', ['2024-01-01', '2024-01-08'], '2024-01-10'], None),
  ('until regenerate', ['2024-02-01', 10, 'regenerate', ['2024-02-05'], '2024-02-15'], '2024-02-15'),
  ('no completions', ['2024-02-01', 10, 'schedule', [], None], '2024-02-01'),
  ('completion after until but due inside',
   ['2024-03-01', 30, 'schedule', ['2024-03-05'], '2024-03-31'],
   '2024-03-31'),
  ('two schedule completions',
   ['2024-04-01', 14, 'schedule', ['2024-03-30', '2024-04-10'], None],
   '2024-04-29'),
  ('out of order regenerate',
   ['2024-04-01', 5, 'regenerate', ['2024-04-09', '2024-04-02'], None],
   '2024-04-14')],
 [('until passed', ['2024-01-01', 7, 'schedule', ['2024-01-01', '2024-01-08'], '2024-01-10'], None),
  ('until regenerate', ['2024-02-01', 10, 'regenerate', ['2024-02-05'], '2024-02-15'], '2024-02-15'),
  ('no completions', ['2024-02-01', 10, 'schedule', [], None], '2024-02-01'),
  ('completion after until but due inside',
   ['2024-03-01', 30, 'schedule', ['2024-03-05'], '2024-03-31'],
   '2024-03-31'),
  ('two schedule completions',
   ['2024-04-01', 14, 'schedule', ['2024-03-30', '2024-04-10'], None],
   '2024-04-29'),
  ('out of order regenerate',
   ['2024-04-01', 5, 'regenerate', ['2024-04-09', '2024-04-02'], None],
   '2024-04-14'),
  ('regression: late completion on next due',
   ['2024-01-01', 7, 'schedule', ['2024-01-08'], None],
   '2024-01-15')],
 [('no completions', ['2024-02-01', 10, 'schedule', [], None], '2024-02-01'),
  ('completion after until but due inside',
   ['2024-03-01', 30, 'schedule', ['2024-03-05'], '2024-03-31'],
   '2024-03-31'),
  ('two schedule completions',
   ['2024-04-01', 14, 'schedule', ['2024-03-30', '2024-04-10'], None],
   '2024-04-29'),
  ('out of order regenerate',
   ['2024-04-01', 5, 'regenerate', ['2024-04-09', '2024-04-02'], None],
   '2024-04-14'),
  ('regression: late completion on next due',
   ['2024-01-01', 7, 'schedule', ['2024-01-08'], None],
   '2024-01-15'),
  ('early completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-05'], None], '2024-01-12'),
  ('late completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-20'], None], '2024-01-27')]]
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(first_due, interval_days, mode, completions, until):
    due = dt.date.fromisoformat(first_due)
    end = dt.date.fromisoformat(until) if until else None
    step = dt.timedelta(days=interval_days)
    for c in completions[-1:]:
        cd = dt.date.fromisoformat(c)
        if mode == 'regenerate':
            due = cd + step
        else:
            due = due + step
            while due <= cd:
                due += step
        if end is not None and due > end:
            return None
    return due.isoformat()
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: late completion on next due',
   ['2024-01-01', 7, 'schedule', ['2024-01-08'], None],
   '2024-01-15'),
  ('early completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-05'], None], '2024-01-12'),
  ('late completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-20'], None], '2024-01-27'),
  ('out of order schedule', ['2024-01-01', 7, 'schedule', ['2024-01-20', '2024-01-02'], None], '2024-01-22'),
  ('multiple missed schedule', ['2024-01-01', 3, 'schedule', ['2024-01-11'], None], '2024-01-13'),
  ('until exact', ['2024-01-01', 7, 'schedule', ['2024-01-01'], '2024-01-08'], '2024-01-08'),
  ('until passed', ['2024-01-01', 7, 'schedule', ['2024-01-01', '2024-01-08'], '2024-01-10'], None)],
 [('late completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-20'], None], '2024-01-27'),
  ('out of order schedule', ['2024-01-01', 7, 'schedule', ['2024-01-20', '2024-01-02'], None], '2024-01-22'),
  ('multiple missed schedule', ['2024-01-01', 3, 'schedule', ['2024-01-11'], None], '2024-01-13'),
  ('until exact', ['2024-01-01', 7, 'schedule', ['2024-01-01'], '2024-01-08'], '2024-01-08'),
  ('until passed', ['2024-01-01', 7, 'schedule', ['2024-01-01', '2024-01-08'], '2024-01-10'], None),
  ('until regenerate', ['2024-02-01', 10, 'regenerate', ['2024-02-05'], '2024-02-15'], '2024-02-15'),
  ('no completions', ['2024-02-01', 10, 'schedule', [], None], '2024-02-01')],
 [('multiple missed schedule', ['2024-01-01', 3, 'schedule', ['2024-01-11'], None], '2024-01-13'),
  ('until exact', ['2024-01-01', 7, 'schedule', ['2024-01-01'], '2024-01-08'], '2024-01-08'),
  ('until passed', ['2024-01-01', 7, 'schedule', ['2024-01-01', '2024-01-08'], '2024-01-10'], None),
  ('until regenerate', ['2024-02-01', 10, 'regenerate', ['2024-02-05'], '2024-02-15'], '2024-02-15'),
  ('no completions', ['2024-02-01', 10, 'schedule', [], None], '2024-02-01'),
  ('completion after until but due inside',
   ['2024-03-01', 30, 'schedule', ['2024-03-05'], '2024-03-31'],
   '2024-03-31'),
  ('two schedule completions',
   ['2024-04-01', 14, 'schedule', ['2024-03-30', '2024-04-10'], None],
   '2024-04-29'),
  ('out of order regenerate',
   ['2024-04-01', 5, 'regenerate', ['2024-04-09', '2024-04-02'], None],
   '2024-04-14')],
 [('until passed', ['2024-01-01', 7, 'schedule', ['2024-01-01', '2024-01-08'], '2024-01-10'], None),
  ('until regenerate', ['2024-02-01', 10, 'regenerate', ['2024-02-05'], '2024-02-15'], '2024-02-15'),
  ('no completions', ['2024-02-01', 10, 'schedule', [], None], '2024-02-01'),
  ('completion after until but due inside',
   ['2024-03-01', 30, 'schedule', ['2024-03-05'], '2024-03-31'],
   '2024-03-31'),
  ('two schedule completions',
   ['2024-04-01', 14, 'schedule', ['2024-03-30', '2024-04-10'], None],
   '2024-04-29'),
  ('out of order regenerate',
   ['2024-04-01', 5, 'regenerate', ['2024-04-09', '2024-04-02'], None],
   '2024-04-14'),
  ('regression: late completion on next due',
   ['2024-01-01', 7, 'schedule', ['2024-01-08'], None],
   '2024-01-15')],
 [('no completions', ['2024-02-01', 10, 'schedule', [], None], '2024-02-01'),
  ('completion after until but due inside',
   ['2024-03-01', 30, 'schedule', ['2024-03-05'], '2024-03-31'],
   '2024-03-31'),
  ('two schedule completions',
   ['2024-04-01', 14, 'schedule', ['2024-03-30', '2024-04-10'], None],
   '2024-04-29'),
  ('out of order regenerate',
   ['2024-04-01', 5, 'regenerate', ['2024-04-09', '2024-04-02'], None],
   '2024-04-14'),
  ('regression: late completion on next due',
   ['2024-01-01', 7, 'schedule', ['2024-01-08'], None],
   '2024-01-15'),
  ('early completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-05'], None], '2024-01-12'),
  ('late completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-20'], None], '2024-01-27')]]
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:
Completions synced out of order leave a scheduled task on a stale due date.

A recurring task first due on first_due repeats every interval_days. Completions are processed in chronological order. mode "regenerate": the next due date is completion + interval. mode "schedule": completing advances to the next scheduled due date, skipping every scheduled date on or before the completion date. If the resulting due date passes until (inclusive bound, may be None), the task has no next due date (None).

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(first_due, interval_days, mode, completions, until):
    due = dt.date.fromisoformat(first_due)
    end = dt.date.fromisoformat(until) if until else None
    step = dt.timedelta(days=interval_days)
    for c in sorted(completions):
        cd = dt.date.fromisoformat(c)
        if mode == 'regenerate':
            due = due + step
        else:
            due = due + step
            while due <= cd:
                due += step
        if end is not None and due > end:
            return None
    return due.isoformat()
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: late completion on next due',
   ['2024-01-01', 7, 'schedule', ['2024-01-08'], None],
   '2024-01-15'),
  ('early completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-05'], None], '2024-01-12'),
  ('late completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-20'], None], '2024-01-27'),
  ('out of order schedule', ['2024-01-01', 7, 'schedule', ['2024-01-20', '2024-01-02'], None], '2024-01-22'),
  ('multiple missed schedule', ['2024-01-01', 3, 'schedule', ['2024-01-11'], None], '2024-01-13'),
  ('until exact', ['2024-01-01', 7, 'schedule', ['2024-01-01'], '2024-01-08'], '2024-01-08'),
  ('until passed', ['2024-01-01', 7, 'schedule', ['2024-01-01', '2024-01-08'], '2024-01-10'], None)],
 [('late completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-20'], None], '2024-01-27'),
  ('out of order schedule', ['2024-01-01', 7, 'schedule', ['2024-01-20', '2024-01-02'], None], '2024-01-22'),
  ('multiple missed schedule', ['2024-01-01', 3, 'schedule', ['2024-01-11'], None], '2024-01-13'),
  ('until exact', ['2024-01-01', 7, 'schedule', ['2024-01-01'], '2024-01-08'], '2024-01-08'),
  ('until passed', ['2024-01-01', 7, 'schedule', ['2024-01-01', '2024-01-08'], '2024-01-10'], None),
  ('until regenerate', ['2024-02-01', 10, 'regenerate', ['2024-02-05'], '2024-02-15'], '2024-02-15'),
  ('no completions', ['2024-02-01', 10, 'schedule', [], None], '2024-02-01'),
  ('early completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-05'], None], '2024-01-12')],
 [('multiple missed schedule', ['2024-01-01', 3, 'schedule', ['2024-01-11'], None], '2024-01-13'),
  ('until exact', ['2024-01-01', 7, 'schedule', ['2024-01-01'], '2024-01-08'], '2024-01-08'),
  ('until passed', ['2024-01-01', 7, 'schedule', ['2024-01-01', '2024-01-08'], '2024-01-10'], None),
  ('until regenerate', ['2024-02-01', 10, 'regenerate', ['2024-02-05'], '2024-02-15'], '2024-02-15'),
  ('no completions', ['2024-02-01', 10, 'schedule', [], None], '2024-02-01'),
  ('completion after until but due inside',
   ['2024-03-01', 30, 'schedule', ['2024-03-05'], '2024-03-31'],
   '2024-03-31'),
  ('two schedule completions',
   ['2024-04-01', 14, 'schedule', ['2024-03-30', '2024-04-10'], None],
   '2024-04-29'),
  ('early completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-05'], None], '2024-01-12')],
 [('until passed', ['2024-01-01', 7, 'schedule', ['2024-01-01', '2024-01-08'], '2024-01-10'], None),
  ('until regenerate', ['2024-02-01', 10, 'regenerate', ['2024-02-05'], '2024-02-15'], '2024-02-15'),
  ('no completions', ['2024-02-01', 10, 'schedule', [], None], '2024-02-01'),
  ('completion after until but due inside',
   ['2024-03-01', 30, 'schedule', ['2024-03-05'], '2024-03-31'],
   '2024-03-31'),
  ('two schedule completions',
   ['2024-04-01', 14, 'schedule', ['2024-03-30', '2024-04-10'], None],
   '2024-04-29'),
  ('out of order regenerate',
   ['2024-04-01', 5, 'regenerate', ['2024-04-09', '2024-04-02'], None],
   '2024-04-14'),
  ('regression: late completion on next due',
   ['2024-01-01', 7, 'schedule', ['2024-01-08'], None],
   '2024-01-15'),
  ('early completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-05'], None], '2024-01-12')],
 [('no completions', ['2024-02-01', 10, 'schedule', [], None], '2024-02-01'),
  ('completion after until but due inside',
   ['2024-03-01', 30, 'schedule', ['2024-03-05'], '2024-03-31'],
   '2024-03-31'),
  ('two schedule completions',
   ['2024-04-01', 14, 'schedule', ['2024-03-30', '2024-04-10'], None],
   '2024-04-29'),
  ('out of order regenerate',
   ['2024-04-01', 5, 'regenerate', ['2024-04-09', '2024-04-02'], None],
   '2024-04-14'),
  ('regression: late completion on next due',
   ['2024-01-01', 7, 'schedule', ['2024-01-08'], None],
   '2024-01-15'),
  ('early completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-05'], None], '2024-01-12'),
  ('late completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-20'], None], '2024-01-27')]]
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(first_due, interval_days, mode, completions, until):
    due = dt.date.fromisoformat(first_due)
    end = dt.date.fromisoformat(until) if until else None
    step = dt.timedelta(days=interval_days)
    for c in sorted(completions):
        cd = dt.date.fromisoformat(c)
        if mode == 'regenerate':
            due = max(cd, due) + step
        else:
            due = due + step
            while due <= cd:
                due += step
        if end is not None and due > end:
            return None
    return due.isoformat()
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: late completion on next due',
   ['2024-01-01', 7, 'schedule', ['2024-01-08'], None],
   '2024-01-15'),
  ('early completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-05'], None], '2024-01-12'),
  ('late completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-20'], None], '2024-01-27'),
  ('out of order schedule', ['2024-01-01', 7, 'schedule', ['2024-01-20', '2024-01-02'], None], '2024-01-22'),
  ('multiple missed schedule', ['2024-01-01', 3, 'schedule', ['2024-01-11'], None], '2024-01-13'),
  ('until exact', ['2024-01-01', 7, 'schedule', ['2024-01-01'], '2024-01-08'], '2024-01-08'),
  ('until passed', ['2024-01-01', 7, 'schedule', ['2024-01-01', '2024-01-08'], '2024-01-10'], None)],
 [('late completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-20'], None], '2024-01-27'),
  ('out of order schedule', ['2024-01-01', 7, 'schedule', ['2024-01-20', '2024-01-02'], None], '2024-01-22'),
  ('multiple missed schedule', ['2024-01-01', 3, 'schedule', ['2024-01-11'], None], '2024-01-13'),
  ('until exact', ['2024-01-01', 7, 'schedule', ['2024-01-01'], '2024-01-08'], '2024-01-08'),
  ('until passed', ['2024-01-01', 7, 'schedule', ['2024-01-01', '2024-01-08'], '2024-01-10'], None),
  ('until regenerate', ['2024-02-01', 10, 'regenerate', ['2024-02-05'], '2024-02-15'], '2024-02-15'),
  ('no completions', ['2024-02-01', 10, 'schedule', [], None], '2024-02-01'),
  ('early completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-05'], None], '2024-01-12')],
 [('multiple missed schedule', ['2024-01-01', 3, 'schedule', ['2024-01-11'], None], '2024-01-13'),
  ('until exact', ['2024-01-01', 7, 'schedule', ['2024-01-01'], '2024-01-08'], '2024-01-08'),
  ('until passed', ['2024-01-01', 7, 'schedule', ['2024-01-01', '2024-01-08'], '2024-01-10'], None),
  ('until regenerate', ['2024-02-01', 10, 'regenerate', ['2024-02-05'], '2024-02-15'], '2024-02-15'),
  ('no completions', ['2024-02-01', 10, 'schedule', [], None], '2024-02-01'),
  ('completion after until but due inside',
   ['2024-03-01', 30, 'schedule', ['2024-03-05'], '2024-03-31'],
   '2024-03-31'),
  ('two schedule completions',
   ['2024-04-01', 14, 'schedule', ['2024-03-30', '2024-04-10'], None],
   '2024-04-29'),
  ('early completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-05'], None], '2024-01-12')],
 [('until passed', ['2024-01-01', 7, 'schedule', ['2024-01-01', '2024-01-08'], '2024-01-10'], None),
  ('until regenerate', ['2024-02-01', 10, 'regenerate', ['2024-02-05'], '2024-02-15'], '2024-02-15'),
  ('no completions', ['2024-02-01', 10, 'schedule', [], None], '2024-02-01'),
  ('completion after until but due inside',
   ['2024-03-01', 30, 'schedule', ['2024-03-05'], '2024-03-31'],
   '2024-03-31'),
  ('two schedule completions',
   ['2024-04-01', 14, 'schedule', ['2024-03-30', '2024-04-10'], None],
   '2024-04-29'),
  ('out of order regenerate',
   ['2024-04-01', 5, 'regenerate', ['2024-04-09', '2024-04-02'], None],
   '2024-04-14'),
  ('regression: late completion on next due',
   ['2024-01-01', 7, 'schedule', ['2024-01-08'], None],
   '2024-01-15'),
  ('early completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-05'], None], '2024-01-12')],
 [('no completions', ['2024-02-01', 10, 'schedule', [], None], '2024-02-01'),
  ('completion after until but due inside',
   ['2024-03-01', 30, 'schedule', ['2024-03-05'], '2024-03-31'],
   '2024-03-31'),
  ('two schedule completions',
   ['2024-04-01', 14, 'schedule', ['2024-03-30', '2024-04-10'], None],
   '2024-04-29'),
  ('out of order regenerate',
   ['2024-04-01', 5, 'regenerate', ['2024-04-09', '2024-04-02'], None],
   '2024-04-14'),
  ('regression: late completion on next due',
   ['2024-01-01', 7, 'schedule', ['2024-01-08'], None],
   '2024-01-15'),
  ('early completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-05'], None], '2024-01-12'),
  ('late completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-20'], None], '2024-01-27')]]
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 regenerating task completed early is rescheduled from its old due date.

A recurring task first due on first_due repeats every interval_days. Completions are processed in chronological order. mode "regenerate": the next due date is completion + interval. mode "schedule": completing advances to the next scheduled due date, skipping every scheduled date on or before the completion date. If the resulting due date passes until (inclusive bound, may be None), the task has no next due date (None).

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(first_due, interval_days, mode, completions, until):
    due = dt.date.fromisoformat(first_due)
    end = dt.date.fromisoformat(until) if until else None
    step = dt.timedelta(days=interval_days)
    for c in sorted(completions):
        cd = dt.date.fromisoformat(c)
        if mode == 'regenerate':
            due = cd + step
        else:
            due = due + step
            while due < cd:
                due += step
        if end is not None and due > end:
            return None
    return due.isoformat()
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: late completion on next due',
   ['2024-01-01', 7, 'schedule', ['2024-01-08'], None],
   '2024-01-15'),
  ('early completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-05'], None], '2024-01-12'),
  ('late completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-20'], None], '2024-01-27'),
  ('out of order schedule', ['2024-01-01', 7, 'schedule', ['2024-01-20', '2024-01-02'], None], '2024-01-22'),
  ('multiple missed schedule', ['2024-01-01', 3, 'schedule', ['2024-01-11'], None], '2024-01-13'),
  ('until exact', ['2024-01-01', 7, 'schedule', ['2024-01-01'], '2024-01-08'], '2024-01-08'),
  ('until passed', ['2024-01-01', 7, 'schedule', ['2024-01-01', '2024-01-08'], '2024-01-10'], None)],
 [('late completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-20'], None], '2024-01-27'),
  ('out of order schedule', ['2024-01-01', 7, 'schedule', ['2024-01-20', '2024-01-02'], None], '2024-01-22'),
  ('multiple missed schedule', ['2024-01-01', 3, 'schedule', ['2024-01-11'], None], '2024-01-13'),
  ('until exact', ['2024-01-01', 7, 'schedule', ['2024-01-01'], '2024-01-08'], '2024-01-08'),
  ('until passed', ['2024-01-01', 7, 'schedule', ['2024-01-01', '2024-01-08'], '2024-01-10'], None),
  ('until regenerate', ['2024-02-01', 10, 'regenerate', ['2024-02-05'], '2024-02-15'], '2024-02-15'),
  ('no completions', ['2024-02-01', 10, 'schedule', [], None], '2024-02-01'),
  ('regression: late completion on next due',
   ['2024-01-01', 7, 'schedule', ['2024-01-08'], None],
   '2024-01-15')],
 [('multiple missed schedule', ['2024-01-01', 3, 'schedule', ['2024-01-11'], None], '2024-01-13'),
  ('until exact', ['2024-01-01', 7, 'schedule', ['2024-01-01'], '2024-01-08'], '2024-01-08'),
  ('until passed', ['2024-01-01', 7, 'schedule', ['2024-01-01', '2024-01-08'], '2024-01-10'], None),
  ('until regenerate', ['2024-02-01', 10, 'regenerate', ['2024-02-05'], '2024-02-15'], '2024-02-15'),
  ('no completions', ['2024-02-01', 10, 'schedule', [], None], '2024-02-01'),
  ('completion after until but due inside',
   ['2024-03-01', 30, 'schedule', ['2024-03-05'], '2024-03-31'],
   '2024-03-31'),
  ('two schedule completions',
   ['2024-04-01', 14, 'schedule', ['2024-03-30', '2024-04-10'], None],
   '2024-04-29'),
  ('regression: late completion on next due',
   ['2024-01-01', 7, 'schedule', ['2024-01-08'], None],
   '2024-01-15')],
 [('until passed', ['2024-01-01', 7, 'schedule', ['2024-01-01', '2024-01-08'], '2024-01-10'], None),
  ('until regenerate', ['2024-02-01', 10, 'regenerate', ['2024-02-05'], '2024-02-15'], '2024-02-15'),
  ('no completions', ['2024-02-01', 10, 'schedule', [], None], '2024-02-01'),
  ('completion after until but due inside',
   ['2024-03-01', 30, 'schedule', ['2024-03-05'], '2024-03-31'],
   '2024-03-31'),
  ('two schedule completions',
   ['2024-04-01', 14, 'schedule', ['2024-03-30', '2024-04-10'], None],
   '2024-04-29'),
  ('out of order regenerate',
   ['2024-04-01', 5, 'regenerate', ['2024-04-09', '2024-04-02'], None],
   '2024-04-14'),
  ('regression: late completion on next due',
   ['2024-01-01', 7, 'schedule', ['2024-01-08'], None],
   '2024-01-15')],
 [('no completions', ['2024-02-01', 10, 'schedule', [], None], '2024-02-01'),
  ('completion after until but due inside',
   ['2024-03-01', 30, 'schedule', ['2024-03-05'], '2024-03-31'],
   '2024-03-31'),
  ('two schedule completions',
   ['2024-04-01', 14, 'schedule', ['2024-03-30', '2024-04-10'], None],
   '2024-04-29'),
  ('out of order regenerate',
   ['2024-04-01', 5, 'regenerate', ['2024-04-09', '2024-04-02'], None],
   '2024-04-14'),
  ('regression: late completion on next due',
   ['2024-01-01', 7, 'schedule', ['2024-01-08'], None],
   '2024-01-15'),
  ('early completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-05'], None], '2024-01-12'),
  ('late completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-20'], None], '2024-01-27')]]
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(first_due, interval_days, mode, completions, until):
    due = dt.date.fromisoformat(first_due)
    end = dt.date.fromisoformat(until) if until else None
    step = dt.timedelta(days=interval_days)
    for c in sorted(completions):
        cd = dt.date.fromisoformat(c)
        if mode == 'regenerate':
            due = cd + step
        else:
            due = due + step
            while due + step <= cd:
                due += step
        if end is not None and due > end:
            return None
    return due.isoformat()
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: late completion on next due',
   ['2024-01-01', 7, 'schedule', ['2024-01-08'], None],
   '2024-01-15'),
  ('early completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-05'], None], '2024-01-12'),
  ('late completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-20'], None], '2024-01-27'),
  ('out of order schedule', ['2024-01-01', 7, 'schedule', ['2024-01-20', '2024-01-02'], None], '2024-01-22'),
  ('multiple missed schedule', ['2024-01-01', 3, 'schedule', ['2024-01-11'], None], '2024-01-13'),
  ('until exact', ['2024-01-01', 7, 'schedule', ['2024-01-01'], '2024-01-08'], '2024-01-08'),
  ('until passed', ['2024-01-01', 7, 'schedule', ['2024-01-01', '2024-01-08'], '2024-01-10'], None)],
 [('late completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-20'], None], '2024-01-27'),
  ('out of order schedule', ['2024-01-01', 7, 'schedule', ['2024-01-20', '2024-01-02'], None], '2024-01-22'),
  ('multiple missed schedule', ['2024-01-01', 3, 'schedule', ['2024-01-11'], None], '2024-01-13'),
  ('until exact', ['2024-01-01', 7, 'schedule', ['2024-01-01'], '2024-01-08'], '2024-01-08'),
  ('until passed', ['2024-01-01', 7, 'schedule', ['2024-01-01', '2024-01-08'], '2024-01-10'], None),
  ('until regenerate', ['2024-02-01', 10, 'regenerate', ['2024-02-05'], '2024-02-15'], '2024-02-15'),
  ('no completions', ['2024-02-01', 10, 'schedule', [], None], '2024-02-01'),
  ('regression: late completion on next due',
   ['2024-01-01', 7, 'schedule', ['2024-01-08'], None],
   '2024-01-15')],
 [('multiple missed schedule', ['2024-01-01', 3, 'schedule', ['2024-01-11'], None], '2024-01-13'),
  ('until exact', ['2024-01-01', 7, 'schedule', ['2024-01-01'], '2024-01-08'], '2024-01-08'),
  ('until passed', ['2024-01-01', 7, 'schedule', ['2024-01-01', '2024-01-08'], '2024-01-10'], None),
  ('until regenerate', ['2024-02-01', 10, 'regenerate', ['2024-02-05'], '2024-02-15'], '2024-02-15'),
  ('no completions', ['2024-02-01', 10, 'schedule', [], None], '2024-02-01'),
  ('completion after until but due inside',
   ['2024-03-01', 30, 'schedule', ['2024-03-05'], '2024-03-31'],
   '2024-03-31'),
  ('two schedule completions',
   ['2024-04-01', 14, 'schedule', ['2024-03-30', '2024-04-10'], None],
   '2024-04-29'),
  ('regression: late completion on next due',
   ['2024-01-01', 7, 'schedule', ['2024-01-08'], None],
   '2024-01-15')],
 [('until passed', ['2024-01-01', 7, 'schedule', ['2024-01-01', '2024-01-08'], '2024-01-10'], None),
  ('until regenerate', ['2024-02-01', 10, 'regenerate', ['2024-02-05'], '2024-02-15'], '2024-02-15'),
  ('no completions', ['2024-02-01', 10, 'schedule', [], None], '2024-02-01'),
  ('completion after until but due inside',
   ['2024-03-01', 30, 'schedule', ['2024-03-05'], '2024-03-31'],
   '2024-03-31'),
  ('two schedule completions',
   ['2024-04-01', 14, 'schedule', ['2024-03-30', '2024-04-10'], None],
   '2024-04-29'),
  ('out of order regenerate',
   ['2024-04-01', 5, 'regenerate', ['2024-04-09', '2024-04-02'], None],
   '2024-04-14'),
  ('regression: late completion on next due',
   ['2024-01-01', 7, 'schedule', ['2024-01-08'], None],
   '2024-01-15')],
 [('no completions', ['2024-02-01', 10, 'schedule', [], None], '2024-02-01'),
  ('completion after until but due inside',
   ['2024-03-01', 30, 'schedule', ['2024-03-05'], '2024-03-31'],
   '2024-03-31'),
  ('two schedule completions',
   ['2024-04-01', 14, 'schedule', ['2024-03-30', '2024-04-10'], None],
   '2024-04-29'),
  ('out of order regenerate',
   ['2024-04-01', 5, 'regenerate', ['2024-04-09', '2024-04-02'], None],
   '2024-04-14'),
  ('regression: late completion on next due',
   ['2024-01-01', 7, 'schedule', ['2024-01-08'], None],
   '2024-01-15'),
  ('early completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-05'], None], '2024-01-12'),
  ('late completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-20'], None], '2024-01-27')]]
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 scheduled task completed late on its next due date stays due that same day.

A recurring task first due on first_due repeats every interval_days. Completions are processed in chronological order. mode "regenerate": the next due date is completion + interval. mode "schedule": completing advances to the next scheduled due date, skipping every scheduled date on or before the completion date. If the resulting due date passes until (inclusive bound, may be None), the task has no next due date (None).

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(first_due, interval_days, mode, completions, until):
    due = dt.date.fromisoformat(first_due)
    end = dt.date.fromisoformat(until) if until else None
    step = dt.timedelta(days=interval_days)
    for c in sorted(completions):
        cd = dt.date.fromisoformat(c)
        if mode == 'regenerate':
            due = cd + step
        else:
            due = due + step
            while due <= cd:
                due += step
        if end is not None and due >= end:
            return None
    return due.isoformat()
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: late completion on next due',
   ['2024-01-01', 7, 'schedule', ['2024-01-08'], None],
   '2024-01-15'),
  ('early completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-05'], None], '2024-01-12'),
  ('late completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-20'], None], '2024-01-27'),
  ('out of order schedule', ['2024-01-01', 7, 'schedule', ['2024-01-20', '2024-01-02'], None], '2024-01-22'),
  ('multiple missed schedule', ['2024-01-01', 3, 'schedule', ['2024-01-11'], None], '2024-01-13'),
  ('until exact', ['2024-01-01', 7, 'schedule', ['2024-01-01'], '2024-01-08'], '2024-01-08'),
  ('until passed', ['2024-01-01', 7, 'schedule', ['2024-01-01', '2024-01-08'], '2024-01-10'], None)],
 [('late completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-20'], None], '2024-01-27'),
  ('out of order schedule', ['2024-01-01', 7, 'schedule', ['2024-01-20', '2024-01-02'], None], '2024-01-22'),
  ('multiple missed schedule', ['2024-01-01', 3, 'schedule', ['2024-01-11'], None], '2024-01-13'),
  ('until exact', ['2024-01-01', 7, 'schedule', ['2024-01-01'], '2024-01-08'], '2024-01-08'),
  ('until passed', ['2024-01-01', 7, 'schedule', ['2024-01-01', '2024-01-08'], '2024-01-10'], None),
  ('until regenerate', ['2024-02-01', 10, 'regenerate', ['2024-02-05'], '2024-02-15'], '2024-02-15'),
  ('no completions', ['2024-02-01', 10, 'schedule', [], None], '2024-02-01')],
 [('multiple missed schedule', ['2024-01-01', 3, 'schedule', ['2024-01-11'], None], '2024-01-13'),
  ('until exact', ['2024-01-01', 7, 'schedule', ['2024-01-01'], '2024-01-08'], '2024-01-08'),
  ('until passed', ['2024-01-01', 7, 'schedule', ['2024-01-01', '2024-01-08'], '2024-01-10'], None),
  ('until regenerate', ['2024-02-01', 10, 'regenerate', ['2024-02-05'], '2024-02-15'], '2024-02-15'),
  ('no completions', ['2024-02-01', 10, 'schedule', [], None], '2024-02-01'),
  ('completion after until but due inside',
   ['2024-03-01', 30, 'schedule', ['2024-03-05'], '2024-03-31'],
   '2024-03-31'),
  ('two schedule completions',
   ['2024-04-01', 14, 'schedule', ['2024-03-30', '2024-04-10'], None],
   '2024-04-29')],
 [('until passed', ['2024-01-01', 7, 'schedule', ['2024-01-01', '2024-01-08'], '2024-01-10'], None),
  ('until regenerate', ['2024-02-01', 10, 'regenerate', ['2024-02-05'], '2024-02-15'], '2024-02-15'),
  ('no completions', ['2024-02-01', 10, 'schedule', [], None], '2024-02-01'),
  ('completion after until but due inside',
   ['2024-03-01', 30, 'schedule', ['2024-03-05'], '2024-03-31'],
   '2024-03-31'),
  ('two schedule completions',
   ['2024-04-01', 14, 'schedule', ['2024-03-30', '2024-04-10'], None],
   '2024-04-29'),
  ('out of order regenerate',
   ['2024-04-01', 5, 'regenerate', ['2024-04-09', '2024-04-02'], None],
   '2024-04-14'),
  ('regression: late completion on next due',
   ['2024-01-01', 7, 'schedule', ['2024-01-08'], None],
   '2024-01-15')],
 [('no completions', ['2024-02-01', 10, 'schedule', [], None], '2024-02-01'),
  ('completion after until but due inside',
   ['2024-03-01', 30, 'schedule', ['2024-03-05'], '2024-03-31'],
   '2024-03-31'),
  ('two schedule completions',
   ['2024-04-01', 14, 'schedule', ['2024-03-30', '2024-04-10'], None],
   '2024-04-29'),
  ('out of order regenerate',
   ['2024-04-01', 5, 'regenerate', ['2024-04-09', '2024-04-02'], None],
   '2024-04-14'),
  ('regression: late completion on next due',
   ['2024-01-01', 7, 'schedule', ['2024-01-08'], None],
   '2024-01-15'),
  ('early completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-05'], None], '2024-01-12'),
  ('late completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-20'], None], '2024-01-27'),
  ('until passed', ['2024-01-01', 7, 'schedule', ['2024-01-01', '2024-01-08'], '2024-01-10'], 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
import datetime as dt
import calendar
N = 1
observations = []
def solve(first_due, interval_days, mode, completions, until):
    due = dt.date.fromisoformat(first_due)
    end = dt.date.fromisoformat(until) if until else None
    step = dt.timedelta(days=interval_days)
    for c in sorted(completions):
        cd = dt.date.fromisoformat(c)
        if mode == 'regenerate':
            due = cd + step
        else:
            due = due + step
            while due <= cd:
                due += step
        if end is not None and cd > end:
            return None
    return due.isoformat()
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: late completion on next due',
   ['2024-01-01', 7, 'schedule', ['2024-01-08'], None],
   '2024-01-15'),
  ('early completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-05'], None], '2024-01-12'),
  ('late completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-20'], None], '2024-01-27'),
  ('out of order schedule', ['2024-01-01', 7, 'schedule', ['2024-01-20', '2024-01-02'], None], '2024-01-22'),
  ('multiple missed schedule', ['2024-01-01', 3, 'schedule', ['2024-01-11'], None], '2024-01-13'),
  ('until exact', ['2024-01-01', 7, 'schedule', ['2024-01-01'], '2024-01-08'], '2024-01-08'),
  ('until passed', ['2024-01-01', 7, 'schedule', ['2024-01-01', '2024-01-08'], '2024-01-10'], None)],
 [('late completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-20'], None], '2024-01-27'),
  ('out of order schedule', ['2024-01-01', 7, 'schedule', ['2024-01-20', '2024-01-02'], None], '2024-01-22'),
  ('multiple missed schedule', ['2024-01-01', 3, 'schedule', ['2024-01-11'], None], '2024-01-13'),
  ('until exact', ['2024-01-01', 7, 'schedule', ['2024-01-01'], '2024-01-08'], '2024-01-08'),
  ('until passed', ['2024-01-01', 7, 'schedule', ['2024-01-01', '2024-01-08'], '2024-01-10'], None),
  ('until regenerate', ['2024-02-01', 10, 'regenerate', ['2024-02-05'], '2024-02-15'], '2024-02-15'),
  ('no completions', ['2024-02-01', 10, 'schedule', [], None], '2024-02-01')],
 [('multiple missed schedule', ['2024-01-01', 3, 'schedule', ['2024-01-11'], None], '2024-01-13'),
  ('until exact', ['2024-01-01', 7, 'schedule', ['2024-01-01'], '2024-01-08'], '2024-01-08'),
  ('until passed', ['2024-01-01', 7, 'schedule', ['2024-01-01', '2024-01-08'], '2024-01-10'], None),
  ('until regenerate', ['2024-02-01', 10, 'regenerate', ['2024-02-05'], '2024-02-15'], '2024-02-15'),
  ('no completions', ['2024-02-01', 10, 'schedule', [], None], '2024-02-01'),
  ('completion after until but due inside',
   ['2024-03-01', 30, 'schedule', ['2024-03-05'], '2024-03-31'],
   '2024-03-31'),
  ('two schedule completions',
   ['2024-04-01', 14, 'schedule', ['2024-03-30', '2024-04-10'], None],
   '2024-04-29')],
 [('until passed', ['2024-01-01', 7, 'schedule', ['2024-01-01', '2024-01-08'], '2024-01-10'], None),
  ('until regenerate', ['2024-02-01', 10, 'regenerate', ['2024-02-05'], '2024-02-15'], '2024-02-15'),
  ('no completions', ['2024-02-01', 10, 'schedule', [], None], '2024-02-01'),
  ('completion after until but due inside',
   ['2024-03-01', 30, 'schedule', ['2024-03-05'], '2024-03-31'],
   '2024-03-31'),
  ('two schedule completions',
   ['2024-04-01', 14, 'schedule', ['2024-03-30', '2024-04-10'], None],
   '2024-04-29'),
  ('out of order regenerate',
   ['2024-04-01', 5, 'regenerate', ['2024-04-09', '2024-04-02'], None],
   '2024-04-14'),
  ('regression: late completion on next due',
   ['2024-01-01', 7, 'schedule', ['2024-01-08'], None],
   '2024-01-15')],
 [('no completions', ['2024-02-01', 10, 'schedule', [], None], '2024-02-01'),
  ('completion after until but due inside',
   ['2024-03-01', 30, 'schedule', ['2024-03-05'], '2024-03-31'],
   '2024-03-31'),
  ('two schedule completions',
   ['2024-04-01', 14, 'schedule', ['2024-03-30', '2024-04-10'], None],
   '2024-04-29'),
  ('out of order regenerate',
   ['2024-04-01', 5, 'regenerate', ['2024-04-09', '2024-04-02'], None],
   '2024-04-14'),
  ('regression: late completion on next due',
   ['2024-01-01', 7, 'schedule', ['2024-01-08'], None],
   '2024-01-15'),
  ('early completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-05'], None], '2024-01-12'),
  ('late completion regenerate', ['2024-01-10', 7, 'regenerate', ['2024-01-20'], None], '2024-01-27'),
  ('until passed', ['2024-01-01', 7, 'schedule', ['2024-01-01', '2024-01-08'], '2024-01-10'], 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:
The final occurrence falling exactly on the end date is dropped.

A recurring task first due on first_due repeats every interval_days. Completions are processed in chronological order. mode "regenerate": the next due date is completion + interval. mode "schedule": completing advances to the next scheduled due date, skipping every scheduled date on or before the completion date. If the resulting due date passes until (inclusive bound, may be None), the task has no next due date (None).

split: open-access


prompt:
A period ending on a Saturday is left due on the Saturday.

Stipulated rule: exclude the trigger day, count every calendar day, and if the last day is a Saturday, Sunday or listed holiday continue to the next day that is none of these. When service was by mail or by leaving with the clerk, 3 days are added after the period would otherwise expire, and the last-day extension is applied again. Electronic and hand service add nothing.

split: open-access


prompt:
A period ending on Saturday is extended only to Sunday.

Stipulated rule: exclude the trigger day, count every calendar day, and if the last day is a Saturday, Sunday or listed holiday continue to the next day that is none of these. When service was by mail or by leaving with the clerk, 3 days are added after the period would otherwise expire, and the last-day extension is applied again. Electronic and hand service add nothing.

split: open-access


prompt:
A 14-day period expires a day early because the trigger day is counted as day one.

Stipulated rule: exclude the trigger day, count every calendar day, and if the last day is a Saturday, Sunday or listed holiday continue to the next day that is none of these. When service was by mail or by leaving with the clerk, 3 days are added after the period would otherwise expire, and the last-day extension is applied again. Electronic and hand service add nothing.

split: open-access


prompt:
Electronic service still receives three extra days.

Stipulated rule: exclude the trigger day, count every calendar day, and if the last day is a Saturday, Sunday or listed holiday continue to the next day that is none of these. When service was by mail or by leaving with the clerk, 3 days are added after the period would otherwise expire, and the last-day extension is applied again. Electronic and hand service add nothing.

split: open-access


prompt:
When the base period ends on a weekend, mail service yields a deadline one or two days early.

Stipulated rule: exclude the trigger day, count every calendar day, and if the last day is a Saturday, Sunday or listed holiday continue to the next day that is none of these. When service was by mail or by leaving with the clerk, 3 days are added after the period would otherwise expire, and the last-day extension is applied again. Electronic and hand service add nothing.

split: open-access


prompt:
A July 4 falling on Sunday does not close the court on Monday July 5.

Stipulated legacy rule: a period of fewer than 11 days excludes intermediate Saturdays, Sundays and holidays; longer periods count every calendar day. The trigger day is excluded, and for any period a last day that is closed rolls forward to the next open day. Holidays are listed by nominal date; a holiday on Saturday is observed the preceding Friday and one on Sunday the following Monday.

split: open-access


prompt:
An 11-day period skips weekends although only shorter periods do.

Stipulated legacy rule: a period of fewer than 11 days excludes intermediate Saturdays, Sundays and holidays; longer periods count every calendar day. The trigger day is excluded, and for any period a last day that is closed rolls forward to the next open day. Holidays are listed by nominal date; a holiday on Saturday is observed the preceding Friday and one on Sunday the following Monday.

split: open-access


prompt:
A 7-day period counts an intermediate holiday as a day.

Stipulated legacy rule: a period of fewer than 11 days excludes intermediate Saturdays, Sundays and holidays; longer periods count every calendar day. The trigger day is excluded, and for any period a last day that is closed rolls forward to the next open day. Holidays are listed by nominal date; a holiday on Saturday is observed the preceding Friday and one on Sunday the following Monday.

split: open-access


prompt:
A 30-day period ending on a Sunday is left due on the Sunday.

Stipulated legacy rule: a period of fewer than 11 days excludes intermediate Saturdays, Sundays and holidays; longer periods count every calendar day. The trigger day is excluded, and for any period a last day that is closed rolls forward to the next open day. Holidays are listed by nominal date; a holiday on Saturday is observed the preceding Friday and one on Sunday the following Monday.

split: open-access


prompt:
The filing deadline is one day later than allowed because the hearing day is counted.

A paper must be filed at least days before the hearing. Stipulated rule: exclude the hearing day and count backward; when court_days is true only open days (not Saturday, Sunday or a listed holiday) are counted. If the resulting day is closed, the deadline moves backward to the preceding open day.

split: open-access


prompt:
A court-day count treats a holiday as a court day.

A paper must be filed at least days before the hearing. Stipulated rule: exclude the hearing day and count backward; when court_days is true only open days (not Saturday, Sunday or a listed holiday) are counted. If the resulting day is closed, the deadline moves backward to the preceding open day.

split: open-access


prompt:
A backward deadline landing on Sunday is moved to Monday, leaving less notice than required.

A paper must be filed at least days before the hearing. Stipulated rule: exclude the hearing day and count backward; when court_days is true only open days (not Saturday, Sunday or a listed holiday) are counted. If the resulting day is closed, the deadline moves backward to the preceding open day.

split: open-access


prompt:
A period triggered on April 30 ends on the 30th of a 31-day month instead of its last day.

A period of months runs to the same-numbered day of the target month. Stipulated: if the trigger is the last day of its month the period ends on the last day of the target month; otherwise a missing day (e.g. the 30th of February) becomes the last day of the target month. A closed last day (Saturday, Sunday, listed holiday) moves forward to the next open day, even into the next month.

split: open-access


prompt:
A one-month period from January 30 overflows into March.

A period of months runs to the same-numbered day of the target month. Stipulated: if the trigger is the last day of its month the period ends on the last day of the target month; otherwise a missing day (e.g. the 30th of February) becomes the last day of the target month. A closed last day (Saturday, Sunday, listed holiday) moves forward to the next open day, even into the next month.

split: open-access


prompt:
A deadline landing on a weekend is moved earlier, shortening the period.

A period of months runs to the same-numbered day of the target month. Stipulated: if the trigger is the last day of its month the period ends on the last day of the target month; otherwise a missing day (e.g. the 30th of February) becomes the last day of the target month. A closed last day (Saturday, Sunday, listed holiday) moves forward to the next open day, even into the next month.

split: open-access


prompt:
A 48-hour period triggered at 10:20 ends at 11:00 two days later.

Stipulated rule: an hours period begins counting immediately at the triggering event, counts every hour including weekends and holidays, and if it ends on a Saturday, Sunday or listed holiday it continues to the same time on the next day that is none of these.

split: open-access


prompt:
A 36-hour period is treated as one day.

Stipulated rule: an hours period begins counting immediately at the triggering event, counts every hour including weekends and holidays, and if it ends on a Saturday, Sunday or listed holiday it continues to the same time on the next day that is none of these.

split: open-access


prompt:
A period ending Saturday 15:00 is extended only to Monday 00:00.

Stipulated rule: an hours period begins counting immediately at the triggering event, counts every hour including weekends and holidays, and if it ends on a Saturday, Sunday or listed holiday it continues to the same time on the next day that is none of these.

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(filed, deadline, offset_min, method, office_close):
    u = dt.datetime.fromisoformat(filed[:19])
    local = u + dt.timedelta(minutes=offset_min)
    dl = dt.date.fromisoformat(deadline)
    if method == 'electronic':
        timely = local.date() <= dl
    else:
        close = dt.time.fromisoformat(office_close)
        timely = local.date() < dl or (local.date() == dl and local.time() < close)
    return [timely, local.isoformat(timespec='seconds')]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: west zone late evening',
   ['2024-03-06T04:30:00Z', '2024-03-05', -300, 'electronic', '17:00'],
   [True, '2024-03-05T23:30:00']),
  ('east zone after midnight',
   ['2024-03-05T22:30:00Z', '2024-03-05', 120, 'electronic', '17:00'],
   [False, '2024-03-06T00:30:00']),
  ('explicit offset stamp',
   ['2024-03-05T23:30:00-05:00', '2024-03-05', 0, 'electronic', '17:00'],
   [False, '2024-03-06T04:30:00']),
  ('last second electronic',
   ['2024-03-05T23:59:30Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T23:59:30']),
  ('deadline day morning',
   ['2024-03-05T09:00:00Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T09:00:00']),
  ('paper after close',
   ['2024-03-05T17:30:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [False, '2024-03-05T17:30:00']),
  ('paper exactly at close',
   ['2024-03-05T22:00:00Z', '2024-03-05', -300, 'paper', '17:00'],
   [False, '2024-03-05T17:00:00'])],
 [('explicit offset stamp',
   ['2024-03-05T23:30:00-05:00', '2024-03-05', 0, 'electronic', '17:00'],
   [False, '2024-03-06T04:30:00']),
  ('last second electronic',
   ['2024-03-05T23:59:30Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T23:59:30']),
  ('deadline day morning',
   ['2024-03-05T09:00:00Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T09:00:00']),
  ('paper after close',
   ['2024-03-05T17:30:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [False, '2024-03-05T17:30:00']),
  ('paper exactly at close',
   ['2024-03-05T22:00:00Z', '2024-03-05', -300, 'paper', '17:00'],
   [False, '2024-03-05T17:00:00']),
  ('paper before close offset',
   ['2024-03-05T14:00:00+02:00', '2024-03-05', 60, 'paper', '16:30'],
   [True, '2024-03-05T13:00:00']),
  ('paper previous day evening',
   ['2024-03-04T21:00:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [True, '2024-03-04T21:00:00'])],
 [('deadline day morning',
   ['2024-03-05T09:00:00Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T09:00:00']),
  ('paper after close',
   ['2024-03-05T17:30:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [False, '2024-03-05T17:30:00']),
  ('paper exactly at close',
   ['2024-03-05T22:00:00Z', '2024-03-05', -300, 'paper', '17:00'],
   [False, '2024-03-05T17:00:00']),
  ('paper before close offset',
   ['2024-03-05T14:00:00+02:00', '2024-03-05', 60, 'paper', '16:30'],
   [True, '2024-03-05T13:00:00']),
  ('paper previous day evening',
   ['2024-03-04T21:00:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [True, '2024-03-04T21:00:00']),
  ('electronic next day',
   ['2024-03-06T00:00:01Z', '2024-03-05', 0, 'electronic', '17:00'],
   [False, '2024-03-06T00:00:01']),
  ('offset stamp plus zone',
   ['2024-03-06T01:15:00+01:00', '2024-03-05', -60, 'electronic', '17:00'],
   [True, '2024-03-05T23:15:00'])],
 [('paper exactly at close',
   ['2024-03-05T22:00:00Z', '2024-03-05', -300, 'paper', '17:00'],
   [False, '2024-03-05T17:00:00']),
  ('paper before close offset',
   ['2024-03-05T14:00:00+02:00', '2024-03-05', 60, 'paper', '16:30'],
   [True, '2024-03-05T13:00:00']),
  ('paper previous day evening',
   ['2024-03-04T21:00:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [True, '2024-03-04T21:00:00']),
  ('electronic next day',
   ['2024-03-06T00:00:01Z', '2024-03-05', 0, 'electronic', '17:00'],
   [False, '2024-03-06T00:00:01']),
  ('offset stamp plus zone',
   ['2024-03-06T01:15:00+01:00', '2024-03-05', -60, 'electronic', '17:00'],
   [True, '2024-03-05T23:15:00']),
  ('regression: west zone late evening',
   ['2024-03-06T04:30:00Z', '2024-03-05', -300, 'electronic', '17:00'],
   [True, '2024-03-05T23:30:00']),
  ('east zone after midnight',
   ['2024-03-05T22:30:00Z', '2024-03-05', 120, 'electronic', '17:00'],
   [False, '2024-03-06T00:30:00'])],
 [('paper previous day evening',
   ['2024-03-04T21:00:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [True, '2024-03-04T21:00:00']),
  ('electronic next day',
   ['2024-03-06T00:00:01Z', '2024-03-05', 0, 'electronic', '17:00'],
   [False, '2024-03-06T00:00:01']),
  ('offset stamp plus zone',
   ['2024-03-06T01:15:00+01:00', '2024-03-05', -60, 'electronic', '17:00'],
   [True, '2024-03-05T23:15:00']),
  ('regression: west zone late evening',
   ['2024-03-06T04:30:00Z', '2024-03-05', -300, 'electronic', '17:00'],
   [True, '2024-03-05T23:30:00']),
  ('east zone after midnight',
   ['2024-03-05T22:30:00Z', '2024-03-05', 120, 'electronic', '17:00'],
   [False, '2024-03-06T00:30:00']),
  ('explicit offset stamp',
   ['2024-03-05T23:30:00-05:00', '2024-03-05', 0, 'electronic', '17:00'],
   [False, '2024-03-06T04:30:00']),
  ('last second electronic',
   ['2024-03-05T23:59:30Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T23:59:30'])]]
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(filed, deadline, offset_min, method, office_close):
    u = dt.datetime.fromisoformat(filed.replace('Z', '+00:00')).replace(tzinfo=None)
    local = u + dt.timedelta(minutes=offset_min)
    dl = dt.date.fromisoformat(deadline)
    if method == 'electronic':
        timely = local.date() <= dl
    else:
        close = dt.time.fromisoformat(office_close)
        timely = local.date() < dl or (local.date() == dl and local.time() < close)
    return [timely, local.isoformat(timespec='seconds')]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: west zone late evening',
   ['2024-03-06T04:30:00Z', '2024-03-05', -300, 'electronic', '17:00'],
   [True, '2024-03-05T23:30:00']),
  ('east zone after midnight',
   ['2024-03-05T22:30:00Z', '2024-03-05', 120, 'electronic', '17:00'],
   [False, '2024-03-06T00:30:00']),
  ('explicit offset stamp',
   ['2024-03-05T23:30:00-05:00', '2024-03-05', 0, 'electronic', '17:00'],
   [False, '2024-03-06T04:30:00']),
  ('last second electronic',
   ['2024-03-05T23:59:30Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T23:59:30']),
  ('deadline day morning',
   ['2024-03-05T09:00:00Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T09:00:00']),
  ('paper after close',
   ['2024-03-05T17:30:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [False, '2024-03-05T17:30:00']),
  ('paper exactly at close',
   ['2024-03-05T22:00:00Z', '2024-03-05', -300, 'paper', '17:00'],
   [False, '2024-03-05T17:00:00'])],
 [('explicit offset stamp',
   ['2024-03-05T23:30:00-05:00', '2024-03-05', 0, 'electronic', '17:00'],
   [False, '2024-03-06T04:30:00']),
  ('last second electronic',
   ['2024-03-05T23:59:30Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T23:59:30']),
  ('deadline day morning',
   ['2024-03-05T09:00:00Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T09:00:00']),
  ('paper after close',
   ['2024-03-05T17:30:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [False, '2024-03-05T17:30:00']),
  ('paper exactly at close',
   ['2024-03-05T22:00:00Z', '2024-03-05', -300, 'paper', '17:00'],
   [False, '2024-03-05T17:00:00']),
  ('paper before close offset',
   ['2024-03-05T14:00:00+02:00', '2024-03-05', 60, 'paper', '16:30'],
   [True, '2024-03-05T13:00:00']),
  ('paper previous day evening',
   ['2024-03-04T21:00:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [True, '2024-03-04T21:00:00'])],
 [('deadline day morning',
   ['2024-03-05T09:00:00Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T09:00:00']),
  ('paper after close',
   ['2024-03-05T17:30:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [False, '2024-03-05T17:30:00']),
  ('paper exactly at close',
   ['2024-03-05T22:00:00Z', '2024-03-05', -300, 'paper', '17:00'],
   [False, '2024-03-05T17:00:00']),
  ('paper before close offset',
   ['2024-03-05T14:00:00+02:00', '2024-03-05', 60, 'paper', '16:30'],
   [True, '2024-03-05T13:00:00']),
  ('paper previous day evening',
   ['2024-03-04T21:00:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [True, '2024-03-04T21:00:00']),
  ('electronic next day',
   ['2024-03-06T00:00:01Z', '2024-03-05', 0, 'electronic', '17:00'],
   [False, '2024-03-06T00:00:01']),
  ('offset stamp plus zone',
   ['2024-03-06T01:15:00+01:00', '2024-03-05', -60, 'electronic', '17:00'],
   [True, '2024-03-05T23:15:00'])],
 [('paper exactly at close',
   ['2024-03-05T22:00:00Z', '2024-03-05', -300, 'paper', '17:00'],
   [False, '2024-03-05T17:00:00']),
  ('paper before close offset',
   ['2024-03-05T14:00:00+02:00', '2024-03-05', 60, 'paper', '16:30'],
   [True, '2024-03-05T13:00:00']),
  ('paper previous day evening',
   ['2024-03-04T21:00:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [True, '2024-03-04T21:00:00']),
  ('electronic next day',
   ['2024-03-06T00:00:01Z', '2024-03-05', 0, 'electronic', '17:00'],
   [False, '2024-03-06T00:00:01']),
  ('offset stamp plus zone',
   ['2024-03-06T01:15:00+01:00', '2024-03-05', -60, 'electronic', '17:00'],
   [True, '2024-03-05T23:15:00']),
  ('regression: west zone late evening',
   ['2024-03-06T04:30:00Z', '2024-03-05', -300, 'electronic', '17:00'],
   [True, '2024-03-05T23:30:00']),
  ('east zone after midnight',
   ['2024-03-05T22:30:00Z', '2024-03-05', 120, 'electronic', '17:00'],
   [False, '2024-03-06T00:30:00'])],
 [('paper previous day evening',
   ['2024-03-04T21:00:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [True, '2024-03-04T21:00:00']),
  ('electronic next day',
   ['2024-03-06T00:00:01Z', '2024-03-05', 0, 'electronic', '17:00'],
   [False, '2024-03-06T00:00:01']),
  ('offset stamp plus zone',
   ['2024-03-06T01:15:00+01:00', '2024-03-05', -60, 'electronic', '17:00'],
   [True, '2024-03-05T23:15:00']),
  ('regression: west zone late evening',
   ['2024-03-06T04:30:00Z', '2024-03-05', -300, 'electronic', '17:00'],
   [True, '2024-03-05T23:30:00']),
  ('east zone after midnight',
   ['2024-03-05T22:30:00Z', '2024-03-05', 120, 'electronic', '17:00'],
   [False, '2024-03-06T00:30:00']),
  ('explicit offset stamp',
   ['2024-03-05T23:30:00-05:00', '2024-03-05', 0, 'electronic', '17:00'],
   [False, '2024-03-06T04:30:00']),
  ('last second electronic',
   ['2024-03-05T23:59:30Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T23:59:30'])]]
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 filing stamped with a non-UTC offset is judged against the wrong local time.

The filing timestamp is ISO 8601 with Z or an explicit UTC offset. The court is at offset_min minutes east of UTC (local = UTC + offset). Electronic filing is timely through local midnight ending the deadline day (any time on the deadline date). Paper filing on the deadline day is timely only strictly before the clerk office closing time. Earlier dates are timely. Return [timely, local time ISO to the second].

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(filed, deadline, offset_min, method, office_close):
    u = dt.datetime.fromisoformat(filed.replace('Z', '+00:00')).astimezone(dt.timezone.utc).replace(tzinfo=None)
    local = u + dt.timedelta(minutes=-offset_min)
    dl = dt.date.fromisoformat(deadline)
    if method == 'electronic':
        timely = local.date() <= dl
    else:
        close = dt.time.fromisoformat(office_close)
        timely = local.date() < dl or (local.date() == dl and local.time() < close)
    return [timely, local.isoformat(timespec='seconds')]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: west zone late evening',
   ['2024-03-06T04:30:00Z', '2024-03-05', -300, 'electronic', '17:00'],
   [True, '2024-03-05T23:30:00']),
  ('east zone after midnight',
   ['2024-03-05T22:30:00Z', '2024-03-05', 120, 'electronic', '17:00'],
   [False, '2024-03-06T00:30:00']),
  ('explicit offset stamp',
   ['2024-03-05T23:30:00-05:00', '2024-03-05', 0, 'electronic', '17:00'],
   [False, '2024-03-06T04:30:00']),
  ('last second electronic',
   ['2024-03-05T23:59:30Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T23:59:30']),
  ('deadline day morning',
   ['2024-03-05T09:00:00Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T09:00:00']),
  ('paper after close',
   ['2024-03-05T17:30:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [False, '2024-03-05T17:30:00']),
  ('paper exactly at close',
   ['2024-03-05T22:00:00Z', '2024-03-05', -300, 'paper', '17:00'],
   [False, '2024-03-05T17:00:00'])],
 [('explicit offset stamp',
   ['2024-03-05T23:30:00-05:00', '2024-03-05', 0, 'electronic', '17:00'],
   [False, '2024-03-06T04:30:00']),
  ('last second electronic',
   ['2024-03-05T23:59:30Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T23:59:30']),
  ('deadline day morning',
   ['2024-03-05T09:00:00Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T09:00:00']),
  ('paper after close',
   ['2024-03-05T17:30:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [False, '2024-03-05T17:30:00']),
  ('paper exactly at close',
   ['2024-03-05T22:00:00Z', '2024-03-05', -300, 'paper', '17:00'],
   [False, '2024-03-05T17:00:00']),
  ('paper before close offset',
   ['2024-03-05T14:00:00+02:00', '2024-03-05', 60, 'paper', '16:30'],
   [True, '2024-03-05T13:00:00']),
  ('paper previous day evening',
   ['2024-03-04T21:00:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [True, '2024-03-04T21:00:00'])],
 [('deadline day morning',
   ['2024-03-05T09:00:00Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T09:00:00']),
  ('paper after close',
   ['2024-03-05T17:30:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [False, '2024-03-05T17:30:00']),
  ('paper exactly at close',
   ['2024-03-05T22:00:00Z', '2024-03-05', -300, 'paper', '17:00'],
   [False, '2024-03-05T17:00:00']),
  ('paper before close offset',
   ['2024-03-05T14:00:00+02:00', '2024-03-05', 60, 'paper', '16:30'],
   [True, '2024-03-05T13:00:00']),
  ('paper previous day evening',
   ['2024-03-04T21:00:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [True, '2024-03-04T21:00:00']),
  ('electronic next day',
   ['2024-03-06T00:00:01Z', '2024-03-05', 0, 'electronic', '17:00'],
   [False, '2024-03-06T00:00:01']),
  ('offset stamp plus zone',
   ['2024-03-06T01:15:00+01:00', '2024-03-05', -60, 'electronic', '17:00'],
   [True, '2024-03-05T23:15:00'])],
 [('paper exactly at close',
   ['2024-03-05T22:00:00Z', '2024-03-05', -300, 'paper', '17:00'],
   [False, '2024-03-05T17:00:00']),
  ('paper before close offset',
   ['2024-03-05T14:00:00+02:00', '2024-03-05', 60, 'paper', '16:30'],
   [True, '2024-03-05T13:00:00']),
  ('paper previous day evening',
   ['2024-03-04T21:00:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [True, '2024-03-04T21:00:00']),
  ('electronic next day',
   ['2024-03-06T00:00:01Z', '2024-03-05', 0, 'electronic', '17:00'],
   [False, '2024-03-06T00:00:01']),
  ('offset stamp plus zone',
   ['2024-03-06T01:15:00+01:00', '2024-03-05', -60, 'electronic', '17:00'],
   [True, '2024-03-05T23:15:00']),
  ('regression: west zone late evening',
   ['2024-03-06T04:30:00Z', '2024-03-05', -300, 'electronic', '17:00'],
   [True, '2024-03-05T23:30:00']),
  ('east zone after midnight',
   ['2024-03-05T22:30:00Z', '2024-03-05', 120, 'electronic', '17:00'],
   [False, '2024-03-06T00:30:00'])],
 [('paper previous day evening',
   ['2024-03-04T21:00:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [True, '2024-03-04T21:00:00']),
  ('electronic next day',
   ['2024-03-06T00:00:01Z', '2024-03-05', 0, 'electronic', '17:00'],
   [False, '2024-03-06T00:00:01']),
  ('offset stamp plus zone',
   ['2024-03-06T01:15:00+01:00', '2024-03-05', -60, 'electronic', '17:00'],
   [True, '2024-03-05T23:15:00']),
  ('regression: west zone late evening',
   ['2024-03-06T04:30:00Z', '2024-03-05', -300, 'electronic', '17:00'],
   [True, '2024-03-05T23:30:00']),
  ('east zone after midnight',
   ['2024-03-05T22:30:00Z', '2024-03-05', 120, 'electronic', '17:00'],
   [False, '2024-03-06T00:30:00']),
  ('explicit offset stamp',
   ['2024-03-05T23:30:00-05:00', '2024-03-05', 0, 'electronic', '17:00'],
   [False, '2024-03-06T04:30:00']),
  ('last second electronic',
   ['2024-03-05T23:59:30Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T23:59:30'])]]
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(filed, deadline, offset_min, method, office_close):
    u = dt.datetime.fromisoformat(filed.replace('Z', '+00:00')).astimezone(dt.timezone.utc).replace(tzinfo=None)
    local = u + dt.timedelta(minutes=abs(offset_min))
    dl = dt.date.fromisoformat(deadline)
    if method == 'electronic':
        timely = local.date() <= dl
    else:
        close = dt.time.fromisoformat(office_close)
        timely = local.date() < dl or (local.date() == dl and local.time() < close)
    return [timely, local.isoformat(timespec='seconds')]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: west zone late evening',
   ['2024-03-06T04:30:00Z', '2024-03-05', -300, 'electronic', '17:00'],
   [True, '2024-03-05T23:30:00']),
  ('east zone after midnight',
   ['2024-03-05T22:30:00Z', '2024-03-05', 120, 'electronic', '17:00'],
   [False, '2024-03-06T00:30:00']),
  ('explicit offset stamp',
   ['2024-03-05T23:30:00-05:00', '2024-03-05', 0, 'electronic', '17:00'],
   [False, '2024-03-06T04:30:00']),
  ('last second electronic',
   ['2024-03-05T23:59:30Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T23:59:30']),
  ('deadline day morning',
   ['2024-03-05T09:00:00Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T09:00:00']),
  ('paper after close',
   ['2024-03-05T17:30:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [False, '2024-03-05T17:30:00']),
  ('paper exactly at close',
   ['2024-03-05T22:00:00Z', '2024-03-05', -300, 'paper', '17:00'],
   [False, '2024-03-05T17:00:00'])],
 [('explicit offset stamp',
   ['2024-03-05T23:30:00-05:00', '2024-03-05', 0, 'electronic', '17:00'],
   [False, '2024-03-06T04:30:00']),
  ('last second electronic',
   ['2024-03-05T23:59:30Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T23:59:30']),
  ('deadline day morning',
   ['2024-03-05T09:00:00Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T09:00:00']),
  ('paper after close',
   ['2024-03-05T17:30:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [False, '2024-03-05T17:30:00']),
  ('paper exactly at close',
   ['2024-03-05T22:00:00Z', '2024-03-05', -300, 'paper', '17:00'],
   [False, '2024-03-05T17:00:00']),
  ('paper before close offset',
   ['2024-03-05T14:00:00+02:00', '2024-03-05', 60, 'paper', '16:30'],
   [True, '2024-03-05T13:00:00']),
  ('paper previous day evening',
   ['2024-03-04T21:00:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [True, '2024-03-04T21:00:00'])],
 [('deadline day morning',
   ['2024-03-05T09:00:00Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T09:00:00']),
  ('paper after close',
   ['2024-03-05T17:30:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [False, '2024-03-05T17:30:00']),
  ('paper exactly at close',
   ['2024-03-05T22:00:00Z', '2024-03-05', -300, 'paper', '17:00'],
   [False, '2024-03-05T17:00:00']),
  ('paper before close offset',
   ['2024-03-05T14:00:00+02:00', '2024-03-05', 60, 'paper', '16:30'],
   [True, '2024-03-05T13:00:00']),
  ('paper previous day evening',
   ['2024-03-04T21:00:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [True, '2024-03-04T21:00:00']),
  ('electronic next day',
   ['2024-03-06T00:00:01Z', '2024-03-05', 0, 'electronic', '17:00'],
   [False, '2024-03-06T00:00:01']),
  ('offset stamp plus zone',
   ['2024-03-06T01:15:00+01:00', '2024-03-05', -60, 'electronic', '17:00'],
   [True, '2024-03-05T23:15:00'])],
 [('paper exactly at close',
   ['2024-03-05T22:00:00Z', '2024-03-05', -300, 'paper', '17:00'],
   [False, '2024-03-05T17:00:00']),
  ('paper before close offset',
   ['2024-03-05T14:00:00+02:00', '2024-03-05', 60, 'paper', '16:30'],
   [True, '2024-03-05T13:00:00']),
  ('paper previous day evening',
   ['2024-03-04T21:00:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [True, '2024-03-04T21:00:00']),
  ('electronic next day',
   ['2024-03-06T00:00:01Z', '2024-03-05', 0, 'electronic', '17:00'],
   [False, '2024-03-06T00:00:01']),
  ('offset stamp plus zone',
   ['2024-03-06T01:15:00+01:00', '2024-03-05', -60, 'electronic', '17:00'],
   [True, '2024-03-05T23:15:00']),
  ('regression: west zone late evening',
   ['2024-03-06T04:30:00Z', '2024-03-05', -300, 'electronic', '17:00'],
   [True, '2024-03-05T23:30:00']),
  ('east zone after midnight',
   ['2024-03-05T22:30:00Z', '2024-03-05', 120, 'electronic', '17:00'],
   [False, '2024-03-06T00:30:00'])],
 [('paper previous day evening',
   ['2024-03-04T21:00:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [True, '2024-03-04T21:00:00']),
  ('electronic next day',
   ['2024-03-06T00:00:01Z', '2024-03-05', 0, 'electronic', '17:00'],
   [False, '2024-03-06T00:00:01']),
  ('offset stamp plus zone',
   ['2024-03-06T01:15:00+01:00', '2024-03-05', -60, 'electronic', '17:00'],
   [True, '2024-03-05T23:15:00']),
  ('regression: west zone late evening',
   ['2024-03-06T04:30:00Z', '2024-03-05', -300, 'electronic', '17:00'],
   [True, '2024-03-05T23:30:00']),
  ('east zone after midnight',
   ['2024-03-05T22:30:00Z', '2024-03-05', 120, 'electronic', '17:00'],
   [False, '2024-03-06T00:30:00']),
  ('explicit offset stamp',
   ['2024-03-05T23:30:00-05:00', '2024-03-05', 0, 'electronic', '17:00'],
   [False, '2024-03-06T04:30:00']),
  ('last second electronic',
   ['2024-03-05T23:59:30Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T23:59:30'])]]
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 filing at 23:30 local in a zone west of UTC is judged late on the following day.

The filing timestamp is ISO 8601 with Z or an explicit UTC offset. The court is at offset_min minutes east of UTC (local = UTC + offset). Electronic filing is timely through local midnight ending the deadline day (any time on the deadline date). Paper filing on the deadline day is timely only strictly before the clerk office closing time. Earlier dates are timely. Return [timely, local time ISO to the second].

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(filed, deadline, offset_min, method, office_close):
    u = dt.datetime.fromisoformat(filed.replace('Z', '+00:00')).astimezone(dt.timezone.utc).replace(tzinfo=None)
    local = u + dt.timedelta(minutes=offset_min)
    dl = dt.date.fromisoformat(deadline)
    if method == 'electronic':
        timely = local.date() < dl
    else:
        close = dt.time.fromisoformat(office_close)
        timely = local.date() < dl or (local.date() == dl and local.time() < close)
    return [timely, local.isoformat(timespec='seconds')]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: west zone late evening',
   ['2024-03-06T04:30:00Z', '2024-03-05', -300, 'electronic', '17:00'],
   [True, '2024-03-05T23:30:00']),
  ('east zone after midnight',
   ['2024-03-05T22:30:00Z', '2024-03-05', 120, 'electronic', '17:00'],
   [False, '2024-03-06T00:30:00']),
  ('explicit offset stamp',
   ['2024-03-05T23:30:00-05:00', '2024-03-05', 0, 'electronic', '17:00'],
   [False, '2024-03-06T04:30:00']),
  ('last second electronic',
   ['2024-03-05T23:59:30Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T23:59:30']),
  ('deadline day morning',
   ['2024-03-05T09:00:00Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T09:00:00']),
  ('paper after close',
   ['2024-03-05T17:30:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [False, '2024-03-05T17:30:00']),
  ('paper exactly at close',
   ['2024-03-05T22:00:00Z', '2024-03-05', -300, 'paper', '17:00'],
   [False, '2024-03-05T17:00:00'])],
 [('explicit offset stamp',
   ['2024-03-05T23:30:00-05:00', '2024-03-05', 0, 'electronic', '17:00'],
   [False, '2024-03-06T04:30:00']),
  ('last second electronic',
   ['2024-03-05T23:59:30Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T23:59:30']),
  ('deadline day morning',
   ['2024-03-05T09:00:00Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T09:00:00']),
  ('paper after close',
   ['2024-03-05T17:30:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [False, '2024-03-05T17:30:00']),
  ('paper exactly at close',
   ['2024-03-05T22:00:00Z', '2024-03-05', -300, 'paper', '17:00'],
   [False, '2024-03-05T17:00:00']),
  ('paper before close offset',
   ['2024-03-05T14:00:00+02:00', '2024-03-05', 60, 'paper', '16:30'],
   [True, '2024-03-05T13:00:00']),
  ('paper previous day evening',
   ['2024-03-04T21:00:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [True, '2024-03-04T21:00:00'])],
 [('deadline day morning',
   ['2024-03-05T09:00:00Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T09:00:00']),
  ('paper after close',
   ['2024-03-05T17:30:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [False, '2024-03-05T17:30:00']),
  ('paper exactly at close',
   ['2024-03-05T22:00:00Z', '2024-03-05', -300, 'paper', '17:00'],
   [False, '2024-03-05T17:00:00']),
  ('paper before close offset',
   ['2024-03-05T14:00:00+02:00', '2024-03-05', 60, 'paper', '16:30'],
   [True, '2024-03-05T13:00:00']),
  ('paper previous day evening',
   ['2024-03-04T21:00:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [True, '2024-03-04T21:00:00']),
  ('electronic next day',
   ['2024-03-06T00:00:01Z', '2024-03-05', 0, 'electronic', '17:00'],
   [False, '2024-03-06T00:00:01']),
  ('offset stamp plus zone',
   ['2024-03-06T01:15:00+01:00', '2024-03-05', -60, 'electronic', '17:00'],
   [True, '2024-03-05T23:15:00']),
  ('last second electronic',
   ['2024-03-05T23:59:30Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T23:59:30'])],
 [('paper exactly at close',
   ['2024-03-05T22:00:00Z', '2024-03-05', -300, 'paper', '17:00'],
   [False, '2024-03-05T17:00:00']),
  ('paper before close offset',
   ['2024-03-05T14:00:00+02:00', '2024-03-05', 60, 'paper', '16:30'],
   [True, '2024-03-05T13:00:00']),
  ('paper previous day evening',
   ['2024-03-04T21:00:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [True, '2024-03-04T21:00:00']),
  ('electronic next day',
   ['2024-03-06T00:00:01Z', '2024-03-05', 0, 'electronic', '17:00'],
   [False, '2024-03-06T00:00:01']),
  ('offset stamp plus zone',
   ['2024-03-06T01:15:00+01:00', '2024-03-05', -60, 'electronic', '17:00'],
   [True, '2024-03-05T23:15:00']),
  ('regression: west zone late evening',
   ['2024-03-06T04:30:00Z', '2024-03-05', -300, 'electronic', '17:00'],
   [True, '2024-03-05T23:30:00']),
  ('east zone after midnight',
   ['2024-03-05T22:30:00Z', '2024-03-05', 120, 'electronic', '17:00'],
   [False, '2024-03-06T00:30:00']),
  ('last second electronic',
   ['2024-03-05T23:59:30Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T23:59:30'])],
 [('paper previous day evening',
   ['2024-03-04T21:00:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [True, '2024-03-04T21:00:00']),
  ('electronic next day',
   ['2024-03-06T00:00:01Z', '2024-03-05', 0, 'electronic', '17:00'],
   [False, '2024-03-06T00:00:01']),
  ('offset stamp plus zone',
   ['2024-03-06T01:15:00+01:00', '2024-03-05', -60, 'electronic', '17:00'],
   [True, '2024-03-05T23:15:00']),
  ('regression: west zone late evening',
   ['2024-03-06T04:30:00Z', '2024-03-05', -300, 'electronic', '17:00'],
   [True, '2024-03-05T23:30:00']),
  ('east zone after midnight',
   ['2024-03-05T22:30:00Z', '2024-03-05', 120, 'electronic', '17:00'],
   [False, '2024-03-06T00:30:00']),
  ('explicit offset stamp',
   ['2024-03-05T23:30:00-05:00', '2024-03-05', 0, 'electronic', '17:00'],
   [False, '2024-03-06T04:30:00']),
  ('last second electronic',
   ['2024-03-05T23:59:30Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T23:59:30'])]]
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(filed, deadline, offset_min, method, office_close):
    u = dt.datetime.fromisoformat(filed.replace('Z', '+00:00')).astimezone(dt.timezone.utc).replace(tzinfo=None)
    local = u + dt.timedelta(minutes=offset_min)
    dl = dt.date.fromisoformat(deadline)
    if method == 'electronic':
        timely = local <= dt.datetime.combine(dl, dt.time(23, 59))
    else:
        close = dt.time.fromisoformat(office_close)
        timely = local.date() < dl or (local.date() == dl and local.time() < close)
    return [timely, local.isoformat(timespec='seconds')]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: west zone late evening',
   ['2024-03-06T04:30:00Z', '2024-03-05', -300, 'electronic', '17:00'],
   [True, '2024-03-05T23:30:00']),
  ('east zone after midnight',
   ['2024-03-05T22:30:00Z', '2024-03-05', 120, 'electronic', '17:00'],
   [False, '2024-03-06T00:30:00']),
  ('explicit offset stamp',
   ['2024-03-05T23:30:00-05:00', '2024-03-05', 0, 'electronic', '17:00'],
   [False, '2024-03-06T04:30:00']),
  ('last second electronic',
   ['2024-03-05T23:59:30Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T23:59:30']),
  ('deadline day morning',
   ['2024-03-05T09:00:00Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T09:00:00']),
  ('paper after close',
   ['2024-03-05T17:30:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [False, '2024-03-05T17:30:00']),
  ('paper exactly at close',
   ['2024-03-05T22:00:00Z', '2024-03-05', -300, 'paper', '17:00'],
   [False, '2024-03-05T17:00:00'])],
 [('explicit offset stamp',
   ['2024-03-05T23:30:00-05:00', '2024-03-05', 0, 'electronic', '17:00'],
   [False, '2024-03-06T04:30:00']),
  ('last second electronic',
   ['2024-03-05T23:59:30Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T23:59:30']),
  ('deadline day morning',
   ['2024-03-05T09:00:00Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T09:00:00']),
  ('paper after close',
   ['2024-03-05T17:30:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [False, '2024-03-05T17:30:00']),
  ('paper exactly at close',
   ['2024-03-05T22:00:00Z', '2024-03-05', -300, 'paper', '17:00'],
   [False, '2024-03-05T17:00:00']),
  ('paper before close offset',
   ['2024-03-05T14:00:00+02:00', '2024-03-05', 60, 'paper', '16:30'],
   [True, '2024-03-05T13:00:00']),
  ('paper previous day evening',
   ['2024-03-04T21:00:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [True, '2024-03-04T21:00:00'])],
 [('deadline day morning',
   ['2024-03-05T09:00:00Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T09:00:00']),
  ('paper after close',
   ['2024-03-05T17:30:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [False, '2024-03-05T17:30:00']),
  ('paper exactly at close',
   ['2024-03-05T22:00:00Z', '2024-03-05', -300, 'paper', '17:00'],
   [False, '2024-03-05T17:00:00']),
  ('paper before close offset',
   ['2024-03-05T14:00:00+02:00', '2024-03-05', 60, 'paper', '16:30'],
   [True, '2024-03-05T13:00:00']),
  ('paper previous day evening',
   ['2024-03-04T21:00:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [True, '2024-03-04T21:00:00']),
  ('electronic next day',
   ['2024-03-06T00:00:01Z', '2024-03-05', 0, 'electronic', '17:00'],
   [False, '2024-03-06T00:00:01']),
  ('offset stamp plus zone',
   ['2024-03-06T01:15:00+01:00', '2024-03-05', -60, 'electronic', '17:00'],
   [True, '2024-03-05T23:15:00']),
  ('last second electronic',
   ['2024-03-05T23:59:30Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T23:59:30'])],
 [('paper exactly at close',
   ['2024-03-05T22:00:00Z', '2024-03-05', -300, 'paper', '17:00'],
   [False, '2024-03-05T17:00:00']),
  ('paper before close offset',
   ['2024-03-05T14:00:00+02:00', '2024-03-05', 60, 'paper', '16:30'],
   [True, '2024-03-05T13:00:00']),
  ('paper previous day evening',
   ['2024-03-04T21:00:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [True, '2024-03-04T21:00:00']),
  ('electronic next day',
   ['2024-03-06T00:00:01Z', '2024-03-05', 0, 'electronic', '17:00'],
   [False, '2024-03-06T00:00:01']),
  ('offset stamp plus zone',
   ['2024-03-06T01:15:00+01:00', '2024-03-05', -60, 'electronic', '17:00'],
   [True, '2024-03-05T23:15:00']),
  ('regression: west zone late evening',
   ['2024-03-06T04:30:00Z', '2024-03-05', -300, 'electronic', '17:00'],
   [True, '2024-03-05T23:30:00']),
  ('east zone after midnight',
   ['2024-03-05T22:30:00Z', '2024-03-05', 120, 'electronic', '17:00'],
   [False, '2024-03-06T00:30:00']),
  ('last second electronic',
   ['2024-03-05T23:59:30Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T23:59:30'])],
 [('paper previous day evening',
   ['2024-03-04T21:00:00Z', '2024-03-05', 0, 'paper', '17:00'],
   [True, '2024-03-04T21:00:00']),
  ('electronic next day',
   ['2024-03-06T00:00:01Z', '2024-03-05', 0, 'electronic', '17:00'],
   [False, '2024-03-06T00:00:01']),
  ('offset stamp plus zone',
   ['2024-03-06T01:15:00+01:00', '2024-03-05', -60, 'electronic', '17:00'],
   [True, '2024-03-05T23:15:00']),
  ('regression: west zone late evening',
   ['2024-03-06T04:30:00Z', '2024-03-05', -300, 'electronic', '17:00'],
   [True, '2024-03-05T23:30:00']),
  ('east zone after midnight',
   ['2024-03-05T22:30:00Z', '2024-03-05', 120, 'electronic', '17:00'],
   [False, '2024-03-06T00:30:00']),
  ('explicit offset stamp',
   ['2024-03-05T23:30:00-05:00', '2024-03-05', 0, 'electronic', '17:00'],
   [False, '2024-03-06T04:30:00']),
  ('last second electronic',
   ['2024-03-05T23:59:30Z', '2024-03-05', 0, 'electronic', '17:00'],
   [True, '2024-03-05T23:59:30'])]]
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:
An electronic filing made on the deadline day is marked late.

The filing timestamp is ISO 8601 with Z or an explicit UTC offset. The court is at offset_min minutes east of UTC (local = UTC + offset). Electronic filing is timely through local midnight ending the deadline day (any time on the deadline date). Paper filing on the deadline day is timely only strictly before the clerk office closing time. Earlier dates are timely. Return [timely, local time ISO to the second].

split: open-access