FAILURE MAP
← Case archive

FA-71921 / Error-correcting codes / Open access

Deinterleaver treats exactly t errors as uncorrectable · case 01

Codewords with exactly t errors are reported uncorrectable.

Verified by executionVariant 1 · 8 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The comparison uses worst < t.

VERIFIED REPAIR

A t-error-correcting code corrects up to and including t errors: worst <= t.

Unsuccessful approach: Allowing t + 1 errors overstates the code capability.

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 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 [[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 [[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, 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]], ['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]], ['control [[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, 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]], ['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 [[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, 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, 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]], ['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]], ['partial-repair [[0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1], 3, 5, 2]', [[0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1], 3, 5, 2], [[0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1], 3, False]], ['control [[1, 1], 3, 1, 1]', [[1, 1], 3, 1, 1], None], ['control [[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, 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]], ['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 [[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], 2, 3, 0]', [[0, 0, 0, 0, 0, 0], 2, 3, 0], [[0, 0, 0, 0, 0, 0], 0, True]], ['partial-repair [[1, 0, 0], 3, 1, 0]', [[1, 0, 0], 3, 1, 0], [[1, 0, 0], 1, 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, 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 [[1, 1], 3, 1, 1]', [[1, 1], 3, 1, 1], None], ['control [[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, 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]]], [['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 [[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, 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]], ['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 [[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]], ['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 [[1, 1], 3, 1, 1]', [[1, 1], 3, 1, 1], None], ['control [[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, 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, 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]], ['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]], ['partial-repair [[1, 0, 0], 3, 1, 0]', [[1, 0, 0], 3, 1, 0], [[1, 0, 0], 1, 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]], ['control [[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]], ['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 [[1, 1], 3, 1, 1]', [[1, 1], 3, 1, 1], None]]]
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 fixtureActualExpectedOutcome
regression [[1, 0, 1, 0, 1, 1, 0, 0, 0, 0], 5, 2, 2][[1, 1, 0, 0, 1, 0, 0, 0, 1, 0], 2, False][[1, 1, 0, 0, 1, 0, 0, 0, 1, 0], 2, True]Failed
regression [[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, False][[1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], 1, True]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
partial-repair [[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 [[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
control [[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
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 [[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][[0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1], 4, False]Passed

SHA-256 / 067aa27dba1bbaf2e38d6e0a010d5f280aa41206d0dc69a260e1fd77ed0543e7

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:(i + 1) * cols] if v) for i in range(rows))
    return [out, worst, worst <= t + 1]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['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 [[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, 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]], ['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]], ['control [[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, 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]], ['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 [[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, 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, 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]], ['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]], ['partial-repair [[0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1], 3, 5, 2]', [[0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1], 3, 5, 2], [[0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1], 3, False]], ['control [[1, 1], 3, 1, 1]', [[1, 1], 3, 1, 1], None], ['control [[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, 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]], ['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 [[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], 2, 3, 0]', [[0, 0, 0, 0, 0, 0], 2, 3, 0], [[0, 0, 0, 0, 0, 0], 0, True]], ['partial-repair [[1, 0, 0], 3, 1, 0]', [[1, 0, 0], 3, 1, 0], [[1, 0, 0], 1, 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, 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 [[1, 1], 3, 1, 1]', [[1, 1], 3, 1, 1], None], ['control [[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, 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]]], [['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 [[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, 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]], ['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 [[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]], ['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 [[1, 1], 3, 1, 1]', [[1, 1], 3, 1, 1], None], ['control [[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, 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, 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]], ['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]], ['partial-repair [[1, 0, 0], 3, 1, 0]', [[1, 0, 0], 3, 1, 0], [[1, 0, 0], 1, 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]], ['control [[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]], ['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 [[1, 1], 3, 1, 1]', [[1, 1], 3, 1, 1], None]]]
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 fixtureActualExpectedOutcome
regression [[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
regression [[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
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, True][[0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1], 3, False]Failed
partial-repair [[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, True][[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], 1, False]Failed
control [[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
control [[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
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 [[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][[0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1], 4, False]Passed

SHA-256 / ac4a1e1b55fa095c2f2af5e93a8931392239ec94a30914b9ce87ab28f3718e8f

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 [[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 [[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, 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]], ['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]], ['control [[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, 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]], ['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 [[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, 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, 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]], ['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]], ['partial-repair [[0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1], 3, 5, 2]', [[0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1], 3, 5, 2], [[0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1], 3, False]], ['control [[1, 1], 3, 1, 1]', [[1, 1], 3, 1, 1], None], ['control [[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, 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]], ['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 [[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], 2, 3, 0]', [[0, 0, 0, 0, 0, 0], 2, 3, 0], [[0, 0, 0, 0, 0, 0], 0, True]], ['partial-repair [[1, 0, 0], 3, 1, 0]', [[1, 0, 0], 3, 1, 0], [[1, 0, 0], 1, 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, 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 [[1, 1], 3, 1, 1]', [[1, 1], 3, 1, 1], None], ['control [[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, 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]]], [['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 [[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, 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]], ['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 [[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]], ['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 [[1, 1], 3, 1, 1]', [[1, 1], 3, 1, 1], None], ['control [[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, 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, 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]], ['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]], ['partial-repair [[1, 0, 0], 3, 1, 0]', [[1, 0, 0], 3, 1, 0], [[1, 0, 0], 1, 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]], ['control [[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]], ['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 [[1, 1], 3, 1, 1]', [[1, 1], 3, 1, 1], None]]]
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 fixtureActualExpectedOutcome
regression [[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
regression [[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
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
partial-repair [[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 [[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
control [[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
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 [[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][[0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1], 4, False]Passed

SHA-256 / 1d6263f41a019a7278fd228d6328c3d55eef3e802d7dfa9c9ed4ee245c96fc71

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.981747+00:00.

Case digest / c9379db40c13315156e1f0bed8e5c41778069cbff8bb70c575f0cdf07b9e56d4