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

N = 1
observations = []
def solve(code):
    names = {100: 'LOAD_CONST', 110: 'JUMP_FORWARD', 113: 'JUMP_ABSOLUTE', 83: 'RETURN_VALUE', 9: 'NOP'}
    out = []
    ext = 0
    start = None
    for off in range(0, len(code) - 1, 2):
        op, arg = code[off], code[off + 1]
        if start is None:
            start = off
        if op == 144:
            ext = (ext | arg) << 8
            continue
        full = ext | arg
        ext = 0
        target = None
        if op == 110:
            target = off + full * 2
        elif op == 113:
            target = full * 2
        out.append([start, off, names.get(op, 'UNKNOWN'), full, target])
        start = None
    if start is not None:
        out.append(['dangling-extended-arg', start])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression: prefixed absolute jump',
   ([100, 1, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 1, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 3, 100, 3],), [[0, 4, 'LOAD_CONST', 66307, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 6],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 6, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 1, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 257, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 1, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 1, 2], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 1, 144, 0],),
   [[0, 0, 'LOAD_CONST', 1, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 1, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 1, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 2, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 2, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 4, 100, 3],), [[0, 4, 'LOAD_CONST', 66563, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 7],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 7, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 2, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 258, 522], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 2, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 2, 4], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 2, 144, 0],),
   [[0, 0, 'LOAD_CONST', 2, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 2, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 2, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 3, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 3, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 5, 100, 3],), [[0, 4, 'LOAD_CONST', 66819, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 8],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 8, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 3, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 259, 524], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 3, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 3, 6], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 3, 144, 0],),
   [[0, 0, 'LOAD_CONST', 3, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 3, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 3, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 4, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 4, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 6, 100, 3],), [[0, 4, 'LOAD_CONST', 67075, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 9],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 9, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 4, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 260, 526], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 4, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 4, 8], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 4, 144, 0],),
   [[0, 0, 'LOAD_CONST', 4, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 4, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 4, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 5, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 5, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 7, 100, 3],), [[0, 4, 'LOAD_CONST', 67331, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 10],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 10, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 5, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 261, 528], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 5, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 5, 10], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 5, 144, 0],),
   [[0, 0, 'LOAD_CONST', 5, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 5, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 5, None], [2, 2, 'RETURN_VALUE', 0, None]])]]
for label, args, expected in cases[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(code):
    names = {100: 'LOAD_CONST', 110: 'JUMP_FORWARD', 113: 'JUMP_ABSOLUTE', 83: 'RETURN_VALUE', 9: 'NOP'}
    out = []
    ext = 0
    start = None
    for off in range(0, len(code) - 1, 2):
        op, arg = code[off], code[off + 1]
        if start is None:
            start = off
        if op == 144:
            ext = (ext | arg) << 8
            continue
        full = ext | arg
        ext = 0
        target = None
        if op == 110:
            target = start + 2 + full * 2
        elif op == 113:
            target = full * 2
        out.append([start, off, names.get(op, 'UNKNOWN'), full, target])
        start = None
    if start is not None:
        out.append(['dangling-extended-arg', start])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression: prefixed absolute jump',
   ([100, 1, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 1, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 3, 100, 3],), [[0, 4, 'LOAD_CONST', 66307, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 6],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 6, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 1, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 257, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 1, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 1, 2], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 1, 144, 0],),
   [[0, 0, 'LOAD_CONST', 1, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 1, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 1, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 2, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 2, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 4, 100, 3],), [[0, 4, 'LOAD_CONST', 66563, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 7],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 7, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 2, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 258, 522], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 2, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 2, 4], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 2, 144, 0],),
   [[0, 0, 'LOAD_CONST', 2, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 2, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 2, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 3, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 3, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 5, 100, 3],), [[0, 4, 'LOAD_CONST', 66819, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 8],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 8, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 3, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 259, 524], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 3, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 3, 6], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 3, 144, 0],),
   [[0, 0, 'LOAD_CONST', 3, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 3, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 3, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 4, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 4, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 6, 100, 3],), [[0, 4, 'LOAD_CONST', 67075, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 9],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 9, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 4, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 260, 526], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 4, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 4, 8], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 4, 144, 0],),
   [[0, 0, 'LOAD_CONST', 4, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 4, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 4, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 5, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 5, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 7, 100, 3],), [[0, 4, 'LOAD_CONST', 67331, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 10],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 10, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 5, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 261, 528], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 5, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 5, 10], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 5, 144, 0],),
   [[0, 0, 'LOAD_CONST', 5, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 5, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 5, None], [2, 2, 'RETURN_VALUE', 0, None]])]]
for label, args, expected in cases[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:
JUMP_FORWARD lands one instruction early.

Two-byte wordcode (opcode, arg). EXTENDED_ARG (144) prefixes build wider arguments: each prefix ORs its byte into an accumulator that is then shifted left 8; the real instruction ORs its own byte in and resets the accumulator. Each decoded instruction reports [start of its first prefix, own offset, name, full arg, jump target in bytes]: JUMP_FORWARD (110) targets the next instruction plus 2*arg, JUMP_ABSOLUTE (113) targets 2*arg. A prefix at the end reports ["dangling-extended-arg", start]. A trailing odd byte is ignored.

split: open-access


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

N = 1
observations = []
def solve(code):
    names = {100: 'LOAD_CONST', 110: 'JUMP_FORWARD', 113: 'JUMP_ABSOLUTE', 83: 'RETURN_VALUE', 9: 'NOP'}
    out = []
    ext = 0
    start = None
    for off in range(0, len(code) - 1, 2):
        op, arg = code[off], code[off + 1]
        if start is None:
            start = off
        if op == 144:
            ext = (ext | arg) << 8
            continue
        full = ext | arg
        ext = 0
        target = None
        if op == 110:
            target = off + 2 + full * 2
        elif op == 113:
            target = full
        out.append([start, off, names.get(op, 'UNKNOWN'), full, target])
        start = None
    if start is not None:
        out.append(['dangling-extended-arg', start])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression: prefixed absolute jump',
   ([100, 1, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 1, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 3, 100, 3],), [[0, 4, 'LOAD_CONST', 66307, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 6],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 6, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 1, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 257, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 1, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 1, 2], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 1, 144, 0],),
   [[0, 0, 'LOAD_CONST', 1, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 1, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 1, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 2, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 2, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 4, 100, 3],), [[0, 4, 'LOAD_CONST', 66563, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 7],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 7, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 2, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 258, 522], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 2, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 2, 4], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 2, 144, 0],),
   [[0, 0, 'LOAD_CONST', 2, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 2, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 2, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 3, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 3, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 5, 100, 3],), [[0, 4, 'LOAD_CONST', 66819, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 8],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 8, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 3, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 259, 524], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 3, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 3, 6], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 3, 144, 0],),
   [[0, 0, 'LOAD_CONST', 3, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 3, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 3, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 4, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 4, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 6, 100, 3],), [[0, 4, 'LOAD_CONST', 67075, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 9],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 9, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 4, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 260, 526], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 4, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 4, 8], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 4, 144, 0],),
   [[0, 0, 'LOAD_CONST', 4, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 4, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 4, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 5, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 5, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 7, 100, 3],), [[0, 4, 'LOAD_CONST', 67331, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 10],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 10, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 5, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 261, 528], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 5, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 5, 10], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 5, 144, 0],),
   [[0, 0, 'LOAD_CONST', 5, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 5, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 5, None], [2, 2, 'RETURN_VALUE', 0, None]])]]
for label, args, expected in cases[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)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

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

N = 1
observations = []
def solve(code):
    names = {100: 'LOAD_CONST', 110: 'JUMP_FORWARD', 113: 'JUMP_ABSOLUTE', 83: 'RETURN_VALUE', 9: 'NOP'}
    out = []
    ext = 0
    start = None
    for off in range(0, len(code) - 1, 2):
        op, arg = code[off], code[off + 1]
        if start is None:
            start = off
        if op == 144:
            ext = (ext | arg) << 8
            continue
        full = ext | arg
        ext = 0
        target = None
        if op == 110:
            target = off + 2 + full * 2
        elif op == 113:
            target = full * 2 + 2
        out.append([start, off, names.get(op, 'UNKNOWN'), full, target])
        start = None
    if start is not None:
        out.append(['dangling-extended-arg', start])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression: prefixed absolute jump',
   ([100, 1, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 1, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 3, 100, 3],), [[0, 4, 'LOAD_CONST', 66307, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 6],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 6, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 1, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 257, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 1, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 1, 2], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 1, 144, 0],),
   [[0, 0, 'LOAD_CONST', 1, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 1, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 1, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 2, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 2, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 4, 100, 3],), [[0, 4, 'LOAD_CONST', 66563, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 7],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 7, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 2, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 258, 522], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 2, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 2, 4], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 2, 144, 0],),
   [[0, 0, 'LOAD_CONST', 2, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 2, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 2, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 3, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 3, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 5, 100, 3],), [[0, 4, 'LOAD_CONST', 66819, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 8],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 8, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 3, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 259, 524], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 3, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 3, 6], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 3, 144, 0],),
   [[0, 0, 'LOAD_CONST', 3, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 3, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 3, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 4, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 4, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 6, 100, 3],), [[0, 4, 'LOAD_CONST', 67075, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 9],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 9, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 4, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 260, 526], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 4, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 4, 8], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 4, 144, 0],),
   [[0, 0, 'LOAD_CONST', 4, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 4, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 4, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 5, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 5, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 7, 100, 3],), [[0, 4, 'LOAD_CONST', 67331, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 10],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 10, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 5, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 261, 528], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 5, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 5, 10], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 5, 144, 0],),
   [[0, 0, 'LOAD_CONST', 5, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 5, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 5, None], [2, 2, 'RETURN_VALUE', 0, None]])]]
for label, args, expected in cases[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:
Absolute jumps land at half their intended byte offset.

Two-byte wordcode (opcode, arg). EXTENDED_ARG (144) prefixes build wider arguments: each prefix ORs its byte into an accumulator that is then shifted left 8; the real instruction ORs its own byte in and resets the accumulator. Each decoded instruction reports [start of its first prefix, own offset, name, full arg, jump target in bytes]: JUMP_FORWARD (110) targets the next instruction plus 2*arg, JUMP_ABSOLUTE (113) targets 2*arg. A prefix at the end reports ["dangling-extended-arg", start]. A trailing odd byte is ignored.

split: open-access


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

N = 1
observations = []
def solve(code):
    names = {100: 'LOAD_CONST', 110: 'JUMP_FORWARD', 113: 'JUMP_ABSOLUTE', 83: 'RETURN_VALUE', 9: 'NOP'}
    out = []
    ext = 0
    start = None
    for off in range(0, len(code) - 1, 2):
        op, arg = code[off], code[off + 1]
        start = off
        if op == 144:
            ext = (ext | arg) << 8
            continue
        full = ext | arg
        ext = 0
        target = None
        if op == 110:
            target = off + 2 + full * 2
        elif op == 113:
            target = full * 2
        out.append([start, off, names.get(op, 'UNKNOWN'), full, target])
        start = None
    if start is not None:
        out.append(['dangling-extended-arg', start])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression: prefixed absolute jump',
   ([100, 1, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 1, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 3, 100, 3],), [[0, 4, 'LOAD_CONST', 66307, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 6],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 6, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 1, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 257, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 1, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 1, 2], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 1, 144, 0],),
   [[0, 0, 'LOAD_CONST', 1, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 1, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 1, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 2, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 2, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 4, 100, 3],), [[0, 4, 'LOAD_CONST', 66563, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 7],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 7, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 2, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 258, 522], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 2, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 2, 4], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 2, 144, 0],),
   [[0, 0, 'LOAD_CONST', 2, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 2, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 2, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 3, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 3, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 5, 100, 3],), [[0, 4, 'LOAD_CONST', 66819, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 8],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 8, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 3, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 259, 524], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 3, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 3, 6], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 3, 144, 0],),
   [[0, 0, 'LOAD_CONST', 3, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 3, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 3, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 4, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 4, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 6, 100, 3],), [[0, 4, 'LOAD_CONST', 67075, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 9],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 9, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 4, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 260, 526], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 4, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 4, 8], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 4, 144, 0],),
   [[0, 0, 'LOAD_CONST', 4, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 4, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 4, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 5, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 5, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 7, 100, 3],), [[0, 4, 'LOAD_CONST', 67331, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 10],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 10, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 5, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 261, 528], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 5, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 5, 10], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 5, 144, 0],),
   [[0, 0, 'LOAD_CONST', 5, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 5, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 5, None], [2, 2, 'RETURN_VALUE', 0, None]])]]
for label, args, expected in cases[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(code):
    names = {100: 'LOAD_CONST', 110: 'JUMP_FORWARD', 113: 'JUMP_ABSOLUTE', 83: 'RETURN_VALUE', 9: 'NOP'}
    out = []
    ext = 0
    start = None
    for off in range(0, len(code) - 1, 2):
        op, arg = code[off], code[off + 1]
        if start is None or op != 144:
            start = off
        if op == 144:
            ext = (ext | arg) << 8
            continue
        full = ext | arg
        ext = 0
        target = None
        if op == 110:
            target = off + 2 + full * 2
        elif op == 113:
            target = full * 2
        out.append([start, off, names.get(op, 'UNKNOWN'), full, target])
        start = None
    if start is not None:
        out.append(['dangling-extended-arg', start])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression: prefixed absolute jump',
   ([100, 1, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 1, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 3, 100, 3],), [[0, 4, 'LOAD_CONST', 66307, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 6],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 6, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 1, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 257, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 1, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 1, 2], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 1, 144, 0],),
   [[0, 0, 'LOAD_CONST', 1, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 1, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 1, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 2, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 2, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 4, 100, 3],), [[0, 4, 'LOAD_CONST', 66563, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 7],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 7, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 2, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 258, 522], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 2, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 2, 4], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 2, 144, 0],),
   [[0, 0, 'LOAD_CONST', 2, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 2, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 2, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 3, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 3, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 5, 100, 3],), [[0, 4, 'LOAD_CONST', 66819, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 8],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 8, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 3, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 259, 524], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 3, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 3, 6], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 3, 144, 0],),
   [[0, 0, 'LOAD_CONST', 3, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 3, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 3, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 4, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 4, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 6, 100, 3],), [[0, 4, 'LOAD_CONST', 67075, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 9],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 9, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 4, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 260, 526], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 4, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 4, 8], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 4, 144, 0],),
   [[0, 0, 'LOAD_CONST', 4, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 4, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 4, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 5, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 5, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 7, 100, 3],), [[0, 4, 'LOAD_CONST', 67331, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 10],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 10, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 5, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 261, 528], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 5, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 5, 10], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 5, 144, 0],),
   [[0, 0, 'LOAD_CONST', 5, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 5, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 5, None], [2, 2, 'RETURN_VALUE', 0, None]])]]
for label, args, expected in cases[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:
Jump tables and line maps point into the middle of prefixed instructions.

Two-byte wordcode (opcode, arg). EXTENDED_ARG (144) prefixes build wider arguments: each prefix ORs its byte into an accumulator that is then shifted left 8; the real instruction ORs its own byte in and resets the accumulator. Each decoded instruction reports [start of its first prefix, own offset, name, full arg, jump target in bytes]: JUMP_FORWARD (110) targets the next instruction plus 2*arg, JUMP_ABSOLUTE (113) targets 2*arg. A prefix at the end reports ["dangling-extended-arg", start]. A trailing odd byte is ignored.

split: open-access


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

N = 1
observations = []
def solve(code):
    names = {100: 'LOAD_CONST', 110: 'JUMP_FORWARD', 113: 'JUMP_ABSOLUTE', 83: 'RETURN_VALUE', 9: 'NOP'}
    out = []
    ext = 0
    start = None
    for off in range(0, len(code) - 1, 2):
        op, arg = code[off], code[off + 1]
        if start is None:
            start = off
        if op == 144:
            ext = (ext | arg) << 8
            continue
        full = ext | arg
        ext = 0
        target = None
        if op == 110:
            target = off + 2 + full * 2
        elif op == 113:
            target = full * 2
        out.append([start, off, names.get(op, 'UNKNOWN'), full, target])
        start = None
    if ext:
        out.append(['dangling-extended-arg', start])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression: prefixed absolute jump',
   ([100, 1, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 1, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 3, 100, 3],), [[0, 4, 'LOAD_CONST', 66307, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 6],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 6, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 1, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 257, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 1, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 1, 2], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 1, 144, 0],),
   [[0, 0, 'LOAD_CONST', 1, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 1, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 1, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 2, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 2, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 4, 100, 3],), [[0, 4, 'LOAD_CONST', 66563, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 7],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 7, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 2, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 258, 522], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 2, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 2, 4], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 2, 144, 0],),
   [[0, 0, 'LOAD_CONST', 2, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 2, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 2, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 3, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 3, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 5, 100, 3],), [[0, 4, 'LOAD_CONST', 66819, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 8],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 8, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 3, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 259, 524], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 3, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 3, 6], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 3, 144, 0],),
   [[0, 0, 'LOAD_CONST', 3, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 3, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 3, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 4, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 4, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 6, 100, 3],), [[0, 4, 'LOAD_CONST', 67075, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 9],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 9, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 4, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 260, 526], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 4, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 4, 8], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 4, 144, 0],),
   [[0, 0, 'LOAD_CONST', 4, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 4, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 4, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 5, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 5, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 7, 100, 3],), [[0, 4, 'LOAD_CONST', 67331, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 10],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 10, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 5, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 261, 528], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 5, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 5, 10], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 5, 144, 0],),
   [[0, 0, 'LOAD_CONST', 5, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 5, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 5, None], [2, 2, 'RETURN_VALUE', 0, None]])]]
for label, args, expected in cases[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(code):
    names = {100: 'LOAD_CONST', 110: 'JUMP_FORWARD', 113: 'JUMP_ABSOLUTE', 83: 'RETURN_VALUE', 9: 'NOP'}
    out = []
    ext = 0
    start = None
    for off in range(0, len(code) - 1, 2):
        op, arg = code[off], code[off + 1]
        if start is None:
            start = off
        if op == 144:
            ext = (ext | arg) << 8
            continue
        full = ext | arg
        ext = 0
        target = None
        if op == 110:
            target = off + 2 + full * 2
        elif op == 113:
            target = full * 2
        out.append([start, off, names.get(op, 'UNKNOWN'), full, target])
        start = None
    if len(code) % 2:
        out.append(['dangling-extended-arg', start])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression: prefixed absolute jump',
   ([100, 1, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 1, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 3, 100, 3],), [[0, 4, 'LOAD_CONST', 66307, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 6],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 6, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 1, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 257, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 1, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 1, 2], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 1, 144, 0],),
   [[0, 0, 'LOAD_CONST', 1, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 1, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 1, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 2, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 2, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 4, 100, 3],), [[0, 4, 'LOAD_CONST', 66563, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 7],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 7, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 2, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 258, 522], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 2, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 2, 4], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 2, 144, 0],),
   [[0, 0, 'LOAD_CONST', 2, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 2, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 2, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 3, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 3, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 5, 100, 3],), [[0, 4, 'LOAD_CONST', 66819, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 8],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 8, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 3, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 259, 524], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 3, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 3, 6], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 3, 144, 0],),
   [[0, 0, 'LOAD_CONST', 3, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 3, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 3, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 4, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 4, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 6, 100, 3],), [[0, 4, 'LOAD_CONST', 67075, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 9],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 9, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 4, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 260, 526], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 4, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 4, 8], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 4, 144, 0],),
   [[0, 0, 'LOAD_CONST', 4, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 4, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 4, None], [2, 2, 'RETURN_VALUE', 0, None]])],
 [('regression: prefixed absolute jump',
   ([100, 5, 144, 1, 113, 4, 83, 0],),
   [[0, 0, 'LOAD_CONST', 5, None], [2, 4, 'JUMP_ABSOLUTE', 260, 520], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('two prefixes accumulate', ([144, 1, 144, 7, 100, 3],), [[0, 4, 'LOAD_CONST', 67331, None]]),
  ('prefix does not leak into the next instruction',
   ([144, 1, 100, 0, 100, 10],),
   [[0, 2, 'LOAD_CONST', 256, None], [4, 4, 'LOAD_CONST', 10, None]]),
  ('prefixed forward jump is relative to the next instruction',
   ([9, 0, 144, 1, 110, 5, 83, 0],),
   [[0, 0, 'NOP', 0, None], [2, 4, 'JUMP_FORWARD', 261, 528], [6, 6, 'RETURN_VALUE', 0, None]]),
  ('absolute jump target in bytes',
   ([113, 5, 83, 0],),
   [[0, 0, 'JUMP_ABSOLUTE', 5, 10], [2, 2, 'RETURN_VALUE', 0, None]]),
  ('trailing prefix with zero argument',
   ([100, 5, 144, 0],),
   [[0, 0, 'LOAD_CONST', 5, None], ['dangling-extended-arg', 2]]),
  ('control: unknown opcode and odd trailing byte',
   ([7, 5, 83, 0, 9],),
   [[0, 0, 'UNKNOWN', 5, None], [2, 2, 'RETURN_VALUE', 0, None]])]]
for label, args, expected in cases[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:
A code object ending in a zero-valued prefix is accepted as complete.

Two-byte wordcode (opcode, arg). EXTENDED_ARG (144) prefixes build wider arguments: each prefix ORs its byte into an accumulator that is then shifted left 8; the real instruction ORs its own byte in and resets the accumulator. Each decoded instruction reports [start of its first prefix, own offset, name, full arg, jump target in bytes]: JUMP_FORWARD (110) targets the next instruction plus 2*arg, JUMP_ABSOLUTE (113) targets 2*arg. A prefix at the end reports ["dangling-extended-arg", start]. A trailing odd byte is ignored.

split: open-access


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

N = 1
observations = []
def solve(initial, frames):
    locals_ = list(initial)
    out = []
    offset = 0
    for idx, fr in enumerate(frames):
        t = fr[0]
        stack = []
        if t <= 63:
            delta = t
        elif t <= 127:
            delta = t - 64
            stack = [fr[1]]
        elif t < 247:
            return ['ClassFormatError', idx]
        elif t == 247:
            delta = fr[1]
            stack = [fr[2]]
        elif t <= 250:
            delta = fr[1]
            k = 251 - t
            if k > len(locals_):
                return ['ClassFormatError', idx]
            locals_ = locals_[:len(locals_) - k]
        elif t == 251:
            delta = fr[1]
        elif t <= 254:
            delta = fr[1]
            locals_ = locals_ + list(fr[2:2 + t - 251])
        else:
            delta = fr[1]
            locals_ = list(fr[2])
            stack = list(fr[3])
        offset = offset + delta + 1
        out.append([offset, locals_, stack])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression: every compressed frame kind',
   (['I', 'Object'], [[5], [71, 'I'], [252, 3, 'F'], [249, 2], [251, 300], [255, 1, ['I'], ['Object', 'J']]]),
   [[5, ['I', 'Object'], []],
    [13, ['I', 'Object'], ['I']],
    [17, ['I', 'Object', 'F'], []],
    [20, ['I'], []],
    [321, ['I'], []],
    [323, ['I'], ['Object', 'J']]]),
  ('first frame offset is its delta',
   (['I', 'Object'], [[11], [3]]),
   [[11, ['I', 'Object'], []], [15, ['I', 'Object'], []]]),
  ('same_locals_1_stack_item delta',
   (['I', 'Object'], [[65, 'Object'], [64, 'I']]),
   [[1, ['I', 'Object'], ['Object']], [2, ['I', 'Object'], ['I']]]),
  ('reserved frame type', (['I', 'I', 'J', 'F', 'Object', 'D'], [[1], [246, 0]]), ['ClassFormatError', 1]),
  ('extended one-item frame type',
   (['I', 'Object'], [[247, 5, 'Object']]),
   [[5, ['I', 'Object'], ['Object']]]),
  ('chop three locals', (['I', 'J', 'F'], [[248, 1], [251, 0]]), [[1, [], []], [2, [], []]]),
  ('chop more locals than exist', ([], [[250, 1]]), ['ClassFormatError', 0]),
  ('append three locals then snapshot',
   (['I', 'Object'], [[0], [254, 1, 'I', 'I', 'F'], [0]]),
   [[0, ['I', 'Object'], []],
    [2, ['I', 'Object', 'I', 'I', 'F'], []],
    [3, ['I', 'Object', 'I', 'I', 'F'], []]]),
  ('control: full frame replaces locals',
   (['I', 'Object'], [[255, 1, ['Object'], []], [2]]),
   [[1, ['Object'], []], [4, ['Object'], []]])],
 [('regression: every compressed frame kind',
   (['I', 'Object'], [[5], [72, 'I'], [252, 3, 'F'], [249, 2], [251, 300], [255, 1, ['I'], ['Object', 'J']]]),
   [[5, ['I', 'Object'], []],
    [14, ['I', 'Object'], ['I']],
    [18, ['I', 'Object', 'F'], []],
    [21, ['I'], []],
    [322, ['I'], []],
    [324, ['I'], ['Object', 'J']]]),
  ('first frame offset is its delta',
   (['I', 'Object'], [[12], [3]]),
   [[12, ['I', 'Object'], []], [16, ['I', 'Object'], []]]),
  ('same_locals_1_stack_item delta',
   (['I', 'Object'], [[66, 'Object'], [64, 'I']]),
   [[2, ['I', 'Object'], ['Object']], [3, ['I', 'Object'], ['I']]]),
  ('reserved frame type', (['I', 'I', 'J', 'F', 'Object', 'D'], [[1], [246, 0]]), ['ClassFormatError', 1]),
  ('extended one-item frame type',
   (['I', 'Object'], [[247, 6, 'Object']]),
   [[6, ['I', 'Object'], ['Object']]]),
  ('chop three locals', (['I', 'J', 'F'], [[248, 2], [251, 0]]), [[2, [], []], [3, [], []]]),
  ('chop more locals than exist', ([], [[250, 2]]), ['ClassFormatError', 0]),
  ('append three locals then snapshot',
   (['I', 'Object'], [[0], [254, 2, 'I', 'I', 'F'], [0]]),
   [[0, ['I', 'Object'], []],
    [3, ['I', 'Object', 'I', 'I', 'F'], []],
    [4, ['I', 'Object', 'I', 'I', 'F'], []]]),
  ('control: full frame replaces locals',
   (['I', 'Object'], [[255, 2, ['Object'], []], [2]]),
   [[2, ['Object'], []], [5, ['Object'], []]])],
 [('regression: every compressed frame kind',
   (['I', 'Object'], [[5], [73, 'I'], [252, 3, 'F'], [249, 2], [251, 300], [255, 1, ['I'], ['Object', 'J']]]),
   [[5, ['I', 'Object'], []],
    [15, ['I', 'Object'], ['I']],
    [19, ['I', 'Object', 'F'], []],
    [22, ['I'], []],
    [323, ['I'], []],
    [325, ['I'], ['Object', 'J']]]),
  ('first frame offset is its delta',
   (['I', 'Object'], [[13], [3]]),
   [[13, ['I', 'Object'], []], [17, ['I', 'Object'], []]]),
  ('same_locals_1_stack_item delta',
   (['I', 'Object'], [[67, 'Object'], [64, 'I']]),
   [[3, ['I', 'Object'], ['Object']], [4, ['I', 'Object'], ['I']]]),
  ('reserved frame type', (['I', 'I', 'J', 'F', 'Object', 'D'], [[1], [246, 0]]), ['ClassFormatError', 1]),
  ('extended one-item frame type',
   (['I', 'Object'], [[247, 7, 'Object']]),
   [[7, ['I', 'Object'], ['Object']]]),
  ('chop three locals', (['I', 'J', 'F'], [[248, 3], [251, 0]]), [[3, [], []], [4, [], []]]),
  ('chop more locals than exist', ([], [[250, 3]]), ['ClassFormatError', 0]),
  ('append three locals then snapshot',
   (['I', 'Object'], [[0], [254, 3, 'I', 'I', 'F'], [0]]),
   [[0, ['I', 'Object'], []],
    [4, ['I', 'Object', 'I', 'I', 'F'], []],
    [5, ['I', 'Object', 'I', 'I', 'F'], []]]),
  ('control: full frame replaces locals',
   (['I', 'Object'], [[255, 3, ['Object'], []], [2]]),
   [[3, ['Object'], []], [6, ['Object'], []]])],
 [('regression: every compressed frame kind',
   (['I', 'Object'], [[5], [74, 'I'], [252, 3, 'F'], [249, 2], [251, 300], [255, 1, ['I'], ['Object', 'J']]]),
   [[5, ['I', 'Object'], []],
    [16, ['I', 'Object'], ['I']],
    [20, ['I', 'Object', 'F'], []],
    [23, ['I'], []],
    [324, ['I'], []],
    [326, ['I'], ['Object', 'J']]]),
  ('first frame offset is its delta',
   (['I', 'Object'], [[14], [3]]),
   [[14, ['I', 'Object'], []], [18, ['I', 'Object'], []]]),
  ('same_locals_1_stack_item delta',
   (['I', 'Object'], [[68, 'Object'], [64, 'I']]),
   [[4, ['I', 'Object'], ['Object']], [5, ['I', 'Object'], ['I']]]),
  ('reserved frame type', (['I', 'I', 'J', 'F', 'Object', 'D'], [[1], [246, 0]]), ['ClassFormatError', 1]),
  ('extended one-item frame type',
   (['I', 'Object'], [[247, 8, 'Object']]),
   [[8, ['I', 'Object'], ['Object']]]),
  ('chop three locals', (['I', 'J', 'F'], [[248, 4], [251, 0]]), [[4, [], []], [5, [], []]]),
  ('chop more locals than exist', ([], [[250, 4]]), ['ClassFormatError', 0]),
  ('append three locals then snapshot',
   (['I', 'Object'], [[0], [254, 4, 'I', 'I', 'F'], [0]]),
   [[0, ['I', 'Object'], []],
    [5, ['I', 'Object', 'I', 'I', 'F'], []],
    [6, ['I', 'Object', 'I', 'I', 'F'], []]]),
  ('control: full frame replaces locals',
   (['I', 'Object'], [[255, 4, ['Object'], []], [2]]),
   [[4, ['Object'], []], [7, ['Object'], []]])],
 [('regression: every compressed frame kind',
   (['I', 'Object'], [[5], [75, 'I'], [252, 3, 'F'], [249, 2], [251, 300], [255, 1, ['I'], ['Object', 'J']]]),
   [[5, ['I', 'Object'], []],
    [17, ['I', 'Object'], ['I']],
    [21, ['I', 'Object', 'F'], []],
    [24, ['I'], []],
    [325, ['I'], []],
    [327, ['I'], ['Object', 'J']]]),
  ('first frame offset is its delta',
   (['I', 'Object'], [[15], [3]]),
   [[15, ['I', 'Object'], []], [19, ['I', 'Object'], []]]),
  ('same_locals_1_stack_item delta',
   (['I', 'Object'], [[69, 'Object'], [64, 'I']]),
   [[5, ['I', 'Object'], ['Object']], [6, ['I', 'Object'], ['I']]]),
  ('reserved frame type', (['I', 'I', 'J', 'F', 'Object', 'D'], [[1], [246, 0]]), ['ClassFormatError', 1]),
  ('extended one-item frame type',
   (['I', 'Object'], [[247, 9, 'Object']]),
   [[9, ['I', 'Object'], ['Object']]]),
  ('chop three locals', (['I', 'J', 'F'], [[248, 5], [251, 0]]), [[5, [], []], [6, [], []]]),
  ('chop more locals than exist', ([], [[250, 5]]), ['ClassFormatError', 0]),
  ('append three locals then snapshot',
   (['I', 'Object'], [[0], [254, 5, 'I', 'I', 'F'], [0]]),
   [[0, ['I', 'Object'], []],
    [6, ['I', 'Object', 'I', 'I', 'F'], []],
    [7, ['I', 'Object', 'I', 'I', 'F'], []]]),
  ('control: full frame replaces locals',
   (['I', 'Object'], [[255, 5, ['Object'], []], [2]]),
   [[5, ['Object'], []], [8, ['Object'], []]])]]
for label, args, expected in cases[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(initial, frames):
    locals_ = list(initial)
    out = []
    offset = 0
    for idx, fr in enumerate(frames):
        t = fr[0]
        stack = []
        if t <= 63:
            delta = t
        elif t <= 127:
            delta = t - 64
            stack = [fr[1]]
        elif t < 247:
            return ['ClassFormatError', idx]
        elif t == 247:
            delta = fr[1]
            stack = [fr[2]]
        elif t <= 250:
            delta = fr[1]
            k = 251 - t
            if k > len(locals_):
                return ['ClassFormatError', idx]
            locals_ = locals_[:len(locals_) - k]
        elif t == 251:
            delta = fr[1]
        elif t <= 254:
            delta = fr[1]
            locals_ = locals_ + list(fr[2:2 + t - 251])
        else:
            delta = fr[1]
            locals_ = list(fr[2])
            stack = list(fr[3])
        offset = delta if idx == 0 else offset + delta
        out.append([offset, locals_, stack])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression: every compressed frame kind',
   (['I', 'Object'], [[5], [71, 'I'], [252, 3, 'F'], [249, 2], [251, 300], [255, 1, ['I'], ['Object', 'J']]]),
   [[5, ['I', 'Object'], []],
    [13, ['I', 'Object'], ['I']],
    [17, ['I', 'Object', 'F'], []],
    [20, ['I'], []],
    [321, ['I'], []],
    [323, ['I'], ['Object', 'J']]]),
  ('first frame offset is its delta',
   (['I', 'Object'], [[11], [3]]),
   [[11, ['I', 'Object'], []], [15, ['I', 'Object'], []]]),
  ('same_locals_1_stack_item delta',
   (['I', 'Object'], [[65, 'Object'], [64, 'I']]),
   [[1, ['I', 'Object'], ['Object']], [2, ['I', 'Object'], ['I']]]),
  ('reserved frame type', (['I', 'I', 'J', 'F', 'Object', 'D'], [[1], [246, 0]]), ['ClassFormatError', 1]),
  ('extended one-item frame type',
   (['I', 'Object'], [[247, 5, 'Object']]),
   [[5, ['I', 'Object'], ['Object']]]),
  ('chop three locals', (['I', 'J', 'F'], [[248, 1], [251, 0]]), [[1, [], []], [2, [], []]]),
  ('chop more locals than exist', ([], [[250, 1]]), ['ClassFormatError', 0]),
  ('append three locals then snapshot',
   (['I', 'Object'], [[0], [254, 1, 'I', 'I', 'F'], [0]]),
   [[0, ['I', 'Object'], []],
    [2, ['I', 'Object', 'I', 'I', 'F'], []],
    [3, ['I', 'Object', 'I', 'I', 'F'], []]]),
  ('control: full frame replaces locals',
   (['I', 'Object'], [[255, 1, ['Object'], []], [2]]),
   [[1, ['Object'], []], [4, ['Object'], []]])],
 [('regression: every compressed frame kind',
   (['I', 'Object'], [[5], [72, 'I'], [252, 3, 'F'], [249, 2], [251, 300], [255, 1, ['I'], ['Object', 'J']]]),
   [[5, ['I', 'Object'], []],
    [14, ['I', 'Object'], ['I']],
    [18, ['I', 'Object', 'F'], []],
    [21, ['I'], []],
    [322, ['I'], []],
    [324, ['I'], ['Object', 'J']]]),
  ('first frame offset is its delta',
   (['I', 'Object'], [[12], [3]]),
   [[12, ['I', 'Object'], []], [16, ['I', 'Object'], []]]),
  ('same_locals_1_stack_item delta',
   (['I', 'Object'], [[66, 'Object'], [64, 'I']]),
   [[2, ['I', 'Object'], ['Object']], [3, ['I', 'Object'], ['I']]]),
  ('reserved frame type', (['I', 'I', 'J', 'F', 'Object', 'D'], [[1], [246, 0]]), ['ClassFormatError', 1]),
  ('extended one-item frame type',
   (['I', 'Object'], [[247, 6, 'Object']]),
   [[6, ['I', 'Object'], ['Object']]]),
  ('chop three locals', (['I', 'J', 'F'], [[248, 2], [251, 0]]), [[2, [], []], [3, [], []]]),
  ('chop more locals than exist', ([], [[250, 2]]), ['ClassFormatError', 0]),
  ('append three locals then snapshot',
   (['I', 'Object'], [[0], [254, 2, 'I', 'I', 'F'], [0]]),
   [[0, ['I', 'Object'], []],
    [3, ['I', 'Object', 'I', 'I', 'F'], []],
    [4, ['I', 'Object', 'I', 'I', 'F'], []]]),
  ('control: full frame replaces locals',
   (['I', 'Object'], [[255, 2, ['Object'], []], [2]]),
   [[2, ['Object'], []], [5, ['Object'], []]])],
 [('regression: every compressed frame kind',
   (['I', 'Object'], [[5], [73, 'I'], [252, 3, 'F'], [249, 2], [251, 300], [255, 1, ['I'], ['Object', 'J']]]),
   [[5, ['I', 'Object'], []],
    [15, ['I', 'Object'], ['I']],
    [19, ['I', 'Object', 'F'], []],
    [22, ['I'], []],
    [323, ['I'], []],
    [325, ['I'], ['Object', 'J']]]),
  ('first frame offset is its delta',
   (['I', 'Object'], [[13], [3]]),
   [[13, ['I', 'Object'], []], [17, ['I', 'Object'], []]]),
  ('same_locals_1_stack_item delta',
   (['I', 'Object'], [[67, 'Object'], [64, 'I']]),
   [[3, ['I', 'Object'], ['Object']], [4, ['I', 'Object'], ['I']]]),
  ('reserved frame type', (['I', 'I', 'J', 'F', 'Object', 'D'], [[1], [246, 0]]), ['ClassFormatError', 1]),
  ('extended one-item frame type',
   (['I', 'Object'], [[247, 7, 'Object']]),
   [[7, ['I', 'Object'], ['Object']]]),
  ('chop three locals', (['I', 'J', 'F'], [[248, 3], [251, 0]]), [[3, [], []], [4, [], []]]),
  ('chop more locals than exist', ([], [[250, 3]]), ['ClassFormatError', 0]),
  ('append three locals then snapshot',
   (['I', 'Object'], [[0], [254, 3, 'I', 'I', 'F'], [0]]),
   [[0, ['I', 'Object'], []],
    [4, ['I', 'Object', 'I', 'I', 'F'], []],
    [5, ['I', 'Object', 'I', 'I', 'F'], []]]),
  ('control: full frame replaces locals',
   (['I', 'Object'], [[255, 3, ['Object'], []], [2]]),
   [[3, ['Object'], []], [6, ['Object'], []]])],
 [('regression: every compressed frame kind',
   (['I', 'Object'], [[5], [74, 'I'], [252, 3, 'F'], [249, 2], [251, 300], [255, 1, ['I'], ['Object', 'J']]]),
   [[5, ['I', 'Object'], []],
    [16, ['I', 'Object'], ['I']],
    [20, ['I', 'Object', 'F'], []],
    [23, ['I'], []],
    [324, ['I'], []],
    [326, ['I'], ['Object', 'J']]]),
  ('first frame offset is its delta',
   (['I', 'Object'], [[14], [3]]),
   [[14, ['I', 'Object'], []], [18, ['I', 'Object'], []]]),
  ('same_locals_1_stack_item delta',
   (['I', 'Object'], [[68, 'Object'], [64, 'I']]),
   [[4, ['I', 'Object'], ['Object']], [5, ['I', 'Object'], ['I']]]),
  ('reserved frame type', (['I', 'I', 'J', 'F', 'Object', 'D'], [[1], [246, 0]]), ['ClassFormatError', 1]),
  ('extended one-item frame type',
   (['I', 'Object'], [[247, 8, 'Object']]),
   [[8, ['I', 'Object'], ['Object']]]),
  ('chop three locals', (['I', 'J', 'F'], [[248, 4], [251, 0]]), [[4, [], []], [5, [], []]]),
  ('chop more locals than exist', ([], [[250, 4]]), ['ClassFormatError', 0]),
  ('append three locals then snapshot',
   (['I', 'Object'], [[0], [254, 4, 'I', 'I', 'F'], [0]]),
   [[0, ['I', 'Object'], []],
    [5, ['I', 'Object', 'I', 'I', 'F'], []],
    [6, ['I', 'Object', 'I', 'I', 'F'], []]]),
  ('control: full frame replaces locals',
   (['I', 'Object'], [[255, 4, ['Object'], []], [2]]),
   [[4, ['Object'], []], [7, ['Object'], []]])],
 [('regression: every compressed frame kind',
   (['I', 'Object'], [[5], [75, 'I'], [252, 3, 'F'], [249, 2], [251, 300], [255, 1, ['I'], ['Object', 'J']]]),
   [[5, ['I', 'Object'], []],
    [17, ['I', 'Object'], ['I']],
    [21, ['I', 'Object', 'F'], []],
    [24, ['I'], []],
    [325, ['I'], []],
    [327, ['I'], ['Object', 'J']]]),
  ('first frame offset is its delta',
   (['I', 'Object'], [[15], [3]]),
   [[15, ['I', 'Object'], []], [19, ['I', 'Object'], []]]),
  ('same_locals_1_stack_item delta',
   (['I', 'Object'], [[69, 'Object'], [64, 'I']]),
   [[5, ['I', 'Object'], ['Object']], [6, ['I', 'Object'], ['I']]]),
  ('reserved frame type', (['I', 'I', 'J', 'F', 'Object', 'D'], [[1], [246, 0]]), ['ClassFormatError', 1]),
  ('extended one-item frame type',
   (['I', 'Object'], [[247, 9, 'Object']]),
   [[9, ['I', 'Object'], ['Object']]]),
  ('chop three locals', (['I', 'J', 'F'], [[248, 5], [251, 0]]), [[5, [], []], [6, [], []]]),
  ('chop more locals than exist', ([], [[250, 5]]), ['ClassFormatError', 0]),
  ('append three locals then snapshot',
   (['I', 'Object'], [[0], [254, 5, 'I', 'I', 'F'], [0]]),
   [[0, ['I', 'Object'], []],
    [6, ['I', 'Object', 'I', 'I', 'F'], []],
    [7, ['I', 'Object', 'I', 'I', 'F'], []]]),
  ('control: full frame replaces locals',
   (['I', 'Object'], [[255, 5, ['Object'], []], [2]]),
   [[5, ['Object'], []], [8, ['Object'], []]])]]
for label, args, expected in cases[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 frame is attached to the instruction after the one it describes.

Expand compressed stack map frames. Types: 0-63 same (delta = type), 64-127 same_locals_1_stack_item (delta = type - 64, one stack item), 128-246 reserved (["ClassFormatError", index]), 247 extended one item [247, delta, item], 248-250 chop 251-type locals [t, delta], 251 same extended [251, delta], 252-254 append type-251 locals [t, delta, items...], 255 full [255, delta, locals, stack]. The first frame's offset is its delta; each later offset is previous + delta + 1. Chopping more locals than exist is an error. Return [offset, locals, stack] for every frame; each frame's locals are an independent snapshot.

split: open-access


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

N = 1
observations = []
def solve(initial, frames):
    locals_ = list(initial)
    out = []
    offset = 0
    for idx, fr in enumerate(frames):
        t = fr[0]
        stack = []
        if t <= 63:
            delta = t
        elif t <= 127:
            delta = t
            stack = [fr[1]]
        elif t < 247:
            return ['ClassFormatError', idx]
        elif t == 247:
            delta = fr[1]
            stack = [fr[2]]
        elif t <= 250:
            delta = fr[1]
            k = 251 - t
            if k > len(locals_):
                return ['ClassFormatError', idx]
            locals_ = locals_[:len(locals_) - k]
        elif t == 251:
            delta = fr[1]
        elif t <= 254:
            delta = fr[1]
            locals_ = locals_ + list(fr[2:2 + t - 251])
        else:
            delta = fr[1]
            locals_ = list(fr[2])
            stack = list(fr[3])
        offset = delta if idx == 0 else offset + delta + 1
        out.append([offset, locals_, stack])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression: every compressed frame kind',
   (['I', 'Object'], [[5], [71, 'I'], [252, 3, 'F'], [249, 2], [251, 300], [255, 1, ['I'], ['Object', 'J']]]),
   [[5, ['I', 'Object'], []],
    [13, ['I', 'Object'], ['I']],
    [17, ['I', 'Object', 'F'], []],
    [20, ['I'], []],
    [321, ['I'], []],
    [323, ['I'], ['Object', 'J']]]),
  ('first frame offset is its delta',
   (['I', 'Object'], [[11], [3]]),
   [[11, ['I', 'Object'], []], [15, ['I', 'Object'], []]]),
  ('same_locals_1_stack_item delta',
   (['I', 'Object'], [[65, 'Object'], [64, 'I']]),
   [[1, ['I', 'Object'], ['Object']], [2, ['I', 'Object'], ['I']]]),
  ('reserved frame type', (['I', 'I', 'J', 'F', 'Object', 'D'], [[1], [246, 0]]), ['ClassFormatError', 1]),
  ('extended one-item frame type',
   (['I', 'Object'], [[247, 5, 'Object']]),
   [[5, ['I', 'Object'], ['Object']]]),
  ('chop three locals', (['I', 'J', 'F'], [[248, 1], [251, 0]]), [[1, [], []], [2, [], []]]),
  ('chop more locals than exist', ([], [[250, 1]]), ['ClassFormatError', 0]),
  ('append three locals then snapshot',
   (['I', 'Object'], [[0], [254, 1, 'I', 'I', 'F'], [0]]),
   [[0, ['I', 'Object'], []],
    [2, ['I', 'Object', 'I', 'I', 'F'], []],
    [3, ['I', 'Object', 'I', 'I', 'F'], []]]),
  ('control: full frame replaces locals',
   (['I', 'Object'], [[255, 1, ['Object'], []], [2]]),
   [[1, ['Object'], []], [4, ['Object'], []]])],
 [('regression: every compressed frame kind',
   (['I', 'Object'], [[5], [72, 'I'], [252, 3, 'F'], [249, 2], [251, 300], [255, 1, ['I'], ['Object', 'J']]]),
   [[5, ['I', 'Object'], []],
    [14, ['I', 'Object'], ['I']],
    [18, ['I', 'Object', 'F'], []],
    [21, ['I'], []],
    [322, ['I'], []],
    [324, ['I'], ['Object', 'J']]]),
  ('first frame offset is its delta',
   (['I', 'Object'], [[12], [3]]),
   [[12, ['I', 'Object'], []], [16, ['I', 'Object'], []]]),
  ('same_locals_1_stack_item delta',
   (['I', 'Object'], [[66, 'Object'], [64, 'I']]),
   [[2, ['I', 'Object'], ['Object']], [3, ['I', 'Object'], ['I']]]),
  ('reserved frame type', (['I', 'I', 'J', 'F', 'Object', 'D'], [[1], [246, 0]]), ['ClassFormatError', 1]),
  ('extended one-item frame type',
   (['I', 'Object'], [[247, 6, 'Object']]),
   [[6, ['I', 'Object'], ['Object']]]),
  ('chop three locals', (['I', 'J', 'F'], [[248, 2], [251, 0]]), [[2, [], []], [3, [], []]]),
  ('chop more locals than exist', ([], [[250, 2]]), ['ClassFormatError', 0]),
  ('append three locals then snapshot',
   (['I', 'Object'], [[0], [254, 2, 'I', 'I', 'F'], [0]]),
   [[0, ['I', 'Object'], []],
    [3, ['I', 'Object', 'I', 'I', 'F'], []],
    [4, ['I', 'Object', 'I', 'I', 'F'], []]]),
  ('control: full frame replaces locals',
   (['I', 'Object'], [[255, 2, ['Object'], []], [2]]),
   [[2, ['Object'], []], [5, ['Object'], []]])],
 [('regression: every compressed frame kind',
   (['I', 'Object'], [[5], [73, 'I'], [252, 3, 'F'], [249, 2], [251, 300], [255, 1, ['I'], ['Object', 'J']]]),
   [[5, ['I', 'Object'], []],
    [15, ['I', 'Object'], ['I']],
    [19, ['I', 'Object', 'F'], []],
    [22, ['I'], []],
    [323, ['I'], []],
    [325, ['I'], ['Object', 'J']]]),
  ('first frame offset is its delta',
   (['I', 'Object'], [[13], [3]]),
   [[13, ['I', 'Object'], []], [17, ['I', 'Object'], []]]),
  ('same_locals_1_stack_item delta',
   (['I', 'Object'], [[67, 'Object'], [64, 'I']]),
   [[3, ['I', 'Object'], ['Object']], [4, ['I', 'Object'], ['I']]]),
  ('reserved frame type', (['I', 'I', 'J', 'F', 'Object', 'D'], [[1], [246, 0]]), ['ClassFormatError', 1]),
  ('extended one-item frame type',
   (['I', 'Object'], [[247, 7, 'Object']]),
   [[7, ['I', 'Object'], ['Object']]]),
  ('chop three locals', (['I', 'J', 'F'], [[248, 3], [251, 0]]), [[3, [], []], [4, [], []]]),
  ('chop more locals than exist', ([], [[250, 3]]), ['ClassFormatError', 0]),
  ('append three locals then snapshot',
   (['I', 'Object'], [[0], [254, 3, 'I', 'I', 'F'], [0]]),
   [[0, ['I', 'Object'], []],
    [4, ['I', 'Object', 'I', 'I', 'F'], []],
    [5, ['I', 'Object', 'I', 'I', 'F'], []]]),
  ('control: full frame replaces locals',
   (['I', 'Object'], [[255, 3, ['Object'], []], [2]]),
   [[3, ['Object'], []], [6, ['Object'], []]])],
 [('regression: every compressed frame kind',
   (['I', 'Object'], [[5], [74, 'I'], [252, 3, 'F'], [249, 2], [251, 300], [255, 1, ['I'], ['Object', 'J']]]),
   [[5, ['I', 'Object'], []],
    [16, ['I', 'Object'], ['I']],
    [20, ['I', 'Object', 'F'], []],
    [23, ['I'], []],
    [324, ['I'], []],
    [326, ['I'], ['Object', 'J']]]),
  ('first frame offset is its delta',
   (['I', 'Object'], [[14], [3]]),
   [[14, ['I', 'Object'], []], [18, ['I', 'Object'], []]]),
  ('same_locals_1_stack_item delta',
   (['I', 'Object'], [[68, 'Object'], [64, 'I']]),
   [[4, ['I', 'Object'], ['Object']], [5, ['I', 'Object'], ['I']]]),
  ('reserved frame type', (['I', 'I', 'J', 'F', 'Object', 'D'], [[1], [246, 0]]), ['ClassFormatError', 1]),
  ('extended one-item frame type',
   (['I', 'Object'], [[247, 8, 'Object']]),
   [[8, ['I', 'Object'], ['Object']]]),
  ('chop three locals', (['I', 'J', 'F'], [[248, 4], [251, 0]]), [[4, [], []], [5, [], []]]),
  ('chop more locals than exist', ([], [[250, 4]]), ['ClassFormatError', 0]),
  ('append three locals then snapshot',
   (['I', 'Object'], [[0], [254, 4, 'I', 'I', 'F'], [0]]),
   [[0, ['I', 'Object'], []],
    [5, ['I', 'Object', 'I', 'I', 'F'], []],
    [6, ['I', 'Object', 'I', 'I', 'F'], []]]),
  ('control: full frame replaces locals',
   (['I', 'Object'], [[255, 4, ['Object'], []], [2]]),
   [[4, ['Object'], []], [7, ['Object'], []]])],
 [('regression: every compressed frame kind',
   (['I', 'Object'], [[5], [75, 'I'], [252, 3, 'F'], [249, 2], [251, 300], [255, 1, ['I'], ['Object', 'J']]]),
   [[5, ['I', 'Object'], []],
    [17, ['I', 'Object'], ['I']],
    [21, ['I', 'Object', 'F'], []],
    [24, ['I'], []],
    [325, ['I'], []],
    [327, ['I'], ['Object', 'J']]]),
  ('first frame offset is its delta',
   (['I', 'Object'], [[15], [3]]),
   [[15, ['I', 'Object'], []], [19, ['I', 'Object'], []]]),
  ('same_locals_1_stack_item delta',
   (['I', 'Object'], [[69, 'Object'], [64, 'I']]),
   [[5, ['I', 'Object'], ['Object']], [6, ['I', 'Object'], ['I']]]),
  ('reserved frame type', (['I', 'I', 'J', 'F', 'Object', 'D'], [[1], [246, 0]]), ['ClassFormatError', 1]),
  ('extended one-item frame type',
   (['I', 'Object'], [[247, 9, 'Object']]),
   [[9, ['I', 'Object'], ['Object']]]),
  ('chop three locals', (['I', 'J', 'F'], [[248, 5], [251, 0]]), [[5, [], []], [6, [], []]]),
  ('chop more locals than exist', ([], [[250, 5]]), ['ClassFormatError', 0]),
  ('append three locals then snapshot',
   (['I', 'Object'], [[0], [254, 5, 'I', 'I', 'F'], [0]]),
   [[0, ['I', 'Object'], []],
    [6, ['I', 'Object', 'I', 'I', 'F'], []],
    [7, ['I', 'Object', 'I', 'I', 'F'], []]]),
  ('control: full frame replaces locals',
   (['I', 'Object'], [[255, 5, ['Object'], []], [2]]),
   [[5, ['Object'], []], [8, ['Object'], []]])]]
for label, args, expected in cases[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(initial, frames):
    locals_ = list(initial)
    out = []
    offset = 0
    for idx, fr in enumerate(frames):
        t = fr[0]
        stack = []
        if t <= 63:
            delta = t
        elif t <= 127:
            delta = t - 63
            stack = [fr[1]]
        elif t < 247:
            return ['ClassFormatError', idx]
        elif t == 247:
            delta = fr[1]
            stack = [fr[2]]
        elif t <= 250:
            delta = fr[1]
            k = 251 - t
            if k > len(locals_):
                return ['ClassFormatError', idx]
            locals_ = locals_[:len(locals_) - k]
        elif t == 251:
            delta = fr[1]
        elif t <= 254:
            delta = fr[1]
            locals_ = locals_ + list(fr[2:2 + t - 251])
        else:
            delta = fr[1]
            locals_ = list(fr[2])
            stack = list(fr[3])
        offset = delta if idx == 0 else offset + delta + 1
        out.append([offset, locals_, stack])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression: every compressed frame kind',
   (['I', 'Object'], [[5], [71, 'I'], [252, 3, 'F'], [249, 2], [251, 300], [255, 1, ['I'], ['Object', 'J']]]),
   [[5, ['I', 'Object'], []],
    [13, ['I', 'Object'], ['I']],
    [17, ['I', 'Object', 'F'], []],
    [20, ['I'], []],
    [321, ['I'], []],
    [323, ['I'], ['Object', 'J']]]),
  ('first frame offset is its delta',
   (['I', 'Object'], [[11], [3]]),
   [[11, ['I', 'Object'], []], [15, ['I', 'Object'], []]]),
  ('same_locals_1_stack_item delta',
   (['I', 'Object'], [[65, 'Object'], [64, 'I']]),
   [[1, ['I', 'Object'], ['Object']], [2, ['I', 'Object'], ['I']]]),
  ('reserved frame type', (['I', 'I', 'J', 'F', 'Object', 'D'], [[1], [246, 0]]), ['ClassFormatError', 1]),
  ('extended one-item frame type',
   (['I', 'Object'], [[247, 5, 'Object']]),
   [[5, ['I', 'Object'], ['Object']]]),
  ('chop three locals', (['I', 'J', 'F'], [[248, 1], [251, 0]]), [[1, [], []], [2, [], []]]),
  ('chop more locals than exist', ([], [[250, 1]]), ['ClassFormatError', 0]),
  ('append three locals then snapshot',
   (['I', 'Object'], [[0], [254, 1, 'I', 'I', 'F'], [0]]),
   [[0, ['I', 'Object'], []],
    [2, ['I', 'Object', 'I', 'I', 'F'], []],
    [3, ['I', 'Object', 'I', 'I', 'F'], []]]),
  ('control: full frame replaces locals',
   (['I', 'Object'], [[255, 1, ['Object'], []], [2]]),
   [[1, ['Object'], []], [4, ['Object'], []]])],
 [('regression: every compressed frame kind',
   (['I', 'Object'], [[5], [72, 'I'], [252, 3, 'F'], [249, 2], [251, 300], [255, 1, ['I'], ['Object', 'J']]]),
   [[5, ['I', 'Object'], []],
    [14, ['I', 'Object'], ['I']],
    [18, ['I', 'Object', 'F'], []],
    [21, ['I'], []],
    [322, ['I'], []],
    [324, ['I'], ['Object', 'J']]]),
  ('first frame offset is its delta',
   (['I', 'Object'], [[12], [3]]),
   [[12, ['I', 'Object'], []], [16, ['I', 'Object'], []]]),
  ('same_locals_1_stack_item delta',
   (['I', 'Object'], [[66, 'Object'], [64, 'I']]),
   [[2, ['I', 'Object'], ['Object']], [3, ['I', 'Object'], ['I']]]),
  ('reserved frame type', (['I', 'I', 'J', 'F', 'Object', 'D'], [[1], [246, 0]]), ['ClassFormatError', 1]),
  ('extended one-item frame type',
   (['I', 'Object'], [[247, 6, 'Object']]),
   [[6, ['I', 'Object'], ['Object']]]),
  ('chop three locals', (['I', 'J', 'F'], [[248, 2], [251, 0]]), [[2, [], []], [3, [], []]]),
  ('chop more locals than exist', ([], [[250, 2]]), ['ClassFormatError', 0]),
  ('append three locals then snapshot',
   (['I', 'Object'], [[0], [254, 2, 'I', 'I', 'F'], [0]]),
   [[0, ['I', 'Object'], []],
    [3, ['I', 'Object', 'I', 'I', 'F'], []],
    [4, ['I', 'Object', 'I', 'I', 'F'], []]]),
  ('control: full frame replaces locals',
   (['I', 'Object'], [[255, 2, ['Object'], []], [2]]),
   [[2, ['Object'], []], [5, ['Object'], []]])],
 [('regression: every compressed frame kind',
   (['I', 'Object'], [[5], [73, 'I'], [252, 3, 'F'], [249, 2], [251, 300], [255, 1, ['I'], ['Object', 'J']]]),
   [[5, ['I', 'Object'], []],
    [15, ['I', 'Object'], ['I']],
    [19, ['I', 'Object', 'F'], []],
    [22, ['I'], []],
    [323, ['I'], []],
    [325, ['I'], ['Object', 'J']]]),
  ('first frame offset is its delta',
   (['I', 'Object'], [[13], [3]]),
   [[13, ['I', 'Object'], []], [17, ['I', 'Object'], []]]),
  ('same_locals_1_stack_item delta',
   (['I', 'Object'], [[67, 'Object'], [64, 'I']]),
   [[3, ['I', 'Object'], ['Object']], [4, ['I', 'Object'], ['I']]]),
  ('reserved frame type', (['I', 'I', 'J', 'F', 'Object', 'D'], [[1], [246, 0]]), ['ClassFormatError', 1]),
  ('extended one-item frame type',
   (['I', 'Object'], [[247, 7, 'Object']]),
   [[7, ['I', 'Object'], ['Object']]]),
  ('chop three locals', (['I', 'J', 'F'], [[248, 3], [251, 0]]), [[3, [], []], [4, [], []]]),
  ('chop more locals than exist', ([], [[250, 3]]), ['ClassFormatError', 0]),
  ('append three locals then snapshot',
   (['I', 'Object'], [[0], [254, 3, 'I', 'I', 'F'], [0]]),
   [[0, ['I', 'Object'], []],
    [4, ['I', 'Object', 'I', 'I', 'F'], []],
    [5, ['I', 'Object', 'I', 'I', 'F'], []]]),
  ('control: full frame replaces locals',
   (['I', 'Object'], [[255, 3, ['Object'], []], [2]]),
   [[3, ['Object'], []], [6, ['Object'], []]])],
 [('regression: every compressed frame kind',
   (['I', 'Object'], [[5], [74, 'I'], [252, 3, 'F'], [249, 2], [251, 300], [255, 1, ['I'], ['Object', 'J']]]),
   [[5, ['I', 'Object'], []],
    [16, ['I', 'Object'], ['I']],
    [20, ['I', 'Object', 'F'], []],
    [23, ['I'], []],
    [324, ['I'], []],
    [326, ['I'], ['Object', 'J']]]),
  ('first frame offset is its delta',
   (['I', 'Object'], [[14], [3]]),
   [[14, ['I', 'Object'], []], [18, ['I', 'Object'], []]]),
  ('same_locals_1_stack_item delta',
   (['I', 'Object'], [[68, 'Object'], [64, 'I']]),
   [[4, ['I', 'Object'], ['Object']], [5, ['I', 'Object'], ['I']]]),
  ('reserved frame type', (['I', 'I', 'J', 'F', 'Object', 'D'], [[1], [246, 0]]), ['ClassFormatError', 1]),
  ('extended one-item frame type',
   (['I', 'Object'], [[247, 8, 'Object']]),
   [[8, ['I', 'Object'], ['Object']]]),
  ('chop three locals', (['I', 'J', 'F'], [[248, 4], [251, 0]]), [[4, [], []], [5, [], []]]),
  ('chop more locals than exist', ([], [[250, 4]]), ['ClassFormatError', 0]),
  ('append three locals then snapshot',
   (['I', 'Object'], [[0], [254, 4, 'I', 'I', 'F'], [0]]),
   [[0, ['I', 'Object'], []],
    [5, ['I', 'Object', 'I', 'I', 'F'], []],
    [6, ['I', 'Object', 'I', 'I', 'F'], []]]),
  ('control: full frame replaces locals',
   (['I', 'Object'], [[255, 4, ['Object'], []], [2]]),
   [[4, ['Object'], []], [7, ['Object'], []]])],
 [('regression: every compressed frame kind',
   (['I', 'Object'], [[5], [75, 'I'], [252, 3, 'F'], [249, 2], [251, 300], [255, 1, ['I'], ['Object', 'J']]]),
   [[5, ['I', 'Object'], []],
    [17, ['I', 'Object'], ['I']],
    [21, ['I', 'Object', 'F'], []],
    [24, ['I'], []],
    [325, ['I'], []],
    [327, ['I'], ['Object', 'J']]]),
  ('first frame offset is its delta',
   (['I', 'Object'], [[15], [3]]),
   [[15, ['I', 'Object'], []], [19, ['I', 'Object'], []]]),
  ('same_locals_1_stack_item delta',
   (['I', 'Object'], [[69, 'Object'], [64, 'I']]),
   [[5, ['I', 'Object'], ['Object']], [6, ['I', 'Object'], ['I']]]),
  ('reserved frame type', (['I', 'I', 'J', 'F', 'Object', 'D'], [[1], [246, 0]]), ['ClassFormatError', 1]),
  ('extended one-item frame type',
   (['I', 'Object'], [[247, 9, 'Object']]),
   [[9, ['I', 'Object'], ['Object']]]),
  ('chop three locals', (['I', 'J', 'F'], [[248, 5], [251, 0]]), [[5, [], []], [6, [], []]]),
  ('chop more locals than exist', ([], [[250, 5]]), ['ClassFormatError', 0]),
  ('append three locals then snapshot',
   (['I', 'Object'], [[0], [254, 5, 'I', 'I', 'F'], [0]]),
   [[0, ['I', 'Object'], []],
    [6, ['I', 'Object', 'I', 'I', 'F'], []],
    [7, ['I', 'Object', 'I', 'I', 'F'], []]]),
  ('control: full frame replaces locals',
   (['I', 'Object'], [[255, 5, ['Object'], []], [2]]),
   [[5, ['Object'], []], [8, ['Object'], []]])]]
for label, args, expected in cases[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:
same_locals_1_stack_item frames land 64 bytes too far.

Expand compressed stack map frames. Types: 0-63 same (delta = type), 64-127 same_locals_1_stack_item (delta = type - 64, one stack item), 128-246 reserved (["ClassFormatError", index]), 247 extended one item [247, delta, item], 248-250 chop 251-type locals [t, delta], 251 same extended [251, delta], 252-254 append type-251 locals [t, delta, items...], 255 full [255, delta, locals, stack]. The first frame's offset is its delta; each later offset is previous + delta + 1. Chopping more locals than exist is an error. Return [offset, locals, stack] for every frame; each frame's locals are an independent snapshot.

split: open-access