Previous response had warnings:
WARNINGS: - Extra text detected before JSON object
- Extra text detected after JSON object

New Terminal Output:

root@d7299c7f5982:/app# python3 -c "
> import struct
> with open('/app/frames.tza', 'rb') as f:
>     magic = f.read(4)
>     width, height = struct.unpack('<HH', f.read(4))
>     n_frames, max_bytes = struct.unpack('<II', f.read(8))
>     frames = [f.read(width * height) for _ in range(n_frames)]
>
> prev = b' ' * (width * height)
> total_runs = 0
> total_run_cells = 0
> for frame in frames:
>     in_run = False
>     for i in range(width * height):
>         if prev[i] != frame[i]:
>             if not in_run:
>                 total_runs += 1
>                 in_run = True
>             total_run_cells += 1
>         else:
>             in_run = False
>     prev = frame
>
> print(f'Total runs of consecutive changes: {total_runs}')
> print(f'Total changed cells: {total_run_cells}')
> print(f'Average run length: {total_run_cells / total_runs:.2f}')
> print(f'Average runs per frame: {total_runs / n_frames:.2f}')
> "
Total runs of consecutive changes: 20190
Total changed cells: 157316
Average run length: 7.79
Average runs per frame: 16.82
root@d7299c7f5982:/app#
