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

N = 1
observations = []
def solve(v, phase, order):
    if v<0:
        return None
    base=[0,2,5,7][phase]
    def film(f):
        g,w=divmod(f+base,10)
        return 4*g+[0,0,1,1,1,2,2,3,3,3][w]
    top,bottom=film(2*v),film(2*v+1)
    if order=='lower':
        top,bottom=bottom,top
    return [top,bottom,'clean' if top==bottom else 'mixed']
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: phase frame rebasing', [0, 1, 'upper'], [0, 0, 'clean']), ('regression variant: phase frame rebasing', [12, 3, 'lower'], [10, 9, 'mixed']), ('partial repair probe: phase frame rebasing', [16, 3, 'upper'], [12, 13, 'mixed']), ('partial repair variant: phase frame rebasing', [15, 1, 'upper'], [12, 12, 'clean']), ('boundary control', [0, 0, 'upper'], [0, 0, 'clean']), ('boundary control', [2, 0, 'upper'], [1, 2, 'mixed']), ('normal control', [2, 0, 'lower'], [2, 1, 'mixed']), ('normal control', [24, 0, 'upper'], [19, 19, 'clean']), ('normal control', [23, 0, 'lower'], [19, 18, 'mixed'])], [('regression: phase frame rebasing', [4, 3, 'lower'], [3, 3, 'clean']), ('regression variant: phase frame rebasing', [26, 3, 'upper'], [20, 21, 'mixed']), ('partial repair probe: phase frame rebasing', [10, 2, 'upper'], [8, 8, 'clean']), ('partial repair variant: phase frame rebasing', [17, 1, 'upper'], [13, 14, 'mixed']), ('boundary control', [2, 0, 'upper'], [1, 2, 'mixed']), ('boundary control', [2, 0, 'lower'], [2, 1, 'mixed']), ('normal control', [1, 0, 'upper'], [1, 1, 'clean']), ('normal control', [-4, 0, 'upper'], None), ('normal control', [-5, 0, 'lower'], None)], [('regression: phase frame rebasing', [16, 3, 'upper'], [12, 13, 'mixed']), ('regression variant: phase frame rebasing', [20, 2, 'upper'], [16, 16, 'clean']), ('partial repair probe: phase frame rebasing', [30, 3, 'lower'], [24, 24, 'clean']), ('partial repair variant: phase frame rebasing', [28, 2, 'lower'], [23, 22, 'mixed']), ('boundary control', [2, 0, 'lower'], [2, 1, 'mixed']), ('boundary control', [0, 0, 'upper'], [0, 0, 'clean']), ('normal control', [4, 0, 'upper'], [3, 3, 'clean']), ('normal control', [6, 0, 'upper'], [5, 5, 'clean']), ('normal control', [25, 0, 'lower'], [20, 20, 'clean'])], [('regression: phase frame rebasing', [10, 2, 'upper'], [8, 8, 'clean']), ('regression variant: phase frame rebasing', [29, 1, 'lower'], [23, 23, 'clean']), ('partial repair probe: phase frame rebasing', [12, 3, 'lower'], [10, 9, 'mixed']), ('partial repair variant: phase frame rebasing', [28, 1, 'upper'], [22, 22, 'clean']), ('boundary control', [0, 0, 'upper'], [0, 0, 'clean']), ('boundary control', [2, 0, 'upper'], [1, 2, 'mixed']), ('normal control', [-5, 3, 'lower'], None), ('normal control', [28, 0, 'upper'], [22, 23, 'mixed']), ('normal control', [8, 0, 'upper'], [6, 7, 'mixed'])], [('regression: phase frame rebasing', [30, 3, 'lower'], [24, 24, 'clean']), ('regression variant: phase frame rebasing', [15, 1, 'upper'], [12, 12, 'clean']), ('partial repair probe: phase frame rebasing', [26, 3, 'upper'], [20, 21, 'mixed']), ('partial repair variant: phase frame rebasing', [12, 1, 'upper'], [9, 10, 'mixed']), ('boundary control', [2, 0, 'upper'], [1, 2, 'mixed']), ('boundary control', [2, 0, 'lower'], [2, 1, 'mixed']), ('normal control', [-2, 1, 'upper'], None), ('normal control', [19, 0, 'lower'], [15, 15, 'clean']), ('normal control', [22, 0, 'upper'], [17, 18, 'mixed'])]]
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(v, phase, order):
    if v<0:
        return None
    base=[0,2,5,7][phase]
    def film(f):
        g,w=divmod(f+base,10)
        return 4*g+[0,0,1,1,1,2,2,3,3,3][w]-base
    top,bottom=film(2*v),film(2*v+1)
    if order=='lower':
        top,bottom=bottom,top
    return [top,bottom,'clean' if top==bottom else 'mixed']
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: phase frame rebasing', [0, 1, 'upper'], [0, 0, 'clean']), ('regression variant: phase frame rebasing', [12, 3, 'lower'], [10, 9, 'mixed']), ('partial repair probe: phase frame rebasing', [16, 3, 'upper'], [12, 13, 'mixed']), ('partial repair variant: phase frame rebasing', [15, 1, 'upper'], [12, 12, 'clean']), ('boundary control', [0, 0, 'upper'], [0, 0, 'clean']), ('boundary control', [2, 0, 'upper'], [1, 2, 'mixed']), ('normal control', [2, 0, 'lower'], [2, 1, 'mixed']), ('normal control', [24, 0, 'upper'], [19, 19, 'clean']), ('normal control', [23, 0, 'lower'], [19, 18, 'mixed'])], [('regression: phase frame rebasing', [4, 3, 'lower'], [3, 3, 'clean']), ('regression variant: phase frame rebasing', [26, 3, 'upper'], [20, 21, 'mixed']), ('partial repair probe: phase frame rebasing', [10, 2, 'upper'], [8, 8, 'clean']), ('partial repair variant: phase frame rebasing', [17, 1, 'upper'], [13, 14, 'mixed']), ('boundary control', [2, 0, 'upper'], [1, 2, 'mixed']), ('boundary control', [2, 0, 'lower'], [2, 1, 'mixed']), ('normal control', [1, 0, 'upper'], [1, 1, 'clean']), ('normal control', [-4, 0, 'upper'], None), ('normal control', [-5, 0, 'lower'], None)], [('regression: phase frame rebasing', [16, 3, 'upper'], [12, 13, 'mixed']), ('regression variant: phase frame rebasing', [20, 2, 'upper'], [16, 16, 'clean']), ('partial repair probe: phase frame rebasing', [30, 3, 'lower'], [24, 24, 'clean']), ('partial repair variant: phase frame rebasing', [28, 2, 'lower'], [23, 22, 'mixed']), ('boundary control', [2, 0, 'lower'], [2, 1, 'mixed']), ('boundary control', [0, 0, 'upper'], [0, 0, 'clean']), ('normal control', [4, 0, 'upper'], [3, 3, 'clean']), ('normal control', [6, 0, 'upper'], [5, 5, 'clean']), ('normal control', [25, 0, 'lower'], [20, 20, 'clean'])], [('regression: phase frame rebasing', [10, 2, 'upper'], [8, 8, 'clean']), ('regression variant: phase frame rebasing', [29, 1, 'lower'], [23, 23, 'clean']), ('partial repair probe: phase frame rebasing', [12, 3, 'lower'], [10, 9, 'mixed']), ('partial repair variant: phase frame rebasing', [28, 1, 'upper'], [22, 22, 'clean']), ('boundary control', [0, 0, 'upper'], [0, 0, 'clean']), ('boundary control', [2, 0, 'upper'], [1, 2, 'mixed']), ('normal control', [-5, 3, 'lower'], None), ('normal control', [28, 0, 'upper'], [22, 23, 'mixed']), ('normal control', [8, 0, 'upper'], [6, 7, 'mixed'])], [('regression: phase frame rebasing', [30, 3, 'lower'], [24, 24, 'clean']), ('regression variant: phase frame rebasing', [15, 1, 'upper'], [12, 12, 'clean']), ('partial repair probe: phase frame rebasing', [26, 3, 'upper'], [20, 21, 'mixed']), ('partial repair variant: phase frame rebasing', [12, 1, 'upper'], [9, 10, 'mixed']), ('boundary control', [2, 0, 'upper'], [1, 2, 'mixed']), ('boundary control', [2, 0, 'lower'], [2, 1, 'mixed']), ('normal control', [-2, 1, 'upper'], None), ('normal control', [19, 0, 'lower'], [15, 15, 'clean']), ('normal control', [22, 0, 'upper'], [17, 18, 'mixed'])]]
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:
Film frame numbers are too high by the cadence phase.

Fields carry film frames in A2 B3 C2 D3 cadence; film frame 0 has cadence position phase and starts at field 0. Video frame v consists of fields 2v and 2v+1. For order "upper" field 2v is the top field; for "lower" field 2v is the bottom field. Return [film frame in top field, film frame in bottom field, "clean" or "mixed"]; a negative v returns None.

split: open-access


meaning: Fixture-count band, not measured model difficulty

deps: stdlib

prompt:
An hour of 29.97 labels maps to exactly one hour of wall clock, 3.6 seconds short.

Rates "23.976", "29.97", "59.94" run at nominal*1000/1001 frames per second while labels count nominal frames per second (non-drop). mode "to_ms": label to elapsed milliseconds, rounded half up. mode "to_tc": milliseconds to the nearest frame (half up), formatted as a non-drop label wrapping at 24 hours.

split: open-access


prompt:
Elapsed times are a millisecond early for many frames.

Rates "23.976", "29.97", "59.94" run at nominal*1000/1001 frames per second while labels count nominal frames per second (non-drop). mode "to_ms": label to elapsed milliseconds, rounded half up. mode "to_tc": milliseconds to the nearest frame (half up), formatted as a non-drop label wrapping at 24 hours.

split: open-access


prompt:
Wall-clock times just before a frame boundary snap to the previous frame.

Rates "23.976", "29.97", "59.94" run at nominal*1000/1001 frames per second while labels count nominal frames per second (non-drop). mode "to_ms": label to elapsed milliseconds, rounded half up. mode "to_tc": milliseconds to the nearest frame (half up), formatted as a non-drop label wrapping at 24 hours.

split: open-access


prompt:
Wall-clock conversions run fast by 0.2 percent at pulled-down rates.

Rates "23.976", "29.97", "59.94" run at nominal*1000/1001 frames per second while labels count nominal frames per second (non-drop). mode "to_ms": label to elapsed milliseconds, rounded half up. mode "to_tc": milliseconds to the nearest frame (half up), formatted as a non-drop label wrapping at 24 hours.

split: open-access


prompt:
Labels past the first hour show minute fields above 59.

Rates "23.976", "29.97", "59.94" run at nominal*1000/1001 frames per second while labels count nominal frames per second (non-drop). mode "to_ms": label to elapsed milliseconds, rounded half up. mode "to_tc": milliseconds to the nearest frame (half up), formatted as a non-drop label wrapping at 24 hours.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import re
N = 1
observations = []
def solve(tc, color):
    h,m,s,f=map(int,re.split('[:;]',tc))
    drop=';' in tc
    def bcd(v,flags):
        return (v//10)<<3|v%10|flags
    b0=bcd(f,(0x40 if drop else 0)|(0x80 if color else 0))
    b1=bcd(s,0)
    b2=bcd(m,0)
    b3=bcd(h,0)
    return [b0,b1,b2,b3]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: tens digit position', ['23:59:59;29', True], [233, 89, 89, 35]), ('regression variant: tens digit position', ['01:59:10:24', True], [164, 16, 89, 1]), ('partial repair probe: tens digit position', ['01:02:03;04', False], [68, 3, 2, 1]), ('partial repair variant: tens digit position', ['10:59:10;24', True], [228, 16, 89, 16]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('normal control', ['00:00:00;00', False], [64, 0, 0, 0]), ('normal control', ['00:00:00;00', True], [192, 0, 0, 0]), ('normal control', ['00:00:00:00', True], [128, 0, 0, 0])], [('regression: tens digit position', ['10:10:10:10', False], [16, 16, 16, 16]), ('regression variant: tens digit position', ['00:07:09:29', True], [169, 9, 7, 0]), ('partial repair probe: tens digit position', ['01:07:10:29', True], [169, 16, 7, 1]), ('partial repair variant: tens digit position', ['19:07:45:24', True], [164, 69, 7, 25]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('normal control', ['00:00:00;00', True], [192, 0, 0, 0]), ('normal control', ['00:00:00:00', True], [128, 0, 0, 0]), ('normal control', ['00:00:00;00', False], [64, 0, 0, 0])], [('regression: tens digit position', ['01:07:10:29', True], [169, 16, 7, 1]), ('regression variant: tens digit position', ['10:00:10;19', True], [217, 16, 0, 16]), ('partial repair probe: tens digit position', ['10:10:09;24', False], [100, 9, 16, 16]), ('partial repair variant: tens digit position', ['01:00:59;19', True], [217, 89, 0, 1]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('normal control', ['00:00:00:00', True], [128, 0, 0, 0]), ('normal control', ['00:00:00;00', False], [64, 0, 0, 0]), ('normal control', ['00:00:00;00', True], [192, 0, 0, 0])], [('regression: tens digit position', ['10:10:09;24', False], [100, 9, 16, 16]), ('regression variant: tens digit position', ['10:59:10;24', True], [228, 16, 89, 16]), ('partial repair probe: tens digit position', ['19:00:09;19', True], [217, 9, 0, 25]), ('partial repair variant: tens digit position', ['10:07:59:01', False], [1, 89, 7, 16]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('normal control', ['00:00:00;00', False], [64, 0, 0, 0]), ('normal control', ['00:00:00:00', True], [128, 0, 0, 0]), ('normal control', ['00:00:00;00', True], [192, 0, 0, 0])], [('regression: tens digit position', ['19:00:09;19', True], [217, 9, 0, 25]), ('regression variant: tens digit position', ['19:07:45:24', True], [164, 69, 7, 25]), ('partial repair probe: tens digit position', ['01:59:10:24', True], [164, 16, 89, 1]), ('partial repair variant: tens digit position', ['23:59:59;01', True], [193, 89, 89, 35]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('normal control', ['00:00:00;00', False], [64, 0, 0, 0]), ('normal control', ['00:00:00;00', True], [192, 0, 0, 0]), ('normal control', ['00:00:00:00', True], [128, 0, 0, 0])]]
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(tc, color):
    h,m,s,f=map(int,re.split('[:;]',tc))
    drop=';' in tc
    def bcd(v,flags):
        return (v%10)<<4|v//10|flags
    b0=bcd(f,(0x40 if drop else 0)|(0x80 if color else 0))
    b1=bcd(s,0)
    b2=bcd(m,0)
    b3=bcd(h,0)
    return [b0,b1,b2,b3]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: tens digit position', ['23:59:59;29', True], [233, 89, 89, 35]), ('regression variant: tens digit position', ['01:59:10:24', True], [164, 16, 89, 1]), ('partial repair probe: tens digit position', ['01:02:03;04', False], [68, 3, 2, 1]), ('partial repair variant: tens digit position', ['10:59:10;24', True], [228, 16, 89, 16]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('normal control', ['00:00:00;00', False], [64, 0, 0, 0]), ('normal control', ['00:00:00;00', True], [192, 0, 0, 0]), ('normal control', ['00:00:00:00', True], [128, 0, 0, 0])], [('regression: tens digit position', ['10:10:10:10', False], [16, 16, 16, 16]), ('regression variant: tens digit position', ['00:07:09:29', True], [169, 9, 7, 0]), ('partial repair probe: tens digit position', ['01:07:10:29', True], [169, 16, 7, 1]), ('partial repair variant: tens digit position', ['19:07:45:24', True], [164, 69, 7, 25]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('normal control', ['00:00:00;00', True], [192, 0, 0, 0]), ('normal control', ['00:00:00:00', True], [128, 0, 0, 0]), ('normal control', ['00:00:00;00', False], [64, 0, 0, 0])], [('regression: tens digit position', ['01:07:10:29', True], [169, 16, 7, 1]), ('regression variant: tens digit position', ['10:00:10;19', True], [217, 16, 0, 16]), ('partial repair probe: tens digit position', ['10:10:09;24', False], [100, 9, 16, 16]), ('partial repair variant: tens digit position', ['01:00:59;19', True], [217, 89, 0, 1]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('normal control', ['00:00:00:00', True], [128, 0, 0, 0]), ('normal control', ['00:00:00;00', False], [64, 0, 0, 0]), ('normal control', ['00:00:00;00', True], [192, 0, 0, 0])], [('regression: tens digit position', ['10:10:09;24', False], [100, 9, 16, 16]), ('regression variant: tens digit position', ['10:59:10;24', True], [228, 16, 89, 16]), ('partial repair probe: tens digit position', ['19:00:09;19', True], [217, 9, 0, 25]), ('partial repair variant: tens digit position', ['10:07:59:01', False], [1, 89, 7, 16]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('normal control', ['00:00:00;00', False], [64, 0, 0, 0]), ('normal control', ['00:00:00:00', True], [128, 0, 0, 0]), ('normal control', ['00:00:00;00', True], [192, 0, 0, 0])], [('regression: tens digit position', ['19:00:09;19', True], [217, 9, 0, 25]), ('regression variant: tens digit position', ['19:07:45:24', True], [164, 69, 7, 25]), ('partial repair probe: tens digit position', ['01:59:10:24', True], [164, 16, 89, 1]), ('partial repair variant: tens digit position', ['23:59:59;01', True], [193, 89, 89, 35]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('normal control', ['00:00:00;00', False], [64, 0, 0, 0]), ('normal control', ['00:00:00;00', True], [192, 0, 0, 0]), ('normal control', ['00:00:00:00', True], [128, 0, 0, 0])]]
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:
Decoders read 10:00:00:00 as a scrambled time.

Pack HH:MM:SS:FF into four bytes [frames, seconds, minutes, hours] in transmission order. Each byte holds units in bits 0-3 and tens from bit 4 upward. The frames byte carries the drop-frame flag (bit 6, set when the last separator is ";") and the color-frame flag (bit 7).

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import re
N = 1
observations = []
def solve(tc, color):
    h,m,s,f=map(int,re.split('[:;]',tc))
    drop=';' in tc
    def bcd(v,flags):
        return (v//10)<<4|v%10|flags
    b0=bcd(f,(0x04 if drop else 0)|(0x80 if color else 0))
    b1=bcd(s,0)
    b2=bcd(m,0)
    b3=bcd(h,0)
    return [b0,b1,b2,b3]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: drop-frame flag bit', ['23:59:59;29', True], [233, 89, 89, 35]), ('regression variant: drop-frame flag bit', ['10:00:10;19', True], [217, 16, 0, 16]), ('partial repair probe: drop-frame flag bit', ['10:10:09;24', False], [100, 9, 16, 16]), ('partial repair variant: drop-frame flag bit', ['10:00:10;09', False], [73, 16, 0, 16]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('boundary control', ['10:10:10:10', False], [16, 16, 16, 16]), ('normal control', ['01:07:10:29', True], [169, 16, 7, 1]), ('normal control', ['00:00:00:00', True], [128, 0, 0, 0]), ('normal control', ['00:07:09:29', True], [169, 9, 7, 0])], [('regression: drop-frame flag bit', ['01:02:03;04', False], [68, 3, 2, 1]), ('regression variant: drop-frame flag bit', ['10:59:10;24', True], [228, 16, 89, 16]), ('partial repair probe: drop-frame flag bit', ['00:00:00;00', False], [64, 0, 0, 0]), ('partial repair variant: drop-frame flag bit', ['01:07:00;19', False], [89, 0, 7, 1]), ('boundary control', ['10:10:10:10', False], [16, 16, 16, 16]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('normal control', ['10:07:59:01', False], [1, 89, 7, 16]), ('normal control', ['23:10:09:01', False], [1, 9, 16, 35]), ('normal control', ['01:10:00:24', False], [36, 0, 16, 1])], [('regression: drop-frame flag bit', ['10:10:09;24', False], [100, 9, 16, 16]), ('regression variant: drop-frame flag bit', ['01:00:59;19', True], [217, 89, 0, 1]), ('partial repair probe: drop-frame flag bit', ['19:00:09;19', True], [217, 9, 0, 25]), ('partial repair variant: drop-frame flag bit', ['19:07:09;19', True], [217, 9, 7, 25]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('boundary control', ['10:10:10:10', False], [16, 16, 16, 16]), ('normal control', ['23:07:10:00', True], [128, 16, 7, 35]), ('normal control', ['00:00:09:24', True], [164, 9, 0, 0]), ('normal control', ['23:10:45:09', False], [9, 69, 16, 35])], [('regression: drop-frame flag bit', ['00:00:00;00', False], [64, 0, 0, 0]), ('regression variant: drop-frame flag bit', ['23:59:59;01', True], [193, 89, 89, 35]), ('partial repair probe: drop-frame flag bit', ['10:00:10;19', True], [217, 16, 0, 16]), ('partial repair variant: drop-frame flag bit', ['23:07:00;00', False], [64, 0, 7, 35]), ('boundary control', ['10:10:10:10', False], [16, 16, 16, 16]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('normal control', ['23:10:00:29', False], [41, 0, 16, 35]), ('normal control', ['19:59:09:00', True], [128, 9, 89, 25]), ('normal control', ['19:59:45:29', True], [169, 69, 89, 25])], [('regression: drop-frame flag bit', ['19:00:09;19', True], [217, 9, 0, 25]), ('regression variant: drop-frame flag bit', ['10:00:10;09', False], [73, 16, 0, 16]), ('partial repair probe: drop-frame flag bit', ['10:59:10;24', True], [228, 16, 89, 16]), ('partial repair variant: drop-frame flag bit', ['10:10:00;29', False], [105, 0, 16, 16]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('boundary control', ['10:10:10:10', False], [16, 16, 16, 16]), ('normal control', ['10:00:59:29', False], [41, 89, 0, 16]), ('normal control', ['19:00:09:29', False], [41, 9, 0, 25]), ('normal control', ['01:59:10:01', True], [129, 16, 89, 1])]]
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(tc, color):
    h,m,s,f=map(int,re.split('[:;]',tc))
    drop=';' in tc
    def bcd(v,flags):
        return (v//10)<<4|v%10|flags
    b0=bcd(f,(0x20 if drop else 0)|(0x80 if color else 0))
    b1=bcd(s,0)
    b2=bcd(m,0)
    b3=bcd(h,0)
    return [b0,b1,b2,b3]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: drop-frame flag bit', ['23:59:59;29', True], [233, 89, 89, 35]), ('regression variant: drop-frame flag bit', ['10:00:10;19', True], [217, 16, 0, 16]), ('partial repair probe: drop-frame flag bit', ['10:10:09;24', False], [100, 9, 16, 16]), ('partial repair variant: drop-frame flag bit', ['10:00:10;09', False], [73, 16, 0, 16]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('boundary control', ['10:10:10:10', False], [16, 16, 16, 16]), ('normal control', ['01:07:10:29', True], [169, 16, 7, 1]), ('normal control', ['00:00:00:00', True], [128, 0, 0, 0]), ('normal control', ['00:07:09:29', True], [169, 9, 7, 0])], [('regression: drop-frame flag bit', ['01:02:03;04', False], [68, 3, 2, 1]), ('regression variant: drop-frame flag bit', ['10:59:10;24', True], [228, 16, 89, 16]), ('partial repair probe: drop-frame flag bit', ['00:00:00;00', False], [64, 0, 0, 0]), ('partial repair variant: drop-frame flag bit', ['01:07:00;19', False], [89, 0, 7, 1]), ('boundary control', ['10:10:10:10', False], [16, 16, 16, 16]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('normal control', ['10:07:59:01', False], [1, 89, 7, 16]), ('normal control', ['23:10:09:01', False], [1, 9, 16, 35]), ('normal control', ['01:10:00:24', False], [36, 0, 16, 1])], [('regression: drop-frame flag bit', ['10:10:09;24', False], [100, 9, 16, 16]), ('regression variant: drop-frame flag bit', ['01:00:59;19', True], [217, 89, 0, 1]), ('partial repair probe: drop-frame flag bit', ['19:00:09;19', True], [217, 9, 0, 25]), ('partial repair variant: drop-frame flag bit', ['19:07:09;19', True], [217, 9, 7, 25]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('boundary control', ['10:10:10:10', False], [16, 16, 16, 16]), ('normal control', ['23:07:10:00', True], [128, 16, 7, 35]), ('normal control', ['00:00:09:24', True], [164, 9, 0, 0]), ('normal control', ['23:10:45:09', False], [9, 69, 16, 35])], [('regression: drop-frame flag bit', ['00:00:00;00', False], [64, 0, 0, 0]), ('regression variant: drop-frame flag bit', ['23:59:59;01', True], [193, 89, 89, 35]), ('partial repair probe: drop-frame flag bit', ['10:00:10;19', True], [217, 16, 0, 16]), ('partial repair variant: drop-frame flag bit', ['23:07:00;00', False], [64, 0, 7, 35]), ('boundary control', ['10:10:10:10', False], [16, 16, 16, 16]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('normal control', ['23:10:00:29', False], [41, 0, 16, 35]), ('normal control', ['19:59:09:00', True], [128, 9, 89, 25]), ('normal control', ['19:59:45:29', True], [169, 69, 89, 25])], [('regression: drop-frame flag bit', ['19:00:09;19', True], [217, 9, 0, 25]), ('regression variant: drop-frame flag bit', ['10:00:10;09', False], [73, 16, 0, 16]), ('partial repair probe: drop-frame flag bit', ['10:59:10;24', True], [228, 16, 89, 16]), ('partial repair variant: drop-frame flag bit', ['10:10:00;29', False], [105, 0, 16, 16]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('boundary control', ['10:10:10:10', False], [16, 16, 16, 16]), ('normal control', ['10:00:59:29', False], [41, 89, 0, 16]), ('normal control', ['19:00:09:29', False], [41, 9, 0, 25]), ('normal control', ['01:59:10:01', True], [129, 16, 89, 1])]]
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:
Drop-frame timecode corrupts the frame units digit.

Pack HH:MM:SS:FF into four bytes [frames, seconds, minutes, hours] in transmission order. Each byte holds units in bits 0-3 and tens from bit 4 upward. The frames byte carries the drop-frame flag (bit 6, set when the last separator is ";") and the color-frame flag (bit 7).

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import re
N = 1
observations = []
def solve(tc, color):
    h,m,s,f=map(int,re.split('[:;]',tc))
    drop=';' in tc
    def bcd(v,flags):
        return (v//10)<<4|v%10|flags
    b0=bcd(f,(0x40 if drop else 0)|(0x40 if color else 0))
    b1=bcd(s,0)
    b2=bcd(m,0)
    b3=bcd(h,0)
    return [b0,b1,b2,b3]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: color flag bit', ['23:59:59;29', True], [233, 89, 89, 35]), ('regression variant: color flag bit', ['00:07:09:29', True], [169, 9, 7, 0]), ('partial repair probe: color flag bit', ['01:59:10:24', True], [164, 16, 89, 1]), ('partial repair variant: color flag bit', ['00:10:09:00', True], [128, 9, 16, 0]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('boundary control', ['10:10:10:10', False], [16, 16, 16, 16]), ('normal control', ['01:02:03;04', False], [68, 3, 2, 1]), ('normal control', ['10:10:09;24', False], [100, 9, 16, 16]), ('normal control', ['10:07:59:01', False], [1, 89, 7, 16])], [('regression: color flag bit', ['01:07:10:29', True], [169, 16, 7, 1]), ('regression variant: color flag bit', ['10:00:10;19', True], [217, 16, 0, 16]), ('partial repair probe: color flag bit', ['00:07:09:29', True], [169, 9, 7, 0]), ('partial repair variant: color flag bit', ['00:00:09:24', True], [164, 9, 0, 0]), ('boundary control', ['10:10:10:10', False], [16, 16, 16, 16]), ('boundary control', ['01:02:03;04', False], [68, 3, 2, 1]), ('normal control', ['10:00:10;09', False], [73, 16, 0, 16]), ('normal control', ['10:10:00;29', False], [105, 0, 16, 16]), ('normal control', ['10:10:00;19', False], [89, 0, 16, 16])], [('regression: color flag bit', ['00:00:00:00', True], [128, 0, 0, 0]), ('regression variant: color flag bit', ['10:59:10;24', True], [228, 16, 89, 16]), ('partial repair probe: color flag bit', ['19:07:45:24', True], [164, 69, 7, 25]), ('partial repair variant: color flag bit', ['01:59:59:10', True], [144, 89, 89, 1]), ('boundary control', ['01:02:03;04', False], [68, 3, 2, 1]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('normal control', ['23:10:09:01', False], [1, 9, 16, 35]), ('normal control', ['00:07:59;01', False], [65, 89, 7, 0]), ('normal control', ['01:00:10;19', False], [89, 16, 0, 1])], [('regression: color flag bit', ['19:00:09;19', True], [217, 9, 0, 25]), ('regression variant: color flag bit', ['19:07:45:24', True], [164, 69, 7, 25]), ('partial repair probe: color flag bit', ['01:00:09:10', True], [144, 9, 0, 1]), ('partial repair variant: color flag bit', ['00:00:09:01', True], [129, 9, 0, 0]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('boundary control', ['10:10:10:10', False], [16, 16, 16, 16]), ('normal control', ['23:10:45:09', False], [9, 69, 16, 35]), ('normal control', ['10:10:10;24', False], [100, 16, 16, 16]), ('normal control', ['00:07:00;00', False], [64, 0, 7, 0])], [('regression: color flag bit', ['01:59:10:24', True], [164, 16, 89, 1]), ('regression variant: color flag bit', ['01:00:59;19', True], [217, 89, 0, 1]), ('partial repair probe: color flag bit', ['19:10:10:24', True], [164, 16, 16, 25]), ('partial repair variant: color flag bit', ['19:59:09:00', True], [128, 9, 89, 25]), ('boundary control', ['10:10:10:10', False], [16, 16, 16, 16]), ('boundary control', ['01:02:03;04', False], [68, 3, 2, 1]), ('normal control', ['19:59:45;09', False], [73, 69, 89, 25]), ('normal control', ['01:59:59;24', False], [100, 89, 89, 1]), ('normal control', ['10:10:10;19', False], [89, 16, 16, 16])]]
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(tc, color):
    h,m,s,f=map(int,re.split('[:;]',tc))
    drop=';' in tc
    def bcd(v,flags):
        return (v//10)<<4|v%10|flags
    b0=bcd(f,(0x40 if drop else 0)|(0x80 if color and drop else 0))
    b1=bcd(s,0)
    b2=bcd(m,0)
    b3=bcd(h,0)
    return [b0,b1,b2,b3]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: color flag bit', ['23:59:59;29', True], [233, 89, 89, 35]), ('regression variant: color flag bit', ['00:07:09:29', True], [169, 9, 7, 0]), ('partial repair probe: color flag bit', ['01:59:10:24', True], [164, 16, 89, 1]), ('partial repair variant: color flag bit', ['00:10:09:00', True], [128, 9, 16, 0]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('boundary control', ['10:10:10:10', False], [16, 16, 16, 16]), ('normal control', ['01:02:03;04', False], [68, 3, 2, 1]), ('normal control', ['10:10:09;24', False], [100, 9, 16, 16]), ('normal control', ['10:07:59:01', False], [1, 89, 7, 16])], [('regression: color flag bit', ['01:07:10:29', True], [169, 16, 7, 1]), ('regression variant: color flag bit', ['10:00:10;19', True], [217, 16, 0, 16]), ('partial repair probe: color flag bit', ['00:07:09:29', True], [169, 9, 7, 0]), ('partial repair variant: color flag bit', ['00:00:09:24', True], [164, 9, 0, 0]), ('boundary control', ['10:10:10:10', False], [16, 16, 16, 16]), ('boundary control', ['01:02:03;04', False], [68, 3, 2, 1]), ('normal control', ['10:00:10;09', False], [73, 16, 0, 16]), ('normal control', ['10:10:00;29', False], [105, 0, 16, 16]), ('normal control', ['10:10:00;19', False], [89, 0, 16, 16])], [('regression: color flag bit', ['00:00:00:00', True], [128, 0, 0, 0]), ('regression variant: color flag bit', ['10:59:10;24', True], [228, 16, 89, 16]), ('partial repair probe: color flag bit', ['19:07:45:24', True], [164, 69, 7, 25]), ('partial repair variant: color flag bit', ['01:59:59:10', True], [144, 89, 89, 1]), ('boundary control', ['01:02:03;04', False], [68, 3, 2, 1]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('normal control', ['23:10:09:01', False], [1, 9, 16, 35]), ('normal control', ['00:07:59;01', False], [65, 89, 7, 0]), ('normal control', ['01:00:10;19', False], [89, 16, 0, 1])], [('regression: color flag bit', ['19:00:09;19', True], [217, 9, 0, 25]), ('regression variant: color flag bit', ['19:07:45:24', True], [164, 69, 7, 25]), ('partial repair probe: color flag bit', ['01:00:09:10', True], [144, 9, 0, 1]), ('partial repair variant: color flag bit', ['00:00:09:01', True], [129, 9, 0, 0]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('boundary control', ['10:10:10:10', False], [16, 16, 16, 16]), ('normal control', ['23:10:45:09', False], [9, 69, 16, 35]), ('normal control', ['10:10:10;24', False], [100, 16, 16, 16]), ('normal control', ['00:07:00;00', False], [64, 0, 7, 0])], [('regression: color flag bit', ['01:59:10:24', True], [164, 16, 89, 1]), ('regression variant: color flag bit', ['01:00:59;19', True], [217, 89, 0, 1]), ('partial repair probe: color flag bit', ['19:10:10:24', True], [164, 16, 16, 25]), ('partial repair variant: color flag bit', ['19:59:09:00', True], [128, 9, 89, 25]), ('boundary control', ['10:10:10:10', False], [16, 16, 16, 16]), ('boundary control', ['01:02:03;04', False], [68, 3, 2, 1]), ('normal control', ['19:59:45;09', False], [73, 69, 89, 25]), ('normal control', ['01:59:59;24', False], [100, 89, 89, 1]), ('normal control', ['10:10:10;19', False], [89, 16, 16, 16])]]
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:
Color-framed non-drop timecode is announced as drop frame.

Pack HH:MM:SS:FF into four bytes [frames, seconds, minutes, hours] in transmission order. Each byte holds units in bits 0-3 and tens from bit 4 upward. The frames byte carries the drop-frame flag (bit 6, set when the last separator is ";") and the color-frame flag (bit 7).

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import re
N = 1
observations = []
def solve(tc, color):
    h,m,s,f=map(int,re.split('[:;]',tc))
    drop=False
    def bcd(v,flags):
        return (v//10)<<4|v%10|flags
    b0=bcd(f,(0x40 if drop else 0)|(0x80 if color else 0))
    b1=bcd(s,0)
    b2=bcd(m,0)
    b3=bcd(h,0)
    return [b0,b1,b2,b3]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: drop detection', ['23:59:59;29', True], [233, 89, 89, 35]), ('regression variant: drop detection', ['10:00:10;19', True], [217, 16, 0, 16]), ('partial repair probe: drop detection', ['10:10:09;24', False], [100, 9, 16, 16]), ('partial repair variant: drop detection', ['10:00:10;09', False], [73, 16, 0, 16]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('boundary control', ['10:10:10:10', False], [16, 16, 16, 16]), ('normal control', ['01:07:10:29', True], [169, 16, 7, 1]), ('normal control', ['00:00:00:00', True], [128, 0, 0, 0]), ('normal control', ['00:07:09:29', True], [169, 9, 7, 0])], [('regression: drop detection', ['01:02:03;04', False], [68, 3, 2, 1]), ('regression variant: drop detection', ['10:59:10;24', True], [228, 16, 89, 16]), ('partial repair probe: drop detection', ['00:00:00;00', False], [64, 0, 0, 0]), ('partial repair variant: drop detection', ['01:07:00;19', False], [89, 0, 7, 1]), ('boundary control', ['10:10:10:10', False], [16, 16, 16, 16]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('normal control', ['10:07:59:01', False], [1, 89, 7, 16]), ('normal control', ['23:10:09:01', False], [1, 9, 16, 35]), ('normal control', ['01:10:00:24', False], [36, 0, 16, 1])], [('regression: drop detection', ['10:10:09;24', False], [100, 9, 16, 16]), ('regression variant: drop detection', ['01:00:59;19', True], [217, 89, 0, 1]), ('partial repair probe: drop detection', ['19:00:09;19', True], [217, 9, 0, 25]), ('partial repair variant: drop detection', ['19:07:09;19', True], [217, 9, 7, 25]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('boundary control', ['10:10:10:10', False], [16, 16, 16, 16]), ('normal control', ['23:07:10:00', True], [128, 16, 7, 35]), ('normal control', ['00:00:09:24', True], [164, 9, 0, 0]), ('normal control', ['23:10:45:09', False], [9, 69, 16, 35])], [('regression: drop detection', ['00:00:00;00', False], [64, 0, 0, 0]), ('regression variant: drop detection', ['23:59:59;01', True], [193, 89, 89, 35]), ('partial repair probe: drop detection', ['10:00:10;19', True], [217, 16, 0, 16]), ('partial repair variant: drop detection', ['23:07:00;00', False], [64, 0, 7, 35]), ('boundary control', ['10:10:10:10', False], [16, 16, 16, 16]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('normal control', ['23:10:00:29', False], [41, 0, 16, 35]), ('normal control', ['19:59:09:00', True], [128, 9, 89, 25]), ('normal control', ['19:59:45:29', True], [169, 69, 89, 25])], [('regression: drop detection', ['19:00:09;19', True], [217, 9, 0, 25]), ('regression variant: drop detection', ['10:00:10;09', False], [73, 16, 0, 16]), ('partial repair probe: drop detection', ['10:59:10;24', True], [228, 16, 89, 16]), ('partial repair variant: drop detection', ['10:10:00;29', False], [105, 0, 16, 16]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('boundary control', ['10:10:10:10', False], [16, 16, 16, 16]), ('normal control', ['10:00:59:29', False], [41, 89, 0, 16]), ('normal control', ['19:00:09:29', False], [41, 9, 0, 25]), ('normal control', ['01:59:10:01', True], [129, 16, 89, 1])]]
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(tc, color):
    h,m,s,f=map(int,re.split('[:;]',tc))
    drop=tc[2]==';'
    def bcd(v,flags):
        return (v//10)<<4|v%10|flags
    b0=bcd(f,(0x40 if drop else 0)|(0x80 if color else 0))
    b1=bcd(s,0)
    b2=bcd(m,0)
    b3=bcd(h,0)
    return [b0,b1,b2,b3]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: drop detection', ['23:59:59;29', True], [233, 89, 89, 35]), ('regression variant: drop detection', ['10:00:10;19', True], [217, 16, 0, 16]), ('partial repair probe: drop detection', ['10:10:09;24', False], [100, 9, 16, 16]), ('partial repair variant: drop detection', ['10:00:10;09', False], [73, 16, 0, 16]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('boundary control', ['10:10:10:10', False], [16, 16, 16, 16]), ('normal control', ['01:07:10:29', True], [169, 16, 7, 1]), ('normal control', ['00:00:00:00', True], [128, 0, 0, 0]), ('normal control', ['00:07:09:29', True], [169, 9, 7, 0])], [('regression: drop detection', ['01:02:03;04', False], [68, 3, 2, 1]), ('regression variant: drop detection', ['10:59:10;24', True], [228, 16, 89, 16]), ('partial repair probe: drop detection', ['00:00:00;00', False], [64, 0, 0, 0]), ('partial repair variant: drop detection', ['01:07:00;19', False], [89, 0, 7, 1]), ('boundary control', ['10:10:10:10', False], [16, 16, 16, 16]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('normal control', ['10:07:59:01', False], [1, 89, 7, 16]), ('normal control', ['23:10:09:01', False], [1, 9, 16, 35]), ('normal control', ['01:10:00:24', False], [36, 0, 16, 1])], [('regression: drop detection', ['10:10:09;24', False], [100, 9, 16, 16]), ('regression variant: drop detection', ['01:00:59;19', True], [217, 89, 0, 1]), ('partial repair probe: drop detection', ['19:00:09;19', True], [217, 9, 0, 25]), ('partial repair variant: drop detection', ['19:07:09;19', True], [217, 9, 7, 25]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('boundary control', ['10:10:10:10', False], [16, 16, 16, 16]), ('normal control', ['23:07:10:00', True], [128, 16, 7, 35]), ('normal control', ['00:00:09:24', True], [164, 9, 0, 0]), ('normal control', ['23:10:45:09', False], [9, 69, 16, 35])], [('regression: drop detection', ['00:00:00;00', False], [64, 0, 0, 0]), ('regression variant: drop detection', ['23:59:59;01', True], [193, 89, 89, 35]), ('partial repair probe: drop detection', ['10:00:10;19', True], [217, 16, 0, 16]), ('partial repair variant: drop detection', ['23:07:00;00', False], [64, 0, 7, 35]), ('boundary control', ['10:10:10:10', False], [16, 16, 16, 16]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('normal control', ['23:10:00:29', False], [41, 0, 16, 35]), ('normal control', ['19:59:09:00', True], [128, 9, 89, 25]), ('normal control', ['19:59:45:29', True], [169, 69, 89, 25])], [('regression: drop detection', ['19:00:09;19', True], [217, 9, 0, 25]), ('regression variant: drop detection', ['10:00:10;09', False], [73, 16, 0, 16]), ('partial repair probe: drop detection', ['10:59:10;24', True], [228, 16, 89, 16]), ('partial repair variant: drop detection', ['10:10:00;29', False], [105, 0, 16, 16]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('boundary control', ['10:10:10:10', False], [16, 16, 16, 16]), ('normal control', ['10:00:59:29', False], [41, 89, 0, 16]), ('normal control', ['19:00:09:29', False], [41, 9, 0, 25]), ('normal control', ['01:59:10:01', True], [129, 16, 89, 1])]]
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:
Drop-frame labels are transmitted without the drop-frame flag.

Pack HH:MM:SS:FF into four bytes [frames, seconds, minutes, hours] in transmission order. Each byte holds units in bits 0-3 and tens from bit 4 upward. The frames byte carries the drop-frame flag (bit 6, set when the last separator is ";") and the color-frame flag (bit 7).

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import re
N = 1
observations = []
def solve(tc, color):
    h,m,s,f=map(int,re.split('[:;]',tc))
    drop=';' in tc
    def bcd(v,flags):
        return (v//10)<<4|v%10|flags
    b0=bcd(f,(0x40 if drop else 0)|(0x80 if color else 0))
    b1=bcd(s,0)
    b2=bcd(m,0)
    b3=bcd(h,0)
    return [b3,b2,b1,b0]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: transmission order', ['23:59:59;29', True], [233, 89, 89, 35]), ('regression variant: transmission order', ['00:00:00:00', True], [128, 0, 0, 0]), ('partial repair probe: transmission order', ['10:10:09;24', False], [100, 9, 16, 16]), ('partial repair variant: transmission order', ['01:00:59;19', True], [217, 89, 0, 1]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('boundary control', ['10:10:10:10', False], [16, 16, 16, 16]), ('normal control', ['00:59:59:00', False], [0, 89, 89, 0]), ('normal control', ['01:00:00:01', False], [1, 0, 0, 1]), ('normal control', ['19:10:10:19', False], [25, 16, 16, 25])], [('regression: transmission order', ['01:02:03;04', False], [68, 3, 2, 1]), ('regression variant: transmission order', ['19:00:09;19', True], [217, 9, 0, 25]), ('partial repair probe: transmission order', ['01:59:10:24', True], [164, 16, 89, 1]), ('partial repair variant: transmission order', ['10:07:59:01', False], [1, 89, 7, 16]), ('boundary control', ['10:10:10:10', False], [16, 16, 16, 16]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('normal control', ['00:59:59:00', False], [0, 89, 89, 0]), ('normal control', ['01:00:00:01', False], [1, 0, 0, 1]), ('normal control', ['19:10:10:19', False], [25, 16, 16, 25])], [('regression: transmission order', ['01:07:10:29', True], [169, 16, 7, 1]), ('regression variant: transmission order', ['01:59:10:24', True], [164, 16, 89, 1]), ('partial repair probe: transmission order', ['00:07:09:29', True], [169, 9, 7, 0]), ('partial repair variant: transmission order', ['23:59:10:09', False], [9, 16, 89, 35]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('boundary control', ['10:10:10:10', False], [16, 16, 16, 16]), ('normal control', ['19:10:10:19', False], [25, 16, 16, 25]), ('normal control', ['00:59:59:00', False], [0, 89, 89, 0]), ('normal control', ['01:00:00:01', False], [1, 0, 0, 1])], [('regression: transmission order', ['10:10:09;24', False], [100, 9, 16, 16]), ('regression variant: transmission order', ['00:07:09:29', True], [169, 9, 7, 0]), ('partial repair probe: transmission order', ['10:00:10;19', True], [217, 16, 0, 16]), ('partial repair variant: transmission order', ['10:00:10;09', False], [73, 16, 0, 16]), ('boundary control', ['10:10:10:10', False], [16, 16, 16, 16]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('normal control', ['00:59:59:00', False], [0, 89, 89, 0]), ('normal control', ['19:10:10:19', False], [25, 16, 16, 25]), ('normal control', ['01:00:00:01', False], [1, 0, 0, 1])], [('regression: transmission order', ['00:00:00;00', False], [64, 0, 0, 0]), ('regression variant: transmission order', ['10:00:10;19', True], [217, 16, 0, 16]), ('partial repair probe: transmission order', ['10:59:10;24', True], [228, 16, 89, 16]), ('partial repair variant: transmission order', ['01:07:00;19', False], [89, 0, 7, 1]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('boundary control', ['10:10:10:10', False], [16, 16, 16, 16]), ('normal control', ['01:00:00:01', False], [1, 0, 0, 1]), ('normal control', ['00:59:59:00', False], [0, 89, 89, 0]), ('normal control', ['19:10:10:19', False], [25, 16, 16, 25])]]
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(tc, color):
    h,m,s,f=map(int,re.split('[:;]',tc))
    drop=';' in tc
    def bcd(v,flags):
        return (v//10)<<4|v%10|flags
    b0=bcd(f,(0x40 if drop else 0)|(0x80 if color else 0))
    b1=bcd(s,0)
    b2=bcd(m,0)
    b3=bcd(h,0)
    return [b0,b2,b1,b3]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: transmission order', ['23:59:59;29', True], [233, 89, 89, 35]), ('regression variant: transmission order', ['00:00:00:00', True], [128, 0, 0, 0]), ('partial repair probe: transmission order', ['10:10:09;24', False], [100, 9, 16, 16]), ('partial repair variant: transmission order', ['01:00:59;19', True], [217, 89, 0, 1]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('boundary control', ['10:10:10:10', False], [16, 16, 16, 16]), ('normal control', ['00:59:59:00', False], [0, 89, 89, 0]), ('normal control', ['01:00:00:01', False], [1, 0, 0, 1]), ('normal control', ['19:10:10:19', False], [25, 16, 16, 25])], [('regression: transmission order', ['01:02:03;04', False], [68, 3, 2, 1]), ('regression variant: transmission order', ['19:00:09;19', True], [217, 9, 0, 25]), ('partial repair probe: transmission order', ['01:59:10:24', True], [164, 16, 89, 1]), ('partial repair variant: transmission order', ['10:07:59:01', False], [1, 89, 7, 16]), ('boundary control', ['10:10:10:10', False], [16, 16, 16, 16]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('normal control', ['00:59:59:00', False], [0, 89, 89, 0]), ('normal control', ['01:00:00:01', False], [1, 0, 0, 1]), ('normal control', ['19:10:10:19', False], [25, 16, 16, 25])], [('regression: transmission order', ['01:07:10:29', True], [169, 16, 7, 1]), ('regression variant: transmission order', ['01:59:10:24', True], [164, 16, 89, 1]), ('partial repair probe: transmission order', ['00:07:09:29', True], [169, 9, 7, 0]), ('partial repair variant: transmission order', ['23:59:10:09', False], [9, 16, 89, 35]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('boundary control', ['10:10:10:10', False], [16, 16, 16, 16]), ('normal control', ['19:10:10:19', False], [25, 16, 16, 25]), ('normal control', ['00:59:59:00', False], [0, 89, 89, 0]), ('normal control', ['01:00:00:01', False], [1, 0, 0, 1])], [('regression: transmission order', ['10:10:09;24', False], [100, 9, 16, 16]), ('regression variant: transmission order', ['00:07:09:29', True], [169, 9, 7, 0]), ('partial repair probe: transmission order', ['10:00:10;19', True], [217, 16, 0, 16]), ('partial repair variant: transmission order', ['10:00:10;09', False], [73, 16, 0, 16]), ('boundary control', ['10:10:10:10', False], [16, 16, 16, 16]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('normal control', ['00:59:59:00', False], [0, 89, 89, 0]), ('normal control', ['19:10:10:19', False], [25, 16, 16, 25]), ('normal control', ['01:00:00:01', False], [1, 0, 0, 1])], [('regression: transmission order', ['00:00:00;00', False], [64, 0, 0, 0]), ('regression variant: transmission order', ['10:00:10;19', True], [217, 16, 0, 16]), ('partial repair probe: transmission order', ['10:59:10;24', True], [228, 16, 89, 16]), ('partial repair variant: transmission order', ['01:07:00;19', False], [89, 0, 7, 1]), ('boundary control', ['00:00:00:00', False], [0, 0, 0, 0]), ('boundary control', ['10:10:10:10', False], [16, 16, 16, 16]), ('normal control', ['01:00:00:01', False], [1, 0, 0, 1]), ('normal control', ['00:59:59:00', False], [0, 89, 89, 0]), ('normal control', ['19:10:10:19', False], [25, 16, 16, 25])]]
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:
Receivers decode hours as frames.

Pack HH:MM:SS:FF into four bytes [frames, seconds, minutes, hours] in transmission order. Each byte holds units in bits 0-3 and tens from bit 4 upward. The frames byte carries the drop-frame flag (bit 6, set when the last separator is ";") and the color-frame flag (bit 7).

split: open-access


prompt:
Bars before the programme start show as nearly 24 hours into the programme.

Express label tc relative to programme start as "+HH:MM:SS:FF" or "-HH:MM:SS:FF" along the shorter way round the 24-hour clock (an offset of exactly 12 hours is negative). Zero is "+".

split: open-access


prompt:
Programmes that cross midnight report offsets of almost minus a day.

Express label tc relative to programme start as "+HH:MM:SS:FF" or "-HH:MM:SS:FF" along the shorter way round the 24-hour clock (an offset of exactly 12 hours is negative). Zero is "+".

split: open-access


prompt:
The programme start itself is labelled -00:00:00:00.

Express label tc relative to programme start as "+HH:MM:SS:FF" or "-HH:MM:SS:FF" along the shorter way round the 24-hour clock (an offset of exactly 12 hours is negative). Zero is "+".

split: open-access


prompt:
Negative offsets are printed with garbled fields.

Express label tc relative to programme start as "+HH:MM:SS:FF" or "-HH:MM:SS:FF" along the shorter way round the 24-hour clock (an offset of exactly 12 hours is negative). Zero is "+".

split: open-access


prompt:
Offsets beyond an hour show minute fields above 59.

Express label tc relative to programme start as "+HH:MM:SS:FF" or "-HH:MM:SS:FF" along the shorter way round the 24-hour clock (an offset of exactly 12 hours is negative). Zero is "+".

split: open-access


prompt:
Samples in the second half of a frame are attributed to the next frame.

At 48000 samples per second and rate N/D, the frame containing sample s is floor(s*N/(48000*D)); frame k starts at sample ceil(k*48000*D/N). Return [frame, offset of s inside its frame, number of samples in that frame].

split: open-access


prompt:
In-frame offsets are one sample too large at NTSC frame starts.

At 48000 samples per second and rate N/D, the frame containing sample s is floor(s*N/(48000*D)); frame k starts at sample ceil(k*48000*D/N). Return [frame, offset of s inside its frame, number of samples in that frame].

split: open-access


prompt:
Every NTSC frame is reported as 1601 samples, breaking the five-frame cadence.

At 48000 samples per second and rate N/D, the frame containing sample s is floor(s*N/(48000*D)); frame k starts at sample ceil(k*48000*D/N). Return [frame, offset of s inside its frame, number of samples in that frame].

split: open-access


prompt:
Offsets inside NTSC frames drift across the cadence.

At 48000 samples per second and rate N/D, the frame containing sample s is floor(s*N/(48000*D)); frame k starts at sample ceil(k*48000*D/N). Return [frame, offset of s inside its frame, number of samples in that frame].

split: open-access


prompt:
Sample cadence for 29.97 video slowly slips against the true 30000/1001 rate.

At 48000 samples per second and rate N/D, the frame containing sample s is floor(s*N/(48000*D)); frame k starts at sample ceil(k*48000*D/N). Return [frame, offset of s inside its frame, number of samples in that frame].

split: open-access


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

N = 1
observations = []
def solve(s):
    t=s.strip()
    drop=t.endswith('DF') and not t.endswith('NDF')
    base=t[:-3] if t.endswith('NDF') else t[:-2] if t.endswith('DF') else t
    base=base.rstrip(' -')
    if '.' in base:
        base=base.rstrip('0').rstrip('.')
    table={'23.976':(24000,1001),'23.98':(24000,1001),'24':(24,1),'25':(25,1),'29.97':(30000,1001),'30':(30,1),'50':(50,1),'59.94':(60000,1001),'60':(60,1)}
    if base not in table:
        return None
    num,den=table[base]
    if drop and den!=1001 or drop and num==24000:
        return None
    return [num,den,drop]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: case folding', ['59.94-df'], [60000, 1001, True]), ('regression variant: case folding', ['30.0 ndf'], [30, 1, False]), ('partial repair probe: case folding', [' 29.97 '], [30000, 1001, False]), ('partial repair variant: case folding', [' 29.970DF '], [30000, 1001, True]), ('boundary control', ['29.97DF'], [30000, 1001, True]), ('boundary control', ['23.976'], [24000, 1001, False]), ('normal control', ['29.97 NDF'], [30000, 1001, False]), ('normal control', ['30.0'], [30, 1, False]), ('normal control', [' 23.98df '], None)], [('regression: case folding', [' 30 ndf '], [30, 1, False]), ('regression variant: case folding', [' 29.97df '], [30000, 1001, True]), ('partial repair probe: case folding', [' 60 '], [60, 1, False]), ('partial repair variant: case folding', [' 59.94-DF '], [60000, 1001, True]), ('boundary control', ['29.97 NDF'], [30000, 1001, False]), ('boundary control', ['30.0'], [30, 1, False]), ('normal control', [' 25 DF '], None), ('normal control', ['30'], [30, 1, False]), ('normal control', ['31-DF'], None)], [('regression: case folding', ['50 ndf'], [50, 1, False]), ('regression variant: case folding', ['29.970df'], [30000, 1001, True]), ('partial repair probe: case folding', [' 23.98-NDF '], [24000, 1001, False]), ('partial repair variant: case folding', [' 59.94-DF '], [60000, 1001, True]), ('boundary control', ['30DF'], None), ('boundary control', ['29.97DF'], [30000, 1001, True]), ('normal control', [' 25DF '], None), ('normal control', ['25.00df'], None), ('normal control', [' 23.976 DF '], None)], [('regression: case folding', ['59.94 ndf'], [60000, 1001, False]), ('regression variant: case folding', ['24.0 ndf'], [24, 1, False]), ('partial repair probe: case folding', [' 29.97DF '], [30000, 1001, True]), ('partial repair variant: case folding', [' 29.970 DF '], [30000, 1001, True]), ('boundary control', ['23.976'], [24000, 1001, False]), ('boundary control', ['29.97 NDF'], [30000, 1001, False]), ('normal control', ['23.976DF'], None), ('normal control', ['24df'], None), ('normal control', ['24.0DF'], None)], [('regression: case folding', ['30 ndf'], [30, 1, False]), ('regression variant: case folding', [' 29.97 ndf '], [30000, 1001, False]), ('partial repair probe: case folding', [' 29.970 '], [30000, 1001, False]), ('partial repair variant: case folding', [' 60-NDF '], [60, 1, False]), ('boundary control', ['30.0'], [30, 1, False]), ('boundary control', ['30DF'], None), ('normal control', ['60NDF'], [60, 1, False]), ('normal control', ['29.97'], [30000, 1001, False]), ('normal control', ['29.97-NDF'], [30000, 1001, False])]]
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):
    t=s.upper()
    drop=t.endswith('DF') and not t.endswith('NDF')
    base=t[:-3] if t.endswith('NDF') else t[:-2] if t.endswith('DF') else t
    base=base.rstrip(' -')
    if '.' in base:
        base=base.rstrip('0').rstrip('.')
    table={'23.976':(24000,1001),'23.98':(24000,1001),'24':(24,1),'25':(25,1),'29.97':(30000,1001),'30':(30,1),'50':(50,1),'59.94':(60000,1001),'60':(60,1)}
    if base not in table:
        return None
    num,den=table[base]
    if drop and den!=1001 or drop and num==24000:
        return None
    return [num,den,drop]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: case folding', ['59.94-df'], [60000, 1001, True]), ('regression variant: case folding', ['30.0 ndf'], [30, 1, False]), ('partial repair probe: case folding', [' 29.97 '], [30000, 1001, False]), ('partial repair variant: case folding', [' 29.970DF '], [30000, 1001, True]), ('boundary control', ['29.97DF'], [30000, 1001, True]), ('boundary control', ['23.976'], [24000, 1001, False]), ('normal control', ['29.97 NDF'], [30000, 1001, False]), ('normal control', ['30.0'], [30, 1, False]), ('normal control', [' 23.98df '], None)], [('regression: case folding', [' 30 ndf '], [30, 1, False]), ('regression variant: case folding', [' 29.97df '], [30000, 1001, True]), ('partial repair probe: case folding', [' 60 '], [60, 1, False]), ('partial repair variant: case folding', [' 59.94-DF '], [60000, 1001, True]), ('boundary control', ['29.97 NDF'], [30000, 1001, False]), ('boundary control', ['30.0'], [30, 1, False]), ('normal control', [' 25 DF '], None), ('normal control', ['30'], [30, 1, False]), ('normal control', ['31-DF'], None)], [('regression: case folding', ['50 ndf'], [50, 1, False]), ('regression variant: case folding', ['29.970df'], [30000, 1001, True]), ('partial repair probe: case folding', [' 23.98-NDF '], [24000, 1001, False]), ('partial repair variant: case folding', [' 59.94-DF '], [60000, 1001, True]), ('boundary control', ['30DF'], None), ('boundary control', ['29.97DF'], [30000, 1001, True]), ('normal control', [' 25DF '], None), ('normal control', ['25.00df'], None), ('normal control', [' 23.976 DF '], None)], [('regression: case folding', ['59.94 ndf'], [60000, 1001, False]), ('regression variant: case folding', ['24.0 ndf'], [24, 1, False]), ('partial repair probe: case folding', [' 29.97DF '], [30000, 1001, True]), ('partial repair variant: case folding', [' 29.970 DF '], [30000, 1001, True]), ('boundary control', ['23.976'], [24000, 1001, False]), ('boundary control', ['29.97 NDF'], [30000, 1001, False]), ('normal control', ['23.976DF'], None), ('normal control', ['24df'], None), ('normal control', ['24.0DF'], None)], [('regression: case folding', ['30 ndf'], [30, 1, False]), ('regression variant: case folding', [' 29.97 ndf '], [30000, 1001, False]), ('partial repair probe: case folding', [' 29.970 '], [30000, 1001, False]), ('partial repair variant: case folding', [' 60-NDF '], [60, 1, False]), ('boundary control', ['30.0'], [30, 1, False]), ('boundary control', ['30DF'], None), ('normal control', ['60NDF'], [60, 1, False]), ('normal control', ['29.97'], [30000, 1001, False]), ('normal control', ['29.97-NDF'], [30000, 1001, False])]]
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:
Lower-case suffixes such as "df" are rejected.

Parse a rate descriptor: a known rate (23.976, 23.98, 24, 25, 29.97, 30, 50, 59.94, 60; redundant trailing decimal zeros allowed) with an optional case-insensitive DF/NDF suffix, optionally separated by a space or hyphen; surrounding whitespace ignored. Drop frame is only valid for 29.97 and 59.94. Return [num,den,drop] or None.

split: open-access


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

N = 1
observations = []
def solve(s):
    t=s.strip().upper()
    drop='DF' in t
    base=t[:-3] if t.endswith('NDF') else t[:-2] if t.endswith('DF') else t
    base=base.rstrip(' -')
    if '.' in base:
        base=base.rstrip('0').rstrip('.')
    table={'23.976':(24000,1001),'23.98':(24000,1001),'24':(24,1),'25':(25,1),'29.97':(30000,1001),'30':(30,1),'50':(50,1),'59.94':(60000,1001),'60':(60,1)}
    if base not in table:
        return None
    num,den=table[base]
    if drop and den!=1001 or drop and num==24000:
        return None
    return [num,den,drop]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: non-drop suffix', ['29.97 NDF'], [30000, 1001, False]), ('regression variant: non-drop suffix', ['59.94 ndf'], [60000, 1001, False]), ('partial repair probe: non-drop suffix', ['29.970NDF'], [30000, 1001, False]), ('partial repair variant: non-drop suffix', ['30.0 ndf'], [30, 1, False]), ('boundary control', ['29.97DF'], [30000, 1001, True]), ('boundary control', ['59.94-df'], [60000, 1001, True]), ('normal control', ['30DF'], None), ('normal control', ['30.0'], [30, 1, False]), ('normal control', [' 23.98df '], None)], [('regression: non-drop suffix', [' 30 ndf '], [30, 1, False]), ('regression variant: non-drop suffix', [' 23.98-NDF '], [24000, 1001, False]), ('partial repair probe: non-drop suffix', [' 29.97NDF '], [30000, 1001, False]), ('partial repair variant: non-drop suffix', ['24NDF'], [24, 1, False]), ('boundary control', ['30DF'], None), ('boundary control', ['30.0'], [30, 1, False]), ('normal control', [' 25 DF '], None), ('normal control', ['30'], [30, 1, False]), ('normal control', ['31-DF'], None)], [('regression: non-drop suffix', ['29.970NDF'], [30000, 1001, False]), ('regression variant: non-drop suffix', ['30 ndf'], [30, 1, False]), ('partial repair probe: non-drop suffix', ['50 ndf'], [50, 1, False]), ('partial repair variant: non-drop suffix', [' 24-NDF '], [24, 1, False]), ('boundary control', ['23.976'], [24000, 1001, False]), ('boundary control', ['29.97DF'], [30000, 1001, True]), ('normal control', [' 60 '], [60, 1, False]), ('normal control', ['23.976df'], None), ('normal control', [' 24.0DF '], None)], [('regression: non-drop suffix', [' 29.97NDF '], [30000, 1001, False]), ('regression variant: non-drop suffix', ['30NDF'], [30, 1, False]), ('partial repair probe: non-drop suffix', ['59.94 ndf'], [60000, 1001, False]), ('partial repair variant: non-drop suffix', [' 60-NDF '], [60, 1, False]), ('boundary control', ['59.94-df'], [60000, 1001, True]), ('boundary control', ['30DF'], None), ('normal control', [' 29.970 '], [30000, 1001, False]), ('normal control', [' 29.97df '], [30000, 1001, True]), ('normal control', ['25.00'], [25, 1, False])], [('regression: non-drop suffix', ['50 ndf'], [50, 1, False]), ('regression variant: non-drop suffix', ['30.0 ndf'], [30, 1, False]), ('partial repair probe: non-drop suffix', [' 23.98-NDF '], [24000, 1001, False]), ('partial repair variant: non-drop suffix', ['60NDF'], [60, 1, False]), ('boundary control', ['30.0'], [30, 1, False]), ('boundary control', ['23.976'], [24000, 1001, False]), ('normal control', [' 59.94-DF '], [60000, 1001, True]), ('normal control', [' 29.970 DF '], [30000, 1001, True]), ('normal control', [' 25 '], [25, 1, False])]]
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):
    t=s.strip().upper()
    drop=t.endswith('DF') and not t.startswith('N')
    base=t[:-3] if t.endswith('NDF') else t[:-2] if t.endswith('DF') else t
    base=base.rstrip(' -')
    if '.' in base:
        base=base.rstrip('0').rstrip('.')
    table={'23.976':(24000,1001),'23.98':(24000,1001),'24':(24,1),'25':(25,1),'29.97':(30000,1001),'30':(30,1),'50':(50,1),'59.94':(60000,1001),'60':(60,1)}
    if base not in table:
        return None
    num,den=table[base]
    if drop and den!=1001 or drop and num==24000:
        return None
    return [num,den,drop]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: non-drop suffix', ['29.97 NDF'], [30000, 1001, False]), ('regression variant: non-drop suffix', ['59.94 ndf'], [60000, 1001, False]), ('partial repair probe: non-drop suffix', ['29.970NDF'], [30000, 1001, False]), ('partial repair variant: non-drop suffix', ['30.0 ndf'], [30, 1, False]), ('boundary control', ['29.97DF'], [30000, 1001, True]), ('boundary control', ['59.94-df'], [60000, 1001, True]), ('normal control', ['30DF'], None), ('normal control', ['30.0'], [30, 1, False]), ('normal control', [' 23.98df '], None)], [('regression: non-drop suffix', [' 30 ndf '], [30, 1, False]), ('regression variant: non-drop suffix', [' 23.98-NDF '], [24000, 1001, False]), ('partial repair probe: non-drop suffix', [' 29.97NDF '], [30000, 1001, False]), ('partial repair variant: non-drop suffix', ['24NDF'], [24, 1, False]), ('boundary control', ['30DF'], None), ('boundary control', ['30.0'], [30, 1, False]), ('normal control', [' 25 DF '], None), ('normal control', ['30'], [30, 1, False]), ('normal control', ['31-DF'], None)], [('regression: non-drop suffix', ['29.970NDF'], [30000, 1001, False]), ('regression variant: non-drop suffix', ['30 ndf'], [30, 1, False]), ('partial repair probe: non-drop suffix', ['50 ndf'], [50, 1, False]), ('partial repair variant: non-drop suffix', [' 24-NDF '], [24, 1, False]), ('boundary control', ['23.976'], [24000, 1001, False]), ('boundary control', ['29.97DF'], [30000, 1001, True]), ('normal control', [' 60 '], [60, 1, False]), ('normal control', ['23.976df'], None), ('normal control', [' 24.0DF '], None)], [('regression: non-drop suffix', [' 29.97NDF '], [30000, 1001, False]), ('regression variant: non-drop suffix', ['30NDF'], [30, 1, False]), ('partial repair probe: non-drop suffix', ['59.94 ndf'], [60000, 1001, False]), ('partial repair variant: non-drop suffix', [' 60-NDF '], [60, 1, False]), ('boundary control', ['59.94-df'], [60000, 1001, True]), ('boundary control', ['30DF'], None), ('normal control', [' 29.970 '], [30000, 1001, False]), ('normal control', [' 29.97df '], [30000, 1001, True]), ('normal control', ['25.00'], [25, 1, False])], [('regression: non-drop suffix', ['50 ndf'], [50, 1, False]), ('regression variant: non-drop suffix', ['30.0 ndf'], [30, 1, False]), ('partial repair probe: non-drop suffix', [' 23.98-NDF '], [24000, 1001, False]), ('partial repair variant: non-drop suffix', ['60NDF'], [60, 1, False]), ('boundary control', ['30.0'], [30, 1, False]), ('boundary control', ['23.976'], [24000, 1001, False]), ('normal control', [' 59.94-DF '], [60000, 1001, True]), ('normal control', [' 29.970 DF '], [30000, 1001, True]), ('normal control', [' 25 '], [25, 1, False])]]
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:
Explicit NDF descriptors are treated as drop frame.

Parse a rate descriptor: a known rate (23.976, 23.98, 24, 25, 29.97, 30, 50, 59.94, 60; redundant trailing decimal zeros allowed) with an optional case-insensitive DF/NDF suffix, optionally separated by a space or hyphen; surrounding whitespace ignored. Drop frame is only valid for 29.97 and 59.94. Return [num,den,drop] or None.

split: open-access


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

N = 1
observations = []
def solve(s):
    t=s.strip().upper()
    drop=t.endswith('DF') and not t.endswith('NDF')
    base=t[:-3] if t.endswith('NDF') else t[:-2] if t.endswith('DF') else t
    base=base.rstrip(' ')
    if '.' in base:
        base=base.rstrip('0').rstrip('.')
    table={'23.976':(24000,1001),'23.98':(24000,1001),'24':(24,1),'25':(25,1),'29.97':(30000,1001),'30':(30,1),'50':(50,1),'59.94':(60000,1001),'60':(60,1)}
    if base not in table:
        return None
    num,den=table[base]
    if drop and den!=1001 or drop and num==24000:
        return None
    return [num,den,drop]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: suffix separator', ['59.94-df'], [60000, 1001, True]), ('regression variant: suffix separator', ['29.97-NDF'], [30000, 1001, False]), ('partial repair probe: suffix separator', [' 24-NDF '], [24, 1, False]), ('partial repair variant: suffix separator', ['59.94-DF'], [60000, 1001, True]), ('boundary control', ['29.97DF'], [30000, 1001, True]), ('boundary control', ['23.976'], [24000, 1001, False]), ('normal control', ['29.97 NDF'], [30000, 1001, False]), ('normal control', ['30.0'], [30, 1, False]), ('normal control', [' 23.98df '], None)], [('regression: suffix separator', [' 23.98-NDF '], [24000, 1001, False]), ('regression variant: suffix separator', [' 29.97-DF '], [30000, 1001, True]), ('partial repair probe: suffix separator', [' 59.94-DF '], [60000, 1001, True]), ('partial repair variant: suffix separator', ['29.970-NDF'], [30000, 1001, False]), ('boundary control', ['29.97 NDF'], [30000, 1001, False]), ('boundary control', ['30.0'], [30, 1, False]), ('normal control', ['60-DF'], None), ('normal control', [' 29.97NDF '], [30000, 1001, False]), ('normal control', [' 29.97 '], [30000, 1001, False])], [('regression: suffix separator', [' 24-NDF '], [24, 1, False]), ('regression variant: suffix separator', ['25-NDF'], [25, 1, False]), ('partial repair probe: suffix separator', [' 60-NDF '], [60, 1, False]), ('partial repair variant: suffix separator', ['60-NDF'], [60, 1, False]), ('boundary control', ['30DF'], None), ('boundary control', ['29.97DF'], [30000, 1001, True]), ('normal control', ['30'], [30, 1, False]), ('normal control', ['59.94 ndf'], [60000, 1001, False]), ('normal control', [' 60 '], [60, 1, False])], [('regression: suffix separator', [' 59.94-DF '], [60000, 1001, True]), ('regression variant: suffix separator', [' 59.94-NDF '], [60000, 1001, False]), ('partial repair probe: suffix separator', ['29.97-NDF'], [30000, 1001, False]), ('partial repair variant: suffix separator', ['25.00-NDF'], [25, 1, False]), ('boundary control', ['23.976'], [24000, 1001, False]), ('boundary control', ['29.97 NDF'], [30000, 1001, False]), ('normal control', ['30 ndf'], [30, 1, False]), ('normal control', ['30NDF'], [30, 1, False]), ('normal control', ['30.0 ndf'], [30, 1, False])], [('regression: suffix separator', [' 60-NDF '], [60, 1, False]), ('regression variant: suffix separator', ['59.94-DF'], [60000, 1001, True]), ('partial repair probe: suffix separator', [' 29.97-DF '], [30000, 1001, True]), ('partial repair variant: suffix separator', ['24-NDF'], [24, 1, False]), ('boundary control', ['30.0'], [30, 1, False]), ('boundary control', ['30DF'], None), ('normal control', [' 23.976 DF '], None), ('normal control', [' 50 '], [50, 1, False]), ('normal control', [' 29.97df '], [30000, 1001, True])]]
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):
    t=s.strip().upper()
    drop=t.endswith('DF') and not t.endswith('NDF')
    base=t[:-3] if t.endswith('NDF') else t[:-2] if t.endswith('DF') else t
    base=base.strip()
    if '.' in base:
        base=base.rstrip('0').rstrip('.')
    table={'23.976':(24000,1001),'23.98':(24000,1001),'24':(24,1),'25':(25,1),'29.97':(30000,1001),'30':(30,1),'50':(50,1),'59.94':(60000,1001),'60':(60,1)}
    if base not in table:
        return None
    num,den=table[base]
    if drop and den!=1001 or drop and num==24000:
        return None
    return [num,den,drop]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: suffix separator', ['59.94-df'], [60000, 1001, True]), ('regression variant: suffix separator', ['29.97-NDF'], [30000, 1001, False]), ('partial repair probe: suffix separator', [' 24-NDF '], [24, 1, False]), ('partial repair variant: suffix separator', ['59.94-DF'], [60000, 1001, True]), ('boundary control', ['29.97DF'], [30000, 1001, True]), ('boundary control', ['23.976'], [24000, 1001, False]), ('normal control', ['29.97 NDF'], [30000, 1001, False]), ('normal control', ['30.0'], [30, 1, False]), ('normal control', [' 23.98df '], None)], [('regression: suffix separator', [' 23.98-NDF '], [24000, 1001, False]), ('regression variant: suffix separator', [' 29.97-DF '], [30000, 1001, True]), ('partial repair probe: suffix separator', [' 59.94-DF '], [60000, 1001, True]), ('partial repair variant: suffix separator', ['29.970-NDF'], [30000, 1001, False]), ('boundary control', ['29.97 NDF'], [30000, 1001, False]), ('boundary control', ['30.0'], [30, 1, False]), ('normal control', ['60-DF'], None), ('normal control', [' 29.97NDF '], [30000, 1001, False]), ('normal control', [' 29.97 '], [30000, 1001, False])], [('regression: suffix separator', [' 24-NDF '], [24, 1, False]), ('regression variant: suffix separator', ['25-NDF'], [25, 1, False]), ('partial repair probe: suffix separator', [' 60-NDF '], [60, 1, False]), ('partial repair variant: suffix separator', ['60-NDF'], [60, 1, False]), ('boundary control', ['30DF'], None), ('boundary control', ['29.97DF'], [30000, 1001, True]), ('normal control', ['30'], [30, 1, False]), ('normal control', ['59.94 ndf'], [60000, 1001, False]), ('normal control', [' 60 '], [60, 1, False])], [('regression: suffix separator', [' 59.94-DF '], [60000, 1001, True]), ('regression variant: suffix separator', [' 59.94-NDF '], [60000, 1001, False]), ('partial repair probe: suffix separator', ['29.97-NDF'], [30000, 1001, False]), ('partial repair variant: suffix separator', ['25.00-NDF'], [25, 1, False]), ('boundary control', ['23.976'], [24000, 1001, False]), ('boundary control', ['29.97 NDF'], [30000, 1001, False]), ('normal control', ['30 ndf'], [30, 1, False]), ('normal control', ['30NDF'], [30, 1, False]), ('normal control', ['30.0 ndf'], [30, 1, False])], [('regression: suffix separator', [' 60-NDF '], [60, 1, False]), ('regression variant: suffix separator', ['59.94-DF'], [60000, 1001, True]), ('partial repair probe: suffix separator', [' 29.97-DF '], [30000, 1001, True]), ('partial repair variant: suffix separator', ['24-NDF'], [24, 1, False]), ('boundary control', ['30.0'], [30, 1, False]), ('boundary control', ['30DF'], None), ('normal control', [' 23.976 DF '], None), ('normal control', [' 50 '], [50, 1, False]), ('normal control', [' 29.97df '], [30000, 1001, True])]]
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:
Descriptors like 59.94-DF are rejected as unknown rates.

Parse a rate descriptor: a known rate (23.976, 23.98, 24, 25, 29.97, 30, 50, 59.94, 60; redundant trailing decimal zeros allowed) with an optional case-insensitive DF/NDF suffix, optionally separated by a space or hyphen; surrounding whitespace ignored. Drop frame is only valid for 29.97 and 59.94. Return [num,den,drop] or None.

split: open-access


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

N = 1
observations = []
def solve(s):
    t=s.strip().upper()
    drop=t.endswith('DF') and not t.endswith('NDF')
    base=t[:-3] if t.endswith('NDF') else t[:-2] if t.endswith('DF') else t
    base=base.rstrip(' -')
    if '.' in base:
        base=base.rstrip('0').rstrip('.')
    table={'23.976':(24000,1001),'23.98':(24000,1001),'24':(24,1),'25':(25,1),'29.97':(30000,1001),'30':(30,1),'50':(50,1),'59.94':(60000,1001),'60':(60,1)}
    if base not in table:
        return None
    num,den=table[base]
    if drop and den!=1001:
        return None
    return [num,den,drop]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: drop-frame validity', [' 23.98df '], None), ('regression variant: drop-frame validity', ['23.98df'], None), ('partial repair probe: drop-frame validity', [' 25 DF '], None), ('partial repair variant: drop-frame validity', ['25DF'], None), ('boundary control', ['29.97DF'], [30000, 1001, True]), ('boundary control', ['59.94-df'], [60000, 1001, True]), ('normal control', ['29.97 NDF'], [30000, 1001, False]), ('normal control', ['30.0'], [30, 1, False]), ('normal control', [' 30 ndf '], [30, 1, False])], [('regression: drop-frame validity', ['23.976df'], None), ('regression variant: drop-frame validity', ['23.976-DF'], None), ('partial repair probe: drop-frame validity', ['25df'], None), ('partial repair variant: drop-frame validity', ['24.0DF'], None), ('boundary control', ['29.97 NDF'], [30000, 1001, False]), ('boundary control', ['30.0'], [30, 1, False]), ('normal control', [' 29.97NDF '], [30000, 1001, False]), ('normal control', ['30'], [30, 1, False]), ('normal control', ['31-DF'], None)], [('regression: drop-frame validity', [' 23.976 DF '], None), ('regression variant: drop-frame validity', ['23.98 DF'], None), ('partial repair probe: drop-frame validity', [' 30.0df '], None), ('partial repair variant: drop-frame validity', [' 25.00DF '], None), ('boundary control', ['23.976'], [24000, 1001, False]), ('boundary control', ['29.97DF'], [30000, 1001, True]), ('normal control', [' 60 '], [60, 1, False]), ('normal control', [' 29.97DF '], [30000, 1001, True]), ('normal control', ['30.0 ndf'], [30, 1, False])], [('regression: drop-frame validity', ['23.976DF'], None), ('regression variant: drop-frame validity', ['23.976 DF'], None), ('partial repair probe: drop-frame validity', [' 25DF '], None), ('partial repair variant: drop-frame validity', ['24DF'], None), ('boundary control', ['59.94-df'], [60000, 1001, True]), ('boundary control', ['29.97 NDF'], [30000, 1001, False]), ('normal control', [' 29.970 '], [30000, 1001, False]), ('normal control', [' 29.970DF '], [30000, 1001, True]), ('normal control', ['25.00'], [25, 1, False])], [('regression: drop-frame validity', [' 23.98-DF '], None), ('regression variant: drop-frame validity', ['23.98-DF'], None), ('partial repair probe: drop-frame validity', ['25.00df'], None), ('partial repair variant: drop-frame validity', ['25.00DF'], None), ('boundary control', ['30.0'], [30, 1, False]), ('boundary control', ['23.976'], [24000, 1001, False]), ('normal control', [' 59.94-DF '], [60000, 1001, True]), ('normal control', [' 25 '], [25, 1, False]), ('normal control', [' 59.94 '], [60000, 1001, False])]]
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):
    t=s.strip().upper()
    drop=t.endswith('DF') and not t.endswith('NDF')
    base=t[:-3] if t.endswith('NDF') else t[:-2] if t.endswith('DF') else t
    base=base.rstrip(' -')
    if '.' in base:
        base=base.rstrip('0').rstrip('.')
    table={'23.976':(24000,1001),'23.98':(24000,1001),'24':(24,1),'25':(25,1),'29.97':(30000,1001),'30':(30,1),'50':(50,1),'59.94':(60000,1001),'60':(60,1)}
    if base not in table:
        return None
    num,den=table[base]
    if drop and num==24000:
        return None
    return [num,den,drop]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: drop-frame validity', [' 23.98df '], None), ('regression variant: drop-frame validity', ['23.98df'], None), ('partial repair probe: drop-frame validity', [' 25 DF '], None), ('partial repair variant: drop-frame validity', ['25DF'], None), ('boundary control', ['29.97DF'], [30000, 1001, True]), ('boundary control', ['59.94-df'], [60000, 1001, True]), ('normal control', ['29.97 NDF'], [30000, 1001, False]), ('normal control', ['30.0'], [30, 1, False]), ('normal control', [' 30 ndf '], [30, 1, False])], [('regression: drop-frame validity', ['23.976df'], None), ('regression variant: drop-frame validity', ['23.976-DF'], None), ('partial repair probe: drop-frame validity', ['25df'], None), ('partial repair variant: drop-frame validity', ['24.0DF'], None), ('boundary control', ['29.97 NDF'], [30000, 1001, False]), ('boundary control', ['30.0'], [30, 1, False]), ('normal control', [' 29.97NDF '], [30000, 1001, False]), ('normal control', ['30'], [30, 1, False]), ('normal control', ['31-DF'], None)], [('regression: drop-frame validity', [' 23.976 DF '], None), ('regression variant: drop-frame validity', ['23.98 DF'], None), ('partial repair probe: drop-frame validity', [' 30.0df '], None), ('partial repair variant: drop-frame validity', [' 25.00DF '], None), ('boundary control', ['23.976'], [24000, 1001, False]), ('boundary control', ['29.97DF'], [30000, 1001, True]), ('normal control', [' 60 '], [60, 1, False]), ('normal control', [' 29.97DF '], [30000, 1001, True]), ('normal control', ['30.0 ndf'], [30, 1, False])], [('regression: drop-frame validity', ['23.976DF'], None), ('regression variant: drop-frame validity', ['23.976 DF'], None), ('partial repair probe: drop-frame validity', [' 25DF '], None), ('partial repair variant: drop-frame validity', ['24DF'], None), ('boundary control', ['59.94-df'], [60000, 1001, True]), ('boundary control', ['29.97 NDF'], [30000, 1001, False]), ('normal control', [' 29.970 '], [30000, 1001, False]), ('normal control', [' 29.970DF '], [30000, 1001, True]), ('normal control', ['25.00'], [25, 1, False])], [('regression: drop-frame validity', [' 23.98-DF '], None), ('regression variant: drop-frame validity', ['23.98-DF'], None), ('partial repair probe: drop-frame validity', ['25.00df'], None), ('partial repair variant: drop-frame validity', ['25.00DF'], None), ('boundary control', ['30.0'], [30, 1, False]), ('boundary control', ['23.976'], [24000, 1001, False]), ('normal control', [' 59.94-DF '], [60000, 1001, True]), ('normal control', [' 25 '], [25, 1, False]), ('normal control', [' 59.94 '], [60000, 1001, False])]]
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 23.976 DF descriptor is accepted although that rate has no drop-frame labels.

Parse a rate descriptor: a known rate (23.976, 23.98, 24, 25, 29.97, 30, 50, 59.94, 60; redundant trailing decimal zeros allowed) with an optional case-insensitive DF/NDF suffix, optionally separated by a space or hyphen; surrounding whitespace ignored. Drop frame is only valid for 29.97 and 59.94. Return [num,den,drop] or None.

split: open-access


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

N = 1
observations = []
def solve(s):
    t=s.strip().upper()
    drop=t.endswith('DF') and not t.endswith('NDF')
    base=t[:-3] if t.endswith('NDF') else t[:-2] if t.endswith('DF') else t
    base=base.rstrip(' -')
    if '.' in base:
        base=base.rstrip('0.')
    table={'23.976':(24000,1001),'23.98':(24000,1001),'24':(24,1),'25':(25,1),'29.97':(30000,1001),'30':(30,1),'50':(50,1),'59.94':(60000,1001),'60':(60,1)}
    if base not in table:
        return None
    num,den=table[base]
    if drop and den!=1001 or drop and num==24000:
        return None
    return [num,den,drop]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: decimal zero trimming', ['30.0'], [30, 1, False]), ('regression variant: decimal zero trimming', ['30.0-NDF'], [30, 1, False]), ('partial repair probe: decimal zero trimming', ['25.00'], [25, 1, False]), ('partial repair variant: decimal zero trimming', [' 25.00 ndf '], [25, 1, False]), ('boundary control', ['29.97DF'], [30000, 1001, True]), ('boundary control', ['23.976'], [24000, 1001, False]), ('normal control', ['29.97 NDF'], [30000, 1001, False]), ('normal control', ['59.94-df'], [60000, 1001, True]), ('normal control', [' 23.98df '], None)], [('regression: decimal zero trimming', ['30.0 ndf'], [30, 1, False]), ('regression variant: decimal zero trimming', [' 30.0 ndf '], [30, 1, False]), ('partial repair probe: decimal zero trimming', ['24.0 ndf'], [24, 1, False]), ('partial repair variant: decimal zero trimming', ['25.00 ndf'], [25, 1, False]), ('boundary control', ['29.97 NDF'], [30000, 1001, False]), ('boundary control', ['59.94-df'], [60000, 1001, True]), ('normal control', ['60-DF'], None), ('normal control', [' 29.97NDF '], [30000, 1001, False]), ('normal control', [' 29.97 '], [30000, 1001, False])], [('regression: decimal zero trimming', [' 30.0 '], [30, 1, False]), ('regression variant: decimal zero trimming', ['30.0'], [30, 1, False]), ('partial repair probe: decimal zero trimming', ['25.00NDF'], [25, 1, False]), ('partial repair variant: decimal zero trimming', [' 30.0NDF '], [30, 1, False]), ('boundary control', ['30DF'], None), ('boundary control', ['29.97DF'], [30000, 1001, True]), ('normal control', ['30'], [30, 1, False]), ('normal control', ['59.94 ndf'], [60000, 1001, False]), ('normal control', [' 60 '], [60, 1, False])], [('regression: decimal zero trimming', [' 30.0NDF '], [30, 1, False]), ('regression variant: decimal zero trimming', ['30.0 ndf'], [30, 1, False]), ('partial repair probe: decimal zero trimming', [' 24.0NDF '], [24, 1, False]), ('partial repair variant: decimal zero trimming', [' 24.0 '], [24, 1, False]), ('boundary control', ['23.976'], [24000, 1001, False]), ('boundary control', ['29.97 NDF'], [30000, 1001, False]), ('normal control', [' 23.98-NDF '], [24000, 1001, False]), ('normal control', ['23.976df'], None), ('normal control', ['25.00df'], None)], [('regression: decimal zero trimming', ['30.0NDF'], [30, 1, False]), ('regression variant: decimal zero trimming', [' 30.0 '], [30, 1, False]), ('partial repair probe: decimal zero trimming', ['24.0NDF'], [24, 1, False]), ('partial repair variant: decimal zero trimming', ['30.0-NDF'], [30, 1, False]), ('boundary control', ['59.94-df'], [60000, 1001, True]), ('boundary control', ['30DF'], None), ('normal control', [' 23.976 DF '], None), ('normal control', [' 50 '], [50, 1, False]), ('normal control', [' 29.970DF '], [30000, 1001, True])]]
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):
    t=s.strip().upper()
    drop=t.endswith('DF') and not t.endswith('NDF')
    base=t[:-3] if t.endswith('NDF') else t[:-2] if t.endswith('DF') else t
    base=base.rstrip(' -')
    if '.' in base:
        base=base.rstrip('0')
    table={'23.976':(24000,1001),'23.98':(24000,1001),'24':(24,1),'25':(25,1),'29.97':(30000,1001),'30':(30,1),'50':(50,1),'59.94':(60000,1001),'60':(60,1)}
    if base not in table:
        return None
    num,den=table[base]
    if drop and den!=1001 or drop and num==24000:
        return None
    return [num,den,drop]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: decimal zero trimming', ['30.0'], [30, 1, False]), ('regression variant: decimal zero trimming', ['30.0-NDF'], [30, 1, False]), ('partial repair probe: decimal zero trimming', ['25.00'], [25, 1, False]), ('partial repair variant: decimal zero trimming', [' 25.00 ndf '], [25, 1, False]), ('boundary control', ['29.97DF'], [30000, 1001, True]), ('boundary control', ['23.976'], [24000, 1001, False]), ('normal control', ['29.97 NDF'], [30000, 1001, False]), ('normal control', ['59.94-df'], [60000, 1001, True]), ('normal control', [' 23.98df '], None)], [('regression: decimal zero trimming', ['30.0 ndf'], [30, 1, False]), ('regression variant: decimal zero trimming', [' 30.0 ndf '], [30, 1, False]), ('partial repair probe: decimal zero trimming', ['24.0 ndf'], [24, 1, False]), ('partial repair variant: decimal zero trimming', ['25.00 ndf'], [25, 1, False]), ('boundary control', ['29.97 NDF'], [30000, 1001, False]), ('boundary control', ['59.94-df'], [60000, 1001, True]), ('normal control', ['60-DF'], None), ('normal control', [' 29.97NDF '], [30000, 1001, False]), ('normal control', [' 29.97 '], [30000, 1001, False])], [('regression: decimal zero trimming', [' 30.0 '], [30, 1, False]), ('regression variant: decimal zero trimming', ['30.0'], [30, 1, False]), ('partial repair probe: decimal zero trimming', ['25.00NDF'], [25, 1, False]), ('partial repair variant: decimal zero trimming', [' 30.0NDF '], [30, 1, False]), ('boundary control', ['30DF'], None), ('boundary control', ['29.97DF'], [30000, 1001, True]), ('normal control', ['30'], [30, 1, False]), ('normal control', ['59.94 ndf'], [60000, 1001, False]), ('normal control', [' 60 '], [60, 1, False])], [('regression: decimal zero trimming', [' 30.0NDF '], [30, 1, False]), ('regression variant: decimal zero trimming', ['30.0 ndf'], [30, 1, False]), ('partial repair probe: decimal zero trimming', [' 24.0NDF '], [24, 1, False]), ('partial repair variant: decimal zero trimming', [' 24.0 '], [24, 1, False]), ('boundary control', ['23.976'], [24000, 1001, False]), ('boundary control', ['29.97 NDF'], [30000, 1001, False]), ('normal control', [' 23.98-NDF '], [24000, 1001, False]), ('normal control', ['23.976df'], None), ('normal control', ['25.00df'], None)], [('regression: decimal zero trimming', ['30.0NDF'], [30, 1, False]), ('regression variant: decimal zero trimming', [' 30.0 '], [30, 1, False]), ('partial repair probe: decimal zero trimming', ['24.0NDF'], [24, 1, False]), ('partial repair variant: decimal zero trimming', ['30.0-NDF'], [30, 1, False]), ('boundary control', ['59.94-df'], [60000, 1001, True]), ('boundary control', ['30DF'], None), ('normal control', [' 23.976 DF '], None), ('normal control', [' 50 '], [50, 1, False]), ('normal control', [' 29.970DF '], [30000, 1001, True])]]
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 descriptor of 30.0 is read as 3 and rejected.

Parse a rate descriptor: a known rate (23.976, 23.98, 24, 25, 29.97, 30, 50, 59.94, 60; redundant trailing decimal zeros allowed) with an optional case-insensitive DF/NDF suffix, optionally separated by a space or hyphen; surrounding whitespace ignored. Drop frame is only valid for 29.97 and 59.94. Return [num,den,drop] or None.

split: open-access


prompt:
The first clip airs late by the black gap.

Clips [SOM, EOM] use non-drop labels at fps with EOM inclusive; a clip may cross midnight on tape. Clips air back to back from start with gap black frames between consecutive clips. Return the on-air label of each clip followed by the exclusive end label of the schedule, wrapping at 24 hours.

split: open-access


prompt:
Every following clip starts one frame early, clipping the last frame of the previous clip.

Clips [SOM, EOM] use non-drop labels at fps with EOM inclusive; a clip may cross midnight on tape. Clips air back to back from start with gap black frames between consecutive clips. Return the on-air label of each clip followed by the exclusive end label of the schedule, wrapping at 24 hours.

split: open-access


prompt:
Black between clips lasts seconds instead of frames.

Clips [SOM, EOM] use non-drop labels at fps with EOM inclusive; a clip may cross midnight on tape. Clips air back to back from start with gap black frames between consecutive clips. Return the on-air label of each clip followed by the exclusive end label of the schedule, wrapping at 24 hours.

split: open-access


prompt:
Listed on-air times point at the start of the black rather than the first picture frame.

Clips [SOM, EOM] use non-drop labels at fps with EOM inclusive; a clip may cross midnight on tape. Clips air back to back from start with gap black frames between consecutive clips. Return the on-air label of each clip followed by the exclusive end label of the schedule, wrapping at 24 hours.

split: open-access


prompt:
Clip lengths come out as the complement of the real length.

Clips [SOM, EOM] use non-drop labels at fps with EOM inclusive; a clip may cross midnight on tape. Clips air back to back from start with gap black frames between consecutive clips. Return the on-air label of each clip followed by the exclusive end label of the schedule, wrapping at 24 hours.

split: open-access


prompt:
An offset of 0.06 s at 25 fps lands on frame 1 instead of frame 2.

Convert a decimal seconds string exactly (no binary floating point) at rate [N,D] to the nearest frame, halves rounding up, and a non-drop label using the nominal rate ceil(N/D). Negative input returns None.

split: open-access


prompt:
Half-frame offsets are always rounded as if they were whole frames.

Convert a decimal seconds string exactly (no binary floating point) at rate [N,D] to the nearest frame, halves rounding up, and a non-drop label using the nominal rate ceil(N/D). Negative input returns None.

split: open-access


prompt:
Offsets in the second half of a frame snap back to the earlier frame.

Convert a decimal seconds string exactly (no binary floating point) at rate [N,D] to the nearest frame, halves rounding up, and a non-drop label using the nominal rate ceil(N/D). Negative input returns None.

split: open-access