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

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

prompt:
Only the first cue setting survives; later settings such as size are lost.

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

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import re
from fractions import Fraction
N = 1
observations = []
def solve(expr, frame_rate, tick_rate):
    m=re.fullmatch(r'(\d+(?:\.\d+)?)(h|ms|m|s|f|t)',expr)
    if m:
        v=Fraction(m.group(1))
        unit=m.group(2)
        scale={'h':3600000,'m':60000,'s':1000,'ms':1}
        if unit in scale:
            x=v*scale[unit]
        elif unit=='f':
            x=v*1000/frame_rate
        else:
            x=v/tick_rate
        return math.floor(x+Fraction(1,2))
    m=re.fullmatch(r'(\d{2,}):(\d{2}):(\d{2})(?:\.(\d+)|:(\d{2,}))?',expr)
    if not m:
        return None
    h,mi,se,frac,fr=m.groups()
    if int(mi)>59 or int(se)>59:
        return None
    x=Fraction(int(h)*3600+int(mi)*60+int(se))*1000
    if frac:
        x+=Fraction('0.'+frac)*1000
    if fr:
        if int(fr)>=frame_rate:
            return None
        x+=Fraction(int(fr)*1000,frame_rate)
    return (x*2+1)//2
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: tick metric scale', ['10t', 25, 1000], 10), ('regression variant: tick metric scale', ['17t', 30, 3], 5667), ('partial repair probe: tick metric scale', ['15t', 30, 3], 5000), ('partial repair variant: tick metric scale', ['17t', 16, 90000], 0), ('boundary control', ['3f', 16, 1000], 188), ('boundary control', ['00:00:00:25', 25, 1000], None), ('normal control', ['00:00:01:15', 16, 1000], 1938), ('normal control', ['10:59:59:15', 40, 1000], 39599375), ('normal control', ['01:60:59:30', 50, 10000000], None)], [('regression: tick metric scale', ['2t', 30, 3], 667), ('regression variant: tick metric scale', ['90t', 24, 1000], 90), ('partial repair probe: tick metric scale', ['7t', 25, 10000000], 0), ('partial repair variant: tick metric scale', ['1.5t', 50, 1000], 2), ('boundary control', ['00:00:01:15', 16, 1000], 1938), ('boundary control', ['3f', 16, 1000], 188), ('normal control', ['0ms', 16, 90000], 0), ('normal control', ['10:59:00:15', 40, 90000], 39540375), ('normal control', ['00:00:59:12', 30, 10000000], 59400)], [('regression: tick metric scale', ['15t', 30, 3], 5000), ('regression variant: tick metric scale', ['1.5t', 50, 1000], 2), ('partial repair probe: tick metric scale', ['1.5t', 16, 3], 500), ('partial repair variant: tick metric scale', ['1t', 40, 1000], 1), ('boundary control', ['00:00:01.0005', 25, 1000], 1001), ('boundary control', ['00:00:01:15', 16, 1000], 1938), ('normal control', ['100:30:59:30', 25, 10000000], None), ('normal control', ['00:30:00:15', 16, 10000000], 1800938), ('normal control', ['01:60:05:12', 16, 10000000], None)], [('regression: tick metric scale', ['1.5t', 16, 3], 500), ('regression variant: tick metric scale', ['1t', 40, 1000], 1), ('partial repair probe: tick metric scale', ['90t', 40, 1000], 90), ('partial repair variant: tick metric scale', ['1.5t', 24, 90000], 0), ('boundary control', ['00:00:00:25', 25, 1000], None), ('boundary control', ['00:00:01.0005', 25, 1000], 1001), ('normal control', ['0t', 24, 3], 0), ('normal control', ['10:00:00.25', 16, 3], 36000250), ('normal control', ['10:30:59.5', 24, 1000], 37859500)], [('regression: tick metric scale', ['90t', 40, 1000], 90), ('regression variant: tick metric scale', ['2t', 24, 3], 667), ('partial repair probe: tick metric scale', ['17t', 30, 3], 5667), ('partial repair variant: tick metric scale', ['12.25t', 16, 90000], 0), ('boundary control', ['3f', 16, 1000], 188), ('boundary control', ['00:00:00:25', 25, 1000], None), ('normal control', ['100:59:05:12', 24, 3], 363545500), ('normal control', ['17h', 24, 10000000], 61200000), ('normal control', ['12.25f', 25, 3], 490)]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import re
from fractions import Fraction
N = 1
observations = []
def solve(expr, frame_rate, tick_rate):
    m=re.fullmatch(r'(\d+(?:\.\d+)?)(h|ms|m|s|f|t)',expr)
    if m:
        v=Fraction(m.group(1))
        unit=m.group(2)
        scale={'h':3600000,'m':60000,'s':1000,'ms':1}
        if unit in scale:
            x=v*scale[unit]
        elif unit=='f':
            x=v*1000/frame_rate
        else:
            x=v*1000/frame_rate
        return math.floor(x+Fraction(1,2))
    m=re.fullmatch(r'(\d{2,}):(\d{2}):(\d{2})(?:\.(\d+)|:(\d{2,}))?',expr)
    if not m:
        return None
    h,mi,se,frac,fr=m.groups()
    if int(mi)>59 or int(se)>59:
        return None
    x=Fraction(int(h)*3600+int(mi)*60+int(se))*1000
    if frac:
        x+=Fraction('0.'+frac)*1000
    if fr:
        if int(fr)>=frame_rate:
            return None
        x+=Fraction(int(fr)*1000,frame_rate)
    return (x*2+1)//2
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: tick metric scale', ['10t', 25, 1000], 10), ('regression variant: tick metric scale', ['17t', 30, 3], 5667), ('partial repair probe: tick metric scale', ['15t', 30, 3], 5000), ('partial repair variant: tick metric scale', ['17t', 16, 90000], 0), ('boundary control', ['3f', 16, 1000], 188), ('boundary control', ['00:00:00:25', 25, 1000], None), ('normal control', ['00:00:01:15', 16, 1000], 1938), ('normal control', ['10:59:59:15', 40, 1000], 39599375), ('normal control', ['01:60:59:30', 50, 10000000], None)], [('regression: tick metric scale', ['2t', 30, 3], 667), ('regression variant: tick metric scale', ['90t', 24, 1000], 90), ('partial repair probe: tick metric scale', ['7t', 25, 10000000], 0), ('partial repair variant: tick metric scale', ['1.5t', 50, 1000], 2), ('boundary control', ['00:00:01:15', 16, 1000], 1938), ('boundary control', ['3f', 16, 1000], 188), ('normal control', ['0ms', 16, 90000], 0), ('normal control', ['10:59:00:15', 40, 90000], 39540375), ('normal control', ['00:00:59:12', 30, 10000000], 59400)], [('regression: tick metric scale', ['15t', 30, 3], 5000), ('regression variant: tick metric scale', ['1.5t', 50, 1000], 2), ('partial repair probe: tick metric scale', ['1.5t', 16, 3], 500), ('partial repair variant: tick metric scale', ['1t', 40, 1000], 1), ('boundary control', ['00:00:01.0005', 25, 1000], 1001), ('boundary control', ['00:00:01:15', 16, 1000], 1938), ('normal control', ['100:30:59:30', 25, 10000000], None), ('normal control', ['00:30:00:15', 16, 10000000], 1800938), ('normal control', ['01:60:05:12', 16, 10000000], None)], [('regression: tick metric scale', ['1.5t', 16, 3], 500), ('regression variant: tick metric scale', ['1t', 40, 1000], 1), ('partial repair probe: tick metric scale', ['90t', 40, 1000], 90), ('partial repair variant: tick metric scale', ['1.5t', 24, 90000], 0), ('boundary control', ['00:00:00:25', 25, 1000], None), ('boundary control', ['00:00:01.0005', 25, 1000], 1001), ('normal control', ['0t', 24, 3], 0), ('normal control', ['10:00:00.25', 16, 3], 36000250), ('normal control', ['10:30:59.5', 24, 1000], 37859500)], [('regression: tick metric scale', ['90t', 40, 1000], 90), ('regression variant: tick metric scale', ['2t', 24, 3], 667), ('partial repair probe: tick metric scale', ['17t', 30, 3], 5667), ('partial repair variant: tick metric scale', ['12.25t', 16, 90000], 0), ('boundary control', ['3f', 16, 1000], 188), ('boundary control', ['00:00:00:25', 25, 1000], None), ('normal control', ['100:59:05:12', 24, 3], 363545500), ('normal control', ['17h', 24, 10000000], 61200000), ('normal control', ['12.25f', 25, 3], 490)]]
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:
Tick-based caption times collapse to near zero.

Evaluate a timed-text time expression to integer ms, rounded half up. Offset form <number><metric> with metric h, m, s, ms, f (frames at frame_rate) or t (ticks at tick_rate). Clock form HH:MM:SS with optional .fraction (any digits) or :FF frames (FF < frame_rate). Minutes/seconds above 59 or malformed text give None.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import re
from fractions import Fraction
N = 1
observations = []
def solve(expr, frame_rate, tick_rate):
    m=re.fullmatch(r'(\d+(?:\.\d+)?)(h|ms|m|s|f|t)',expr)
    if m:
        v=Fraction(m.group(1))
        unit=m.group(2)
        scale={'h':3600000,'m':60000,'s':1000,'ms':1}
        if unit in scale:
            x=v*scale[unit]
        elif unit=='f':
            x=v*1000//frame_rate
        else:
            x=v*1000/tick_rate
        return math.floor(x+Fraction(1,2))
    m=re.fullmatch(r'(\d{2,}):(\d{2}):(\d{2})(?:\.(\d+)|:(\d{2,}))?',expr)
    if not m:
        return None
    h,mi,se,frac,fr=m.groups()
    if int(mi)>59 or int(se)>59:
        return None
    x=Fraction(int(h)*3600+int(mi)*60+int(se))*1000
    if frac:
        x+=Fraction('0.'+frac)*1000
    if fr:
        if int(fr)>=frame_rate:
            return None
        x+=Fraction(int(fr)*1000,frame_rate)
    return (x*2+1)//2
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: frame metric scale', ['3f', 16, 1000], 188), ('regression variant: frame metric scale', ['15f', 16, 1000], 938), ('partial repair probe: frame metric scale', ['1.5f', 16, 1000], 94), ('partial repair variant: frame metric scale', ['1f', 40, 90000], 25), ('boundary control', ['10t', 25, 1000], 10), ('boundary control', ['00:00:00:25', 25, 1000], None), ('normal control', ['00:00:01:15', 16, 1000], 1938), ('normal control', ['10:59:59:15', 40, 1000], 39599375), ('normal control', ['01:60:59:30', 50, 10000000], None)], [('regression: frame metric scale', ['1.5f', 16, 1000], 94), ('regression variant: frame metric scale', ['12.25f', 16, 10000000], 766), ('partial repair probe: frame metric scale', ['2f', 24, 3], 83), ('partial repair variant: frame metric scale', ['2f', 16, 1000], 125), ('boundary control', ['00:00:01:15', 16, 1000], 1938), ('boundary control', ['10t', 25, 1000], 10), ('normal control', ['0ms', 16, 90000], 0), ('normal control', ['2t', 30, 3], 667), ('normal control', ['0.001t', 24, 1000], 0)], [('regression: frame metric scale', ['7f', 16, 10000000], 438), ('regression variant: frame metric scale', ['2f', 30, 1000], 67), ('partial repair probe: frame metric scale', ['3f', 50, 3], 60), ('partial repair variant: frame metric scale', ['7f', 16, 90000], 438), ('boundary control', ['00:00:01.0005', 25, 1000], 1001), ('boundary control', ['00:00:01:15', 16, 1000], 1938), ('normal control', ['0f', 24, 90000], 0), ('normal control', ['10:30:00:25', 16, 10000000], None), ('normal control', ['15t', 30, 3], 5000)], [('regression: frame metric scale', ['17f', 30, 90000], 567), ('regression variant: frame metric scale', ['7f', 16, 3], 438), ('partial repair probe: frame metric scale', ['3f', 50, 3], 60), ('partial repair variant: frame metric scale', ['17f', 24, 1000], 708), ('boundary control', ['00:00:00:25', 25, 1000], None), ('boundary control', ['00:00:01.0005', 25, 1000], 1001), ('normal control', ['01:60:05:12', 16, 10000000], None), ('normal control', ['100:30:05:30', 16, 10000000], None), ('normal control', ['1.5t', 16, 3], 500)], [('regression: frame metric scale', ['7f', 16, 90000], 438), ('regression variant: frame metric scale', ['3f', 16, 1000], 188), ('partial repair probe: frame metric scale', ['1f', 50, 90000], 20), ('partial repair variant: frame metric scale', ['15f', 16, 1000], 938), ('boundary control', ['10t', 25, 1000], 10), ('boundary control', ['00:00:00:25', 25, 1000], None), ('normal control', ['10:00:00.25', 16, 3], 36000250), ('normal control', ['2ms', 40, 90000], 2), ('normal control', ['01:30:05:25', 16, 90000], None)]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import re
from fractions import Fraction
N = 1
observations = []
def solve(expr, frame_rate, tick_rate):
    m=re.fullmatch(r'(\d+(?:\.\d+)?)(h|ms|m|s|f|t)',expr)
    if m:
        v=Fraction(m.group(1))
        unit=m.group(2)
        scale={'h':3600000,'m':60000,'s':1000,'ms':1}
        if unit in scale:
            x=v*scale[unit]
        elif unit=='f':
            x=v*1000/30
        else:
            x=v*1000/tick_rate
        return math.floor(x+Fraction(1,2))
    m=re.fullmatch(r'(\d{2,}):(\d{2}):(\d{2})(?:\.(\d+)|:(\d{2,}))?',expr)
    if not m:
        return None
    h,mi,se,frac,fr=m.groups()
    if int(mi)>59 or int(se)>59:
        return None
    x=Fraction(int(h)*3600+int(mi)*60+int(se))*1000
    if frac:
        x+=Fraction('0.'+frac)*1000
    if fr:
        if int(fr)>=frame_rate:
            return None
        x+=Fraction(int(fr)*1000,frame_rate)
    return (x*2+1)//2
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: frame metric scale', ['3f', 16, 1000], 188), ('regression variant: frame metric scale', ['15f', 16, 1000], 938), ('partial repair probe: frame metric scale', ['1.5f', 16, 1000], 94), ('partial repair variant: frame metric scale', ['1f', 40, 90000], 25), ('boundary control', ['10t', 25, 1000], 10), ('boundary control', ['00:00:00:25', 25, 1000], None), ('normal control', ['00:00:01:15', 16, 1000], 1938), ('normal control', ['10:59:59:15', 40, 1000], 39599375), ('normal control', ['01:60:59:30', 50, 10000000], None)], [('regression: frame metric scale', ['1.5f', 16, 1000], 94), ('regression variant: frame metric scale', ['12.25f', 16, 10000000], 766), ('partial repair probe: frame metric scale', ['2f', 24, 3], 83), ('partial repair variant: frame metric scale', ['2f', 16, 1000], 125), ('boundary control', ['00:00:01:15', 16, 1000], 1938), ('boundary control', ['10t', 25, 1000], 10), ('normal control', ['0ms', 16, 90000], 0), ('normal control', ['2t', 30, 3], 667), ('normal control', ['0.001t', 24, 1000], 0)], [('regression: frame metric scale', ['7f', 16, 10000000], 438), ('regression variant: frame metric scale', ['2f', 30, 1000], 67), ('partial repair probe: frame metric scale', ['3f', 50, 3], 60), ('partial repair variant: frame metric scale', ['7f', 16, 90000], 438), ('boundary control', ['00:00:01.0005', 25, 1000], 1001), ('boundary control', ['00:00:01:15', 16, 1000], 1938), ('normal control', ['0f', 24, 90000], 0), ('normal control', ['10:30:00:25', 16, 10000000], None), ('normal control', ['15t', 30, 3], 5000)], [('regression: frame metric scale', ['17f', 30, 90000], 567), ('regression variant: frame metric scale', ['7f', 16, 3], 438), ('partial repair probe: frame metric scale', ['3f', 50, 3], 60), ('partial repair variant: frame metric scale', ['17f', 24, 1000], 708), ('boundary control', ['00:00:00:25', 25, 1000], None), ('boundary control', ['00:00:01.0005', 25, 1000], 1001), ('normal control', ['01:60:05:12', 16, 10000000], None), ('normal control', ['100:30:05:30', 16, 10000000], None), ('normal control', ['1.5t', 16, 3], 500)], [('regression: frame metric scale', ['7f', 16, 90000], 438), ('regression variant: frame metric scale', ['3f', 16, 1000], 188), ('partial repair probe: frame metric scale', ['1f', 50, 90000], 20), ('partial repair variant: frame metric scale', ['15f', 16, 1000], 938), ('boundary control', ['10t', 25, 1000], 10), ('boundary control', ['00:00:00:25', 25, 1000], None), ('normal control', ['10:00:00.25', 16, 3], 36000250), ('normal control', ['2ms', 40, 90000], 2), ('normal control', ['01:30:05:25', 16, 90000], 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:
Frame offsets at rates that do not divide 1000 lose their fractional milliseconds before rounding.

Evaluate a timed-text time expression to integer ms, rounded half up. Offset form <number><metric> with metric h, m, s, ms, f (frames at frame_rate) or t (ticks at tick_rate). Clock form HH:MM:SS with optional .fraction (any digits) or :FF frames (FF < frame_rate). Minutes/seconds above 59 or malformed text give None.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import re
from fractions import Fraction
N = 1
observations = []
def solve(expr, frame_rate, tick_rate):
    m=re.fullmatch(r'(\d+(?:\.\d+)?)(h|ms|m|s|f|t)',expr)
    if m:
        v=Fraction(m.group(1))
        unit=m.group(2)
        scale={'h':3600000,'m':60000,'s':1000,'ms':1}
        if unit in scale:
            x=v*scale[unit]
        elif unit=='f':
            x=v*1000/frame_rate
        else:
            x=v*1000/tick_rate
        return math.floor(x+Fraction(1,2))
    m=re.fullmatch(r'(\d{2,}):(\d{2}):(\d{2})(?:\.(\d+)|:(\d{2,}))?',expr)
    if not m:
        return None
    h,mi,se,frac,fr=m.groups()
    if int(mi)>59 or int(se)>59:
        return None
    x=Fraction(int(h)*3600+int(mi)*60+int(se))*1000
    if frac:
        x+=Fraction(int(frac),1000)*1000
    if fr:
        if int(fr)>=frame_rate:
            return None
        x+=Fraction(int(fr)*1000,frame_rate)
    return (x*2+1)//2
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: clock fraction digits', ['00:00:01.0005', 25, 1000], 1001), ('regression variant: clock fraction digits', ['00:00:05.25', 30, 1000], 5250), ('partial repair probe: clock fraction digits', ['10:00:00.25', 16, 3], 36000250), ('partial repair variant: clock fraction digits', ['10:59:59.0005', 50, 90000], 39599001), ('boundary control', ['10t', 25, 1000], 10), ('boundary control', ['00:00:00:25', 25, 1000], None), ('normal control', ['3f', 16, 1000], 188), ('normal control', ['10:59:59:15', 40, 1000], 39599375), ('normal control', ['01:60:59:30', 50, 10000000], None)], [('regression: clock fraction digits', ['10:59:59.25', 25, 10000000], 39599250), ('regression variant: clock fraction digits', ['100:00:00.5', 25, 90000], 360000500), ('partial repair probe: clock fraction digits', ['10:30:59.5', 24, 1000], 37859500), ('partial repair variant: clock fraction digits', ['01:30:59.25', 40, 3], 5459250), ('boundary control', ['3f', 16, 1000], 188), ('boundary control', ['10t', 25, 1000], 10), ('normal control', ['0ms', 16, 90000], 0), ('normal control', ['10:59:00:15', 40, 90000], 39540375), ('normal control', ['00:00:59:12', 30, 10000000], 59400)], [('regression: clock fraction digits', ['10:00:00.25', 16, 3], 36000250), ('regression variant: clock fraction digits', ['100:59:59.1234', 40, 10000000], 363599123), ('partial repair probe: clock fraction digits', ['01:00:00.5', 50, 1000], 3600500), ('partial repair variant: clock fraction digits', ['00:30:00.5', 25, 10000000], 1800500), ('boundary control', ['00:00:01:15', 16, 1000], 1938), ('boundary control', ['3f', 16, 1000], 188), ('normal control', ['100:30:59:30', 25, 10000000], None), ('normal control', ['00:30:00:15', 16, 10000000], 1800938), ('normal control', ['2s', 50, 3], 2000)], [('regression: clock fraction digits', ['10:30:59.5', 24, 1000], 37859500), ('regression variant: clock fraction digits', ['10:00:05.5', 30, 90000], 36005500), ('partial repair probe: clock fraction digits', ['00:00:05.25', 30, 1000], 5250), ('partial repair variant: clock fraction digits', ['00:30:00.5', 40, 1000], 1800500), ('boundary control', ['00:00:00:25', 25, 1000], None), ('boundary control', ['00:00:01:15', 16, 1000], 1938), ('normal control', ['100:59:59:12', 24, 1000], 363599500), ('normal control', ['7t', 25, 10000000], 0), ('normal control', ['17s', 25, 1000], 17000)], [('regression: clock fraction digits', ['01:00:00.5', 50, 1000], 3600500), ('regression variant: clock fraction digits', ['100:00:05.25', 50, 90000], 360005250), ('partial repair probe: clock fraction digits', ['100:00:00.5', 25, 90000], 360000500), ('partial repair variant: clock fraction digits', ['100:59:00.0005', 16, 3], 363540001), ('boundary control', ['10t', 25, 1000], 10), ('boundary control', ['00:00:00:25', 25, 1000], None), ('normal control', ['2ms', 40, 90000], 2), ('normal control', ['0.001ms', 30, 90000], 0), ('normal control', ['10:00:00:30', 25, 1000], None)]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import re
from fractions import Fraction
N = 1
observations = []
def solve(expr, frame_rate, tick_rate):
    m=re.fullmatch(r'(\d+(?:\.\d+)?)(h|ms|m|s|f|t)',expr)
    if m:
        v=Fraction(m.group(1))
        unit=m.group(2)
        scale={'h':3600000,'m':60000,'s':1000,'ms':1}
        if unit in scale:
            x=v*scale[unit]
        elif unit=='f':
            x=v*1000/frame_rate
        else:
            x=v*1000/tick_rate
        return math.floor(x+Fraction(1,2))
    m=re.fullmatch(r'(\d{2,}):(\d{2}):(\d{2})(?:\.(\d+)|:(\d{2,}))?',expr)
    if not m:
        return None
    h,mi,se,frac,fr=m.groups()
    if int(mi)>59 or int(se)>59:
        return None
    x=Fraction(int(h)*3600+int(mi)*60+int(se))*1000
    if frac:
        x+=Fraction(int(frac[:3]),1000)*1000
    if fr:
        if int(fr)>=frame_rate:
            return None
        x+=Fraction(int(fr)*1000,frame_rate)
    return (x*2+1)//2
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: clock fraction digits', ['00:00:01.0005', 25, 1000], 1001), ('regression variant: clock fraction digits', ['00:00:05.25', 30, 1000], 5250), ('partial repair probe: clock fraction digits', ['10:00:00.25', 16, 3], 36000250), ('partial repair variant: clock fraction digits', ['10:59:59.0005', 50, 90000], 39599001), ('boundary control', ['10t', 25, 1000], 10), ('boundary control', ['00:00:00:25', 25, 1000], None), ('normal control', ['3f', 16, 1000], 188), ('normal control', ['10:59:59:15', 40, 1000], 39599375), ('normal control', ['01:60:59:30', 50, 10000000], None)], [('regression: clock fraction digits', ['10:59:59.25', 25, 10000000], 39599250), ('regression variant: clock fraction digits', ['100:00:00.5', 25, 90000], 360000500), ('partial repair probe: clock fraction digits', ['10:30:59.5', 24, 1000], 37859500), ('partial repair variant: clock fraction digits', ['01:30:59.25', 40, 3], 5459250), ('boundary control', ['3f', 16, 1000], 188), ('boundary control', ['10t', 25, 1000], 10), ('normal control', ['0ms', 16, 90000], 0), ('normal control', ['10:59:00:15', 40, 90000], 39540375), ('normal control', ['00:00:59:12', 30, 10000000], 59400)], [('regression: clock fraction digits', ['10:00:00.25', 16, 3], 36000250), ('regression variant: clock fraction digits', ['100:59:59.1234', 40, 10000000], 363599123), ('partial repair probe: clock fraction digits', ['01:00:00.5', 50, 1000], 3600500), ('partial repair variant: clock fraction digits', ['00:30:00.5', 25, 10000000], 1800500), ('boundary control', ['00:00:01:15', 16, 1000], 1938), ('boundary control', ['3f', 16, 1000], 188), ('normal control', ['100:30:59:30', 25, 10000000], None), ('normal control', ['00:30:00:15', 16, 10000000], 1800938), ('normal control', ['2s', 50, 3], 2000)], [('regression: clock fraction digits', ['10:30:59.5', 24, 1000], 37859500), ('regression variant: clock fraction digits', ['10:00:05.5', 30, 90000], 36005500), ('partial repair probe: clock fraction digits', ['00:00:05.25', 30, 1000], 5250), ('partial repair variant: clock fraction digits', ['00:30:00.5', 40, 1000], 1800500), ('boundary control', ['00:00:00:25', 25, 1000], None), ('boundary control', ['00:00:01:15', 16, 1000], 1938), ('normal control', ['100:59:59:12', 24, 1000], 363599500), ('normal control', ['7t', 25, 10000000], 0), ('normal control', ['17s', 25, 1000], 17000)], [('regression: clock fraction digits', ['01:00:00.5', 50, 1000], 3600500), ('regression variant: clock fraction digits', ['100:00:05.25', 50, 90000], 360005250), ('partial repair probe: clock fraction digits', ['100:00:00.5', 25, 90000], 360000500), ('partial repair variant: clock fraction digits', ['100:59:00.0005', 16, 3], 363540001), ('boundary control', ['10t', 25, 1000], 10), ('boundary control', ['00:00:00:25', 25, 1000], None), ('normal control', ['2ms', 40, 90000], 2), ('normal control', ['0.001ms', 30, 90000], 0), ('normal control', ['10:00:00:30', 25, 1000], None)]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A clock time of 00:00:01.5 evaluates to 1005 ms.

Evaluate a timed-text time expression to integer ms, rounded half up. Offset form <number><metric> with metric h, m, s, ms, f (frames at frame_rate) or t (ticks at tick_rate). Clock form HH:MM:SS with optional .fraction (any digits) or :FF frames (FF < frame_rate). Minutes/seconds above 59 or malformed text give None.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import re
from fractions import Fraction
N = 1
observations = []
def solve(expr, frame_rate, tick_rate):
    m=re.fullmatch(r'(\d+(?:\.\d+)?)(h|ms|m|s|f|t)',expr)
    if m:
        v=Fraction(m.group(1))
        unit=m.group(2)
        scale={'h':3600000,'m':60000,'s':1000,'ms':1}
        if unit in scale:
            x=v*scale[unit]
        elif unit=='f':
            x=v*1000/frame_rate
        else:
            x=v*1000/tick_rate
        return math.floor(x+Fraction(1,2))
    m=re.fullmatch(r'(\d{2,}):(\d{2}):(\d{2})(?:\.(\d+)|:(\d{2,}))?',expr)
    if not m:
        return None
    h,mi,se,frac,fr=m.groups()
    if int(mi)>59 or int(se)>59:
        return None
    x=Fraction(int(h)*3600+int(mi)*60+int(se))*1000
    if frac:
        x+=Fraction('0.'+frac)*1000
    if fr:
        if int(fr)>frame_rate:
            return None
        x+=Fraction(int(fr)*1000,frame_rate)
    return (x*2+1)//2
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: clock frame bound', ['00:00:00:25', 25, 1000], None), ('regression variant: clock frame bound', ['100:59:05:30', 30, 1000], None), ('partial repair probe: clock frame bound', ['10:30:00:25', 16, 10000000], None), ('partial repair variant: clock frame bound', ['100:30:00:29', 25, 90000], None), ('boundary control', ['10t', 25, 1000], 10), ('boundary control', ['00:00:01.0005', 25, 1000], 1001), ('normal control', ['3f', 16, 1000], 188), ('normal control', ['10:59:59:15', 40, 1000], 39599375), ('normal control', ['01:60:59:30', 50, 10000000], None)], [('regression: clock frame bound', ['100:59:05:30', 30, 1000], None), ('regression variant: clock frame bound', ['10:00:00:25', 25, 3], None), ('partial repair probe: clock frame bound', ['100:30:05:30', 16, 10000000], None), ('partial repair variant: clock frame bound', ['10:30:05:25', 24, 3], None), ('boundary control', ['3f', 16, 1000], 188), ('boundary control', ['10t', 25, 1000], 10), ('normal control', ['0ms', 16, 90000], 0), ('normal control', ['2t', 30, 3], 667), ('normal control', ['0.001t', 24, 1000], 0)], [('regression: clock frame bound', ['10:00:00:25', 25, 3], None), ('regression variant: clock frame bound', ['00:30:59:30', 30, 3], None), ('partial repair probe: clock frame bound', ['01:30:05:25', 16, 90000], None), ('partial repair variant: clock frame bound', ['01:59:59:24', 16, 3], None), ('boundary control', ['00:00:01:15', 16, 1000], 1938), ('boundary control', ['3f', 16, 1000], 188), ('normal control', ['0f', 24, 90000], 0), ('normal control', ['15t', 30, 3], 5000), ('normal control', ['01:60:05:12', 16, 10000000], None)], [('regression: clock frame bound', ['00:30:59:30', 30, 3], None), ('regression variant: clock frame bound', ['01:59:05:24', 24, 3], None), ('partial repair probe: clock frame bound', ['10:00:00:30', 25, 1000], None), ('partial repair variant: clock frame bound', ['01:00:59:29', 25, 10000000], None), ('boundary control', ['00:00:01.0005', 25, 1000], 1001), ('boundary control', ['00:00:01:15', 16, 1000], 1938), ('normal control', ['0t', 24, 3], 0), ('normal control', ['17s', 25, 1000], 17000), ('normal control', ['100:59:59:03', 50, 3], 363599060)], [('regression: clock frame bound', ['01:59:05:24', 24, 3], None), ('regression variant: clock frame bound', ['00:00:00:25', 25, 1000], None), ('partial repair probe: clock frame bound', ['00:59:59:30', 24, 3], None), ('partial repair variant: clock frame bound', ['00:59:05:30', 24, 3], None), ('boundary control', ['10t', 25, 1000], 10), ('boundary control', ['00:00:01.0005', 25, 1000], 1001), ('normal control', ['2ms', 40, 90000], 2), ('normal control', ['17h', 24, 10000000], 61200000), ('normal control', ['00:59:00:03', 24, 1000], 3540125)]]
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 math
import re
from fractions import Fraction
N = 1
observations = []
def solve(expr, frame_rate, tick_rate):
    m=re.fullmatch(r'(\d+(?:\.\d+)?)(h|ms|m|s|f|t)',expr)
    if m:
        v=Fraction(m.group(1))
        unit=m.group(2)
        scale={'h':3600000,'m':60000,'s':1000,'ms':1}
        if unit in scale:
            x=v*scale[unit]
        elif unit=='f':
            x=v*1000/frame_rate
        else:
            x=v*1000/tick_rate
        return math.floor(x+Fraction(1,2))
    m=re.fullmatch(r'(\d{2,}):(\d{2}):(\d{2})(?:\.(\d+)|:(\d{2,}))?',expr)
    if not m:
        return None
    h,mi,se,frac,fr=m.groups()
    if int(mi)>59 or int(se)>59:
        return None
    x=Fraction(int(h)*3600+int(mi)*60+int(se))*1000
    if frac:
        x+=Fraction('0.'+frac)*1000
    if fr:
        if int(fr)>=60:
            return None
        x+=Fraction(int(fr)*1000,frame_rate)
    return (x*2+1)//2
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: clock frame bound', ['00:00:00:25', 25, 1000], None), ('regression variant: clock frame bound', ['100:59:05:30', 30, 1000], None), ('partial repair probe: clock frame bound', ['10:30:00:25', 16, 10000000], None), ('partial repair variant: clock frame bound', ['100:30:00:29', 25, 90000], None), ('boundary control', ['10t', 25, 1000], 10), ('boundary control', ['00:00:01.0005', 25, 1000], 1001), ('normal control', ['3f', 16, 1000], 188), ('normal control', ['10:59:59:15', 40, 1000], 39599375), ('normal control', ['01:60:59:30', 50, 10000000], None)], [('regression: clock frame bound', ['100:59:05:30', 30, 1000], None), ('regression variant: clock frame bound', ['10:00:00:25', 25, 3], None), ('partial repair probe: clock frame bound', ['100:30:05:30', 16, 10000000], None), ('partial repair variant: clock frame bound', ['10:30:05:25', 24, 3], None), ('boundary control', ['3f', 16, 1000], 188), ('boundary control', ['10t', 25, 1000], 10), ('normal control', ['0ms', 16, 90000], 0), ('normal control', ['2t', 30, 3], 667), ('normal control', ['0.001t', 24, 1000], 0)], [('regression: clock frame bound', ['10:00:00:25', 25, 3], None), ('regression variant: clock frame bound', ['00:30:59:30', 30, 3], None), ('partial repair probe: clock frame bound', ['01:30:05:25', 16, 90000], None), ('partial repair variant: clock frame bound', ['01:59:59:24', 16, 3], None), ('boundary control', ['00:00:01:15', 16, 1000], 1938), ('boundary control', ['3f', 16, 1000], 188), ('normal control', ['0f', 24, 90000], 0), ('normal control', ['15t', 30, 3], 5000), ('normal control', ['01:60:05:12', 16, 10000000], None)], [('regression: clock frame bound', ['00:30:59:30', 30, 3], None), ('regression variant: clock frame bound', ['01:59:05:24', 24, 3], None), ('partial repair probe: clock frame bound', ['10:00:00:30', 25, 1000], None), ('partial repair variant: clock frame bound', ['01:00:59:29', 25, 10000000], None), ('boundary control', ['00:00:01.0005', 25, 1000], 1001), ('boundary control', ['00:00:01:15', 16, 1000], 1938), ('normal control', ['0t', 24, 3], 0), ('normal control', ['17s', 25, 1000], 17000), ('normal control', ['100:59:59:03', 50, 3], 363599060)], [('regression: clock frame bound', ['01:59:05:24', 24, 3], None), ('regression variant: clock frame bound', ['00:00:00:25', 25, 1000], None), ('partial repair probe: clock frame bound', ['00:59:59:30', 24, 3], None), ('partial repair variant: clock frame bound', ['00:59:05:30', 24, 3], None), ('boundary control', ['10t', 25, 1000], 10), ('boundary control', ['00:00:01.0005', 25, 1000], 1001), ('normal control', ['2ms', 40, 90000], 2), ('normal control', ['17h', 24, 10000000], 61200000), ('normal control', ['00:59:00:03', 24, 1000], 3540125)]]
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 frame field equal to the frame rate is accepted and rolls into the next second.

Evaluate a timed-text time expression to integer ms, rounded half up. Offset form <number><metric> with metric h, m, s, ms, f (frames at frame_rate) or t (ticks at tick_rate). Clock form HH:MM:SS with optional .fraction (any digits) or :FF frames (FF < frame_rate). Minutes/seconds above 59 or malformed text give None.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import re
from fractions import Fraction
N = 1
observations = []
def solve(expr, frame_rate, tick_rate):
    m=re.fullmatch(r'(\d+(?:\.\d+)?)(h|ms|m|s|f|t)',expr)
    if m:
        v=Fraction(m.group(1))
        unit=m.group(2)
        scale={'h':3600000,'m':60000,'s':1000,'ms':1}
        if unit in scale:
            x=v*scale[unit]
        elif unit=='f':
            x=v*1000/frame_rate
        else:
            x=v*1000/tick_rate
        return math.floor(x+Fraction(1,2))
    m=re.fullmatch(r'(\d{2,}):(\d{2}):(\d{2})(?:\.(\d+)|:(\d{2,}))?',expr)
    if not m:
        return None
    h,mi,se,frac,fr=m.groups()
    if int(mi)>59 or int(se)>59:
        return None
    x=Fraction(int(h)*3600+int(mi)*60+int(se))*1000
    if frac:
        x+=Fraction('0.'+frac)*1000
    if fr:
        if int(fr)>=frame_rate:
            return None
        x+=Fraction(int(fr)*1000,frame_rate)
    return int(x)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: clock rounding', ['00:00:01:15', 16, 1000], 1938), ('regression variant: clock rounding', ['10:59:59.0005', 50, 90000], 39599001), ('partial repair probe: clock rounding', ['100:59:00.0005', 16, 3], 363540001), ('partial repair variant: clock rounding', ['10:30:00.0005', 24, 90000], 37800001), ('boundary control', ['10t', 25, 1000], 10), ('boundary control', ['3f', 16, 1000], 188), ('normal control', ['00:00:00:25', 25, 1000], None), ('normal control', ['10:59:59:15', 40, 1000], 39599375), ('normal control', ['15h', 50, 1000], 54000000)], [('regression: clock rounding', ['00:00:01.0005', 25, 1000], 1001), ('regression variant: clock rounding', ['10:59:59:29', 30, 90000], 39599967), ('partial repair probe: clock rounding', ['00:00:00:01', 16, 1000], 63), ('partial repair variant: clock rounding', ['100:59:59.0005', 40, 1000], 363599001), ('boundary control', ['3f', 16, 1000], 188), ('boundary control', ['00:00:00:25', 25, 1000], None), ('normal control', ['15m', 30, 1000], 900000), ('normal control', ['10:59:00:15', 40, 90000], 39540375), ('normal control', ['00:00:59:12', 30, 10000000], 59400)], [('regression: clock rounding', ['00:30:00:15', 16, 10000000], 1800938), ('regression variant: clock rounding', ['100:59:00.0005', 16, 3], 363540001), ('partial repair probe: clock rounding', ['100:30:59.0005', 40, 3], 361859001), ('partial repair variant: clock rounding', ['10:00:00.0005', 50, 3], 36000001), ('boundary control', ['00:00:00:25', 25, 1000], None), ('boundary control', ['10t', 25, 1000], 10), ('normal control', ['100:30:59:30', 25, 10000000], None), ('normal control', ['15t', 30, 3], 5000), ('normal control', ['01:60:05:12', 16, 10000000], None)], [('regression: clock rounding', ['00:30:00:01', 24, 1000], 1800042), ('regression variant: clock rounding', ['00:00:00:01', 16, 1000], 63), ('partial repair probe: clock rounding', ['01:30:05.0005', 30, 1000], 5405001), ('partial repair variant: clock rounding', ['10:30:05.0005', 30, 90000], 37805001), ('boundary control', ['10t', 25, 1000], 10), ('boundary control', ['3f', 16, 1000], 188), ('normal control', ['0t', 24, 3], 0), ('normal control', ['1.5t', 16, 3], 500), ('normal control', ['10:00:00.25', 16, 3], 36000250)], [('regression: clock rounding', ['01:59:59:01', 24, 3], 7199042), ('regression variant: clock rounding', ['100:30:00:15', 16, 90000], 361800938), ('partial repair probe: clock rounding', ['00:30:00.0005', 40, 3], 1800001), ('partial repair variant: clock rounding', ['00:59:00.0005', 24, 10000000], 3540001), ('boundary control', ['3f', 16, 1000], 188), ('boundary control', ['00:00:00:25', 25, 1000], None), ('normal control', ['10:30:59.5', 24, 1000], 37859500), ('normal control', ['01:30:05:25', 16, 90000], None), ('normal control', ['17h', 24, 10000000], 61200000)]]
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 math
import re
from fractions import Fraction
N = 1
observations = []
def solve(expr, frame_rate, tick_rate):
    m=re.fullmatch(r'(\d+(?:\.\d+)?)(h|ms|m|s|f|t)',expr)
    if m:
        v=Fraction(m.group(1))
        unit=m.group(2)
        scale={'h':3600000,'m':60000,'s':1000,'ms':1}
        if unit in scale:
            x=v*scale[unit]
        elif unit=='f':
            x=v*1000/frame_rate
        else:
            x=v*1000/tick_rate
        return math.floor(x+Fraction(1,2))
    m=re.fullmatch(r'(\d{2,}):(\d{2}):(\d{2})(?:\.(\d+)|:(\d{2,}))?',expr)
    if not m:
        return None
    h,mi,se,frac,fr=m.groups()
    if int(mi)>59 or int(se)>59:
        return None
    x=Fraction(int(h)*3600+int(mi)*60+int(se))*1000
    if frac:
        x+=Fraction('0.'+frac)*1000
    if fr:
        if int(fr)>=frame_rate:
            return None
        x+=Fraction(int(fr)*1000,frame_rate)
    return round(x)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: clock rounding', ['00:00:01:15', 16, 1000], 1938), ('regression variant: clock rounding', ['10:59:59.0005', 50, 90000], 39599001), ('partial repair probe: clock rounding', ['100:59:00.0005', 16, 3], 363540001), ('partial repair variant: clock rounding', ['10:30:00.0005', 24, 90000], 37800001), ('boundary control', ['10t', 25, 1000], 10), ('boundary control', ['3f', 16, 1000], 188), ('normal control', ['00:00:00:25', 25, 1000], None), ('normal control', ['10:59:59:15', 40, 1000], 39599375), ('normal control', ['15h', 50, 1000], 54000000)], [('regression: clock rounding', ['00:00:01.0005', 25, 1000], 1001), ('regression variant: clock rounding', ['10:59:59:29', 30, 90000], 39599967), ('partial repair probe: clock rounding', ['00:00:00:01', 16, 1000], 63), ('partial repair variant: clock rounding', ['100:59:59.0005', 40, 1000], 363599001), ('boundary control', ['3f', 16, 1000], 188), ('boundary control', ['00:00:00:25', 25, 1000], None), ('normal control', ['15m', 30, 1000], 900000), ('normal control', ['10:59:00:15', 40, 90000], 39540375), ('normal control', ['00:00:59:12', 30, 10000000], 59400)], [('regression: clock rounding', ['00:30:00:15', 16, 10000000], 1800938), ('regression variant: clock rounding', ['100:59:00.0005', 16, 3], 363540001), ('partial repair probe: clock rounding', ['100:30:59.0005', 40, 3], 361859001), ('partial repair variant: clock rounding', ['10:00:00.0005', 50, 3], 36000001), ('boundary control', ['00:00:00:25', 25, 1000], None), ('boundary control', ['10t', 25, 1000], 10), ('normal control', ['100:30:59:30', 25, 10000000], None), ('normal control', ['15t', 30, 3], 5000), ('normal control', ['01:60:05:12', 16, 10000000], None)], [('regression: clock rounding', ['00:30:00:01', 24, 1000], 1800042), ('regression variant: clock rounding', ['00:00:00:01', 16, 1000], 63), ('partial repair probe: clock rounding', ['01:30:05.0005', 30, 1000], 5405001), ('partial repair variant: clock rounding', ['10:30:05.0005', 30, 90000], 37805001), ('boundary control', ['10t', 25, 1000], 10), ('boundary control', ['3f', 16, 1000], 188), ('normal control', ['0t', 24, 3], 0), ('normal control', ['1.5t', 16, 3], 500), ('normal control', ['10:00:00.25', 16, 3], 36000250)], [('regression: clock rounding', ['01:59:59:01', 24, 3], 7199042), ('regression variant: clock rounding', ['100:30:00:15', 16, 90000], 361800938), ('partial repair probe: clock rounding', ['00:30:00.0005', 40, 3], 1800001), ('partial repair variant: clock rounding', ['00:59:00.0005', 24, 10000000], 3540001), ('boundary control', ['3f', 16, 1000], 188), ('boundary control', ['00:00:00:25', 25, 1000], None), ('normal control', ['10:30:59.5', 24, 1000], 37859500), ('normal control', ['01:30:05:25', 16, 90000], None), ('normal control', ['17h', 24, 10000000], 61200000)]]
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:
Clock times with half-millisecond frames end up one millisecond early.

Evaluate a timed-text time expression to integer ms, rounded half up. Offset form <number><metric> with metric h, m, s, ms, f (frames at frame_rate) or t (ticks at tick_rate). Clock form HH:MM:SS with optional .fraction (any digits) or :FF frames (FF < frame_rate). Minutes/seconds above 59 or malformed text give None.

split: open-access


prompt:
Sweep-fill and outline karaoke syllables vanish and later syllables start early.

Karaoke text is a sequence of {\k|\K|\kf|\ko<cs>}syllable with durations in centiseconds. Syllable i starts at cue start plus the sum of all previous durations (empty syllables still consume time). Syllables starting at or after the cue end are dropped; others are clipped to the cue end. Output [syllable,start_ms,end_ms].

split: open-access


prompt:
Karaoke highlighting races through the line ten times too fast.

Karaoke text is a sequence of {\k|\K|\kf|\ko<cs>}syllable with durations in centiseconds. Syllable i starts at cue start plus the sum of all previous durations (empty syllables still consume time). Syllables starting at or after the cue end are dropped; others are clipped to the cue end. Output [syllable,start_ms,end_ms].

split: open-access


prompt:
Syllables after a pause marker highlight too early.

Karaoke text is a sequence of {\k|\K|\kf|\ko<cs>}syllable with durations in centiseconds. Syllable i starts at cue start plus the sum of all previous durations (empty syllables still consume time). Syllables starting at or after the cue end are dropped; others are clipped to the cue end. Output [syllable,start_ms,end_ms].

split: open-access


prompt:
The last syllable keeps highlighting after the cue has disappeared.

Karaoke text is a sequence of {\k|\K|\kf|\ko<cs>}syllable with durations in centiseconds. Syllable i starts at cue start plus the sum of all previous durations (empty syllables still consume time). Syllables starting at or after the cue end are dropped; others are clipped to the cue end. Output [syllable,start_ms,end_ms].

split: open-access


prompt:
A zero-length syllable appears exactly at the cue end.

Karaoke text is a sequence of {\k|\K|\kf|\ko<cs>}syllable with durations in centiseconds. Syllable i starts at cue start plus the sum of all previous durations (empty syllables still consume time). Syllables starting at or after the cue end are dropped; others are clipped to the cue end. Output [syllable,start_ms,end_ms].

split: open-access


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

N = 1
observations = []
def solve(events, fps):
    shown=''
    hidden=''
    since=None
    out=[]
    for frame,cmd in events:
        t=frame*1000//fps
        if cmd.startswith('TEXT:'):
            hidden+=cmd[5:]
        elif cmd=='ENM':
            hidden=''
        elif cmd=='EOC':
            if shown:
                out.append([since,t,shown])
            shown=hidden
            since=t
        elif cmd=='EDM':
            if shown: out.append([since,t,shown])
            shown=''
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: memory swap', [[[0, 'TEXT:A'], [10, 'EOC'], [20, 'TEXT:B'], [40, 'EOC'], [50, 'EOC']], 25], [[400, 1600, 'A'], [1600, 2000, 'B']]), ('regression variant: memory swap', [[[30, 'TEXT: there'], [45, 'EOC'], [52, 'EOC'], [82, 'ENM'], [82, 'TEXT:Bye'], [127, 'EOC'], [127, 'EOC'], [156, 'TEXT:Hi']], 29], [[1551, 1793, ' there'], [4379, 4379, 'Bye']]), ('partial repair probe: memory swap', [[[30, 'TEXT:Hi'], [59, 'TEXT:Hi'], [59, 'EOC'], [74, 'ENM'], [119, 'EOC'], [149, 'EOC'], [194, 'EOC']], 29], [[2034, 4103, 'HiHi'], [5137, 6689, 'HiHi']]), ('partial repair variant: memory swap', [[[3, 'TEXT:Hi'], [48, 'EOC'], [49, 'EOC'], [49, 'TEXT:Hi'], [94, 'TEXT:Bye'], [123, 'EOC'], [130, 'EDM']], 25], [[1920, 1960, 'Hi'], [4920, 5200, 'HiHiBye']]), ('boundary control', [[[0, 'TEXT:Hi'], [30, 'EOC'], [60, 'EDM']], 30], [[1000, 2000, 'Hi']]), ('boundary control', [[[0, 'EOC'], [5, 'EDM']], 30], []), ('normal control', [[[30, 'EOC'], [30, 'TEXT:Hi'], [37, 'ENM']], 24], []), ('normal control', [[[0, 'EOC'], [7, 'TEXT:Bye'], [52, 'EDM'], [59, 'TEXT:Bye'], [74, 'EOC']], 24], []), ('normal control', [[[30, 'TEXT:Hi'], [31, 'TEXT: there'], [61, 'EDM'], [106, 'TEXT: there'], [121, 'ENM'], [136, 'TEXT:Hi'], [166, 'EOC']], 24], [])], [('regression: memory swap', [[[0, 'EOC'], [30, 'TEXT:Bye'], [31, 'EOC'], [46, 'EOC'], [91, 'TEXT:Hi'], [92, 'TEXT: there'], [99, 'EDM'], [129, 'ENM']], 30], [[1033, 1533, 'Bye']]), ('regression variant: memory swap', [[[30, 'TEXT:Hi'], [75, 'TEXT:Hi'], [120, 'EOC'], [135, 'TEXT:Hi'], [164, 'EDM'], [193, 'TEXT:Hi'], [238, 'EOC'], [267, 'EOC']], 25], [[4800, 6560, 'HiHi'], [9520, 10680, 'HiHi']]), ('partial repair probe: memory swap', [[[30, 'TEXT:Bye'], [45, 'EOC'], [74, 'EOC'], [74, 'EDM'], [103, 'EOC'], [148, 'EDM'], [163, 'TEXT:Bye']], 24], [[1875, 3083, 'Bye'], [4291, 6166, 'Bye']]), ('partial repair variant: memory swap', [[[30, 'TEXT:Hi'], [30, 'TEXT:Bye'], [60, 'TEXT:Bye'], [105, 'EOC'], [120, 'EOC'], [165, 'EOC'], [180, 'TEXT: there'], [195, 'EDM']], 24], [[4375, 5000, 'HiByeBye'], [6875, 8125, 'HiByeBye']]), ('boundary control', [[[0, 'EOC'], [5, 'EDM']], 30], []), ('boundary control', [[[0, 'TEXT:Hi'], [30, 'EOC'], [60, 'EDM']], 30], [[1000, 2000, 'Hi']]), ('normal control', [[[30, 'EDM'], [30, 'EOC'], [60, 'ENM'], [89, 'ENM']], 25], []), ('normal control', [[[3, 'ENM'], [4, 'TEXT: there'], [34, 'EDM'], [64, 'ENM'], [79, 'EOC']], 30], []), ('normal control', [[[3, 'EOC'], [32, 'EOC'], [77, 'TEXT:Bye']], 25], [])], [('regression: memory swap', [[[3, 'TEXT:Hi'], [48, 'EOC'], [49, 'EOC'], [49, 'TEXT:Hi'], [94, 'TEXT:Bye'], [123, 'EOC'], [130, 'EDM']], 25], [[1920, 1960, 'Hi'], [4920, 5200, 'HiHiBye']]), ('regression variant: memory swap', [[[3, 'TEXT:Hi'], [10, 'EOC'], [17, 'TEXT:Bye'], [62, 'TEXT:Bye'], [91, 'TEXT:Bye'], [136, 'EOC'], [151, 'EDM']], 25], [[400, 5440, 'Hi'], [5440, 6040, 'ByeByeBye']]), ('partial repair probe: memory swap', [[[0, 'TEXT: there'], [7, 'EOC'], [37, 'TEXT:Hi'], [52, 'EOC'], [67, 'EOC'], [74, 'EOC'], [75, 'EOC'], [90, 'TEXT:Hi']], 24], [[291, 2166, ' there'], [2166, 2791, 'Hi'], [2791, 3083, ' there'], [3083, 3125, 'Hi']]), ('partial repair variant: memory swap', [[[30, 'TEXT:Hi'], [59, 'TEXT:Hi'], [59, 'EOC'], [74, 'ENM'], [119, 'EOC'], [149, 'EOC'], [194, 'EOC']], 29], [[2034, 4103, 'HiHi'], [5137, 6689, 'HiHi']]), ('boundary control', [[[0, 'TEXT:Hi'], [30, 'EOC'], [60, 'EDM']], 30], [[1000, 2000, 'Hi']]), ('boundary control', [[[0, 'EOC'], [5, 'EDM']], 30], []), ('normal control', [[[0, 'EOC'], [7, 'EDM'], [14, 'EOC'], [59, 'EOC'], [104, 'EOC'], [133, 'EOC'], [162, 'EOC'], [207, 'EOC']], 25], []), ('normal control', [[[30, 'EOC'], [31, 'TEXT: there'], [31, 'EDM'], [76, 'TEXT:Bye'], [76, 'ENM'], [91, 'EDM']], 30], []), ('normal control', [[[30, 'EOC'], [59, 'EOC'], [60, 'TEXT: there'], [89, 'TEXT: there'], [96, 'ENM'], [96, 'TEXT:Bye'], [96, 'TEXT:Bye'], [96, 'TEXT: there']], 30], [])], [('regression: memory swap', [[[30, 'TEXT:Hi'], [30, 'TEXT:Bye'], [60, 'TEXT:Bye'], [105, 'EOC'], [120, 'EOC'], [165, 'EOC'], [180, 'TEXT: there'], [195, 'EDM']], 24], [[4375, 5000, 'HiByeBye'], [6875, 8125, 'HiByeBye']]), ('regression variant: memory swap', [[[3, 'TEXT: there'], [4, 'EOC'], [11, 'EOC'], [12, 'TEXT:Hi'], [42, 'EOC'], [57, 'ENM']], 24], [[166, 458, ' there']]), ('partial repair probe: memory swap', [[[0, 'ENM'], [1, 'TEXT:Hi'], [16, 'EOC'], [16, 'EOC'], [45, 'TEXT:Bye'], [74, 'EOC'], [89, 'EOC'], [119, 'ENM']], 30], [[533, 533, 'Hi'], [2466, 2966, 'HiBye']]), ('partial repair variant: memory swap', [[[30, 'TEXT:Bye'], [45, 'EOC'], [74, 'EOC'], [74, 'EDM'], [103, 'EOC'], [148, 'EDM'], [163, 'TEXT:Bye']], 24], [[1875, 3083, 'Bye'], [4291, 6166, 'Bye']]), ('boundary control', [[[0, 'EOC'], [5, 'EDM']], 30], []), ('boundary control', [[[0, 'TEXT:Hi'], [30, 'EOC'], [60, 'EDM']], 30], [[1000, 2000, 'Hi']]), ('normal control', [[[0, 'TEXT: there'], [7, 'ENM'], [8, 'EOC'], [9, 'ENM'], [16, 'TEXT:Hi']], 30], []), ('normal control', [[[30, 'EDM'], [60, 'TEXT: there'], [90, 'TEXT:Bye']], 24], []), ('normal control', [[[3, 'EDM'], [18, 'TEXT:Hi'], [19, 'TEXT:Hi'], [34, 'TEXT: there'], [79, 'TEXT:Bye']], 25], [])], [('regression: memory swap', [[[3, 'ENM'], [3, 'TEXT:Bye'], [10, 'EOC'], [10, 'EOC'], [55, 'TEXT:Bye'], [56, 'EOC']], 29], [[344, 344, 'Bye']]), ('regression variant: memory swap', [[[3, 'TEXT:Hi'], [48, 'TEXT:Bye'], [49, 'TEXT:Bye'], [79, 'EOC'], [79, 'TEXT: there'], [124, 'EOC'], [169, 'TEXT:Bye'], [198, 'EOC']], 30], [[2633, 4133, 'HiByeBye'], [4133, 6600, ' there']]), ('partial repair probe: memory swap', [[[3, 'TEXT: there'], [18, 'EOC'], [18, 'EOC'], [19, 'EOC'], [48, 'EOC'], [78, 'EDM']], 29], [[620, 620, ' there'], [655, 1655, ' there']]), ('partial repair variant: memory swap', [[[0, 'TEXT: there'], [7, 'EOC'], [37, 'TEXT:Hi'], [52, 'EOC'], [67, 'EOC'], [74, 'EOC'], [75, 'EOC'], [90, 'TEXT:Hi']], 24], [[291, 2166, ' there'], [2166, 2791, 'Hi'], [2791, 3083, ' there'], [3083, 3125, 'Hi']]), ('boundary control', [[[0, 'TEXT:Hi'], [30, 'EOC'], [60, 'EDM']], 30], [[1000, 2000, 'Hi']]), ('boundary control', [[[0, 'EOC'], [5, 'EDM']], 30], []), ('normal control', [[[0, 'EOC'], [7, 'TEXT:Bye'], [14, 'TEXT:Bye']], 25], []), ('normal control', [[[30, 'TEXT:Bye'], [60, 'TEXT:Bye'], [90, 'ENM'], [120, 'EOC'], [127, 'TEXT: there'], [127, 'TEXT:Bye'], [134, 'TEXT:Bye']], 25], []), ('normal control', [[[3, 'EDM'], [32, 'TEXT:Bye'], [77, 'TEXT:Bye'], [106, 'TEXT:Hi'], [151, 'TEXT:Hi']], 29], [])]]
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(events, fps):
    shown=''
    hidden=''
    since=None
    out=[]
    for frame,cmd in events:
        t=frame*1000//fps
        if cmd.startswith('TEXT:'):
            hidden+=cmd[5:]
        elif cmd=='ENM':
            hidden=''
        elif cmd=='EOC':
            if shown:
                out.append([since,t,shown])
            shown,hidden=hidden,''
            since=t
        elif cmd=='EDM':
            if shown: out.append([since,t,shown])
            shown=''
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: memory swap', [[[0, 'TEXT:A'], [10, 'EOC'], [20, 'TEXT:B'], [40, 'EOC'], [50, 'EOC']], 25], [[400, 1600, 'A'], [1600, 2000, 'B']]), ('regression variant: memory swap', [[[30, 'TEXT: there'], [45, 'EOC'], [52, 'EOC'], [82, 'ENM'], [82, 'TEXT:Bye'], [127, 'EOC'], [127, 'EOC'], [156, 'TEXT:Hi']], 29], [[1551, 1793, ' there'], [4379, 4379, 'Bye']]), ('partial repair probe: memory swap', [[[30, 'TEXT:Hi'], [59, 'TEXT:Hi'], [59, 'EOC'], [74, 'ENM'], [119, 'EOC'], [149, 'EOC'], [194, 'EOC']], 29], [[2034, 4103, 'HiHi'], [5137, 6689, 'HiHi']]), ('partial repair variant: memory swap', [[[3, 'TEXT:Hi'], [48, 'EOC'], [49, 'EOC'], [49, 'TEXT:Hi'], [94, 'TEXT:Bye'], [123, 'EOC'], [130, 'EDM']], 25], [[1920, 1960, 'Hi'], [4920, 5200, 'HiHiBye']]), ('boundary control', [[[0, 'TEXT:Hi'], [30, 'EOC'], [60, 'EDM']], 30], [[1000, 2000, 'Hi']]), ('boundary control', [[[0, 'EOC'], [5, 'EDM']], 30], []), ('normal control', [[[30, 'EOC'], [30, 'TEXT:Hi'], [37, 'ENM']], 24], []), ('normal control', [[[0, 'EOC'], [7, 'TEXT:Bye'], [52, 'EDM'], [59, 'TEXT:Bye'], [74, 'EOC']], 24], []), ('normal control', [[[30, 'TEXT:Hi'], [31, 'TEXT: there'], [61, 'EDM'], [106, 'TEXT: there'], [121, 'ENM'], [136, 'TEXT:Hi'], [166, 'EOC']], 24], [])], [('regression: memory swap', [[[0, 'EOC'], [30, 'TEXT:Bye'], [31, 'EOC'], [46, 'EOC'], [91, 'TEXT:Hi'], [92, 'TEXT: there'], [99, 'EDM'], [129, 'ENM']], 30], [[1033, 1533, 'Bye']]), ('regression variant: memory swap', [[[30, 'TEXT:Hi'], [75, 'TEXT:Hi'], [120, 'EOC'], [135, 'TEXT:Hi'], [164, 'EDM'], [193, 'TEXT:Hi'], [238, 'EOC'], [267, 'EOC']], 25], [[4800, 6560, 'HiHi'], [9520, 10680, 'HiHi']]), ('partial repair probe: memory swap', [[[30, 'TEXT:Bye'], [45, 'EOC'], [74, 'EOC'], [74, 'EDM'], [103, 'EOC'], [148, 'EDM'], [163, 'TEXT:Bye']], 24], [[1875, 3083, 'Bye'], [4291, 6166, 'Bye']]), ('partial repair variant: memory swap', [[[30, 'TEXT:Hi'], [30, 'TEXT:Bye'], [60, 'TEXT:Bye'], [105, 'EOC'], [120, 'EOC'], [165, 'EOC'], [180, 'TEXT: there'], [195, 'EDM']], 24], [[4375, 5000, 'HiByeBye'], [6875, 8125, 'HiByeBye']]), ('boundary control', [[[0, 'EOC'], [5, 'EDM']], 30], []), ('boundary control', [[[0, 'TEXT:Hi'], [30, 'EOC'], [60, 'EDM']], 30], [[1000, 2000, 'Hi']]), ('normal control', [[[30, 'EDM'], [30, 'EOC'], [60, 'ENM'], [89, 'ENM']], 25], []), ('normal control', [[[3, 'ENM'], [4, 'TEXT: there'], [34, 'EDM'], [64, 'ENM'], [79, 'EOC']], 30], []), ('normal control', [[[3, 'EOC'], [32, 'EOC'], [77, 'TEXT:Bye']], 25], [])], [('regression: memory swap', [[[3, 'TEXT:Hi'], [48, 'EOC'], [49, 'EOC'], [49, 'TEXT:Hi'], [94, 'TEXT:Bye'], [123, 'EOC'], [130, 'EDM']], 25], [[1920, 1960, 'Hi'], [4920, 5200, 'HiHiBye']]), ('regression variant: memory swap', [[[3, 'TEXT:Hi'], [10, 'EOC'], [17, 'TEXT:Bye'], [62, 'TEXT:Bye'], [91, 'TEXT:Bye'], [136, 'EOC'], [151, 'EDM']], 25], [[400, 5440, 'Hi'], [5440, 6040, 'ByeByeBye']]), ('partial repair probe: memory swap', [[[0, 'TEXT: there'], [7, 'EOC'], [37, 'TEXT:Hi'], [52, 'EOC'], [67, 'EOC'], [74, 'EOC'], [75, 'EOC'], [90, 'TEXT:Hi']], 24], [[291, 2166, ' there'], [2166, 2791, 'Hi'], [2791, 3083, ' there'], [3083, 3125, 'Hi']]), ('partial repair variant: memory swap', [[[30, 'TEXT:Hi'], [59, 'TEXT:Hi'], [59, 'EOC'], [74, 'ENM'], [119, 'EOC'], [149, 'EOC'], [194, 'EOC']], 29], [[2034, 4103, 'HiHi'], [5137, 6689, 'HiHi']]), ('boundary control', [[[0, 'TEXT:Hi'], [30, 'EOC'], [60, 'EDM']], 30], [[1000, 2000, 'Hi']]), ('boundary control', [[[0, 'EOC'], [5, 'EDM']], 30], []), ('normal control', [[[0, 'EOC'], [7, 'EDM'], [14, 'EOC'], [59, 'EOC'], [104, 'EOC'], [133, 'EOC'], [162, 'EOC'], [207, 'EOC']], 25], []), ('normal control', [[[30, 'EOC'], [31, 'TEXT: there'], [31, 'EDM'], [76, 'TEXT:Bye'], [76, 'ENM'], [91, 'EDM']], 30], []), ('normal control', [[[30, 'EOC'], [59, 'EOC'], [60, 'TEXT: there'], [89, 'TEXT: there'], [96, 'ENM'], [96, 'TEXT:Bye'], [96, 'TEXT:Bye'], [96, 'TEXT: there']], 30], [])], [('regression: memory swap', [[[30, 'TEXT:Hi'], [30, 'TEXT:Bye'], [60, 'TEXT:Bye'], [105, 'EOC'], [120, 'EOC'], [165, 'EOC'], [180, 'TEXT: there'], [195, 'EDM']], 24], [[4375, 5000, 'HiByeBye'], [6875, 8125, 'HiByeBye']]), ('regression variant: memory swap', [[[3, 'TEXT: there'], [4, 'EOC'], [11, 'EOC'], [12, 'TEXT:Hi'], [42, 'EOC'], [57, 'ENM']], 24], [[166, 458, ' there']]), ('partial repair probe: memory swap', [[[0, 'ENM'], [1, 'TEXT:Hi'], [16, 'EOC'], [16, 'EOC'], [45, 'TEXT:Bye'], [74, 'EOC'], [89, 'EOC'], [119, 'ENM']], 30], [[533, 533, 'Hi'], [2466, 2966, 'HiBye']]), ('partial repair variant: memory swap', [[[30, 'TEXT:Bye'], [45, 'EOC'], [74, 'EOC'], [74, 'EDM'], [103, 'EOC'], [148, 'EDM'], [163, 'TEXT:Bye']], 24], [[1875, 3083, 'Bye'], [4291, 6166, 'Bye']]), ('boundary control', [[[0, 'EOC'], [5, 'EDM']], 30], []), ('boundary control', [[[0, 'TEXT:Hi'], [30, 'EOC'], [60, 'EDM']], 30], [[1000, 2000, 'Hi']]), ('normal control', [[[0, 'TEXT: there'], [7, 'ENM'], [8, 'EOC'], [9, 'ENM'], [16, 'TEXT:Hi']], 30], []), ('normal control', [[[30, 'EDM'], [60, 'TEXT: there'], [90, 'TEXT:Bye']], 24], []), ('normal control', [[[3, 'EDM'], [18, 'TEXT:Hi'], [19, 'TEXT:Hi'], [34, 'TEXT: there'], [79, 'TEXT:Bye']], 25], [])], [('regression: memory swap', [[[3, 'ENM'], [3, 'TEXT:Bye'], [10, 'EOC'], [10, 'EOC'], [55, 'TEXT:Bye'], [56, 'EOC']], 29], [[344, 344, 'Bye']]), ('regression variant: memory swap', [[[3, 'TEXT:Hi'], [48, 'TEXT:Bye'], [49, 'TEXT:Bye'], [79, 'EOC'], [79, 'TEXT: there'], [124, 'EOC'], [169, 'TEXT:Bye'], [198, 'EOC']], 30], [[2633, 4133, 'HiByeBye'], [4133, 6600, ' there']]), ('partial repair probe: memory swap', [[[3, 'TEXT: there'], [18, 'EOC'], [18, 'EOC'], [19, 'EOC'], [48, 'EOC'], [78, 'EDM']], 29], [[620, 620, ' there'], [655, 1655, ' there']]), ('partial repair variant: memory swap', [[[0, 'TEXT: there'], [7, 'EOC'], [37, 'TEXT:Hi'], [52, 'EOC'], [67, 'EOC'], [74, 'EOC'], [75, 'EOC'], [90, 'TEXT:Hi']], 24], [[291, 2166, ' there'], [2166, 2791, 'Hi'], [2791, 3083, ' there'], [3083, 3125, 'Hi']]), ('boundary control', [[[0, 'TEXT:Hi'], [30, 'EOC'], [60, 'EDM']], 30], [[1000, 2000, 'Hi']]), ('boundary control', [[[0, 'EOC'], [5, 'EDM']], 30], []), ('normal control', [[[0, 'EOC'], [7, 'TEXT:Bye'], [14, 'TEXT:Bye']], 25], []), ('normal control', [[[30, 'TEXT:Bye'], [60, 'TEXT:Bye'], [90, 'ENM'], [120, 'EOC'], [127, 'TEXT: there'], [127, 'TEXT:Bye'], [134, 'TEXT:Bye']], 25], []), ('normal control', [[[3, 'EDM'], [32, 'TEXT:Bye'], [77, 'TEXT:Bye'], [106, 'TEXT:Hi'], [151, 'TEXT:Hi']], 29], [])]]
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:
Captions loaded after a flip repeat the previous caption text.

Commands [frame,cmd] at integer fps (time = frame*1000//fps). TEXT:x appends x to the non-displayed memory; ENM erases non-displayed memory; EOC swaps displayed and non-displayed memories; EDM erases displayed memory. Whenever non-empty displayed text is replaced (EOC) or erased (EDM), emit [shown_since_ms, now_ms, text].

split: open-access


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

N = 1
observations = []
def solve(events, fps):
    shown=''
    hidden=''
    since=None
    out=[]
    for frame,cmd in events:
        t=frame*1000//fps
        if cmd.startswith('TEXT:'):
            hidden+=cmd[5:]
        elif cmd=='ENM':
            hidden=''
        elif cmd=='EOC':
            if shown:
                out.append([since,t,shown])
            shown,hidden=hidden,shown
            since=t
        elif cmd=='EDM':
            if shown: out.append([since,t,shown])
            hidden=''
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: display erase target', [[[30, 'TEXT:Bye'], [37, 'EOC'], [52, 'EDM'], [52, 'ENM'], [67, 'EDM']], 30], [[1233, 1733, 'Bye']]), ('regression variant: display erase target', [[[30, 'TEXT:Hi'], [75, 'TEXT:Hi'], [120, 'EOC'], [135, 'TEXT:Hi'], [164, 'EDM'], [193, 'TEXT:Hi'], [238, 'EOC'], [267, 'EOC']], 25], [[4800, 6560, 'HiHi'], [9520, 10680, 'HiHi']]), ('partial repair probe: display erase target', [[[30, 'TEXT:Hi'], [75, 'EOC'], [90, 'EDM'], [90, 'EDM'], [135, 'TEXT:Hi'], [136, 'EDM'], [136, 'TEXT:Hi']], 29], [[2586, 3103, 'Hi']]), ('partial repair variant: display erase target', [[[3, 'TEXT:Bye'], [18, 'EOC'], [33, 'TEXT:Hi'], [33, 'EDM'], [33, 'TEXT:Hi'], [62, 'ENM'], [63, 'EOC'], [92, 'TEXT: there']], 29], [[620, 1137, 'Bye']]), ('boundary control', [[[0, 'TEXT:Hi'], [30, 'EOC'], [60, 'EDM']], 30], [[1000, 2000, 'Hi']]), ('boundary control', [[[0, 'TEXT:A'], [10, 'EOC'], [20, 'TEXT:B'], [40, 'EOC'], [50, 'EOC']], 25], [[400, 1600, 'A'], [1600, 2000, 'B']]), ('normal control', [[[0, 'EOC'], [5, 'EDM']], 30], []), ('normal control', [[[30, 'EOC'], [30, 'TEXT:Hi'], [37, 'ENM']], 24], []), ('normal control', [[[0, 'EOC'], [30, 'TEXT:Bye'], [31, 'EOC'], [46, 'EOC'], [91, 'TEXT:Hi'], [92, 'TEXT: there'], [99, 'EDM'], [129, 'ENM']], 30], [[1033, 1533, 'Bye']])], [('regression: display erase target', [[[0, 'TEXT:Bye'], [7, 'EOC'], [14, 'EDM'], [43, 'ENM'], [88, 'EDM'], [95, 'EOC'], [95, 'EOC'], [125, 'TEXT:Bye']], 24], [[291, 583, 'Bye']]), ('regression variant: display erase target', [[[30, 'TEXT:Hi'], [75, 'EOC'], [90, 'EDM'], [90, 'EDM'], [135, 'TEXT:Hi'], [136, 'EDM'], [136, 'TEXT:Hi']], 29], [[2586, 3103, 'Hi']]), ('partial repair probe: display erase target', [[[0, 'TEXT: there'], [1, 'EOC'], [31, 'EDM'], [38, 'EOC'], [45, 'TEXT: there'], [46, 'ENM'], [76, 'TEXT: there']], 29], [[34, 1068, ' there']]), ('partial repair variant: display erase target', [[[3, 'EOC'], [10, 'ENM'], [40, 'TEXT: there'], [55, 'EOC'], [85, 'TEXT:Hi'], [115, 'EOC'], [160, 'EDM'], [167, 'EOC']], 29], [[1896, 3965, ' there'], [3965, 5517, 'Hi']]), ('boundary control', [[[0, 'TEXT:A'], [10, 'EOC'], [20, 'TEXT:B'], [40, 'EOC'], [50, 'EOC']], 25], [[400, 1600, 'A'], [1600, 2000, 'B']]), ('boundary control', [[[0, 'EOC'], [5, 'EDM']], 30], []), ('normal control', [[[30, 'TEXT: there'], [30, 'EOC'], [59, 'ENM']], 30], []), ('normal control', [[[0, 'EDM'], [7, 'TEXT: there'], [37, 'TEXT: there']], 29], []), ('normal control', [[[0, 'ENM'], [0, 'EOC'], [30, 'TEXT:Hi']], 24], [])], [('regression: display erase target', [[[30, 'TEXT:Hi'], [30, 'EDM'], [75, 'EOC'], [120, 'EDM']], 24], [[3125, 5000, 'Hi']]), ('regression variant: display erase target', [[[0, 'TEXT: there'], [1, 'EOC'], [31, 'EDM'], [38, 'EOC'], [45, 'TEXT: there'], [46, 'ENM'], [76, 'TEXT: there']], 29], [[34, 1068, ' there']]), ('partial repair probe: display erase target', [[[30, 'TEXT:Hi'], [45, 'TEXT:Hi'], [75, 'EDM'], [76, 'TEXT: there'], [83, 'EOC'], [128, 'EDM'], [143, 'EOC']], 25], [[3320, 5120, 'HiHi there']]), ('partial repair variant: display erase target', [[[0, 'TEXT: there'], [0, 'TEXT: there'], [7, 'TEXT: there'], [37, 'EOC'], [67, 'TEXT:Hi'], [67, 'TEXT:Hi'], [97, 'EDM'], [112, 'EOC']], 29], [[1275, 3344, ' there there there']]), ('boundary control', [[[0, 'EOC'], [5, 'EDM']], 30], []), ('boundary control', [[[0, 'TEXT:Hi'], [30, 'EOC'], [60, 'EDM']], 30], [[1000, 2000, 'Hi']]), ('normal control', [[[0, 'TEXT:Bye'], [1, 'EDM'], [31, 'TEXT: there'], [61, 'ENM'], [68, 'EOC'], [98, 'EOC'], [113, 'TEXT:Bye']], 25], []), ('normal control', [[[3, 'TEXT: there'], [32, 'TEXT: there'], [33, 'TEXT: there'], [48, 'EOC'], [78, 'EOC'], [123, 'TEXT: there']], 25], [[1920, 3120, ' there there there']]), ('normal control', [[[3, 'EDM'], [18, 'EOC'], [63, 'TEXT:Bye'], [63, 'ENM'], [108, 'TEXT:Bye'], [123, 'ENM'], [138, 'TEXT: there']], 25], [])], [('regression: display erase target', [[[30, 'TEXT:Bye'], [31, 'ENM'], [76, 'EOC'], [106, 'TEXT:Hi'], [107, 'EDM'], [137, 'EOC'], [166, 'EDM'], [167, 'TEXT: there']], 24], [[5708, 6916, 'Hi']]), ('regression variant: display erase target', [[[0, 'TEXT: there'], [29, 'TEXT:Bye'], [44, 'EDM'], [73, 'EOC'], [118, 'EOC'], [163, 'TEXT: there'], [192, 'ENM']], 25], [[2920, 4720, ' thereBye']]), ('partial repair probe: display erase target', [[[30, 'TEXT:Hi'], [45, 'TEXT:Hi'], [75, 'EDM'], [76, 'TEXT: there'], [83, 'EOC'], [128, 'EDM'], [143, 'EOC']], 25], [[3320, 5120, 'HiHi there']]), ('partial repair variant: display erase target', [[[0, 'TEXT:Bye'], [45, 'EDM'], [74, 'EOC'], [119, 'TEXT:Hi'], [120, 'EDM'], [135, 'EOC'], [165, 'TEXT: there'], [194, 'TEXT: there']], 29], [[2551, 4137, 'Bye']]), ('boundary control', [[[0, 'TEXT:Hi'], [30, 'EOC'], [60, 'EDM']], 30], [[1000, 2000, 'Hi']]), ('boundary control', [[[0, 'TEXT:A'], [10, 'EOC'], [20, 'TEXT:B'], [40, 'EOC'], [50, 'EOC']], 25], [[400, 1600, 'A'], [1600, 2000, 'B']]), ('normal control', [[[30, 'TEXT:Bye'], [59, 'EOC'], [66, 'TEXT:Bye'], [111, 'EOC']], 24], [[2458, 4625, 'Bye']]), ('normal control', [[[3, 'TEXT:Hi'], [10, 'TEXT:Bye']], 30], []), ('normal control', [[[3, 'EOC'], [18, 'EOC'], [19, 'EOC']], 25], [])], [('regression: display erase target', [[[3, 'EOC'], [3, 'TEXT: there'], [4, 'TEXT: there'], [34, 'EDM'], [64, 'EOC'], [71, 'EOC'], [78, 'TEXT: there'], [78, 'TEXT: there']], 30], [[2133, 2366, ' there there']]), ('regression variant: display erase target', [[[30, 'TEXT:Hi'], [45, 'TEXT:Hi'], [75, 'EDM'], [76, 'TEXT: there'], [83, 'EOC'], [128, 'EDM'], [143, 'EOC']], 25], [[3320, 5120, 'HiHi there']]), ('partial repair probe: display erase target', [[[3, 'TEXT:Hi'], [18, 'TEXT: there'], [33, 'TEXT:Bye'], [62, 'EOC'], [91, 'EDM'], [120, 'EOC'], [149, 'EOC'], [150, 'TEXT:Bye']], 25], [[2480, 3640, 'Hi thereBye']]), ('partial repair variant: display erase target', [[[0, 'TEXT:Bye'], [30, 'EOC'], [30, 'EDM'], [45, 'EOC'], [60, 'TEXT: there'], [89, 'EDM'], [119, 'EDM'], [126, 'TEXT:Bye']], 24], [[1250, 1250, 'Bye']]), ('boundary control', [[[0, 'TEXT:A'], [10, 'EOC'], [20, 'TEXT:B'], [40, 'EOC'], [50, 'EOC']], 25], [[400, 1600, 'A'], [1600, 2000, 'B']]), ('boundary control', [[[0, 'EOC'], [5, 'EDM']], 30], []), ('normal control', [[[30, 'EDM'], [60, 'TEXT: there'], [67, 'EOC'], [112, 'EOC']], 24], [[2791, 4666, ' there']]), ('normal control', [[[3, 'EDM'], [33, 'TEXT:Bye'], [63, 'TEXT:Hi'], [108, 'EOC'], [109, 'TEXT:Hi']], 30], []), ('normal control', [[[30, 'ENM'], [31, 'TEXT: there'], [60, 'EDM'], [89, 'ENM'], [96, 'EDM'], [111, 'EOC']], 30], [])]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(events, fps):
    shown=''
    hidden=''
    since=None
    out=[]
    for frame,cmd in events:
        t=frame*1000//fps
        if cmd.startswith('TEXT:'):
            hidden+=cmd[5:]
        elif cmd=='ENM':
            hidden=''
        elif cmd=='EOC':
            if shown:
                out.append([since,t,shown])
            shown,hidden=hidden,shown
            since=t
        elif cmd=='EDM':
            if shown: out.append([since,t,shown])
            since=t
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: display erase target', [[[30, 'TEXT:Bye'], [37, 'EOC'], [52, 'EDM'], [52, 'ENM'], [67, 'EDM']], 30], [[1233, 1733, 'Bye']]), ('regression variant: display erase target', [[[30, 'TEXT:Hi'], [75, 'TEXT:Hi'], [120, 'EOC'], [135, 'TEXT:Hi'], [164, 'EDM'], [193, 'TEXT:Hi'], [238, 'EOC'], [267, 'EOC']], 25], [[4800, 6560, 'HiHi'], [9520, 10680, 'HiHi']]), ('partial repair probe: display erase target', [[[30, 'TEXT:Hi'], [75, 'EOC'], [90, 'EDM'], [90, 'EDM'], [135, 'TEXT:Hi'], [136, 'EDM'], [136, 'TEXT:Hi']], 29], [[2586, 3103, 'Hi']]), ('partial repair variant: display erase target', [[[3, 'TEXT:Bye'], [18, 'EOC'], [33, 'TEXT:Hi'], [33, 'EDM'], [33, 'TEXT:Hi'], [62, 'ENM'], [63, 'EOC'], [92, 'TEXT: there']], 29], [[620, 1137, 'Bye']]), ('boundary control', [[[0, 'TEXT:Hi'], [30, 'EOC'], [60, 'EDM']], 30], [[1000, 2000, 'Hi']]), ('boundary control', [[[0, 'TEXT:A'], [10, 'EOC'], [20, 'TEXT:B'], [40, 'EOC'], [50, 'EOC']], 25], [[400, 1600, 'A'], [1600, 2000, 'B']]), ('normal control', [[[0, 'EOC'], [5, 'EDM']], 30], []), ('normal control', [[[30, 'EOC'], [30, 'TEXT:Hi'], [37, 'ENM']], 24], []), ('normal control', [[[0, 'EOC'], [30, 'TEXT:Bye'], [31, 'EOC'], [46, 'EOC'], [91, 'TEXT:Hi'], [92, 'TEXT: there'], [99, 'EDM'], [129, 'ENM']], 30], [[1033, 1533, 'Bye']])], [('regression: display erase target', [[[0, 'TEXT:Bye'], [7, 'EOC'], [14, 'EDM'], [43, 'ENM'], [88, 'EDM'], [95, 'EOC'], [95, 'EOC'], [125, 'TEXT:Bye']], 24], [[291, 583, 'Bye']]), ('regression variant: display erase target', [[[30, 'TEXT:Hi'], [75, 'EOC'], [90, 'EDM'], [90, 'EDM'], [135, 'TEXT:Hi'], [136, 'EDM'], [136, 'TEXT:Hi']], 29], [[2586, 3103, 'Hi']]), ('partial repair probe: display erase target', [[[0, 'TEXT: there'], [1, 'EOC'], [31, 'EDM'], [38, 'EOC'], [45, 'TEXT: there'], [46, 'ENM'], [76, 'TEXT: there']], 29], [[34, 1068, ' there']]), ('partial repair variant: display erase target', [[[3, 'EOC'], [10, 'ENM'], [40, 'TEXT: there'], [55, 'EOC'], [85, 'TEXT:Hi'], [115, 'EOC'], [160, 'EDM'], [167, 'EOC']], 29], [[1896, 3965, ' there'], [3965, 5517, 'Hi']]), ('boundary control', [[[0, 'TEXT:A'], [10, 'EOC'], [20, 'TEXT:B'], [40, 'EOC'], [50, 'EOC']], 25], [[400, 1600, 'A'], [1600, 2000, 'B']]), ('boundary control', [[[0, 'EOC'], [5, 'EDM']], 30], []), ('normal control', [[[30, 'TEXT: there'], [30, 'EOC'], [59, 'ENM']], 30], []), ('normal control', [[[0, 'EDM'], [7, 'TEXT: there'], [37, 'TEXT: there']], 29], []), ('normal control', [[[0, 'ENM'], [0, 'EOC'], [30, 'TEXT:Hi']], 24], [])], [('regression: display erase target', [[[30, 'TEXT:Hi'], [30, 'EDM'], [75, 'EOC'], [120, 'EDM']], 24], [[3125, 5000, 'Hi']]), ('regression variant: display erase target', [[[0, 'TEXT: there'], [1, 'EOC'], [31, 'EDM'], [38, 'EOC'], [45, 'TEXT: there'], [46, 'ENM'], [76, 'TEXT: there']], 29], [[34, 1068, ' there']]), ('partial repair probe: display erase target', [[[30, 'TEXT:Hi'], [45, 'TEXT:Hi'], [75, 'EDM'], [76, 'TEXT: there'], [83, 'EOC'], [128, 'EDM'], [143, 'EOC']], 25], [[3320, 5120, 'HiHi there']]), ('partial repair variant: display erase target', [[[0, 'TEXT: there'], [0, 'TEXT: there'], [7, 'TEXT: there'], [37, 'EOC'], [67, 'TEXT:Hi'], [67, 'TEXT:Hi'], [97, 'EDM'], [112, 'EOC']], 29], [[1275, 3344, ' there there there']]), ('boundary control', [[[0, 'EOC'], [5, 'EDM']], 30], []), ('boundary control', [[[0, 'TEXT:Hi'], [30, 'EOC'], [60, 'EDM']], 30], [[1000, 2000, 'Hi']]), ('normal control', [[[0, 'TEXT:Bye'], [1, 'EDM'], [31, 'TEXT: there'], [61, 'ENM'], [68, 'EOC'], [98, 'EOC'], [113, 'TEXT:Bye']], 25], []), ('normal control', [[[3, 'TEXT: there'], [32, 'TEXT: there'], [33, 'TEXT: there'], [48, 'EOC'], [78, 'EOC'], [123, 'TEXT: there']], 25], [[1920, 3120, ' there there there']]), ('normal control', [[[3, 'EDM'], [18, 'EOC'], [63, 'TEXT:Bye'], [63, 'ENM'], [108, 'TEXT:Bye'], [123, 'ENM'], [138, 'TEXT: there']], 25], [])], [('regression: display erase target', [[[30, 'TEXT:Bye'], [31, 'ENM'], [76, 'EOC'], [106, 'TEXT:Hi'], [107, 'EDM'], [137, 'EOC'], [166, 'EDM'], [167, 'TEXT: there']], 24], [[5708, 6916, 'Hi']]), ('regression variant: display erase target', [[[0, 'TEXT: there'], [29, 'TEXT:Bye'], [44, 'EDM'], [73, 'EOC'], [118, 'EOC'], [163, 'TEXT: there'], [192, 'ENM']], 25], [[2920, 4720, ' thereBye']]), ('partial repair probe: display erase target', [[[30, 'TEXT:Hi'], [45, 'TEXT:Hi'], [75, 'EDM'], [76, 'TEXT: there'], [83, 'EOC'], [128, 'EDM'], [143, 'EOC']], 25], [[3320, 5120, 'HiHi there']]), ('partial repair variant: display erase target', [[[0, 'TEXT:Bye'], [45, 'EDM'], [74, 'EOC'], [119, 'TEXT:Hi'], [120, 'EDM'], [135, 'EOC'], [165, 'TEXT: there'], [194, 'TEXT: there']], 29], [[2551, 4137, 'Bye']]), ('boundary control', [[[0, 'TEXT:Hi'], [30, 'EOC'], [60, 'EDM']], 30], [[1000, 2000, 'Hi']]), ('boundary control', [[[0, 'TEXT:A'], [10, 'EOC'], [20, 'TEXT:B'], [40, 'EOC'], [50, 'EOC']], 25], [[400, 1600, 'A'], [1600, 2000, 'B']]), ('normal control', [[[30, 'TEXT:Bye'], [59, 'EOC'], [66, 'TEXT:Bye'], [111, 'EOC']], 24], [[2458, 4625, 'Bye']]), ('normal control', [[[3, 'TEXT:Hi'], [10, 'TEXT:Bye']], 30], []), ('normal control', [[[3, 'EOC'], [18, 'EOC'], [19, 'EOC']], 25], [])], [('regression: display erase target', [[[3, 'EOC'], [3, 'TEXT: there'], [4, 'TEXT: there'], [34, 'EDM'], [64, 'EOC'], [71, 'EOC'], [78, 'TEXT: there'], [78, 'TEXT: there']], 30], [[2133, 2366, ' there there']]), ('regression variant: display erase target', [[[30, 'TEXT:Hi'], [45, 'TEXT:Hi'], [75, 'EDM'], [76, 'TEXT: there'], [83, 'EOC'], [128, 'EDM'], [143, 'EOC']], 25], [[3320, 5120, 'HiHi there']]), ('partial repair probe: display erase target', [[[3, 'TEXT:Hi'], [18, 'TEXT: there'], [33, 'TEXT:Bye'], [62, 'EOC'], [91, 'EDM'], [120, 'EOC'], [149, 'EOC'], [150, 'TEXT:Bye']], 25], [[2480, 3640, 'Hi thereBye']]), ('partial repair variant: display erase target', [[[0, 'TEXT:Bye'], [30, 'EOC'], [30, 'EDM'], [45, 'EOC'], [60, 'TEXT: there'], [89, 'EDM'], [119, 'EDM'], [126, 'TEXT:Bye']], 24], [[1250, 1250, 'Bye']]), ('boundary control', [[[0, 'TEXT:A'], [10, 'EOC'], [20, 'TEXT:B'], [40, 'EOC'], [50, 'EOC']], 25], [[400, 1600, 'A'], [1600, 2000, 'B']]), ('boundary control', [[[0, 'EOC'], [5, 'EDM']], 30], []), ('normal control', [[[30, 'EDM'], [60, 'TEXT: there'], [67, 'EOC'], [112, 'EOC']], 24], [[2791, 4666, ' there']]), ('normal control', [[[3, 'EDM'], [33, 'TEXT:Bye'], [63, 'TEXT:Hi'], [108, 'EOC'], [109, 'TEXT:Hi']], 30], []), ('normal control', [[[30, 'ENM'], [31, 'TEXT: there'], [60, 'EDM'], [89, 'ENM'], [96, 'EDM'], [111, 'EOC']], 30], [])]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Captions stay on screen after an erase-displayed-memory command.

Commands [frame,cmd] at integer fps (time = frame*1000//fps). TEXT:x appends x to the non-displayed memory; ENM erases non-displayed memory; EOC swaps displayed and non-displayed memories; EDM erases displayed memory. Whenever non-empty displayed text is replaced (EOC) or erased (EDM), emit [shown_since_ms, now_ms, text].

split: open-access