FA-71911 / Error-correcting codes / Open access
Deinterleaver splits the stream by row length · case 01
Non-square interleavers put flags in the wrong codewords.
ROOT CAUSE
The transmission index is split with divmod(k, cols); each transmitted column has rows symbols.
VERIFIED REPAIR
Use col, row = divmod(k, rows).
Unsuccessful approach: Reading the stream as row-major (row, col = divmod(k, cols)) skips deinterleaving altogether.
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, cols)
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, 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]], ['regression [[0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0], 4, 3, 2]', [[0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0], 4, 3, 2], [[0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0], 3, False]], ['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 [[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]], ['control [[1, 0, 1, 0, 1, 1, 0, 0, 0, 0], 5, 2, 2]', [[1, 0, 1, 0, 1, 1, 0, 0, 0, 0], 5, 2, 2], [[1, 1, 0, 0, 1, 0, 0, 0, 1, 0], 2, True]], ['control [[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]], ['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]]], [['regression [[1, 0, 1, 0, 1, 1, 0, 0, 0, 0], 5, 2, 2]', [[1, 0, 1, 0, 1, 1, 0, 0, 0, 0], 5, 2, 2], [[1, 1, 0, 0, 1, 0, 0, 0, 1, 0], 2, True]], ['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]], ['control [[1, 1], 3, 1, 1]', [[1, 1], 3, 1, 1], None], ['control [[1, 0, 0], 3, 1, 0]', [[1, 0, 0], 3, 1, 0], [[1, 0, 0], 1, 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 [[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]], ['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]]], [['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, 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]], ['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 [[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, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0], 4, 3, 2]', [[0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0], 4, 3, 2], [[0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0], 3, False]], ['control [[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, 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, 0, 1, 0, 1, 1, 0, 0, 0, 0], 5, 2, 2]', [[1, 0, 1, 0, 1, 1, 0, 0, 0, 0], 5, 2, 2], [[1, 1, 0, 0, 1, 0, 0, 0, 1, 0], 2, True]], ['partial-repair [[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]], ['partial-repair [[0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0], 4, 3, 2]', [[0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0], 4, 3, 2], [[0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0], 3, False]], ['control [[1, 1], 3, 1, 1]', [[1, 1], 3, 1, 1], None], ['control [[1, 0, 0], 3, 1, 0]', [[1, 0, 0], 3, 1, 0], [[1, 0, 0], 1, False]], ['control [[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]], ['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]]], [['regression [[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]], ['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]], ['partial-repair [[1, 0, 1, 0, 1, 1, 0, 0, 0, 0], 5, 2, 2]', [[1, 0, 1, 0, 1, 1, 0, 0, 0, 0], 5, 2, 2], [[1, 1, 0, 0, 1, 0, 0, 0, 1, 0], 2, 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]], ['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, 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 [[0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0], 4, 3, 2]', [[0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0], 4, 3, 2], [[0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0], 3, 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)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 4, 3, 0] | [[0, 0, 0, 0, 0, 0, 0, 1, 0, 0, None, None], 1, False] | [[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], 1, False] | Failed |
| regression [[0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0], 4, 3, 2] | [[0, 1, 0, 1, 1, 0, 0, 1, 1, 0, None, None], 2, True] | [[0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0], 3, False] | Failed |
| control [[1, 0, 0], 3, 1, 0] | [[1, 0, 0], 1, False] | [[1, 0, 0], 1, False] | Passed |
| control [[1, 1], 3, 1, 1] | None | None | Passed |
| control [[1, 1, 1, 1, 1, 0, 0, 0, 0, 0], 5, 2, 2] | [[1, 1, 1, 0, 0, 0, 0, None, None, None], 2, True] | [[1, 0, 1, 0, 1, 0, 1, 0, 1, 0], 1, True] | Failed |
| control [[1, 0, 1, 0, 1, 1, 0, 0, 0, 0], 5, 2, 2] | [[1, 1, 1, 0, 0, 0, 0, None, None, None], 2, True] | [[1, 1, 0, 0, 1, 0, 0, 0, 1, 0], 2, True] | Failed |
| control [[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] | [[1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], 1, True] | 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 |
SHA-256 / 51a252dbf5b76ac5ff4286a066ff903659090d7a9682c3eb013afafb8811b806
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):
row, col = divmod(k, cols)
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, 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]], ['regression [[0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0], 4, 3, 2]', [[0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0], 4, 3, 2], [[0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0], 3, False]], ['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 [[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]], ['control [[1, 0, 1, 0, 1, 1, 0, 0, 0, 0], 5, 2, 2]', [[1, 0, 1, 0, 1, 1, 0, 0, 0, 0], 5, 2, 2], [[1, 1, 0, 0, 1, 0, 0, 0, 1, 0], 2, True]], ['control [[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]], ['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]]], [['regression [[1, 0, 1, 0, 1, 1, 0, 0, 0, 0], 5, 2, 2]', [[1, 0, 1, 0, 1, 1, 0, 0, 0, 0], 5, 2, 2], [[1, 1, 0, 0, 1, 0, 0, 0, 1, 0], 2, True]], ['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]], ['control [[1, 1], 3, 1, 1]', [[1, 1], 3, 1, 1], None], ['control [[1, 0, 0], 3, 1, 0]', [[1, 0, 0], 3, 1, 0], [[1, 0, 0], 1, 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 [[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]], ['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]]], [['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, 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]], ['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 [[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, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0], 4, 3, 2]', [[0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0], 4, 3, 2], [[0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0], 3, False]], ['control [[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, 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, 0, 1, 0, 1, 1, 0, 0, 0, 0], 5, 2, 2]', [[1, 0, 1, 0, 1, 1, 0, 0, 0, 0], 5, 2, 2], [[1, 1, 0, 0, 1, 0, 0, 0, 1, 0], 2, True]], ['partial-repair [[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]], ['partial-repair [[0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0], 4, 3, 2]', [[0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0], 4, 3, 2], [[0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0], 3, False]], ['control [[1, 1], 3, 1, 1]', [[1, 1], 3, 1, 1], None], ['control [[1, 0, 0], 3, 1, 0]', [[1, 0, 0], 3, 1, 0], [[1, 0, 0], 1, False]], ['control [[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]], ['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]]], [['regression [[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]], ['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]], ['partial-repair [[1, 0, 1, 0, 1, 1, 0, 0, 0, 0], 5, 2, 2]', [[1, 0, 1, 0, 1, 1, 0, 0, 0, 0], 5, 2, 2], [[1, 1, 0, 0, 1, 0, 0, 0, 1, 0], 2, 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]], ['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, 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 [[0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0], 4, 3, 2]', [[0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0], 4, 3, 2], [[0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0], 3, 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)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression [[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], 1, False] | [[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], 1, False] | Failed |
| regression [[0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0], 4, 3, 2] | [[0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0], 3, False] | [[0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0], 3, False] | Failed |
| control [[1, 0, 0], 3, 1, 0] | [[1, 0, 0], 1, False] | [[1, 0, 0], 1, False] | Passed |
| control [[1, 1], 3, 1, 1] | None | None | Passed |
| control [[1, 1, 1, 1, 1, 0, 0, 0, 0, 0], 5, 2, 2] | [[1, 1, 1, 1, 1, 0, 0, 0, 0, 0], 2, True] | [[1, 0, 1, 0, 1, 0, 1, 0, 1, 0], 1, True] | Failed |
| control [[1, 0, 1, 0, 1, 1, 0, 0, 0, 0], 5, 2, 2] | [[1, 0, 1, 0, 1, 1, 0, 0, 0, 0], 2, True] | [[1, 1, 0, 0, 1, 0, 0, 0, 1, 0], 2, True] | Failed |
| control [[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], 3, False] | [[1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], 1, True] | Failed |
| 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], 2, True] | [[1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1], 2, True] | Failed |
SHA-256 / be1f598f9749320811569698f9a62b1a68173adaf99a6ba2930ec8958e192e9f
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, 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]], ['regression [[0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0], 4, 3, 2]', [[0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0], 4, 3, 2], [[0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0], 3, False]], ['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 [[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]], ['control [[1, 0, 1, 0, 1, 1, 0, 0, 0, 0], 5, 2, 2]', [[1, 0, 1, 0, 1, 1, 0, 0, 0, 0], 5, 2, 2], [[1, 1, 0, 0, 1, 0, 0, 0, 1, 0], 2, True]], ['control [[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]], ['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]]], [['regression [[1, 0, 1, 0, 1, 1, 0, 0, 0, 0], 5, 2, 2]', [[1, 0, 1, 0, 1, 1, 0, 0, 0, 0], 5, 2, 2], [[1, 1, 0, 0, 1, 0, 0, 0, 1, 0], 2, True]], ['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]], ['control [[1, 1], 3, 1, 1]', [[1, 1], 3, 1, 1], None], ['control [[1, 0, 0], 3, 1, 0]', [[1, 0, 0], 3, 1, 0], [[1, 0, 0], 1, 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 [[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]], ['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]]], [['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, 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]], ['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 [[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, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0], 4, 3, 2]', [[0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0], 4, 3, 2], [[0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0], 3, False]], ['control [[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, 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, 0, 1, 0, 1, 1, 0, 0, 0, 0], 5, 2, 2]', [[1, 0, 1, 0, 1, 1, 0, 0, 0, 0], 5, 2, 2], [[1, 1, 0, 0, 1, 0, 0, 0, 1, 0], 2, True]], ['partial-repair [[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]], ['partial-repair [[0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0], 4, 3, 2]', [[0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0], 4, 3, 2], [[0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0], 3, False]], ['control [[1, 1], 3, 1, 1]', [[1, 1], 3, 1, 1], None], ['control [[1, 0, 0], 3, 1, 0]', [[1, 0, 0], 3, 1, 0], [[1, 0, 0], 1, False]], ['control [[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]], ['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]]], [['regression [[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]], ['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]], ['partial-repair [[1, 0, 1, 0, 1, 1, 0, 0, 0, 0], 5, 2, 2]', [[1, 0, 1, 0, 1, 1, 0, 0, 0, 0], 5, 2, 2], [[1, 1, 0, 0, 1, 0, 0, 0, 1, 0], 2, 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]], ['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, 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 [[0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0], 4, 3, 2]', [[0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0], 4, 3, 2], [[0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0], 3, 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)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression [[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 |
| regression [[0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0], 4, 3, 2] | [[0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0], 3, False] | [[0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0], 3, False] | Passed |
| control [[1, 0, 0], 3, 1, 0] | [[1, 0, 0], 1, False] | [[1, 0, 0], 1, False] | Passed |
| control [[1, 1], 3, 1, 1] | None | None | Passed |
| control [[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] | [[1, 0, 1, 0, 1, 0, 1, 0, 1, 0], 1, True] | Passed |
| control [[1, 0, 1, 0, 1, 1, 0, 0, 0, 0], 5, 2, 2] | [[1, 1, 0, 0, 1, 0, 0, 0, 1, 0], 2, True] | [[1, 1, 0, 0, 1, 0, 0, 0, 1, 0], 2, True] | Passed |
| control [[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] | [[1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], 1, True] | 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 |
SHA-256 / d6db1a5b08d4a8954f1e8d2756d8a92d8d05b591fe2846b7a9b6abbd9e9bc761
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.815646+00:00.
Case digest / c956d94eeec34a09fc0190fd4f5a95a104e0c3c32ce238bf97e426bdb14fbfb2