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

N = 1
observations = []
def solve(base, corrections, deadline, weights):
    stats = dict(base)
    applied = 0
    for ts, seq, stat, value in sorted(corrections, key=lambda c: (c[0], c[1])):
        if ts // 86400 > deadline:
            continue
        stats[stat] = stats.get(stat, 0) + value
        applied += 1
    pts = sum(weights[s] * stats.get(s, 0) for s in sorted(weights))
    return {'stats': stats, 'points': pts, 'applied': applied}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: absolute replacement',
   [{'rec': 3, 'rush_yds': 26, 'td': 2},
    [[259200, 1, 'rush_yds', 42], [431999, 3, 'rec', 103], [345600, 1, 'td', 92],
     [259200, 2, 'rush_yds', 116]],
    4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 6151, 'stats': {'rec': 103, 'rush_yds': 116, 'td': 92}}),
  ('partial repair probe: absolute replacement',
   [{'rec': 7, 'rush_yds': 95, 'td': 1}, [[431999, 0, 'rush_yds', 26], [259201, 0, 'td', 88]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 5341, 'stats': {'rec': 7, 'rush_yds': 26, 'td': 88}}),
  ('second regression',
   [{'rec': 1, 'rush_yds': 77, 'td': 0},
    [[349200, 0, 'td', 20], [349200, 1, 'td', 119], [292017, 2, 'rush_yds', 68],
     [430353, 1, 'rush_yds', 118]],
    4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 7263, 'stats': {'rec': 1, 'rush_yds': 118, 'td': 119}}),
  ('normal control 1',
   [{'rec': 2, 'rush_yds': 13}, [[435600, 0, 'td', 25]], 5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 1523, 'stats': {'rec': 2, 'rush_yds': 13, 'td': 25}}),
  ('normal control 2',
   [{'rec': 1, 'rush_yds': 15, 'td': 1}, [[518401, 2, 'rec', 93]], 5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 0, 'points': 80, 'stats': {'rec': 1, 'rush_yds': 15, 'td': 1}}),
  ('normal control 3',
   [{'rec': 4, 'rush_yds': 97, 'td': 1}, [[345600, 1, 'rush_yds', 75]], 3,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 0, 'points': 177, 'stats': {'rec': 4, 'rush_yds': 97, 'td': 1}}),
  ('normal control 4',
   [{'rec': 8, 'rush_yds': 38, 'td': 2}, [[349200, 0, 'rec', 36]], 3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 0, 'points': 198, 'stats': {'rec': 8, 'rush_yds': 38, 'td': 2}})],
 [('regression: absolute replacement',
   [{'rec': 2, 'rush_yds': 117, 'td': 2},
    [[176400, 2, 'rec', 41], [345600, 1, 'td', 117], [262800, 3, 'td', 21], [279149, 3, 'rec', 16],
     [178188, 2, 'rush_yds', 50]],
    3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 1390, 'stats': {'rec': 16, 'rush_yds': 50, 'td': 21}}),
  ('partial repair probe: absolute replacement',
   [{'rec': 7, 'rush_yds': 71, 'td': 1}, [[349200, 0, 'rush_yds', 6], [345601, 1, 'rush_yds', 90]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 101, 'stats': {'rec': 7, 'rush_yds': 6, 'td': 1}}),
  ('second regression',
   [{'rec': 8, 'rush_yds': 28}, [[172800, 2, 'rec', 86], [414873, 0, 'td', 101], [262800, 1, 'td', 77]], 3,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 5078, 'stats': {'rec': 86, 'rush_yds': 28, 'td': 77}}),
  ('normal control 1',
   [{'rec': 2, 'rush_yds': 30}, [[435600, 3, 'rec', 33]], 4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 0, 'points': 40, 'stats': {'rec': 2, 'rush_yds': 30}}),
  ('normal control 2',
   [{'rec': 8, 'rush_yds': 52, 'td': 1}, [[345601, 1, 'rec', 115]], 3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 0, 'points': 152, 'stats': {'rec': 8, 'rush_yds': 52, 'td': 1}}),
  ('normal control 3',
   [{'rec': 6, 'rush_yds': 74, 'td': 0}, [[259201, 3, 'td', 14]], 4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 944, 'stats': {'rec': 6, 'rush_yds': 74, 'td': 14}}),
  ('normal control 4',
   [{'rec': 1, 'rush_yds': 10, 'td': 0}, [[362957, 0, 'td', 83]], 5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 4995, 'stats': {'rec': 1, 'rush_yds': 10, 'td': 83}})],
 [('regression: absolute replacement',
   [{'rec': 3, 'rush_yds': 117},
    [[259200, 3, 'rush_yds', 5], [349200, 3, 'rush_yds', 6], [259201, 0, 'rush_yds', 91],
     [345599, 2, 'td', 29]],
    4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 1761, 'stats': {'rec': 3, 'rush_yds': 6, 'td': 29}}),
  ('partial repair probe: absolute replacement',
   [{'rec': 7, 'rush_yds': 12},
    [[345599, 3, 'rush_yds', 79], [431999, 2, 'rush_yds', 46], [345601, 3, 'rush_yds', 46],
     [259200, 3, 'rush_yds', 118]],
    3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 114, 'stats': {'rec': 7, 'rush_yds': 79}}),
  ('second regression',
   [{'rec': 1, 'rush_yds': 31}, [[345600, 1, 'rec', 60], [518399, 3, 'rush_yds', 72]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 331, 'stats': {'rec': 60, 'rush_yds': 31}}),
  ('normal control 1',
   [{'rec': 5, 'rush_yds': 62}, [[491838, 1, 'td', 115]], 5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 6987, 'stats': {'rec': 5, 'rush_yds': 62, 'td': 115}}),
  ('normal control 2',
   [{'rec': 0, 'rush_yds': 94}, [[345601, 0, 'td', 12], [432001, 1, 'rec', 93]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 1279, 'stats': {'rec': 93, 'rush_yds': 94, 'td': 12}}),
  ('normal control 3',
   [{'rec': 0, 'rush_yds': 77}, [[435600, 2, 'rush_yds', 2]], 4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 0, 'points': 77, 'stats': {'rec': 0, 'rush_yds': 77}}),
  ('normal control 4',
   [{'rec': 0, 'rush_yds': 31, 'td': 0}, [[282221, 3, 'td', 41]], 4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 2491, 'stats': {'rec': 0, 'rush_yds': 31, 'td': 41}})],
 [('regression: absolute replacement',
   [{'rec': 6, 'rush_yds': 36},
    [[349200, 2, 'rush_yds', 49], [518401, 0, 'rush_yds', 104], [432001, 1, 'td', 96]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 5839, 'stats': {'rec': 6, 'rush_yds': 49, 'td': 96}}),
  ('partial repair probe: absolute replacement',
   [{'rec': 8, 'rush_yds': 44},
    [[262800, 2, 'rec', 80], [259200, 3, 'rush_yds', 92], [345599, 2, 'rush_yds', 13],
     [259199, 2, 'rec', 114]],
    3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 413, 'stats': {'rec': 80, 'rush_yds': 13}}),
  ('second regression',
   [{'rec': 4, 'rush_yds': 66},
    [[389729, 1, 'rec', 92], [345600, 2, 'rush_yds', 101], [432000, 0, 'rec', 55]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 561, 'stats': {'rec': 92, 'rush_yds': 101}}),
  ('normal control 1',
   [{'rec': 3, 'rush_yds': 70, 'td': 0},
    [[502436, 1, 'rush_yds', 109], [449161, 0, 'td', 20], [518399, 2, 'rec', 27]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 0, 'points': 85, 'stats': {'rec': 3, 'rush_yds': 70, 'td': 0}}),
  ('normal control 2',
   [{'rec': 8, 'rush_yds': 28, 'td': 2}, [[518400, 1, 'rec', 3]], 5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 0, 'points': 188, 'stats': {'rec': 8, 'rush_yds': 28, 'td': 2}}),
  ('normal control 3',
   [{'rec': 0, 'rush_yds': 26},
    [[345601, 1, 'td', 101], [432000, 3, 'rush_yds', 57], [518399, 2, 'rec', 114]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 6086, 'stats': {'rec': 0, 'rush_yds': 26, 'td': 101}}),
  ('normal control 4',
   [{'rec': 6, 'rush_yds': 110, 'td': 2}, [[363142, 2, 'rush_yds', 69]], 3,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 0, 'points': 260, 'stats': {'rec': 6, 'rush_yds': 110, 'td': 2}})],
 [('regression: absolute replacement',
   [{'rec': 6, 'rush_yds': 52, 'td': 0},
    [[259200, 0, 'rush_yds', 15], [435600, 2, 'td', 74], [345601, 2, 'rush_yds', 10],
     [345600, 0, 'rush_yds', 82]],
    4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 3, 'points': 40, 'stats': {'rec': 6, 'rush_yds': 10, 'td': 0}}),
  ('partial repair probe: absolute replacement',
   [{'rec': 6, 'rush_yds': 73, 'td': 2}, [[423408, 3, 'td', 73], [432000, 2, 'td', 49]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 3043, 'stats': {'rec': 6, 'rush_yds': 73, 'td': 49}}),
  ('second regression',
   [{'rec': 3, 'rush_yds': 10}, [[435600, 1, 'td', 58], [345601, 0, 'rec', 84]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 3910, 'stats': {'rec': 84, 'rush_yds': 10, 'td': 58}}),
  ('normal control 1',
   [{'rec': 2, 'rush_yds': 71}, [[345601, 0, 'td', 119]], 4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 7221, 'stats': {'rec': 2, 'rush_yds': 71, 'td': 119}}),
  ('normal control 2',
   [{'rec': 8, 'rush_yds': 50}, [[349200, 2, 'td', 117]], 5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 7110, 'stats': {'rec': 8, 'rush_yds': 50, 'td': 117}}),
  ('normal control 3',
   [{'rec': 3, 'rush_yds': 23}, [[518401, 1, 'rec', 35]], 5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 0, 'points': 38, 'stats': {'rec': 3, 'rush_yds': 23}}),
  ('normal control 4',
   [{'rec': 0, 'rush_yds': 86}, [[259201, 1, 'rec', 5], [259199, 3, 'td', 17]], 3,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 1131, 'stats': {'rec': 5, 'rush_yds': 86, 'td': 17}})]]
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(base, corrections, deadline, weights):
    stats = dict(base)
    applied = 0
    for ts, seq, stat, value in sorted(corrections, key=lambda c: (c[0], c[1])):
        if ts // 86400 > deadline:
            continue
        stats[stat] = max(stats.get(stat, 0), value)
        applied += 1
    pts = sum(weights[s] * stats.get(s, 0) for s in sorted(weights))
    return {'stats': stats, 'points': pts, 'applied': applied}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: absolute replacement',
   [{'rec': 3, 'rush_yds': 26, 'td': 2},
    [[259200, 1, 'rush_yds', 42], [431999, 3, 'rec', 103], [345600, 1, 'td', 92],
     [259200, 2, 'rush_yds', 116]],
    4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 6151, 'stats': {'rec': 103, 'rush_yds': 116, 'td': 92}}),
  ('partial repair probe: absolute replacement',
   [{'rec': 7, 'rush_yds': 95, 'td': 1}, [[431999, 0, 'rush_yds', 26], [259201, 0, 'td', 88]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 5341, 'stats': {'rec': 7, 'rush_yds': 26, 'td': 88}}),
  ('second regression',
   [{'rec': 1, 'rush_yds': 77, 'td': 0},
    [[349200, 0, 'td', 20], [349200, 1, 'td', 119], [292017, 2, 'rush_yds', 68],
     [430353, 1, 'rush_yds', 118]],
    4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 7263, 'stats': {'rec': 1, 'rush_yds': 118, 'td': 119}}),
  ('normal control 1',
   [{'rec': 2, 'rush_yds': 13}, [[435600, 0, 'td', 25]], 5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 1523, 'stats': {'rec': 2, 'rush_yds': 13, 'td': 25}}),
  ('normal control 2',
   [{'rec': 1, 'rush_yds': 15, 'td': 1}, [[518401, 2, 'rec', 93]], 5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 0, 'points': 80, 'stats': {'rec': 1, 'rush_yds': 15, 'td': 1}}),
  ('normal control 3',
   [{'rec': 4, 'rush_yds': 97, 'td': 1}, [[345600, 1, 'rush_yds', 75]], 3,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 0, 'points': 177, 'stats': {'rec': 4, 'rush_yds': 97, 'td': 1}}),
  ('normal control 4',
   [{'rec': 8, 'rush_yds': 38, 'td': 2}, [[349200, 0, 'rec', 36]], 3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 0, 'points': 198, 'stats': {'rec': 8, 'rush_yds': 38, 'td': 2}})],
 [('regression: absolute replacement',
   [{'rec': 2, 'rush_yds': 117, 'td': 2},
    [[176400, 2, 'rec', 41], [345600, 1, 'td', 117], [262800, 3, 'td', 21], [279149, 3, 'rec', 16],
     [178188, 2, 'rush_yds', 50]],
    3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 1390, 'stats': {'rec': 16, 'rush_yds': 50, 'td': 21}}),
  ('partial repair probe: absolute replacement',
   [{'rec': 7, 'rush_yds': 71, 'td': 1}, [[349200, 0, 'rush_yds', 6], [345601, 1, 'rush_yds', 90]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 101, 'stats': {'rec': 7, 'rush_yds': 6, 'td': 1}}),
  ('second regression',
   [{'rec': 8, 'rush_yds': 28}, [[172800, 2, 'rec', 86], [414873, 0, 'td', 101], [262800, 1, 'td', 77]], 3,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 5078, 'stats': {'rec': 86, 'rush_yds': 28, 'td': 77}}),
  ('normal control 1',
   [{'rec': 2, 'rush_yds': 30}, [[435600, 3, 'rec', 33]], 4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 0, 'points': 40, 'stats': {'rec': 2, 'rush_yds': 30}}),
  ('normal control 2',
   [{'rec': 8, 'rush_yds': 52, 'td': 1}, [[345601, 1, 'rec', 115]], 3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 0, 'points': 152, 'stats': {'rec': 8, 'rush_yds': 52, 'td': 1}}),
  ('normal control 3',
   [{'rec': 6, 'rush_yds': 74, 'td': 0}, [[259201, 3, 'td', 14]], 4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 944, 'stats': {'rec': 6, 'rush_yds': 74, 'td': 14}}),
  ('normal control 4',
   [{'rec': 1, 'rush_yds': 10, 'td': 0}, [[362957, 0, 'td', 83]], 5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 4995, 'stats': {'rec': 1, 'rush_yds': 10, 'td': 83}})],
 [('regression: absolute replacement',
   [{'rec': 3, 'rush_yds': 117},
    [[259200, 3, 'rush_yds', 5], [349200, 3, 'rush_yds', 6], [259201, 0, 'rush_yds', 91],
     [345599, 2, 'td', 29]],
    4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 1761, 'stats': {'rec': 3, 'rush_yds': 6, 'td': 29}}),
  ('partial repair probe: absolute replacement',
   [{'rec': 7, 'rush_yds': 12},
    [[345599, 3, 'rush_yds', 79], [431999, 2, 'rush_yds', 46], [345601, 3, 'rush_yds', 46],
     [259200, 3, 'rush_yds', 118]],
    3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 114, 'stats': {'rec': 7, 'rush_yds': 79}}),
  ('second regression',
   [{'rec': 1, 'rush_yds': 31}, [[345600, 1, 'rec', 60], [518399, 3, 'rush_yds', 72]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 331, 'stats': {'rec': 60, 'rush_yds': 31}}),
  ('normal control 1',
   [{'rec': 5, 'rush_yds': 62}, [[491838, 1, 'td', 115]], 5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 6987, 'stats': {'rec': 5, 'rush_yds': 62, 'td': 115}}),
  ('normal control 2',
   [{'rec': 0, 'rush_yds': 94}, [[345601, 0, 'td', 12], [432001, 1, 'rec', 93]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 1279, 'stats': {'rec': 93, 'rush_yds': 94, 'td': 12}}),
  ('normal control 3',
   [{'rec': 0, 'rush_yds': 77}, [[435600, 2, 'rush_yds', 2]], 4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 0, 'points': 77, 'stats': {'rec': 0, 'rush_yds': 77}}),
  ('normal control 4',
   [{'rec': 0, 'rush_yds': 31, 'td': 0}, [[282221, 3, 'td', 41]], 4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 2491, 'stats': {'rec': 0, 'rush_yds': 31, 'td': 41}})],
 [('regression: absolute replacement',
   [{'rec': 6, 'rush_yds': 36},
    [[349200, 2, 'rush_yds', 49], [518401, 0, 'rush_yds', 104], [432001, 1, 'td', 96]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 5839, 'stats': {'rec': 6, 'rush_yds': 49, 'td': 96}}),
  ('partial repair probe: absolute replacement',
   [{'rec': 8, 'rush_yds': 44},
    [[262800, 2, 'rec', 80], [259200, 3, 'rush_yds', 92], [345599, 2, 'rush_yds', 13],
     [259199, 2, 'rec', 114]],
    3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 413, 'stats': {'rec': 80, 'rush_yds': 13}}),
  ('second regression',
   [{'rec': 4, 'rush_yds': 66},
    [[389729, 1, 'rec', 92], [345600, 2, 'rush_yds', 101], [432000, 0, 'rec', 55]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 561, 'stats': {'rec': 92, 'rush_yds': 101}}),
  ('normal control 1',
   [{'rec': 3, 'rush_yds': 70, 'td': 0},
    [[502436, 1, 'rush_yds', 109], [449161, 0, 'td', 20], [518399, 2, 'rec', 27]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 0, 'points': 85, 'stats': {'rec': 3, 'rush_yds': 70, 'td': 0}}),
  ('normal control 2',
   [{'rec': 8, 'rush_yds': 28, 'td': 2}, [[518400, 1, 'rec', 3]], 5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 0, 'points': 188, 'stats': {'rec': 8, 'rush_yds': 28, 'td': 2}}),
  ('normal control 3',
   [{'rec': 0, 'rush_yds': 26},
    [[345601, 1, 'td', 101], [432000, 3, 'rush_yds', 57], [518399, 2, 'rec', 114]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 6086, 'stats': {'rec': 0, 'rush_yds': 26, 'td': 101}}),
  ('normal control 4',
   [{'rec': 6, 'rush_yds': 110, 'td': 2}, [[363142, 2, 'rush_yds', 69]], 3,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 0, 'points': 260, 'stats': {'rec': 6, 'rush_yds': 110, 'td': 2}})],
 [('regression: absolute replacement',
   [{'rec': 6, 'rush_yds': 52, 'td': 0},
    [[259200, 0, 'rush_yds', 15], [435600, 2, 'td', 74], [345601, 2, 'rush_yds', 10],
     [345600, 0, 'rush_yds', 82]],
    4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 3, 'points': 40, 'stats': {'rec': 6, 'rush_yds': 10, 'td': 0}}),
  ('partial repair probe: absolute replacement',
   [{'rec': 6, 'rush_yds': 73, 'td': 2}, [[423408, 3, 'td', 73], [432000, 2, 'td', 49]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 3043, 'stats': {'rec': 6, 'rush_yds': 73, 'td': 49}}),
  ('second regression',
   [{'rec': 3, 'rush_yds': 10}, [[435600, 1, 'td', 58], [345601, 0, 'rec', 84]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 3910, 'stats': {'rec': 84, 'rush_yds': 10, 'td': 58}}),
  ('normal control 1',
   [{'rec': 2, 'rush_yds': 71}, [[345601, 0, 'td', 119]], 4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 7221, 'stats': {'rec': 2, 'rush_yds': 71, 'td': 119}}),
  ('normal control 2',
   [{'rec': 8, 'rush_yds': 50}, [[349200, 2, 'td', 117]], 5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 7110, 'stats': {'rec': 8, 'rush_yds': 50, 'td': 117}}),
  ('normal control 3',
   [{'rec': 3, 'rush_yds': 23}, [[518401, 1, 'rec', 35]], 5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 0, 'points': 38, 'stats': {'rec': 3, 'rush_yds': 23}}),
  ('normal control 4',
   [{'rec': 0, 'rush_yds': 86}, [[259201, 1, 'rec', 5], [259199, 3, 'td', 17]], 3,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 1131, 'stats': {'rec': 5, 'rush_yds': 86, 'td': 17}})]]
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 correction of rushing yards to 88 turns 85 yards into 173.

Corrections are [timestamp seconds, per-day sequence, stat, corrected absolute value]. Apply corrections whose UTC day (timestamp // 86400) is on or before the deadline day, ordered by timestamp then sequence; each replaces the stat value (a later correction wins, a stat missing from the base line is added). Points are the weighted sum over the weight table using corrected stats. Return stats, points and the count of corrections applied.

split: open-access


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

N = 1
observations = []
def solve(base, corrections, deadline, weights):
    stats = dict(base)
    applied = 0
    for ts, seq, stat, value in sorted(corrections, key=lambda c: (c[0], c[1])):
        if ts > deadline * 86400:
            continue
        stats[stat] = value
        applied += 1
    pts = sum(weights[s] * stats.get(s, 0) for s in sorted(weights))
    return {'stats': stats, 'points': pts, 'applied': applied}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: deadline day cutoff',
   [{'rec': 1, 'rush_yds': 3, 'td': 0},
    [[278745, 1, 'td', 113], [259201, 2, 'td', 47], [345599, 1, 'rush_yds', 12]], 3,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 3, 'points': 6797, 'stats': {'rec': 1, 'rush_yds': 12, 'td': 113}}),
  ('partial repair probe: deadline day cutoff',
   [{'rec': 2, 'rush_yds': 46, 'td': 1},
    [[342520, 0, 'rec', 93], [176400, 2, 'rec', 23], [232305, 3, 'rush_yds', 15], [262800, 3, 'rec', 57],
     [345600, 2, 'rec', 21]],
    3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 540, 'stats': {'rec': 93, 'rush_yds': 15, 'td': 1}}),
  ('second regression',
   [{'rec': 7, 'rush_yds': 99},
    [[518399, 3, 'rush_yds', 76], [345601, 3, 'rec', 24], [345601, 3, 'rec', 85], [384412, 1, 'rec', 5],
     [345601, 1, 'rec', 48]],
    4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 124, 'stats': {'rec': 5, 'rush_yds': 99}}),
  ('normal control 1',
   [{'rec': 6, 'rush_yds': 102, 'td': 2},
    [[373279, 0, 'rush_yds', 0], [349200, 1, 'rec', 60], [431999, 2, 'rush_yds', 74],
     [259200, 0, 'rush_yds', 49], [172800, 1, 'rush_yds', 83]],
    3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 199, 'stats': {'rec': 6, 'rush_yds': 49, 'td': 2}}),
  ('normal control 2',
   [{'rec': 2, 'rush_yds': 116}, [[345600, 2, 'rush_yds', 33]], 5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 43, 'stats': {'rec': 2, 'rush_yds': 33}}),
  ('normal control 3',
   [{'rec': 6, 'rush_yds': 38, 'td': 0}, [[435600, 1, 'td', 20]], 4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 0, 'points': 68, 'stats': {'rec': 6, 'rush_yds': 38, 'td': 0}}),
  ('normal control 4',
   [{'rec': 7, 'rush_yds': 109, 'td': 2}, [[345601, 3, 'rush_yds', 119]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 274, 'stats': {'rec': 7, 'rush_yds': 119, 'td': 2}})],
 [('regression: deadline day cutoff',
   [{'rec': 4, 'rush_yds': 48, 'td': 1},
    [[329900, 0, 'rush_yds', 53], [259199, 2, 'td', 45], [259201, 2, 'td', 35], [345599, 2, 'rush_yds', 54]],
    3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 2174, 'stats': {'rec': 4, 'rush_yds': 54, 'td': 35}}),
  ('partial repair probe: deadline day cutoff',
   [{'rec': 2, 'rush_yds': 58, 'td': 1}, [[518400, 1, 'td', 96]], 5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 0, 'points': 128, 'stats': {'rec': 2, 'rush_yds': 58, 'td': 1}}),
  ('second regression',
   [{'rec': 6, 'rush_yds': 48, 'td': 1},
    [[435600, 2, 'rush_yds', 69], [435600, 1, 'td', 96], [431999, 3, 'rec', 120],
     [435600, 0, 'rush_yds', 26]],
    5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 6429, 'stats': {'rec': 120, 'rush_yds': 69, 'td': 96}}),
  ('normal control 1',
   [{'rec': 1, 'rush_yds': 44, 'td': 1}, [[259201, 3, 'rec', 65], [345599, 1, 'rush_yds', 94]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 479, 'stats': {'rec': 65, 'rush_yds': 94, 'td': 1}}),
  ('normal control 2',
   [{'rec': 5, 'rush_yds': 36, 'td': 2}, [[259200, 1, 'rec', 20]], 4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 256, 'stats': {'rec': 20, 'rush_yds': 36, 'td': 2}}),
  ('normal control 3',
   [{'rec': 5, 'rush_yds': 53}, [[518399, 3, 'td', 91]], 4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 0, 'points': 78, 'stats': {'rec': 5, 'rush_yds': 53}}),
  ('normal control 4',
   [{'rec': 3, 'rush_yds': 99}, [[176400, 0, 'td', 4]], 3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 354, 'stats': {'rec': 3, 'rush_yds': 99, 'td': 4}})],
 [('regression: deadline day cutoff',
   [{'rec': 7, 'rush_yds': 75},
    [[604799, 1, 'rush_yds', 83], [518399, 3, 'td', 105], [432001, 1, 'rush_yds', 53],
     [496594, 0, 'rush_yds', 86]],
    5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 3, 'points': 6421, 'stats': {'rec': 7, 'rush_yds': 86, 'td': 105}}),
  ('partial repair probe: deadline day cutoff',
   [{'rec': 8, 'rush_yds': 67, 'td': 0}, [[518400, 0, 'td', 120], [518400, 2, 'rec', 45]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 0, 'points': 107, 'stats': {'rec': 8, 'rush_yds': 67, 'td': 0}}),
  ('second regression',
   [{'rec': 2, 'rush_yds': 91}, [[259201, 2, 'rec', 13]], 3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 156, 'stats': {'rec': 13, 'rush_yds': 91}}),
  ('normal control 1',
   [{'rec': 0, 'rush_yds': 55}, [[396394, 1, 'rush_yds', 69]], 5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 69, 'stats': {'rec': 0, 'rush_yds': 69}}),
  ('normal control 2',
   [{'rec': 8, 'rush_yds': 105}, [[345600, 1, 'td', 26]], 4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 1705, 'stats': {'rec': 8, 'rush_yds': 105, 'td': 26}}),
  ('normal control 3',
   [{'rec': 0, 'rush_yds': 38}, [[345600, 3, 'rush_yds', 68], [498366, 1, 'td', 65]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 68, 'stats': {'rec': 0, 'rush_yds': 68}}),
  ('normal control 4',
   [{'rec': 3, 'rush_yds': 72}, [[259199, 1, 'rec', 107]], 3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 607, 'stats': {'rec': 107, 'rush_yds': 72}})],
 [('regression: deadline day cutoff',
   [{'rec': 4, 'rush_yds': 21},
    [[432000, 2, 'rec', 27], [432000, 2, 'rush_yds', 115], [518401, 2, 'rec', 37], [435600, 2, 'rec', 44]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 3, 'points': 335, 'stats': {'rec': 44, 'rush_yds': 115}}),
  ('partial repair probe: deadline day cutoff',
   [{'rec': 3, 'rush_yds': 9, 'td': 0},
    [[435600, 1, 'rec', 34], [345601, 1, 'rec', 9], [262800, 3, 'td', 70], [259200, 3, 'rec', 68],
     [432000, 0, 'td', 20]],
    4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 3, 'points': 4254, 'stats': {'rec': 9, 'rush_yds': 9, 'td': 70}}),
  ('second regression',
   [{'rec': 0, 'rush_yds': 23},
    [[252656, 0, 'td', 58], [349200, 2, 'td', 101], [345599, 3, 'rec', 20], [431999, 0, 'rush_yds', 7]], 3,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 3603, 'stats': {'rec': 20, 'rush_yds': 23, 'td': 58}}),
  ('normal control 1',
   [{'rec': 7, 'rush_yds': 42, 'td': 0},
    [[345600, 3, 'rec', 87], [259201, 2, 'rec', 46], [518399, 0, 'rush_yds', 58]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 477, 'stats': {'rec': 87, 'rush_yds': 42, 'td': 0}}),
  ('normal control 2',
   [{'rec': 2, 'rush_yds': 43}, [[345600, 3, 'td', 23], [345600, 0, 'td', 30]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 1433, 'stats': {'rec': 2, 'rush_yds': 43, 'td': 23}}),
  ('normal control 3',
   [{'rec': 7, 'rush_yds': 19},
    [[369799, 2, 'td', 53], [345601, 3, 'rush_yds', 64], [230373, 0, 'rec', 100],
     [259200, 3, 'rush_yds', 113]],
    3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 613, 'stats': {'rec': 100, 'rush_yds': 113}}),
  ('normal control 4',
   [{'rec': 8, 'rush_yds': 36}, [[349200, 1, 'rush_yds', 24]], 3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 0, 'points': 76, 'stats': {'rec': 8, 'rush_yds': 36}})],
 [('regression: deadline day cutoff',
   [{'rec': 7, 'rush_yds': 28},
    [[522000, 1, 'td', 107], [522000, 0, 'rush_yds', 33], [432001, 2, 'rush_yds', 1],
     [345601, 1, 'rec', 109]],
    5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 546, 'stats': {'rec': 109, 'rush_yds': 1}}),
  ('partial repair probe: deadline day cutoff',
   [{'rec': 5, 'rush_yds': 71, 'td': 2},
    [[349200, 1, 'rec', 110], [518401, 0, 'td', 111], [518400, 3, 'td', 51]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 741, 'stats': {'rec': 110, 'rush_yds': 71, 'td': 2}}),
  ('second regression',
   [{'rec': 1, 'rush_yds': 85, 'td': 2},
    [[259201, 3, 'td', 120], [176400, 1, 'rec', 97], [329992, 1, 'rush_yds', 71]], 3,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 3, 'points': 7756, 'stats': {'rec': 97, 'rush_yds': 71, 'td': 120}}),
  ('normal control 1',
   [{'rec': 7, 'rush_yds': 33}, [[495842, 2, 'rec', 72], [259200, 1, 'rec', 5]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 58, 'stats': {'rec': 5, 'rush_yds': 33}}),
  ('normal control 2',
   [{'rec': 1, 'rush_yds': 68}, [[172800, 0, 'td', 16]], 3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 1033, 'stats': {'rec': 1, 'rush_yds': 68, 'td': 16}}),
  ('normal control 3',
   [{'rec': 1, 'rush_yds': 42, 'td': 0}, [[259200, 0, 'rec', 2], [191838, 1, 'rush_yds', 99]], 3,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 109, 'stats': {'rec': 2, 'rush_yds': 99, 'td': 0}}),
  ('normal control 4',
   [{'rec': 3, 'rush_yds': 90}, [[172800, 3, 'rush_yds', 85]], 3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 100, 'stats': {'rec': 3, 'rush_yds': 85}})]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

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

N = 1
observations = []
def solve(base, corrections, deadline, weights):
    stats = dict(base)
    applied = 0
    for ts, seq, stat, value in sorted(corrections, key=lambda c: (c[0], c[1])):
        if ts > (deadline + 1) * 86400:
            continue
        stats[stat] = value
        applied += 1
    pts = sum(weights[s] * stats.get(s, 0) for s in sorted(weights))
    return {'stats': stats, 'points': pts, 'applied': applied}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: deadline day cutoff',
   [{'rec': 1, 'rush_yds': 3, 'td': 0},
    [[278745, 1, 'td', 113], [259201, 2, 'td', 47], [345599, 1, 'rush_yds', 12]], 3,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 3, 'points': 6797, 'stats': {'rec': 1, 'rush_yds': 12, 'td': 113}}),
  ('partial repair probe: deadline day cutoff',
   [{'rec': 2, 'rush_yds': 46, 'td': 1},
    [[342520, 0, 'rec', 93], [176400, 2, 'rec', 23], [232305, 3, 'rush_yds', 15], [262800, 3, 'rec', 57],
     [345600, 2, 'rec', 21]],
    3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 540, 'stats': {'rec': 93, 'rush_yds': 15, 'td': 1}}),
  ('second regression',
   [{'rec': 7, 'rush_yds': 99},
    [[518399, 3, 'rush_yds', 76], [345601, 3, 'rec', 24], [345601, 3, 'rec', 85], [384412, 1, 'rec', 5],
     [345601, 1, 'rec', 48]],
    4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 124, 'stats': {'rec': 5, 'rush_yds': 99}}),
  ('normal control 1',
   [{'rec': 6, 'rush_yds': 102, 'td': 2},
    [[373279, 0, 'rush_yds', 0], [349200, 1, 'rec', 60], [431999, 2, 'rush_yds', 74],
     [259200, 0, 'rush_yds', 49], [172800, 1, 'rush_yds', 83]],
    3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 199, 'stats': {'rec': 6, 'rush_yds': 49, 'td': 2}}),
  ('normal control 2',
   [{'rec': 2, 'rush_yds': 116}, [[345600, 2, 'rush_yds', 33]], 5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 43, 'stats': {'rec': 2, 'rush_yds': 33}}),
  ('normal control 3',
   [{'rec': 6, 'rush_yds': 38, 'td': 0}, [[435600, 1, 'td', 20]], 4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 0, 'points': 68, 'stats': {'rec': 6, 'rush_yds': 38, 'td': 0}}),
  ('normal control 4',
   [{'rec': 7, 'rush_yds': 109, 'td': 2}, [[345601, 3, 'rush_yds', 119]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 274, 'stats': {'rec': 7, 'rush_yds': 119, 'td': 2}})],
 [('regression: deadline day cutoff',
   [{'rec': 4, 'rush_yds': 48, 'td': 1},
    [[329900, 0, 'rush_yds', 53], [259199, 2, 'td', 45], [259201, 2, 'td', 35], [345599, 2, 'rush_yds', 54]],
    3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 2174, 'stats': {'rec': 4, 'rush_yds': 54, 'td': 35}}),
  ('partial repair probe: deadline day cutoff',
   [{'rec': 2, 'rush_yds': 58, 'td': 1}, [[518400, 1, 'td', 96]], 5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 0, 'points': 128, 'stats': {'rec': 2, 'rush_yds': 58, 'td': 1}}),
  ('second regression',
   [{'rec': 6, 'rush_yds': 48, 'td': 1},
    [[435600, 2, 'rush_yds', 69], [435600, 1, 'td', 96], [431999, 3, 'rec', 120],
     [435600, 0, 'rush_yds', 26]],
    5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 6429, 'stats': {'rec': 120, 'rush_yds': 69, 'td': 96}}),
  ('normal control 1',
   [{'rec': 1, 'rush_yds': 44, 'td': 1}, [[259201, 3, 'rec', 65], [345599, 1, 'rush_yds', 94]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 479, 'stats': {'rec': 65, 'rush_yds': 94, 'td': 1}}),
  ('normal control 2',
   [{'rec': 5, 'rush_yds': 36, 'td': 2}, [[259200, 1, 'rec', 20]], 4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 256, 'stats': {'rec': 20, 'rush_yds': 36, 'td': 2}}),
  ('normal control 3',
   [{'rec': 5, 'rush_yds': 53}, [[518399, 3, 'td', 91]], 4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 0, 'points': 78, 'stats': {'rec': 5, 'rush_yds': 53}}),
  ('normal control 4',
   [{'rec': 3, 'rush_yds': 99}, [[176400, 0, 'td', 4]], 3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 354, 'stats': {'rec': 3, 'rush_yds': 99, 'td': 4}})],
 [('regression: deadline day cutoff',
   [{'rec': 7, 'rush_yds': 75},
    [[604799, 1, 'rush_yds', 83], [518399, 3, 'td', 105], [432001, 1, 'rush_yds', 53],
     [496594, 0, 'rush_yds', 86]],
    5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 3, 'points': 6421, 'stats': {'rec': 7, 'rush_yds': 86, 'td': 105}}),
  ('partial repair probe: deadline day cutoff',
   [{'rec': 8, 'rush_yds': 67, 'td': 0}, [[518400, 0, 'td', 120], [518400, 2, 'rec', 45]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 0, 'points': 107, 'stats': {'rec': 8, 'rush_yds': 67, 'td': 0}}),
  ('second regression',
   [{'rec': 2, 'rush_yds': 91}, [[259201, 2, 'rec', 13]], 3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 156, 'stats': {'rec': 13, 'rush_yds': 91}}),
  ('normal control 1',
   [{'rec': 0, 'rush_yds': 55}, [[396394, 1, 'rush_yds', 69]], 5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 69, 'stats': {'rec': 0, 'rush_yds': 69}}),
  ('normal control 2',
   [{'rec': 8, 'rush_yds': 105}, [[345600, 1, 'td', 26]], 4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 1705, 'stats': {'rec': 8, 'rush_yds': 105, 'td': 26}}),
  ('normal control 3',
   [{'rec': 0, 'rush_yds': 38}, [[345600, 3, 'rush_yds', 68], [498366, 1, 'td', 65]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 68, 'stats': {'rec': 0, 'rush_yds': 68}}),
  ('normal control 4',
   [{'rec': 3, 'rush_yds': 72}, [[259199, 1, 'rec', 107]], 3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 607, 'stats': {'rec': 107, 'rush_yds': 72}})],
 [('regression: deadline day cutoff',
   [{'rec': 4, 'rush_yds': 21},
    [[432000, 2, 'rec', 27], [432000, 2, 'rush_yds', 115], [518401, 2, 'rec', 37], [435600, 2, 'rec', 44]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 3, 'points': 335, 'stats': {'rec': 44, 'rush_yds': 115}}),
  ('partial repair probe: deadline day cutoff',
   [{'rec': 3, 'rush_yds': 9, 'td': 0},
    [[435600, 1, 'rec', 34], [345601, 1, 'rec', 9], [262800, 3, 'td', 70], [259200, 3, 'rec', 68],
     [432000, 0, 'td', 20]],
    4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 3, 'points': 4254, 'stats': {'rec': 9, 'rush_yds': 9, 'td': 70}}),
  ('second regression',
   [{'rec': 0, 'rush_yds': 23},
    [[252656, 0, 'td', 58], [349200, 2, 'td', 101], [345599, 3, 'rec', 20], [431999, 0, 'rush_yds', 7]], 3,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 3603, 'stats': {'rec': 20, 'rush_yds': 23, 'td': 58}}),
  ('normal control 1',
   [{'rec': 7, 'rush_yds': 42, 'td': 0},
    [[345600, 3, 'rec', 87], [259201, 2, 'rec', 46], [518399, 0, 'rush_yds', 58]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 477, 'stats': {'rec': 87, 'rush_yds': 42, 'td': 0}}),
  ('normal control 2',
   [{'rec': 2, 'rush_yds': 43}, [[345600, 3, 'td', 23], [345600, 0, 'td', 30]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 1433, 'stats': {'rec': 2, 'rush_yds': 43, 'td': 23}}),
  ('normal control 3',
   [{'rec': 7, 'rush_yds': 19},
    [[369799, 2, 'td', 53], [345601, 3, 'rush_yds', 64], [230373, 0, 'rec', 100],
     [259200, 3, 'rush_yds', 113]],
    3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 613, 'stats': {'rec': 100, 'rush_yds': 113}}),
  ('normal control 4',
   [{'rec': 8, 'rush_yds': 36}, [[349200, 1, 'rush_yds', 24]], 3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 0, 'points': 76, 'stats': {'rec': 8, 'rush_yds': 36}})],
 [('regression: deadline day cutoff',
   [{'rec': 7, 'rush_yds': 28},
    [[522000, 1, 'td', 107], [522000, 0, 'rush_yds', 33], [432001, 2, 'rush_yds', 1],
     [345601, 1, 'rec', 109]],
    5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 546, 'stats': {'rec': 109, 'rush_yds': 1}}),
  ('partial repair probe: deadline day cutoff',
   [{'rec': 5, 'rush_yds': 71, 'td': 2},
    [[349200, 1, 'rec', 110], [518401, 0, 'td', 111], [518400, 3, 'td', 51]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 741, 'stats': {'rec': 110, 'rush_yds': 71, 'td': 2}}),
  ('second regression',
   [{'rec': 1, 'rush_yds': 85, 'td': 2},
    [[259201, 3, 'td', 120], [176400, 1, 'rec', 97], [329992, 1, 'rush_yds', 71]], 3,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 3, 'points': 7756, 'stats': {'rec': 97, 'rush_yds': 71, 'td': 120}}),
  ('normal control 1',
   [{'rec': 7, 'rush_yds': 33}, [[495842, 2, 'rec', 72], [259200, 1, 'rec', 5]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 58, 'stats': {'rec': 5, 'rush_yds': 33}}),
  ('normal control 2',
   [{'rec': 1, 'rush_yds': 68}, [[172800, 0, 'td', 16]], 3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 1033, 'stats': {'rec': 1, 'rush_yds': 68, 'td': 16}}),
  ('normal control 3',
   [{'rec': 1, 'rush_yds': 42, 'td': 0}, [[259200, 0, 'rec', 2], [191838, 1, 'rush_yds', 99]], 3,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 109, 'stats': {'rec': 2, 'rush_yds': 99, 'td': 0}}),
  ('normal control 4',
   [{'rec': 3, 'rush_yds': 90}, [[172800, 3, 'rush_yds', 85]], 3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 100, 'stats': {'rec': 3, 'rush_yds': 85}})]]
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 correction published at noon on the deadline day is discarded.

Corrections are [timestamp seconds, per-day sequence, stat, corrected absolute value]. Apply corrections whose UTC day (timestamp // 86400) is on or before the deadline day, ordered by timestamp then sequence; each replaces the stat value (a later correction wins, a stat missing from the base line is added). Points are the weighted sum over the weight table using corrected stats. Return stats, points and the count of corrections applied.

split: open-access


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

N = 1
observations = []
def solve(base, corrections, deadline, weights):
    stats = dict(base)
    applied = 0
    for ts, seq, stat, value in sorted(corrections, key=lambda c: c[1]):
        if ts // 86400 > deadline:
            continue
        stats[stat] = value
        applied += 1
    pts = sum(weights[s] * stats.get(s, 0) for s in sorted(weights))
    return {'stats': stats, 'points': pts, 'applied': applied}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: ordering by per-day sequence',
   [{'rec': 1, 'rush_yds': 48},
    [[262800, 0, 'td', 16], [262800, 1, 'td', 104], [262800, 3, 'rush_yds', 17], [345599, 0, 'td', 83],
     [262800, 0, 'rush_yds', 112]],
    3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 5, 'points': 5002, 'stats': {'rec': 1, 'rush_yds': 17, 'td': 83}}),
  ('partial repair probe: ordering by per-day sequence',
   [{'rec': 7, 'rush_yds': 62},
    [[259201, 3, 'rush_yds', 37], [262800, 3, 'rec', 64], [332124, 2, 'rec', 65],
     [345599, 1, 'rush_yds', 91]],
    3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 416, 'stats': {'rec': 65, 'rush_yds': 91}}),
  ('second regression',
   [{'rec': 8, 'rush_yds': 65, 'td': 0},
    [[404733, 0, 'rec', 94], [361680, 3, 'rec', 1], [262800, 1, 'rec', 30]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 3, 'points': 535, 'stats': {'rec': 94, 'rush_yds': 65, 'td': 0}}),
  ('normal control 1',
   [{'rec': 2, 'rush_yds': 61, 'td': 2},
    [[349200, 2, 'rush_yds', 98], [349200, 3, 'rush_yds', 34], [286902, 1, 'rush_yds', 33],
     [345601, 1, 'rec', 85], [353444, 1, 'td', 18]],
    4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 5, 'points': 1539, 'stats': {'rec': 85, 'rush_yds': 34, 'td': 18}}),
  ('normal control 2',
   [{'rec': 1, 'rush_yds': 109, 'td': 0},
    [[176400, 3, 'rec', 59], [345600, 0, 'rush_yds', 47], [172800, 0, 'td', 3], [184833, 3, 'td', 8]], 3,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 3, 'points': 884, 'stats': {'rec': 59, 'rush_yds': 109, 'td': 8}}),
  ('normal control 3',
   [{'rec': 1, 'rush_yds': 113, 'td': 1},
    [[345601, 3, 'rush_yds', 106], [432001, 1, 'rush_yds', 108], [431999, 1, 'td', 18],
     [432000, 0, 'rush_yds', 19], [345599, 2, 'rec', 25]],
    4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 3, 'points': 1311, 'stats': {'rec': 25, 'rush_yds': 106, 'td': 18}}),
  ('normal control 4',
   [{'rec': 0, 'rush_yds': 36, 'td': 0}, [[522000, 3, 'rec', 11]], 5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 0, 'points': 36, 'stats': {'rec': 0, 'rush_yds': 36, 'td': 0}})],
 [('regression: ordering by per-day sequence',
   [{'rec': 8, 'rush_yds': 92, 'td': 2},
    [[259201, 0, 'rush_yds', 93], [259200, 1, 'rush_yds', 71], [259200, 2, 'td', 68], [431999, 1, 'td', 95]],
    4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 5833, 'stats': {'rec': 8, 'rush_yds': 93, 'td': 95}}),
  ('partial repair probe: ordering by per-day sequence',
   [{'rec': 0, 'rush_yds': 12, 'td': 0},
    [[262800, 3, 'rec', 90], [432001, 0, 'rec', 41], [349200, 2, 'rec', 83], [259201, 0, 'rush_yds', 26],
     [337939, 3, 'rush_yds', 72]],
    4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 487, 'stats': {'rec': 83, 'rush_yds': 72, 'td': 0}}),
  ('second regression',
   [{'rec': 4, 'rush_yds': 84, 'td': 2},
    [[267442, 3, 'rec', 80], [518399, 1, 'td', 57], [259201, 3, 'rec', 5], [496069, 2, 'td', 87],
     [481126, 1, 'rec', 92]],
    4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 604, 'stats': {'rec': 80, 'rush_yds': 84, 'td': 2}}),
  ('normal control 1',
   [{'rec': 3, 'rush_yds': 85},
    [[518399, 3, 'td', 22], [312423, 2, 'rec', 67], [389726, 3, 'td', 50], [345599, 0, 'rush_yds', 86]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 3, 'points': 3421, 'stats': {'rec': 67, 'rush_yds': 86, 'td': 50}}),
  ('normal control 2',
   [{'rec': 3, 'rush_yds': 25}, [[345601, 1, 'td', 20], [455741, 3, 'rec', 27]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 1360, 'stats': {'rec': 27, 'rush_yds': 25, 'td': 20}}),
  ('normal control 3',
   [{'rec': 7, 'rush_yds': 66}, [[345600, 2, 'td', 4]], 4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 341, 'stats': {'rec': 7, 'rush_yds': 66, 'td': 4}}),
  ('normal control 4',
   [{'rec': 6, 'rush_yds': 67, 'td': 0}, [[345600, 0, 'td', 14]], 4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 937, 'stats': {'rec': 6, 'rush_yds': 67, 'td': 14}})],
 [('regression: ordering by per-day sequence',
   [{'rec': 5, 'rush_yds': 21, 'td': 0},
    [[345600, 1, 'rush_yds', 23], [435600, 2, 'rush_yds', 25], [431999, 2, 'rush_yds', 82],
     [432001, 2, 'rush_yds', 72]],
    5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 50, 'stats': {'rec': 5, 'rush_yds': 25, 'td': 0}}),
  ('partial repair probe: ordering by per-day sequence',
   [{'rec': 5, 'rush_yds': 23, 'td': 1},
    [[518399, 1, 'td', 50], [421461, 3, 'td', 3], [432001, 0, 'rec', 110], [349200, 0, 'rec', 13]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 3573, 'stats': {'rec': 110, 'rush_yds': 23, 'td': 50}}),
  ('second regression',
   [{'rec': 3, 'rush_yds': 10},
    [[522000, 1, 'rec', 77], [435600, 0, 'rush_yds', 52], [518401, 3, 'rec', 49], [432000, 2, 'rush_yds', 4],
     [604799, 1, 'td', 12]],
    5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 67, 'stats': {'rec': 3, 'rush_yds': 52}}),
  ('normal control 1',
   [{'rec': 4, 'rush_yds': 87},
    [[432000, 2, 'td', 10], [506896, 1, 'rec', 116], [349531, 3, 'rush_yds', 65], [510444, 2, 'td', 15],
     [522000, 1, 'rec', 21]],
    5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 1545, 'stats': {'rec': 116, 'rush_yds': 65, 'td': 15}}),
  ('normal control 2',
   [{'rec': 2, 'rush_yds': 36}, [[455938, 2, 'td', 96], [314193, 0, 'rush_yds', 7]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 17, 'stats': {'rec': 2, 'rush_yds': 7}}),
  ('normal control 3',
   [{'rec': 2, 'rush_yds': 117}, [[380783, 3, 'td', 74], [259200, 1, 'rec', 75]], 3,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 492, 'stats': {'rec': 75, 'rush_yds': 117}}),
  ('normal control 4',
   [{'rec': 1, 'rush_yds': 61, 'td': 0}, [[431999, 1, 'rec', 82]], 4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 471, 'stats': {'rec': 82, 'rush_yds': 61, 'td': 0}})],
 [('regression: ordering by per-day sequence',
   [{'rec': 6, 'rush_yds': 3}, [[259200, 0, 'rec', 114], [345601, 0, 'rec', 31], [172801, 0, 'rec', 63]], 3,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 573, 'stats': {'rec': 114, 'rush_yds': 3}}),
  ('partial repair probe: ordering by per-day sequence',
   [{'rec': 8, 'rush_yds': 51, 'td': 2},
    [[435600, 0, 'rush_yds', 118], [432000, 2, 'rush_yds', 100], [518399, 1, 'td', 96],
     [432001, 2, 'rec', 17], [345601, 3, 'rush_yds', 34]],
    5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 5, 'points': 5963, 'stats': {'rec': 17, 'rush_yds': 118, 'td': 96}}),
  ('second regression',
   [{'rec': 0, 'rush_yds': 41},
    [[604799, 0, 'rec', 1], [447240, 2, 'rush_yds', 9], [432001, 3, 'rush_yds', 32]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 9, 'stats': {'rec': 0, 'rush_yds': 9}}),
  ('normal control 1',
   [{'rec': 6, 'rush_yds': 51}, [[349200, 2, 'rec', 5]], 4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 76, 'stats': {'rec': 5, 'rush_yds': 51}}),
  ('normal control 2',
   [{'rec': 2, 'rush_yds': 30, 'td': 0}, [[345600, 1, 'td', 6]], 4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 400, 'stats': {'rec': 2, 'rush_yds': 30, 'td': 6}}),
  ('normal control 3',
   [{'rec': 8, 'rush_yds': 32},
    [[408772, 1, 'rec', 110], [539866, 3, 'rush_yds', 88], [604799, 2, 'rec', 69]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 582, 'stats': {'rec': 110, 'rush_yds': 32}}),
  ('normal control 4',
   [{'rec': 5, 'rush_yds': 10}, [[229110, 1, 'td', 120], [271187, 1, 'rec', 75], [259201, 1, 'rush_yds', 81]],
    3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 3, 'points': 7656, 'stats': {'rec': 75, 'rush_yds': 81, 'td': 120}})],
 [('regression: ordering by per-day sequence',
   [{'rec': 8, 'rush_yds': 21}, [[432001, 1, 'rec', 83], [432001, 3, 'rec', 13], [518399, 1, 'rec', 106]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 3, 'points': 551, 'stats': {'rec': 106, 'rush_yds': 21}}),
  ('partial repair probe: ordering by per-day sequence',
   [{'rec': 3, 'rush_yds': 32}, [[271219, 2, 'td', 77], [262800, 3, 'td', 74], [308677, 2, 'rush_yds', 2]], 3,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 3, 'points': 4637, 'stats': {'rec': 3, 'rush_yds': 2, 'td': 77}}),
  ('second regression',
   [{'rec': 7, 'rush_yds': 52, 'td': 1},
    [[376011, 0, 'td', 23], [259201, 1, 'td', 85], [349200, 3, 'rush_yds', 42], [433522, 3, 'rush_yds', 48],
     [345601, 2, 'rush_yds', 82]],
    4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 1457, 'stats': {'rec': 7, 'rush_yds': 42, 'td': 23}}),
  ('normal control 1',
   [{'rec': 7, 'rush_yds': 18, 'td': 2}, [[432001, 0, 'rush_yds', 80], [439508, 0, 'rec', 62]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 510, 'stats': {'rec': 62, 'rush_yds': 80, 'td': 2}}),
  ('normal control 2',
   [{'rec': 1, 'rush_yds': 31, 'td': 0},
    [[518399, 3, 'rush_yds', 55], [582426, 3, 'rec', 56], [522000, 0, 'td', 95], [518399, 3, 'td', 89],
     [518400, 3, 'rush_yds', 107]],
    5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 5400, 'stats': {'rec': 1, 'rush_yds': 55, 'td': 89}}),
  ('normal control 3',
   [{'rec': 3, 'rush_yds': 99}, [[432001, 2, 'rush_yds', 23]], 5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 38, 'stats': {'rec': 3, 'rush_yds': 23}}),
  ('normal control 4',
   [{'rec': 2, 'rush_yds': 41}, [[345600, 0, 'td', 67], [259200, 3, 'rush_yds', 2]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 4032, 'stats': {'rec': 2, 'rush_yds': 2, 'td': 67}})]]
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(base, corrections, deadline, weights):
    stats = dict(base)
    applied = 0
    for ts, seq, stat, value in sorted(corrections, key=lambda c: (c[1], c[0])):
        if ts // 86400 > deadline:
            continue
        stats[stat] = value
        applied += 1
    pts = sum(weights[s] * stats.get(s, 0) for s in sorted(weights))
    return {'stats': stats, 'points': pts, 'applied': applied}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: ordering by per-day sequence',
   [{'rec': 1, 'rush_yds': 48},
    [[262800, 0, 'td', 16], [262800, 1, 'td', 104], [262800, 3, 'rush_yds', 17], [345599, 0, 'td', 83],
     [262800, 0, 'rush_yds', 112]],
    3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 5, 'points': 5002, 'stats': {'rec': 1, 'rush_yds': 17, 'td': 83}}),
  ('partial repair probe: ordering by per-day sequence',
   [{'rec': 7, 'rush_yds': 62},
    [[259201, 3, 'rush_yds', 37], [262800, 3, 'rec', 64], [332124, 2, 'rec', 65],
     [345599, 1, 'rush_yds', 91]],
    3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 416, 'stats': {'rec': 65, 'rush_yds': 91}}),
  ('second regression',
   [{'rec': 8, 'rush_yds': 65, 'td': 0},
    [[404733, 0, 'rec', 94], [361680, 3, 'rec', 1], [262800, 1, 'rec', 30]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 3, 'points': 535, 'stats': {'rec': 94, 'rush_yds': 65, 'td': 0}}),
  ('normal control 1',
   [{'rec': 2, 'rush_yds': 61, 'td': 2},
    [[349200, 2, 'rush_yds', 98], [349200, 3, 'rush_yds', 34], [286902, 1, 'rush_yds', 33],
     [345601, 1, 'rec', 85], [353444, 1, 'td', 18]],
    4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 5, 'points': 1539, 'stats': {'rec': 85, 'rush_yds': 34, 'td': 18}}),
  ('normal control 2',
   [{'rec': 1, 'rush_yds': 109, 'td': 0},
    [[176400, 3, 'rec', 59], [345600, 0, 'rush_yds', 47], [172800, 0, 'td', 3], [184833, 3, 'td', 8]], 3,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 3, 'points': 884, 'stats': {'rec': 59, 'rush_yds': 109, 'td': 8}}),
  ('normal control 3',
   [{'rec': 1, 'rush_yds': 113, 'td': 1},
    [[345601, 3, 'rush_yds', 106], [432001, 1, 'rush_yds', 108], [431999, 1, 'td', 18],
     [432000, 0, 'rush_yds', 19], [345599, 2, 'rec', 25]],
    4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 3, 'points': 1311, 'stats': {'rec': 25, 'rush_yds': 106, 'td': 18}}),
  ('normal control 4',
   [{'rec': 0, 'rush_yds': 36, 'td': 0}, [[522000, 3, 'rec', 11]], 5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 0, 'points': 36, 'stats': {'rec': 0, 'rush_yds': 36, 'td': 0}})],
 [('regression: ordering by per-day sequence',
   [{'rec': 8, 'rush_yds': 92, 'td': 2},
    [[259201, 0, 'rush_yds', 93], [259200, 1, 'rush_yds', 71], [259200, 2, 'td', 68], [431999, 1, 'td', 95]],
    4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 5833, 'stats': {'rec': 8, 'rush_yds': 93, 'td': 95}}),
  ('partial repair probe: ordering by per-day sequence',
   [{'rec': 0, 'rush_yds': 12, 'td': 0},
    [[262800, 3, 'rec', 90], [432001, 0, 'rec', 41], [349200, 2, 'rec', 83], [259201, 0, 'rush_yds', 26],
     [337939, 3, 'rush_yds', 72]],
    4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 487, 'stats': {'rec': 83, 'rush_yds': 72, 'td': 0}}),
  ('second regression',
   [{'rec': 4, 'rush_yds': 84, 'td': 2},
    [[267442, 3, 'rec', 80], [518399, 1, 'td', 57], [259201, 3, 'rec', 5], [496069, 2, 'td', 87],
     [481126, 1, 'rec', 92]],
    4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 604, 'stats': {'rec': 80, 'rush_yds': 84, 'td': 2}}),
  ('normal control 1',
   [{'rec': 3, 'rush_yds': 85},
    [[518399, 3, 'td', 22], [312423, 2, 'rec', 67], [389726, 3, 'td', 50], [345599, 0, 'rush_yds', 86]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 3, 'points': 3421, 'stats': {'rec': 67, 'rush_yds': 86, 'td': 50}}),
  ('normal control 2',
   [{'rec': 3, 'rush_yds': 25}, [[345601, 1, 'td', 20], [455741, 3, 'rec', 27]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 1360, 'stats': {'rec': 27, 'rush_yds': 25, 'td': 20}}),
  ('normal control 3',
   [{'rec': 7, 'rush_yds': 66}, [[345600, 2, 'td', 4]], 4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 341, 'stats': {'rec': 7, 'rush_yds': 66, 'td': 4}}),
  ('normal control 4',
   [{'rec': 6, 'rush_yds': 67, 'td': 0}, [[345600, 0, 'td', 14]], 4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 937, 'stats': {'rec': 6, 'rush_yds': 67, 'td': 14}})],
 [('regression: ordering by per-day sequence',
   [{'rec': 5, 'rush_yds': 21, 'td': 0},
    [[345600, 1, 'rush_yds', 23], [435600, 2, 'rush_yds', 25], [431999, 2, 'rush_yds', 82],
     [432001, 2, 'rush_yds', 72]],
    5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 50, 'stats': {'rec': 5, 'rush_yds': 25, 'td': 0}}),
  ('partial repair probe: ordering by per-day sequence',
   [{'rec': 5, 'rush_yds': 23, 'td': 1},
    [[518399, 1, 'td', 50], [421461, 3, 'td', 3], [432001, 0, 'rec', 110], [349200, 0, 'rec', 13]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 3573, 'stats': {'rec': 110, 'rush_yds': 23, 'td': 50}}),
  ('second regression',
   [{'rec': 3, 'rush_yds': 10},
    [[522000, 1, 'rec', 77], [435600, 0, 'rush_yds', 52], [518401, 3, 'rec', 49], [432000, 2, 'rush_yds', 4],
     [604799, 1, 'td', 12]],
    5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 67, 'stats': {'rec': 3, 'rush_yds': 52}}),
  ('normal control 1',
   [{'rec': 4, 'rush_yds': 87},
    [[432000, 2, 'td', 10], [506896, 1, 'rec', 116], [349531, 3, 'rush_yds', 65], [510444, 2, 'td', 15],
     [522000, 1, 'rec', 21]],
    5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 1545, 'stats': {'rec': 116, 'rush_yds': 65, 'td': 15}}),
  ('normal control 2',
   [{'rec': 2, 'rush_yds': 36}, [[455938, 2, 'td', 96], [314193, 0, 'rush_yds', 7]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 17, 'stats': {'rec': 2, 'rush_yds': 7}}),
  ('normal control 3',
   [{'rec': 2, 'rush_yds': 117}, [[380783, 3, 'td', 74], [259200, 1, 'rec', 75]], 3,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 492, 'stats': {'rec': 75, 'rush_yds': 117}}),
  ('normal control 4',
   [{'rec': 1, 'rush_yds': 61, 'td': 0}, [[431999, 1, 'rec', 82]], 4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 471, 'stats': {'rec': 82, 'rush_yds': 61, 'td': 0}})],
 [('regression: ordering by per-day sequence',
   [{'rec': 6, 'rush_yds': 3}, [[259200, 0, 'rec', 114], [345601, 0, 'rec', 31], [172801, 0, 'rec', 63]], 3,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 573, 'stats': {'rec': 114, 'rush_yds': 3}}),
  ('partial repair probe: ordering by per-day sequence',
   [{'rec': 8, 'rush_yds': 51, 'td': 2},
    [[435600, 0, 'rush_yds', 118], [432000, 2, 'rush_yds', 100], [518399, 1, 'td', 96],
     [432001, 2, 'rec', 17], [345601, 3, 'rush_yds', 34]],
    5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 5, 'points': 5963, 'stats': {'rec': 17, 'rush_yds': 118, 'td': 96}}),
  ('second regression',
   [{'rec': 0, 'rush_yds': 41},
    [[604799, 0, 'rec', 1], [447240, 2, 'rush_yds', 9], [432001, 3, 'rush_yds', 32]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 9, 'stats': {'rec': 0, 'rush_yds': 9}}),
  ('normal control 1',
   [{'rec': 6, 'rush_yds': 51}, [[349200, 2, 'rec', 5]], 4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 76, 'stats': {'rec': 5, 'rush_yds': 51}}),
  ('normal control 2',
   [{'rec': 2, 'rush_yds': 30, 'td': 0}, [[345600, 1, 'td', 6]], 4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 400, 'stats': {'rec': 2, 'rush_yds': 30, 'td': 6}}),
  ('normal control 3',
   [{'rec': 8, 'rush_yds': 32},
    [[408772, 1, 'rec', 110], [539866, 3, 'rush_yds', 88], [604799, 2, 'rec', 69]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 582, 'stats': {'rec': 110, 'rush_yds': 32}}),
  ('normal control 4',
   [{'rec': 5, 'rush_yds': 10}, [[229110, 1, 'td', 120], [271187, 1, 'rec', 75], [259201, 1, 'rush_yds', 81]],
    3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 3, 'points': 7656, 'stats': {'rec': 75, 'rush_yds': 81, 'td': 120}})],
 [('regression: ordering by per-day sequence',
   [{'rec': 8, 'rush_yds': 21}, [[432001, 1, 'rec', 83], [432001, 3, 'rec', 13], [518399, 1, 'rec', 106]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 3, 'points': 551, 'stats': {'rec': 106, 'rush_yds': 21}}),
  ('partial repair probe: ordering by per-day sequence',
   [{'rec': 3, 'rush_yds': 32}, [[271219, 2, 'td', 77], [262800, 3, 'td', 74], [308677, 2, 'rush_yds', 2]], 3,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 3, 'points': 4637, 'stats': {'rec': 3, 'rush_yds': 2, 'td': 77}}),
  ('second regression',
   [{'rec': 7, 'rush_yds': 52, 'td': 1},
    [[376011, 0, 'td', 23], [259201, 1, 'td', 85], [349200, 3, 'rush_yds', 42], [433522, 3, 'rush_yds', 48],
     [345601, 2, 'rush_yds', 82]],
    4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 1457, 'stats': {'rec': 7, 'rush_yds': 42, 'td': 23}}),
  ('normal control 1',
   [{'rec': 7, 'rush_yds': 18, 'td': 2}, [[432001, 0, 'rush_yds', 80], [439508, 0, 'rec', 62]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 510, 'stats': {'rec': 62, 'rush_yds': 80, 'td': 2}}),
  ('normal control 2',
   [{'rec': 1, 'rush_yds': 31, 'td': 0},
    [[518399, 3, 'rush_yds', 55], [582426, 3, 'rec', 56], [522000, 0, 'td', 95], [518399, 3, 'td', 89],
     [518400, 3, 'rush_yds', 107]],
    5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 5400, 'stats': {'rec': 1, 'rush_yds': 55, 'td': 89}}),
  ('normal control 3',
   [{'rec': 3, 'rush_yds': 99}, [[432001, 2, 'rush_yds', 23]], 5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 38, 'stats': {'rec': 3, 'rush_yds': 23}}),
  ('normal control 4',
   [{'rec': 2, 'rush_yds': 41}, [[345600, 0, 'td', 67], [259200, 3, 'rush_yds', 2]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 4032, 'stats': {'rec': 2, 'rush_yds': 2, 'td': 67}})]]
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 Tuesday correction with sequence 0 is overridden by Monday's sequence 2.

Corrections are [timestamp seconds, per-day sequence, stat, corrected absolute value]. Apply corrections whose UTC day (timestamp // 86400) is on or before the deadline day, ordered by timestamp then sequence; each replaces the stat value (a later correction wins, a stat missing from the base line is added). Points are the weighted sum over the weight table using corrected stats. Return stats, points and the count of corrections applied.

split: open-access


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

N = 1
observations = []
def solve(base, corrections, deadline, weights):
    stats = dict(base)
    applied = 0
    for ts, seq, stat, value in sorted(corrections, key=lambda c: (c[0], c[1])):
        applied += 1
        if ts // 86400 > deadline:
            continue
        stats[stat] = value
    pts = sum(weights[s] * stats.get(s, 0) for s in sorted(weights))
    return {'stats': stats, 'points': pts, 'applied': applied}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: applied counter',
   [{'rec': 5, 'rush_yds': 100, 'td': 2},
    [[604799, 0, 'rec', 90], [604799, 0, 'rec', 2], [345600, 2, 'td', 68]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 4205, 'stats': {'rec': 5, 'rush_yds': 100, 'td': 68}}),
  ('partial repair probe: applied counter',
   [{'rec': 2, 'rush_yds': 44, 'td': 1}, [[435600, 1, 'td', 2], [349200, 3, 'rush_yds', 44]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 114, 'stats': {'rec': 2, 'rush_yds': 44, 'td': 1}}),
  ('second regression',
   [{'rec': 2, 'rush_yds': 26, 'td': 2},
    [[259200, 3, 'rush_yds', 108], [349200, 0, 'rush_yds', 100], [345599, 2, 'rec', 7],
     [345601, 2, 'rush_yds', 46], [259199, 2, 'rush_yds', 23]],
    3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 3, 'points': 263, 'stats': {'rec': 7, 'rush_yds': 108, 'td': 2}}),
  ('normal control 1',
   [{'rec': 7, 'rush_yds': 61},
    [[259200, 3, 'td', 60], [259200, 1, 'td', 68], [172800, 1, 'rec', 104], [259201, 0, 'rec', 23]], 3,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 3776, 'stats': {'rec': 23, 'rush_yds': 61, 'td': 60}}),
  ('normal control 2',
   [{'rec': 8, 'rush_yds': 69, 'td': 1}, [[518399, 1, 'td', 39], [435600, 2, 'rec', 94]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 2879, 'stats': {'rec': 94, 'rush_yds': 69, 'td': 39}}),
  ('normal control 3',
   [{'rec': 7, 'rush_yds': 78, 'td': 0}, [[345601, 2, 'rec', 108], [431999, 2, 'rec', 102]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 588, 'stats': {'rec': 102, 'rush_yds': 78, 'td': 0}}),
  ('normal control 4',
   [{'rec': 5, 'rush_yds': 27, 'td': 0}, [[345600, 2, 'rush_yds', 20]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 45, 'stats': {'rec': 5, 'rush_yds': 20, 'td': 0}})],
 [('regression: applied counter',
   [{'rec': 8, 'rush_yds': 86},
    [[259200, 1, 'rec', 18], [345601, 0, 'rec', 73], [259200, 2, 'td', 3], [259201, 3, 'rec', 13],
     [262800, 3, 'rush_yds', 40]],
    3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 285, 'stats': {'rec': 13, 'rush_yds': 40, 'td': 3}}),
  ('partial repair probe: applied counter',
   [{'rec': 8, 'rush_yds': 10}, [[262800, 1, 'rush_yds', 10]], 4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 50, 'stats': {'rec': 8, 'rush_yds': 10}}),
  ('second regression',
   [{'rec': 1, 'rush_yds': 15, 'td': 1},
    [[345601, 0, 'rec', 47], [432000, 0, 'td', 119], [408723, 0, 'rush_yds', 112]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 407, 'stats': {'rec': 47, 'rush_yds': 112, 'td': 1}}),
  ('normal control 1',
   [{'rec': 5, 'rush_yds': 79, 'td': 0},
    [[435600, 1, 'rush_yds', 53], [345601, 1, 'rush_yds', 105], [464918, 3, 'td', 114], [518399, 2, 'td', 26],
     [518399, 2, 'rush_yds', 63]],
    5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 5, 'points': 1648, 'stats': {'rec': 5, 'rush_yds': 63, 'td': 26}}),
  ('normal control 2',
   [{'rec': 4, 'rush_yds': 22}, [[349200, 1, 'td', 101]], 5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 6102, 'stats': {'rec': 4, 'rush_yds': 22, 'td': 101}}),
  ('normal control 3',
   [{'rec': 3, 'rush_yds': 0, 'td': 2}, [[259201, 0, 'rec', 70]], 3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 470, 'stats': {'rec': 70, 'rush_yds': 0, 'td': 2}}),
  ('normal control 4',
   [{'rec': 3, 'rush_yds': 82},
    [[349200, 2, 'td', 114], [431999, 0, 'rush_yds', 24], [259200, 1, 'rec', 55], [431999, 3, 'td', 79]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 5039, 'stats': {'rec': 55, 'rush_yds': 24, 'td': 79}})],
 [('regression: applied counter',
   [{'rec': 8, 'rush_yds': 75, 'td': 2},
    [[435600, 3, 'rec', 93], [432001, 2, 'td', 86], [432000, 2, 'td', 101]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 0, 'points': 235, 'stats': {'rec': 8, 'rush_yds': 75, 'td': 2}}),
  ('partial repair probe: applied counter',
   [{'rec': 4, 'rush_yds': 84, 'td': 2},
    [[284666, 2, 'rec', 4], [259200, 3, 'td', 82], [298948, 0, 'td', 105], [349200, 2, 'td', 67],
     [431999, 1, 'rush_yds', 88]],
    4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 5, 'points': 4128, 'stats': {'rec': 4, 'rush_yds': 88, 'td': 67}}),
  ('second regression',
   [{'rec': 2, 'rush_yds': 65, 'td': 0}, [[432000, 0, 'rush_yds', 10], [604799, 3, 'rec', 74]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 20, 'stats': {'rec': 2, 'rush_yds': 10, 'td': 0}}),
  ('normal control 1',
   [{'rec': 5, 'rush_yds': 43, 'td': 2}, [[405691, 0, 'rec', 35]], 4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 338, 'stats': {'rec': 35, 'rush_yds': 43, 'td': 2}}),
  ('normal control 2',
   [{'rec': 3, 'rush_yds': 25},
    [[482768, 1, 'rec', 26], [345600, 2, 'rush_yds', 32], [450486, 1, 'td', 36], [432000, 1, 'td', 64]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 2322, 'stats': {'rec': 26, 'rush_yds': 32, 'td': 36}}),
  ('normal control 3',
   [{'rec': 3, 'rush_yds': 71, 'td': 1}, [[259200, 0, 'rush_yds', 87], [172801, 3, 'rec', 86]], 3,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 577, 'stats': {'rec': 86, 'rush_yds': 87, 'td': 1}}),
  ('normal control 4',
   [{'rec': 3, 'rush_yds': 46}, [[259201, 0, 'td', 50]], 3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 3061, 'stats': {'rec': 3, 'rush_yds': 46, 'td': 50}})],
 [('regression: applied counter',
   [{'rec': 7, 'rush_yds': 95, 'td': 2}, [[345600, 1, 'rec', 113], [435600, 1, 'rush_yds', 96]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 780, 'stats': {'rec': 113, 'rush_yds': 95, 'td': 2}}),
  ('partial repair probe: applied counter',
   [{'rec': 3, 'rush_yds': 59, 'td': 2}, [[334588, 1, 'td', 2]], 3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 194, 'stats': {'rec': 3, 'rush_yds': 59, 'td': 2}}),
  ('second regression',
   [{'rec': 1, 'rush_yds': 30},
    [[488302, 1, 'rush_yds', 83], [518399, 2, 'td', 46], [345601, 1, 'rush_yds', 62], [432000, 0, 'rec', 55]],
    4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 67, 'stats': {'rec': 1, 'rush_yds': 62}}),
  ('normal control 1',
   [{'rec': 4, 'rush_yds': 97}, [[259201, 0, 'rush_yds', 49]], 3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 69, 'stats': {'rec': 4, 'rush_yds': 49}}),
  ('normal control 2',
   [{'rec': 6, 'rush_yds': 29, 'td': 1}, [[500428, 3, 'rush_yds', 90], [432001, 0, 'rec', 40]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 350, 'stats': {'rec': 40, 'rush_yds': 90, 'td': 1}}),
  ('normal control 3',
   [{'rec': 4, 'rush_yds': 39}, [[349200, 3, 'rec', 73], [259201, 2, 'rec', 19], [330457, 1, 'rush_yds', 66]],
    4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 3, 'points': 431, 'stats': {'rec': 73, 'rush_yds': 66}}),
  ('normal control 4',
   [{'rec': 2, 'rush_yds': 1},
    [[435600, 2, 'td', 71], [432001, 3, 'td', 70], [435600, 0, 'td', 60], [432000, 0, 'rec', 39]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 4456, 'stats': {'rec': 39, 'rush_yds': 1, 'td': 71}})],
 [('regression: applied counter',
   [{'rec': 8, 'rush_yds': 76, 'td': 2},
    [[259200, 0, 'rec', 91], [345601, 0, 'rec', 0], [188559, 3, 'rec', 31], [262800, 1, 'td', 35]], 3,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 3, 'points': 2631, 'stats': {'rec': 91, 'rush_yds': 76, 'td': 35}}),
  ('partial repair probe: applied counter',
   [{'rec': 6, 'rush_yds': 53, 'td': 2}, [[259201, 3, 'td', 2]], 3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 203, 'stats': {'rec': 6, 'rush_yds': 53, 'td': 2}}),
  ('second regression',
   [{'rec': 1, 'rush_yds': 45}, [[262800, 1, 'rush_yds', 84], [259201, 2, 'td', 69], [431999, 3, 'td', 3]], 3,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 4229, 'stats': {'rec': 1, 'rush_yds': 84, 'td': 69}}),
  ('normal control 1',
   [{'rec': 8, 'rush_yds': 36, 'td': 0}, [[432000, 0, 'td', 78], [345601, 3, 'td', 71]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 4756, 'stats': {'rec': 8, 'rush_yds': 36, 'td': 78}}),
  ('normal control 2',
   [{'rec': 5, 'rush_yds': 96},
    [[345601, 3, 'rec', 28], [262800, 3, 'rush_yds', 58], [259200, 3, 'rush_yds', 4]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 3, 'points': 198, 'stats': {'rec': 28, 'rush_yds': 58}}),
  ('normal control 3',
   [{'rec': 0, 'rush_yds': 120, 'td': 2},
    [[432001, 2, 'rec', 75], [435600, 3, 'rush_yds', 9], [518399, 3, 'td', 93]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 3, 'points': 5964, 'stats': {'rec': 75, 'rush_yds': 9, 'td': 93}}),
  ('normal control 4',
   [{'rec': 4, 'rush_yds': 63},
    [[345599, 1, 'rush_yds', 74], [240637, 0, 'rush_yds', 4], [176400, 0, 'rec', 34],
     [289010, 0, 'rush_yds', 45]],
    3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 244, 'stats': {'rec': 34, 'rush_yds': 74}})]]
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(base, corrections, deadline, weights):
    stats = dict(base)
    applied = 0
    for ts, seq, stat, value in sorted(corrections, key=lambda c: (c[0], c[1])):
        if ts // 86400 > deadline:
            continue
        applied += 1 if stats.get(stat) != value else 0
        stats[stat] = value
    pts = sum(weights[s] * stats.get(s, 0) for s in sorted(weights))
    return {'stats': stats, 'points': pts, 'applied': applied}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: applied counter',
   [{'rec': 5, 'rush_yds': 100, 'td': 2},
    [[604799, 0, 'rec', 90], [604799, 0, 'rec', 2], [345600, 2, 'td', 68]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 4205, 'stats': {'rec': 5, 'rush_yds': 100, 'td': 68}}),
  ('partial repair probe: applied counter',
   [{'rec': 2, 'rush_yds': 44, 'td': 1}, [[435600, 1, 'td', 2], [349200, 3, 'rush_yds', 44]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 114, 'stats': {'rec': 2, 'rush_yds': 44, 'td': 1}}),
  ('second regression',
   [{'rec': 2, 'rush_yds': 26, 'td': 2},
    [[259200, 3, 'rush_yds', 108], [349200, 0, 'rush_yds', 100], [345599, 2, 'rec', 7],
     [345601, 2, 'rush_yds', 46], [259199, 2, 'rush_yds', 23]],
    3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 3, 'points': 263, 'stats': {'rec': 7, 'rush_yds': 108, 'td': 2}}),
  ('normal control 1',
   [{'rec': 7, 'rush_yds': 61},
    [[259200, 3, 'td', 60], [259200, 1, 'td', 68], [172800, 1, 'rec', 104], [259201, 0, 'rec', 23]], 3,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 3776, 'stats': {'rec': 23, 'rush_yds': 61, 'td': 60}}),
  ('normal control 2',
   [{'rec': 8, 'rush_yds': 69, 'td': 1}, [[518399, 1, 'td', 39], [435600, 2, 'rec', 94]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 2879, 'stats': {'rec': 94, 'rush_yds': 69, 'td': 39}}),
  ('normal control 3',
   [{'rec': 7, 'rush_yds': 78, 'td': 0}, [[345601, 2, 'rec', 108], [431999, 2, 'rec', 102]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 588, 'stats': {'rec': 102, 'rush_yds': 78, 'td': 0}}),
  ('normal control 4',
   [{'rec': 5, 'rush_yds': 27, 'td': 0}, [[345600, 2, 'rush_yds', 20]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 45, 'stats': {'rec': 5, 'rush_yds': 20, 'td': 0}})],
 [('regression: applied counter',
   [{'rec': 8, 'rush_yds': 86},
    [[259200, 1, 'rec', 18], [345601, 0, 'rec', 73], [259200, 2, 'td', 3], [259201, 3, 'rec', 13],
     [262800, 3, 'rush_yds', 40]],
    3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 285, 'stats': {'rec': 13, 'rush_yds': 40, 'td': 3}}),
  ('partial repair probe: applied counter',
   [{'rec': 8, 'rush_yds': 10}, [[262800, 1, 'rush_yds', 10]], 4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 50, 'stats': {'rec': 8, 'rush_yds': 10}}),
  ('second regression',
   [{'rec': 1, 'rush_yds': 15, 'td': 1},
    [[345601, 0, 'rec', 47], [432000, 0, 'td', 119], [408723, 0, 'rush_yds', 112]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 407, 'stats': {'rec': 47, 'rush_yds': 112, 'td': 1}}),
  ('normal control 1',
   [{'rec': 5, 'rush_yds': 79, 'td': 0},
    [[435600, 1, 'rush_yds', 53], [345601, 1, 'rush_yds', 105], [464918, 3, 'td', 114], [518399, 2, 'td', 26],
     [518399, 2, 'rush_yds', 63]],
    5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 5, 'points': 1648, 'stats': {'rec': 5, 'rush_yds': 63, 'td': 26}}),
  ('normal control 2',
   [{'rec': 4, 'rush_yds': 22}, [[349200, 1, 'td', 101]], 5, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 6102, 'stats': {'rec': 4, 'rush_yds': 22, 'td': 101}}),
  ('normal control 3',
   [{'rec': 3, 'rush_yds': 0, 'td': 2}, [[259201, 0, 'rec', 70]], 3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 470, 'stats': {'rec': 70, 'rush_yds': 0, 'td': 2}}),
  ('normal control 4',
   [{'rec': 3, 'rush_yds': 82},
    [[349200, 2, 'td', 114], [431999, 0, 'rush_yds', 24], [259200, 1, 'rec', 55], [431999, 3, 'td', 79]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 5039, 'stats': {'rec': 55, 'rush_yds': 24, 'td': 79}})],
 [('regression: applied counter',
   [{'rec': 8, 'rush_yds': 75, 'td': 2},
    [[435600, 3, 'rec', 93], [432001, 2, 'td', 86], [432000, 2, 'td', 101]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 0, 'points': 235, 'stats': {'rec': 8, 'rush_yds': 75, 'td': 2}}),
  ('partial repair probe: applied counter',
   [{'rec': 4, 'rush_yds': 84, 'td': 2},
    [[284666, 2, 'rec', 4], [259200, 3, 'td', 82], [298948, 0, 'td', 105], [349200, 2, 'td', 67],
     [431999, 1, 'rush_yds', 88]],
    4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 5, 'points': 4128, 'stats': {'rec': 4, 'rush_yds': 88, 'td': 67}}),
  ('second regression',
   [{'rec': 2, 'rush_yds': 65, 'td': 0}, [[432000, 0, 'rush_yds', 10], [604799, 3, 'rec', 74]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 20, 'stats': {'rec': 2, 'rush_yds': 10, 'td': 0}}),
  ('normal control 1',
   [{'rec': 5, 'rush_yds': 43, 'td': 2}, [[405691, 0, 'rec', 35]], 4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 338, 'stats': {'rec': 35, 'rush_yds': 43, 'td': 2}}),
  ('normal control 2',
   [{'rec': 3, 'rush_yds': 25},
    [[482768, 1, 'rec', 26], [345600, 2, 'rush_yds', 32], [450486, 1, 'td', 36], [432000, 1, 'td', 64]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 2322, 'stats': {'rec': 26, 'rush_yds': 32, 'td': 36}}),
  ('normal control 3',
   [{'rec': 3, 'rush_yds': 71, 'td': 1}, [[259200, 0, 'rush_yds', 87], [172801, 3, 'rec', 86]], 3,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 577, 'stats': {'rec': 86, 'rush_yds': 87, 'td': 1}}),
  ('normal control 4',
   [{'rec': 3, 'rush_yds': 46}, [[259201, 0, 'td', 50]], 3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 3061, 'stats': {'rec': 3, 'rush_yds': 46, 'td': 50}})],
 [('regression: applied counter',
   [{'rec': 7, 'rush_yds': 95, 'td': 2}, [[345600, 1, 'rec', 113], [435600, 1, 'rush_yds', 96]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 780, 'stats': {'rec': 113, 'rush_yds': 95, 'td': 2}}),
  ('partial repair probe: applied counter',
   [{'rec': 3, 'rush_yds': 59, 'td': 2}, [[334588, 1, 'td', 2]], 3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 194, 'stats': {'rec': 3, 'rush_yds': 59, 'td': 2}}),
  ('second regression',
   [{'rec': 1, 'rush_yds': 30},
    [[488302, 1, 'rush_yds', 83], [518399, 2, 'td', 46], [345601, 1, 'rush_yds', 62], [432000, 0, 'rec', 55]],
    4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 67, 'stats': {'rec': 1, 'rush_yds': 62}}),
  ('normal control 1',
   [{'rec': 4, 'rush_yds': 97}, [[259201, 0, 'rush_yds', 49]], 3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 69, 'stats': {'rec': 4, 'rush_yds': 49}}),
  ('normal control 2',
   [{'rec': 6, 'rush_yds': 29, 'td': 1}, [[500428, 3, 'rush_yds', 90], [432001, 0, 'rec', 40]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 350, 'stats': {'rec': 40, 'rush_yds': 90, 'td': 1}}),
  ('normal control 3',
   [{'rec': 4, 'rush_yds': 39}, [[349200, 3, 'rec', 73], [259201, 2, 'rec', 19], [330457, 1, 'rush_yds', 66]],
    4, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 3, 'points': 431, 'stats': {'rec': 73, 'rush_yds': 66}}),
  ('normal control 4',
   [{'rec': 2, 'rush_yds': 1},
    [[435600, 2, 'td', 71], [432001, 3, 'td', 70], [435600, 0, 'td', 60], [432000, 0, 'rec', 39]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 4456, 'stats': {'rec': 39, 'rush_yds': 1, 'td': 71}})],
 [('regression: applied counter',
   [{'rec': 8, 'rush_yds': 76, 'td': 2},
    [[259200, 0, 'rec', 91], [345601, 0, 'rec', 0], [188559, 3, 'rec', 31], [262800, 1, 'td', 35]], 3,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 3, 'points': 2631, 'stats': {'rec': 91, 'rush_yds': 76, 'td': 35}}),
  ('partial repair probe: applied counter',
   [{'rec': 6, 'rush_yds': 53, 'td': 2}, [[259201, 3, 'td', 2]], 3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 1, 'points': 203, 'stats': {'rec': 6, 'rush_yds': 53, 'td': 2}}),
  ('second regression',
   [{'rec': 1, 'rush_yds': 45}, [[262800, 1, 'rush_yds', 84], [259201, 2, 'td', 69], [431999, 3, 'td', 3]], 3,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 4229, 'stats': {'rec': 1, 'rush_yds': 84, 'td': 69}}),
  ('normal control 1',
   [{'rec': 8, 'rush_yds': 36, 'td': 0}, [[432000, 0, 'td', 78], [345601, 3, 'td', 71]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 2, 'points': 4756, 'stats': {'rec': 8, 'rush_yds': 36, 'td': 78}}),
  ('normal control 2',
   [{'rec': 5, 'rush_yds': 96},
    [[345601, 3, 'rec', 28], [262800, 3, 'rush_yds', 58], [259200, 3, 'rush_yds', 4]], 4,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 3, 'points': 198, 'stats': {'rec': 28, 'rush_yds': 58}}),
  ('normal control 3',
   [{'rec': 0, 'rush_yds': 120, 'td': 2},
    [[432001, 2, 'rec', 75], [435600, 3, 'rush_yds', 9], [518399, 3, 'td', 93]], 5,
    {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 3, 'points': 5964, 'stats': {'rec': 75, 'rush_yds': 9, 'td': 93}}),
  ('normal control 4',
   [{'rec': 4, 'rush_yds': 63},
    [[345599, 1, 'rush_yds', 74], [240637, 0, 'rush_yds', 4], [176400, 0, 'rec', 34],
     [289010, 0, 'rush_yds', 45]],
    3, {'rec': 5, 'rush_yds': 1, 'td': 60}],
   {'applied': 4, 'points': 244, 'stats': {'rec': 34, 'rush_yds': 74}})]]
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 audit trail reports five applied corrections while only three were within the deadline.

Corrections are [timestamp seconds, per-day sequence, stat, corrected absolute value]. Apply corrections whose UTC day (timestamp // 86400) is on or before the deadline day, ordered by timestamp then sequence; each replaces the stat value (a later correction wins, a stat missing from the base line is added). Points are the weighted sum over the weight table using corrected stats. Return stats, points and the count of corrections applied.

split: open-access