prompt:
A dead horizontal channel drags ML down by 1.5 units.

Zero-to-peak Wood-Anderson amplitudes on two horizontal components in mm (0 = dead channel, ignored; both dead returns None). -log A0 is linearly interpolated from [(0,1.4),(10,1.5),(20,1.7),(30,2.1),(50,2.6),(100,3.0),(200,3.5),(300,4.0),(400,4.5),(600,5.1)] with 0 <= dist <= 600 inclusive, else None. ML = mean of per-component log10 amplitudes + (-log A0), rounded 0.01.

split: open-access


meaning: Fixture-count band, not measured model difficulty

deps: stdlib

prompt:
Between table nodes the distance correction moves in the wrong direction; only node distances are right.

Zero-to-peak Wood-Anderson amplitudes on two horizontal components in mm (0 = dead channel, ignored; both dead returns None). -log A0 is linearly interpolated from [(0,1.4),(10,1.5),(20,1.7),(30,2.1),(50,2.6),(100,3.0),(200,3.5),(300,4.0),(400,4.5),(600,5.1)] with 0 <= dist <= 600 inclusive, else None. ML = mean of per-component log10 amplitudes + (-log A0), rounded 0.01.

split: open-access


prompt:
ML 3.5 converts to Mw 3.4.

Case-sensitive type. ML: < 3.5 -> 0.8 ML + 0.6; 3.5..6.0 -> ML; > 6.0 None. mb: 3.5..6.2 -> 1.54 mb - 2.54, else None. Ms: <= 6.1 -> 0.67 Ms + 2.07; 6.1 < Ms <= 8.2 -> 0.99 Ms + 0.08; else None. Other types None. Round half up to 0.1 via floor(x*10 + 0.5)/10.

split: open-access


prompt:
Ms 6.1 converts with the large-magnitude relation.

Case-sensitive type. ML: < 3.5 -> 0.8 ML + 0.6; 3.5..6.0 -> ML; > 6.0 None. mb: 3.5..6.2 -> 1.54 mb - 2.54, else None. Ms: <= 6.1 -> 0.67 Ms + 2.07; 6.1 < Ms <= 8.2 -> 0.99 Ms + 0.08; else None. Other types None. Round half up to 0.1 via floor(x*10 + 0.5)/10.

split: open-access


prompt:
Saturated ML 6.5 is passed through as Mw 6.5.

Case-sensitive type. ML: < 3.5 -> 0.8 ML + 0.6; 3.5..6.0 -> ML; > 6.0 None. mb: 3.5..6.2 -> 1.54 mb - 2.54, else None. Ms: <= 6.1 -> 0.67 Ms + 2.07; 6.1 < Ms <= 8.2 -> 0.99 Ms + 0.08; else None. Other types None. Round half up to 0.1 via floor(x*10 + 0.5)/10.

split: open-access


prompt:
Md and lower-case ml values are published as Mw unchanged.

Case-sensitive type. ML: < 3.5 -> 0.8 ML + 0.6; 3.5..6.0 -> ML; > 6.0 None. mb: 3.5..6.2 -> 1.54 mb - 2.54, else None. Ms: <= 6.1 -> 0.67 Ms + 2.07; 6.1 < Ms <= 8.2 -> 0.99 Ms + 0.08; else None. Other types None. Round half up to 0.1 via floor(x*10 + 0.5)/10.

split: open-access


prompt:
Strike-slip and oblique mechanisms get Mw too small.

mt = [Mrr, Mtt, Mpp, Mrt, Mrp, Mtp] mantissas; tensor = mantissa * 10^exponent dyne*cm. M0 = sqrt(sum of all nine squared elements / 2) (off-diagonals appear twice), converted to N*m (1e-7). Mw = 2/3 (log10 M0 - 9.1). Flag "non-deviatoric" when |trace| > 0.1 * M0 mantissa norm, else "deviatoric". Return [Mw rounded 0.01, flag].

split: open-access


prompt:
Mw is 0.1 units too high for every tensor.

mt = [Mrr, Mtt, Mpp, Mrt, Mrp, Mtp] mantissas; tensor = mantissa * 10^exponent dyne*cm. M0 = sqrt(sum of all nine squared elements / 2) (off-diagonals appear twice), converted to N*m (1e-7). Mw = 2/3 (log10 M0 - 9.1). Flag "non-deviatoric" when |trace| > 0.1 * M0 mantissa norm, else "deviatoric". Return [Mw rounded 0.01, flag].

split: open-access


prompt:
Every CMT Mw is 4.67 units high.

mt = [Mrr, Mtt, Mpp, Mrt, Mrp, Mtp] mantissas; tensor = mantissa * 10^exponent dyne*cm. M0 = sqrt(sum of all nine squared elements / 2) (off-diagonals appear twice), converted to N*m (1e-7). Mw = 2/3 (log10 M0 - 9.1). Flag "non-deviatoric" when |trace| > 0.1 * M0 mantissa norm, else "deviatoric". Return [Mw rounded 0.01, flag].

split: open-access


prompt:
Implosive (negative trace) sources are labelled deviatoric.

mt = [Mrr, Mtt, Mpp, Mrt, Mrp, Mtp] mantissas; tensor = mantissa * 10^exponent dyne*cm. M0 = sqrt(sum of all nine squared elements / 2) (off-diagonals appear twice), converted to N*m (1e-7). Mw = 2/3 (log10 M0 - 9.1). Flag "non-deviatoric" when |trace| > 0.1 * M0 mantissa norm, else "deviatoric". Return [Mw rounded 0.01, flag].

split: open-access


prompt:
Applying the corrections doubles the station bias instead of removing it.

events are [station, station magnitude, network magnitude]. Residual = station - network; residuals with |r| > 1.0 are discarded (exactly 1.0 kept). A station with at least min_n kept residuals gets correction = -mean(kept) rounded 0.01, otherwise 0.0. Return [[station, correction, kept count]] sorted by station.

split: open-access


prompt:
Residuals of exactly one magnitude unit are discarded.

events are [station, station magnitude, network magnitude]. Residual = station - network; residuals with |r| > 1.0 are discarded (exactly 1.0 kept). A station with at least min_n kept residuals gets correction = -mean(kept) rounded 0.01, otherwise 0.0. Return [[station, correction, kept count]] sorted by station.

split: open-access


prompt:
Stations with exactly the minimum number of residuals get no correction.

events are [station, station magnitude, network magnitude]. Residual = station - network; residuals with |r| > 1.0 are discarded (exactly 1.0 kept). A station with at least min_n kept residuals gets correction = -mean(kept) rounded 0.01, otherwise 0.0. Return [[station, correction, kept count]] sorted by station.

split: open-access


prompt:
A tide gauge at exactly 100 km is ignored.

gauges are [crest-to-trough double amplitude m, distance km]. Only gauges with distance >= 100 km are used. H = double amplitude / 2; Mt_i = log10 H + log10 distance + 5.8. Return [mean rounded 0.01, gauges used] or None.

split: open-access


prompt:
Mt is 0.3 units high at every gauge.

gauges are [crest-to-trough double amplitude m, distance km]. Only gauges with distance >= 100 km are used. H = double amplitude / 2; Mt_i = log10 H + log10 distance + 5.8. Return [mean rounded 0.01, gauges used] or None.

split: open-access


prompt:
Mt is about two units low.

gauges are [crest-to-trough double amplitude m, distance km]. Only gauges with distance >= 100 km are used. H = double amplitude / 2; Mt_i = log10 H + log10 distance + 5.8. Return [mean rounded 0.01, gauges used] or None.

split: open-access


prompt:
Events recorded by near-field gauges have their Mt diluted.

gauges are [crest-to-trough double amplitude m, distance km]. Only gauges with distance >= 100 km are used. H = double amplitude / 2; Mt_i = log10 H + log10 distance + 5.8. Return [mean rounded 0.01, gauges used] or None.

split: open-access


prompt:
Swapped phase picks still produce a magnitude.

Zero-to-peak amplitude in mm and P and S arrival times in s. dt = tS - tP must be positive and amplitude positive, else None. ML = log10 A + 3 log10(8 dt) - 2.92, rounded 0.01.

split: open-access


prompt:
Magnitudes are 2.7 units low.

Zero-to-peak amplitude in mm and P and S arrival times in s. dt = tS - tP must be positive and amplitude positive, else None. ML = log10 A + 3 log10(8 dt) - 2.92, rounded 0.01.

split: open-access


prompt:
Distant events get far too large a correction.

Zero-to-peak amplitude in mm and P and S arrival times in s. dt = tS - tP must be positive and amplitude positive, else None. ML = log10 A + 3 log10(8 dt) - 2.92, rounded 0.01.

split: open-access


prompt:
All nomogram magnitudes are 5.84 units high.

Zero-to-peak amplitude in mm and P and S arrival times in s. dt = tS - tP must be positive and amplitude positive, else None. ML = log10 A + 3 log10(8 dt) - 2.92, rounded 0.01.

split: open-access


prompt:
Energy is eight times too large and Me 0.6 high.

Ground velocity samples in m/s, sample interval s, hypocentral distance km. Energy flux integral = sum(v^2)*dt; Es = 4 pi rho beta R^2 * integral * 0.25 (free-surface correction), rho=2700 kg/m3, beta=3500 m/s, R in m. Me = 2/3 log10 Es - 2.9. Return [Es "%.3e", Me rounded 0.01]; None if the trace is empty or all zero.

split: open-access


prompt:
Energy is a million times too small.

Ground velocity samples in m/s, sample interval s, hypocentral distance km. Energy flux integral = sum(v^2)*dt; Es = 4 pi rho beta R^2 * integral * 0.25 (free-surface correction), rho=2700 kg/m3, beta=3500 m/s, R in m. Me = 2/3 log10 Es - 2.9. Return [Es "%.3e", Me rounded 0.01]; None if the trace is empty or all zero.

split: open-access


prompt:
Energy grows with the square of the record length.

Ground velocity samples in m/s, sample interval s, hypocentral distance km. Energy flux integral = sum(v^2)*dt; Es = 4 pi rho beta R^2 * integral * 0.25 (free-surface correction), rho=2700 kg/m3, beta=3500 m/s, R in m. Me = 2/3 log10 Es - 2.9. Return [Es "%.3e", Me rounded 0.01]; None if the trace is empty or all zero.

split: open-access


prompt:
Energy magnitudes exceed 10 for moderate events.

Ground velocity samples in m/s, sample interval s, hypocentral distance km. Energy flux integral = sum(v^2)*dt; Es = 4 pi rho beta R^2 * integral * 0.25 (free-surface correction), rho=2700 kg/m3, beta=3500 m/s, R in m. Me = 2/3 log10 Es - 2.9. Return [Es "%.3e", Me rounded 0.01]; None if the trace is empty or all zero.

split: open-access


prompt:
Rupture-length magnitudes are nonsensical, around 1 to 6 units off.

Regression M = a + b log10(L km) by slip type: SS (5.16, 1.12), R (5.00, 1.22), N (4.86, 1.32), ALL (5.08, 1.16); unknown type or non-positive length returns None. Round to 0.01.

split: open-access


prompt:
Long ruptures are assigned magnitudes above 11.

Regression M = a + b log10(L km) by slip type: SS (5.16, 1.12), R (5.00, 1.22), N (4.86, 1.32), ALL (5.08, 1.16); unknown type or non-positive length returns None. Round to 0.01.

split: open-access


prompt:
Single-bit errors are moved to the neighbouring bit instead of being repaired.

Single-error-correcting Hamming decoder for a full or shortened code of length n >= 3 (bits 0/1, else None). Positions are 1-based; parity bits sit at powers of two. The syndrome is the XOR of the positions holding a 1. A syndrome above n points outside the shortened code and is "uncorrectable" (data None); otherwise the bit at the syndrome position is flipped. Return [status, data bits from non-power-of-two positions, syndrome].

split: open-access


prompt:
Clean codewords report nonzero syndromes and get corrupted.

Single-error-correcting Hamming decoder for a full or shortened code of length n >= 3 (bits 0/1, else None). Positions are 1-based; parity bits sit at powers of two. The syndrome is the XOR of the positions holding a 1. A syndrome above n points outside the shortened code and is "uncorrectable" (data None); otherwise the bit at the syndrome position is flipped. Return [status, data bits from non-power-of-two positions, syndrome].

split: open-access


prompt:
Decoded data contains check bits and is one bit too long.

Single-error-correcting Hamming decoder for a full or shortened code of length n >= 3 (bits 0/1, else None). Positions are 1-based; parity bits sit at powers of two. The syndrome is the XOR of the positions holding a 1. A syndrome above n points outside the shortened code and is "uncorrectable" (data None); otherwise the bit at the syndrome position is flipped. Return [status, data bits from non-power-of-two positions, syndrome].

split: open-access


prompt:
Double errors in a shortened code are silently "corrected" at a wrong bit.

Single-error-correcting Hamming decoder for a full or shortened code of length n >= 3 (bits 0/1, else None). Positions are 1-based; parity bits sit at powers of two. The syndrome is the XOR of the positions holding a 1. A syndrome above n points outside the shortened code and is "uncorrectable" (data None); otherwise the bit at the syndrome position is flipped. Return [status, data bits from non-power-of-two positions, syndrome].

split: open-access


prompt:
Codewords fail to decode as clean.

Hamming(7,4) encoder: data d1..d4 go to positions 3, 5, 6, 7; the parity bit at position p (1, 2, 4) is the XOR of all other positions whose index has bit p set. Return the 7-bit codeword (position 1 first).

split: open-access


prompt:
Decoders recover the data bits reversed.

Hamming(7,4) encoder: data d1..d4 go to positions 3, 5, 6, 7; the parity bit at position p (1, 2, 4) is the XOR of all other positions whose index has bit p set. Return the 7-bit codeword (position 1 first).

split: open-access


prompt:
Double-bit errors are "corrected" into wrong data and parity-bit errors are reported as double errors.

Extended Hamming (8,4) SECDED decoder. r[0] is the overall parity bit; r[1..7] are Hamming positions 1..7 with data at 3, 5, 6, 7. s is the XOR of set positions 1..7 and p the parity of all eight bits. s=0,p=0: "clean"; p=1: single error at position s (s=0 means the overall parity bit) - "corrected"; s!=0,p=0: ["double", None]. Return [status, data]. Non-binary or wrong-length input returns None.

split: open-access


prompt:
Clean words with an odd number of data/check ones are misclassified.

Extended Hamming (8,4) SECDED decoder. r[0] is the overall parity bit; r[1..7] are Hamming positions 1..7 with data at 3, 5, 6, 7. s is the XOR of set positions 1..7 and p the parity of all eight bits. s=0,p=0: "clean"; p=1: single error at position s (s=0 means the overall parity bit) - "corrected"; s!=0,p=0: ["double", None]. Return [status, data]. Non-binary or wrong-length input returns None.

split: open-access


prompt:
Single-bit errors are moved rather than corrected.

Extended Hamming (8,4) SECDED decoder. r[0] is the overall parity bit; r[1..7] are Hamming positions 1..7 with data at 3, 5, 6, 7. s is the XOR of set positions 1..7 and p the parity of all eight bits. s=0,p=0: "clean"; p=1: single error at position s (s=0 means the overall parity bit) - "corrected"; s!=0,p=0: ["double", None]. Return [status, data]. Non-binary or wrong-length input returns None.

split: open-access


prompt:
Blocks with erasures are biased towards 0.

Decode an n-fold repetition code sent in contiguous blocks of n symbols; each received symbol is 0, 1 or None (erasure). Erasures do not vote. The bit is the majority of non-erased symbols; a tie (including an all-erased block) yields None. fixed_count counts non-erased symbols outvoted in decided blocks. A length that is not a multiple of n, or n < 1, returns None. Return [bits, fixed_count].

split: open-access


prompt:
Evenly split or fully erased blocks decode to 0 instead of unknown.

Decode an n-fold repetition code sent in contiguous blocks of n symbols; each received symbol is 0, 1 or None (erasure). Erasures do not vote. The bit is the majority of non-erased symbols; a tie (including an all-erased block) yields None. fixed_count counts non-erased symbols outvoted in decided blocks. A length that is not a multiple of n, or n < 1, returns None. Return [bits, fixed_count].

split: open-access


prompt:
Multi-bit messages decode into scrambled bits.

Decode an n-fold repetition code sent in contiguous blocks of n symbols; each received symbol is 0, 1 or None (erasure). Erasures do not vote. The bit is the majority of non-erased symbols; a tie (including an all-erased block) yields None. fixed_count counts non-erased symbols outvoted in decided blocks. A length that is not a multiple of n, or n < 1, returns None. Return [bits, fixed_count].

split: open-access


prompt:
The corrected-symbol statistic is inflated by erasures.

Decode an n-fold repetition code sent in contiguous blocks of n symbols; each received symbol is 0, 1 or None (erasure). Erasures do not vote. The bit is the majority of non-erased symbols; a tie (including an all-erased block) yields None. fixed_count counts non-erased symbols outvoted in decided blocks. A length that is not a multiple of n, or n < 1, returns None. Return [bits, fixed_count].

split: open-access


prompt:
A stream cut mid-block decodes a partial block as if complete.

Decode an n-fold repetition code sent in contiguous blocks of n symbols; each received symbol is 0, 1 or None (erasure). Erasures do not vote. The bit is the majority of non-erased symbols; a tie (including an all-erased block) yields None. fixed_count counts non-erased symbols outvoted in decided blocks. A length that is not a multiple of n, or n < 1, returns None. Return [bits, fixed_count].

split: open-access


prompt:
Non-square interleavers put flags in the wrong codewords.

A rows x cols block interleaver writes codewords row by row (each row is one codeword of cols symbols) and transmits column by column. Given per-symbol error flags in transmission order, deinterleave them back to row order, find the largest number of flagged symbols in any codeword, and report whether it is within the per-codeword capability t. Return [deinterleaved flags, worst, correctable]; mismatched sizes return None.

split: open-access


prompt:
Bursts are judged uncorrectable although interleaving spreads them.

A rows x cols block interleaver writes codewords row by row (each row is one codeword of cols symbols) and transmits column by column. Given per-symbol error flags in transmission order, deinterleave them back to row order, find the largest number of flagged symbols in any codeword, and report whether it is within the per-codeword capability t. Return [deinterleaved flags, worst, correctable]; mismatched sizes return None.

split: open-access


prompt:
Codewords with exactly t errors are reported uncorrectable.

A rows x cols block interleaver writes codewords row by row (each row is one codeword of cols symbols) and transmits column by column. Given per-symbol error flags in transmission order, deinterleave them back to row order, find the largest number of flagged symbols in any codeword, and report whether it is within the per-codeword capability t. Return [deinterleaved flags, worst, correctable]; mismatched sizes return None.

split: open-access


prompt:
Decoders cannot terminate in state 0 and the last bits decode unreliably.

Rate-1/2, constraint-length-3 convolutional encoder with generators 7 (111) and 5 (101) octal. The register holds the current bit in bit 2 and the two previous bits below it; for each input bit output the g=7 parity then the g=5 parity, then shift. Two zero tail bits terminate the trellis. Return the output bit list.

split: open-access


prompt:
Output parities stop depending on the latest input bits.

Rate-1/2, constraint-length-3 convolutional encoder with generators 7 (111) and 5 (101) octal. The register holds the current bit in bit 2 and the two previous bits below it; for each input bit output the g=7 parity then the g=5 parity, then shift. Two zero tail bits terminate the trellis. Return the output bit list.

split: open-access


prompt:
Receivers pair the parity streams the wrong way round.

Rate-1/2, constraint-length-3 convolutional encoder with generators 7 (111) and 5 (101) octal. The register holds the current bit in bit 2 and the two previous bits below it; for each input bit output the g=7 parity then the g=5 parity, then shift. Two zero tail bits terminate the trellis. Return the output bit list.

split: open-access


prompt:
The reported path metric understates the errors on the terminated path.

Hard-decision Viterbi decoder for the terminated K=3 (7,5) code (outputs g=7 then g=5 per step, two zero tail bits). Branch metric is the Hamming distance between the received pair and the branch output. Survivors keep the first strictly better candidate (states in ascending order, input 0 before 1). Decoding ends in state 0 and the two tail bits are removed. Return [decoded bits, final path metric]; odd or too-short input returns None.

split: open-access


prompt:
Every decoded frame has two extra trailing zeros.

Hard-decision Viterbi decoder for the terminated K=3 (7,5) code (outputs g=7 then g=5 per step, two zero tail bits). Branch metric is the Hamming distance between the received pair and the branch output. Survivors keep the first strictly better candidate (states in ascending order, input 0 before 1). Decoding ends in state 0 and the two tail bits are removed. Return [decoded bits, final path metric]; odd or too-short input returns None.

split: open-access


prompt:
Pairs with both bits wrong are penalised like a single error, so wrong paths win.

Hard-decision Viterbi decoder for the terminated K=3 (7,5) code (outputs g=7 then g=5 per step, two zero tail bits). Branch metric is the Hamming distance between the received pair and the branch output. Survivors keep the first strictly better candidate (states in ascending order, input 0 before 1). Decoding ends in state 0 and the two tail bits are removed. Return [decoded bits, final path metric]; odd or too-short input returns None.

split: open-access


prompt:
Products that overflow the byte disagree with the Reed-Solomon field.

Multiply two elements of GF(2^8) defined by the primitive polynomial x^8+x^4+x^3+x^2+1 (0x11D) using shift-and-add. Operands outside 0..255 return None.

split: open-access


prompt:
Products exceed 255 or differ from the field product.

Multiply two elements of GF(2^8) defined by the primitive polynomial x^8+x^4+x^3+x^2+1 (0x11D) using shift-and-add. Operands outside 0..255 return None.

split: open-access


prompt:
Operands with the top bit set are not reduced.

Multiply two elements of GF(2^8) defined by the primitive polynomial x^8+x^4+x^3+x^2+1 (0x11D) using shift-and-add. Operands outside 0..255 return None.

split: open-access


prompt:
Quotients are wrong whenever the log difference is negative.

Table-driven GF(2^8) (polynomial 0x11D, generator 2) operations: "div" a/b (None for b = 0, 0 for a = 0 otherwise), "inv" 1/a (None for 0) and "pow" a^b for integer b >= 0 (0^0 = 1, 0^b = 0). EXP is extended to 510 entries so sums of logarithms need no reduction. Unknown ops return None.

split: open-access


prompt:
The inverse of 1 is reported as 0.

Table-driven GF(2^8) (polynomial 0x11D, generator 2) operations: "div" a/b (None for b = 0, 0 for a = 0 otherwise), "inv" 1/a (None for 0) and "pow" a^b for integer b >= 0 (0^0 = 1, 0^b = 0). EXP is extended to 510 entries so sums of logarithms need no reduction. Unknown ops return None.

split: open-access


prompt:
Polynomial evaluation at 0 loses its constant term.

Table-driven GF(2^8) (polynomial 0x11D, generator 2) operations: "div" a/b (None for b = 0, 0 for a = 0 otherwise), "inv" 1/a (None for 0) and "pow" a^b for integer b >= 0 (0^0 = 1, 0^b = 0). EXP is extended to 510 entries so sums of logarithms need no reduction. Unknown ops return None.

split: open-access


prompt:
0/0 silently yields 0.

Table-driven GF(2^8) (polynomial 0x11D, generator 2) operations: "div" a/b (None for b = 0, 0 for a = 0 otherwise), "inv" 1/a (None for 0) and "pow" a^b for integer b >= 0 (0^0 = 1, 0^b = 0). EXP is extended to 510 entries so sums of logarithms need no reduction. Unknown ops return None.

split: open-access


prompt:
Error-free codewords report nonzero syndromes.

Reed-Solomon syndromes over GF(2^8) (0x11D, alpha = 2, first consecutive root alpha^0). msg lists coefficients from the highest degree down. S_j = msg(alpha^j) for j = 0..nsym-1 by Horner evaluation. Return [syndromes, whether any syndrome is nonzero].

split: open-access


prompt:
Codewords generated with roots alpha^0, alpha^1 fail the check.

Reed-Solomon syndromes over GF(2^8) (0x11D, alpha = 2, first consecutive root alpha^0). msg lists coefficients from the highest degree down. S_j = msg(alpha^j) for j = 0..nsym-1 by Horner evaluation. Return [syndromes, whether any syndrome is nonzero].

split: open-access


prompt:
Errors that happen to leave S_0 zero are reported clean.

Reed-Solomon syndromes over GF(2^8) (0x11D, alpha = 2, first consecutive root alpha^0). msg lists coefficients from the highest degree down. S_j = msg(alpha^j) for j = 0..nsym-1 by Horner evaluation. Return [syndromes, whether any syndrome is nonzero].

split: open-access


prompt:
Correctable errors are written at the mirrored degree or rejected.

Correct at most one symbol error in a Reed-Solomon codeword with two parity symbols over GF(2^8) (0x11D, roots alpha^0 and alpha^1, alpha = 2). msg lists coefficients highest degree first, so index n-1-i holds degree i. With S0 = msg(1) and S1 = msg(alpha): both zero -> clean; one zero -> uncorrectable; else the error degree is log(S1/S0), which must be < n, and the error value is S0. Return [corrected symbols or None, status].

split: open-access


prompt:
The error value is applied to the symbol at the mirrored position.

Correct at most one symbol error in a Reed-Solomon codeword with two parity symbols over GF(2^8) (0x11D, roots alpha^0 and alpha^1, alpha = 2). msg lists coefficients highest degree first, so index n-1-i holds degree i. With S0 = msg(1) and S1 = msg(alpha): both zero -> clean; one zero -> uncorrectable; else the error degree is log(S1/S0), which must be < n, and the error value is S0. Return [corrected symbols or None, status].

split: open-access


prompt:
The located symbol is changed by the wrong amount.

Correct at most one symbol error in a Reed-Solomon codeword with two parity symbols over GF(2^8) (0x11D, roots alpha^0 and alpha^1, alpha = 2). msg lists coefficients highest degree first, so index n-1-i holds degree i. With S0 = msg(1) and S1 = msg(alpha): both zero -> clean; one zero -> uncorrectable; else the error degree is log(S1/S0), which must be < n, and the error value is S0. Return [corrected symbols or None, status].

split: open-access


prompt:
Multi-symbol errors are "corrected" at a wrapped position.

Correct at most one symbol error in a Reed-Solomon codeword with two parity symbols over GF(2^8) (0x11D, roots alpha^0 and alpha^1, alpha = 2). msg lists coefficients highest degree first, so index n-1-i holds degree i. With S0 = msg(1) and S1 = msg(alpha): both zero -> clean; one zero -> uncorrectable; else the error degree is log(S1/S0), which must be < n, and the error value is S0. Return [corrected symbols or None, status].

split: open-access


prompt:
Error patterns with exactly one zero syndrome are "corrected" using log(0).

Correct at most one symbol error in a Reed-Solomon codeword with two parity symbols over GF(2^8) (0x11D, roots alpha^0 and alpha^1, alpha = 2). msg lists coefficients highest degree first, so index n-1-i holds degree i. With S0 = msg(1) and S1 = msg(alpha): both zero -> clean; one zero -> uncorrectable; else the error degree is log(S1/S0), which must be < n, and the error value is S0. Return [corrected symbols or None, status].

split: open-access


prompt:
Rebuilt stripes return parity as data for most stripes.

RAID-5 left-symmetric layout on n >= 3 disks: in stripe s the parity lives on disk n-1-(s mod n) and data chunk j lives on disk (parity + 1 + j) mod n. blocks lists the stripe per disk (ints; at most one None for a failed disk). A missing block is rebuilt by XOR; with no missing block the XOR of all blocks must be 0 or the result is "parity-mismatch". Return [data chunks in logical order, parity block].

split: open-access


prompt:
Logical chunks come back rotated for stripes whose parity is not on the last disk.

RAID-5 left-symmetric layout on n >= 3 disks: in stripe s the parity lives on disk n-1-(s mod n) and data chunk j lives on disk (parity + 1 + j) mod n. blocks lists the stripe per disk (ints; at most one None for a failed disk). A missing block is rebuilt by XOR; with no missing block the XOR of all blocks must be 0 or the result is "parity-mismatch". Return [data chunks in logical order, parity block].

split: open-access


prompt:
Stripes with silent corruption are returned as valid data.

RAID-5 left-symmetric layout on n >= 3 disks: in stripe s the parity lives on disk n-1-(s mod n) and data chunk j lives on disk (parity + 1 + j) mod n. blocks lists the stripe per disk (ints; at most one None for a failed disk). A missing block is rebuilt by XOR; with no missing block the XOR of all blocks must be 0 or the result is "parity-mismatch". Return [data chunks in logical order, parity block].

split: open-access


prompt:
Q-based rebuilds return wrong bytes.

Recover one missing data block of a RAID-6 stripe over GF(2^8) (0x11D). data has exactly one None (else None is returned). P = XOR of data; Q = sum of g^k * D_k with g = 2 and k the 0-based disk index. Use P when it is available; otherwise rebuild D_i = (Q + sum over present k of g^k D_k) * g^(-i); if neither is available return None.

split: open-access


prompt:
Rebuilt blocks are wrong except on disk 0.

Recover one missing data block of a RAID-6 stripe over GF(2^8) (0x11D). data has exactly one None (else None is returned). P = XOR of data; Q = sum of g^k * D_k with g = 2 and k the 0-based disk index. Use P when it is available; otherwise rebuild D_i = (Q + sum over present k of g^k D_k) * g^(-i); if neither is available return None.

split: open-access


prompt:
Two-bit errors are "corrected" into a third wrong bit.

Two-dimensional parity product code. m is a (rows+1) x (cols+1) bit matrix: the last column holds row parities, the last row column parities, and the corner the overall parity, so every full row and column is even. A single failing row and single failing column locate one error (in data or parity) which is flipped. Return [status, data block without parity row/column] with status clean/corrected, or ["uncorrectable", None].

split: open-access


prompt:
An error in a row parity bit is reported uncorrectable.

Two-dimensional parity product code. m is a (rows+1) x (cols+1) bit matrix: the last column holds row parities, the last row column parities, and the corner the overall parity, so every full row and column is even. A single failing row and single failing column locate one error (in data or parity) which is flipped. Return [status, data block without parity row/column] with status clean/corrected, or ["uncorrectable", None].

split: open-access


prompt:
Corrected blocks contain one extra row of parity bits.

Two-dimensional parity product code. m is a (rows+1) x (cols+1) bit matrix: the last column holds row parities, the last row column parities, and the corner the overall parity, so every full row and column is even. A single failing row and single failing column locate one error (in data or parity) which is flipped. Return [status, data block without parity row/column] with status clean/corrected, or ["uncorrectable", None].

split: open-access


prompt:
Decoded messages are wrong because correlations are not symmetric around zero.

Maximum-likelihood decoding of the first-order Reed-Muller code RM(1,3) by fast Hadamard transform. Codeword bit x (0..7) is m0 ^ m1*x2 ^ m2*x1 ^ m3*x0 where x2 x1 x0 are the bits of x. Map bit b to 1 - 2b, transform, pick u with the largest |W[u]| (smallest u on ties); m1 m2 m3 are the bits of u from the top, m0 = 0 when W[u] > 0 else 1. Return [[m0, m1, m2, m3], |W[u]|]; invalid input returns None.

split: open-access


prompt:
Messages with m0 = 1 decode to the wrong linear part.

Maximum-likelihood decoding of the first-order Reed-Muller code RM(1,3) by fast Hadamard transform. Codeword bit x (0..7) is m0 ^ m1*x2 ^ m2*x1 ^ m3*x0 where x2 x1 x0 are the bits of x. Map bit b to 1 - 2b, transform, pick u with the largest |W[u]| (smallest u on ties); m1 m2 m3 are the bits of u from the top, m0 = 0 when W[u] > 0 else 1. Return [[m0, m1, m2, m3], |W[u]|]; invalid input returns None.

split: open-access


prompt:
Correlations for odd u come out negated or misplaced.

Maximum-likelihood decoding of the first-order Reed-Muller code RM(1,3) by fast Hadamard transform. Codeword bit x (0..7) is m0 ^ m1*x2 ^ m2*x1 ^ m3*x0 where x2 x1 x0 are the bits of x. Map bit b to 1 - 2b, transform, pick u with the largest |W[u]| (smallest u on ties); m1 m2 m3 are the bits of u from the top, m0 = 0 when W[u] > 0 else 1. Return [[m0, m1, m2, m3], |W[u]|]; invalid input returns None.

split: open-access


prompt:
m1 and m3 come back swapped.

Maximum-likelihood decoding of the first-order Reed-Muller code RM(1,3) by fast Hadamard transform. Codeword bit x (0..7) is m0 ^ m1*x2 ^ m2*x1 ^ m3*x0 where x2 x1 x0 are the bits of x. Map bit b to 1 - 2b, transform, pick u with the largest |W[u]| (smallest u on ties); m1 m2 m3 are the bits of u from the top, m0 = 0 when W[u] > 0 else 1. Return [[m0, m1, m2, m3], |W[u]|]; invalid input returns None.

split: open-access


prompt:
Outgoing messages point back towards the incoming belief instead of the extrinsic one.

Offset min-sum check-node update for LDPC decoding with integer LLRs. For each edge i the outgoing message is the product of the signs of all OTHER incoming LLRs (0 counts as positive) times max(min |other LLR| - beta, 0). Fewer than two edges returns None. Return the outgoing messages in edge order.

split: open-access


prompt:
The least reliable edge receives its own small magnitude back.

Offset min-sum check-node update for LDPC decoding with integer LLRs. For each edge i the outgoing message is the product of the signs of all OTHER incoming LLRs (0 counts as positive) times max(min |other LLR| - beta, 0). Fewer than two edges returns None. Return the outgoing messages in edge order.

split: open-access


prompt:
Weak messages flip sign after the offset is applied.

Offset min-sum check-node update for LDPC decoding with integer LLRs. For each edge i the outgoing message is the product of the signs of all OTHER incoming LLRs (0 counts as positive) times max(min |other LLR| - beta, 0). Fewer than two edges returns None. Return the outgoing messages in edge order.

split: open-access


prompt:
Words fixed by the final permitted iteration are reported as failures.

Parallel Gallager bit-flipping decoder. H lists the variable indices of each parity check. In each iteration: if every check is satisfied stop with success; otherwise count, per bit, the unsatisfied checks it joins and flip all bits that reach the maximum count. At most max_iter flipping iterations are performed and the syndrome is checked after the last one. Return [bits, iterations performed, success].

split: open-access


prompt:
Decoding needs more iterations or fails where parallel flipping succeeds.

Parallel Gallager bit-flipping decoder. H lists the variable indices of each parity check. In each iteration: if every check is satisfied stop with success; otherwise count, per bit, the unsatisfied checks it joins and flip all bits that reach the maximum count. At most max_iter flipping iterations are performed and the syndrome is checked after the last one. Return [bits, iterations performed, success].

split: open-access


prompt:
Even-distance codes are credited with one more correctable error.

Given a block code as a list of equal-length codewords (duplicates allowed but ignored; fewer than two distinct words or unequal lengths return None), compute the minimum Hamming distance d, the guaranteed correction capability t = floor((d-1)/2), detection capability d-1, and whether a pattern of the given errors and erasures is decodable (2*errors + erasures < d). Return [d, t, detect, decodable].

split: open-access


prompt:
Patterns with errors are declared decodable beyond the code capability.

Given a block code as a list of equal-length codewords (duplicates allowed but ignored; fewer than two distinct words or unequal lengths return None), compute the minimum Hamming distance d, the guaranteed correction capability t = floor((d-1)/2), detection capability d-1, and whether a pattern of the given errors and erasures is decodable (2*errors + erasures < d). Return [d, t, detect, decodable].

split: open-access


prompt:
A code list containing a repeated word reports distance 0.

Given a block code as a list of equal-length codewords (duplicates allowed but ignored; fewer than two distinct words or unequal lengths return None), compute the minimum Hamming distance d, the guaranteed correction capability t = floor((d-1)/2), detection capability d-1, and whether a pattern of the given errors and erasures is decodable (2*errors + erasures < d). Return [d, t, detect, decodable].

split: open-access


prompt:
Detection capability is overstated by one.

Given a block code as a list of equal-length codewords (duplicates allowed but ignored; fewer than two distinct words or unequal lengths return None), compute the minimum Hamming distance d, the guaranteed correction capability t = floor((d-1)/2), detection capability d-1, and whether a pattern of the given errors and erasures is decodable (2*errors + erasures < d). Return [d, t, detect, decodable].

split: open-access


prompt:
Received words are "corrected" by high-weight patterns instead of the most likely error.

Syndrome decoding of a binary linear code from its parity-check matrix H (rows). The coset-leader table is built by enumerating error patterns by increasing weight and, within a weight, in lexicographic order of error positions; the first pattern seen for a syndrome is its leader. Decode r by XORing the leader of its syndrome. Return [codeword, leader weight] (None if the syndrome has no leader).

split: open-access


prompt:
Syndromes of different cosets collide or miss the table.

Syndrome decoding of a binary linear code from its parity-check matrix H (rows). The coset-leader table is built by enumerating error patterns by increasing weight and, within a weight, in lexicographic order of error positions; the first pattern seen for a syndrome is its leader. Decode r by XORing the leader of its syndrome. Return [codeword, leader weight] (None if the syndrome has no leader).

split: open-access


prompt:
Errors on bits that were received as 1 are never removed.

Syndrome decoding of a binary linear code from its parity-check matrix H (rows). The coset-leader table is built by enumerating error patterns by increasing weight and, within a weight, in lexicographic order of error positions; the first pattern seen for a syndrome is its leader. Decode r by XORing the leader of its syndrome. Return [codeword, leader weight] (None if the syndrome has no leader).

split: open-access


prompt:
Soft values are placed at shifted positions after the first punctured bit.

Depuncture a rate-matched soft stream: the mother-code stream of length total was punctured with a cyclic 0/1 pattern starting at pattern phase 0 for every block. Reinsert LLR 0 at punctured positions and place received values at kept positions. If the number of received values differs from the number of kept positions, or the pattern keeps nothing, return None. Return the depunctured list.

split: open-access


prompt:
Blocks whose length is not a multiple of the pattern period are rejected.

Depuncture a rate-matched soft stream: the mother-code stream of length total was punctured with a cyclic 0/1 pattern starting at pattern phase 0 for every block. Reinsert LLR 0 at punctured positions and place received values at kept positions. If the number of received values differs from the number of kept positions, or the pattern keeps nothing, return None. Return the depunctured list.

split: open-access


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

N = 1
observations = []
def solve(op, x):
    EC = {'L': 1, 'M': 0, 'Q': 3, 'H': 2}
    def enc(level, mask):
        data = (EC[level] << 3) | mask
        rem = data << 10
        for i in range(14, 9, -1):
            if rem & (1 << i):
                rem ^= 0x537 << (i - 10)
        return (data << 10) | rem
    if op == 'encode':
        level, mask = x
        if level not in EC or not 0 <= mask <= 7:
            return None
        return enc(level, mask)
    best = None
    for level in 'LMQH':
        for mask in range(8):
            dist = bin(enc(level, mask) ^ x).count('1')
            if dist <= 3 and (best is None or dist < best[2]):
                best = [level, mask, dist]
    return best
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression ["encode", ["L", 0]]', ['encode', ['L', 0]], 30660], ['regression ["encode", ["L", 3]]', ['encode', ['L', 3]], 30877], ['control ["encode", ["X", 1]]', ['encode', ['X', 1]], None], ['control ["encode", ["L", 8]]', ['encode', ['L', 8]], None], ['control ["decode", 21533]', ['decode', 21533], None], ['control ["encode", ["L", 7]]', ['encode', ['L', 7]], 26998], ['control ["encode", ["M", 0]]', ['encode', ['M', 0]], 21522], ['control ["encode", ["M", 3]]', ['encode', ['M', 3]], 23371]], [['regression ["encode", ["L", 7]]', ['encode', ['L', 7]], 26998], ['regression ["encode", ["M", 0]]', ['encode', ['M', 0]], 21522], ['control ["decode", 21533]', ['decode', 21533], None], ['control ["encode", ["X", 1]]', ['encode', ['X', 1]], None], ['control ["encode", ["L", 8]]', ['encode', ['L', 8]], None], ['control ["encode", ["Q", 0]]', ['encode', ['Q', 0]], 13663], ['control ["encode", ["Q", 3]]', ['encode', ['Q', 3]], 14854], ['control ["encode", ["Q", 5]]', ['encode', ['Q', 5]], 8579]], [['regression ["encode", ["M", 5]]', ['encode', ['M', 5]], 16590], ['regression ["encode", ["M", 7]]', ['encode', ['M', 7]], 19104], ['control ["encode", ["L", 8]]', ['encode', ['L', 8]], None], ['control ["decode", 21533]', ['decode', 21533], None], ['control ["encode", ["X", 1]]', ['encode', ['X', 1]], None], ['control ["encode", ["H", 3]]', ['encode', ['H', 3]], 6608], ['control ["encode", ["H", 5]]', ['encode', ['H', 5]], 597], ['control ["encode", ["H", 7]]', ['encode', ['H', 7]], 2107]], [['regression ["encode", ["Q", 3]]', ['encode', ['Q', 3]], 14854], ['regression ["encode", ["Q", 5]]', ['encode', ['Q', 5]], 8579], ['control ["encode", ["X", 1]]', ['encode', ['X', 1]], None], ['control ["encode", ["L", 8]]', ['encode', ['L', 8]], None], ['control ["decode", 21533]', ['decode', 21533], None], ['control ["decode", 19724]', ['decode', 19724], ['H', 6, 1]], ['control ["decode", 6616]', ['decode', 6616], ['H', 3, 1]], ['control ["decode", 20345]', ['decode', 20345], ['M', 4, 3]]], [['regression ["encode", ["H", 0]]', ['encode', ['H', 0]], 5769], ['regression ["encode", ["H", 3]]', ['encode', ['H', 3]], 6608], ['control ["decode", 21533]', ['decode', 21533], None], ['control ["encode", ["X", 1]]', ['encode', ['X', 1]], None], ['control ["encode", ["L", 8]]', ['encode', ['L', 8]], None], ['control ["decode", 2309]', ['decode', 2309], ['H', 6, 3]], ['control ["decode", 2099]', ['decode', 2099], ['H', 7, 1]], ['control ["decode", 27094]', ['decode', 27094], ['L', 7, 2]]]]
for label, args, expected in fixtures[N - 1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(op, x):
    EC = {'L': 1, 'M': 0, 'Q': 3, 'H': 2}
    def enc(level, mask):
        data = ((EC[level] << 3) | mask) ^ 0b10101
        rem = data << 10
        for i in range(14, 9, -1):
            if rem & (1 << i):
                rem ^= 0x537 << (i - 10)
        return (data << 10) | rem
    if op == 'encode':
        level, mask = x
        if level not in EC or not 0 <= mask <= 7:
            return None
        return enc(level, mask)
    best = None
    for level in 'LMQH':
        for mask in range(8):
            dist = bin(enc(level, mask) ^ x).count('1')
            if dist <= 3 and (best is None or dist < best[2]):
                best = [level, mask, dist]
    return best
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression ["encode", ["L", 0]]', ['encode', ['L', 0]], 30660], ['regression ["encode", ["L", 3]]', ['encode', ['L', 3]], 30877], ['control ["encode", ["X", 1]]', ['encode', ['X', 1]], None], ['control ["encode", ["L", 8]]', ['encode', ['L', 8]], None], ['control ["decode", 21533]', ['decode', 21533], None], ['control ["encode", ["L", 7]]', ['encode', ['L', 7]], 26998], ['control ["encode", ["M", 0]]', ['encode', ['M', 0]], 21522], ['control ["encode", ["M", 3]]', ['encode', ['M', 3]], 23371]], [['regression ["encode", ["L", 7]]', ['encode', ['L', 7]], 26998], ['regression ["encode", ["M", 0]]', ['encode', ['M', 0]], 21522], ['control ["decode", 21533]', ['decode', 21533], None], ['control ["encode", ["X", 1]]', ['encode', ['X', 1]], None], ['control ["encode", ["L", 8]]', ['encode', ['L', 8]], None], ['control ["encode", ["Q", 0]]', ['encode', ['Q', 0]], 13663], ['control ["encode", ["Q", 3]]', ['encode', ['Q', 3]], 14854], ['control ["encode", ["Q", 5]]', ['encode', ['Q', 5]], 8579]], [['regression ["encode", ["M", 5]]', ['encode', ['M', 5]], 16590], ['regression ["encode", ["M", 7]]', ['encode', ['M', 7]], 19104], ['control ["encode", ["L", 8]]', ['encode', ['L', 8]], None], ['control ["decode", 21533]', ['decode', 21533], None], ['control ["encode", ["X", 1]]', ['encode', ['X', 1]], None], ['control ["encode", ["H", 3]]', ['encode', ['H', 3]], 6608], ['control ["encode", ["H", 5]]', ['encode', ['H', 5]], 597], ['control ["encode", ["H", 7]]', ['encode', ['H', 7]], 2107]], [['regression ["encode", ["Q", 3]]', ['encode', ['Q', 3]], 14854], ['regression ["encode", ["Q", 5]]', ['encode', ['Q', 5]], 8579], ['control ["encode", ["X", 1]]', ['encode', ['X', 1]], None], ['control ["encode", ["L", 8]]', ['encode', ['L', 8]], None], ['control ["decode", 21533]', ['decode', 21533], None], ['control ["decode", 19724]', ['decode', 19724], ['H', 6, 1]], ['control ["decode", 6616]', ['decode', 6616], ['H', 3, 1]], ['control ["decode", 20345]', ['decode', 20345], ['M', 4, 3]]], [['regression ["encode", ["H", 0]]', ['encode', ['H', 0]], 5769], ['regression ["encode", ["H", 3]]', ['encode', ['H', 3]], 6608], ['control ["decode", 21533]', ['decode', 21533], None], ['control ["encode", ["X", 1]]', ['encode', ['X', 1]], None], ['control ["encode", ["L", 8]]', ['encode', ['L', 8]], None], ['control ["decode", 2309]', ['decode', 2309], ['H', 6, 3]], ['control ["decode", 2099]', ['decode', 2099], ['H', 7, 1]], ['control ["decode", 27094]', ['decode', 27094], ['L', 7, 2]]]]
for label, args, expected in fixtures[N - 1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Format words disagree with printed symbols; decoding finds nothing within distance 3.

QR code format information, a BCH(15,5) code. "encode" takes [level, mask] with level bits L=01, M=00, Q=11, H=10 and mask 0..7 (else None): data = level<<3 | mask, append the 10-bit remainder of data*x^10 modulo 0x537, then XOR 0x5412. "decode" takes a 15-bit integer and returns [level, mask, distance] for the unique format word within Hamming distance 3, else None.

split: open-access


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

N = 1
observations = []
def solve(op, x):
    EC = {'L': 0, 'M': 1, 'Q': 2, 'H': 3}
    def enc(level, mask):
        data = (EC[level] << 3) | mask
        rem = data << 10
        for i in range(14, 9, -1):
            if rem & (1 << i):
                rem ^= 0x537 << (i - 10)
        return ((data << 10) | rem) ^ 0x5412
    if op == 'encode':
        level, mask = x
        if level not in EC or not 0 <= mask <= 7:
            return None
        return enc(level, mask)
    best = None
    for level in 'LMQH':
        for mask in range(8):
            dist = bin(enc(level, mask) ^ x).count('1')
            if dist <= 3 and (best is None or dist < best[2]):
                best = [level, mask, dist]
    return best
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression ["encode", ["L", 0]]', ['encode', ['L', 0]], 30660], ['regression ["encode", ["L", 3]]', ['encode', ['L', 3]], 30877], ['partial-repair ["encode", ["Q", 0]]', ['encode', ['Q', 0]], 13663], ['partial-repair ["encode", ["Q", 3]]', ['encode', ['Q', 3]], 14854], ['control ["encode", ["X", 1]]', ['encode', ['X', 1]], None], ['control ["encode", ["L", 8]]', ['encode', ['L', 8]], None], ['control ["decode", 0]', ['decode', 0], None], ['control ["decode", 32767]', ['decode', 32767], None]], [['regression ["encode", ["L", 7]]', ['encode', ['L', 7]], 26998], ['regression ["encode", ["M", 0]]', ['encode', ['M', 0]], 21522], ['partial-repair ["encode", ["Q", 7]]', ['encode', ['Q', 7]], 11245], ['partial-repair ["encode", ["H", 0]]', ['encode', ['H', 0]], 5769], ['control ["encode", ["X", 1]]', ['encode', ['X', 1]], None], ['control ["encode", ["L", 8]]', ['encode', ['L', 8]], None], ['control ["decode", 0]', ['decode', 0], None], ['control ["decode", 32767]', ['decode', 32767], None]], [['regression ["encode", ["M", 5]]', ['encode', ['M', 5]], 16590], ['regression ["encode", ["M", 7]]', ['encode', ['M', 7]], 19104], ['partial-repair ["encode", ["H", 5]]', ['encode', ['H', 5]], 597], ['partial-repair ["encode", ["H", 7]]', ['encode', ['H', 7]], 2107], ['control ["encode", ["X", 1]]', ['encode', ['X', 1]], None], ['control ["encode", ["L", 8]]', ['encode', ['L', 8]], None], ['control ["decode", 0]', ['decode', 0], None], ['control ["decode", 32767]', ['decode', 32767], None]], [['regression ["encode", ["Q", 3]]', ['encode', ['Q', 3]], 14854], ['regression ["encode", ["Q", 5]]', ['encode', ['Q', 5]], 8579], ['partial-repair ["decode", 19724]', ['decode', 19724], ['H', 6, 1]], ['partial-repair ["decode", 6616]', ['decode', 6616], ['H', 3, 1]], ['control ["encode", ["X", 1]]', ['encode', ['X', 1]], None], ['control ["encode", ["L", 8]]', ['encode', ['L', 8]], None], ['control ["decode", 0]', ['decode', 0], None], ['control ["decode", 32767]', ['decode', 32767], None]], [['regression ["encode", ["H", 0]]', ['encode', ['H', 0]], 5769], ['regression ["encode", ["H", 3]]', ['encode', ['H', 3]], 6608], ['partial-repair ["decode", 2099]', ['decode', 2099], ['H', 7, 1]], ['partial-repair ["encode", ["Q", 0]]', ['encode', ['Q', 0]], 13663], ['control ["encode", ["X", 1]]', ['encode', ['X', 1]], None], ['control ["encode", ["L", 8]]', ['encode', ['L', 8]], None], ['control ["decode", 0]', ['decode', 0], None], ['control ["decode", 32767]', ['decode', 32767], None]]]
for label, args, expected in fixtures[N - 1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(op, x):
    EC = {'L': 1, 'M': 0, 'Q': 2, 'H': 3}
    def enc(level, mask):
        data = (EC[level] << 3) | mask
        rem = data << 10
        for i in range(14, 9, -1):
            if rem & (1 << i):
                rem ^= 0x537 << (i - 10)
        return ((data << 10) | rem) ^ 0x5412
    if op == 'encode':
        level, mask = x
        if level not in EC or not 0 <= mask <= 7:
            return None
        return enc(level, mask)
    best = None
    for level in 'LMQH':
        for mask in range(8):
            dist = bin(enc(level, mask) ^ x).count('1')
            if dist <= 3 and (best is None or dist < best[2]):
                best = [level, mask, dist]
    return best
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression ["encode", ["L", 0]]', ['encode', ['L', 0]], 30660], ['regression ["encode", ["L", 3]]', ['encode', ['L', 3]], 30877], ['partial-repair ["encode", ["Q", 0]]', ['encode', ['Q', 0]], 13663], ['partial-repair ["encode", ["Q", 3]]', ['encode', ['Q', 3]], 14854], ['control ["encode", ["X", 1]]', ['encode', ['X', 1]], None], ['control ["encode", ["L", 8]]', ['encode', ['L', 8]], None], ['control ["decode", 0]', ['decode', 0], None], ['control ["decode", 32767]', ['decode', 32767], None]], [['regression ["encode", ["L", 7]]', ['encode', ['L', 7]], 26998], ['regression ["encode", ["M", 0]]', ['encode', ['M', 0]], 21522], ['partial-repair ["encode", ["Q", 7]]', ['encode', ['Q', 7]], 11245], ['partial-repair ["encode", ["H", 0]]', ['encode', ['H', 0]], 5769], ['control ["encode", ["X", 1]]', ['encode', ['X', 1]], None], ['control ["encode", ["L", 8]]', ['encode', ['L', 8]], None], ['control ["decode", 0]', ['decode', 0], None], ['control ["decode", 32767]', ['decode', 32767], None]], [['regression ["encode", ["M", 5]]', ['encode', ['M', 5]], 16590], ['regression ["encode", ["M", 7]]', ['encode', ['M', 7]], 19104], ['partial-repair ["encode", ["H", 5]]', ['encode', ['H', 5]], 597], ['partial-repair ["encode", ["H", 7]]', ['encode', ['H', 7]], 2107], ['control ["encode", ["X", 1]]', ['encode', ['X', 1]], None], ['control ["encode", ["L", 8]]', ['encode', ['L', 8]], None], ['control ["decode", 0]', ['decode', 0], None], ['control ["decode", 32767]', ['decode', 32767], None]], [['regression ["encode", ["Q", 3]]', ['encode', ['Q', 3]], 14854], ['regression ["encode", ["Q", 5]]', ['encode', ['Q', 5]], 8579], ['partial-repair ["decode", 19724]', ['decode', 19724], ['H', 6, 1]], ['partial-repair ["decode", 6616]', ['decode', 6616], ['H', 3, 1]], ['control ["encode", ["X", 1]]', ['encode', ['X', 1]], None], ['control ["encode", ["L", 8]]', ['encode', ['L', 8]], None], ['control ["decode", 0]', ['decode', 0], None], ['control ["decode", 32767]', ['decode', 32767], None]], [['regression ["encode", ["H", 0]]', ['encode', ['H', 0]], 5769], ['regression ["encode", ["H", 3]]', ['encode', ['H', 3]], 6608], ['partial-repair ["decode", 2099]', ['decode', 2099], ['H', 7, 1]], ['partial-repair ["encode", ["Q", 0]]', ['encode', ['Q', 0]], 13663], ['control ["encode", ["X", 1]]', ['encode', ['X', 1]], None], ['control ["encode", ["L", 8]]', ['encode', ['L', 8]], None], ['control ["decode", 0]', ['decode', 0], None], ['control ["decode", 32767]', ['decode', 32767], None]]]
for label, args, expected in fixtures[N - 1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Every level except H decodes as a different level.

QR code format information, a BCH(15,5) code. "encode" takes [level, mask] with level bits L=01, M=00, Q=11, H=10 and mask 0..7 (else None): data = level<<3 | mask, append the 10-bit remainder of data*x^10 modulo 0x537, then XOR 0x5412. "decode" takes a 15-bit integer and returns [level, mask, distance] for the unique format word within Hamming distance 3, else None.

split: open-access


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

N = 1
observations = []
def solve(op, x):
    EC = {'L': 1, 'M': 0, 'Q': 3, 'H': 2}
    def enc(level, mask):
        data = (EC[level] << 3) | mask
        rem = data << 10
        for i in range(14, 10, -1):
            if rem & (1 << i):
                rem ^= 0x537 << (i - 10)
        return ((data << 10) | rem) ^ 0x5412
    if op == 'encode':
        level, mask = x
        if level not in EC or not 0 <= mask <= 7:
            return None
        return enc(level, mask)
    best = None
    for level in 'LMQH':
        for mask in range(8):
            dist = bin(enc(level, mask) ^ x).count('1')
            if dist <= 3 and (best is None or dist < best[2]):
                best = [level, mask, dist]
    return best
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression ["encode", ["L", 3]]', ['encode', ['L', 3]], 30877], ['regression ["encode", ["M", 3]]', ['encode', ['M', 3]], 23371], ['partial-repair ["encode", ["Q", 0]]', ['encode', ['Q', 0]], 13663], ['partial-repair ["encode", ["Q", 3]]', ['encode', ['Q', 3]], 14854], ['control ["encode", ["L", 0]]', ['encode', ['L', 0]], 30660], ['control ["encode", ["L", 5]]', ['encode', ['L', 5]], 25368], ['control ["encode", ["L", 7]]', ['encode', ['L', 7]], 26998], ['control ["encode", ["M", 0]]', ['encode', ['M', 0]], 21522]], [['regression ["encode", ["Q", 5]]', ['encode', ['Q', 5]], 8579], ['regression ["encode", ["Q", 7]]', ['encode', ['Q', 7]], 11245], ['partial-repair ["encode", ["H", 0]]', ['encode', ['H', 0]], 5769], ['control ["encode", ["M", 7]]', ['encode', ['M', 7]], 19104], ['control ["decode", 30660]', ['decode', 30660], ['L', 0, 0]], ['control ["encode", ["X", 1]]', ['encode', ['X', 1]], None], ['control ["encode", ["L", 8]]', ['encode', ['L', 8]], None], ['control ["decode", 0]', ['decode', 0], None]], [['regression ["encode", ["H", 5]]', ['encode', ['H', 5]], 597], ['regression ["encode", ["H", 7]]', ['encode', ['H', 7]], 2107], ['control ["decode", 32767]', ['decode', 32767], None], ['control ["decode", 21522]', ['decode', 21522], ['M', 0, 0]], ['control ["decode", 21525]', ['decode', 21525], ['M', 0, 3]], ['control ["decode", 21533]', ['decode', 21533], None], ['control ["encode", ["L", 0]]', ['encode', ['L', 0]], 30660], ['control ["encode", ["L", 5]]', ['encode', ['L', 5]], 25368]], [['regression ["decode", 6616]', ['decode', 6616], ['H', 3, 1]], ['regression ["decode", 20345]', ['decode', 20345], ['M', 4, 3]], ['partial-repair ["decode", 19724]', ['decode', 19724], ['H', 6, 1]], ['control ["encode", ["L", 5]]', ['encode', ['L', 5]], 25368], ['control ["encode", ["L", 7]]', ['encode', ['L', 7]], 26998], ['control ["encode", ["M", 0]]', ['encode', ['M', 0]], 21522], ['control ["encode", ["M", 5]]', ['encode', ['M', 5]], 16590], ['control ["encode", ["M", 7]]', ['encode', ['M', 7]], 19104]], [['regression ["decode", 2309]', ['decode', 2309], ['H', 6, 3]], ['regression ["decode", 2099]', ['decode', 2099], ['H', 7, 1]], ['partial-repair ["encode", ["Q", 0]]', ['encode', ['Q', 0]], 13663], ['control ["decode", 30660]', ['decode', 30660], ['L', 0, 0]], ['control ["encode", ["X", 1]]', ['encode', ['X', 1]], None], ['control ["encode", ["L", 8]]', ['encode', ['L', 8]], None], ['control ["decode", 0]', ['decode', 0], None], ['control ["decode", 32767]', ['decode', 32767], None]]]
for label, args, expected in fixtures[N - 1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(op, x):
    EC = {'L': 1, 'M': 0, 'Q': 3, 'H': 2}
    def enc(level, mask):
        data = (EC[level] << 3) | mask
        rem = data << 10
        for i in range(13, 9, -1):
            if rem & (1 << i):
                rem ^= 0x537 << (i - 10)
        return ((data << 10) | rem) ^ 0x5412
    if op == 'encode':
        level, mask = x
        if level not in EC or not 0 <= mask <= 7:
            return None
        return enc(level, mask)
    best = None
    for level in 'LMQH':
        for mask in range(8):
            dist = bin(enc(level, mask) ^ x).count('1')
            if dist <= 3 and (best is None or dist < best[2]):
                best = [level, mask, dist]
    return best
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression ["encode", ["L", 3]]', ['encode', ['L', 3]], 30877], ['regression ["encode", ["M", 3]]', ['encode', ['M', 3]], 23371], ['partial-repair ["encode", ["Q", 0]]', ['encode', ['Q', 0]], 13663], ['partial-repair ["encode", ["Q", 3]]', ['encode', ['Q', 3]], 14854], ['control ["encode", ["L", 0]]', ['encode', ['L', 0]], 30660], ['control ["encode", ["L", 5]]', ['encode', ['L', 5]], 25368], ['control ["encode", ["L", 7]]', ['encode', ['L', 7]], 26998], ['control ["encode", ["M", 0]]', ['encode', ['M', 0]], 21522]], [['regression ["encode", ["Q", 5]]', ['encode', ['Q', 5]], 8579], ['regression ["encode", ["Q", 7]]', ['encode', ['Q', 7]], 11245], ['partial-repair ["encode", ["H", 0]]', ['encode', ['H', 0]], 5769], ['control ["encode", ["M", 7]]', ['encode', ['M', 7]], 19104], ['control ["decode", 30660]', ['decode', 30660], ['L', 0, 0]], ['control ["encode", ["X", 1]]', ['encode', ['X', 1]], None], ['control ["encode", ["L", 8]]', ['encode', ['L', 8]], None], ['control ["decode", 0]', ['decode', 0], None]], [['regression ["encode", ["H", 5]]', ['encode', ['H', 5]], 597], ['regression ["encode", ["H", 7]]', ['encode', ['H', 7]], 2107], ['control ["decode", 32767]', ['decode', 32767], None], ['control ["decode", 21522]', ['decode', 21522], ['M', 0, 0]], ['control ["decode", 21525]', ['decode', 21525], ['M', 0, 3]], ['control ["decode", 21533]', ['decode', 21533], None], ['control ["encode", ["L", 0]]', ['encode', ['L', 0]], 30660], ['control ["encode", ["L", 5]]', ['encode', ['L', 5]], 25368]], [['regression ["decode", 6616]', ['decode', 6616], ['H', 3, 1]], ['regression ["decode", 20345]', ['decode', 20345], ['M', 4, 3]], ['partial-repair ["decode", 19724]', ['decode', 19724], ['H', 6, 1]], ['control ["encode", ["L", 5]]', ['encode', ['L', 5]], 25368], ['control ["encode", ["L", 7]]', ['encode', ['L', 7]], 26998], ['control ["encode", ["M", 0]]', ['encode', ['M', 0]], 21522], ['control ["encode", ["M", 5]]', ['encode', ['M', 5]], 16590], ['control ["encode", ["M", 7]]', ['encode', ['M', 7]], 19104]], [['regression ["decode", 2309]', ['decode', 2309], ['H', 6, 3]], ['regression ["decode", 2099]', ['decode', 2099], ['H', 7, 1]], ['partial-repair ["encode", ["Q", 0]]', ['encode', ['Q', 0]], 13663], ['control ["decode", 30660]', ['decode', 30660], ['L', 0, 0]], ['control ["encode", ["X", 1]]', ['encode', ['X', 1]], None], ['control ["encode", ["L", 8]]', ['encode', ['L', 8]], None], ['control ["decode", 0]', ['decode', 0], None], ['control ["decode", 32767]', ['decode', 32767], None]]]
for label, args, expected in fixtures[N - 1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Remainders are left unreduced for some data values.

QR code format information, a BCH(15,5) code. "encode" takes [level, mask] with level bits L=01, M=00, Q=11, H=10 and mask 0..7 (else None): data = level<<3 | mask, append the 10-bit remainder of data*x^10 modulo 0x537, then XOR 0x5412. "decode" takes a 15-bit integer and returns [level, mask, distance] for the unique format word within Hamming distance 3, else None.

split: open-access


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

N = 1
observations = []
def solve(op, x):
    EC = {'L': 1, 'M': 0, 'Q': 3, 'H': 2}
    def enc(level, mask):
        data = (EC[level] << 3) | mask
        rem = data << 10
        for i in range(14, 9, -1):
            if rem & (1 << i):
                rem ^= 0x537 << (i - 10)
        return ((data << 10) | rem) ^ 0x5412
    if op == 'encode':
        level, mask = x
        if level not in EC or not 0 <= mask <= 7:
            return None
        return enc(level, mask)
    best = None
    for level in 'LMQH':
        for mask in range(8):
            dist = bin(enc(level, mask) ^ x).count('1')
            if dist < 3 and (best is None or dist < best[2]):
                best = [level, mask, dist]
    return best
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression ["decode", 32647]', ['decode', 32647], ['M', 6, 3]], ['regression ["decode", 1588]', ['decode', 1588], ['Q', 4, 3]], ['partial-repair ["decode", 21533]', ['decode', 21533], None], ['control ["encode", ["L", 0]]', ['encode', ['L', 0]], 30660], ['control ["encode", ["L", 3]]', ['encode', ['L', 3]], 30877], ['control ["encode", ["L", 5]]', ['encode', ['L', 5]], 25368], ['control ["encode", ["L", 7]]', ['encode', ['L', 7]], 26998], ['control ["encode", ["M", 0]]', ['encode', ['M', 0]], 21522]], [['regression ["decode", 31121]', ['decode', 31121], ['L', 3, 3]], ['regression ["decode", 2309]', ['decode', 2309], ['H', 6, 3]], ['partial-repair ["decode", 21533]', ['decode', 21533], None], ['control ["encode", ["M", 3]]', ['encode', ['M', 3]], 23371], ['control ["encode", ["M", 5]]', ['encode', ['M', 5]], 16590], ['control ["encode", ["M", 7]]', ['encode', ['M', 7]], 19104], ['control ["encode", ["Q", 0]]', ['encode', ['Q', 0]], 13663], ['control ["encode", ["Q", 3]]', ['encode', ['Q', 3]], 14854]], [['regression ["decode", 32647]', ['decode', 32647], ['M', 6, 3]], ['regression ["decode", 1588]', ['decode', 1588], ['Q', 4, 3]], ['partial-repair ["decode", 21533]', ['decode', 21533], None], ['control ["encode", ["Q", 5]]', ['encode', ['Q', 5]], 8579], ['control ["encode", ["Q", 7]]', ['encode', ['Q', 7]], 11245], ['control ["encode", ["H", 0]]', ['encode', ['H', 0]], 5769], ['control ["encode", ["H", 3]]', ['encode', ['H', 3]], 6608], ['control ["encode", ["H", 5]]', ['encode', ['H', 5]], 597]], [['regression ["decode", 31121]', ['decode', 31121], ['L', 3, 3]], ['regression ["decode", 2309]', ['decode', 2309], ['H', 6, 3]], ['partial-repair ["decode", 21533]', ['decode', 21533], None], ['control ["encode", ["H", 7]]', ['encode', ['H', 7]], 2107], ['control ["decode", 19724]', ['decode', 19724], ['H', 6, 1]], ['control ["decode", 6616]', ['decode', 6616], ['H', 3, 1]], ['control ["decode", 30660]', ['decode', 30660], ['L', 0, 0]], ['control ["decode", 2099]', ['decode', 2099], ['H', 7, 1]]], [['regression ["decode", 32647]', ['decode', 32647], ['M', 6, 3]], ['regression ["decode", 1588]', ['decode', 1588], ['Q', 4, 3]], ['partial-repair ["decode", 21533]', ['decode', 21533], None], ['control ["decode", 27094]', ['decode', 27094], ['L', 7, 2]], ['control ["encode", ["X", 1]]', ['encode', ['X', 1]], None], ['control ["encode", ["L", 8]]', ['encode', ['L', 8]], None], ['control ["decode", 0]', ['decode', 0], None], ['control ["decode", 32767]', ['decode', 32767], None]]]
for label, args, expected in fixtures[N - 1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(op, x):
    EC = {'L': 1, 'M': 0, 'Q': 3, 'H': 2}
    def enc(level, mask):
        data = (EC[level] << 3) | mask
        rem = data << 10
        for i in range(14, 9, -1):
            if rem & (1 << i):
                rem ^= 0x537 << (i - 10)
        return ((data << 10) | rem) ^ 0x5412
    if op == 'encode':
        level, mask = x
        if level not in EC or not 0 <= mask <= 7:
            return None
        return enc(level, mask)
    best = None
    for level in 'LMQH':
        for mask in range(8):
            dist = bin(enc(level, mask) ^ x).count('1')
            if dist <= 4 and (best is None or dist < best[2]):
                best = [level, mask, dist]
    return best
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression ["decode", 32647]', ['decode', 32647], ['M', 6, 3]], ['regression ["decode", 1588]', ['decode', 1588], ['Q', 4, 3]], ['partial-repair ["decode", 21533]', ['decode', 21533], None], ['control ["encode", ["L", 0]]', ['encode', ['L', 0]], 30660], ['control ["encode", ["L", 3]]', ['encode', ['L', 3]], 30877], ['control ["encode", ["L", 5]]', ['encode', ['L', 5]], 25368], ['control ["encode", ["L", 7]]', ['encode', ['L', 7]], 26998], ['control ["encode", ["M", 0]]', ['encode', ['M', 0]], 21522]], [['regression ["decode", 31121]', ['decode', 31121], ['L', 3, 3]], ['regression ["decode", 2309]', ['decode', 2309], ['H', 6, 3]], ['partial-repair ["decode", 21533]', ['decode', 21533], None], ['control ["encode", ["M", 3]]', ['encode', ['M', 3]], 23371], ['control ["encode", ["M", 5]]', ['encode', ['M', 5]], 16590], ['control ["encode", ["M", 7]]', ['encode', ['M', 7]], 19104], ['control ["encode", ["Q", 0]]', ['encode', ['Q', 0]], 13663], ['control ["encode", ["Q", 3]]', ['encode', ['Q', 3]], 14854]], [['regression ["decode", 32647]', ['decode', 32647], ['M', 6, 3]], ['regression ["decode", 1588]', ['decode', 1588], ['Q', 4, 3]], ['partial-repair ["decode", 21533]', ['decode', 21533], None], ['control ["encode", ["Q", 5]]', ['encode', ['Q', 5]], 8579], ['control ["encode", ["Q", 7]]', ['encode', ['Q', 7]], 11245], ['control ["encode", ["H", 0]]', ['encode', ['H', 0]], 5769], ['control ["encode", ["H", 3]]', ['encode', ['H', 3]], 6608], ['control ["encode", ["H", 5]]', ['encode', ['H', 5]], 597]], [['regression ["decode", 31121]', ['decode', 31121], ['L', 3, 3]], ['regression ["decode", 2309]', ['decode', 2309], ['H', 6, 3]], ['partial-repair ["decode", 21533]', ['decode', 21533], None], ['control ["encode", ["H", 7]]', ['encode', ['H', 7]], 2107], ['control ["decode", 19724]', ['decode', 19724], ['H', 6, 1]], ['control ["decode", 6616]', ['decode', 6616], ['H', 3, 1]], ['control ["decode", 30660]', ['decode', 30660], ['L', 0, 0]], ['control ["decode", 2099]', ['decode', 2099], ['H', 7, 1]]], [['regression ["decode", 32647]', ['decode', 32647], ['M', 6, 3]], ['regression ["decode", 1588]', ['decode', 1588], ['Q', 4, 3]], ['partial-repair ["decode", 21533]', ['decode', 21533], None], ['control ["decode", 27094]', ['decode', 27094], ['L', 7, 2]], ['control ["encode", ["X", 1]]', ['encode', ['X', 1]], None], ['control ["encode", ["L", 8]]', ['encode', ['L', 8]], None], ['control ["decode", 0]', ['decode', 0], None], ['control ["decode", 32767]', ['decode', 32767], None]]]
for label, args, expected in fixtures[N - 1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Format words with three bit errors are rejected although the code corrects them.

QR code format information, a BCH(15,5) code. "encode" takes [level, mask] with level bits L=01, M=00, Q=11, H=10 and mask 0..7 (else None): data = level<<3 | mask, append the 10-bit remainder of data*x^10 modulo 0x537, then XOR 0x5412. "decode" takes a 15-bit integer and returns [level, mask, distance] for the unique format word within Hamming distance 3, else None.

split: open-access


prompt:
Rows with sparse, harmless corrected errors are retired.

Memory-controller ECC policy. events are [time, row, kind] with kind "ce" (corrected) or "ue" (uncorrectable), processed in time order (stable for equal times). A "ue" retires its row immediately. A "ce" is added to the row's history, entries at or before time - window expire, and the row retires when the remaining count reaches the threshold. Events for a retired row are ignored. Return sorted [row, retirement time] pairs.

split: open-access


prompt:
Unrelated rows are retired because their neighbours had errors.

Memory-controller ECC policy. events are [time, row, kind] with kind "ce" (corrected) or "ue" (uncorrectable), processed in time order (stable for equal times). A "ue" retires its row immediately. A "ce" is added to the row's history, entries at or before time - window expire, and the row retires when the remaining count reaches the threshold. Events for a retired row are ignored. Return sorted [row, retirement time] pairs.

split: open-access


prompt:
Retirement timestamps move later as more errors arrive on an already retired row.

Memory-controller ECC policy. events are [time, row, kind] with kind "ce" (corrected) or "ue" (uncorrectable), processed in time order (stable for equal times). A "ue" retires its row immediately. A "ce" is added to the row's history, entries at or before time - window expire, and the row retires when the remaining count reaches the threshold. Events for a retired row are ignored. Return sorted [row, retirement time] pairs.

split: open-access


prompt:
Rows with an uncorrectable error stay in service until the threshold is reached.

Memory-controller ECC policy. events are [time, row, kind] with kind "ce" (corrected) or "ue" (uncorrectable), processed in time order (stable for equal times). A "ue" retires its row immediately. A "ce" is added to the row's history, entries at or before time - window expire, and the row retires when the remaining count reaches the threshold. Events for a retired row are ignored. Return sorted [row, retirement time] pairs.

split: open-access


prompt:
Out-of-order logs expire or count the wrong errors.

Memory-controller ECC policy. events are [time, row, kind] with kind "ce" (corrected) or "ue" (uncorrectable), processed in time order (stable for equal times). A "ue" retires its row immediately. A "ce" is added to the row's history, entries at or before time - window expire, and the row retires when the remaining count reaches the threshold. Events for a retired row are ignored. Return sorted [row, retirement time] pairs.

split: open-access


prompt:
Symbols that become degree one late in the list are never used.

Peeling (belief-propagation) decoder for an LT fountain code over bytes. symbols is a list of [neighbour indices, XOR of those source symbols]. Repeatedly find an encoded symbol with exactly one unresolved neighbour, resolve it as the value XOR all resolved neighbours, and continue until a full pass makes no progress. Return the k source values with None for unresolved ones.

split: open-access


prompt:
Resolved source values are wrong whenever the releasing symbol had degree above one.

Peeling (belief-propagation) decoder for an LT fountain code over bytes. symbols is a list of [neighbour indices, XOR of those source symbols]. Repeatedly find an encoded symbol with exactly one unresolved neighbour, resolve it as the value XOR all resolved neighbours, and continue until a full pass makes no progress. Return the k source values with None for unresolved ones.

split: open-access


prompt:
Higher-degree symbols are never peeled, leaving many sources unresolved.

Peeling (belief-propagation) decoder for an LT fountain code over bytes. symbols is a list of [neighbour indices, XOR of those source symbols]. Repeatedly find an encoded symbol with exactly one unresolved neighbour, resolve it as the value XOR all resolved neighbours, and continue until a full pass makes no progress. Return the k source values with None for unresolved ones.

split: open-access


prompt:
Frames whose CRC byte took the hit are declared uncorrectable.

Frames of 2..15 bytes end with a CRC-8 (polynomial 0x07, initial value 0, MSB first, no final XOR) over the preceding bytes. A matching CRC is "clean"; otherwise try every single-bit flip across the whole frame, including the CRC byte, and accept the first that makes the CRC match ("corrected"). Otherwise "uncorrectable". Return [status, payload bytes or None].

split: open-access


prompt:
Clean frames are reported corrupted or "corrected" into different payloads.

Frames of 2..15 bytes end with a CRC-8 (polynomial 0x07, initial value 0, MSB first, no final XOR) over the preceding bytes. A matching CRC is "clean"; otherwise try every single-bit flip across the whole frame, including the CRC byte, and accept the first that makes the CRC match ("corrected"). Otherwise "uncorrectable". Return [status, payload bytes or None].

split: open-access


prompt:
Negative samples are quantised one step less reliable than positive samples of equal magnitude.

Quantise soft demodulator samples to signed integer LLRs for a hard/soft decoder. Each sample y (integer) is scaled (v = y * scale, in hundredths), rounded to the nearest integer with halves rounded away from zero, and saturated symmetrically to +-(2^(bits-1) - 1). Positive LLR means bit 0, negative bit 1, zero is an erasure (None). Return [llrs, hard decisions].

split: open-access


prompt:
Large samples produce LLRs outside the decoder word size.

Quantise soft demodulator samples to signed integer LLRs for a hard/soft decoder. Each sample y (integer) is scaled (v = y * scale, in hundredths), rounded to the nearest integer with halves rounded away from zero, and saturated symmetrically to +-(2^(bits-1) - 1). Positive LLR means bit 0, negative bit 1, zero is an erasure (None). Return [llrs, hard decisions].

split: open-access


prompt:
Recovered symbols are wrong whenever k - 1 is odd.

Systematic Reed-Solomon erasure code over GF(257): the k data symbols are the values of a degree < k polynomial at x = 1..k, and any symbol is its value at another x. Given surviving shares [x, y] (duplicates allowed if they agree; conflicting duplicates return None; y is reduced mod 257), recover the k data symbols by Lagrange interpolation over the k shares with the smallest x. Fewer than k distinct x values returns None.

split: open-access


prompt:
A corrupted duplicate share silently replaces the good one.

Systematic Reed-Solomon erasure code over GF(257): the k data symbols are the values of a degree < k polynomial at x = 1..k, and any symbol is its value at another x. Given surviving shares [x, y] (duplicates allowed if they agree; conflicting duplicates return None; y is reduced mod 257), recover the k data symbols by Lagrange interpolation over the k shares with the smallest x. Fewer than k distinct x values returns None.

split: open-access


prompt:
Too few distinct shares are accepted and interpolation uses fewer points than needed.

Systematic Reed-Solomon erasure code over GF(257): the k data symbols are the values of a degree < k polynomial at x = 1..k, and any symbol is its value at another x. Given surviving shares [x, y] (duplicates allowed if they agree; conflicting duplicates return None; y is reduced mod 257), recover the k data symbols by Lagrange interpolation over the k shares with the smallest x. Fewer than k distinct x values returns None.

split: open-access


prompt:
Recovered data is shifted by one position and includes a value at x = 0.

Systematic Reed-Solomon erasure code over GF(257): the k data symbols are the values of a degree < k polynomial at x = 1..k, and any symbol is its value at another x. Given surviving shares [x, y] (duplicates allowed if they agree; conflicting duplicates return None; y is reduced mod 257), recover the k data symbols by Lagrange interpolation over the k shares with the smallest x. Fewer than k distinct x values returns None.

split: open-access


prompt:
Quoted burst capability is too large by up to one symbol.

Guaranteed burst correction of an RS(n, k) code with m-bit symbols interleaved to depth D. Each codeword corrects t = floor((n - k) / 2) symbol errors; D interleaved codewords correct any burst of at most (t*D - 1)*m + 1 bits (a burst that straddles symbol boundaries touches one extra symbol). t = 0 gives 0. Invalid parameters return None.

split: open-access


prompt:
Codes with an odd number of parity symbols are credited with an extra correctable symbol.

Guaranteed burst correction of an RS(n, k) code with m-bit symbols interleaved to depth D. Each codeword corrects t = floor((n - k) / 2) symbol errors; D interleaved codewords correct any burst of at most (t*D - 1)*m + 1 bits (a burst that straddles symbol boundaries touches one extra symbol). t = 0 gives 0. Invalid parameters return None.

split: open-access


prompt:
A single-parity code is credited with a non-positive or one-bit burst capability.

Guaranteed burst correction of an RS(n, k) code with m-bit symbols interleaved to depth D. Each codeword corrects t = floor((n - k) / 2) symbol errors; D interleaved codewords correct any burst of at most (t*D - 1)*m + 1 bits (a burst that straddles symbol boundaries touches one extra symbol). t = 0 gives 0. Invalid parameters return None.

split: open-access


prompt:
Retransmissions that disagree strongly are combined with the wrong sign or magnitude.

Hybrid-ARQ chase combining. txs are equal-length LLR vectors from successive transmissions (None where a position was not received). Combined LLR = sum of received values, saturated once at the end to [-clip, clip]. Hard decision: positive -> 0, negative -> 1, zero -> None (undecided). Return [combined, hard]; empty or ragged input returns None.

split: open-access


prompt:
Positions with no information are reported as confident zeros.

Hybrid-ARQ chase combining. txs are equal-length LLR vectors from successive transmissions (None where a position was not received). Combined LLR = sum of received values, saturated once at the end to [-clip, clip]. Hard decision: positive -> 0, negative -> 1, zero -> None (undecided). Return [combined, hard]; empty or ragged input returns None.

split: open-access


prompt:
The histogram totals 2^k - 1 and weight 0 is missing.

Weight distribution of the binary linear code spanned by the rows of generator matrix G (rows may be dependent). Enumerate all 2^k messages including the zero message, form codewords as XOR combinations of rows, and histogram their Hamming weights (index 0..n). dmin is the smallest nonzero weight present (0 if the code is only the zero word). Return [histogram, dmin].

split: open-access


prompt:
Codeword weights are inflated when rows overlap.

Weight distribution of the binary linear code spanned by the rows of generator matrix G (rows may be dependent). Enumerate all 2^k messages including the zero message, form codewords as XOR combinations of rows, and histogram their Hamming weights (index 0..n). dmin is the smallest nonzero weight present (0 if the code is only the zero word). Return [histogram, dmin].

split: open-access


prompt:
Minimum distance is overstated when a combination of rows is lighter than every row.

Weight distribution of the binary linear code spanned by the rows of generator matrix G (rows may be dependent). Enumerate all 2^k messages including the zero message, form codewords as XOR combinations of rows, and histogram their Hamming weights (index 0..n). dmin is the smallest nonzero weight present (0 if the code is only the zero word). Return [histogram, dmin].

split: open-access


prompt:
Payloads that are an exact multiple of k (and empty payloads) get an extra, empty codeword.

Frame a payload of the given number of bytes into shortened RS(n, k) codewords: cw = ceil(payload / k) codewords, the last one carries payload - (cw - 1)*k data bytes (shortened, zero padding not transmitted), and each codeword adds n - k parity bytes. An empty payload uses no codewords. Return [cw, last data bytes, bytes sent]; invalid parameters return None.

split: open-access


prompt:
Bandwidth estimates count padding bytes that a shortened code never sends.

Frame a payload of the given number of bytes into shortened RS(n, k) codewords: cw = ceil(payload / k) codewords, the last one carries payload - (cw - 1)*k data bytes (shortened, zero padding not transmitted), and each codeword adds n - k parity bytes. An empty payload uses no codewords. Return [cw, last data bytes, bytes sent]; invalid parameters return None.

split: open-access


prompt:
An empty payload reports k data bytes in its last codeword.

Frame a payload of the given number of bytes into shortened RS(n, k) codewords: cw = ceil(payload / k) codewords, the last one carries payload - (cw - 1)*k data bytes (shortened, zero padding not transmitted), and each codeword adds n - k parity bytes. An empty payload uses no codewords. Return [cw, last data bytes, bytes sent]; invalid parameters return None.

split: open-access


prompt:
Cosets collapse to zero and the parity count is wrong.

Design a binary narrow-sense BCH code of length n = 2^m - 1 correcting t errors: its generator has as roots the union of the 2-cyclotomic cosets mod n of 1..2t. Return [distinct cosets in order of first representative, each sorted, number of parity bits n - k = size of the union]. Invalid n or t < 1 returns None.

split: open-access


prompt:
Codes correct fewer errors than requested.

Design a binary narrow-sense BCH code of length n = 2^m - 1 correcting t errors: its generator has as roots the union of the 2-cyclotomic cosets mod n of 1..2t. Return [distinct cosets in order of first representative, each sorted, number of parity bits n - k = size of the union]. Invalid n or t < 1 returns None.

split: open-access


prompt:
The coset list repeats a coset reached from a later representative.

Design a binary narrow-sense BCH code of length n = 2^m - 1 correcting t errors: its generator has as roots the union of the 2-cyclotomic cosets mod n of 1..2t. Return [distinct cosets in order of first representative, each sorted, number of parity bits n - k = size of the union]. Invalid n or t < 1 returns None.

split: open-access


prompt:
Received words equidistant from two codewords are decoded to an arbitrary one.

Bounded-distance decoding against an explicit codebook (duplicate entries allowed). Find the codeword at minimum Hamming distance from r; if two different codewords tie for the minimum, or the minimum exceeds radius, return None. Otherwise return [codeword, distance].

split: open-access


prompt:
Heavily corrupted words are decoded instead of flagged.

Bounded-distance decoding against an explicit codebook (duplicate entries allowed). Find the codeword at minimum Hamming distance from r; if two different codewords tie for the minimum, or the minimum exceeds radius, return None. Otherwise return [codeword, distance].

split: open-access


prompt:
Valid card numbers are reported invalid while some single-digit typos pass.

Input a card-style number that may contain spaces or hyphens as group separators. After removing them the text must be 2..19 ASCII digits, otherwise "malformed". Doubling applies to every second digit counting from the rightmost (check) digit, doubled values above 9 lose 9, and the number is "valid" when the sum is a multiple of 10, else "invalid".

split: open-access


prompt:
Numbers containing a doubled 9 are misjudged.

Input a card-style number that may contain spaces or hyphens as group separators. After removing them the text must be 2..19 ASCII digits, otherwise "malformed". Doubling applies to every second digit counting from the rightmost (check) digit, doubled values above 9 lose 9, and the number is "valid" when the sum is a multiple of 10, else "invalid".

split: open-access


prompt:
Hyphen-grouped card numbers are rejected as malformed.

Input a card-style number that may contain spaces or hyphens as group separators. After removing them the text must be 2..19 ASCII digits, otherwise "malformed". Doubling applies to every second digit counting from the rightmost (check) digit, doubled values above 9 lose 9, and the number is "valid" when the sum is a multiple of 10, else "invalid".

split: open-access


prompt:
A single "0" is accepted as a valid account number.

Input a card-style number that may contain spaces or hyphens as group separators. After removing them the text must be 2..19 ASCII digits, otherwise "malformed". Doubling applies to every second digit counting from the rightmost (check) digit, doubled values above 9 lose 9, and the number is "valid" when the sum is a multiple of 10, else "invalid".

split: open-access


prompt:
Arabic-Indic digit strings are scored as valid or invalid instead of malformed.

Input a card-style number that may contain spaces or hyphens as group separators. After removing them the text must be 2..19 ASCII digits, otherwise "malformed". Doubling applies to every second digit counting from the rightmost (check) digit, doubled values above 9 lose 9, and the number is "valid" when the sum is a multiple of 10, else "invalid".

split: open-access


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

N = 1
observations = []
def solve(s):
    if len(s) != 12 or not s.isascii() or not s[:2].isalpha() or not s[:2].isupper():
        return 'malformed'
    if not s[2:11].isalnum() or s[2:11] != s[2:11].upper() or not s[11].isdigit():
        return 'malformed'
    digits = ''
    for ch in s[:11]:
        digits += ch if ch.isdigit() else str(ord(ch) - 64)
    total = 0
    for i, ch in enumerate(reversed(digits)):
        d = int(ch)
        if i % 2 == 0:
            d *= 2
            if d > 9:
                d -= 9
        total += d
    check = (10 - total % 10) % 10
    return [check, check == int(s[11])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression ["US4V5PGS4IX8"]', ['US4V5PGS4IX8'], [0, False]], ['regression ["GBOV8F5J6090"]', ['GBOV8F5J6090'], [7, False]], ['control ["US037833100"]', ['US037833100'], 'malformed'], ['control ["us0378331005"]', ['us0378331005'], 'malformed'], ['control ["US03783310a5"]', ['US03783310a5'], 'malformed'], ['control ["12Q037833100"]', ['12Q037833100'], 'malformed'], ['control ["1S0378331005"]', ['1S0378331005'], 'malformed'], ['control ["U10378331005"]', ['U10378331005'], 'malformed']], [['regression ["JPFWKDL124I1"]', ['JPFWKDL124I1'], [1, True]], ['regression ["CHXVXSVIT016"]', ['CHXVXSVIT016'], [1, False]], ['partial-repair ["FRLWNIYHPT37"]', ['FRLWNIYHPT37'], [5, False]], ['control ["U10378331005"]', ['U10378331005'], 'malformed'], ['control ["US000000000A"]', ['US000000000A'], 'malformed'], ['control ["US037833100"]', ['US037833100'], 'malformed'], ['control ["us0378331005"]', ['us0378331005'], 'malformed'], ['control ["US03783310a5"]', ['US03783310a5'], 'malformed']], [['regression ["XS0K4JDSXBN1"]', ['XS0K4JDSXBN1'], [4, False]], ['regression ["AUKWRNHD2XR3"]', ['AUKWRNHD2XR3'], [8, False]], ['partial-repair ["NL5BVKR8BB60"]', ['NL5BVKR8BB60'], [3, False]], ['partial-repair ["CA3CKMM2IAN8"]', ['CA3CKMM2IAN8'], [0, False]], ['control ["12Q037833100"]', ['12Q037833100'], 'malformed'], ['control ["1S0378331005"]', ['1S0378331005'], 'malformed'], ['control ["U10378331005"]', ['U10378331005'], 'malformed'], ['control ["US000000000A"]', ['US000000000A'], 'malformed']], [['regression ["US6754047769"]', ['US6754047769'], [8, False]], ['regression ["IE9141151847"]', ['IE9141151847'], [0, False]], ['partial-repair ["LU7763909076"]', ['LU7763909076'], [8, False]], ['control ["us0378331005"]', ['us0378331005'], 'malformed'], ['control ["US03783310a5"]', ['US03783310a5'], 'malformed'], ['control ["12Q037833100"]', ['12Q037833100'], 'malformed'], ['control ["1S0378331005"]', ['1S0378331005'], 'malformed'], ['control ["U10378331005"]', ['U10378331005'], 'malformed']], [['regression ["KY3791880781"]', ['KY3791880781'], [4, False]], ['regression ["BM9170095145"]', ['BM9170095145'], [7, False]], ['partial-repair ["US0378331005"]', ['US0378331005'], [5, True]], ['control ["US000000000A"]', ['US000000000A'], 'malformed'], ['control ["US037833100"]', ['US037833100'], 'malformed'], ['control ["us0378331005"]', ['us0378331005'], 'malformed'], ['control ["US03783310a5"]', ['US03783310a5'], 'malformed'], ['control ["12Q037833100"]', ['12Q037833100'], 'malformed']]]
for label, args, expected in fixtures[N - 1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(s):
    if len(s) != 12 or not s.isascii() or not s[:2].isalpha() or not s[:2].isupper():
        return 'malformed'
    if not s[2:11].isalnum() or s[2:11] != s[2:11].upper() or not s[11].isdigit():
        return 'malformed'
    digits = ''
    for ch in s[:11]:
        digits += ch if ch.isdigit() else str(ord(ch) - 65)
    total = 0
    for i, ch in enumerate(reversed(digits)):
        d = int(ch)
        if i % 2 == 0:
            d *= 2
            if d > 9:
                d -= 9
        total += d
    check = (10 - total % 10) % 10
    return [check, check == int(s[11])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression ["US4V5PGS4IX8"]', ['US4V5PGS4IX8'], [0, False]], ['regression ["GBOV8F5J6090"]', ['GBOV8F5J6090'], [7, False]], ['control ["US037833100"]', ['US037833100'], 'malformed'], ['control ["us0378331005"]', ['us0378331005'], 'malformed'], ['control ["US03783310a5"]', ['US03783310a5'], 'malformed'], ['control ["12Q037833100"]', ['12Q037833100'], 'malformed'], ['control ["1S0378331005"]', ['1S0378331005'], 'malformed'], ['control ["U10378331005"]', ['U10378331005'], 'malformed']], [['regression ["JPFWKDL124I1"]', ['JPFWKDL124I1'], [1, True]], ['regression ["CHXVXSVIT016"]', ['CHXVXSVIT016'], [1, False]], ['partial-repair ["FRLWNIYHPT37"]', ['FRLWNIYHPT37'], [5, False]], ['control ["U10378331005"]', ['U10378331005'], 'malformed'], ['control ["US000000000A"]', ['US000000000A'], 'malformed'], ['control ["US037833100"]', ['US037833100'], 'malformed'], ['control ["us0378331005"]', ['us0378331005'], 'malformed'], ['control ["US03783310a5"]', ['US03783310a5'], 'malformed']], [['regression ["XS0K4JDSXBN1"]', ['XS0K4JDSXBN1'], [4, False]], ['regression ["AUKWRNHD2XR3"]', ['AUKWRNHD2XR3'], [8, False]], ['partial-repair ["NL5BVKR8BB60"]', ['NL5BVKR8BB60'], [3, False]], ['partial-repair ["CA3CKMM2IAN8"]', ['CA3CKMM2IAN8'], [0, False]], ['control ["12Q037833100"]', ['12Q037833100'], 'malformed'], ['control ["1S0378331005"]', ['1S0378331005'], 'malformed'], ['control ["U10378331005"]', ['U10378331005'], 'malformed'], ['control ["US000000000A"]', ['US000000000A'], 'malformed']], [['regression ["US6754047769"]', ['US6754047769'], [8, False]], ['regression ["IE9141151847"]', ['IE9141151847'], [0, False]], ['partial-repair ["LU7763909076"]', ['LU7763909076'], [8, False]], ['control ["us0378331005"]', ['us0378331005'], 'malformed'], ['control ["US03783310a5"]', ['US03783310a5'], 'malformed'], ['control ["12Q037833100"]', ['12Q037833100'], 'malformed'], ['control ["1S0378331005"]', ['1S0378331005'], 'malformed'], ['control ["U10378331005"]', ['U10378331005'], 'malformed']], [['regression ["KY3791880781"]', ['KY3791880781'], [4, False]], ['regression ["BM9170095145"]', ['BM9170095145'], [7, False]], ['partial-repair ["US0378331005"]', ['US0378331005'], [5, True]], ['control ["US000000000A"]', ['US000000000A'], 'malformed'], ['control ["US037833100"]', ['US037833100'], 'malformed'], ['control ["us0378331005"]', ['us0378331005'], 'malformed'], ['control ["US03783310a5"]', ['US03783310a5'], 'malformed'], ['control ["12Q037833100"]', ['12Q037833100'], 'malformed']]]
for label, args, expected in fixtures[N - 1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
ISINs containing letters get the wrong computed check digit.

Input a 12-character ISIN: two uppercase ASCII letters (country), nine uppercase alphanumerics, one check digit; anything else is "malformed". Letters expand to two digits (A=10 .. Z=35), then Luhn doubling starts at the rightmost digit of the expanded 11-character payload. Return [computed check digit, whether it matches].

split: open-access