broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import re
N = 1
observations = []
def solve(cues, max_cps):
    flagged=[]
    for idx,(start,end,text) in enumerate(cues,1):
        visible=re.sub(r'<[^>]*>','',text)
        visible=visible.replace('\r\n','\n')
        chars=len(visible.replace('\n',''))
        dur=end-start
        if dur<=0:
            if chars>0: flagged.append(idx)
            continue
        if chars*1000>=max_cps*dur:
            flagged.append(idx)
    return flagged
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: speed threshold', [[[0, 1000, 'abcdefghij']], 10], []), ('regression variant: speed threshold', [[[5543, 5743, 'Red'], [3551, 4551, 'Two\nlines'], [4354, 4454, 'A']], 15], []), ('partial repair probe: speed threshold', [[[8892, 9392, 'Two\nlines']], 10], [1]), ('partial repair variant: speed threshold', [[[9754, 12754, 'Long line of dialogue here'], [617, 617, 'A\r\nB\r\nC'], [5734, 7734, 'Two\r\nlines'], [3694, 4361, 'Two\r\nlines'], [253, 353, '  spaced  ']], 15], [2, 5]), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('boundary control', [[[0, 0, '']], 17], []), ('normal control', [[[0, 500, 'a\r\nb']], 5], []), ('normal control', [[[839, 3839, 'I'], [4652, 6652, 'x\ny\nz']], 17], []), ('normal control', [[[1857, 1857, 'x\ny\nz']], 10], [1])], [('regression: speed threshold', [[[2569, 2769, 'A\r\nB\r\nC'], [1782, 1782, 'x\ny\nz']], 15], [2]), ('regression variant: speed threshold', [[[4903, 5303, 'Two\r\nlines'], [7669, 7920, 'Hello'], [9175, 12175, 'Two\nlines']], 20], []), ('partial repair probe: speed threshold', [[[6012, 6112, 'Hi there']], 15], [1]), ('partial repair variant: speed threshold', [[[5112, 5760, 'Italic text'], [2636, 2931, 'Hello'], [1678, 1778, 'Two\r\nlines'], [6527, 6586, 'a'], [9403, 9403, 'x\n']], 17], [3, 5]), ('boundary control', [[[0, 0, '']], 17], []), ('boundary control', [[[0, 500, 'a\r\nb']], 5], []), ('normal control', [[[7799, 7899, ''], [6867, 9867, 'Hello'], [1132, 1132, '<c.yellow>Cue</c> text'], [3310, 3310, 'a']], 17], [3, 4]), ('normal control', [[[3439, 3939, 'abcd'], [7218, 9218, '<c.yellow>Cue</c> text'], [9347, 11347, 'Two\r\nlines'], [1314, 1314, 'A\r\nB\r\nC'], [1557, 3557, 'x\ny\nz']], 10], [4]), ('normal control', [[[5029, 5019, 'abcd']], 20], [1])], [('regression: speed threshold', [[[9565, 11365, 'abcd'], [7862, 10862, 'abcd'], [9297, 9397, 'a']], 10], []), ('regression variant: speed threshold', [[[4743, 5143, 'A'], [1982, 2982, 'Hi there'], [5318, 5468, 'Red'], [4990, 5140, 'Red'], [1465, 1965, 'A']], 20], []), ('partial repair probe: speed threshold', [[[2466, 4200, 'Long line of dialogue here'], [3387, 5387, '<c.yellow>Cue</c> text']], 15], []), ('partial repair variant: speed threshold', [[[7253, 10253, '<c.yellow>Cue</c> text'], [7954, 8954, 'x\ny\nz'], [4376, 4476, 'x\ny\nz'], [5892, 6892, 'Hi there']], 15], [3]), ('boundary control', [[[0, 500, 'a\r\nb']], 5], []), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('normal control', [[[5649, 5916, 'abcd'], [3007, 2997, 'Hello'], [9574, 9574, 'A\r\nB\r\nC'], [6652, 7319, '  spaced  ']], 15], [2, 3]), ('normal control', [[[6795, 6795, 'x\n']], 17], [1]), ('normal control', [[[959, 1459, 'Two\nlines'], [7727, 7727, 'x\ny\nz'], [3146, 3146, 'Italic text'], [3843, 6843, 'Long line of dialogue here']], 20], [2, 3])], [('regression: speed threshold', [[[5207, 5208, ''], [8379, 8879, '  spaced  '], [9114, 9365, 'x\ny\nz'], [2354, 2344, 'Hi there'], [3706, 3756, 'x\n']], 20], [4]), ('regression variant: speed threshold', [[[3319, 3319, ''], [9021, 9021, '  spaced  '], [4466, 5367, 'Two\nlines'], [3595, 4096, 'Hello'], [4276, 5276, '  spaced  ']], 10], [2]), ('partial repair probe: speed threshold', [[[7961, 7961, 'x\n'], [4865, 5399, 'Hi there'], [9675, 12675, ''], [2209, 3410, 'abcd'], [4016, 4116, 'abcd']], 15], [1, 5]), ('partial repair variant: speed threshold', [[[936, 1137, 'A\r\nB\r\nC'], [5836, 7570, 'Long line of dialogue here'], [1739, 1739, '']], 15], []), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('boundary control', [[[0, 0, '']], 17], []), ('normal control', [[[3192, 3393, 'abcd']], 20], []), ('normal control', [[[3725, 6725, '<c.yellow>Cue</c> text'], [8427, 8663, 'abcd'], [9335, 9325, 'Red']], 17], [3]), ('normal control', [[[6632, 6632, 'Two\nlines'], [8773, 8763, 'Two\nlines'], [815, 815, '<c.yellow>Cue</c> text']], 10], [1, 2, 3])], [('regression: speed threshold', [[[4694, 5494, 'Two\nlines'], [3327, 3327, 'x\ny\nz'], [2373, 4573, '<c.yellow>Cue</c> text'], [1711, 1911, 'x\n'], [7573, 7573, '<c.yellow>Cue</c> text']], 10], [2, 5]), ('regression variant: speed threshold', [[[955, 1005, 'A'], [9350, 11350, 'abcd'], [864, 854, 'A\r\nB\r\nC'], [6216, 6716, 'Long line of dialogue here']], 20], [3, 4]), ('partial repair probe: speed threshold', [[[7027, 7527, 'Two\nlines'], [1204, 1851, 'Italic text'], [7529, 9059, 'Long line of dialogue here'], [3040, 3216, 'Red'], [5263, 5253, 'Two\r\nlines']], 17], [2, 4, 5]), ('partial repair variant: speed threshold', [[[2544, 2544, '  spaced  '], [4666, 4766, 'Hello'], [1260, 1250, ''], [1606, 1807, 'x\ny\nz']], 15], [1, 2]), ('boundary control', [[[0, 0, '']], 17], []), ('boundary control', [[[0, 500, 'a\r\nb']], 5], []), ('normal control', [[[4014, 4081, 'a'], [3684, 6684, 'Hi there']], 15], []), ('normal control', [[[8878, 9378, 'a'], [1695, 1990, 'x\ny\nz'], [8649, 8649, '<c.yellow>Cue</c> text'], [4805, 5334, 'Two\nlines']], 17], [3]), ('normal control', [[[3769, 4036, 'abcd']], 15], [])]]
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 re
N = 1
observations = []
def solve(cues, max_cps):
    flagged=[]
    for idx,(start,end,text) in enumerate(cues,1):
        visible=re.sub(r'<[^>]*>','',text)
        visible=visible.replace('\r\n','\n')
        chars=len(visible.replace('\n',''))
        dur=end-start
        if dur<=0:
            if chars>0: flagged.append(idx)
            continue
        if chars//(dur//1000 or 1)>max_cps:
            flagged.append(idx)
    return flagged
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: speed threshold', [[[0, 1000, 'abcdefghij']], 10], []), ('regression variant: speed threshold', [[[5543, 5743, 'Red'], [3551, 4551, 'Two\nlines'], [4354, 4454, 'A']], 15], []), ('partial repair probe: speed threshold', [[[8892, 9392, 'Two\nlines']], 10], [1]), ('partial repair variant: speed threshold', [[[9754, 12754, 'Long line of dialogue here'], [617, 617, 'A\r\nB\r\nC'], [5734, 7734, 'Two\r\nlines'], [3694, 4361, 'Two\r\nlines'], [253, 353, '  spaced  ']], 15], [2, 5]), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('boundary control', [[[0, 0, '']], 17], []), ('normal control', [[[0, 500, 'a\r\nb']], 5], []), ('normal control', [[[839, 3839, 'I'], [4652, 6652, 'x\ny\nz']], 17], []), ('normal control', [[[1857, 1857, 'x\ny\nz']], 10], [1])], [('regression: speed threshold', [[[2569, 2769, 'A\r\nB\r\nC'], [1782, 1782, 'x\ny\nz']], 15], [2]), ('regression variant: speed threshold', [[[4903, 5303, 'Two\r\nlines'], [7669, 7920, 'Hello'], [9175, 12175, 'Two\nlines']], 20], []), ('partial repair probe: speed threshold', [[[6012, 6112, 'Hi there']], 15], [1]), ('partial repair variant: speed threshold', [[[5112, 5760, 'Italic text'], [2636, 2931, 'Hello'], [1678, 1778, 'Two\r\nlines'], [6527, 6586, 'a'], [9403, 9403, 'x\n']], 17], [3, 5]), ('boundary control', [[[0, 0, '']], 17], []), ('boundary control', [[[0, 500, 'a\r\nb']], 5], []), ('normal control', [[[7799, 7899, ''], [6867, 9867, 'Hello'], [1132, 1132, '<c.yellow>Cue</c> text'], [3310, 3310, 'a']], 17], [3, 4]), ('normal control', [[[3439, 3939, 'abcd'], [7218, 9218, '<c.yellow>Cue</c> text'], [9347, 11347, 'Two\r\nlines'], [1314, 1314, 'A\r\nB\r\nC'], [1557, 3557, 'x\ny\nz']], 10], [4]), ('normal control', [[[5029, 5019, 'abcd']], 20], [1])], [('regression: speed threshold', [[[9565, 11365, 'abcd'], [7862, 10862, 'abcd'], [9297, 9397, 'a']], 10], []), ('regression variant: speed threshold', [[[4743, 5143, 'A'], [1982, 2982, 'Hi there'], [5318, 5468, 'Red'], [4990, 5140, 'Red'], [1465, 1965, 'A']], 20], []), ('partial repair probe: speed threshold', [[[2466, 4200, 'Long line of dialogue here'], [3387, 5387, '<c.yellow>Cue</c> text']], 15], []), ('partial repair variant: speed threshold', [[[7253, 10253, '<c.yellow>Cue</c> text'], [7954, 8954, 'x\ny\nz'], [4376, 4476, 'x\ny\nz'], [5892, 6892, 'Hi there']], 15], [3]), ('boundary control', [[[0, 500, 'a\r\nb']], 5], []), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('normal control', [[[5649, 5916, 'abcd'], [3007, 2997, 'Hello'], [9574, 9574, 'A\r\nB\r\nC'], [6652, 7319, '  spaced  ']], 15], [2, 3]), ('normal control', [[[6795, 6795, 'x\n']], 17], [1]), ('normal control', [[[959, 1459, 'Two\nlines'], [7727, 7727, 'x\ny\nz'], [3146, 3146, 'Italic text'], [3843, 6843, 'Long line of dialogue here']], 20], [2, 3])], [('regression: speed threshold', [[[5207, 5208, ''], [8379, 8879, '  spaced  '], [9114, 9365, 'x\ny\nz'], [2354, 2344, 'Hi there'], [3706, 3756, 'x\n']], 20], [4]), ('regression variant: speed threshold', [[[3319, 3319, ''], [9021, 9021, '  spaced  '], [4466, 5367, 'Two\nlines'], [3595, 4096, 'Hello'], [4276, 5276, '  spaced  ']], 10], [2]), ('partial repair probe: speed threshold', [[[7961, 7961, 'x\n'], [4865, 5399, 'Hi there'], [9675, 12675, ''], [2209, 3410, 'abcd'], [4016, 4116, 'abcd']], 15], [1, 5]), ('partial repair variant: speed threshold', [[[936, 1137, 'A\r\nB\r\nC'], [5836, 7570, 'Long line of dialogue here'], [1739, 1739, '']], 15], []), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('boundary control', [[[0, 0, '']], 17], []), ('normal control', [[[3192, 3393, 'abcd']], 20], []), ('normal control', [[[3725, 6725, '<c.yellow>Cue</c> text'], [8427, 8663, 'abcd'], [9335, 9325, 'Red']], 17], [3]), ('normal control', [[[6632, 6632, 'Two\nlines'], [8773, 8763, 'Two\nlines'], [815, 815, '<c.yellow>Cue</c> text']], 10], [1, 2, 3])], [('regression: speed threshold', [[[4694, 5494, 'Two\nlines'], [3327, 3327, 'x\ny\nz'], [2373, 4573, '<c.yellow>Cue</c> text'], [1711, 1911, 'x\n'], [7573, 7573, '<c.yellow>Cue</c> text']], 10], [2, 5]), ('regression variant: speed threshold', [[[955, 1005, 'A'], [9350, 11350, 'abcd'], [864, 854, 'A\r\nB\r\nC'], [6216, 6716, 'Long line of dialogue here']], 20], [3, 4]), ('partial repair probe: speed threshold', [[[7027, 7527, 'Two\nlines'], [1204, 1851, 'Italic text'], [7529, 9059, 'Long line of dialogue here'], [3040, 3216, 'Red'], [5263, 5253, 'Two\r\nlines']], 17], [2, 4, 5]), ('partial repair variant: speed threshold', [[[2544, 2544, '  spaced  '], [4666, 4766, 'Hello'], [1260, 1250, ''], [1606, 1807, 'x\ny\nz']], 15], [1, 2]), ('boundary control', [[[0, 0, '']], 17], []), ('boundary control', [[[0, 500, 'a\r\nb']], 5], []), ('normal control', [[[4014, 4081, 'a'], [3684, 6684, 'Hi there']], 15], []), ('normal control', [[[8878, 9378, 'a'], [1695, 1990, 'x\ny\nz'], [8649, 8649, '<c.yellow>Cue</c> text'], [4805, 5334, 'Two\nlines']], 17], [3]), ('normal control', [[[3769, 4036, 'abcd']], 15], [])]]
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:
Cues exactly at the permitted reading speed are flagged.

For cues [start,end,text] return the 1-based indices whose reading speed exceeds max_cps. Tags <...> are removed, CRLF is treated as one line break, line breaks are not counted, all other characters (including spaces) count. The test is chars*1000 > max_cps*duration; a cue with duration <= 0 is flagged iff it has any counted character.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import re
N = 1
observations = []
def solve(cues, max_cps):
    flagged=[]
    for idx,(start,end,text) in enumerate(cues,1):
        visible=re.sub(r'<[^>]*>','',text)
        visible=visible.replace('\r\n','\n')
        chars=len(visible.replace('\n',''))
        dur=end-start
        if dur<=0:
            if chars>max_cps: flagged.append(idx)
            continue
        if chars*1000>max_cps*dur:
            flagged.append(idx)
    return flagged
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: zero duration rule', [[[0, 0, 'a']], 17], [1]), ('regression variant: zero duration rule', [[[7799, 7899, ''], [6867, 9867, 'Hello'], [1132, 1132, '<c.yellow>Cue</c> text'], [3310, 3310, 'a']], 17], [3, 4]), ('partial repair probe: zero duration rule', [[[6795, 6795, 'x\n']], 17], [1]), ('partial repair variant: zero duration rule', [[[7418, 10218, 'Red'], [2978, 3978, 'x\ny\nz'], [9027, 9828, 'Hi there'], [6361, 6361, 'x\n']], 10], [4]), ('boundary control', [[[0, 1000, 'abcdefghij']], 10], []), ('boundary control', [[[0, 0, '']], 17], []), ('normal control', [[[0, 500, 'a\r\nb']], 5], []), ('normal control', [[[839, 3839, 'I'], [4652, 6652, 'x\ny\nz']], 17], []), ('normal control', [[[1726, 1992, 'abcd'], [9258, 10258, 'A']], 15], [1])], [('regression: zero duration rule', [[[2569, 2769, 'A\r\nB\r\nC'], [1782, 1782, 'x\ny\nz']], 15], [2]), ('regression variant: zero duration rule', [[[1285, 1285, '<c.yellow>Cue</c> text'], [4496, 4596, 'A'], [6179, 6169, 'Hello']], 20], [1, 3]), ('partial repair probe: zero duration rule', [[[6795, 6795, 'x\n']], 17], [1]), ('partial repair variant: zero duration rule', [[[3245, 3446, 'x\n'], [8378, 8478, '<c.yellow>Cue</c> text'], [5335, 5335, 'a'], [744, 744, ''], [9295, 10095, 'Two\nlines']], 10], [2, 3]), ('boundary control', [[[0, 0, '']], 17], []), ('boundary control', [[[0, 500, 'a\r\nb']], 5], []), ('normal control', [[[7732, 8133, 'A'], [2534, 2634, 'Two\r\nlines']], 20], [2]), ('normal control', [[[5514, 5765, 'Hello']], 20], []), ('normal control', [[[893, 1893, '<c.yellow>Cue</c> text']], 10], [])], [('regression: zero duration rule', [[[8781, 9781, 'x\ny\nz'], [6605, 6664, 'x\n'], [733, 723, 'Red'], [2157, 2147, 'a']], 17], [3, 4]), ('regression variant: zero duration rule', [[[3439, 3939, 'abcd'], [7218, 9218, '<c.yellow>Cue</c> text'], [9347, 11347, 'Two\r\nlines'], [1314, 1314, 'A\r\nB\r\nC'], [1557, 3557, 'x\ny\nz']], 10], [4]), ('partial repair probe: zero duration rule', [[[5357, 5357, 'a']], 20], [1]), ('partial repair variant: zero duration rule', [[[2531, 2531, 'a'], [8471, 9137, '  spaced  '], [7985, 8651, 'Two\r\nlines'], [8197, 8197, 'Hello']], 15], [1, 2, 4]), ('boundary control', [[[0, 500, 'a\r\nb']], 5], []), ('boundary control', [[[0, 1000, 'abcdefghij']], 10], []), ('normal control', [[[540, 607, 'a'], [5643, 7643, 'Italic text']], 15], []), ('normal control', [[[7326, 7326, ''], [6999, 7058, 'a'], [7165, 7635, '<c.yellow>Cue</c> text'], [2882, 4882, 'abcd']], 17], [3]), ('normal control', [[[4903, 5303, 'Two\r\nlines'], [7669, 7920, 'Hello'], [9175, 12175, 'Two\nlines']], 20], [])], [('regression: zero duration rule', [[[1857, 1857, 'x\ny\nz']], 10], [1]), ('regression variant: zero duration rule', [[[5207, 5208, ''], [8379, 8879, '  spaced  '], [9114, 9365, 'x\ny\nz'], [2354, 2344, 'Hi there'], [3706, 3756, 'x\n']], 20], [4]), ('partial repair probe: zero duration rule', [[[7961, 7961, 'x\n'], [4865, 5399, 'Hi there'], [9675, 12675, ''], [2209, 3410, 'abcd'], [4016, 4116, 'abcd']], 15], [1, 5]), ('partial repair variant: zero duration rule', [[[4622, 4612, 'x\n']], 17], [1]), ('boundary control', [[[0, 1000, 'abcdefghij']], 10], []), ('boundary control', [[[0, 0, '']], 17], []), ('normal control', [[[4743, 5143, 'A'], [1982, 2982, 'Hi there'], [5318, 5468, 'Red'], [4990, 5140, 'Red'], [1465, 1965, 'A']], 20], []), ('normal control', [[[7253, 10253, '<c.yellow>Cue</c> text'], [7954, 8954, 'x\ny\nz'], [4376, 4476, 'x\ny\nz'], [5892, 6892, 'Hi there']], 15], [3]), ('normal control', [[[4014, 4081, 'a'], [3684, 6684, 'Hi there']], 15], [])], [('regression: zero duration rule', [[[2260, 3260, '  spaced  '], [770, 770, 'Red'], [4134, 4201, 'a'], [6488, 9488, '<c.yellow>Cue</c> text']], 15], [2]), ('regression variant: zero duration rule', [[[5029, 5019, 'abcd']], 20], [1]), ('partial repair probe: zero duration rule', [[[5112, 5760, 'Italic text'], [2636, 2931, 'Hello'], [1678, 1778, 'Two\r\nlines'], [6527, 6586, 'a'], [9403, 9403, 'x\n']], 17], [3, 5]), ('partial repair variant: zero duration rule', [[[629, 629, 'I'], [6687, 9687, 'abcd']], 10], [1]), ('boundary control', [[[0, 0, '']], 17], []), ('boundary control', [[[0, 500, 'a\r\nb']], 5], []), ('normal control', [[[7923, 7913, ''], [9749, 10249, 'I'], [364, 2364, 'x\n'], [2736, 3736, '  spaced  ']], 17], []), ('normal control', [[[3769, 4036, 'abcd']], 15], []), ('normal control', [[[4985, 5280, 'x\ny\nz'], [9931, 10402, 'Two\r\nlines'], [4982, 4982, 'Long line of dialogue here']], 17], [3])]]
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 re
N = 1
observations = []
def solve(cues, max_cps):
    flagged=[]
    for idx,(start,end,text) in enumerate(cues,1):
        visible=re.sub(r'<[^>]*>','',text)
        visible=visible.replace('\r\n','\n')
        chars=len(visible.replace('\n',''))
        dur=end-start
        if dur<=0:
            if chars>1: flagged.append(idx)
            continue
        if chars*1000>max_cps*dur:
            flagged.append(idx)
    return flagged
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: zero duration rule', [[[0, 0, 'a']], 17], [1]), ('regression variant: zero duration rule', [[[7799, 7899, ''], [6867, 9867, 'Hello'], [1132, 1132, '<c.yellow>Cue</c> text'], [3310, 3310, 'a']], 17], [3, 4]), ('partial repair probe: zero duration rule', [[[6795, 6795, 'x\n']], 17], [1]), ('partial repair variant: zero duration rule', [[[7418, 10218, 'Red'], [2978, 3978, 'x\ny\nz'], [9027, 9828, 'Hi there'], [6361, 6361, 'x\n']], 10], [4]), ('boundary control', [[[0, 1000, 'abcdefghij']], 10], []), ('boundary control', [[[0, 0, '']], 17], []), ('normal control', [[[0, 500, 'a\r\nb']], 5], []), ('normal control', [[[839, 3839, 'I'], [4652, 6652, 'x\ny\nz']], 17], []), ('normal control', [[[1726, 1992, 'abcd'], [9258, 10258, 'A']], 15], [1])], [('regression: zero duration rule', [[[2569, 2769, 'A\r\nB\r\nC'], [1782, 1782, 'x\ny\nz']], 15], [2]), ('regression variant: zero duration rule', [[[1285, 1285, '<c.yellow>Cue</c> text'], [4496, 4596, 'A'], [6179, 6169, 'Hello']], 20], [1, 3]), ('partial repair probe: zero duration rule', [[[6795, 6795, 'x\n']], 17], [1]), ('partial repair variant: zero duration rule', [[[3245, 3446, 'x\n'], [8378, 8478, '<c.yellow>Cue</c> text'], [5335, 5335, 'a'], [744, 744, ''], [9295, 10095, 'Two\nlines']], 10], [2, 3]), ('boundary control', [[[0, 0, '']], 17], []), ('boundary control', [[[0, 500, 'a\r\nb']], 5], []), ('normal control', [[[7732, 8133, 'A'], [2534, 2634, 'Two\r\nlines']], 20], [2]), ('normal control', [[[5514, 5765, 'Hello']], 20], []), ('normal control', [[[893, 1893, '<c.yellow>Cue</c> text']], 10], [])], [('regression: zero duration rule', [[[8781, 9781, 'x\ny\nz'], [6605, 6664, 'x\n'], [733, 723, 'Red'], [2157, 2147, 'a']], 17], [3, 4]), ('regression variant: zero duration rule', [[[3439, 3939, 'abcd'], [7218, 9218, '<c.yellow>Cue</c> text'], [9347, 11347, 'Two\r\nlines'], [1314, 1314, 'A\r\nB\r\nC'], [1557, 3557, 'x\ny\nz']], 10], [4]), ('partial repair probe: zero duration rule', [[[5357, 5357, 'a']], 20], [1]), ('partial repair variant: zero duration rule', [[[2531, 2531, 'a'], [8471, 9137, '  spaced  '], [7985, 8651, 'Two\r\nlines'], [8197, 8197, 'Hello']], 15], [1, 2, 4]), ('boundary control', [[[0, 500, 'a\r\nb']], 5], []), ('boundary control', [[[0, 1000, 'abcdefghij']], 10], []), ('normal control', [[[540, 607, 'a'], [5643, 7643, 'Italic text']], 15], []), ('normal control', [[[7326, 7326, ''], [6999, 7058, 'a'], [7165, 7635, '<c.yellow>Cue</c> text'], [2882, 4882, 'abcd']], 17], [3]), ('normal control', [[[4903, 5303, 'Two\r\nlines'], [7669, 7920, 'Hello'], [9175, 12175, 'Two\nlines']], 20], [])], [('regression: zero duration rule', [[[1857, 1857, 'x\ny\nz']], 10], [1]), ('regression variant: zero duration rule', [[[5207, 5208, ''], [8379, 8879, '  spaced  '], [9114, 9365, 'x\ny\nz'], [2354, 2344, 'Hi there'], [3706, 3756, 'x\n']], 20], [4]), ('partial repair probe: zero duration rule', [[[7961, 7961, 'x\n'], [4865, 5399, 'Hi there'], [9675, 12675, ''], [2209, 3410, 'abcd'], [4016, 4116, 'abcd']], 15], [1, 5]), ('partial repair variant: zero duration rule', [[[4622, 4612, 'x\n']], 17], [1]), ('boundary control', [[[0, 1000, 'abcdefghij']], 10], []), ('boundary control', [[[0, 0, '']], 17], []), ('normal control', [[[4743, 5143, 'A'], [1982, 2982, 'Hi there'], [5318, 5468, 'Red'], [4990, 5140, 'Red'], [1465, 1965, 'A']], 20], []), ('normal control', [[[7253, 10253, '<c.yellow>Cue</c> text'], [7954, 8954, 'x\ny\nz'], [4376, 4476, 'x\ny\nz'], [5892, 6892, 'Hi there']], 15], [3]), ('normal control', [[[4014, 4081, 'a'], [3684, 6684, 'Hi there']], 15], [])], [('regression: zero duration rule', [[[2260, 3260, '  spaced  '], [770, 770, 'Red'], [4134, 4201, 'a'], [6488, 9488, '<c.yellow>Cue</c> text']], 15], [2]), ('regression variant: zero duration rule', [[[5029, 5019, 'abcd']], 20], [1]), ('partial repair probe: zero duration rule', [[[5112, 5760, 'Italic text'], [2636, 2931, 'Hello'], [1678, 1778, 'Two\r\nlines'], [6527, 6586, 'a'], [9403, 9403, 'x\n']], 17], [3, 5]), ('partial repair variant: zero duration rule', [[[629, 629, 'I'], [6687, 9687, 'abcd']], 10], [1]), ('boundary control', [[[0, 0, '']], 17], []), ('boundary control', [[[0, 500, 'a\r\nb']], 5], []), ('normal control', [[[7923, 7913, ''], [9749, 10249, 'I'], [364, 2364, 'x\n'], [2736, 3736, '  spaced  ']], 17], []), ('normal control', [[[3769, 4036, 'abcd']], 15], []), ('normal control', [[[4985, 5280, 'x\ny\nz'], [9931, 10402, 'Two\r\nlines'], [4982, 4982, 'Long line of dialogue here']], 17], [3])]]
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:
Zero-length cues with a few characters are reported as readable.

For cues [start,end,text] return the 1-based indices whose reading speed exceeds max_cps. Tags <...> are removed, CRLF is treated as one line break, line breaks are not counted, all other characters (including spaces) count. The test is chars*1000 > max_cps*duration; a cue with duration <= 0 is flagged iff it has any counted character.

split: open-access


prompt:
Back-to-back cues climb to a second row instead of reusing the bottom row.

Assign overlapping cues to display rows. Cues are processed by (start, input index); a row is free at time t when the last cue placed there ended at or before t (end exclusive). Each cue takes the lowest free row, or opens a new row. Return the row of each cue in input order.

split: open-access


prompt:
Long cues that start first are pushed up by shorter later cues.

Assign overlapping cues to display rows. Cues are processed by (start, input index); a row is free at time t when the last cue placed there ended at or before t (end exclusive). Each cue takes the lowest free row, or opens a new row. Return the row of each cue in input order.

split: open-access


prompt:
Free bottom rows stay empty while captions sit high on screen.

Assign overlapping cues to display rows. Cues are processed by (start, input index); a row is free at time t when the last cue placed there ended at or before t (end exclusive). Each cue takes the lowest free row, or opens a new row. Return the row of each cue in input order.

split: open-access


prompt:
Reused rows receive overlapping cues.

Assign overlapping cues to display rows. Cues are processed by (start, input index); a row is free at time t when the last cue placed there ended at or before t (end exclusive). Each cue takes the lowest free row, or opens a new row. Return the row of each cue in input order.

split: open-access


prompt:
Newly opened rows get the index of the last cue slot rather than the new row.

Assign overlapping cues to display rows. Cues are processed by (start, input index); a row is free at time t when the last cue placed there ended at or before t (end exclusive). Each cue takes the lowest free row, or opens a new row. Return the row of each cue in input order.

split: open-access


prompt:
Subtitles drift in the wrong direction the further they are from the first anchor.

anchors [[a1,b1],[a2,b2]] (a1 != a2, b1 != b2) map subtitle time a to video time b linearly through both points. Each time is mapped exactly, rounded half up, clamped at 0; cues whose mapped end is not after the mapped start are dropped.

split: open-access


prompt:
Mapped cues are offset by a constant error unless the first anchor sits at time zero.

anchors [[a1,b1],[a2,b2]] (a1 != a2, b1 != b2) map subtitle time a to video time b linearly through both points. Each time is mapped exactly, rounded half up, clamped at 0; cues whose mapped end is not after the mapped start are dropped.

split: open-access


prompt:
Mapped times with half-millisecond or larger fractions are one millisecond early.

anchors [[a1,b1],[a2,b2]] (a1 != a2, b1 != b2) map subtitle time a to video time b linearly through both points. Each time is mapped exactly, rounded half up, clamped at 0; cues whose mapped end is not after the mapped start are dropped.

split: open-access


prompt:
Cues mapped before the start of the video carry negative timestamps.

anchors [[a1,b1],[a2,b2]] (a1 != a2, b1 != b2) map subtitle time a to video time b linearly through both points. Each time is mapped exactly, rounded half up, clamped at 0; cues whose mapped end is not after the mapped start are dropped.

split: open-access


prompt:
Cues squeezed to zero length by the mapping remain in the output.

anchors [[a1,b1],[a2,b2]] (a1 != a2, b1 != b2) map subtitle time a to video time b linearly through both points. Each time is mapped exactly, rounded half up, clamped at 0; cues whose mapped end is not after the mapped start are dropped.

split: open-access


prompt:
Repeated lines that differ only by a trailing space are shown as separate flickering cues.

Walk cues [start,end,text] in order. Text is normalized by collapsing whitespace runs to single spaces and trimming. A cue whose normalized text is nonempty and equal to the previous output cue text, starting at most max_gap after that cue ends (overlaps included), is merged: the output end becomes the later of the two ends. Output cues carry normalized text.

split: open-access


prompt:
Duplicates separated by exactly the allowed gap are not merged.

Walk cues [start,end,text] in order. Text is normalized by collapsing whitespace runs to single spaces and trimming. A cue whose normalized text is nonempty and equal to the previous output cue text, starting at most max_gap after that cue ends (overlaps included), is merged: the output end becomes the later of the two ends. Output cues carry normalized text.

split: open-access


prompt:
Merged duplicates appear twice: once extended and once as the original repeat.

Walk cues [start,end,text] in order. Text is normalized by collapsing whitespace runs to single spaces and trimming. A cue whose normalized text is nonempty and equal to the previous output cue text, starting at most max_gap after that cue ends (overlaps included), is merged: the output end becomes the later of the two ends. Output cues carry normalized text.

split: open-access


prompt:
Output cues keep irregular whitespace and later duplicates fail to merge with them.

Walk cues [start,end,text] in order. Text is normalized by collapsing whitespace runs to single spaces and trimming. A cue whose normalized text is nonempty and equal to the previous output cue text, starting at most max_gap after that cue ends (overlaps included), is merged: the output end becomes the later of the two ends. Output cues carry normalized text.

split: open-access


prompt:
Consecutive blank spacer cues are fused into one long empty cue.

Walk cues [start,end,text] in order. Text is normalized by collapsing whitespace runs to single spaces and trimming. A cue whose normalized text is nonempty and equal to the previous output cue text, starting at most max_gap after that cue ends (overlaps included), is merged: the output end becomes the later of the two ends. Output cues carry normalized text.

split: open-access


prompt:
Empty fragments become zero-length cues.

Split cue [start,end] into len(parts) consecutive cues. Each part weighs max(1, len(part.strip())). Boundary after part k is start + floor(dur * cumulative_weight_k / total_weight); pieces are contiguous and the last ends at end. Output [s,e,part.strip()].

split: open-access


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

N = 1
observations = []
def solve(cue, parts):
    start,end=cue
    w=[max(1,len(p.strip())) for p in parts]
    total=sum(w)
    dur=end-start
    out=[]
    acc=0
    prev=start
    for p,x in zip(parts,w):
        acc=x
        b=start+dur*acc//total
        out.append([prev,b,p.strip()])
        prev=b
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: cumulative weight', [[0, 1000], ['ab', 'cd']], [[0, 500, 'ab'], [500, 1000, 'cd']]), ('regression variant: cumulative weight', [[1000, 1007], ['a', 'xyz', 'friend', 'a']], [[1000, 1000, 'a'], [1000, 1002, 'xyz'], [1002, 1006, 'friend'], [1006, 1007, 'a']]), ('partial repair probe: cumulative weight', [[0, 100], ['friend', 'ok ', 'ok ']], [[0, 60, 'friend'], [60, 80, 'ok'], [80, 100, 'ok']]), ('partial repair variant: cumulative weight', [[1000, 1100], [' there ', 'ok ', 'Longer chunk of text']], [[1000, 1018, 'there'], [1018, 1025, 'ok'], [1025, 1100, 'Longer chunk of text']]), ('normal control', [[0, 2500], ['xyz']], [[0, 2500, 'xyz']]), ('normal control', [[1000, 1999], ['friend']], [[1000, 1999, 'friend']]), ('normal control', [[0, 3001], ['a']], [[0, 3001, 'a']])], [('regression: cumulative weight', [[0, 1000], ['a', '']], [[0, 500, 'a'], [500, 1000, '']]), ('regression variant: cumulative weight', [[1000, 1999], ['Longer chunk of text', 'xyz']], [[1000, 1868, 'Longer chunk of text'], [1868, 1999, 'xyz']]), ('partial repair probe: cumulative weight', [[0, 7], [' there ']], [[0, 7, 'there']]), ('partial repair variant: cumulative weight', [[1000, 1999], ['  ']], [[1000, 1999, '']]), ('normal control', [[12345, 15346], ['Hello']], [[12345, 15346, 'Hello']]), ('normal control', [[12345, 13345], ['xyz']], [[12345, 13345, 'xyz']]), ('normal control', [[12345, 13345], ['friend']], [[12345, 13345, 'friend']])], [('regression: cumulative weight', [[0, 7], ['abc', 'de', 'f']], [[0, 3, 'abc'], [3, 5, 'de'], [5, 7, 'f']]), ('regression variant: cumulative weight', [[0, 100], ['friend', 'ok ', 'ok ']], [[0, 60, 'friend'], [60, 80, 'ok'], [80, 100, 'ok']]), ('partial repair probe: cumulative weight', [[0, 3001], ['ok ', ' there ']], [[0, 857, 'ok'], [857, 3001, 'there']]), ('partial repair variant: cumulative weight', [[1000, 4001], ['friend', 'a', ' there ', 'a']], [[1000, 2385, 'friend'], [2385, 2615, 'a'], [2615, 3770, 'there'], [3770, 4001, 'a']]), ('normal control', [[1000, 1007], ['friend']], [[1000, 1007, 'friend']]), ('normal control', [[0, 1000], ['Longer chunk of text']], [[0, 1000, 'Longer chunk of text']]), ('normal control', [[12345, 15346], ['xyz']], [[12345, 15346, 'xyz']])], [('regression: cumulative weight', [[100, 1100], [' x ', 'y']], [[100, 600, 'x'], [600, 1100, 'y']]), ('regression variant: cumulative weight', [[0, 3001], ['ok ', ' there ']], [[0, 857, 'ok'], [857, 3001, 'there']]), ('partial repair probe: cumulative weight', [[1000, 1999], ['ok ', 'Hello']], [[1000, 1285, 'ok'], [1285, 1999, 'Hello']]), ('partial repair variant: cumulative weight', [[0, 7], ['  ', 'ok ', '  ', 'ok ']], [[0, 1, ''], [1, 3, 'ok'], [3, 4, ''], [4, 7, 'ok']]), ('normal control', [[1000, 3500], ['a']], [[1000, 3500, 'a']]), ('normal control', [[12345, 12352], ['a']], [[12345, 12352, 'a']]), ('normal control', [[12345, 12352], ['Longer chunk of text']], [[12345, 12352, 'Longer chunk of text']])], [('regression: cumulative weight', [[0, 7], ['friend', 'Hello', 'ok ']], [[0, 3, 'friend'], [3, 5, 'Hello'], [5, 7, 'ok']]), ('regression variant: cumulative weight', [[1000, 1999], ['ok ', 'Hello']], [[1000, 1285, 'ok'], [1285, 1999, 'Hello']]), ('partial repair probe: cumulative weight', [[1000, 1999], ['ok ', '  ', 'friend', 'ok ']], [[1000, 1181, 'ok'], [1181, 1272, ''], [1272, 1817, 'friend'], [1817, 1999, 'ok']]), ('partial repair variant: cumulative weight', [[1000, 2000], ['ok ', '', '']], [[1000, 1500, 'ok'], [1500, 1750, ''], [1750, 2000, '']]), ('normal control', [[12345, 13345], ['Hello']], [[12345, 13345, 'Hello']]), ('normal control', [[12345, 15346], ['friend']], [[12345, 15346, 'friend']]), ('normal control', [[0, 100], ['Hello']], [[0, 100, 'Hello']])]]
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(cue, parts):
    start,end=cue
    w=[max(1,len(p.strip())) for p in parts]
    total=sum(w)
    dur=end-start
    out=[]
    acc=0
    prev=start
    for p,x in zip(parts,w):
        acc+=len(p)
        b=start+dur*acc//total
        out.append([prev,b,p.strip()])
        prev=b
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: cumulative weight', [[0, 1000], ['ab', 'cd']], [[0, 500, 'ab'], [500, 1000, 'cd']]), ('regression variant: cumulative weight', [[1000, 1007], ['a', 'xyz', 'friend', 'a']], [[1000, 1000, 'a'], [1000, 1002, 'xyz'], [1002, 1006, 'friend'], [1006, 1007, 'a']]), ('partial repair probe: cumulative weight', [[0, 100], ['friend', 'ok ', 'ok ']], [[0, 60, 'friend'], [60, 80, 'ok'], [80, 100, 'ok']]), ('partial repair variant: cumulative weight', [[1000, 1100], [' there ', 'ok ', 'Longer chunk of text']], [[1000, 1018, 'there'], [1018, 1025, 'ok'], [1025, 1100, 'Longer chunk of text']]), ('normal control', [[0, 2500], ['xyz']], [[0, 2500, 'xyz']]), ('normal control', [[1000, 1999], ['friend']], [[1000, 1999, 'friend']]), ('normal control', [[0, 3001], ['a']], [[0, 3001, 'a']])], [('regression: cumulative weight', [[0, 1000], ['a', '']], [[0, 500, 'a'], [500, 1000, '']]), ('regression variant: cumulative weight', [[1000, 1999], ['Longer chunk of text', 'xyz']], [[1000, 1868, 'Longer chunk of text'], [1868, 1999, 'xyz']]), ('partial repair probe: cumulative weight', [[0, 7], [' there ']], [[0, 7, 'there']]), ('partial repair variant: cumulative weight', [[1000, 1999], ['  ']], [[1000, 1999, '']]), ('normal control', [[12345, 15346], ['Hello']], [[12345, 15346, 'Hello']]), ('normal control', [[12345, 13345], ['xyz']], [[12345, 13345, 'xyz']]), ('normal control', [[12345, 13345], ['friend']], [[12345, 13345, 'friend']])], [('regression: cumulative weight', [[0, 7], ['abc', 'de', 'f']], [[0, 3, 'abc'], [3, 5, 'de'], [5, 7, 'f']]), ('regression variant: cumulative weight', [[0, 100], ['friend', 'ok ', 'ok ']], [[0, 60, 'friend'], [60, 80, 'ok'], [80, 100, 'ok']]), ('partial repair probe: cumulative weight', [[0, 3001], ['ok ', ' there ']], [[0, 857, 'ok'], [857, 3001, 'there']]), ('partial repair variant: cumulative weight', [[1000, 4001], ['friend', 'a', ' there ', 'a']], [[1000, 2385, 'friend'], [2385, 2615, 'a'], [2615, 3770, 'there'], [3770, 4001, 'a']]), ('normal control', [[1000, 1007], ['friend']], [[1000, 1007, 'friend']]), ('normal control', [[0, 1000], ['Longer chunk of text']], [[0, 1000, 'Longer chunk of text']]), ('normal control', [[12345, 15346], ['xyz']], [[12345, 15346, 'xyz']])], [('regression: cumulative weight', [[100, 1100], [' x ', 'y']], [[100, 600, 'x'], [600, 1100, 'y']]), ('regression variant: cumulative weight', [[0, 3001], ['ok ', ' there ']], [[0, 857, 'ok'], [857, 3001, 'there']]), ('partial repair probe: cumulative weight', [[1000, 1999], ['ok ', 'Hello']], [[1000, 1285, 'ok'], [1285, 1999, 'Hello']]), ('partial repair variant: cumulative weight', [[0, 7], ['  ', 'ok ', '  ', 'ok ']], [[0, 1, ''], [1, 3, 'ok'], [3, 4, ''], [4, 7, 'ok']]), ('normal control', [[1000, 3500], ['a']], [[1000, 3500, 'a']]), ('normal control', [[12345, 12352], ['a']], [[12345, 12352, 'a']]), ('normal control', [[12345, 12352], ['Longer chunk of text']], [[12345, 12352, 'Longer chunk of text']])], [('regression: cumulative weight', [[0, 7], ['friend', 'Hello', 'ok ']], [[0, 3, 'friend'], [3, 5, 'Hello'], [5, 7, 'ok']]), ('regression variant: cumulative weight', [[1000, 1999], ['ok ', 'Hello']], [[1000, 1285, 'ok'], [1285, 1999, 'Hello']]), ('partial repair probe: cumulative weight', [[1000, 1999], ['ok ', '  ', 'friend', 'ok ']], [[1000, 1181, 'ok'], [1181, 1272, ''], [1272, 1817, 'friend'], [1817, 1999, 'ok']]), ('partial repair variant: cumulative weight', [[1000, 2000], ['ok ', '', '']], [[1000, 1500, 'ok'], [1500, 1750, ''], [1750, 2000, '']]), ('normal control', [[12345, 13345], ['Hello']], [[12345, 13345, 'Hello']]), ('normal control', [[12345, 15346], ['friend']], [[12345, 15346, 'friend']]), ('normal control', [[0, 100], ['Hello']], [[0, 100, 'Hello']])]]
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:
Split pieces overlap and the final piece does not end at the cue end.

Split cue [start,end] into len(parts) consecutive cues. Each part weighs max(1, len(part.strip())). Boundary after part k is start + floor(dur * cumulative_weight_k / total_weight); pieces are contiguous and the last ends at end. Output [s,e,part.strip()].

split: open-access


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

N = 1
observations = []
def solve(cue, parts):
    start,end=cue
    w=[max(1,len(p.strip())) for p in parts]
    total=sum(w)
    dur=end-start
    out=[]
    acc=0
    prev=start
    for p,x in zip(parts,w):
        acc+=x
        b=start+dur//total*acc
        out.append([prev,b,p.strip()])
        prev=b
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: boundary arithmetic', [[0, 7], ['abc', 'de', 'f']], [[0, 3, 'abc'], [3, 5, 'de'], [5, 7, 'f']]), ('regression variant: boundary arithmetic', [[1000, 1999], ['Longer chunk of text', 'xyz']], [[1000, 1868, 'Longer chunk of text'], [1868, 1999, 'xyz']]), ('partial repair probe: boundary arithmetic', [[1000, 1007], ['a', 'xyz', 'friend', 'a']], [[1000, 1000, 'a'], [1000, 1002, 'xyz'], [1002, 1006, 'friend'], [1006, 1007, 'a']]), ('partial repair variant: boundary arithmetic', [[0, 7], ['  ', 'ok ', '  ', 'ok ']], [[0, 1, ''], [1, 3, 'ok'], [3, 4, ''], [4, 7, 'ok']]), ('boundary control', [[0, 1000], ['ab', 'cd']], [[0, 500, 'ab'], [500, 1000, 'cd']]), ('boundary control', [[0, 1000], ['a', '']], [[0, 500, 'a'], [500, 1000, '']]), ('normal control', [[100, 1100], [' x ', 'y']], [[100, 600, 'x'], [600, 1100, 'y']]), ('normal control', [[0, 100], ['friend', 'ok ', 'ok ']], [[0, 60, 'friend'], [60, 80, 'ok'], [80, 100, 'ok']]), ('normal control', [[12345, 12352], ['  ']], [[12345, 12352, '']])], [('regression: boundary arithmetic', [[0, 2500], ['xyz']], [[0, 2500, 'xyz']]), ('regression variant: boundary arithmetic', [[0, 7], [' there ']], [[0, 7, 'there']]), ('partial repair probe: boundary arithmetic', [[1000, 1999], ['Longer chunk of text', 'xyz']], [[1000, 1868, 'Longer chunk of text'], [1868, 1999, 'xyz']]), ('partial repair variant: boundary arithmetic', [[1000, 3500], ['a', 'ok ', 'Longer chunk of text']], [[1000, 1108, 'a'], [1108, 1326, 'ok'], [1326, 3500, 'Longer chunk of text']]), ('boundary control', [[0, 1000], ['a', '']], [[0, 500, 'a'], [500, 1000, '']]), ('boundary control', [[100, 1100], [' x ', 'y']], [[100, 600, 'x'], [600, 1100, 'y']]), ('normal control', [[1000, 2000], ['ok ', '', '']], [[1000, 1500, 'ok'], [1500, 1750, ''], [1750, 2000, '']]), ('normal control', [[0, 2500], ['', 'ok ', '']], [[0, 625, ''], [625, 1875, 'ok'], [1875, 2500, '']]), ('normal control', [[1000, 1999], ['xyz', 'friend']], [[1000, 1333, 'xyz'], [1333, 1999, 'friend']])], [('regression: boundary arithmetic', [[1000, 1007], ['xyz']], [[1000, 1007, 'xyz']]), ('regression variant: boundary arithmetic', [[0, 3001], ['ok ', ' there ']], [[0, 857, 'ok'], [857, 3001, 'there']]), ('partial repair probe: boundary arithmetic', [[1000, 1999], ['ok ', '  ', 'friend', 'ok ']], [[1000, 1181, 'ok'], [1181, 1272, ''], [1272, 1817, 'friend'], [1817, 1999, 'ok']]), ('partial repair variant: boundary arithmetic', [[1000, 4001], ['a', ' there ', ' there ', 'a']], [[1000, 1250, 'a'], [1250, 2500, 'there'], [2500, 3750, 'there'], [3750, 4001, 'a']]), ('boundary control', [[100, 1100], [' x ', 'y']], [[100, 600, 'x'], [600, 1100, 'y']]), ('boundary control', [[0, 1000], ['ab', 'cd']], [[0, 500, 'ab'], [500, 1000, 'cd']]), ('normal control', [[1000, 3500], ['Hello']], [[1000, 3500, 'Hello']]), ('normal control', [[12345, 12352], ['']], [[12345, 12352, '']]), ('normal control', [[12345, 12445], ['a']], [[12345, 12445, 'a']])], [('regression: boundary arithmetic', [[0, 7], ['friend', 'Hello', 'ok ']], [[0, 3, 'friend'], [3, 5, 'Hello'], [5, 7, 'ok']]), ('regression variant: boundary arithmetic', [[1000, 1999], ['ok ', 'Hello']], [[1000, 1285, 'ok'], [1285, 1999, 'Hello']]), ('partial repair probe: boundary arithmetic', [[12345, 13344], ['ok ', 'ok ', '  ']], [[12345, 12744, 'ok'], [12744, 13144, 'ok'], [13144, 13344, '']]), ('partial repair variant: boundary arithmetic', [[12345, 14845], ['  ', '  ', '  ']], [[12345, 13178, ''], [13178, 14011, ''], [14011, 14845, '']]), ('boundary control', [[0, 1000], ['ab', 'cd']], [[0, 500, 'ab'], [500, 1000, 'cd']]), ('boundary control', [[0, 1000], ['a', '']], [[0, 500, 'a'], [500, 1000, '']]), ('normal control', [[12345, 12445], ['xyz', '  ']], [[12345, 12420, 'xyz'], [12420, 12445, '']]), ('normal control', [[0, 7], ['xyz', 'xyz', '  ']], [[0, 3, 'xyz'], [3, 6, 'xyz'], [6, 7, '']]), ('normal control', [[1000, 1999], ['ok ', '  ']], [[1000, 1666, 'ok'], [1666, 1999, '']])], [('regression: boundary arithmetic', [[1000, 1007], ['a', 'xyz', 'friend', 'a']], [[1000, 1000, 'a'], [1000, 1002, 'xyz'], [1002, 1006, 'friend'], [1006, 1007, 'a']]), ('regression variant: boundary arithmetic', [[1000, 1999], ['ok ', '  ', 'friend', 'ok ']], [[1000, 1181, 'ok'], [1181, 1272, ''], [1272, 1817, 'friend'], [1817, 1999, 'ok']]), ('partial repair probe: boundary arithmetic', [[1000, 1100], [' there ', 'ok ', 'Longer chunk of text']], [[1000, 1018, 'there'], [1018, 1025, 'ok'], [1025, 1100, 'Longer chunk of text']]), ('partial repair variant: boundary arithmetic', [[12345, 12445], ['xyz', 'xyz', ' there ', '']], [[12345, 12370, 'xyz'], [12370, 12395, 'xyz'], [12395, 12436, 'there'], [12436, 12445, '']]), ('boundary control', [[0, 1000], ['a', '']], [[0, 500, 'a'], [500, 1000, '']]), ('boundary control', [[100, 1100], [' x ', 'y']], [[100, 600, 'x'], [600, 1100, 'y']]), ('normal control', [[12345, 13345], ['  ']], [[12345, 13345, '']]), ('normal control', [[12345, 12352], ['Hello', 'ok ']], [[12345, 12350, 'Hello'], [12350, 12352, 'ok']]), ('normal control', [[0, 1000], ['Longer chunk of text', 'Longer chunk of text']], [[0, 500, 'Longer chunk of text'], [500, 1000, 'Longer chunk of text']])]]
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(cue, parts):
    start,end=cue
    w=[max(1,len(p.strip())) for p in parts]
    total=sum(w)
    dur=end-start
    out=[]
    acc=0
    prev=start
    for p,x in zip(parts,w):
        acc+=x
        b=start+round(dur*acc/total)
        out.append([prev,b,p.strip()])
        prev=b
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: boundary arithmetic', [[0, 7], ['abc', 'de', 'f']], [[0, 3, 'abc'], [3, 5, 'de'], [5, 7, 'f']]), ('regression variant: boundary arithmetic', [[1000, 1999], ['Longer chunk of text', 'xyz']], [[1000, 1868, 'Longer chunk of text'], [1868, 1999, 'xyz']]), ('partial repair probe: boundary arithmetic', [[1000, 1007], ['a', 'xyz', 'friend', 'a']], [[1000, 1000, 'a'], [1000, 1002, 'xyz'], [1002, 1006, 'friend'], [1006, 1007, 'a']]), ('partial repair variant: boundary arithmetic', [[0, 7], ['  ', 'ok ', '  ', 'ok ']], [[0, 1, ''], [1, 3, 'ok'], [3, 4, ''], [4, 7, 'ok']]), ('boundary control', [[0, 1000], ['ab', 'cd']], [[0, 500, 'ab'], [500, 1000, 'cd']]), ('boundary control', [[0, 1000], ['a', '']], [[0, 500, 'a'], [500, 1000, '']]), ('normal control', [[100, 1100], [' x ', 'y']], [[100, 600, 'x'], [600, 1100, 'y']]), ('normal control', [[0, 100], ['friend', 'ok ', 'ok ']], [[0, 60, 'friend'], [60, 80, 'ok'], [80, 100, 'ok']]), ('normal control', [[12345, 12352], ['  ']], [[12345, 12352, '']])], [('regression: boundary arithmetic', [[0, 2500], ['xyz']], [[0, 2500, 'xyz']]), ('regression variant: boundary arithmetic', [[0, 7], [' there ']], [[0, 7, 'there']]), ('partial repair probe: boundary arithmetic', [[1000, 1999], ['Longer chunk of text', 'xyz']], [[1000, 1868, 'Longer chunk of text'], [1868, 1999, 'xyz']]), ('partial repair variant: boundary arithmetic', [[1000, 3500], ['a', 'ok ', 'Longer chunk of text']], [[1000, 1108, 'a'], [1108, 1326, 'ok'], [1326, 3500, 'Longer chunk of text']]), ('boundary control', [[0, 1000], ['a', '']], [[0, 500, 'a'], [500, 1000, '']]), ('boundary control', [[100, 1100], [' x ', 'y']], [[100, 600, 'x'], [600, 1100, 'y']]), ('normal control', [[1000, 2000], ['ok ', '', '']], [[1000, 1500, 'ok'], [1500, 1750, ''], [1750, 2000, '']]), ('normal control', [[0, 2500], ['', 'ok ', '']], [[0, 625, ''], [625, 1875, 'ok'], [1875, 2500, '']]), ('normal control', [[1000, 1999], ['xyz', 'friend']], [[1000, 1333, 'xyz'], [1333, 1999, 'friend']])], [('regression: boundary arithmetic', [[1000, 1007], ['xyz']], [[1000, 1007, 'xyz']]), ('regression variant: boundary arithmetic', [[0, 3001], ['ok ', ' there ']], [[0, 857, 'ok'], [857, 3001, 'there']]), ('partial repair probe: boundary arithmetic', [[1000, 1999], ['ok ', '  ', 'friend', 'ok ']], [[1000, 1181, 'ok'], [1181, 1272, ''], [1272, 1817, 'friend'], [1817, 1999, 'ok']]), ('partial repair variant: boundary arithmetic', [[1000, 4001], ['a', ' there ', ' there ', 'a']], [[1000, 1250, 'a'], [1250, 2500, 'there'], [2500, 3750, 'there'], [3750, 4001, 'a']]), ('boundary control', [[100, 1100], [' x ', 'y']], [[100, 600, 'x'], [600, 1100, 'y']]), ('boundary control', [[0, 1000], ['ab', 'cd']], [[0, 500, 'ab'], [500, 1000, 'cd']]), ('normal control', [[1000, 3500], ['Hello']], [[1000, 3500, 'Hello']]), ('normal control', [[12345, 12352], ['']], [[12345, 12352, '']]), ('normal control', [[12345, 12445], ['a']], [[12345, 12445, 'a']])], [('regression: boundary arithmetic', [[0, 7], ['friend', 'Hello', 'ok ']], [[0, 3, 'friend'], [3, 5, 'Hello'], [5, 7, 'ok']]), ('regression variant: boundary arithmetic', [[1000, 1999], ['ok ', 'Hello']], [[1000, 1285, 'ok'], [1285, 1999, 'Hello']]), ('partial repair probe: boundary arithmetic', [[12345, 13344], ['ok ', 'ok ', '  ']], [[12345, 12744, 'ok'], [12744, 13144, 'ok'], [13144, 13344, '']]), ('partial repair variant: boundary arithmetic', [[12345, 14845], ['  ', '  ', '  ']], [[12345, 13178, ''], [13178, 14011, ''], [14011, 14845, '']]), ('boundary control', [[0, 1000], ['ab', 'cd']], [[0, 500, 'ab'], [500, 1000, 'cd']]), ('boundary control', [[0, 1000], ['a', '']], [[0, 500, 'a'], [500, 1000, '']]), ('normal control', [[12345, 12445], ['xyz', '  ']], [[12345, 12420, 'xyz'], [12420, 12445, '']]), ('normal control', [[0, 7], ['xyz', 'xyz', '  ']], [[0, 3, 'xyz'], [3, 6, 'xyz'], [6, 7, '']]), ('normal control', [[1000, 1999], ['ok ', '  ']], [[1000, 1666, 'ok'], [1666, 1999, '']])], [('regression: boundary arithmetic', [[1000, 1007], ['a', 'xyz', 'friend', 'a']], [[1000, 1000, 'a'], [1000, 1002, 'xyz'], [1002, 1006, 'friend'], [1006, 1007, 'a']]), ('regression variant: boundary arithmetic', [[1000, 1999], ['ok ', '  ', 'friend', 'ok ']], [[1000, 1181, 'ok'], [1181, 1272, ''], [1272, 1817, 'friend'], [1817, 1999, 'ok']]), ('partial repair probe: boundary arithmetic', [[1000, 1100], [' there ', 'ok ', 'Longer chunk of text']], [[1000, 1018, 'there'], [1018, 1025, 'ok'], [1025, 1100, 'Longer chunk of text']]), ('partial repair variant: boundary arithmetic', [[12345, 12445], ['xyz', 'xyz', ' there ', '']], [[12345, 12370, 'xyz'], [12370, 12395, 'xyz'], [12395, 12436, 'there'], [12436, 12445, '']]), ('boundary control', [[0, 1000], ['a', '']], [[0, 500, 'a'], [500, 1000, '']]), ('boundary control', [[100, 1100], [' x ', 'y']], [[100, 600, 'x'], [600, 1100, 'y']]), ('normal control', [[12345, 13345], ['  ']], [[12345, 13345, '']]), ('normal control', [[12345, 12352], ['Hello', 'ok ']], [[12345, 12350, 'Hello'], [12350, 12352, 'ok']]), ('normal control', [[0, 1000], ['Longer chunk of text', 'Longer chunk of text']], [[0, 500, 'Longer chunk of text'], [500, 1000, 'Longer chunk of text']])]]
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 last split piece ends before the original cue end.

Split cue [start,end] into len(parts) consecutive cues. Each part weighs max(1, len(part.strip())). Boundary after part k is start + floor(dur * cumulative_weight_k / total_weight); pieces are contiguous and the last ends at end. Output [s,e,part.strip()].

split: open-access


prompt:
Split pieces are separated by one-millisecond holes.

Split cue [start,end] into len(parts) consecutive cues. Each part weighs max(1, len(part.strip())). Boundary after part k is start + floor(dur * cumulative_weight_k / total_weight); pieces are contiguous and the last ends at end. Output [s,e,part.strip()].

split: open-access


prompt:
Split pieces show stray leading and trailing spaces.

Split cue [start,end] into len(parts) consecutive cues. Each part weighs max(1, len(part.strip())). Boundary after part k is start + floor(dur * cumulative_weight_k / total_weight); pieces are contiguous and the last ends at end. Output [s,e,part.strip()].

split: open-access


prompt:
Boundaries exactly one window away from a cut are left unsnapped.

For each cue, the start snaps to the nearest shot change within window ms (|shot - start| <= window; ties go to the earlier shot). The end snaps so that it sits gap ms before the nearest shot change within window of end+gap. If snapping leaves end <= start, the original cue is kept unchanged.

split: open-access


prompt:
Boundaries snap to the first cut in range even when a closer cut exists.

For each cue, the start snaps to the nearest shot change within window ms (|shot - start| <= window; ties go to the earlier shot). The end snaps so that it sits gap ms before the nearest shot change within window of end+gap. If snapping leaves end <= start, the original cue is kept unchanged.

split: open-access


prompt:
Cue ends near a cut are snapped against the wrong reference point.

For each cue, the start snaps to the nearest shot change within window ms (|shot - start| <= window; ties go to the earlier shot). The end snaps so that it sits gap ms before the nearest shot change within window of end+gap. If snapping leaves end <= start, the original cue is kept unchanged.

split: open-access


prompt:
Snapped cues remain on screen across the shot change.

For each cue, the start snaps to the nearest shot change within window ms (|shot - start| <= window; ties go to the earlier shot). The end snaps so that it sits gap ms before the nearest shot change within window of end+gap. If snapping leaves end <= start, the original cue is kept unchanged.

split: open-access


prompt:
Short cues between two nearby cuts collapse to zero length.

For each cue, the start snaps to the nearest shot change within window ms (|shot - start| <= window; ties go to the earlier shot). The end snaps so that it sits gap ms before the nearest shot change within window of end+gap. If snapping leaves end <= start, the original cue is kept unchanged.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import re
N = 1
observations = []
def solve(line):
    parts=line.split()
    if len(parts)<3 or parts[1]!='-->':
        return None
    def ts(x):
        m=re.fullmatch(r'(?:(\d{2}):)?(\d{2}):(\d{2})\.(\d{3})',x)
        if not m:
            return None
        h,mi,se,f=m.groups()
        if int(mi)>59 or int(se)>59:
            return None
        return int(h or 0)*3600000+int(mi)*60000+int(se)*1000+int(f)
    a=ts(parts[0]); b=ts(parts[2])
    if a is None or b is None or b<=a:
        return None
    return [a,b,' '.join(parts[3:])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: hour digit count', ['100:00:00.000 --> 100:00:01.000 align:start'], [360000000, 360001000, 'align:start']), ('regression variant: hour digit count', ['00:00:00.500 --> 100:01:00.000 align:start'], [500, 360060000, 'align:start']), ('partial repair probe: hour digit count', ['59:09.999 --> 100:00:00.000'], [3549999, 360000000, '']), ('partial repair variant: hour digit count', ['01:00:00.999 --> 100:00:00.000 size:50% align:end'], [3600999, 360000000, 'size:50% align:end']), ('boundary control', ['00:01.000 --> 00:02.000'], [1000, 2000, '']), ('boundary control', ['00:01.000 --> 00:01.000'], None), ('normal control', ['00:59.999 --> 01:00.000 line:0 size:50%'], [59999, 60000, 'line:0 size:50%']), ('normal control', ['59:09.5 --> 00:02.000 align:start'], None), ('normal control', ['100:01:60,500 --> 00:00:60.5 align:start'], None)], [('regression: hour digit count', ['01:00:00.999 --> 100:00:00.000 size:50% align:end'], [3600999, 360000000, 'size:50% align:end']), ('regression variant: hour digit count', ['00:59.500 --> 100:00:00.000 line:0 position:10%'], [59500, 360000000, 'line:0 position:10%']), ('partial repair probe: hour digit count', ['00:01:09.500 --> 100:00:00.000 line:0 position:10%'], [69500, 360000000, 'line:0 position:10%']), ('partial repair variant: hour digit count', ['59:09.999 --> 100:00:00.000'], [3549999, 360000000, '']), ('boundary control', ['00:01.000 --> 00:01.000'], None), ('boundary control', ['00:59.999 --> 01:00.000 line:0 size:50%'], [59999, 60000, 'line:0 size:50%']), ('normal control', ['00:5:00.000 -> 00:5:00.000'], None), ('normal control', ['01:01:09.5 --> 60:09.5 size:50% align:end'], None), ('normal control', ['01:60:59.999 --> 00:00.001 line:0 position:10%'], None)], [('regression: hour digit count', ['59:09.999 --> 100:00:00.000'], [3549999, 360000000, '']), ('regression variant: hour digit count', ['59:09.500 --> 100:00:00.000 line:0 position:10%'], [3549500, 360000000, 'line:0 position:10%']), ('partial repair probe: hour digit count', ['59:59.999 --> 100:00:59.999 size:50% align:end'], [3599999, 360059999, 'size:50% align:end']), ('partial repair variant: hour digit count', ['00:01:09.500 --> 100:00:00.000 line:0 position:10%'], [69500, 360000000, 'line:0 position:10%']), ('boundary control', ['00:59.999 --> 01:00.000 line:0 size:50%'], [59999, 60000, 'line:0 size:50%']), ('boundary control', ['00:01.000 --> 00:02.000'], [1000, 2000, '']), ('normal control', ['01:60:00.500 --> 5:60,500 line:0 position:10%'], None), ('normal control', ['100:01:00,500 --> 01:00:00.000 align:start'], None), ('normal control', ['60:59.500 --> 100:00:00.000'], None)], [('regression: hour digit count', ['00:01:09.500 --> 100:00:00.000 line:0 position:10%'], [69500, 360000000, 'line:0 position:10%']), ('regression variant: hour digit count', ['100:00:00.000 --> 100:00:01.000 align:start'], [360000000, 360001000, 'align:start']), ('partial repair probe: hour digit count', ['00:00:00.500 --> 100:01:00.000 align:start'], [500, 360060000, 'align:start']), ('partial repair variant: hour digit count', ['59:59.999 --> 100:00:59.999 size:50% align:end'], [3599999, 360059999, 'size:50% align:end']), ('boundary control', ['00:01.000 --> 00:02.000'], [1000, 2000, '']), ('boundary control', ['00:01.000 --> 00:01.000'], None), ('normal control', ['60:60.999 --> 00:00.001'], None), ('normal control', ['01:59:59,500 --> 01:59:59,500 size:50% align:end'], None), ('normal control', ['59:60.5 --> 100:00:00.000 line:0 position:10%'], None)], [('regression: hour digit count', ['59:59.999 --> 100:00:59.999 size:50% align:end'], [3599999, 360059999, 'size:50% align:end']), ('regression variant: hour digit count', ['01:00:00.999 --> 100:00:00.000 size:50% align:end'], [3600999, 360000000, 'size:50% align:end']), ('partial repair probe: hour digit count', ['00:59.500 --> 100:00:00.000 line:0 position:10%'], [59500, 360000000, 'line:0 position:10%']), ('partial repair variant: hour digit count', ['00:00:00.500 --> 100:01:00.000 align:start'], [500, 360060000, 'align:start']), ('boundary control', ['00:01.000 --> 00:01.000'], None), ('boundary control', ['00:59.999 --> 01:00.000 line:0 size:50%'], [59999, 60000, 'line:0 size:50%']), ('normal control', ['01:5:60.500 --> 00:00.001 size:50% align:end'], None), ('normal control', ['100:00:59.000 --> 00:02.000 size:50% align:end'], None), ('normal control', ['100:59:09.000 --> 100:59:09.000'], 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 re
N = 1
observations = []
def solve(line):
    parts=line.split()
    if len(parts)<3 or parts[1]!='-->':
        return None
    def ts(x):
        m=re.fullmatch(r'(?:(\d{1,2}):)?(\d{2}):(\d{2})\.(\d{3})',x)
        if not m:
            return None
        h,mi,se,f=m.groups()
        if int(mi)>59 or int(se)>59:
            return None
        return int(h or 0)*3600000+int(mi)*60000+int(se)*1000+int(f)
    a=ts(parts[0]); b=ts(parts[2])
    if a is None or b is None or b<=a:
        return None
    return [a,b,' '.join(parts[3:])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: hour digit count', ['100:00:00.000 --> 100:00:01.000 align:start'], [360000000, 360001000, 'align:start']), ('regression variant: hour digit count', ['00:00:00.500 --> 100:01:00.000 align:start'], [500, 360060000, 'align:start']), ('partial repair probe: hour digit count', ['59:09.999 --> 100:00:00.000'], [3549999, 360000000, '']), ('partial repair variant: hour digit count', ['01:00:00.999 --> 100:00:00.000 size:50% align:end'], [3600999, 360000000, 'size:50% align:end']), ('boundary control', ['00:01.000 --> 00:02.000'], [1000, 2000, '']), ('boundary control', ['00:01.000 --> 00:01.000'], None), ('normal control', ['00:59.999 --> 01:00.000 line:0 size:50%'], [59999, 60000, 'line:0 size:50%']), ('normal control', ['59:09.5 --> 00:02.000 align:start'], None), ('normal control', ['100:01:60,500 --> 00:00:60.5 align:start'], None)], [('regression: hour digit count', ['01:00:00.999 --> 100:00:00.000 size:50% align:end'], [3600999, 360000000, 'size:50% align:end']), ('regression variant: hour digit count', ['00:59.500 --> 100:00:00.000 line:0 position:10%'], [59500, 360000000, 'line:0 position:10%']), ('partial repair probe: hour digit count', ['00:01:09.500 --> 100:00:00.000 line:0 position:10%'], [69500, 360000000, 'line:0 position:10%']), ('partial repair variant: hour digit count', ['59:09.999 --> 100:00:00.000'], [3549999, 360000000, '']), ('boundary control', ['00:01.000 --> 00:01.000'], None), ('boundary control', ['00:59.999 --> 01:00.000 line:0 size:50%'], [59999, 60000, 'line:0 size:50%']), ('normal control', ['00:5:00.000 -> 00:5:00.000'], None), ('normal control', ['01:01:09.5 --> 60:09.5 size:50% align:end'], None), ('normal control', ['01:60:59.999 --> 00:00.001 line:0 position:10%'], None)], [('regression: hour digit count', ['59:09.999 --> 100:00:00.000'], [3549999, 360000000, '']), ('regression variant: hour digit count', ['59:09.500 --> 100:00:00.000 line:0 position:10%'], [3549500, 360000000, 'line:0 position:10%']), ('partial repair probe: hour digit count', ['59:59.999 --> 100:00:59.999 size:50% align:end'], [3599999, 360059999, 'size:50% align:end']), ('partial repair variant: hour digit count', ['00:01:09.500 --> 100:00:00.000 line:0 position:10%'], [69500, 360000000, 'line:0 position:10%']), ('boundary control', ['00:59.999 --> 01:00.000 line:0 size:50%'], [59999, 60000, 'line:0 size:50%']), ('boundary control', ['00:01.000 --> 00:02.000'], [1000, 2000, '']), ('normal control', ['01:60:00.500 --> 5:60,500 line:0 position:10%'], None), ('normal control', ['100:01:00,500 --> 01:00:00.000 align:start'], None), ('normal control', ['60:59.500 --> 100:00:00.000'], None)], [('regression: hour digit count', ['00:01:09.500 --> 100:00:00.000 line:0 position:10%'], [69500, 360000000, 'line:0 position:10%']), ('regression variant: hour digit count', ['100:00:00.000 --> 100:00:01.000 align:start'], [360000000, 360001000, 'align:start']), ('partial repair probe: hour digit count', ['00:00:00.500 --> 100:01:00.000 align:start'], [500, 360060000, 'align:start']), ('partial repair variant: hour digit count', ['59:59.999 --> 100:00:59.999 size:50% align:end'], [3599999, 360059999, 'size:50% align:end']), ('boundary control', ['00:01.000 --> 00:02.000'], [1000, 2000, '']), ('boundary control', ['00:01.000 --> 00:01.000'], None), ('normal control', ['60:60.999 --> 00:00.001'], None), ('normal control', ['01:59:59,500 --> 01:59:59,500 size:50% align:end'], None), ('normal control', ['59:60.5 --> 100:00:00.000 line:0 position:10%'], None)], [('regression: hour digit count', ['59:59.999 --> 100:00:59.999 size:50% align:end'], [3599999, 360059999, 'size:50% align:end']), ('regression variant: hour digit count', ['01:00:00.999 --> 100:00:00.000 size:50% align:end'], [3600999, 360000000, 'size:50% align:end']), ('partial repair probe: hour digit count', ['00:59.500 --> 100:00:00.000 line:0 position:10%'], [59500, 360000000, 'line:0 position:10%']), ('partial repair variant: hour digit count', ['00:00:00.500 --> 100:01:00.000 align:start'], [500, 360060000, 'align:start']), ('boundary control', ['00:01.000 --> 00:01.000'], None), ('boundary control', ['00:59.999 --> 01:00.000 line:0 size:50%'], [59999, 60000, 'line:0 size:50%']), ('normal control', ['01:5:60.500 --> 00:00.001 size:50% align:end'], None), ('normal control', ['100:00:59.000 --> 00:02.000 size:50% align:end'], None), ('normal control', ['100:59:09.000 --> 100:59:09.000'], 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:
Cues after hour 99 in long recordings fail to parse.

Parse "START --> END [settings...]" (whitespace separated). Timestamps are [hh:]mm:ss.ttt with hours of two or more digits, minutes and seconds exactly two digits below 60, and exactly three fraction digits after a period. END must be after START. Return [start_ms,end_ms,settings joined by single spaces] or None.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import re
N = 1
observations = []
def solve(line):
    parts=line.split()
    if len(parts)<3 or parts[1]!='-->':
        return None
    def ts(x):
        m=re.fullmatch(r'(?:(\d{2,}):)?(\d{2}):(\d{2})\.(\d{1,3})',x)
        if not m:
            return None
        h,mi,se,f=m.groups()
        if int(mi)>59 or int(se)>59:
            return None
        return int(h or 0)*3600000+int(mi)*60000+int(se)*1000+int(f)
    a=ts(parts[0]); b=ts(parts[2])
    if a is None or b is None or b<=a:
        return None
    return [a,b,' '.join(parts[3:])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: fraction format', ['59:09.5 --> 01:00:00.000 line:0 position:10%'], None), ('regression variant: fraction format', ['59:09.5 --> 01:00:00.000 align:start'], None), ('partial repair probe: fraction format', ['00:01:00,500 --> 100:59:59.000 align:start'], None), ('partial repair variant: fraction format', ['00:59,500 --> 59:00.999'], None), ('boundary control', ['00:01.000 --> 00:02.000'], [1000, 2000, '']), ('boundary control', ['00:59.999 --> 01:00.000 line:0 size:50%'], [59999, 60000, 'line:0 size:50%']), ('normal control', ['00:01.000 --> 00:01.000'], None), ('normal control', ['59:09.5 --> 00:02.000 align:start'], None), ('normal control', ['01:01:60,500 -> 01:01:60,500'], None)], [('regression: fraction format', ['00:01:09.5 --> 01:00:00.000'], None), ('regression variant: fraction format', ['59:09.5 --> 01:00:00.000 line:0 position:10%'], None), ('partial repair probe: fraction format', ['00:01:59,500 --> 01:00:00.000 size:50% align:end'], None), ('partial repair variant: fraction format', ['01:59:09,500 --> 100:00:00.000 line:0 position:10%'], None), ('boundary control', ['00:01.000 --> 00:01.000'], None), ('boundary control', ['00:01.000 --> 00:02.000'], [1000, 2000, '']), ('normal control', ['100:60:00.5 --> 01:60:09.000 line:0 position:10%'], None), ('normal control', ['60:09.5 -> 60:09.5'], None), ('normal control', ['01:00:09,500 --> 00:00.001'], None)], [('regression: fraction format', ['59:59.5 --> 01:00:00.000'], None), ('regression variant: fraction format', ['00:01:09.5 --> 01:00:00.000'], None), ('partial repair probe: fraction format', ['59:59,500 --> 100:00:00.000 line:0 position:10%'], None), ('partial repair variant: fraction format', ['00:00,500 --> 00:02.000 align:start'], None), ('boundary control', ['100:00:00.000 --> 100:00:01.000 align:start'], [360000000, 360001000, 'align:start']), ('boundary control', ['00:01.000 --> 00:01.000'], None), ('normal control', ['01:09,500 --> 01:09,500'], None), ('normal control', ['01:5:09.000 --> 00:00.001'], None), ('normal control', ['5:60.500 --> 5:60.500 align:start'], None)], [('regression: fraction format', ['59:59.5 --> 100:00:00.500 align:start'], None), ('regression variant: fraction format', ['59:59.5 --> 01:00:00.000'], None), ('partial repair probe: fraction format', ['01:09,500 --> 01:00:00.000'], None), ('partial repair variant: fraction format', ['00:01:00,500 --> 100:59:59.000 align:start'], None), ('boundary control', ['00:59.999 --> 01:00.000 line:0 size:50%'], [59999, 60000, 'line:0 size:50%']), ('boundary control', ['100:00:00.000 --> 100:00:01.000 align:start'], [360000000, 360001000, 'align:start']), ('normal control', ['100:5:00.5 --> 100:5:00.5 size:50% align:end'], None), ('normal control', ['1:00:60.000 -> 59:09,500'], None), ('normal control', ['100:59:59,500 --> 00:60:09.000'], None)], [('regression: fraction format', ['01:00.5 --> 100:00:00.000'], None), ('regression variant: fraction format', ['59:59.5 --> 100:00:00.500 align:start'], None), ('partial repair probe: fraction format', ['00:59,500 --> 01:09.999 size:50% align:end'], None), ('partial repair variant: fraction format', ['00:01:59,500 --> 01:00:00.000 size:50% align:end'], None), ('boundary control', ['00:01.000 --> 00:02.000'], [1000, 2000, '']), ('boundary control', ['00:59.999 --> 01:00.000 line:0 size:50%'], [59999, 60000, 'line:0 size:50%']), ('normal control', ['60:59.000 --> 60:59.000'], None), ('normal control', ['100:60:00.5 -> 100:00:00.000'], None), ('normal control', ['00:00:60.5 --> 60:59.999'], 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 re
N = 1
observations = []
def solve(line):
    parts=line.split()
    if len(parts)<3 or parts[1]!='-->':
        return None
    def ts(x):
        m=re.fullmatch(r'(?:(\d{2,}):)?(\d{2}):(\d{2})[.,](\d{3})',x)
        if not m:
            return None
        h,mi,se,f=m.groups()
        if int(mi)>59 or int(se)>59:
            return None
        return int(h or 0)*3600000+int(mi)*60000+int(se)*1000+int(f)
    a=ts(parts[0]); b=ts(parts[2])
    if a is None or b is None or b<=a:
        return None
    return [a,b,' '.join(parts[3:])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: fraction format', ['59:09.5 --> 01:00:00.000 line:0 position:10%'], None), ('regression variant: fraction format', ['59:09.5 --> 01:00:00.000 align:start'], None), ('partial repair probe: fraction format', ['00:01:00,500 --> 100:59:59.000 align:start'], None), ('partial repair variant: fraction format', ['00:59,500 --> 59:00.999'], None), ('boundary control', ['00:01.000 --> 00:02.000'], [1000, 2000, '']), ('boundary control', ['00:59.999 --> 01:00.000 line:0 size:50%'], [59999, 60000, 'line:0 size:50%']), ('normal control', ['00:01.000 --> 00:01.000'], None), ('normal control', ['59:09.5 --> 00:02.000 align:start'], None), ('normal control', ['01:01:60,500 -> 01:01:60,500'], None)], [('regression: fraction format', ['00:01:09.5 --> 01:00:00.000'], None), ('regression variant: fraction format', ['59:09.5 --> 01:00:00.000 line:0 position:10%'], None), ('partial repair probe: fraction format', ['00:01:59,500 --> 01:00:00.000 size:50% align:end'], None), ('partial repair variant: fraction format', ['01:59:09,500 --> 100:00:00.000 line:0 position:10%'], None), ('boundary control', ['00:01.000 --> 00:01.000'], None), ('boundary control', ['00:01.000 --> 00:02.000'], [1000, 2000, '']), ('normal control', ['100:60:00.5 --> 01:60:09.000 line:0 position:10%'], None), ('normal control', ['60:09.5 -> 60:09.5'], None), ('normal control', ['01:00:09,500 --> 00:00.001'], None)], [('regression: fraction format', ['59:59.5 --> 01:00:00.000'], None), ('regression variant: fraction format', ['00:01:09.5 --> 01:00:00.000'], None), ('partial repair probe: fraction format', ['59:59,500 --> 100:00:00.000 line:0 position:10%'], None), ('partial repair variant: fraction format', ['00:00,500 --> 00:02.000 align:start'], None), ('boundary control', ['100:00:00.000 --> 100:00:01.000 align:start'], [360000000, 360001000, 'align:start']), ('boundary control', ['00:01.000 --> 00:01.000'], None), ('normal control', ['01:09,500 --> 01:09,500'], None), ('normal control', ['01:5:09.000 --> 00:00.001'], None), ('normal control', ['5:60.500 --> 5:60.500 align:start'], None)], [('regression: fraction format', ['59:59.5 --> 100:00:00.500 align:start'], None), ('regression variant: fraction format', ['59:59.5 --> 01:00:00.000'], None), ('partial repair probe: fraction format', ['01:09,500 --> 01:00:00.000'], None), ('partial repair variant: fraction format', ['00:01:00,500 --> 100:59:59.000 align:start'], None), ('boundary control', ['00:59.999 --> 01:00.000 line:0 size:50%'], [59999, 60000, 'line:0 size:50%']), ('boundary control', ['100:00:00.000 --> 100:00:01.000 align:start'], [360000000, 360001000, 'align:start']), ('normal control', ['100:5:00.5 --> 100:5:00.5 size:50% align:end'], None), ('normal control', ['1:00:60.000 -> 59:09,500'], None), ('normal control', ['100:59:59,500 --> 00:60:09.000'], None)], [('regression: fraction format', ['01:00.5 --> 100:00:00.000'], None), ('regression variant: fraction format', ['59:59.5 --> 100:00:00.500 align:start'], None), ('partial repair probe: fraction format', ['00:59,500 --> 01:09.999 size:50% align:end'], None), ('partial repair variant: fraction format', ['00:01:59,500 --> 01:00:00.000 size:50% align:end'], None), ('boundary control', ['00:01.000 --> 00:02.000'], [1000, 2000, '']), ('boundary control', ['00:59.999 --> 01:00.000 line:0 size:50%'], [59999, 60000, 'line:0 size:50%']), ('normal control', ['60:59.000 --> 60:59.000'], None), ('normal control', ['100:60:00.5 -> 100:00:00.000'], None), ('normal control', ['00:00:60.5 --> 60:59.999'], 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:
Timestamps with truncated fractions such as 00:01.5 are accepted as 5 ms.

Parse "START --> END [settings...]" (whitespace separated). Timestamps are [hh:]mm:ss.ttt with hours of two or more digits, minutes and seconds exactly two digits below 60, and exactly three fraction digits after a period. END must be after START. Return [start_ms,end_ms,settings joined by single spaces] or None.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import re
N = 1
observations = []
def solve(line):
    parts=line.split()
    if len(parts)<3 or parts[1]!='-->':
        return None
    def ts(x):
        m=re.fullmatch(r'(?:(\d{2,}):)?(\d{2}):(\d{2})\.(\d{3})',x)
        if not m:
            return None
        h,mi,se,f=m.groups()
        if int(mi)>60 or int(se)>60:
            return None
        return int(h or 0)*3600000+int(mi)*60000+int(se)*1000+int(f)
    a=ts(parts[0]); b=ts(parts[2])
    if a is None or b is None or b<=a:
        return None
    return [a,b,' '.join(parts[3:])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: field range check', ['60:59.500 --> 100:00:00.000'], None), ('regression variant: field range check', ['01:60:00.000 --> 100:00:00.000 align:start'], None), ('partial repair probe: field range check', ['01:59:09.999 --> 01:60:09.500'], None), ('partial repair variant: field range check', ['00:09.000 --> 100:60:59.999'], None), ('boundary control', ['00:01.000 --> 00:02.000'], [1000, 2000, '']), ('boundary control', ['00:59.999 --> 01:00.000 line:0 size:50%'], [59999, 60000, 'line:0 size:50%']), ('normal control', ['00:01.000 --> 00:01.000'], None), ('normal control', ['59:09.5 --> 00:02.000 align:start'], None), ('normal control', ['01:01:60,500 -> 01:01:60,500'], None)], [('regression: field range check', ['00:60:00.000 --> 100:00:00.000 align:start'], None), ('regression variant: field range check', ['00:59:59.000 --> 100:01:60.000'], None), ('partial repair probe: field range check', ['01:60:00.000 --> 100:00:00.000 align:start'], None), ('partial repair variant: field range check', ['00:09.000 --> 100:60:59.999'], None), ('boundary control', ['00:01.000 --> 00:01.000'], None), ('boundary control', ['00:01.000 --> 00:02.000'], [1000, 2000, '']), ('normal control', ['100:60:00.5 --> 01:60:09.000 line:0 position:10%'], None), ('normal control', ['60:09.5 -> 60:09.5'], None), ('normal control', ['01:00:09,500 --> 00:00.001'], None)], [('regression: field range check', ['01:60:60.999 --> 100:59:00.000 align:start'], None), ('regression variant: field range check', ['00:09.000 --> 100:60:59.999'], None), ('partial repair probe: field range check', ['00:60:09.500 --> 100:00:00.000'], None), ('partial repair variant: field range check', ['00:59:09.500 --> 60:59.000 size:50% align:end'], None), ('boundary control', ['100:00:00.000 --> 100:00:01.000 align:start'], [360000000, 360001000, 'align:start']), ('boundary control', ['00:01.000 --> 00:01.000'], None), ('normal control', ['01:09,500 --> 01:09,500'], None), ('normal control', ['01:5:09.000 --> 00:00.001'], None), ('normal control', ['5:60.500 --> 5:60.500 align:start'], None)], [('regression: field range check', ['01:59:09.999 --> 01:60:09.500'], None), ('regression variant: field range check', ['00:60:09.500 --> 100:00:00.000'], None), ('partial repair probe: field range check', ['00:59:09.500 --> 60:59.000 size:50% align:end'], None), ('partial repair variant: field range check', ['60:59.500 --> 100:00:00.000'], None), ('boundary control', ['00:59.999 --> 01:00.000 line:0 size:50%'], [59999, 60000, 'line:0 size:50%']), ('boundary control', ['100:00:00.000 --> 100:00:01.000 align:start'], [360000000, 360001000, 'align:start']), ('normal control', ['60:60.999 --> 00:00.001'], None), ('normal control', ['01:59:59,500 --> 01:59:59,500 size:50% align:end'], None), ('normal control', ['59:60.5 --> 100:00:00.000 line:0 position:10%'], None)], [('regression: field range check', ['00:59:60.999 --> 01:60:59.000'], None), ('regression variant: field range check', ['00:01:60.000 --> 100:00:00.000 line:0 position:10%'], None), ('partial repair probe: field range check', ['00:59:09.500 --> 60:59.000 size:50% align:end'], None), ('partial repair variant: field range check', ['60:59.500 --> 100:00:00.000'], None), ('boundary control', ['00:01.000 --> 00:02.000'], [1000, 2000, '']), ('boundary control', ['00:59.999 --> 01:00.000 line:0 size:50%'], [59999, 60000, 'line:0 size:50%']), ('normal control', ['01:5:60.500 --> 00:00.001 size:50% align:end'], None), ('normal control', ['100:00:59.000 --> 00:02.000 size:50% align:end'], None), ('normal control', ['100:59:09.000 --> 100:59:09.000'], 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 re
N = 1
observations = []
def solve(line):
    parts=line.split()
    if len(parts)<3 or parts[1]!='-->':
        return None
    def ts(x):
        m=re.fullmatch(r'(?:(\d{2,}):)?(\d{2}):(\d{2})\.(\d{3})',x)
        if not m:
            return None
        h,mi,se,f=m.groups()
        if int(se)>59:
            return None
        return int(h or 0)*3600000+int(mi)*60000+int(se)*1000+int(f)
    a=ts(parts[0]); b=ts(parts[2])
    if a is None or b is None or b<=a:
        return None
    return [a,b,' '.join(parts[3:])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: field range check', ['60:59.500 --> 100:00:00.000'], None), ('regression variant: field range check', ['01:60:00.000 --> 100:00:00.000 align:start'], None), ('partial repair probe: field range check', ['01:59:09.999 --> 01:60:09.500'], None), ('partial repair variant: field range check', ['00:09.000 --> 100:60:59.999'], None), ('boundary control', ['00:01.000 --> 00:02.000'], [1000, 2000, '']), ('boundary control', ['00:59.999 --> 01:00.000 line:0 size:50%'], [59999, 60000, 'line:0 size:50%']), ('normal control', ['00:01.000 --> 00:01.000'], None), ('normal control', ['59:09.5 --> 00:02.000 align:start'], None), ('normal control', ['01:01:60,500 -> 01:01:60,500'], None)], [('regression: field range check', ['00:60:00.000 --> 100:00:00.000 align:start'], None), ('regression variant: field range check', ['00:59:59.000 --> 100:01:60.000'], None), ('partial repair probe: field range check', ['01:60:00.000 --> 100:00:00.000 align:start'], None), ('partial repair variant: field range check', ['00:09.000 --> 100:60:59.999'], None), ('boundary control', ['00:01.000 --> 00:01.000'], None), ('boundary control', ['00:01.000 --> 00:02.000'], [1000, 2000, '']), ('normal control', ['100:60:00.5 --> 01:60:09.000 line:0 position:10%'], None), ('normal control', ['60:09.5 -> 60:09.5'], None), ('normal control', ['01:00:09,500 --> 00:00.001'], None)], [('regression: field range check', ['01:60:60.999 --> 100:59:00.000 align:start'], None), ('regression variant: field range check', ['00:09.000 --> 100:60:59.999'], None), ('partial repair probe: field range check', ['00:60:09.500 --> 100:00:00.000'], None), ('partial repair variant: field range check', ['00:59:09.500 --> 60:59.000 size:50% align:end'], None), ('boundary control', ['100:00:00.000 --> 100:00:01.000 align:start'], [360000000, 360001000, 'align:start']), ('boundary control', ['00:01.000 --> 00:01.000'], None), ('normal control', ['01:09,500 --> 01:09,500'], None), ('normal control', ['01:5:09.000 --> 00:00.001'], None), ('normal control', ['5:60.500 --> 5:60.500 align:start'], None)], [('regression: field range check', ['01:59:09.999 --> 01:60:09.500'], None), ('regression variant: field range check', ['00:60:09.500 --> 100:00:00.000'], None), ('partial repair probe: field range check', ['00:59:09.500 --> 60:59.000 size:50% align:end'], None), ('partial repair variant: field range check', ['60:59.500 --> 100:00:00.000'], None), ('boundary control', ['00:59.999 --> 01:00.000 line:0 size:50%'], [59999, 60000, 'line:0 size:50%']), ('boundary control', ['100:00:00.000 --> 100:00:01.000 align:start'], [360000000, 360001000, 'align:start']), ('normal control', ['60:60.999 --> 00:00.001'], None), ('normal control', ['01:59:59,500 --> 01:59:59,500 size:50% align:end'], None), ('normal control', ['59:60.5 --> 100:00:00.000 line:0 position:10%'], None)], [('regression: field range check', ['00:59:60.999 --> 01:60:59.000'], None), ('regression variant: field range check', ['00:01:60.000 --> 100:00:00.000 line:0 position:10%'], None), ('partial repair probe: field range check', ['00:59:09.500 --> 60:59.000 size:50% align:end'], None), ('partial repair variant: field range check', ['60:59.500 --> 100:00:00.000'], None), ('boundary control', ['00:01.000 --> 00:02.000'], [1000, 2000, '']), ('boundary control', ['00:59.999 --> 01:00.000 line:0 size:50%'], [59999, 60000, 'line:0 size:50%']), ('normal control', ['01:5:60.500 --> 00:00.001 size:50% align:end'], None), ('normal control', ['100:00:59.000 --> 00:02.000 size:50% align:end'], None), ('normal control', ['100:59:09.000 --> 100:59:09.000'], None)]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A timestamp with 60 minutes or seconds is accepted and rolls over silently.

Parse "START --> END [settings...]" (whitespace separated). Timestamps are [hh:]mm:ss.ttt with hours of two or more digits, minutes and seconds exactly two digits below 60, and exactly three fraction digits after a period. END must be after START. Return [start_ms,end_ms,settings joined by single spaces] or None.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import re
N = 1
observations = []
def solve(line):
    parts=line.split()
    if len(parts)<3 or parts[1]!='-->':
        return None
    def ts(x):
        m=re.fullmatch(r'(?:(\d{2,}):)?(\d{2}):(\d{2})\.(\d{3})',x)
        if not m:
            return None
        h,mi,se,f=m.groups()
        if int(mi)>59 or int(se)>59:
            return None
        return int(h or 0)*3600000+int(mi)*60000+int(se)*1000+int(f)
    a=ts(parts[0]); b=ts(parts[2])
    if a is None or b is None or b<a:
        return None
    return [a,b,' '.join(parts[3:])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: cue ordering check', ['00:01.000 --> 00:01.000'], None), ('regression variant: cue ordering check', ['01:00.500 --> 01:00.500'], None), ('partial repair probe: cue ordering check', ['01:09.500 --> 01:09.500'], None), ('partial repair variant: cue ordering check', ['100:59:59.999 --> 100:59:59.999 align:start'], None), ('boundary control', ['00:01.000 --> 00:02.000'], [1000, 2000, '']), ('boundary control', ['100:00:00.000 --> 100:00:01.000 align:start'], [360000000, 360001000, 'align:start']), ('normal control', ['00:59.999 --> 01:00.000 line:0 size:50%'], [59999, 60000, 'line:0 size:50%']), ('normal control', ['59:09.5 --> 00:02.000 align:start'], None), ('normal control', ['100:01:60,500 --> 00:00:60.5 align:start'], None)], [('regression: cue ordering check', ['100:59:09.000 --> 100:59:09.000'], None), ('regression variant: cue ordering check', ['100:59:09.500 --> 100:59:09.500 align:start'], None), ('partial repair probe: cue ordering check', ['00:00:09.000 --> 00:00:09.000'], None), ('partial repair variant: cue ordering check', ['00:59.000 --> 00:59.000 line:0 position:10%'], None), ('boundary control', ['100:00:00.000 --> 100:00:01.000 align:start'], [360000000, 360001000, 'align:start']), ('boundary control', ['00:59.999 --> 01:00.000 line:0 size:50%'], [59999, 60000, 'line:0 size:50%']), ('normal control', ['00:5:00.000 -> 00:5:00.000'], None), ('normal control', ['01:01:09.5 --> 60:09.5 size:50% align:end'], None), ('normal control', ['01:60:59.999 --> 00:00.001 line:0 position:10%'], None)], [('regression: cue ordering check', ['01:09.500 --> 01:09.500'], None), ('regression variant: cue ordering check', ['01:59:00.500 --> 01:59:00.500 size:50% align:end'], None), ('partial repair probe: cue ordering check', ['01:59:59.500 --> 01:59:59.500 size:50% align:end'], None), ('partial repair variant: cue ordering check', ['00:01:00.000 --> 00:01:00.000'], None), ('boundary control', ['00:59.999 --> 01:00.000 line:0 size:50%'], [59999, 60000, 'line:0 size:50%']), ('boundary control', ['00:01.000 --> 00:02.000'], [1000, 2000, '']), ('normal control', ['01:60:00.500 --> 5:60,500 line:0 position:10%'], None), ('normal control', ['100:01:00,500 --> 01:00:00.000 align:start'], None), ('normal control', ['60:59.500 --> 100:00:00.000'], None)], [('regression: cue ordering check', ['00:00:09.000 --> 00:00:09.000'], None), ('regression variant: cue ordering check', ['100:59:00.000 --> 100:59:00.000 size:50% align:end'], None), ('partial repair probe: cue ordering check', ['01:00.500 --> 01:00.500'], None), ('partial repair variant: cue ordering check', ['00:59:00.999 --> 00:59:00.999 size:50% align:end'], None), ('boundary control', ['00:01.000 --> 00:02.000'], [1000, 2000, '']), ('boundary control', ['100:00:00.000 --> 100:00:01.000 align:start'], [360000000, 360001000, 'align:start']), ('normal control', ['60:60.999 --> 00:00.001'], None), ('normal control', ['01:59:59,500 --> 01:59:59,500 size:50% align:end'], None), ('normal control', ['59:60.5 --> 100:00:00.000 line:0 position:10%'], None)], [('regression: cue ordering check', ['01:59:59.500 --> 01:59:59.500 size:50% align:end'], None), ('regression variant: cue ordering check', ['100:59:59.999 --> 100:59:59.999 align:start'], None), ('partial repair probe: cue ordering check', ['100:59:09.500 --> 100:59:09.500 align:start'], None), ('partial repair variant: cue ordering check', ['01:59:59.999 --> 01:59:59.999'], None), ('boundary control', ['100:00:00.000 --> 100:00:01.000 align:start'], [360000000, 360001000, 'align:start']), ('boundary control', ['00:59.999 --> 01:00.000 line:0 size:50%'], [59999, 60000, 'line:0 size:50%']), ('normal control', ['01:5:60.500 --> 00:00.001 size:50% align:end'], None), ('normal control', ['100:00:59.000 --> 00:02.000 size:50% align:end'], None), ('normal control', ['59:59.5 -> 00:5:59.999'], 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 re
N = 1
observations = []
def solve(line):
    parts=line.split()
    if len(parts)<3 or parts[1]!='-->':
        return None
    def ts(x):
        m=re.fullmatch(r'(?:(\d{2,}):)?(\d{2}):(\d{2})\.(\d{3})',x)
        if not m:
            return None
        h,mi,se,f=m.groups()
        if int(mi)>59 or int(se)>59:
            return None
        return int(h or 0)*3600000+int(mi)*60000+int(se)*1000+int(f)
    a=ts(parts[0]); b=ts(parts[2])
    if a is None or b is None or b<a or b==0:
        return None
    return [a,b,' '.join(parts[3:])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: cue ordering check', ['00:01.000 --> 00:01.000'], None), ('regression variant: cue ordering check', ['01:00.500 --> 01:00.500'], None), ('partial repair probe: cue ordering check', ['01:09.500 --> 01:09.500'], None), ('partial repair variant: cue ordering check', ['100:59:59.999 --> 100:59:59.999 align:start'], None), ('boundary control', ['00:01.000 --> 00:02.000'], [1000, 2000, '']), ('boundary control', ['100:00:00.000 --> 100:00:01.000 align:start'], [360000000, 360001000, 'align:start']), ('normal control', ['00:59.999 --> 01:00.000 line:0 size:50%'], [59999, 60000, 'line:0 size:50%']), ('normal control', ['59:09.5 --> 00:02.000 align:start'], None), ('normal control', ['100:01:60,500 --> 00:00:60.5 align:start'], None)], [('regression: cue ordering check', ['100:59:09.000 --> 100:59:09.000'], None), ('regression variant: cue ordering check', ['100:59:09.500 --> 100:59:09.500 align:start'], None), ('partial repair probe: cue ordering check', ['00:00:09.000 --> 00:00:09.000'], None), ('partial repair variant: cue ordering check', ['00:59.000 --> 00:59.000 line:0 position:10%'], None), ('boundary control', ['100:00:00.000 --> 100:00:01.000 align:start'], [360000000, 360001000, 'align:start']), ('boundary control', ['00:59.999 --> 01:00.000 line:0 size:50%'], [59999, 60000, 'line:0 size:50%']), ('normal control', ['00:5:00.000 -> 00:5:00.000'], None), ('normal control', ['01:01:09.5 --> 60:09.5 size:50% align:end'], None), ('normal control', ['01:60:59.999 --> 00:00.001 line:0 position:10%'], None)], [('regression: cue ordering check', ['01:09.500 --> 01:09.500'], None), ('regression variant: cue ordering check', ['01:59:00.500 --> 01:59:00.500 size:50% align:end'], None), ('partial repair probe: cue ordering check', ['01:59:59.500 --> 01:59:59.500 size:50% align:end'], None), ('partial repair variant: cue ordering check', ['00:01:00.000 --> 00:01:00.000'], None), ('boundary control', ['00:59.999 --> 01:00.000 line:0 size:50%'], [59999, 60000, 'line:0 size:50%']), ('boundary control', ['00:01.000 --> 00:02.000'], [1000, 2000, '']), ('normal control', ['01:60:00.500 --> 5:60,500 line:0 position:10%'], None), ('normal control', ['100:01:00,500 --> 01:00:00.000 align:start'], None), ('normal control', ['60:59.500 --> 100:00:00.000'], None)], [('regression: cue ordering check', ['00:00:09.000 --> 00:00:09.000'], None), ('regression variant: cue ordering check', ['100:59:00.000 --> 100:59:00.000 size:50% align:end'], None), ('partial repair probe: cue ordering check', ['01:00.500 --> 01:00.500'], None), ('partial repair variant: cue ordering check', ['00:59:00.999 --> 00:59:00.999 size:50% align:end'], None), ('boundary control', ['00:01.000 --> 00:02.000'], [1000, 2000, '']), ('boundary control', ['100:00:00.000 --> 100:00:01.000 align:start'], [360000000, 360001000, 'align:start']), ('normal control', ['60:60.999 --> 00:00.001'], None), ('normal control', ['01:59:59,500 --> 01:59:59,500 size:50% align:end'], None), ('normal control', ['59:60.5 --> 100:00:00.000 line:0 position:10%'], None)], [('regression: cue ordering check', ['01:59:59.500 --> 01:59:59.500 size:50% align:end'], None), ('regression variant: cue ordering check', ['100:59:59.999 --> 100:59:59.999 align:start'], None), ('partial repair probe: cue ordering check', ['100:59:09.500 --> 100:59:09.500 align:start'], None), ('partial repair variant: cue ordering check', ['01:59:59.999 --> 01:59:59.999'], None), ('boundary control', ['100:00:00.000 --> 100:00:01.000 align:start'], [360000000, 360001000, 'align:start']), ('boundary control', ['00:59.999 --> 01:00.000 line:0 size:50%'], [59999, 60000, 'line:0 size:50%']), ('normal control', ['01:5:60.500 --> 00:00.001 size:50% align:end'], None), ('normal control', ['100:00:59.000 --> 00:02.000 size:50% align:end'], None), ('normal control', ['59:59.5 -> 00:5:59.999'], 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:
Zero-duration cues where END equals START are accepted.

Parse "START --> END [settings...]" (whitespace separated). Timestamps are [hh:]mm:ss.ttt with hours of two or more digits, minutes and seconds exactly two digits below 60, and exactly three fraction digits after a period. END must be after START. Return [start_ms,end_ms,settings joined by single spaces] or None.

split: open-access