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

N = 1
observations = []
def solve(s):
    s=s
    parts=s.replace('.',',').split(',')
    if len(parts)!=2: return None
    hms,frac=parts
    fields=hms.split(':')
    if len(fields)!=3: return None
    if not all(p.isdigit() for p in fields) or not frac.isdigit(): return None
    if len(frac)>3: return None
    h,mi,se=int(fields[0]),int(fields[1]),int(fields[2])
    if mi>=60 or se>=60: return None
    ms=int(frac.ljust(3,'0'))
    return h*3600000+mi*60000+se*1000+ms
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: surrounding whitespace', ['00:59:59,999\r'], 3599999), ('regression variant: surrounding whitespace', ['01:05:00,500\r'], 3900500), ('partial repair probe: surrounding whitespace', ['99:00:59,001 \r'], 356459001), ('partial repair variant: surrounding whitespace', ['100:59:42.001\r'], 363582001), ('boundary control', ['00:00:00,000'], 0), ('boundary control', ['00:60:00,000'], None), ('normal control', ['00:00:01,5'], 1500), ('normal control', ['100:00:00,000'], 360000000), ('normal control', ['00:61:00;5 \r'], None)], [('regression: surrounding whitespace', ['99:00:00.500\r'], 356400500), ('regression variant: surrounding whitespace', [' 00:05:00.5 '], 300500), ('partial repair probe: surrounding whitespace', ['01:30:01,500 \r'], 5401500), ('partial repair variant: surrounding whitespace', ['00:30:59,12 '], 1859120), ('boundary control', ['00:00:01,5'], 1500), ('boundary control', ['100:00:00,000'], 360000000), ('normal control', ['123:60:59,5'], None), ('normal control', [' 00:30:60,500'], None), ('normal control', ['00:00:60.1234 '], None)], [('regression: surrounding whitespace', ['99:00:59,001 \r'], 356459001), ('regression variant: surrounding whitespace', ['100:30:42,500\r'], 361842500), ('partial repair probe: surrounding whitespace', ['01:05:00,500\r'], 3900500), ('partial repair variant: surrounding whitespace', ['10:05:42,000 '], 36342000), ('boundary control', ['01:02:03.004'], 3723004), ('boundary control', ['00:00:00,000'], 0), ('normal control', ['123:60:42,999'], None), ('normal control', ['00:30:59;12'], None), ('normal control', ['00:00:60,1234\r'], None)], [('regression: surrounding whitespace', ['01:30:01,500 \r'], 5401500), ('regression variant: surrounding whitespace', ['123:05:01,001\t'], 443101001), ('partial repair probe: surrounding whitespace', [' 00:05:00.5 '], 300500), ('partial repair variant: surrounding whitespace', [' 123:59:42,50 '], 446382500), ('boundary control', ['00:60:00,000'], None), ('boundary control', ['00:00:01,5'], 1500), ('normal control', ['00:59:00.000'], 3540000), ('normal control', [' 00:61:42,000'], None), ('normal control', ['100:60:60,999 '], None)], [('regression: surrounding whitespace', [' 10:05:00.000'], 36300000), ('regression variant: surrounding whitespace', ['02:30:42,5\t'], 9042500), ('partial repair probe: surrounding whitespace', ['100:30:42,500\r'], 361842500), ('partial repair variant: surrounding whitespace', ['01:59:00.500\t'], 7140500), ('boundary control', ['100:00:00,000'], 360000000), ('boundary control', ['01:02:03.004'], 3723004), ('normal control', ['02:00:01,1234 \r'], None), ('normal control', [' 99:60:60, '], None), ('normal control', [' 100:59:61,50'], None)]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(s):
    s=s.lstrip()
    parts=s.replace('.',',').split(',')
    if len(parts)!=2: return None
    hms,frac=parts
    fields=hms.split(':')
    if len(fields)!=3: return None
    if not all(p.isdigit() for p in fields) or not frac.isdigit(): return None
    if len(frac)>3: return None
    h,mi,se=int(fields[0]),int(fields[1]),int(fields[2])
    if mi>=60 or se>=60: return None
    ms=int(frac.ljust(3,'0'))
    return h*3600000+mi*60000+se*1000+ms
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: surrounding whitespace', ['00:59:59,999\r'], 3599999), ('regression variant: surrounding whitespace', ['01:05:00,500\r'], 3900500), ('partial repair probe: surrounding whitespace', ['99:00:59,001 \r'], 356459001), ('partial repair variant: surrounding whitespace', ['100:59:42.001\r'], 363582001), ('boundary control', ['00:00:00,000'], 0), ('boundary control', ['00:60:00,000'], None), ('normal control', ['00:00:01,5'], 1500), ('normal control', ['100:00:00,000'], 360000000), ('normal control', ['00:61:00;5 \r'], None)], [('regression: surrounding whitespace', ['99:00:00.500\r'], 356400500), ('regression variant: surrounding whitespace', [' 00:05:00.5 '], 300500), ('partial repair probe: surrounding whitespace', ['01:30:01,500 \r'], 5401500), ('partial repair variant: surrounding whitespace', ['00:30:59,12 '], 1859120), ('boundary control', ['00:00:01,5'], 1500), ('boundary control', ['100:00:00,000'], 360000000), ('normal control', ['123:60:59,5'], None), ('normal control', [' 00:30:60,500'], None), ('normal control', ['00:00:60.1234 '], None)], [('regression: surrounding whitespace', ['99:00:59,001 \r'], 356459001), ('regression variant: surrounding whitespace', ['100:30:42,500\r'], 361842500), ('partial repair probe: surrounding whitespace', ['01:05:00,500\r'], 3900500), ('partial repair variant: surrounding whitespace', ['10:05:42,000 '], 36342000), ('boundary control', ['01:02:03.004'], 3723004), ('boundary control', ['00:00:00,000'], 0), ('normal control', ['123:60:42,999'], None), ('normal control', ['00:30:59;12'], None), ('normal control', ['00:00:60,1234\r'], None)], [('regression: surrounding whitespace', ['01:30:01,500 \r'], 5401500), ('regression variant: surrounding whitespace', ['123:05:01,001\t'], 443101001), ('partial repair probe: surrounding whitespace', [' 00:05:00.5 '], 300500), ('partial repair variant: surrounding whitespace', [' 123:59:42,50 '], 446382500), ('boundary control', ['00:60:00,000'], None), ('boundary control', ['00:00:01,5'], 1500), ('normal control', ['00:59:00.000'], 3540000), ('normal control', [' 00:61:42,000'], None), ('normal control', ['100:60:60,999 '], None)], [('regression: surrounding whitespace', [' 10:05:00.000'], 36300000), ('regression variant: surrounding whitespace', ['02:30:42,5\t'], 9042500), ('partial repair probe: surrounding whitespace', ['100:30:42,500\r'], 361842500), ('partial repair variant: surrounding whitespace', ['01:59:00.500\t'], 7140500), ('boundary control', ['100:00:00,000'], 360000000), ('boundary control', ['01:02:03.004'], 3723004), ('normal control', ['02:00:01,1234 \r'], None), ('normal control', [' 99:60:60, '], None), ('normal control', [' 100:59:61,50'], 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:
Every cue from a CRLF subtitle file fails to parse because its end timestamp carries a carriage return.

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

split: open-access


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

N = 1
observations = []
def solve(ms, style):
    if ms<0: ms=-ms
    h=ms//3600000
    m=(ms-h*3600000)//60000
    s=ms//1000%60
    f=ms%1000
    if style=='srt':
        return '%02d:%02d:%02d,%03d'%(h,m,s,f)
    if h==0:
        return '%02d:%02d.%03d'%(m,s,f)
    return '%02d:%02d:%02d.%03d'%(h,m,s,f)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: negative clamp', [-1, 'srt'], '00:00:00,000'), ('regression variant: negative clamp', [-999, 'srt'], '00:00:00,000'), ('partial repair probe: negative clamp', [-1, 'vtt'], '00:00.000'), ('partial repair variant: negative clamp', [-999, 'vtt'], '00:00.000'), ('boundary control', [0, 'srt'], '00:00:00,000'), ('boundary control', [3599999, 'vtt'], '59:59.999'), ('normal control', [0, 'vtt'], '00:00.000'), ('normal control', [61001, 'vtt'], '01:01.001'), ('normal control', [7834, 'srt'], '00:00:07,834')], [('regression: negative clamp', [-999, 'vtt'], '00:00.000'), ('regression variant: negative clamp', [-1000, 'vtt'], '00:00.000'), ('partial repair probe: negative clamp', [-1, 'vtt'], '00:00.000'), ('partial repair variant: negative clamp', [-999, 'srt'], '00:00:00,000'), ('boundary control', [0, 'vtt'], '00:00.000'), ('boundary control', [61001, 'vtt'], '01:01.001'), ('normal control', [3192469, 'vtt'], '53:12.469'), ('normal control', [893654, 'srt'], '00:14:53,654'), ('normal control', [55880, 'vtt'], '00:55.880')], [('regression: negative clamp', [-5000, 'srt'], '00:00:00,000'), ('regression variant: negative clamp', [-1, 'vtt'], '00:00.000'), ('partial repair probe: negative clamp', [-1, 'srt'], '00:00:00,000'), ('partial repair variant: negative clamp', [-999, 'vtt'], '00:00.000'), ('boundary control', [3600000, 'vtt'], '01:00:00.000'), ('boundary control', [0, 'srt'], '00:00:00,000'), ('normal control', [11761, 'vtt'], '00:11.761'), ('normal control', [360000000, 'vtt'], '100:00:00.000'), ('normal control', [78935, 'srt'], '00:01:18,935')], [('regression: negative clamp', [-5000, 'vtt'], '00:00.000'), ('regression variant: negative clamp', [-1, 'srt'], '00:00:00,000'), ('partial repair probe: negative clamp', [-999, 'vtt'], '00:00.000'), ('partial repair variant: negative clamp', [-999, 'srt'], '00:00:00,000'), ('boundary control', [3599999, 'vtt'], '59:59.999'), ('boundary control', [0, 'vtt'], '00:00.000'), ('normal control', [3576784, 'srt'], '00:59:36,784'), ('normal control', [59999, 'vtt'], '00:59.999'), ('normal control', [1088867, 'srt'], '00:18:08,867')], [('regression: negative clamp', [-1000, 'srt'], '00:00:00,000'), ('regression variant: negative clamp', [-999, 'vtt'], '00:00.000'), ('partial repair probe: negative clamp', [-999, 'srt'], '00:00:00,000'), ('partial repair variant: negative clamp', [-1, 'vtt'], '00:00.000'), ('boundary control', [61001, 'vtt'], '01:01.001'), ('boundary control', [3600000, 'vtt'], '01:00:00.000'), ('normal control', [3599999, 'srt'], '00:59:59,999'), ('normal control', [3689889, 'srt'], '01:01:29,889'), ('normal control', [19225823, 'srt'], '05:20:25,823')]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

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

N = 1
observations = []
def solve(ms, style):
    if ms<=-1000: ms=0
    h=ms//3600000
    m=(ms-h*3600000)//60000
    s=ms//1000%60
    f=ms%1000
    if style=='srt':
        return '%02d:%02d:%02d,%03d'%(h,m,s,f)
    if h==0:
        return '%02d:%02d.%03d'%(m,s,f)
    return '%02d:%02d:%02d.%03d'%(h,m,s,f)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: negative clamp', [-1, 'srt'], '00:00:00,000'), ('regression variant: negative clamp', [-999, 'srt'], '00:00:00,000'), ('partial repair probe: negative clamp', [-1, 'vtt'], '00:00.000'), ('partial repair variant: negative clamp', [-999, 'vtt'], '00:00.000'), ('boundary control', [0, 'srt'], '00:00:00,000'), ('boundary control', [3599999, 'vtt'], '59:59.999'), ('normal control', [0, 'vtt'], '00:00.000'), ('normal control', [61001, 'vtt'], '01:01.001'), ('normal control', [7834, 'srt'], '00:00:07,834')], [('regression: negative clamp', [-999, 'vtt'], '00:00.000'), ('regression variant: negative clamp', [-1000, 'vtt'], '00:00.000'), ('partial repair probe: negative clamp', [-1, 'vtt'], '00:00.000'), ('partial repair variant: negative clamp', [-999, 'srt'], '00:00:00,000'), ('boundary control', [0, 'vtt'], '00:00.000'), ('boundary control', [61001, 'vtt'], '01:01.001'), ('normal control', [3192469, 'vtt'], '53:12.469'), ('normal control', [893654, 'srt'], '00:14:53,654'), ('normal control', [55880, 'vtt'], '00:55.880')], [('regression: negative clamp', [-5000, 'srt'], '00:00:00,000'), ('regression variant: negative clamp', [-1, 'vtt'], '00:00.000'), ('partial repair probe: negative clamp', [-1, 'srt'], '00:00:00,000'), ('partial repair variant: negative clamp', [-999, 'vtt'], '00:00.000'), ('boundary control', [3600000, 'vtt'], '01:00:00.000'), ('boundary control', [0, 'srt'], '00:00:00,000'), ('normal control', [11761, 'vtt'], '00:11.761'), ('normal control', [360000000, 'vtt'], '100:00:00.000'), ('normal control', [78935, 'srt'], '00:01:18,935')], [('regression: negative clamp', [-5000, 'vtt'], '00:00.000'), ('regression variant: negative clamp', [-1, 'srt'], '00:00:00,000'), ('partial repair probe: negative clamp', [-999, 'vtt'], '00:00.000'), ('partial repair variant: negative clamp', [-999, 'srt'], '00:00:00,000'), ('boundary control', [3599999, 'vtt'], '59:59.999'), ('boundary control', [0, 'vtt'], '00:00.000'), ('normal control', [3576784, 'srt'], '00:59:36,784'), ('normal control', [59999, 'vtt'], '00:59.999'), ('normal control', [1088867, 'srt'], '00:18:08,867')], [('regression: negative clamp', [-1000, 'srt'], '00:00:00,000'), ('regression variant: negative clamp', [-999, 'vtt'], '00:00.000'), ('partial repair probe: negative clamp', [-999, 'srt'], '00:00:00,000'), ('partial repair variant: negative clamp', [-1, 'vtt'], '00:00.000'), ('boundary control', [61001, 'vtt'], '01:01.001'), ('boundary control', [3600000, 'vtt'], '01:00:00.000'), ('normal control', [3599999, 'srt'], '00:59:59,999'), ('normal control', [3689889, 'srt'], '01:01:29,889'), ('normal control', [19225823, 'srt'], '05:20:25,823')]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A cue shifted slightly before zero is written at a positive time mirrored around the origin.

Format integer milliseconds as a cue timestamp. Negative values clamp to 0. style "srt" gives HH:MM:SS,mmm (hours at least two digits, never wrapped); style "vtt" gives MM:SS.mmm when the hour field is zero and HH:MM:SS.mmm otherwise.

split: open-access


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

N = 1
observations = []
def solve(ms, style):
    if ms<0: ms=0
    h=ms//3600000
    m=ms//60000
    s=ms//1000%60
    f=ms%1000
    if style=='srt':
        return '%02d:%02d:%02d,%03d'%(h,m,s,f)
    if h==0:
        return '%02d:%02d.%03d'%(m,s,f)
    return '%02d:%02d:%02d.%03d'%(h,m,s,f)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: minute field extraction', [3600000, 'vtt'], '01:00:00.000'), ('regression variant: minute field extraction', [3849665, 'vtt'], '01:04:09.665'), ('partial repair probe: minute field extraction', [4082731, 'srt'], '01:08:02,731'), ('partial repair variant: minute field extraction', [3689889, 'srt'], '01:01:29,889'), ('boundary control', [0, 'srt'], '00:00:00,000'), ('boundary control', [3599999, 'vtt'], '59:59.999'), ('normal control', [0, 'vtt'], '00:00.000'), ('normal control', [61001, 'vtt'], '01:01.001'), ('normal control', [7834, 'srt'], '00:00:07,834')], [('regression: minute field extraction', [3664439, 'srt'], '01:01:04,439'), ('regression variant: minute field extraction', [360000000, 'srt'], '100:00:00,000'), ('partial repair probe: minute field extraction', [274754132, 'srt'], '76:19:14,132'), ('partial repair variant: minute field extraction', [19225823, 'srt'], '05:20:25,823'), ('boundary control', [0, 'vtt'], '00:00.000'), ('boundary control', [61001, 'vtt'], '01:01.001'), ('normal control', [-999, 'vtt'], '00:00.000'), ('normal control', [60000, 'vtt'], '01:00.000'), ('normal control', [11761, 'vtt'], '00:11.761')], [('regression: minute field extraction', [4082731, 'srt'], '01:08:02,731'), ('regression variant: minute field extraction', [76782995, 'vtt'], '21:19:42.995'), ('partial repair probe: minute field extraction', [360000000, 'vtt'], '100:00:00.000'), ('partial repair variant: minute field extraction', [3673366, 'srt'], '01:01:13,366'), ('boundary control', [-1, 'srt'], '00:00:00,000'), ('boundary control', [0, 'srt'], '00:00:00,000'), ('normal control', [-5000, 'srt'], '00:00:00,000'), ('normal control', [-5000, 'vtt'], '00:00.000'), ('normal control', [5, 'srt'], '00:00:00,005')], [('regression: minute field extraction', [274754132, 'srt'], '76:19:14,132'), ('regression variant: minute field extraction', [175213793, 'vtt'], '48:40:13.793'), ('partial repair probe: minute field extraction', [3849665, 'vtt'], '01:04:09.665'), ('partial repair variant: minute field extraction', [36000000, 'vtt'], '10:00:00.000'), ('boundary control', [3599999, 'vtt'], '59:59.999'), ('boundary control', [0, 'vtt'], '00:00.000'), ('normal control', [59999, 'vtt'], '00:59.999'), ('normal control', [3509491, 'srt'], '00:58:29,491'), ('normal control', [3441818, 'srt'], '00:57:21,818')], [('regression: minute field extraction', [360000000, 'vtt'], '100:00:00.000'), ('regression variant: minute field extraction', [3689889, 'srt'], '01:01:29,889'), ('partial repair probe: minute field extraction', [360000000, 'srt'], '100:00:00,000'), ('partial repair variant: minute field extraction', [290743422, 'vtt'], '80:45:43.422'), ('boundary control', [61001, 'vtt'], '01:01.001'), ('boundary control', [-1, 'srt'], '00:00:00,000'), ('normal control', [65993, 'srt'], '00:01:05,993'), ('normal control', [61977, 'vtt'], '01:01.977'), ('normal control', [-999, 'srt'], '00:00:00,000')]]
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(ms, style):
    if ms<0: ms=0
    h=ms//3600000
    m=(ms-h*3600)//60000
    s=ms//1000%60
    f=ms%1000
    if style=='srt':
        return '%02d:%02d:%02d,%03d'%(h,m,s,f)
    if h==0:
        return '%02d:%02d.%03d'%(m,s,f)
    return '%02d:%02d:%02d.%03d'%(h,m,s,f)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: minute field extraction', [3600000, 'vtt'], '01:00:00.000'), ('regression variant: minute field extraction', [3849665, 'vtt'], '01:04:09.665'), ('partial repair probe: minute field extraction', [4082731, 'srt'], '01:08:02,731'), ('partial repair variant: minute field extraction', [3689889, 'srt'], '01:01:29,889'), ('boundary control', [0, 'srt'], '00:00:00,000'), ('boundary control', [3599999, 'vtt'], '59:59.999'), ('normal control', [0, 'vtt'], '00:00.000'), ('normal control', [61001, 'vtt'], '01:01.001'), ('normal control', [7834, 'srt'], '00:00:07,834')], [('regression: minute field extraction', [3664439, 'srt'], '01:01:04,439'), ('regression variant: minute field extraction', [360000000, 'srt'], '100:00:00,000'), ('partial repair probe: minute field extraction', [274754132, 'srt'], '76:19:14,132'), ('partial repair variant: minute field extraction', [19225823, 'srt'], '05:20:25,823'), ('boundary control', [0, 'vtt'], '00:00.000'), ('boundary control', [61001, 'vtt'], '01:01.001'), ('normal control', [-999, 'vtt'], '00:00.000'), ('normal control', [60000, 'vtt'], '01:00.000'), ('normal control', [11761, 'vtt'], '00:11.761')], [('regression: minute field extraction', [4082731, 'srt'], '01:08:02,731'), ('regression variant: minute field extraction', [76782995, 'vtt'], '21:19:42.995'), ('partial repair probe: minute field extraction', [360000000, 'vtt'], '100:00:00.000'), ('partial repair variant: minute field extraction', [3673366, 'srt'], '01:01:13,366'), ('boundary control', [-1, 'srt'], '00:00:00,000'), ('boundary control', [0, 'srt'], '00:00:00,000'), ('normal control', [-5000, 'srt'], '00:00:00,000'), ('normal control', [-5000, 'vtt'], '00:00.000'), ('normal control', [5, 'srt'], '00:00:00,005')], [('regression: minute field extraction', [274754132, 'srt'], '76:19:14,132'), ('regression variant: minute field extraction', [175213793, 'vtt'], '48:40:13.793'), ('partial repair probe: minute field extraction', [3849665, 'vtt'], '01:04:09.665'), ('partial repair variant: minute field extraction', [36000000, 'vtt'], '10:00:00.000'), ('boundary control', [3599999, 'vtt'], '59:59.999'), ('boundary control', [0, 'vtt'], '00:00.000'), ('normal control', [59999, 'vtt'], '00:59.999'), ('normal control', [3509491, 'srt'], '00:58:29,491'), ('normal control', [3441818, 'srt'], '00:57:21,818')], [('regression: minute field extraction', [360000000, 'vtt'], '100:00:00.000'), ('regression variant: minute field extraction', [3689889, 'srt'], '01:01:29,889'), ('partial repair probe: minute field extraction', [360000000, 'srt'], '100:00:00,000'), ('partial repair variant: minute field extraction', [290743422, 'vtt'], '80:45:43.422'), ('boundary control', [61001, 'vtt'], '01:01.001'), ('boundary control', [-1, 'srt'], '00:00:00,000'), ('normal control', [65993, 'srt'], '00:01:05,993'), ('normal control', [61977, 'vtt'], '01:01.977'), ('normal control', [-999, 'srt'], '00:00:00,000')]]
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 past the first hour print minute fields such as 61 or 125.

Format integer milliseconds as a cue timestamp. Negative values clamp to 0. style "srt" gives HH:MM:SS,mmm (hours at least two digits, never wrapped); style "vtt" gives MM:SS.mmm when the hour field is zero and HH:MM:SS.mmm otherwise.

split: open-access


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

N = 1
observations = []
def solve(ms, style):
    if ms<0: ms=0
    h=ms//3600000
    m=(ms-h*3600000)//60000
    s=ms//1000%60
    f=ms%1000
    if style=='srt':
        return '%02d:%02d:%02d,%d'%(h,m,s,f)
    if h==0:
        return '%02d:%02d.%03d'%(m,s,f)
    return '%02d:%02d:%02d.%03d'%(h,m,s,f)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: srt millisecond padding', [0, 'srt'], '00:00:00,000'), ('regression variant: srt millisecond padding', [5, 'srt'], '00:00:00,005'), ('partial repair probe: srt millisecond padding', [3541034, 'srt'], '00:59:01,034'), ('partial repair variant: srt millisecond padding', [36000000, 'srt'], '10:00:00,000'), ('boundary control', [0, 'vtt'], '00:00.000'), ('boundary control', [61001, 'vtt'], '01:01.001'), ('normal control', [3600000, 'vtt'], '01:00:00.000'), ('normal control', [7834, 'srt'], '00:00:07,834'), ('normal control', [3664439, 'srt'], '01:01:04,439')], [('regression: srt millisecond padding', [-1, 'srt'], '00:00:00,000'), ('regression variant: srt millisecond padding', [360000000, 'srt'], '100:00:00,000'), ('partial repair probe: srt millisecond padding', [-5000, 'srt'], '00:00:00,000'), ('partial repair variant: srt millisecond padding', [30977039, 'srt'], '08:36:17,039'), ('boundary control', [3600000, 'vtt'], '01:00:00.000'), ('boundary control', [0, 'vtt'], '00:00.000'), ('normal control', [-999, 'vtt'], '00:00.000'), ('normal control', [893654, 'srt'], '00:14:53,654'), ('normal control', [55880, 'vtt'], '00:55.880')], [('regression: srt millisecond padding', [3541034, 'srt'], '00:59:01,034'), ('regression variant: srt millisecond padding', [-1000, 'srt'], '00:00:00,000'), ('partial repair probe: srt millisecond padding', [60000, 'srt'], '00:01:00,000'), ('partial repair variant: srt millisecond padding', [3327047, 'srt'], '00:55:27,047'), ('boundary control', [3599999, 'vtt'], '59:59.999'), ('boundary control', [3600000, 'vtt'], '01:00:00.000'), ('normal control', [11761, 'vtt'], '00:11.761'), ('normal control', [-5000, 'vtt'], '00:00.000'), ('normal control', [3576784, 'srt'], '00:59:36,784')], [('regression: srt millisecond padding', [-5000, 'srt'], '00:00:00,000'), ('regression variant: srt millisecond padding', [-999, 'srt'], '00:00:00,000'), ('partial repair probe: srt millisecond padding', [5, 'srt'], '00:00:00,005'), ('partial repair variant: srt millisecond padding', [379730021, 'srt'], '105:28:50,021'), ('boundary control', [61001, 'vtt'], '01:01.001'), ('boundary control', [3599999, 'vtt'], '59:59.999'), ('normal control', [59999, 'vtt'], '00:59.999'), ('normal control', [3509491, 'srt'], '00:58:29,491'), ('normal control', [175213793, 'vtt'], '48:40:13.793')], [('regression: srt millisecond padding', [60000, 'srt'], '00:01:00,000'), ('regression variant: srt millisecond padding', [36000000, 'srt'], '10:00:00,000'), ('partial repair probe: srt millisecond padding', [360000000, 'srt'], '100:00:00,000'), ('partial repair variant: srt millisecond padding', [3661001, 'srt'], '01:01:01,001'), ('boundary control', [0, 'vtt'], '00:00.000'), ('boundary control', [61001, 'vtt'], '01:01.001'), ('normal control', [3689889, 'srt'], '01:01:29,889'), ('normal control', [3673366, 'srt'], '01:01:13,366'), ('normal control', [290743422, 'vtt'], '80:45:43.422')]]
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(ms, style):
    if ms<0: ms=0
    h=ms//3600000
    m=(ms-h*3600000)//60000
    s=ms//1000%60
    f=ms%1000
    if style=='srt':
        return '%02d:%02d:%02d,%3d'%(h,m,s,f)
    if h==0:
        return '%02d:%02d.%03d'%(m,s,f)
    return '%02d:%02d:%02d.%03d'%(h,m,s,f)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: srt millisecond padding', [0, 'srt'], '00:00:00,000'), ('regression variant: srt millisecond padding', [5, 'srt'], '00:00:00,005'), ('partial repair probe: srt millisecond padding', [3541034, 'srt'], '00:59:01,034'), ('partial repair variant: srt millisecond padding', [36000000, 'srt'], '10:00:00,000'), ('boundary control', [0, 'vtt'], '00:00.000'), ('boundary control', [61001, 'vtt'], '01:01.001'), ('normal control', [3600000, 'vtt'], '01:00:00.000'), ('normal control', [7834, 'srt'], '00:00:07,834'), ('normal control', [3664439, 'srt'], '01:01:04,439')], [('regression: srt millisecond padding', [-1, 'srt'], '00:00:00,000'), ('regression variant: srt millisecond padding', [360000000, 'srt'], '100:00:00,000'), ('partial repair probe: srt millisecond padding', [-5000, 'srt'], '00:00:00,000'), ('partial repair variant: srt millisecond padding', [30977039, 'srt'], '08:36:17,039'), ('boundary control', [3600000, 'vtt'], '01:00:00.000'), ('boundary control', [0, 'vtt'], '00:00.000'), ('normal control', [-999, 'vtt'], '00:00.000'), ('normal control', [893654, 'srt'], '00:14:53,654'), ('normal control', [55880, 'vtt'], '00:55.880')], [('regression: srt millisecond padding', [3541034, 'srt'], '00:59:01,034'), ('regression variant: srt millisecond padding', [-1000, 'srt'], '00:00:00,000'), ('partial repair probe: srt millisecond padding', [60000, 'srt'], '00:01:00,000'), ('partial repair variant: srt millisecond padding', [3327047, 'srt'], '00:55:27,047'), ('boundary control', [3599999, 'vtt'], '59:59.999'), ('boundary control', [3600000, 'vtt'], '01:00:00.000'), ('normal control', [11761, 'vtt'], '00:11.761'), ('normal control', [-5000, 'vtt'], '00:00.000'), ('normal control', [3576784, 'srt'], '00:59:36,784')], [('regression: srt millisecond padding', [-5000, 'srt'], '00:00:00,000'), ('regression variant: srt millisecond padding', [-999, 'srt'], '00:00:00,000'), ('partial repair probe: srt millisecond padding', [5, 'srt'], '00:00:00,005'), ('partial repair variant: srt millisecond padding', [379730021, 'srt'], '105:28:50,021'), ('boundary control', [61001, 'vtt'], '01:01.001'), ('boundary control', [3599999, 'vtt'], '59:59.999'), ('normal control', [59999, 'vtt'], '00:59.999'), ('normal control', [3509491, 'srt'], '00:58:29,491'), ('normal control', [175213793, 'vtt'], '48:40:13.793')], [('regression: srt millisecond padding', [60000, 'srt'], '00:01:00,000'), ('regression variant: srt millisecond padding', [36000000, 'srt'], '10:00:00,000'), ('partial repair probe: srt millisecond padding', [360000000, 'srt'], '100:00:00,000'), ('partial repair variant: srt millisecond padding', [3661001, 'srt'], '01:01:01,001'), ('boundary control', [0, 'vtt'], '00:00.000'), ('boundary control', [61001, 'vtt'], '01:01.001'), ('normal control', [3689889, 'srt'], '01:01:29,889'), ('normal control', [3673366, 'srt'], '01:01:13,366'), ('normal control', [290743422, 'vtt'], '80:45:43.422')]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
An SRT cue at 1.050 s is written as 00:00:01,50, which readers interpret as 500 ms.

Format integer milliseconds as a cue timestamp. Negative values clamp to 0. style "srt" gives HH:MM:SS,mmm (hours at least two digits, never wrapped); style "vtt" gives MM:SS.mmm when the hour field is zero and HH:MM:SS.mmm otherwise.

split: open-access


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

N = 1
observations = []
def solve(ms, style):
    if ms<0: ms=0
    h=ms//3600000
    m=(ms-h*3600000)//60000
    s=ms//1000%60
    f=ms%1000
    if style=='srt':
        return '%02d:%02d:%02d,%03d'%(h,m,s,f)
    if h==0 and m==0:
        return '%02d:%02d.%03d'%(m,s,f)
    return '%02d:%02d:%02d.%03d'%(h,m,s,f)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: vtt hour omission', [3599999, 'vtt'], '59:59.999'), ('regression variant: vtt hour omission', [61977, 'vtt'], '01:01.977'), ('partial repair probe: vtt hour omission', [3192469, 'vtt'], '53:12.469'), ('partial repair variant: vtt hour omission', [3189669, 'vtt'], '53:09.669'), ('boundary control', [0, 'srt'], '00:00:00,000'), ('boundary control', [3600000, 'vtt'], '01:00:00.000'), ('normal control', [0, 'vtt'], '00:00.000'), ('normal control', [7834, 'srt'], '00:00:07,834'), ('normal control', [3664439, 'srt'], '01:01:04,439')], [('regression: vtt hour omission', [61001, 'vtt'], '01:01.001'), ('regression variant: vtt hour omission', [153727, 'vtt'], '02:33.727'), ('partial repair probe: vtt hour omission', [353272, 'vtt'], '05:53.272'), ('partial repair variant: vtt hour omission', [37938, 'vtt'], '00:37.938'), ('boundary control', [0, 'vtt'], '00:00.000'), ('boundary control', [0, 'srt'], '00:00:00,000'), ('normal control', [4082731, 'srt'], '01:08:02,731'), ('normal control', [3541034, 'srt'], '00:59:01,034'), ('normal control', [334598, 'srt'], '00:05:34,598')], [('regression: vtt hour omission', [3192469, 'vtt'], '53:12.469'), ('regression variant: vtt hour omission', [3189669, 'vtt'], '53:09.669'), ('partial repair probe: vtt hour omission', [55880, 'vtt'], '00:55.880'), ('partial repair variant: vtt hour omission', [1976232, 'vtt'], '32:56.232'), ('boundary control', [-1, 'srt'], '00:00:00,000'), ('boundary control', [0, 'vtt'], '00:00.000'), ('normal control', [60000, 'srt'], '00:01:00,000'), ('normal control', [5, 'srt'], '00:00:00,005'), ('normal control', [3849665, 'vtt'], '01:04:09.665')], [('regression: vtt hour omission', [353272, 'vtt'], '05:53.272'), ('regression variant: vtt hour omission', [1976232, 'vtt'], '32:56.232'), ('partial repair probe: vtt hour omission', [11761, 'vtt'], '00:11.761'), ('partial repair variant: vtt hour omission', [37617, 'vtt'], '00:37.617'), ('boundary control', [3600000, 'vtt'], '01:00:00.000'), ('boundary control', [-1, 'srt'], '00:00:00,000'), ('normal control', [76782995, 'vtt'], '21:19:42.995'), ('normal control', [3509491, 'srt'], '00:58:29,491'), ('normal control', [175213793, 'vtt'], '48:40:13.793')], [('regression: vtt hour omission', [60000, 'vtt'], '01:00.000'), ('regression variant: vtt hour omission', [3328850, 'vtt'], '55:28.850'), ('partial repair probe: vtt hour omission', [59999, 'vtt'], '00:59.999'), ('partial repair variant: vtt hour omission', [33430, 'vtt'], '00:33.430'), ('boundary control', [0, 'srt'], '00:00:00,000'), ('boundary control', [3600000, 'vtt'], '01:00:00.000'), ('normal control', [3689889, 'srt'], '01:01:29,889'), ('normal control', [3673366, 'srt'], '01:01:13,366'), ('normal control', [290743422, 'vtt'], '80:45:43.422')]]
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(ms, style):
    if ms<0: ms=0
    h=ms//3600000
    m=(ms-h*3600000)//60000
    s=ms//1000%60
    f=ms%1000
    if style=='srt':
        return '%02d:%02d:%02d,%03d'%(h,m,s,f)
    if h==0 and s==0:
        return '%02d:%02d.%03d'%(m,s,f)
    return '%02d:%02d:%02d.%03d'%(h,m,s,f)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: vtt hour omission', [3599999, 'vtt'], '59:59.999'), ('regression variant: vtt hour omission', [61977, 'vtt'], '01:01.977'), ('partial repair probe: vtt hour omission', [3192469, 'vtt'], '53:12.469'), ('partial repair variant: vtt hour omission', [3189669, 'vtt'], '53:09.669'), ('boundary control', [0, 'srt'], '00:00:00,000'), ('boundary control', [3600000, 'vtt'], '01:00:00.000'), ('normal control', [0, 'vtt'], '00:00.000'), ('normal control', [7834, 'srt'], '00:00:07,834'), ('normal control', [3664439, 'srt'], '01:01:04,439')], [('regression: vtt hour omission', [61001, 'vtt'], '01:01.001'), ('regression variant: vtt hour omission', [153727, 'vtt'], '02:33.727'), ('partial repair probe: vtt hour omission', [353272, 'vtt'], '05:53.272'), ('partial repair variant: vtt hour omission', [37938, 'vtt'], '00:37.938'), ('boundary control', [0, 'vtt'], '00:00.000'), ('boundary control', [0, 'srt'], '00:00:00,000'), ('normal control', [4082731, 'srt'], '01:08:02,731'), ('normal control', [3541034, 'srt'], '00:59:01,034'), ('normal control', [334598, 'srt'], '00:05:34,598')], [('regression: vtt hour omission', [3192469, 'vtt'], '53:12.469'), ('regression variant: vtt hour omission', [3189669, 'vtt'], '53:09.669'), ('partial repair probe: vtt hour omission', [55880, 'vtt'], '00:55.880'), ('partial repair variant: vtt hour omission', [1976232, 'vtt'], '32:56.232'), ('boundary control', [-1, 'srt'], '00:00:00,000'), ('boundary control', [0, 'vtt'], '00:00.000'), ('normal control', [60000, 'srt'], '00:01:00,000'), ('normal control', [5, 'srt'], '00:00:00,005'), ('normal control', [3849665, 'vtt'], '01:04:09.665')], [('regression: vtt hour omission', [353272, 'vtt'], '05:53.272'), ('regression variant: vtt hour omission', [1976232, 'vtt'], '32:56.232'), ('partial repair probe: vtt hour omission', [11761, 'vtt'], '00:11.761'), ('partial repair variant: vtt hour omission', [37617, 'vtt'], '00:37.617'), ('boundary control', [3600000, 'vtt'], '01:00:00.000'), ('boundary control', [-1, 'srt'], '00:00:00,000'), ('normal control', [76782995, 'vtt'], '21:19:42.995'), ('normal control', [3509491, 'srt'], '00:58:29,491'), ('normal control', [175213793, 'vtt'], '48:40:13.793')], [('regression: vtt hour omission', [60000, 'vtt'], '01:00.000'), ('regression variant: vtt hour omission', [3328850, 'vtt'], '55:28.850'), ('partial repair probe: vtt hour omission', [59999, 'vtt'], '00:59.999'), ('partial repair variant: vtt hour omission', [33430, 'vtt'], '00:33.430'), ('boundary control', [0, 'srt'], '00:00:00,000'), ('boundary control', [3600000, 'vtt'], '01:00:00.000'), ('normal control', [3689889, 'srt'], '01:01:29,889'), ('normal control', [3673366, 'srt'], '01:01:13,366'), ('normal control', [290743422, 'vtt'], '80:45:43.422')]]
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:
WebVTT cues between one and sixty minutes are written with a redundant 00: hour prefix.

Format integer milliseconds as a cue timestamp. Negative values clamp to 0. style "srt" gives HH:MM:SS,mmm (hours at least two digits, never wrapped); style "vtt" gives MM:SS.mmm when the hour field is zero and HH:MM:SS.mmm otherwise.

split: open-access


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

N = 1
observations = []
def solve(ms, style):
    if ms<0: ms=0
    h=ms//3600000
    m=(ms-h*3600000)//60000
    s=ms//1000%60
    f=ms%1000
    if style=='srt':
        return '%02d:%02d:%02d,%03d'%(h,m,s,f)
    if h==0:
        return '%02d:%02d,%03d'%(m,s,f)
    return '%02d:%02d:%02d.%03d'%(h,m,s,f)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: vtt short separator', [0, 'vtt'], '00:00.000'), ('regression variant: vtt short separator', [353272, 'vtt'], '05:53.272'), ('partial repair probe: vtt short separator', [-999, 'vtt'], '00:00.000'), ('partial repair variant: vtt short separator', [110, 'vtt'], '00:00.110'), ('boundary control', [0, 'srt'], '00:00:00,000'), ('boundary control', [-1, 'srt'], '00:00:00,000'), ('normal control', [3600000, 'vtt'], '01:00:00.000'), ('normal control', [7834, 'srt'], '00:00:07,834'), ('normal control', [4082731, 'srt'], '01:08:02,731')], [('regression: vtt short separator', [3599999, 'vtt'], '59:59.999'), ('regression variant: vtt short separator', [60000, 'vtt'], '01:00.000'), ('partial repair probe: vtt short separator', [353272, 'vtt'], '05:53.272'), ('partial repair variant: vtt short separator', [61977, 'vtt'], '01:01.977'), ('boundary control', [-1, 'srt'], '00:00:00,000'), ('boundary control', [3600000, 'vtt'], '01:00:00.000'), ('normal control', [274754132, 'srt'], '76:19:14,132'), ('normal control', [334598, 'srt'], '00:05:34,598'), ('normal control', [60000, 'srt'], '00:01:00,000')], [('regression: vtt short separator', [61001, 'vtt'], '01:01.001'), ('regression variant: vtt short separator', [55880, 'vtt'], '00:55.880'), ('partial repair probe: vtt short separator', [60000, 'vtt'], '01:00.000'), ('partial repair variant: vtt short separator', [153727, 'vtt'], '02:33.727'), ('boundary control', [3600000, 'vtt'], '01:00:00.000'), ('boundary control', [0, 'srt'], '00:00:00,000'), ('normal control', [5, 'srt'], '00:00:00,005'), ('normal control', [360000000, 'srt'], '100:00:00,000'), ('normal control', [-1000, 'srt'], '00:00:00,000')], [('regression: vtt short separator', [3192469, 'vtt'], '53:12.469'), ('regression variant: vtt short separator', [11761, 'vtt'], '00:11.761'), ('partial repair probe: vtt short separator', [55880, 'vtt'], '00:55.880'), ('partial repair variant: vtt short separator', [37938, 'vtt'], '00:37.938'), ('boundary control', [0, 'srt'], '00:00:00,000'), ('boundary control', [-1, 'srt'], '00:00:00,000'), ('normal control', [3509491, 'srt'], '00:58:29,491'), ('normal control', [3441818, 'srt'], '00:57:21,818'), ('normal control', [22968, 'srt'], '00:00:22,968')], [('regression: vtt short separator', [-999, 'vtt'], '00:00.000'), ('regression variant: vtt short separator', [-5000, 'vtt'], '00:00.000'), ('partial repair probe: vtt short separator', [11761, 'vtt'], '00:11.761'), ('partial repair variant: vtt short separator', [37617, 'vtt'], '00:37.617'), ('boundary control', [-1, 'srt'], '00:00:00,000'), ('boundary control', [3600000, 'vtt'], '01:00:00.000'), ('normal control', [3673366, 'srt'], '01:01:13,366'), ('normal control', [3854981, 'srt'], '01:04:14,981'), ('normal control', [65993, 'srt'], '00:01:05,993')]]
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(ms, style):
    if ms<0: ms=0
    h=ms//3600000
    m=(ms-h*3600000)//60000
    s=ms//1000%60
    f=ms%1000
    if style=='srt':
        return '%02d:%02d:%02d,%03d'%(h,m,s,f)
    if h==0:
        return '%d:%02d.%03d'%(m,s,f)
    return '%02d:%02d:%02d.%03d'%(h,m,s,f)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: vtt short separator', [0, 'vtt'], '00:00.000'), ('regression variant: vtt short separator', [353272, 'vtt'], '05:53.272'), ('partial repair probe: vtt short separator', [-999, 'vtt'], '00:00.000'), ('partial repair variant: vtt short separator', [110, 'vtt'], '00:00.110'), ('boundary control', [0, 'srt'], '00:00:00,000'), ('boundary control', [-1, 'srt'], '00:00:00,000'), ('normal control', [3600000, 'vtt'], '01:00:00.000'), ('normal control', [7834, 'srt'], '00:00:07,834'), ('normal control', [4082731, 'srt'], '01:08:02,731')], [('regression: vtt short separator', [3599999, 'vtt'], '59:59.999'), ('regression variant: vtt short separator', [60000, 'vtt'], '01:00.000'), ('partial repair probe: vtt short separator', [353272, 'vtt'], '05:53.272'), ('partial repair variant: vtt short separator', [61977, 'vtt'], '01:01.977'), ('boundary control', [-1, 'srt'], '00:00:00,000'), ('boundary control', [3600000, 'vtt'], '01:00:00.000'), ('normal control', [274754132, 'srt'], '76:19:14,132'), ('normal control', [334598, 'srt'], '00:05:34,598'), ('normal control', [60000, 'srt'], '00:01:00,000')], [('regression: vtt short separator', [61001, 'vtt'], '01:01.001'), ('regression variant: vtt short separator', [55880, 'vtt'], '00:55.880'), ('partial repair probe: vtt short separator', [60000, 'vtt'], '01:00.000'), ('partial repair variant: vtt short separator', [153727, 'vtt'], '02:33.727'), ('boundary control', [3600000, 'vtt'], '01:00:00.000'), ('boundary control', [0, 'srt'], '00:00:00,000'), ('normal control', [5, 'srt'], '00:00:00,005'), ('normal control', [360000000, 'srt'], '100:00:00,000'), ('normal control', [-1000, 'srt'], '00:00:00,000')], [('regression: vtt short separator', [3192469, 'vtt'], '53:12.469'), ('regression variant: vtt short separator', [11761, 'vtt'], '00:11.761'), ('partial repair probe: vtt short separator', [55880, 'vtt'], '00:55.880'), ('partial repair variant: vtt short separator', [37938, 'vtt'], '00:37.938'), ('boundary control', [0, 'srt'], '00:00:00,000'), ('boundary control', [-1, 'srt'], '00:00:00,000'), ('normal control', [3509491, 'srt'], '00:58:29,491'), ('normal control', [3441818, 'srt'], '00:57:21,818'), ('normal control', [22968, 'srt'], '00:00:22,968')], [('regression: vtt short separator', [-999, 'vtt'], '00:00.000'), ('regression variant: vtt short separator', [-5000, 'vtt'], '00:00.000'), ('partial repair probe: vtt short separator', [11761, 'vtt'], '00:11.761'), ('partial repair variant: vtt short separator', [37617, 'vtt'], '00:37.617'), ('boundary control', [-1, 'srt'], '00:00:00,000'), ('boundary control', [3600000, 'vtt'], '01:00:00.000'), ('normal control', [3673366, 'srt'], '01:01:13,366'), ('normal control', [3854981, 'srt'], '01:04:14,981'), ('normal control', [65993, 'srt'], '00:01:05,993')]]
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:
Short WebVTT timestamps contain a comma and are rejected by players.

Format integer milliseconds as a cue timestamp. Negative values clamp to 0. style "srt" gives HH:MM:SS,mmm (hours at least two digits, never wrapped); style "vtt" gives MM:SS.mmm when the hour field is zero and HH:MM:SS.mmm otherwise.

split: open-access


prompt:
The cue that begins exactly at the chosen resync point keeps its old timing while all later cues move.

Cues [start,end,text] (sorted by start) whose start is at or after from_ms are shifted by offset ms (start and end). A cue whose end becomes <= 0 is dropped; a negative start is clamped to 0 without moving its end. The result is re-sorted by (start,end) and numbered from 1 as [n,start,end,text].

split: open-access


prompt:
A cue that ends exactly at time zero after shifting survives as a zero-length cue.

Cues [start,end,text] (sorted by start) whose start is at or after from_ms are shifted by offset ms (start and end). A cue whose end becomes <= 0 is dropped; a negative start is clamped to 0 without moving its end. The result is re-sorted by (start,end) and numbered from 1 as [n,start,end,text].

split: open-access


prompt:
Cues that straddle zero after an early shift disappear entirely.

Cues [start,end,text] (sorted by start) whose start is at or after from_ms are shifted by offset ms (start and end). A cue whose end becomes <= 0 is dropped; a negative start is clamped to 0 without moving its end. The result is re-sorted by (start,end) and numbered from 1 as [n,start,end,text].

split: open-access


prompt:
After a negative partial resync, cue numbers no longer follow display order.

Cues [start,end,text] (sorted by start) whose start is at or after from_ms are shifted by offset ms (start and end). A cue whose end becomes <= 0 is dropped; a negative start is clamped to 0 without moving its end. The result is re-sorted by (start,end) and numbered from 1 as [n,start,end,text].

split: open-access


prompt:
Shifted cues keep their old end time and become too long or inverted.

Cues [start,end,text] (sorted by start) whose start is at or after from_ms are shifted by offset ms (start and end). A cue whose end becomes <= 0 is dropped; a negative start is clamped to 0 without moving its end. The result is re-sorted by (start,end) and numbered from 1 as [n,start,end,text].

split: open-access


prompt:
After a PAL speed-up conversion subtitles drift later and later behind the dialogue.

Cue times authored against a src frame rate are rescaled for playback at dst by t*src/dst, rounded half up to integer ms. Rates are "N", "N/D", or the aliases "23.976"/"29.97" meaning (N+1)*1000/1001. The end is rounded independently; an end that does not exceed the start becomes start+1.

split: open-access


prompt:
NTSC-rate sources written as 30000/1001 retime as if they were exactly 29 fps.

Cue times authored against a src frame rate are rescaled for playback at dst by t*src/dst, rounded half up to integer ms. Rates are "N", "N/D", or the aliases "23.976"/"29.97" meaning (N+1)*1000/1001. The end is rounded independently; an end that does not exceed the start becomes start+1.

split: open-access


prompt:
Files labelled 23.976 accumulate a small drift against the real 24000/1001 video.

Cue times authored against a src frame rate are rescaled for playback at dst by t*src/dst, rounded half up to integer ms. Rates are "N", "N/D", or the aliases "23.976"/"29.97" meaning (N+1)*1000/1001. The end is rounded independently; an end that does not exceed the start becomes start+1.

split: open-access


prompt:
Cue starts land one millisecond early whenever the scaled time has a fractional half or more.

Cue times authored against a src frame rate are rescaled for playback at dst by t*src/dst, rounded half up to integer ms. Rates are "N", "N/D", or the aliases "23.976"/"29.97" meaning (N+1)*1000/1001. The end is rounded independently; an end that does not exceed the start becomes start+1.

split: open-access


prompt:
Cue ends are off by a millisecond relative to the independently scaled timeline.

Cue times authored against a src frame rate are rescaled for playback at dst by t*src/dst, rounded half up to integer ms. Rates are "N", "N/D", or the aliases "23.976"/"29.97" meaning (N+1)*1000/1001. The end is rounded independently; an end that does not exceed the start becomes start+1.

split: open-access


prompt:
Cues appear a frame after the dialogue begins.

For fps "N" or "N/D", frame k starts at k*1000*D/N ms. Each cue [start,end] (sorted) gets start frame floor(start*N/(1000*D)) and end frame ceil(end*N/(1000*D)), at least one frame long. A cue whose start frame precedes the previous cue end frame is pushed to that end frame (and kept at least one frame long). Output [a,b,ms(a),ms(b)] with ms(k)=floor(k*1000*D/N).

split: open-access


prompt:
Cues vanish one frame before the spoken line ends.

For fps "N" or "N/D", frame k starts at k*1000*D/N ms. Each cue [start,end] (sorted) gets start frame floor(start*N/(1000*D)) and end frame ceil(end*N/(1000*D)), at least one frame long. A cue whose start frame precedes the previous cue end frame is pushed to that end frame (and kept at least one frame long). Output [a,b,ms(a),ms(b)] with ms(k)=floor(k*1000*D/N).

split: open-access


prompt:
Consecutive snapped cues share frames and flicker on screen together.

For fps "N" or "N/D", frame k starts at k*1000*D/N ms. Each cue [start,end] (sorted) gets start frame floor(start*N/(1000*D)) and end frame ceil(end*N/(1000*D)), at least one frame long. A cue whose start frame precedes the previous cue end frame is pushed to that end frame (and kept at least one frame long). Output [a,b,ms(a),ms(b)] with ms(k)=floor(k*1000*D/N).

split: open-access


prompt:
Snapped cues overlap by several frames after a long cue.

For fps "N" or "N/D", frame k starts at k*1000*D/N ms. Each cue [start,end] (sorted) gets start frame floor(start*N/(1000*D)) and end frame ceil(end*N/(1000*D)), at least one frame long. A cue whose start frame precedes the previous cue end frame is pushed to that end frame (and kept at least one frame long). Output [a,b,ms(a),ms(b)] with ms(k)=floor(k*1000*D/N).

split: open-access


prompt:
Millisecond boundaries of NTSC-rate cues are about 0.1 percent early.

For fps "N" or "N/D", frame k starts at k*1000*D/N ms. Each cue [start,end] (sorted) gets start frame floor(start*N/(1000*D)) and end frame ceil(end*N/(1000*D)), at least one frame long. A cue whose start frame precedes the previous cue end frame is pushed to that end frame (and kept at least one frame long). Output [a,b,ms(a),ms(b)] with ms(k)=floor(k*1000*D/N).

split: open-access


prompt:
Cues with a tiny positive gap blink the screen for a couple of frames between lines.

For sorted cues [start,end], compare each cue with the next start. If gap = next_start - end is below min_gap, the end is trimmed to next_start - min_gap but never below start+1. If min_gap <= gap < chain, the end is extended to next_start - min_gap. Larger gaps are untouched.

split: open-access


prompt:
A short cue followed immediately by another ends before it starts.

For sorted cues [start,end], compare each cue with the next start. If gap = next_start - end is below min_gap, the end is trimmed to next_start - min_gap but never below start+1. If min_gap <= gap < chain, the end is extended to next_start - min_gap. Larger gaps are untouched.

split: open-access


prompt:
Gaps of exactly the chaining threshold are closed although the contract leaves them open.

For sorted cues [start,end], compare each cue with the next start. If gap = next_start - end is below min_gap, the end is trimmed to next_start - min_gap but never below start+1. If min_gap <= gap < chain, the end is extended to next_start - min_gap. Larger gaps are untouched.

split: open-access


prompt:
Chained cues touch the next cue with no separating gap.

For sorted cues [start,end], compare each cue with the next start. If gap = next_start - end is below min_gap, the end is trimmed to next_start - min_gap but never below start+1. If min_gap <= gap < chain, the end is extended to next_start - min_gap. Larger gaps are untouched.

split: open-access


prompt:
Almost no cue is ever trimmed or chained because gaps look enormous.

For sorted cues [start,end], compare each cue with the next start. If gap = next_start - end is below min_gap, the end is trimmed to next_start - min_gap but never below start+1. If min_gap <= gap < chain, the end is extended to next_start - min_gap. Larger gaps are untouched.

split: open-access


prompt:
Short cues become much longer than the minimum duration.

Cues [start,end] may be unsorted; the neighbour of a cue is the next cue in (start, input index) order. A cue shorter than min_dur has its end extended to start+min_dur, limited to neighbour_start - min_gap; an end is never shortened. Output keeps input order.

split: open-access


prompt:
Extended cues butt directly against the following cue.

Cues [start,end] may be unsorted; the neighbour of a cue is the next cue in (start, input index) order. A cue shorter than min_dur has its end extended to start+min_dur, limited to neighbour_start - min_gap; an end is never shortened. Output keeps input order.

split: open-access


prompt:
Short cues crowded by a close neighbour get even shorter or inverted.

Cues [start,end] may be unsorted; the neighbour of a cue is the next cue in (start, input index) order. A cue shorter than min_dur has its end extended to start+min_dur, limited to neighbour_start - min_gap; an end is never shortened. Output keeps input order.

split: open-access


prompt:
In files with out-of-order cues the extension is limited by the wrong neighbour.

Cues [start,end] may be unsorted; the neighbour of a cue is the next cue in (start, input index) order. A cue shorter than min_dur has its end extended to start+min_dur, limited to neighbour_start - min_gap; an end is never shortened. Output keeps input order.

split: open-access


prompt:
Cues late in the programme are never extended no matter how short they are.

Cues [start,end] may be unsorted; the neighbour of a cue is the next cue in (start, input index) order. A cue shorter than min_dur has its end extended to start+min_dur, limited to neighbour_start - min_gap; an end is never shortened. Output keeps input order.

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>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: tag stripping', [[[8781, 9781, 'x\ny\nz'], [6605, 6664, 'x\n'], [733, 723, 'Red'], [2157, 2147, 'a']], 17], [3, 4]), ('regression variant: tag stripping', [[[7326, 7326, ''], [6999, 7058, 'a'], [7165, 7635, '<c.yellow>Cue</c> text'], [2882, 4882, 'abcd']], 17], [3]), ('partial repair probe: tag stripping', [[[4743, 5143, 'A'], [1982, 2982, 'Hi there'], [5318, 5468, 'Red'], [4990, 5140, 'Red'], [1465, 1965, 'A']], 20], []), ('partial repair variant: tag stripping', [[[4912, 5382, 'Hi there'], [4236, 4295, 'I'], [7060, 7560, '<c.yellow>Cue</c> text'], [81, 81, 'Two\nlines']], 17], [1, 4]), ('boundary control', [[[0, 1000, 'abcdefghij']], 10], []), ('boundary control', [[[0, 500, 'a\r\nb']], 5], []), ('normal control', [[[0, 0, 'a']], 17], [1]), ('normal control', [[[839, 3839, 'I'], [4652, 6652, 'x\ny\nz']], 17], []), ('normal control', [[[2569, 2769, 'A\r\nB\r\nC'], [1782, 1782, 'x\ny\nz']], 15], [2])], [('regression: tag stripping', [[[2260, 3260, '  spaced  '], [770, 770, 'Red'], [4134, 4201, 'a'], [6488, 9488, '<c.yellow>Cue</c> text']], 15], [2]), ('regression variant: tag stripping', [[[3511, 4712, 'Italic text'], [839, 829, 'Red'], [8024, 8358, 'x\ny\nz'], [1857, 1857, '']], 15], [2]), ('partial repair probe: tag stripping', [[[8476, 8947, 'Hi there'], [6662, 7162, 'Red'], [6248, 6365, 'x\n'], [2603, 3103, 'x\n'], [4374, 4874, 'I']], 17], []), ('partial repair variant: tag stripping', [[[8515, 9515, '<c.yellow>Cue</c> text'], [836, 1337, 'x\ny\nz']], 10], []), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('boundary control', [[[0, 1000, 'abcdefghij']], 10], []), ('normal control', [[[7799, 7899, ''], [6867, 9867, 'Hello'], [1132, 1132, '<c.yellow>Cue</c> text'], [3310, 3310, 'a']], 17], [3, 4]), ('normal control', [[[1285, 1285, '<c.yellow>Cue</c> text'], [4496, 4596, 'A'], [6179, 6169, 'Hello']], 20], [1, 3]), ('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])], [('regression: tag stripping', [[[1726, 1992, 'abcd'], [9258, 10258, 'A']], 15], [1]), ('regression variant: tag stripping', [[[3725, 6725, '<c.yellow>Cue</c> text'], [8427, 8663, 'abcd'], [9335, 9325, 'Red']], 17], [3]), ('partial repair probe: tag stripping', [[[1536, 2070, '<c.yellow>Cue</c> text']], 15], []), ('partial repair variant: tag stripping', [[[2586, 4586, 'a'], [6090, 8090, 'Two\r\nlines'], [5201, 5501, 'Red'], [3151, 3152, ''], [8829, 8929, 'I']], 10], []), ('boundary control', [[[0, 0, '']], 17], []), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('normal control', [[[8892, 9392, 'Two\nlines']], 10], [1]), ('normal control', [[[5514, 5765, 'Hello']], 20], []), ('normal control', [[[5649, 5916, 'abcd'], [3007, 2997, 'Hello'], [9574, 9574, 'A\r\nB\r\nC'], [6652, 7319, '  spaced  ']], 15], [2, 3])], [('regression: tag stripping', [[[7961, 7961, 'x\n'], [4865, 5399, 'Hi there'], [9675, 12675, ''], [2209, 3410, 'abcd'], [4016, 4116, 'abcd']], 15], [1, 5]), ('regression variant: tag stripping', [[[8642, 8642, 'Red'], [5828, 5818, 'Two\r\nlines'], [3091, 3591, 'a'], [1539, 1839, 'x\ny\nz']], 10], [1, 2]), ('partial repair probe: tag stripping', [[[8643, 9643, 'Italic text'], [6224, 7224, 'Red']], 10], [1]), ('partial repair variant: tag stripping', [[[6644, 7644, 'abcd'], [1488, 1988, 'Italic text'], [6071, 6371, 'Red'], [800, 800, 'Italic text']], 10], [2, 4]), ('boundary control', [[[0, 500, 'a\r\nb']], 5], []), ('boundary control', [[[0, 0, '']], 17], []), ('normal control', [[[540, 607, 'a'], [5643, 7643, 'Italic text']], 15], []), ('normal control', [[[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]), ('normal control', [[[8192, 8192, 'x\ny\nz']], 20], [1])], [('regression: tag stripping', [[[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]), ('regression variant: tag stripping', [[[9540, 9540, 'A']], 20], [1]), ('partial repair probe: tag stripping', [[[463, 863, '<c.yellow>Cue</c> text'], [8098, 9098, 'A'], [8359, 8859, 'Long line of dialogue here'], [2340, 2741, 'Two\nlines'], [4451, 4451, 'A\r\nB\r\nC']], 20], [3, 5]), ('partial repair variant: tag stripping', [[[4798, 4898, 'a'], [6925, 9925, 'Two\r\nlines'], [8398, 9398, 'Red'], [5098, 5298, 'Red']], 15], []), ('boundary control', [[[0, 1000, 'abcdefghij']], 10], []), ('boundary control', [[[0, 500, 'a\r\nb']], 5], []), ('normal control', [[[6951, 7480, 'Two\nlines'], [5406, 5906, 'x\ny\nz'], [1631, 2101, 'Hi there'], [6704, 7234, 'Two\nlines']], 17], [3]), ('normal control', [[[3319, 3319, ''], [9021, 9021, '  spaced  '], [4466, 5367, 'Two\nlines'], [3595, 4096, 'Hello'], [4276, 5276, '  spaced  ']], 10], [2]), ('normal control', [[[955, 1005, 'A'], [9350, 11350, 'abcd'], [864, 854, 'A\r\nB\r\nC'], [6216, 6716, 'Long line of dialogue here']], 20], [3, 4])]]
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'</?[a-z]>','',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: tag stripping', [[[8781, 9781, 'x\ny\nz'], [6605, 6664, 'x\n'], [733, 723, 'Red'], [2157, 2147, 'a']], 17], [3, 4]), ('regression variant: tag stripping', [[[7326, 7326, ''], [6999, 7058, 'a'], [7165, 7635, '<c.yellow>Cue</c> text'], [2882, 4882, 'abcd']], 17], [3]), ('partial repair probe: tag stripping', [[[4743, 5143, 'A'], [1982, 2982, 'Hi there'], [5318, 5468, 'Red'], [4990, 5140, 'Red'], [1465, 1965, 'A']], 20], []), ('partial repair variant: tag stripping', [[[4912, 5382, 'Hi there'], [4236, 4295, 'I'], [7060, 7560, '<c.yellow>Cue</c> text'], [81, 81, 'Two\nlines']], 17], [1, 4]), ('boundary control', [[[0, 1000, 'abcdefghij']], 10], []), ('boundary control', [[[0, 500, 'a\r\nb']], 5], []), ('normal control', [[[0, 0, 'a']], 17], [1]), ('normal control', [[[839, 3839, 'I'], [4652, 6652, 'x\ny\nz']], 17], []), ('normal control', [[[2569, 2769, 'A\r\nB\r\nC'], [1782, 1782, 'x\ny\nz']], 15], [2])], [('regression: tag stripping', [[[2260, 3260, '  spaced  '], [770, 770, 'Red'], [4134, 4201, 'a'], [6488, 9488, '<c.yellow>Cue</c> text']], 15], [2]), ('regression variant: tag stripping', [[[3511, 4712, 'Italic text'], [839, 829, 'Red'], [8024, 8358, 'x\ny\nz'], [1857, 1857, '']], 15], [2]), ('partial repair probe: tag stripping', [[[8476, 8947, 'Hi there'], [6662, 7162, 'Red'], [6248, 6365, 'x\n'], [2603, 3103, 'x\n'], [4374, 4874, 'I']], 17], []), ('partial repair variant: tag stripping', [[[8515, 9515, '<c.yellow>Cue</c> text'], [836, 1337, 'x\ny\nz']], 10], []), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('boundary control', [[[0, 1000, 'abcdefghij']], 10], []), ('normal control', [[[7799, 7899, ''], [6867, 9867, 'Hello'], [1132, 1132, '<c.yellow>Cue</c> text'], [3310, 3310, 'a']], 17], [3, 4]), ('normal control', [[[1285, 1285, '<c.yellow>Cue</c> text'], [4496, 4596, 'A'], [6179, 6169, 'Hello']], 20], [1, 3]), ('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])], [('regression: tag stripping', [[[1726, 1992, 'abcd'], [9258, 10258, 'A']], 15], [1]), ('regression variant: tag stripping', [[[3725, 6725, '<c.yellow>Cue</c> text'], [8427, 8663, 'abcd'], [9335, 9325, 'Red']], 17], [3]), ('partial repair probe: tag stripping', [[[1536, 2070, '<c.yellow>Cue</c> text']], 15], []), ('partial repair variant: tag stripping', [[[2586, 4586, 'a'], [6090, 8090, 'Two\r\nlines'], [5201, 5501, 'Red'], [3151, 3152, ''], [8829, 8929, 'I']], 10], []), ('boundary control', [[[0, 0, '']], 17], []), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('normal control', [[[8892, 9392, 'Two\nlines']], 10], [1]), ('normal control', [[[5514, 5765, 'Hello']], 20], []), ('normal control', [[[5649, 5916, 'abcd'], [3007, 2997, 'Hello'], [9574, 9574, 'A\r\nB\r\nC'], [6652, 7319, '  spaced  ']], 15], [2, 3])], [('regression: tag stripping', [[[7961, 7961, 'x\n'], [4865, 5399, 'Hi there'], [9675, 12675, ''], [2209, 3410, 'abcd'], [4016, 4116, 'abcd']], 15], [1, 5]), ('regression variant: tag stripping', [[[8642, 8642, 'Red'], [5828, 5818, 'Two\r\nlines'], [3091, 3591, 'a'], [1539, 1839, 'x\ny\nz']], 10], [1, 2]), ('partial repair probe: tag stripping', [[[8643, 9643, 'Italic text'], [6224, 7224, 'Red']], 10], [1]), ('partial repair variant: tag stripping', [[[6644, 7644, 'abcd'], [1488, 1988, 'Italic text'], [6071, 6371, 'Red'], [800, 800, 'Italic text']], 10], [2, 4]), ('boundary control', [[[0, 500, 'a\r\nb']], 5], []), ('boundary control', [[[0, 0, '']], 17], []), ('normal control', [[[540, 607, 'a'], [5643, 7643, 'Italic text']], 15], []), ('normal control', [[[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]), ('normal control', [[[8192, 8192, 'x\ny\nz']], 20], [1])], [('regression: tag stripping', [[[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]), ('regression variant: tag stripping', [[[9540, 9540, 'A']], 20], [1]), ('partial repair probe: tag stripping', [[[463, 863, '<c.yellow>Cue</c> text'], [8098, 9098, 'A'], [8359, 8859, 'Long line of dialogue here'], [2340, 2741, 'Two\nlines'], [4451, 4451, 'A\r\nB\r\nC']], 20], [3, 5]), ('partial repair variant: tag stripping', [[[4798, 4898, 'a'], [6925, 9925, 'Two\r\nlines'], [8398, 9398, 'Red'], [5098, 5298, 'Red']], 15], []), ('boundary control', [[[0, 1000, 'abcdefghij']], 10], []), ('boundary control', [[[0, 500, 'a\r\nb']], 5], []), ('normal control', [[[6951, 7480, 'Two\nlines'], [5406, 5906, 'x\ny\nz'], [1631, 2101, 'Hi there'], [6704, 7234, 'Two\nlines']], 17], [3]), ('normal control', [[[3319, 3319, ''], [9021, 9021, '  spaced  '], [4466, 5367, 'Two\nlines'], [3595, 4096, 'Hello'], [4276, 5276, '  spaced  ']], 10], [2]), ('normal control', [[[955, 1005, 'A'], [9350, 11350, 'abcd'], [864, 854, 'A\r\nB\r\nC'], [6216, 6716, 'Long line of dialogue here']], 20], [3, 4])]]
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 with two formatting tags pass the speed check because their middle text vanishes.

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)
        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: line break exclusion', [[[0, 500, 'a\r\nb']], 5], []), ('regression variant: line break exclusion', [[[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 probe: line break exclusion', [[[8781, 9781, 'x\ny\nz'], [6605, 6664, 'x\n'], [733, 723, 'Red'], [2157, 2147, 'a']], 17], [3, 4]), ('partial repair variant: line break exclusion', [[[8476, 8947, 'Hi there'], [6662, 7162, 'Red'], [6248, 6365, 'x\n'], [2603, 3103, 'x\n'], [4374, 4874, 'I']], 17], []), ('boundary control', [[[0, 1000, 'abcdefghij']], 10], []), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('normal control', [[[0, 0, '']], 17], []), ('normal control', [[[839, 3839, 'I'], [4652, 6652, 'x\ny\nz']], 17], []), ('normal control', [[[2260, 3260, '  spaced  '], [770, 770, 'Red'], [4134, 4201, 'a'], [6488, 9488, '<c.yellow>Cue</c> text']], 15], [2])], [('regression: line break exclusion', [[[2569, 2769, 'A\r\nB\r\nC'], [1782, 1782, 'x\ny\nz']], 15], [2]), ('regression variant: line break exclusion', [[[6951, 7480, 'Two\nlines'], [5406, 5906, 'x\ny\nz'], [1631, 2101, 'Hi there'], [6704, 7234, 'Two\nlines']], 17], [3]), ('partial repair probe: line break exclusion', [[[5207, 5208, ''], [8379, 8879, '  spaced  '], [9114, 9365, 'x\ny\nz'], [2354, 2344, 'Hi there'], [3706, 3756, 'x\n']], 20], [4]), ('partial repair variant: line break exclusion', [[[1599, 1800, 'A\r\nB\r\nC'], [8401, 8401, '']], 15], []), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('boundary control', [[[0, 0, '']], 17], []), ('normal control', [[[9663, 11063, 'Red']], 20], []), ('normal control', [[[1285, 1285, '<c.yellow>Cue</c> text'], [4496, 4596, 'A'], [6179, 6169, 'Hello']], 20], [1, 3]), ('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])], [('regression: line break exclusion', [[[8781, 9781, 'x\ny\nz'], [6605, 6664, 'x\n'], [733, 723, 'Red'], [2157, 2147, 'a']], 17], [3, 4]), ('regression variant: line break exclusion', [[[4903, 5303, 'Two\r\nlines'], [7669, 7920, 'Hello'], [9175, 12175, 'Two\nlines']], 20], []), ('partial repair probe: line break exclusion', [[[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]), ('partial repair variant: line break exclusion', [[[936, 1137, 'A\r\nB\r\nC'], [5836, 7570, 'Long line of dialogue here'], [1739, 1739, '']], 15], []), ('boundary control', [[[0, 0, '']], 17], []), ('boundary control', [[[0, 1000, 'abcdefghij']], 10], []), ('normal control', [[[8892, 9392, 'Two\nlines']], 10], [1]), ('normal control', [[[6012, 6112, 'Hi there']], 15], [1]), ('normal control', [[[893, 1893, '<c.yellow>Cue</c> text']], 10], [])], [('regression: line break exclusion', [[[5207, 5208, ''], [8379, 8879, '  spaced  '], [9114, 9365, 'x\ny\nz'], [2354, 2344, 'Hi there'], [3706, 3756, 'x\n']], 20], [4]), ('regression variant: line break exclusion', [[[8642, 8642, 'Red'], [5828, 5818, 'Two\r\nlines'], [3091, 3591, 'a'], [1539, 1839, 'x\ny\nz']], 10], [1, 2]), ('partial repair probe: line break exclusion', [[[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: line break exclusion', [[[8878, 9378, 'a'], [1695, 1990, 'x\ny\nz'], [8649, 8649, '<c.yellow>Cue</c> text'], [4805, 5334, 'Two\nlines']], 17], [3]), ('boundary control', [[[0, 1000, 'abcdefghij']], 10], []), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('normal control', [[[540, 607, 'a'], [5643, 7643, 'Italic text']], 15], []), ('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]), ('normal control', [[[5543, 5743, 'Red'], [3551, 4551, 'Two\nlines'], [4354, 4454, 'A']], 15], [])], [('regression: line break exclusion', [[[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: line break exclusion', [[[8476, 8947, 'Hi there'], [6662, 7162, 'Red'], [6248, 6365, 'x\n'], [2603, 3103, 'x\n'], [4374, 4874, 'I']], 17], []), ('partial repair probe: line break exclusion', [[[6951, 7480, 'Two\nlines'], [5406, 5906, 'x\ny\nz'], [1631, 2101, 'Hi there'], [6704, 7234, 'Two\nlines']], 17], [3]), ('partial repair variant: line break exclusion', [[[2544, 2544, '  spaced  '], [4666, 4766, 'Hello'], [1260, 1250, ''], [1606, 1807, 'x\ny\nz']], 15], [1, 2]), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('boundary control', [[[0, 0, '']], 17], []), ('normal control', [[[7961, 7961, 'x\n'], [4865, 5399, 'Hi there'], [9675, 12675, ''], [2209, 3410, 'abcd'], [4016, 4116, 'abcd']], 15], [1, 5]), ('normal control', [[[4643, 7643, 'a']], 10], []), ('normal control', [[[4743, 5143, 'A'], [1982, 2982, 'Hi there'], [5318, 5468, 'Red'], [4990, 5140, 'Red'], [1465, 1965, 'A']], 20], [])]]
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*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: line break exclusion', [[[0, 500, 'a\r\nb']], 5], []), ('regression variant: line break exclusion', [[[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 probe: line break exclusion', [[[8781, 9781, 'x\ny\nz'], [6605, 6664, 'x\n'], [733, 723, 'Red'], [2157, 2147, 'a']], 17], [3, 4]), ('partial repair variant: line break exclusion', [[[8476, 8947, 'Hi there'], [6662, 7162, 'Red'], [6248, 6365, 'x\n'], [2603, 3103, 'x\n'], [4374, 4874, 'I']], 17], []), ('boundary control', [[[0, 1000, 'abcdefghij']], 10], []), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('normal control', [[[0, 0, '']], 17], []), ('normal control', [[[839, 3839, 'I'], [4652, 6652, 'x\ny\nz']], 17], []), ('normal control', [[[2260, 3260, '  spaced  '], [770, 770, 'Red'], [4134, 4201, 'a'], [6488, 9488, '<c.yellow>Cue</c> text']], 15], [2])], [('regression: line break exclusion', [[[2569, 2769, 'A\r\nB\r\nC'], [1782, 1782, 'x\ny\nz']], 15], [2]), ('regression variant: line break exclusion', [[[6951, 7480, 'Two\nlines'], [5406, 5906, 'x\ny\nz'], [1631, 2101, 'Hi there'], [6704, 7234, 'Two\nlines']], 17], [3]), ('partial repair probe: line break exclusion', [[[5207, 5208, ''], [8379, 8879, '  spaced  '], [9114, 9365, 'x\ny\nz'], [2354, 2344, 'Hi there'], [3706, 3756, 'x\n']], 20], [4]), ('partial repair variant: line break exclusion', [[[1599, 1800, 'A\r\nB\r\nC'], [8401, 8401, '']], 15], []), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('boundary control', [[[0, 0, '']], 17], []), ('normal control', [[[9663, 11063, 'Red']], 20], []), ('normal control', [[[1285, 1285, '<c.yellow>Cue</c> text'], [4496, 4596, 'A'], [6179, 6169, 'Hello']], 20], [1, 3]), ('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])], [('regression: line break exclusion', [[[8781, 9781, 'x\ny\nz'], [6605, 6664, 'x\n'], [733, 723, 'Red'], [2157, 2147, 'a']], 17], [3, 4]), ('regression variant: line break exclusion', [[[4903, 5303, 'Two\r\nlines'], [7669, 7920, 'Hello'], [9175, 12175, 'Two\nlines']], 20], []), ('partial repair probe: line break exclusion', [[[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]), ('partial repair variant: line break exclusion', [[[936, 1137, 'A\r\nB\r\nC'], [5836, 7570, 'Long line of dialogue here'], [1739, 1739, '']], 15], []), ('boundary control', [[[0, 0, '']], 17], []), ('boundary control', [[[0, 1000, 'abcdefghij']], 10], []), ('normal control', [[[8892, 9392, 'Two\nlines']], 10], [1]), ('normal control', [[[6012, 6112, 'Hi there']], 15], [1]), ('normal control', [[[893, 1893, '<c.yellow>Cue</c> text']], 10], [])], [('regression: line break exclusion', [[[5207, 5208, ''], [8379, 8879, '  spaced  '], [9114, 9365, 'x\ny\nz'], [2354, 2344, 'Hi there'], [3706, 3756, 'x\n']], 20], [4]), ('regression variant: line break exclusion', [[[8642, 8642, 'Red'], [5828, 5818, 'Two\r\nlines'], [3091, 3591, 'a'], [1539, 1839, 'x\ny\nz']], 10], [1, 2]), ('partial repair probe: line break exclusion', [[[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: line break exclusion', [[[8878, 9378, 'a'], [1695, 1990, 'x\ny\nz'], [8649, 8649, '<c.yellow>Cue</c> text'], [4805, 5334, 'Two\nlines']], 17], [3]), ('boundary control', [[[0, 1000, 'abcdefghij']], 10], []), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('normal control', [[[540, 607, 'a'], [5643, 7643, 'Italic text']], 15], []), ('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]), ('normal control', [[[5543, 5743, 'Red'], [3551, 4551, 'Two\nlines'], [4354, 4454, 'A']], 15], [])], [('regression: line break exclusion', [[[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: line break exclusion', [[[8476, 8947, 'Hi there'], [6662, 7162, 'Red'], [6248, 6365, 'x\n'], [2603, 3103, 'x\n'], [4374, 4874, 'I']], 17], []), ('partial repair probe: line break exclusion', [[[6951, 7480, 'Two\nlines'], [5406, 5906, 'x\ny\nz'], [1631, 2101, 'Hi there'], [6704, 7234, 'Two\nlines']], 17], [3]), ('partial repair variant: line break exclusion', [[[2544, 2544, '  spaced  '], [4666, 4766, 'Hello'], [1260, 1250, ''], [1606, 1807, 'x\ny\nz']], 15], [1, 2]), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('boundary control', [[[0, 0, '']], 17], []), ('normal control', [[[7961, 7961, 'x\n'], [4865, 5399, 'Hi there'], [9675, 12675, ''], [2209, 3410, 'abcd'], [4016, 4116, 'abcd']], 15], [1, 5]), ('normal control', [[[4643, 7643, 'a']], 10], []), ('normal control', [[[4743, 5143, 'A'], [1982, 2982, 'Hi there'], [5318, 5468, 'Red'], [4990, 5140, 'Red'], [1465, 1965, 'A']], 20], [])]]
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:
Two-line cues are flagged as too fast although the text is short.

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
        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: crlf normalization', [[[0, 500, 'a\r\nb']], 5], []), ('regression variant: crlf normalization', [[[5965, 6298, 'Hello'], [8965, 9165, 'A\r\nB\r\nC'], [2814, 3814, 'I']], 15], [1]), ('partial repair probe: crlf normalization', [[[4903, 5303, 'Two\r\nlines'], [7669, 7920, 'Hello'], [9175, 12175, 'Two\nlines']], 20], []), ('partial repair variant: crlf normalization', [[[4520, 4520, 'A'], [2750, 2850, 'x\n'], [6574, 7075, 'Hello'], [1920, 2221, 'A\r\nB\r\nC']], 10], [1]), ('boundary control', [[[0, 1000, 'abcdefghij']], 10], []), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('normal control', [[[0, 0, '']], 17], []), ('normal control', [[[839, 3839, 'I'], [4652, 6652, 'x\ny\nz']], 17], []), ('normal control', [[[1857, 1857, 'x\ny\nz']], 10], [1])], [('regression: crlf normalization', [[[2569, 2769, 'A\r\nB\r\nC'], [1782, 1782, 'x\ny\nz']], 15], [2]), ('regression variant: crlf normalization', [[[4985, 5280, 'x\ny\nz'], [9931, 10402, 'Two\r\nlines'], [4982, 4982, 'Long line of dialogue here']], 17], [3]), ('partial repair probe: crlf normalization', [[[1599, 1800, 'A\r\nB\r\nC'], [8401, 8401, '']], 15], []), ('partial repair variant: crlf normalization', [[[5725, 5725, 'a'], [6804, 7470, '  spaced  '], [5609, 5609, 'abcd'], [1969, 2035, 'a'], [2084, 2618, 'Two\r\nlines']], 15], [1, 2, 3, 4]), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('boundary control', [[[0, 0, '']], 17], []), ('normal control', [[[7799, 7899, ''], [6867, 9867, 'Hello'], [1132, 1132, '<c.yellow>Cue</c> text'], [3310, 3310, 'a']], 17], [3, 4]), ('normal control', [[[9565, 11365, 'abcd'], [7862, 10862, 'abcd'], [9297, 9397, 'a']], 10], []), ('normal control', [[[7732, 8133, 'A'], [2534, 2634, 'Two\r\nlines']], 20], [2])], [('regression: crlf normalization', [[[4903, 5303, 'Two\r\nlines'], [7669, 7920, 'Hello'], [9175, 12175, 'Two\nlines']], 20], []), ('regression variant: crlf normalization', [[[7259, 10259, 'x\ny\nz'], [6920, 7220, 'A\r\nB\r\nC']], 10], []), ('partial repair probe: crlf normalization', [[[936, 1137, 'A\r\nB\r\nC'], [5836, 7570, 'Long line of dialogue here'], [1739, 1739, '']], 15], []), ('partial repair variant: crlf normalization', [[[605, 906, 'A\r\nB\r\nC'], [7108, 8108, 'abcd']], 10], []), ('boundary control', [[[0, 0, '']], 17], []), ('boundary control', [[[0, 1000, 'abcdefghij']], 10], []), ('normal control', [[[5260, 5250, ''], [1557, 1557, 'Long line of dialogue here'], [5807, 7807, 'Long line of dialogue here'], [6191, 7191, 'x\n']], 15], [2]), ('normal control', [[[5029, 5019, 'abcd']], 20], [1]), ('normal control', [[[6012, 6112, 'Hi there']], 15], [1])], [('regression: crlf normalization', [[[1599, 1800, 'A\r\nB\r\nC'], [8401, 8401, '']], 15], []), ('regression variant: crlf normalization', [[[1676, 1827, 'A\r\nB\r\nC'], [5080, 5080, '  spaced  '], [8082, 11082, 'a'], [9203, 9193, 'abcd']], 20], [2, 4]), ('partial repair probe: crlf normalization', [[[5965, 6298, 'Hello'], [8965, 9165, 'A\r\nB\r\nC'], [2814, 3814, 'I']], 15], [1]), ('partial repair variant: crlf normalization', [[[1193, 1370, 'A\r\nB\r\nC']], 17], []), ('boundary control', [[[0, 1000, 'abcdefghij']], 10], []), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('normal control', [[[893, 1893, '<c.yellow>Cue</c> text']], 10], []), ('normal control', [[[6795, 6795, 'x\n']], 17], [1]), ('normal control', [[[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: crlf normalization', [[[936, 1137, 'A\r\nB\r\nC'], [5836, 7570, 'Long line of dialogue here'], [1739, 1739, '']], 15], []), ('regression variant: crlf normalization', [[[4520, 4520, 'A'], [2750, 2850, 'x\n'], [6574, 7075, 'Hello'], [1920, 2221, 'A\r\nB\r\nC']], 10], [1]), ('partial repair probe: crlf normalization', [[[4985, 5280, 'x\ny\nz'], [9931, 10402, 'Two\r\nlines'], [4982, 4982, 'Long line of dialogue here']], 17], [3]), ('partial repair variant: crlf normalization', [[[2637, 3038, 'Two\r\nlines'], [1289, 1689, 'Hi there'], [8536, 8587, 'a'], [9456, 10456, 'x\n'], [1366, 1366, 'Long line of dialogue here']], 20], [5]), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('boundary control', [[[0, 0, '']], 17], []), ('normal control', [[[8192, 8192, 'x\ny\nz']], 20], [1]), ('normal control', [[[7961, 7961, 'x\n'], [4865, 5399, 'Hi there'], [9675, 12675, ''], [2209, 3410, 'abcd'], [4016, 4116, 'abcd']], 15], [1, 5]), ('normal control', [[[7326, 7326, ''], [6999, 7058, 'a'], [7165, 7635, '<c.yellow>Cue</c> text'], [2882, 4882, 'abcd']], 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)

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('\n\r','\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: crlf normalization', [[[0, 500, 'a\r\nb']], 5], []), ('regression variant: crlf normalization', [[[5965, 6298, 'Hello'], [8965, 9165, 'A\r\nB\r\nC'], [2814, 3814, 'I']], 15], [1]), ('partial repair probe: crlf normalization', [[[4903, 5303, 'Two\r\nlines'], [7669, 7920, 'Hello'], [9175, 12175, 'Two\nlines']], 20], []), ('partial repair variant: crlf normalization', [[[4520, 4520, 'A'], [2750, 2850, 'x\n'], [6574, 7075, 'Hello'], [1920, 2221, 'A\r\nB\r\nC']], 10], [1]), ('boundary control', [[[0, 1000, 'abcdefghij']], 10], []), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('normal control', [[[0, 0, '']], 17], []), ('normal control', [[[839, 3839, 'I'], [4652, 6652, 'x\ny\nz']], 17], []), ('normal control', [[[1857, 1857, 'x\ny\nz']], 10], [1])], [('regression: crlf normalization', [[[2569, 2769, 'A\r\nB\r\nC'], [1782, 1782, 'x\ny\nz']], 15], [2]), ('regression variant: crlf normalization', [[[4985, 5280, 'x\ny\nz'], [9931, 10402, 'Two\r\nlines'], [4982, 4982, 'Long line of dialogue here']], 17], [3]), ('partial repair probe: crlf normalization', [[[1599, 1800, 'A\r\nB\r\nC'], [8401, 8401, '']], 15], []), ('partial repair variant: crlf normalization', [[[5725, 5725, 'a'], [6804, 7470, '  spaced  '], [5609, 5609, 'abcd'], [1969, 2035, 'a'], [2084, 2618, 'Two\r\nlines']], 15], [1, 2, 3, 4]), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('boundary control', [[[0, 0, '']], 17], []), ('normal control', [[[7799, 7899, ''], [6867, 9867, 'Hello'], [1132, 1132, '<c.yellow>Cue</c> text'], [3310, 3310, 'a']], 17], [3, 4]), ('normal control', [[[9565, 11365, 'abcd'], [7862, 10862, 'abcd'], [9297, 9397, 'a']], 10], []), ('normal control', [[[7732, 8133, 'A'], [2534, 2634, 'Two\r\nlines']], 20], [2])], [('regression: crlf normalization', [[[4903, 5303, 'Two\r\nlines'], [7669, 7920, 'Hello'], [9175, 12175, 'Two\nlines']], 20], []), ('regression variant: crlf normalization', [[[7259, 10259, 'x\ny\nz'], [6920, 7220, 'A\r\nB\r\nC']], 10], []), ('partial repair probe: crlf normalization', [[[936, 1137, 'A\r\nB\r\nC'], [5836, 7570, 'Long line of dialogue here'], [1739, 1739, '']], 15], []), ('partial repair variant: crlf normalization', [[[605, 906, 'A\r\nB\r\nC'], [7108, 8108, 'abcd']], 10], []), ('boundary control', [[[0, 0, '']], 17], []), ('boundary control', [[[0, 1000, 'abcdefghij']], 10], []), ('normal control', [[[5260, 5250, ''], [1557, 1557, 'Long line of dialogue here'], [5807, 7807, 'Long line of dialogue here'], [6191, 7191, 'x\n']], 15], [2]), ('normal control', [[[5029, 5019, 'abcd']], 20], [1]), ('normal control', [[[6012, 6112, 'Hi there']], 15], [1])], [('regression: crlf normalization', [[[1599, 1800, 'A\r\nB\r\nC'], [8401, 8401, '']], 15], []), ('regression variant: crlf normalization', [[[1676, 1827, 'A\r\nB\r\nC'], [5080, 5080, '  spaced  '], [8082, 11082, 'a'], [9203, 9193, 'abcd']], 20], [2, 4]), ('partial repair probe: crlf normalization', [[[5965, 6298, 'Hello'], [8965, 9165, 'A\r\nB\r\nC'], [2814, 3814, 'I']], 15], [1]), ('partial repair variant: crlf normalization', [[[1193, 1370, 'A\r\nB\r\nC']], 17], []), ('boundary control', [[[0, 1000, 'abcdefghij']], 10], []), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('normal control', [[[893, 1893, '<c.yellow>Cue</c> text']], 10], []), ('normal control', [[[6795, 6795, 'x\n']], 17], [1]), ('normal control', [[[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: crlf normalization', [[[936, 1137, 'A\r\nB\r\nC'], [5836, 7570, 'Long line of dialogue here'], [1739, 1739, '']], 15], []), ('regression variant: crlf normalization', [[[4520, 4520, 'A'], [2750, 2850, 'x\n'], [6574, 7075, 'Hello'], [1920, 2221, 'A\r\nB\r\nC']], 10], [1]), ('partial repair probe: crlf normalization', [[[4985, 5280, 'x\ny\nz'], [9931, 10402, 'Two\r\nlines'], [4982, 4982, 'Long line of dialogue here']], 17], [3]), ('partial repair variant: crlf normalization', [[[2637, 3038, 'Two\r\nlines'], [1289, 1689, 'Hi there'], [8536, 8587, 'a'], [9456, 10456, 'x\n'], [1366, 1366, 'Long line of dialogue here']], 20], [5]), ('boundary control', [[[0, 0, 'a']], 17], [1]), ('boundary control', [[[0, 0, '']], 17], []), ('normal control', [[[8192, 8192, 'x\ny\nz']], 20], [1]), ('normal control', [[[7961, 7961, 'x\n'], [4865, 5399, 'Hi there'], [9675, 12675, ''], [2209, 3410, 'abcd'], [4016, 4116, 'abcd']], 15], [1, 5]), ('normal control', [[[7326, 7326, ''], [6999, 7058, 'a'], [7165, 7635, '<c.yellow>Cue</c> text'], [2882, 4882, 'abcd']], 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:
Cues from Windows-authored files read one character faster per line break.

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