broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(codes, width, invert_sign):
    mask=(1<<(width-1))-1
    sign=1<<(width-1)
    values=[]
    zeros=[]
    for code in codes:
        magnitude=code&mask
        negative=bool(code&sign)^invert_sign
        values.append(-magnitude if negative else magnitude)
        zeros.append(bool(negative and code==0))
    return [values,zeros]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([0, 1, 7, 8, 9, 15], 4, False)), [[0, 1, 7, 0, -1, -7], [False, False, False, True, False, False]])
check('oracle 2', solve(*([0, 8, 1, 9], 4, True)), [[0, 0, -1, 1], [True, False, False, False]])
check('oracle 3', solve(*([], 4, False)), [[], []])
check('oracle 4', solve(*([0, 3, 4, 7], 3, False)), [[0, 3, 0, -3], [False, False, True, False]])
check('oracle 5', solve(*([0, 128, 255, 127], 8, False)), [[0, 0, -127, 127], [False, True, False, False]])
check('oracle 6', solve(*([1, 2, 3], 4, True)), [[-1, -2, -3], [False, False, False]])
check('oracle 7', solve(*([0, 4], 3, True)), [[0, 0], [True, False]])
if N == 1: check('variant packet 1', solve(*[[0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15], 4, False]), [[0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7], [False, False, False, True, False, False, False, False, False, True, False, False]])
if N == 2: check('variant packet 2', solve(*[[0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15], 4, False]), [[0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7], [False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False]])
if N == 3: check('variant packet 3', solve(*[[0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15], 4, False]), [[0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7], [False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False]])
if N == 4: check('variant packet 4', solve(*[[0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15], 4, False]), [[0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7], [False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False]])
if N == 5: check('variant packet 5', solve(*[[0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15], 4, False]), [[0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7], [False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False]])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(codes, width, invert_sign):
    mask=(1<<(width-1))-1
    sign=1<<(width-1)
    values=[]
    zeros=[]
    for code in codes:
        magnitude=code&mask
        negative=bool(code&sign)^invert_sign
        values.append(-magnitude if negative else magnitude)
        zeros.append(bool(magnitude==0))
    return [values,zeros]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([0, 1, 7, 8, 9, 15], 4, False)), [[0, 1, 7, 0, -1, -7], [False, False, False, True, False, False]])
check('oracle 2', solve(*([0, 8, 1, 9], 4, True)), [[0, 0, -1, 1], [True, False, False, False]])
check('oracle 3', solve(*([], 4, False)), [[], []])
check('oracle 4', solve(*([0, 3, 4, 7], 3, False)), [[0, 3, 0, -3], [False, False, True, False]])
check('oracle 5', solve(*([0, 128, 255, 127], 8, False)), [[0, 0, -127, 127], [False, True, False, False]])
check('oracle 6', solve(*([1, 2, 3], 4, True)), [[-1, -2, -3], [False, False, False]])
check('oracle 7', solve(*([0, 4], 3, True)), [[0, 0], [True, False]])
if N == 1: check('variant packet 1', solve(*[[0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15], 4, False]), [[0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7], [False, False, False, True, False, False, False, False, False, True, False, False]])
if N == 2: check('variant packet 2', solve(*[[0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15], 4, False]), [[0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7], [False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False]])
if N == 3: check('variant packet 3', solve(*[[0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15], 4, False]), [[0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7], [False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False]])
if N == 4: check('variant packet 4', solve(*[[0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15], 4, False]), [[0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7], [False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False]])
if N == 5: check('variant packet 5', solve(*[[0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15], 4, False]), [[0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7], [False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False]])
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)

prompt:
The negative-zero marker tests the complete signed code for zero.

Decode sign-magnitude PCM with configurable physical sign-bit polarity and preserve numerical negative zero as a Boolean sideband.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(codes, width, invert_sign):
    mask=(1<<(width-1))-1
    sign=1<<width
    values=[]
    zeros=[]
    for code in codes:
        magnitude=code&mask
        negative=bool(code&sign)^invert_sign
        values.append(-magnitude if negative else magnitude)
        zeros.append(bool(negative and magnitude==0))
    return [values,zeros]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([0, 1, 7, 8, 9, 15], 4, False)), [[0, 1, 7, 0, -1, -7], [False, False, False, True, False, False]])
check('oracle 2', solve(*([0, 8, 1, 9], 4, True)), [[0, 0, -1, 1], [True, False, False, False]])
check('oracle 3', solve(*([], 4, False)), [[], []])
check('oracle 4', solve(*([0, 3, 4, 7], 3, False)), [[0, 3, 0, -3], [False, False, True, False]])
check('oracle 5', solve(*([0, 128, 255, 127], 8, False)), [[0, 0, -127, 127], [False, True, False, False]])
check('oracle 6', solve(*([1, 2, 3], 4, True)), [[-1, -2, -3], [False, False, False]])
check('oracle 7', solve(*([0, 4], 3, True)), [[0, 0], [True, False]])
if N == 1: check('variant packet 1', solve(*[[0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15], 4, False]), [[0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7], [False, False, False, True, False, False, False, False, False, True, False, False]])
if N == 2: check('variant packet 2', solve(*[[0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15], 4, False]), [[0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7], [False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False]])
if N == 3: check('variant packet 3', solve(*[[0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15], 4, False]), [[0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7], [False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False]])
if N == 4: check('variant packet 4', solve(*[[0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15], 4, False]), [[0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7], [False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False]])
if N == 5: check('variant packet 5', solve(*[[0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15], 4, False]), [[0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7], [False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False]])
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)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(codes, width, invert_sign):
    mask=(1<<(width-1))-1
    sign=1
    values=[]
    zeros=[]
    for code in codes:
        magnitude=code&mask
        negative=bool(code&sign)^invert_sign
        values.append(-magnitude if negative else magnitude)
        zeros.append(bool(negative and magnitude==0))
    return [values,zeros]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([0, 1, 7, 8, 9, 15], 4, False)), [[0, 1, 7, 0, -1, -7], [False, False, False, True, False, False]])
check('oracle 2', solve(*([0, 8, 1, 9], 4, True)), [[0, 0, -1, 1], [True, False, False, False]])
check('oracle 3', solve(*([], 4, False)), [[], []])
check('oracle 4', solve(*([0, 3, 4, 7], 3, False)), [[0, 3, 0, -3], [False, False, True, False]])
check('oracle 5', solve(*([0, 128, 255, 127], 8, False)), [[0, 0, -127, 127], [False, True, False, False]])
check('oracle 6', solve(*([1, 2, 3], 4, True)), [[-1, -2, -3], [False, False, False]])
check('oracle 7', solve(*([0, 4], 3, True)), [[0, 0], [True, False]])
if N == 1: check('variant packet 1', solve(*[[0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15], 4, False]), [[0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7], [False, False, False, True, False, False, False, False, False, True, False, False]])
if N == 2: check('variant packet 2', solve(*[[0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15], 4, False]), [[0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7], [False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False]])
if N == 3: check('variant packet 3', solve(*[[0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15], 4, False]), [[0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7], [False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False]])
if N == 4: check('variant packet 4', solve(*[[0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15], 4, False]), [[0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7], [False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False]])
if N == 5: check('variant packet 5', solve(*[[0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15, 0, 1, 7, 8, 9, 15], 4, False]), [[0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7, 0, 1, 7, 0, -1, -7], [False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False, False, False, False, True, False, False]])
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)

prompt:
The sign bit is read beyond the PCM field.

Decode sign-magnitude PCM with configurable physical sign-bit polarity and preserve numerical negative zero as a Boolean sideband.

split: open-access


prompt:
The companded wire complement is omitted.

Decode eight-bit mu-law codewords using complement, three-bit segment, four-bit mantissa and reconstruction bias132; return signed integer PCM amplitudes.

split: open-access


prompt:
Mantissa contribution has the wrong reconstruction weight.

Decode eight-bit mu-law codewords using complement, three-bit segment, four-bit mantissa and reconstruction bias132; return signed integer PCM amplitudes.

split: open-access


prompt:
The segment shift is applied only to bias, not mantissa.

Decode eight-bit mu-law codewords using complement, three-bit segment, four-bit mantissa and reconstruction bias132; return signed integer PCM amplitudes.

split: open-access


prompt:
Reconstructed mu-law amplitude retains its encoding bias.

Decode eight-bit mu-law codewords using complement, three-bit segment, four-bit mantissa and reconstruction bias132; return signed integer PCM amplitudes.

split: open-access


prompt:
Segment extraction includes a mantissa bit.

Decode eight-bit mu-law codewords using complement, three-bit segment, four-bit mantissa and reconstruction bias132; return signed integer PCM amplitudes.

split: open-access


prompt:
Alternating transmission bits are left toggled in A-law decode.

Decode eight-bit A-law codes into signed integer PCM using alternating-bit mask85, midpoint reconstruction and explicit segment rules.

split: open-access


prompt:
The reconstruction midpoint is omitted in the lowest segment.

Decode eight-bit A-law codes into signed integer PCM using alternating-bit mask85, midpoint reconstruction and explicit segment rules.

split: open-access


prompt:
The first expanded segment omits its fixed offset.

Decode eight-bit A-law codes into signed integer PCM using alternating-bit mask85, midpoint reconstruction and explicit segment rules.

split: open-access


prompt:
Higher A-law segments receive one extra shift.

Decode eight-bit A-law codes into signed integer PCM using alternating-bit mask85, midpoint reconstruction and explicit segment rules.

split: open-access


prompt:
A-law polarity uses the opposite convention from the decoder.

Decode eight-bit A-law codes into signed integer PCM using alternating-bit mask85, midpoint reconstruction and explicit segment rules.

split: open-access


prompt:
Invalid wire values wrap into in-range amplitudes.

Recenter bounded unsigned PCM around an explicitly calibrated zero code and report asymmetric representable headroom; clamp invalid code inputs before recentering.

split: open-access


prompt:
A calibrated PCM zero code is replaced by a hard-coded midpoint.

Recenter bounded unsigned PCM around an explicitly calibrated zero code and report asymmetric representable headroom; clamp invalid code inputs before recentering.

split: open-access


prompt:
Negative available amplitude is inferred from positive headroom.

Recenter bounded unsigned PCM around an explicitly calibrated zero code and report asymmetric representable headroom; clamp invalid code inputs before recentering.

split: open-access


prompt:
Positive headroom is confused with the silence code.

Recenter bounded unsigned PCM around an explicitly calibrated zero code and report asymmetric representable headroom; clamp invalid code inputs before recentering.

split: open-access


prompt:
The invalid code just beyond the field is treated as a valid endpoint.

Recenter bounded unsigned PCM around an explicitly calibrated zero code and report asymmetric representable headroom; clamp invalid code inputs before recentering.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(codes, width, xor_mask):
    field=(1<<width)-1
    out=[]
    for raw in codes:
        code=(raw|xor_mask)&field
        sign=1<<(width-1)
        value=code-(1<<width) if code&sign else code
        out.append([value, code==0])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([0, 3, 7, 8, 15], 4, 5)), [[5, False], [6, False], [2, False], [-3, False], [-6, False]])
check('oracle 2', solve(*([8, 0, 15], 4, 8)), [[0, True], [-8, False], [7, False]])
check('oracle 3', solve(*([16, 31, 0], 4, 32)), [[0, True], [-1, False], [0, True]])
check('oracle 4', solve(*([0, 255], 8, 85)), [[85, False], [-86, False]])
check('oracle 5', solve(*([], 3, 7)), [])
check('oracle 6', solve(*([0, 1], 1, 1)), [[-1, False], [0, True]])
check('oracle 7', solve(*([3, 4, 7], 3, 2)), [[1, False], [-2, False], [-3, False]])
if N == 1: check('variant packet 1', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 2: check('variant packet 2', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 3: check('variant packet 3', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 4: check('variant packet 4', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 5: check('variant packet 5', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(codes, width, xor_mask):
    field=(1<<width)-1
    out=[]
    for raw in codes:
        code=(raw&xor_mask)&field
        sign=1<<(width-1)
        value=code-(1<<width) if code&sign else code
        out.append([value, code==0])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([0, 3, 7, 8, 15], 4, 5)), [[5, False], [6, False], [2, False], [-3, False], [-6, False]])
check('oracle 2', solve(*([8, 0, 15], 4, 8)), [[0, True], [-8, False], [7, False]])
check('oracle 3', solve(*([16, 31, 0], 4, 32)), [[0, True], [-1, False], [0, True]])
check('oracle 4', solve(*([0, 255], 8, 85)), [[85, False], [-86, False]])
check('oracle 5', solve(*([], 3, 7)), [])
check('oracle 6', solve(*([0, 1], 1, 1)), [[-1, False], [0, True]])
check('oracle 7', solve(*([3, 4, 7], 3, 2)), [[1, False], [-2, False], [-3, False]])
if N == 1: check('variant packet 1', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 2: check('variant packet 2', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 3: check('variant packet 3', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 4: check('variant packet 4', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 5: check('variant packet 5', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
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)

prompt:
A hardware line-inversion map is applied as a bit-set mask.

Undo a per-line XOR inversion map within a signed PCM field before interpreting sign and detecting canonical zero.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(codes, width, xor_mask):
    field=(1<<width)-1
    out=[]
    for raw in codes:
        code=(raw&field)^xor_mask
        sign=1<<(width-1)
        value=code-(1<<width) if code&sign else code
        out.append([value, code==0])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([0, 3, 7, 8, 15], 4, 5)), [[5, False], [6, False], [2, False], [-3, False], [-6, False]])
check('oracle 2', solve(*([8, 0, 15], 4, 8)), [[0, True], [-8, False], [7, False]])
check('oracle 3', solve(*([16, 31, 0], 4, 32)), [[0, True], [-1, False], [0, True]])
check('oracle 4', solve(*([0, 255], 8, 85)), [[85, False], [-86, False]])
check('oracle 5', solve(*([], 3, 7)), [])
check('oracle 6', solve(*([0, 1], 1, 1)), [[-1, False], [0, True]])
check('oracle 7', solve(*([3, 4, 7], 3, 2)), [[1, False], [-2, False], [-3, False]])
if N == 1: check('variant packet 1', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 2: check('variant packet 2', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 3: check('variant packet 3', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 4: check('variant packet 4', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 5: check('variant packet 5', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(codes, width, xor_mask):
    field=(1<<width)-1
    out=[]
    for raw in codes:
        code=raw^(xor_mask&field)
        sign=1<<(width-1)
        value=code-(1<<width) if code&sign else code
        out.append([value, code==0])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([0, 3, 7, 8, 15], 4, 5)), [[5, False], [6, False], [2, False], [-3, False], [-6, False]])
check('oracle 2', solve(*([8, 0, 15], 4, 8)), [[0, True], [-8, False], [7, False]])
check('oracle 3', solve(*([16, 31, 0], 4, 32)), [[0, True], [-1, False], [0, True]])
check('oracle 4', solve(*([0, 255], 8, 85)), [[85, False], [-86, False]])
check('oracle 5', solve(*([], 3, 7)), [])
check('oracle 6', solve(*([0, 1], 1, 1)), [[-1, False], [0, True]])
check('oracle 7', solve(*([3, 4, 7], 3, 2)), [[1, False], [-2, False], [-3, False]])
if N == 1: check('variant packet 1', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 2: check('variant packet 2', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 3: check('variant packet 3', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 4: check('variant packet 4', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 5: check('variant packet 5', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
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)

prompt:
Out-of-field inversion-mask bits survive field extraction.

Undo a per-line XOR inversion map within a signed PCM field before interpreting sign and detecting canonical zero.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(codes, width, xor_mask):
    field=(1<<width)-1
    out=[]
    for raw in codes:
        code=(raw^xor_mask)&field
        sign=1<<(width-1)
        value=code-(1<<width) if code&sign else code
        out.append([value, raw==0])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([0, 3, 7, 8, 15], 4, 5)), [[5, False], [6, False], [2, False], [-3, False], [-6, False]])
check('oracle 2', solve(*([8, 0, 15], 4, 8)), [[0, True], [-8, False], [7, False]])
check('oracle 3', solve(*([16, 31, 0], 4, 32)), [[0, True], [-1, False], [0, True]])
check('oracle 4', solve(*([0, 255], 8, 85)), [[85, False], [-86, False]])
check('oracle 5', solve(*([], 3, 7)), [])
check('oracle 6', solve(*([0, 1], 1, 1)), [[-1, False], [0, True]])
check('oracle 7', solve(*([3, 4, 7], 3, 2)), [[1, False], [-2, False], [-3, False]])
if N == 1: check('variant packet 1', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 2: check('variant packet 2', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 3: check('variant packet 3', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 4: check('variant packet 4', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 5: check('variant packet 5', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(codes, width, xor_mask):
    field=(1<<width)-1
    out=[]
    for raw in codes:
        code=(raw^xor_mask)&field
        sign=1<<(width-1)
        value=code-(1<<width) if code&sign else code
        out.append([value, code==xor_mask])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([0, 3, 7, 8, 15], 4, 5)), [[5, False], [6, False], [2, False], [-3, False], [-6, False]])
check('oracle 2', solve(*([8, 0, 15], 4, 8)), [[0, True], [-8, False], [7, False]])
check('oracle 3', solve(*([16, 31, 0], 4, 32)), [[0, True], [-1, False], [0, True]])
check('oracle 4', solve(*([0, 255], 8, 85)), [[85, False], [-86, False]])
check('oracle 5', solve(*([], 3, 7)), [])
check('oracle 6', solve(*([0, 1], 1, 1)), [[-1, False], [0, True]])
check('oracle 7', solve(*([3, 4, 7], 3, 2)), [[1, False], [-2, False], [-3, False]])
if N == 1: check('variant packet 1', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 2: check('variant packet 2', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 3: check('variant packet 3', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 4: check('variant packet 4', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 5: check('variant packet 5', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
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)

prompt:
Silence detection uses the encoded electrical bits.

Undo a per-line XOR inversion map within a signed PCM field before interpreting sign and detecting canonical zero.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(codes, width, xor_mask):
    field=(1<<width)-1
    out=[]
    for raw in codes:
        code=(raw^xor_mask)&field
        sign=1<<(width-1)
        value=code-(1<<width) if raw&sign else code
        out.append([value, code==0])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([0, 3, 7, 8, 15], 4, 5)), [[5, False], [6, False], [2, False], [-3, False], [-6, False]])
check('oracle 2', solve(*([8, 0, 15], 4, 8)), [[0, True], [-8, False], [7, False]])
check('oracle 3', solve(*([16, 31, 0], 4, 32)), [[0, True], [-1, False], [0, True]])
check('oracle 4', solve(*([0, 255], 8, 85)), [[85, False], [-86, False]])
check('oracle 5', solve(*([], 3, 7)), [])
check('oracle 6', solve(*([0, 1], 1, 1)), [[-1, False], [0, True]])
check('oracle 7', solve(*([3, 4, 7], 3, 2)), [[1, False], [-2, False], [-3, False]])
if N == 1: check('variant packet 1', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 2: check('variant packet 2', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 3: check('variant packet 3', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 4: check('variant packet 4', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 5: check('variant packet 5', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(codes, width, xor_mask):
    field=(1<<width)-1
    out=[]
    for raw in codes:
        code=(raw^xor_mask)&field
        sign=1<<(width-1)
        value=code-(1<<width) if xor_mask&sign else code
        out.append([value, code==0])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([0, 3, 7, 8, 15], 4, 5)), [[5, False], [6, False], [2, False], [-3, False], [-6, False]])
check('oracle 2', solve(*([8, 0, 15], 4, 8)), [[0, True], [-8, False], [7, False]])
check('oracle 3', solve(*([16, 31, 0], 4, 32)), [[0, True], [-1, False], [0, True]])
check('oracle 4', solve(*([0, 255], 8, 85)), [[85, False], [-86, False]])
check('oracle 5', solve(*([], 3, 7)), [])
check('oracle 6', solve(*([0, 1], 1, 1)), [[-1, False], [0, True]])
check('oracle 7', solve(*([3, 4, 7], 3, 2)), [[1, False], [-2, False], [-3, False]])
if N == 1: check('variant packet 1', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 2: check('variant packet 2', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 3: check('variant packet 3', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 4: check('variant packet 4', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 5: check('variant packet 5', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
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)

prompt:
Sign is tested before the sign line is uninverted.

Undo a per-line XOR inversion map within a signed PCM field before interpreting sign and detecting canonical zero.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(codes, width, xor_mask):
    field=(1<<width)
    out=[]
    for raw in codes:
        code=(raw^xor_mask)&field
        sign=1<<(width-1)
        value=code-(1<<width) if code&sign else code
        out.append([value, code==0])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([0, 3, 7, 8, 15], 4, 5)), [[5, False], [6, False], [2, False], [-3, False], [-6, False]])
check('oracle 2', solve(*([8, 0, 15], 4, 8)), [[0, True], [-8, False], [7, False]])
check('oracle 3', solve(*([16, 31, 0], 4, 32)), [[0, True], [-1, False], [0, True]])
check('oracle 4', solve(*([0, 255], 8, 85)), [[85, False], [-86, False]])
check('oracle 5', solve(*([], 3, 7)), [])
check('oracle 6', solve(*([0, 1], 1, 1)), [[-1, False], [0, True]])
check('oracle 7', solve(*([3, 4, 7], 3, 2)), [[1, False], [-2, False], [-3, False]])
if N == 1: check('variant packet 1', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 2: check('variant packet 2', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 3: check('variant packet 3', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 4: check('variant packet 4', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 5: check('variant packet 5', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(codes, width, xor_mask):
    field=(1<<(width-1))-1
    out=[]
    for raw in codes:
        code=(raw^xor_mask)&field
        sign=1<<(width-1)
        value=code-(1<<width) if code&sign else code
        out.append([value, code==0])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([0, 3, 7, 8, 15], 4, 5)), [[5, False], [6, False], [2, False], [-3, False], [-6, False]])
check('oracle 2', solve(*([8, 0, 15], 4, 8)), [[0, True], [-8, False], [7, False]])
check('oracle 3', solve(*([16, 31, 0], 4, 32)), [[0, True], [-1, False], [0, True]])
check('oracle 4', solve(*([0, 255], 8, 85)), [[85, False], [-86, False]])
check('oracle 5', solve(*([], 3, 7)), [])
check('oracle 6', solve(*([0, 1], 1, 1)), [[-1, False], [0, True]])
check('oracle 7', solve(*([3, 4, 7], 3, 2)), [[1, False], [-2, False], [-3, False]])
if N == 1: check('variant packet 1', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 2: check('variant packet 2', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 3: check('variant packet 3', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 4: check('variant packet 4', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
if N == 5: check('variant packet 5', solve(*[[0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15, 0, 3, 7, 8, 15], 4, 5]), [[5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False], [5, False], [6, False], [2, False], [-3, False], [-6, False]])
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)

prompt:
A single boundary bit is used where a contiguous field mask is required.

Undo a per-line XOR inversion map within a signed PCM field before interpreting sign and detecting canonical zero.

split: open-access


prompt:
A hardware byte-lane map is sorted instead of honored.

Repack each fixed-size sample container using an explicit byte-lane map, retain duplicate selections and validate only declared zero-pad lanes.

split: open-access


prompt:
Repeated byte-lane entries are deduplicated despite explicit replicated-byte conversion.

Repack each fixed-size sample container using an explicit byte-lane map, retain duplicate selections and validate only declared zero-pad lanes.

split: open-access


prompt:
Pad validation examines selected sample bytes.

Repack each fixed-size sample container using an explicit byte-lane map, retain duplicate selections and validate only declared zero-pad lanes.

split: open-access


prompt:
One clean pad lane hides contamination elsewhere.

Repack each fixed-size sample container using an explicit byte-lane map, retain duplicate selections and validate only declared zero-pad lanes.

split: open-access


prompt:
Converted sample width is reported as input container width.

Repack each fixed-size sample container using an explicit byte-lane map, retain duplicate selections and validate only declared zero-pad lanes.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(planes, samples, width):
    out=[0]*samples
    for bit,plane in enumerate(planes[:width]):
        for i in range(samples):
            value=(plane>>i)&1
            out[i]|=value<<(width-1-bit)
    sign=1<<(width-1)
    return [x-(1<<width) if x&sign else x for x in out]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([5, 6, 3], 3, 3)), [-3, -2, 3])
check('oracle 2', solve(*([1, 2, 4, 7], 3, 3)), [1, 2, -4])
check('oracle 3', solve(*([0, 0, 7], 3, 3)), [-4, -4, -4])
check('oracle 4', solve(*([3, 0], 2, 2)), [1, 1])
check('oracle 5', solve(*([], 0, 4)), [])
check('oracle 6', solve(*([1], 1, 1)), [-1])
check('oracle 7', solve(*([0, 1, 0, 0], 1, 3)), [2])
if N == 1: check('variant packet 1', solve(*[[5, 6, 3], 4, 3]), [-3, -2, 3, 0])
if N == 2: check('variant packet 2', solve(*[[5, 6, 3], 5, 3]), [-3, -2, 3, 0, 0])
if N == 3: check('variant packet 3', solve(*[[5, 6, 3], 6, 3]), [-3, -2, 3, 0, 0, 0])
if N == 4: check('variant packet 4', solve(*[[5, 6, 3], 7, 3]), [-3, -2, 3, 0, 0, 0, 0])
if N == 5: check('variant packet 5', solve(*[[5, 6, 3], 8, 3]), [-3, -2, 3, 0, 0, 0, 0, 0])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(planes, samples, width):
    out=[0]*samples
    for bit,plane in enumerate(planes[:width]):
        for i in range(samples):
            value=(plane>>i)&1
            out[i]|=value
    sign=1<<(width-1)
    return [x-(1<<width) if x&sign else x for x in out]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([5, 6, 3], 3, 3)), [-3, -2, 3])
check('oracle 2', solve(*([1, 2, 4, 7], 3, 3)), [1, 2, -4])
check('oracle 3', solve(*([0, 0, 7], 3, 3)), [-4, -4, -4])
check('oracle 4', solve(*([3, 0], 2, 2)), [1, 1])
check('oracle 5', solve(*([], 0, 4)), [])
check('oracle 6', solve(*([1], 1, 1)), [-1])
check('oracle 7', solve(*([0, 1, 0, 0], 1, 3)), [2])
if N == 1: check('variant packet 1', solve(*[[5, 6, 3], 4, 3]), [-3, -2, 3, 0])
if N == 2: check('variant packet 2', solve(*[[5, 6, 3], 5, 3]), [-3, -2, 3, 0, 0])
if N == 3: check('variant packet 3', solve(*[[5, 6, 3], 6, 3]), [-3, -2, 3, 0, 0, 0])
if N == 4: check('variant packet 4', solve(*[[5, 6, 3], 7, 3]), [-3, -2, 3, 0, 0, 0, 0])
if N == 5: check('variant packet 5', solve(*[[5, 6, 3], 8, 3]), [-3, -2, 3, 0, 0, 0, 0, 0])
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)

prompt:
Bit planes are assigned reversed amplitude significance.

Restore signed PCM sample integers from least-significant-bit-first bitplanes; sample index selects a bit inside each plane, and extra planes are ignored.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(planes, samples, width):
    out=[0]*samples
    for bit,plane in enumerate(planes[:width]):
        for i in range(samples):
            value=(plane>>(samples-1-i))&1
            out[i]|=value<<bit
    sign=1<<(width-1)
    return [x-(1<<width) if x&sign else x for x in out]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([5, 6, 3], 3, 3)), [-3, -2, 3])
check('oracle 2', solve(*([1, 2, 4, 7], 3, 3)), [1, 2, -4])
check('oracle 3', solve(*([0, 0, 7], 3, 3)), [-4, -4, -4])
check('oracle 4', solve(*([3, 0], 2, 2)), [1, 1])
check('oracle 5', solve(*([], 0, 4)), [])
check('oracle 6', solve(*([1], 1, 1)), [-1])
check('oracle 7', solve(*([0, 1, 0, 0], 1, 3)), [2])
if N == 1: check('variant packet 1', solve(*[[5, 6, 3], 4, 3]), [-3, -2, 3, 0])
if N == 2: check('variant packet 2', solve(*[[5, 6, 3], 5, 3]), [-3, -2, 3, 0, 0])
if N == 3: check('variant packet 3', solve(*[[5, 6, 3], 6, 3]), [-3, -2, 3, 0, 0, 0])
if N == 4: check('variant packet 4', solve(*[[5, 6, 3], 7, 3]), [-3, -2, 3, 0, 0, 0, 0])
if N == 5: check('variant packet 5', solve(*[[5, 6, 3], 8, 3]), [-3, -2, 3, 0, 0, 0, 0, 0])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(planes, samples, width):
    out=[0]*samples
    for bit,plane in enumerate(planes[:width]):
        for i in range(samples):
            value=plane&1
            out[i]|=value<<bit
    sign=1<<(width-1)
    return [x-(1<<width) if x&sign else x for x in out]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([5, 6, 3], 3, 3)), [-3, -2, 3])
check('oracle 2', solve(*([1, 2, 4, 7], 3, 3)), [1, 2, -4])
check('oracle 3', solve(*([0, 0, 7], 3, 3)), [-4, -4, -4])
check('oracle 4', solve(*([3, 0], 2, 2)), [1, 1])
check('oracle 5', solve(*([], 0, 4)), [])
check('oracle 6', solve(*([1], 1, 1)), [-1])
check('oracle 7', solve(*([0, 1, 0, 0], 1, 3)), [2])
if N == 1: check('variant packet 1', solve(*[[5, 6, 3], 4, 3]), [-3, -2, 3, 0])
if N == 2: check('variant packet 2', solve(*[[5, 6, 3], 5, 3]), [-3, -2, 3, 0, 0])
if N == 3: check('variant packet 3', solve(*[[5, 6, 3], 6, 3]), [-3, -2, 3, 0, 0, 0])
if N == 4: check('variant packet 4', solve(*[[5, 6, 3], 7, 3]), [-3, -2, 3, 0, 0, 0, 0])
if N == 5: check('variant packet 5', solve(*[[5, 6, 3], 8, 3]), [-3, -2, 3, 0, 0, 0, 0, 0])
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)

prompt:
Samples within each PCM bitplane are read in reverse order.

Restore signed PCM sample integers from least-significant-bit-first bitplanes; sample index selects a bit inside each plane, and extra planes are ignored.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(planes, samples, width):
    out=[0]*samples
    for bit,plane in enumerate(planes):
        for i in range(samples):
            value=(plane>>i)&1
            out[i]|=value<<bit
    sign=1<<(width-1)
    return [x-(1<<width) if x&sign else x for x in out]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([5, 6, 3], 3, 3)), [-3, -2, 3])
check('oracle 2', solve(*([1, 2, 4, 7], 3, 3)), [1, 2, -4])
check('oracle 3', solve(*([0, 0, 7], 3, 3)), [-4, -4, -4])
check('oracle 4', solve(*([3, 0], 2, 2)), [1, 1])
check('oracle 5', solve(*([], 0, 4)), [])
check('oracle 6', solve(*([1], 1, 1)), [-1])
check('oracle 7', solve(*([0, 1, 0, 0], 1, 3)), [2])
if N == 1: check('variant packet 1', solve(*[[5, 6, 3], 4, 3]), [-3, -2, 3, 0])
if N == 2: check('variant packet 2', solve(*[[5, 6, 3], 5, 3]), [-3, -2, 3, 0, 0])
if N == 3: check('variant packet 3', solve(*[[5, 6, 3], 6, 3]), [-3, -2, 3, 0, 0, 0])
if N == 4: check('variant packet 4', solve(*[[5, 6, 3], 7, 3]), [-3, -2, 3, 0, 0, 0, 0])
if N == 5: check('variant packet 5', solve(*[[5, 6, 3], 8, 3]), [-3, -2, 3, 0, 0, 0, 0, 0])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(planes, samples, width):
    out=[0]*samples
    for bit,plane in enumerate(planes[:width-1]):
        for i in range(samples):
            value=(plane>>i)&1
            out[i]|=value<<bit
    sign=1<<(width-1)
    return [x-(1<<width) if x&sign else x for x in out]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([5, 6, 3], 3, 3)), [-3, -2, 3])
check('oracle 2', solve(*([1, 2, 4, 7], 3, 3)), [1, 2, -4])
check('oracle 3', solve(*([0, 0, 7], 3, 3)), [-4, -4, -4])
check('oracle 4', solve(*([3, 0], 2, 2)), [1, 1])
check('oracle 5', solve(*([], 0, 4)), [])
check('oracle 6', solve(*([1], 1, 1)), [-1])
check('oracle 7', solve(*([0, 1, 0, 0], 1, 3)), [2])
if N == 1: check('variant packet 1', solve(*[[5, 6, 3], 4, 3]), [-3, -2, 3, 0])
if N == 2: check('variant packet 2', solve(*[[5, 6, 3], 5, 3]), [-3, -2, 3, 0, 0])
if N == 3: check('variant packet 3', solve(*[[5, 6, 3], 6, 3]), [-3, -2, 3, 0, 0, 0])
if N == 4: check('variant packet 4', solve(*[[5, 6, 3], 7, 3]), [-3, -2, 3, 0, 0, 0, 0])
if N == 5: check('variant packet 5', solve(*[[5, 6, 3], 8, 3]), [-3, -2, 3, 0, 0, 0, 0, 0])
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)

prompt:
Extra transport planes leak above the PCM field.

Restore signed PCM sample integers from least-significant-bit-first bitplanes; sample index selects a bit inside each plane, and extra planes are ignored.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(planes, samples, width):
    out=[0]*samples
    for bit,plane in enumerate(planes[:width]):
        for i in range(samples):
            value=(plane>>i)&1
            out[i]=value<<bit
    sign=1<<(width-1)
    return [x-(1<<width) if x&sign else x for x in out]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([5, 6, 3], 3, 3)), [-3, -2, 3])
check('oracle 2', solve(*([1, 2, 4, 7], 3, 3)), [1, 2, -4])
check('oracle 3', solve(*([0, 0, 7], 3, 3)), [-4, -4, -4])
check('oracle 4', solve(*([3, 0], 2, 2)), [1, 1])
check('oracle 5', solve(*([], 0, 4)), [])
check('oracle 6', solve(*([1], 1, 1)), [-1])
check('oracle 7', solve(*([0, 1, 0, 0], 1, 3)), [2])
if N == 1: check('variant packet 1', solve(*[[5, 6, 3], 4, 3]), [-3, -2, 3, 0])
if N == 2: check('variant packet 2', solve(*[[5, 6, 3], 5, 3]), [-3, -2, 3, 0, 0])
if N == 3: check('variant packet 3', solve(*[[5, 6, 3], 6, 3]), [-3, -2, 3, 0, 0, 0])
if N == 4: check('variant packet 4', solve(*[[5, 6, 3], 7, 3]), [-3, -2, 3, 0, 0, 0, 0])
if N == 5: check('variant packet 5', solve(*[[5, 6, 3], 8, 3]), [-3, -2, 3, 0, 0, 0, 0, 0])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(planes, samples, width):
    out=[0]*samples
    for bit,plane in enumerate(planes[:width]):
        for i in range(samples):
            value=(plane>>i)&1
            out[i]+=value
    sign=1<<(width-1)
    return [x-(1<<width) if x&sign else x for x in out]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([5, 6, 3], 3, 3)), [-3, -2, 3])
check('oracle 2', solve(*([1, 2, 4, 7], 3, 3)), [1, 2, -4])
check('oracle 3', solve(*([0, 0, 7], 3, 3)), [-4, -4, -4])
check('oracle 4', solve(*([3, 0], 2, 2)), [1, 1])
check('oracle 5', solve(*([], 0, 4)), [])
check('oracle 6', solve(*([1], 1, 1)), [-1])
check('oracle 7', solve(*([0, 1, 0, 0], 1, 3)), [2])
if N == 1: check('variant packet 1', solve(*[[5, 6, 3], 4, 3]), [-3, -2, 3, 0])
if N == 2: check('variant packet 2', solve(*[[5, 6, 3], 5, 3]), [-3, -2, 3, 0, 0])
if N == 3: check('variant packet 3', solve(*[[5, 6, 3], 6, 3]), [-3, -2, 3, 0, 0, 0])
if N == 4: check('variant packet 4', solve(*[[5, 6, 3], 7, 3]), [-3, -2, 3, 0, 0, 0, 0])
if N == 5: check('variant packet 5', solve(*[[5, 6, 3], 8, 3]), [-3, -2, 3, 0, 0, 0, 0, 0])
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)

prompt:
Each incoming plane overwrites all previously restored signal bits.

Restore signed PCM sample integers from least-significant-bit-first bitplanes; sample index selects a bit inside each plane, and extra planes are ignored.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(planes, samples, width):
    out=[0]*samples
    for bit,plane in enumerate(planes[:width]):
        for i in range(samples):
            value=(plane>>i)&1
            out[i]|=value<<bit
    sign=1<<(width-1)
    return [x-(1<<width) if planes and planes[0]&(1<<i) else x for x in out]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([5, 6, 3], 3, 3)), [-3, -2, 3])
check('oracle 2', solve(*([1, 2, 4, 7], 3, 3)), [1, 2, -4])
check('oracle 3', solve(*([0, 0, 7], 3, 3)), [-4, -4, -4])
check('oracle 4', solve(*([3, 0], 2, 2)), [1, 1])
check('oracle 5', solve(*([], 0, 4)), [])
check('oracle 6', solve(*([1], 1, 1)), [-1])
check('oracle 7', solve(*([0, 1, 0, 0], 1, 3)), [2])
if N == 1: check('variant packet 1', solve(*[[5, 6, 3], 4, 3]), [-3, -2, 3, 0])
if N == 2: check('variant packet 2', solve(*[[5, 6, 3], 5, 3]), [-3, -2, 3, 0, 0])
if N == 3: check('variant packet 3', solve(*[[5, 6, 3], 6, 3]), [-3, -2, 3, 0, 0, 0])
if N == 4: check('variant packet 4', solve(*[[5, 6, 3], 7, 3]), [-3, -2, 3, 0, 0, 0, 0])
if N == 5: check('variant packet 5', solve(*[[5, 6, 3], 8, 3]), [-3, -2, 3, 0, 0, 0, 0, 0])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(planes, samples, width):
    out=[0]*samples
    for bit,plane in enumerate(planes[:width]):
        for i in range(samples):
            value=(plane>>i)&1
            out[i]|=value<<bit
    sign=1<<(width-1)
    return [x-(1<<width) if x>sign else x for x in out]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([5, 6, 3], 3, 3)), [-3, -2, 3])
check('oracle 2', solve(*([1, 2, 4, 7], 3, 3)), [1, 2, -4])
check('oracle 3', solve(*([0, 0, 7], 3, 3)), [-4, -4, -4])
check('oracle 4', solve(*([3, 0], 2, 2)), [1, 1])
check('oracle 5', solve(*([], 0, 4)), [])
check('oracle 6', solve(*([1], 1, 1)), [-1])
check('oracle 7', solve(*([0, 1, 0, 0], 1, 3)), [2])
if N == 1: check('variant packet 1', solve(*[[5, 6, 3], 4, 3]), [-3, -2, 3, 0])
if N == 2: check('variant packet 2', solve(*[[5, 6, 3], 5, 3]), [-3, -2, 3, 0, 0])
if N == 3: check('variant packet 3', solve(*[[5, 6, 3], 6, 3]), [-3, -2, 3, 0, 0, 0])
if N == 4: check('variant packet 4', solve(*[[5, 6, 3], 7, 3]), [-3, -2, 3, 0, 0, 0, 0])
if N == 5: check('variant packet 5', solve(*[[5, 6, 3], 8, 3]), [-3, -2, 3, 0, 0, 0, 0, 0])
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)

prompt:
Sign is inferred from a low-order plane instead of reconstructed sample.

Restore signed PCM sample integers from least-significant-bit-first bitplanes; sample index selects a bit inside each plane, and extra planes are ignored.

split: open-access


prompt:
Each byte plane reuses its first sample byte.

Reassemble signed integer PCM from per-byte-significance planes, preserving sample order and the declared number of octets per sample.

split: open-access


prompt:
Byte planes are weighted as single-bit planes.

Reassemble signed integer PCM from per-byte-significance planes, preserving sample order and the declared number of octets per sample.

split: open-access


prompt:
The sign-containing final plane is omitted.

Reassemble signed integer PCM from per-byte-significance planes, preserving sample order and the declared number of octets per sample.

split: open-access


prompt:
The final declared sample is lost.

Reassemble signed integer PCM from per-byte-significance planes, preserving sample order and the declared number of octets per sample.

split: open-access


prompt:
Negative plane-assembled words use half the complement modulus.

Reassemble signed integer PCM from per-byte-significance planes, preserving sample order and the declared number of octets per sample.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(slots, width):
    out=[]
    mask=(1<<width)-1
    for slot in slots:
        payload=slot&mask
        valid=bool(slot&(1<<width))
        parity=(slot>>(width+1))&1
        parity_ok=((bin(payload).count("1")+int(not valid)+parity)%2)==0
        sample=payload-(1<<width) if payload&(1<<(width-1)) else payload
        out.append([sample if valid and parity_ok else None,valid,parity_ok])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([0, 1, 33, 16, 48], 4)), [[0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True]])
check('oracle 2', solve(*([15, 47, 8, 40], 4)), [[-1, True, True], [None, True, False], [None, True, False], [-8, True, True]])
check('oracle 3', solve(*([], 4)), [])
check('oracle 4', solve(*([0, 1, 2, 3, 4, 5, 6, 7], 1)), [[0, True, True], [None, True, False], [None, False, False], [None, False, True], [None, True, False], [-1, True, True], [None, False, True], [None, False, False]])
check('oracle 5', solve(*([7, 23, 8, 24], 3)), [[None, True, False], [-1, True, True], [None, False, False], [None, False, True]])
check('oracle 6', solve(*([2, 3, 4, 5, 6], 4)), [[None, True, False], [3, True, True], [None, True, False], [5, True, True], [6, True, True]])
check('oracle 7', solve(*([255, 767, 256, 768], 8)), [[-1, True, True], [None, True, False], [None, False, False], [None, False, True]])
if N == 1: check('variant packet 1', solve(*[[0, 1, 33, 16, 48, 0, 1, 33, 16, 48], 4]), [[0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True]])
if N == 2: check('variant packet 2', solve(*[[0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48], 4]), [[0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True]])
if N == 3: check('variant packet 3', solve(*[[0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48], 4]), [[0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True]])
if N == 4: check('variant packet 4', solve(*[[0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48], 4]), [[0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True]])
if N == 5: check('variant packet 5', solve(*[[0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48], 4]), [[0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True]])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(slots, width):
    out=[]
    mask=(1<<width)-1
    for slot in slots:
        payload=slot&mask
        valid=not bool(payload)
        parity=(slot>>(width+1))&1
        parity_ok=((bin(payload).count("1")+int(not valid)+parity)%2)==0
        sample=payload-(1<<width) if payload&(1<<(width-1)) else payload
        out.append([sample if valid and parity_ok else None,valid,parity_ok])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([0, 1, 33, 16, 48], 4)), [[0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True]])
check('oracle 2', solve(*([15, 47, 8, 40], 4)), [[-1, True, True], [None, True, False], [None, True, False], [-8, True, True]])
check('oracle 3', solve(*([], 4)), [])
check('oracle 4', solve(*([0, 1, 2, 3, 4, 5, 6, 7], 1)), [[0, True, True], [None, True, False], [None, False, False], [None, False, True], [None, True, False], [-1, True, True], [None, False, True], [None, False, False]])
check('oracle 5', solve(*([7, 23, 8, 24], 3)), [[None, True, False], [-1, True, True], [None, False, False], [None, False, True]])
check('oracle 6', solve(*([2, 3, 4, 5, 6], 4)), [[None, True, False], [3, True, True], [None, True, False], [5, True, True], [6, True, True]])
check('oracle 7', solve(*([255, 767, 256, 768], 8)), [[-1, True, True], [None, True, False], [None, False, False], [None, False, True]])
if N == 1: check('variant packet 1', solve(*[[0, 1, 33, 16, 48, 0, 1, 33, 16, 48], 4]), [[0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True]])
if N == 2: check('variant packet 2', solve(*[[0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48], 4]), [[0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True]])
if N == 3: check('variant packet 3', solve(*[[0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48], 4]), [[0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True]])
if N == 4: check('variant packet 4', solve(*[[0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48], 4]), [[0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True]])
if N == 5: check('variant packet 5', solve(*[[0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48], 4]), [[0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True]])
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)

prompt:
The PCM invalid flag is interpreted as valid.

Decode a stipulated slot: signed payload, one invalid bit, then even parity covering payload and invalid bit; invalid or corrupt samples return null plus status.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(slots, width):
    out=[]
    mask=(1<<width)-1
    for slot in slots:
        payload=slot&mask
        valid=not bool(slot&(1<<width))
        parity=(slot>>(width+1))&1
        parity_ok=((bin(payload).count("1")+parity)%2)==0
        sample=payload-(1<<width) if payload&(1<<(width-1)) else payload
        out.append([sample if valid and parity_ok else None,valid,parity_ok])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([0, 1, 33, 16, 48], 4)), [[0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True]])
check('oracle 2', solve(*([15, 47, 8, 40], 4)), [[-1, True, True], [None, True, False], [None, True, False], [-8, True, True]])
check('oracle 3', solve(*([], 4)), [])
check('oracle 4', solve(*([0, 1, 2, 3, 4, 5, 6, 7], 1)), [[0, True, True], [None, True, False], [None, False, False], [None, False, True], [None, True, False], [-1, True, True], [None, False, True], [None, False, False]])
check('oracle 5', solve(*([7, 23, 8, 24], 3)), [[None, True, False], [-1, True, True], [None, False, False], [None, False, True]])
check('oracle 6', solve(*([2, 3, 4, 5, 6], 4)), [[None, True, False], [3, True, True], [None, True, False], [5, True, True], [6, True, True]])
check('oracle 7', solve(*([255, 767, 256, 768], 8)), [[-1, True, True], [None, True, False], [None, False, False], [None, False, True]])
if N == 1: check('variant packet 1', solve(*[[0, 1, 33, 16, 48, 0, 1, 33, 16, 48], 4]), [[0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True]])
if N == 2: check('variant packet 2', solve(*[[0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48], 4]), [[0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True]])
if N == 3: check('variant packet 3', solve(*[[0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48], 4]), [[0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True]])
if N == 4: check('variant packet 4', solve(*[[0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48], 4]), [[0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True]])
if N == 5: check('variant packet 5', solve(*[[0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48], 4]), [[0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True]])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(slots, width):
    out=[]
    mask=(1<<width)-1
    for slot in slots:
        payload=slot&mask
        valid=not bool(slot&(1<<width))
        parity=(slot>>(width+1))&1
        parity_ok=((bin(payload).count("1")+int(valid)+parity)%2)==0
        sample=payload-(1<<width) if payload&(1<<(width-1)) else payload
        out.append([sample if valid and parity_ok else None,valid,parity_ok])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([0, 1, 33, 16, 48], 4)), [[0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True]])
check('oracle 2', solve(*([15, 47, 8, 40], 4)), [[-1, True, True], [None, True, False], [None, True, False], [-8, True, True]])
check('oracle 3', solve(*([], 4)), [])
check('oracle 4', solve(*([0, 1, 2, 3, 4, 5, 6, 7], 1)), [[0, True, True], [None, True, False], [None, False, False], [None, False, True], [None, True, False], [-1, True, True], [None, False, True], [None, False, False]])
check('oracle 5', solve(*([7, 23, 8, 24], 3)), [[None, True, False], [-1, True, True], [None, False, False], [None, False, True]])
check('oracle 6', solve(*([2, 3, 4, 5, 6], 4)), [[None, True, False], [3, True, True], [None, True, False], [5, True, True], [6, True, True]])
check('oracle 7', solve(*([255, 767, 256, 768], 8)), [[-1, True, True], [None, True, False], [None, False, False], [None, False, True]])
if N == 1: check('variant packet 1', solve(*[[0, 1, 33, 16, 48, 0, 1, 33, 16, 48], 4]), [[0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True]])
if N == 2: check('variant packet 2', solve(*[[0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48], 4]), [[0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True]])
if N == 3: check('variant packet 3', solve(*[[0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48], 4]), [[0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True]])
if N == 4: check('variant packet 4', solve(*[[0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48], 4]), [[0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True]])
if N == 5: check('variant packet 5', solve(*[[0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48], 4]), [[0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True]])
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)

prompt:
Parity omits the invalid-status bit carried in the protected slot.

Decode a stipulated slot: signed payload, one invalid bit, then even parity covering payload and invalid bit; invalid or corrupt samples return null plus status.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(slots, width):
    out=[]
    mask=(1<<width)-1
    for slot in slots:
        payload=slot&mask
        valid=not bool(slot&(1<<width))
        parity=(slot>>width)&1
        parity_ok=((bin(payload).count("1")+int(not valid)+parity)%2)==0
        sample=payload-(1<<width) if payload&(1<<(width-1)) else payload
        out.append([sample if valid and parity_ok else None,valid,parity_ok])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([0, 1, 33, 16, 48], 4)), [[0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True]])
check('oracle 2', solve(*([15, 47, 8, 40], 4)), [[-1, True, True], [None, True, False], [None, True, False], [-8, True, True]])
check('oracle 3', solve(*([], 4)), [])
check('oracle 4', solve(*([0, 1, 2, 3, 4, 5, 6, 7], 1)), [[0, True, True], [None, True, False], [None, False, False], [None, False, True], [None, True, False], [-1, True, True], [None, False, True], [None, False, False]])
check('oracle 5', solve(*([7, 23, 8, 24], 3)), [[None, True, False], [-1, True, True], [None, False, False], [None, False, True]])
check('oracle 6', solve(*([2, 3, 4, 5, 6], 4)), [[None, True, False], [3, True, True], [None, True, False], [5, True, True], [6, True, True]])
check('oracle 7', solve(*([255, 767, 256, 768], 8)), [[-1, True, True], [None, True, False], [None, False, False], [None, False, True]])
if N == 1: check('variant packet 1', solve(*[[0, 1, 33, 16, 48, 0, 1, 33, 16, 48], 4]), [[0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True]])
if N == 2: check('variant packet 2', solve(*[[0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48], 4]), [[0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True]])
if N == 3: check('variant packet 3', solve(*[[0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48], 4]), [[0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True]])
if N == 4: check('variant packet 4', solve(*[[0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48], 4]), [[0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True]])
if N == 5: check('variant packet 5', solve(*[[0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48], 4]), [[0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True]])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(slots, width):
    out=[]
    mask=(1<<width)-1
    for slot in slots:
        payload=slot&mask
        valid=not bool(slot&(1<<width))
        parity=slot&1
        parity_ok=((bin(payload).count("1")+int(not valid)+parity)%2)==0
        sample=payload-(1<<width) if payload&(1<<(width-1)) else payload
        out.append([sample if valid and parity_ok else None,valid,parity_ok])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([0, 1, 33, 16, 48], 4)), [[0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True]])
check('oracle 2', solve(*([15, 47, 8, 40], 4)), [[-1, True, True], [None, True, False], [None, True, False], [-8, True, True]])
check('oracle 3', solve(*([], 4)), [])
check('oracle 4', solve(*([0, 1, 2, 3, 4, 5, 6, 7], 1)), [[0, True, True], [None, True, False], [None, False, False], [None, False, True], [None, True, False], [-1, True, True], [None, False, True], [None, False, False]])
check('oracle 5', solve(*([7, 23, 8, 24], 3)), [[None, True, False], [-1, True, True], [None, False, False], [None, False, True]])
check('oracle 6', solve(*([2, 3, 4, 5, 6], 4)), [[None, True, False], [3, True, True], [None, True, False], [5, True, True], [6, True, True]])
check('oracle 7', solve(*([255, 767, 256, 768], 8)), [[-1, True, True], [None, True, False], [None, False, False], [None, False, True]])
if N == 1: check('variant packet 1', solve(*[[0, 1, 33, 16, 48, 0, 1, 33, 16, 48], 4]), [[0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True]])
if N == 2: check('variant packet 2', solve(*[[0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48], 4]), [[0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True]])
if N == 3: check('variant packet 3', solve(*[[0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48], 4]), [[0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True]])
if N == 4: check('variant packet 4', solve(*[[0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48], 4]), [[0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True]])
if N == 5: check('variant packet 5', solve(*[[0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48, 0, 1, 33, 16, 48], 4]), [[0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True], [0, True, True], [None, True, False], [1, True, True], [None, False, False], [None, False, True]])
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)

prompt:
The invalid bit is reused as parity.

Decode a stipulated slot: signed payload, one invalid bit, then even parity covering payload and invalid bit; invalid or corrupt samples return null plus status.

split: open-access