New Terminal Output:

root@f3f8d6319494:/app# python3 << 'PYEOF'
> import struct
>
> with open('/app/frames.tza', 'rb') as f:
>     f.read(4)
>     w, h = struct.unpack('<HH', f.read(4))
>     n_frames, max_bytes = struct.unpack('<II', f.read(8))
>     frames = [f.read(w*h) for _ in range(n_frames)]
>
> # Find a frame with ~300 changes
> for i in range(1, n_frames):
>     changes = [(j//w, j%w) for j in range(w*h) if frames[i-1][j] != frames[i][j]]
>     if 280 <= len(changes) <= 320:
>         print(f'Frame {i}: {len(changes)} changes')
>
>         # Group by row
>         by_row = {}
>         for r, c in changes:
>             by_row.setdefault(r, []).append(c)
>
>         print(f'  Changed rows: {sorted(by_row.keys())}')
>         for r in sorted(by_row.keys()):
>             cols = sorted(by_row[r])
>             # Find runs
>             runs = []
>             if cols:
>                 run_start = cols[0]
>                 run_end = cols[0]
>                 for c in cols[1:]:
>                     if c == run_end + 1:
>                         run_end = c
>                     else:
>                         runs.append((run_start, run_end))
>                         run_start = run_end = c
>                 runs.append((run_start, run_end))
>             print(f'    Row {r}: {len(cols)} changes, {len(runs)} runs: {runs}')
>         break
> PYEOF
Frame 7: 288 changes
  Changed rows: [1, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22]
    Row 1: 4 changes, 3 runs: [(5, 5), (34, 35), (56, 56)]
    Row 13: 33 changes, 2 runs: [(6, 6), (9, 40)]
    Row 14: 14 changes, 3 runs: [(6, 6), (9, 14), (34, 40)]
    Row 15: 29 changes, 6 runs: [(6, 6), (9, 14), (16, 19), (21, 21), (24, 24), (26, 41)]
    Row 16: 22 changes, 9 runs: [(6, 6), (9, 9), (11, 14), (16, 17), (19, 21), (24, 25), (27, 28), (34, 35), (37, 41)]
    Row 17: 34 changes, 4 runs: [(6, 6), (9, 15), (17, 38), (40, 43)]
    Row 18: 35 changes, 3 runs: [(6, 6), (9, 12), (14, 43)]
    Row 19: 32 changes, 2 runs: [(6, 6), (9, 39)]
    Row 20: 26 changes, 3 runs: [(6, 6), (14, 32), (34, 39)]
    Row 21: 25 changes, 4 runs: [(6, 6), (9, 25), (31, 34), (36, 38)]
    Row 22: 34 changes, 3 runs: [(5, 6), (9, 34), (36, 41)]
root@f3f8d6319494:/app#
