FA-71916 / Error-correcting codes / Open access
Deinterleaver measures the burst before deinterleaving · case 01
Bursts are judged uncorrectable although interleaving spreads them.
ROOT CAUSE
The worst-codeword count is taken over slices of the transmitted stream instead of the deinterleaved rows.
VERIFIED REPAIR
Count errors per codeword row of the deinterleaved matrix.
Unsuccessful approach: Counting per column of the deinterleaved matrix measures the channel burst again.
Case contract
A rows x cols block interleaver writes codewords row by row (each row is one codeword of cols symbols) and transmits column by column. Given per-symbol error flags in transmission order, deinterleave them back to row order, find the largest number of flagged symbols in any codeword, and report whether it is within the per-codeword capability t. Return [deinterleaved flags, worst, correctable]; mismatched sizes return None.
Why this case matters
Interleaving spreads channel bursts across codewords; link budgets check whether a burst stays correctable.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(stream, rows, cols, t):
if rows < 1 or cols < 1 or len(stream) != rows * cols:
return None
out = [None] * (rows * cols)
for k, v in enumerate(stream):
col, row = divmod(k, rows)
out[row * cols + col] = v
worst = max(sum(1 for v in stream[i * cols:(i + 1) * cols] if v) for i in range(rows))
return [out, worst, worst <= t]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression [[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1], 3, 4, 0]', [[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1], 3, 4, 0], [[0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1], 2, False]], ['regression [[0, 0, 1, 1, 1, 0, 0, 0, 0, 0], 2, 5, 0]', [[0, 0, 1, 1, 1, 0, 0, 0, 0, 0], 2, 5, 0], [[0, 1, 1, 0, 0, 0, 1, 0, 0, 0], 2, False]], ['partial-repair [[0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1], 3, 4, 2]', [[0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1], 3, 4, 2], [[0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1], 3, False]], ['control [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 4, 3, 0]', [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 4, 3, 0], [[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], 1, False]], ['control [[1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1], 4, 4, 2]', [[1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1], 4, 4, 2], [[1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1], 2, True]], ['control [[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 2, 6, 1]', [[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 2, 6, 1], [[0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], 1, True]], ['control [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 6, 2, 1]', [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 6, 2, 1], [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], 1, True]], ['control [[1, 0, 0], 3, 1, 0]', [[1, 0, 0], 3, 1, 0], [[1, 0, 0], 1, False]]], [['regression [[1, 1, 1, 1, 1, 0, 0, 0, 0, 0], 5, 2, 2]', [[1, 1, 1, 1, 1, 0, 0, 0, 0, 0], 5, 2, 2], [[1, 0, 1, 0, 1, 0, 1, 0, 1, 0], 1, True]], ['regression [[1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 4, 4, 1]', [[1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 4, 4, 1], [[1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], 1, True]], ['partial-repair [[0, 0, 1, 1, 0, 1, 0, 1, 0, 1], 2, 5, 3]', [[0, 0, 1, 1, 0, 1, 0, 1, 0, 1], 2, 5, 3], [[0, 1, 0, 0, 0, 0, 1, 1, 1, 1], 4, False]], ['control [[1, 1], 3, 1, 1]', [[1, 1], 3, 1, 1], None], ['control [[0, 0, 0, 0, 0, 0], 2, 3, 0]', [[0, 0, 0, 0, 0, 0], 2, 3, 0], [[0, 0, 0, 0, 0, 0], 0, True]], ['control [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 4, 3, 0]', [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 4, 3, 0], [[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], 1, False]], ['control [[1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1], 4, 4, 2]', [[1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1], 4, 4, 2], [[1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1], 2, True]], ['control [[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 2, 6, 1]', [[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 2, 6, 1], [[0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], 1, True]]], [['regression [[0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1], 2, 6, 2]', [[0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1], 2, 6, 2], [[0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1], 4, False]], ['regression [[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0], 6, 2, 2]', [[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0], 6, 2, 2], [[0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0], 1, True]], ['partial-repair [[1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 4, 4, 1]', [[1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 4, 4, 1], [[1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], 1, True]], ['partial-repair [[1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1], 3, 5, 3]', [[1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1], 3, 5, 3], [[1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1], 4, False]], ['control [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 6, 2, 1]', [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 6, 2, 1], [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], 1, True]], ['control [[1, 0, 0], 3, 1, 0]', [[1, 0, 0], 3, 1, 0], [[1, 0, 0], 1, False]], ['control [[1, 1], 3, 1, 1]', [[1, 1], 3, 1, 1], None], ['control [[0, 0, 0, 0, 0, 0], 2, 3, 0]', [[0, 0, 0, 0, 0, 0], 2, 3, 0], [[0, 0, 0, 0, 0, 0], 0, True]]], [['regression [[0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0], 4, 3, 1]', [[0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0], 4, 3, 1], [[0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0], 1, True]], ['regression [[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1], 3, 4, 0]', [[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1], 3, 4, 0], [[0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1], 2, False]], ['partial-repair [[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0], 6, 2, 2]', [[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0], 6, 2, 2], [[0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0], 1, True]], ['partial-repair [[1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], 3, 4, 1]', [[1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], 3, 4, 1], [[1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], 1, True]], ['control [[1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1], 4, 4, 2]', [[1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1], 4, 4, 2], [[1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1], 2, True]], ['control [[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 2, 6, 1]', [[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 2, 6, 1], [[0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], 1, True]], ['control [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 6, 2, 1]', [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 6, 2, 1], [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], 1, True]], ['control [[1, 0, 0], 3, 1, 0]', [[1, 0, 0], 3, 1, 0], [[1, 0, 0], 1, False]]], [['regression [[0, 0, 1, 1, 0, 1, 0, 1, 0, 1], 2, 5, 3]', [[0, 0, 1, 1, 0, 1, 0, 1, 0, 1], 2, 5, 3], [[0, 1, 0, 0, 0, 0, 1, 1, 1, 1], 4, False]], ['regression [[1, 1, 1, 1, 1, 0, 0, 0, 0, 0], 5, 2, 2]', [[1, 1, 1, 1, 1, 0, 0, 0, 0, 0], 5, 2, 2], [[1, 0, 1, 0, 1, 0, 1, 0, 1, 0], 1, True]], ['partial-repair [[1, 1, 1, 1, 1, 1], 2, 3, 3]', [[1, 1, 1, 1, 1, 1], 2, 3, 3], [[1, 1, 1, 1, 1, 1], 3, True]], ['partial-repair [[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1], 3, 4, 0]', [[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1], 3, 4, 0], [[0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1], 2, False]], ['control [[0, 0, 0, 0, 0, 0], 2, 3, 0]', [[0, 0, 0, 0, 0, 0], 2, 3, 0], [[0, 0, 0, 0, 0, 0], 0, True]], ['control [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 4, 3, 0]', [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 4, 3, 0], [[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], 1, False]], ['control [[1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1], 4, 4, 2]', [[1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1], 4, 4, 2], [[1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1], 2, True]], ['control [[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 2, 6, 1]', [[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 2, 6, 1], [[0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], 1, 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)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression [[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1], 3, 4, 0] | [[0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1], 4, False] | [[0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1], 2, False] | Failed |
| regression [[0, 0, 1, 1, 1, 0, 0, 0, 0, 0], 2, 5, 0] | [[0, 1, 1, 0, 0, 0, 1, 0, 0, 0], 3, False] | [[0, 1, 1, 0, 0, 0, 1, 0, 0, 0], 2, False] | Failed |
| partial-repair [[0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1], 3, 4, 2] | [[0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1], 3, False] | [[0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1], 3, False] | Passed |
| control [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 4, 3, 0] | [[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], 1, False] | [[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], 1, False] | Passed |
| control [[1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1], 4, 4, 2] | [[1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1], 2, True] | [[1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1], 2, True] | Passed |
| control [[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 2, 6, 1] | [[0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], 1, True] | [[0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], 1, True] | Passed |
| control [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 6, 2, 1] | [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], 1, True] | [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], 1, True] | Passed |
| control [[1, 0, 0], 3, 1, 0] | [[1, 0, 0], 1, False] | [[1, 0, 0], 1, False] | Passed |
SHA-256 / b8b39ebbc288b42fb08bfd1430d12e277ebcbf17fa79813e35ab6f1961659e75
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(stream, rows, cols, t):
if rows < 1 or cols < 1 or len(stream) != rows * cols:
return None
out = [None] * (rows * cols)
for k, v in enumerate(stream):
col, row = divmod(k, rows)
out[row * cols + col] = v
worst = max(sum(1 for v in out[i::cols] if v) for i in range(cols))
return [out, worst, worst <= t]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression [[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1], 3, 4, 0]', [[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1], 3, 4, 0], [[0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1], 2, False]], ['regression [[0, 0, 1, 1, 1, 0, 0, 0, 0, 0], 2, 5, 0]', [[0, 0, 1, 1, 1, 0, 0, 0, 0, 0], 2, 5, 0], [[0, 1, 1, 0, 0, 0, 1, 0, 0, 0], 2, False]], ['partial-repair [[0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1], 3, 4, 2]', [[0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1], 3, 4, 2], [[0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1], 3, False]], ['control [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 4, 3, 0]', [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 4, 3, 0], [[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], 1, False]], ['control [[1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1], 4, 4, 2]', [[1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1], 4, 4, 2], [[1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1], 2, True]], ['control [[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 2, 6, 1]', [[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 2, 6, 1], [[0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], 1, True]], ['control [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 6, 2, 1]', [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 6, 2, 1], [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], 1, True]], ['control [[1, 0, 0], 3, 1, 0]', [[1, 0, 0], 3, 1, 0], [[1, 0, 0], 1, False]]], [['regression [[1, 1, 1, 1, 1, 0, 0, 0, 0, 0], 5, 2, 2]', [[1, 1, 1, 1, 1, 0, 0, 0, 0, 0], 5, 2, 2], [[1, 0, 1, 0, 1, 0, 1, 0, 1, 0], 1, True]], ['regression [[1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 4, 4, 1]', [[1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 4, 4, 1], [[1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], 1, True]], ['partial-repair [[0, 0, 1, 1, 0, 1, 0, 1, 0, 1], 2, 5, 3]', [[0, 0, 1, 1, 0, 1, 0, 1, 0, 1], 2, 5, 3], [[0, 1, 0, 0, 0, 0, 1, 1, 1, 1], 4, False]], ['control [[1, 1], 3, 1, 1]', [[1, 1], 3, 1, 1], None], ['control [[0, 0, 0, 0, 0, 0], 2, 3, 0]', [[0, 0, 0, 0, 0, 0], 2, 3, 0], [[0, 0, 0, 0, 0, 0], 0, True]], ['control [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 4, 3, 0]', [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 4, 3, 0], [[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], 1, False]], ['control [[1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1], 4, 4, 2]', [[1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1], 4, 4, 2], [[1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1], 2, True]], ['control [[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 2, 6, 1]', [[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 2, 6, 1], [[0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], 1, True]]], [['regression [[0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1], 2, 6, 2]', [[0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1], 2, 6, 2], [[0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1], 4, False]], ['regression [[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0], 6, 2, 2]', [[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0], 6, 2, 2], [[0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0], 1, True]], ['partial-repair [[1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 4, 4, 1]', [[1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 4, 4, 1], [[1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], 1, True]], ['partial-repair [[1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1], 3, 5, 3]', [[1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1], 3, 5, 3], [[1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1], 4, False]], ['control [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 6, 2, 1]', [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 6, 2, 1], [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], 1, True]], ['control [[1, 0, 0], 3, 1, 0]', [[1, 0, 0], 3, 1, 0], [[1, 0, 0], 1, False]], ['control [[1, 1], 3, 1, 1]', [[1, 1], 3, 1, 1], None], ['control [[0, 0, 0, 0, 0, 0], 2, 3, 0]', [[0, 0, 0, 0, 0, 0], 2, 3, 0], [[0, 0, 0, 0, 0, 0], 0, True]]], [['regression [[0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0], 4, 3, 1]', [[0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0], 4, 3, 1], [[0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0], 1, True]], ['regression [[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1], 3, 4, 0]', [[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1], 3, 4, 0], [[0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1], 2, False]], ['partial-repair [[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0], 6, 2, 2]', [[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0], 6, 2, 2], [[0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0], 1, True]], ['partial-repair [[1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], 3, 4, 1]', [[1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], 3, 4, 1], [[1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], 1, True]], ['control [[1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1], 4, 4, 2]', [[1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1], 4, 4, 2], [[1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1], 2, True]], ['control [[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 2, 6, 1]', [[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 2, 6, 1], [[0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], 1, True]], ['control [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 6, 2, 1]', [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 6, 2, 1], [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], 1, True]], ['control [[1, 0, 0], 3, 1, 0]', [[1, 0, 0], 3, 1, 0], [[1, 0, 0], 1, False]]], [['regression [[0, 0, 1, 1, 0, 1, 0, 1, 0, 1], 2, 5, 3]', [[0, 0, 1, 1, 0, 1, 0, 1, 0, 1], 2, 5, 3], [[0, 1, 0, 0, 0, 0, 1, 1, 1, 1], 4, False]], ['regression [[1, 1, 1, 1, 1, 0, 0, 0, 0, 0], 5, 2, 2]', [[1, 1, 1, 1, 1, 0, 0, 0, 0, 0], 5, 2, 2], [[1, 0, 1, 0, 1, 0, 1, 0, 1, 0], 1, True]], ['partial-repair [[1, 1, 1, 1, 1, 1], 2, 3, 3]', [[1, 1, 1, 1, 1, 1], 2, 3, 3], [[1, 1, 1, 1, 1, 1], 3, True]], ['partial-repair [[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1], 3, 4, 0]', [[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1], 3, 4, 0], [[0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1], 2, False]], ['control [[0, 0, 0, 0, 0, 0], 2, 3, 0]', [[0, 0, 0, 0, 0, 0], 2, 3, 0], [[0, 0, 0, 0, 0, 0], 0, True]], ['control [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 4, 3, 0]', [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 4, 3, 0], [[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], 1, False]], ['control [[1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1], 4, 4, 2]', [[1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1], 4, 4, 2], [[1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1], 2, True]], ['control [[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 2, 6, 1]', [[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 2, 6, 1], [[0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], 1, 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)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression [[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1], 3, 4, 0] | [[0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1], 3, False] | [[0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1], 2, False] | Failed |
| regression [[0, 0, 1, 1, 1, 0, 0, 0, 0, 0], 2, 5, 0] | [[0, 1, 1, 0, 0, 0, 1, 0, 0, 0], 2, False] | [[0, 1, 1, 0, 0, 0, 1, 0, 0, 0], 2, False] | Passed |
| partial-repair [[0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1], 3, 4, 2] | [[0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1], 2, True] | [[0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1], 3, False] | Failed |
| control [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 4, 3, 0] | [[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], 1, False] | [[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], 1, False] | Passed |
| control [[1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1], 4, 4, 2] | [[1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1], 2, True] | [[1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1], 2, True] | Passed |
| control [[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 2, 6, 1] | [[0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], 1, True] | [[0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], 1, True] | Passed |
| control [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 6, 2, 1] | [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], 1, True] | [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], 1, True] | Passed |
| control [[1, 0, 0], 3, 1, 0] | [[1, 0, 0], 1, False] | [[1, 0, 0], 1, False] | Passed |
SHA-256 / 194e05b92f41930504522417f93d97b5a45d378f22a638bfbf2077509ef165ce
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(stream, rows, cols, t):
if rows < 1 or cols < 1 or len(stream) != rows * cols:
return None
out = [None] * (rows * cols)
for k, v in enumerate(stream):
col, row = divmod(k, rows)
out[row * cols + col] = v
worst = max(sum(1 for v in out[i * cols:(i + 1) * cols] if v) for i in range(rows))
return [out, worst, worst <= t]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression [[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1], 3, 4, 0]', [[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1], 3, 4, 0], [[0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1], 2, False]], ['regression [[0, 0, 1, 1, 1, 0, 0, 0, 0, 0], 2, 5, 0]', [[0, 0, 1, 1, 1, 0, 0, 0, 0, 0], 2, 5, 0], [[0, 1, 1, 0, 0, 0, 1, 0, 0, 0], 2, False]], ['partial-repair [[0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1], 3, 4, 2]', [[0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1], 3, 4, 2], [[0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1], 3, False]], ['control [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 4, 3, 0]', [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 4, 3, 0], [[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], 1, False]], ['control [[1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1], 4, 4, 2]', [[1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1], 4, 4, 2], [[1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1], 2, True]], ['control [[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 2, 6, 1]', [[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 2, 6, 1], [[0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], 1, True]], ['control [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 6, 2, 1]', [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 6, 2, 1], [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], 1, True]], ['control [[1, 0, 0], 3, 1, 0]', [[1, 0, 0], 3, 1, 0], [[1, 0, 0], 1, False]]], [['regression [[1, 1, 1, 1, 1, 0, 0, 0, 0, 0], 5, 2, 2]', [[1, 1, 1, 1, 1, 0, 0, 0, 0, 0], 5, 2, 2], [[1, 0, 1, 0, 1, 0, 1, 0, 1, 0], 1, True]], ['regression [[1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 4, 4, 1]', [[1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 4, 4, 1], [[1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], 1, True]], ['partial-repair [[0, 0, 1, 1, 0, 1, 0, 1, 0, 1], 2, 5, 3]', [[0, 0, 1, 1, 0, 1, 0, 1, 0, 1], 2, 5, 3], [[0, 1, 0, 0, 0, 0, 1, 1, 1, 1], 4, False]], ['control [[1, 1], 3, 1, 1]', [[1, 1], 3, 1, 1], None], ['control [[0, 0, 0, 0, 0, 0], 2, 3, 0]', [[0, 0, 0, 0, 0, 0], 2, 3, 0], [[0, 0, 0, 0, 0, 0], 0, True]], ['control [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 4, 3, 0]', [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 4, 3, 0], [[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], 1, False]], ['control [[1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1], 4, 4, 2]', [[1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1], 4, 4, 2], [[1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1], 2, True]], ['control [[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 2, 6, 1]', [[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 2, 6, 1], [[0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], 1, True]]], [['regression [[0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1], 2, 6, 2]', [[0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1], 2, 6, 2], [[0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1], 4, False]], ['regression [[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0], 6, 2, 2]', [[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0], 6, 2, 2], [[0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0], 1, True]], ['partial-repair [[1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 4, 4, 1]', [[1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 4, 4, 1], [[1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], 1, True]], ['partial-repair [[1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1], 3, 5, 3]', [[1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1], 3, 5, 3], [[1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1], 4, False]], ['control [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 6, 2, 1]', [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 6, 2, 1], [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], 1, True]], ['control [[1, 0, 0], 3, 1, 0]', [[1, 0, 0], 3, 1, 0], [[1, 0, 0], 1, False]], ['control [[1, 1], 3, 1, 1]', [[1, 1], 3, 1, 1], None], ['control [[0, 0, 0, 0, 0, 0], 2, 3, 0]', [[0, 0, 0, 0, 0, 0], 2, 3, 0], [[0, 0, 0, 0, 0, 0], 0, True]]], [['regression [[0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0], 4, 3, 1]', [[0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0], 4, 3, 1], [[0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0], 1, True]], ['regression [[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1], 3, 4, 0]', [[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1], 3, 4, 0], [[0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1], 2, False]], ['partial-repair [[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0], 6, 2, 2]', [[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0], 6, 2, 2], [[0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0], 1, True]], ['partial-repair [[1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], 3, 4, 1]', [[1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], 3, 4, 1], [[1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], 1, True]], ['control [[1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1], 4, 4, 2]', [[1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1], 4, 4, 2], [[1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1], 2, True]], ['control [[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 2, 6, 1]', [[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 2, 6, 1], [[0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], 1, True]], ['control [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 6, 2, 1]', [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 6, 2, 1], [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], 1, True]], ['control [[1, 0, 0], 3, 1, 0]', [[1, 0, 0], 3, 1, 0], [[1, 0, 0], 1, False]]], [['regression [[0, 0, 1, 1, 0, 1, 0, 1, 0, 1], 2, 5, 3]', [[0, 0, 1, 1, 0, 1, 0, 1, 0, 1], 2, 5, 3], [[0, 1, 0, 0, 0, 0, 1, 1, 1, 1], 4, False]], ['regression [[1, 1, 1, 1, 1, 0, 0, 0, 0, 0], 5, 2, 2]', [[1, 1, 1, 1, 1, 0, 0, 0, 0, 0], 5, 2, 2], [[1, 0, 1, 0, 1, 0, 1, 0, 1, 0], 1, True]], ['partial-repair [[1, 1, 1, 1, 1, 1], 2, 3, 3]', [[1, 1, 1, 1, 1, 1], 2, 3, 3], [[1, 1, 1, 1, 1, 1], 3, True]], ['partial-repair [[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1], 3, 4, 0]', [[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1], 3, 4, 0], [[0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1], 2, False]], ['control [[0, 0, 0, 0, 0, 0], 2, 3, 0]', [[0, 0, 0, 0, 0, 0], 2, 3, 0], [[0, 0, 0, 0, 0, 0], 0, True]], ['control [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 4, 3, 0]', [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 4, 3, 0], [[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], 1, False]], ['control [[1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1], 4, 4, 2]', [[1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1], 4, 4, 2], [[1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1], 2, True]], ['control [[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 2, 6, 1]', [[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 2, 6, 1], [[0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], 1, 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)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression [[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1], 3, 4, 0] | [[0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1], 2, False] | [[0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1], 2, False] | Passed |
| regression [[0, 0, 1, 1, 1, 0, 0, 0, 0, 0], 2, 5, 0] | [[0, 1, 1, 0, 0, 0, 1, 0, 0, 0], 2, False] | [[0, 1, 1, 0, 0, 0, 1, 0, 0, 0], 2, False] | Passed |
| partial-repair [[0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1], 3, 4, 2] | [[0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1], 3, False] | [[0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1], 3, False] | Passed |
| control [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 4, 3, 0] | [[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], 1, False] | [[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], 1, False] | Passed |
| control [[1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1], 4, 4, 2] | [[1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1], 2, True] | [[1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1], 2, True] | Passed |
| control [[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 2, 6, 1] | [[0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], 1, True] | [[0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], 1, True] | Passed |
| control [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 6, 2, 1] | [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], 1, True] | [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], 1, True] | Passed |
| control [[1, 0, 0], 3, 1, 0] | [[1, 0, 0], 1, False] | [[1, 0, 0], 1, False] | Passed |
SHA-256 / a561fd5910958a31fdcaf6854c6418525bbd6a71708aaeade61b37e1d1c72833
Verification & scope
A deterministic, bounded teaching model of the named code under the stated contract; not a production codec. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:48:33.898819+00:00.
Case digest / 7a440e9e08fd0e0c7f3f65a95187d35b0dcd0f46b127ebbb7d9fb120a32f8908