broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    wall_delta = r['wall_now'] - r['wall_saved']
    mono_delta = r['mono_now'] - r['mono_saved']
    reboot = r['boot_now'] != r['boot_saved']
    elapsed = max(0, wall_delta if reboot else mono_delta)
    consumed = 0 if r['paused'] else elapsed
    remaining = max(0, r['budget'] - consumed)
    expired = not r['paused'] and consumed >= r['budget']
    overdue = max(0, consumed - r['budget'])
    deadline = None if r['paused'] else r['mono_now'] + remaining
    base = r['mono_now'] + consumed
    return [remaining,expired,overdue,deadline,base]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'wall_now': 130, 'wall_saved': 100, 'mono_now': 50, 'mono_saved': 20, 'boot_now': 'a', 'boot_saved': 'a', 'paused': False, 'budget': 30}), [0, True, 0, 50, 20])
check('fixture 2', solve({'wall_now': 90, 'wall_saved': 100, 'mono_now': 5, 'mono_saved': 20, 'boot_now': 'b', 'boot_saved': 'a', 'paused': False, 'budget': 10}), [10, False, 0, 15, 5])
check('fixture 3', solve({'wall_now': 150, 'wall_saved': 100, 'mono_now': 5, 'mono_saved': 20, 'boot_now': 'b', 'boot_saved': 'a', 'paused': False, 'budget': 20}), [0, True, 30, 5, -45])
check('fixture 4', solve({'wall_now': 130, 'wall_saved': 100, 'mono_now': 50, 'mono_saved': 20, 'boot_now': 'a', 'boot_saved': 'a', 'paused': True, 'budget': 0}), [0, False, 0, None, 50])
check('fixture 5', solve({'wall_now': 140, 'wall_saved': 100, 'mono_now': 60, 'mono_saved': 20, 'boot_now': 'a', 'boot_saved': 'a', 'paused': False, 'budget': 100}), [60, False, 0, 120, 20])
check('fixture 6', solve({'wall_now': 90, 'wall_saved': 100, 'mono_now': -5, 'mono_saved': -20, 'boot_now': 'a', 'boot_saved': 'a', 'paused': False, 'budget': 20}), [5, False, 0, 0, -20])
check('fixture 7', solve({'wall_now': 101, 'wall_saved': 100, 'mono_now': 0, 'mono_saved': 0, 'boot_now': 'c', 'boot_saved': 'a', 'paused': False, 'budget': 0}), [0, True, 1, 0, -1])
check('fixture 8', solve({'wall_now': 100, 'wall_saved': 100, 'mono_now': 20, 'mono_saved': 20, 'boot_now': 'a', 'boot_saved': 'a', 'paused': True, 'budget': 10}), [10, False, 0, None, 20])
check('fixture 9', solve({'wall_now': 105, 'wall_saved': 100, 'mono_now': 24, 'mono_saved': 20, 'boot_now': 'a', 'boot_saved': 'a', 'paused': False, 'budget': 3}), [0, True, 1, 24, 20])
check('fixture 10', solve({'wall_now': 80, 'wall_saved': 100, 'mono_now': -10, 'mono_saved': -20, 'boot_now': 'a', 'boot_saved': 'a', 'paused': False, 'budget': 0}), [0, True, 10, -10, -20])
variant = [({'wall_now': 130, 'wall_saved': 100, 'mono_now': 50, 'mono_saved': 20, 'boot_now': 'a', 'boot_saved': 'a', 'paused': False, 'budget': 31}, [1, False, 0, 51, 20]), ({'wall_now': 130, 'wall_saved': 100, 'mono_now': 50, 'mono_saved': 20, 'boot_now': 'a', 'boot_saved': 'a', 'paused': False, 'budget': 32}, [2, False, 0, 52, 20]), ({'wall_now': 130, 'wall_saved': 100, 'mono_now': 50, 'mono_saved': 20, 'boot_now': 'a', 'boot_saved': 'a', 'paused': False, 'budget': 33}, [3, False, 0, 53, 20]), ({'wall_now': 130, 'wall_saved': 100, 'mono_now': 50, 'mono_saved': 20, 'boot_now': 'a', 'boot_saved': 'a', 'paused': False, 'budget': 34}, [4, False, 0, 54, 20]), ({'wall_now': 130, 'wall_saved': 100, 'mono_now': 50, 'mono_saved': 20, 'boot_now': 'a', 'boot_saved': 'a', 'paused': False, 'budget': 35}, [5, False, 0, 55, 20])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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
from fractions import Fraction
N = 1
observations = []
def solve(r):
    wall_delta = r['wall_now'] - r['wall_saved']
    mono_delta = r['mono_now'] - r['mono_saved']
    reboot = r['boot_now'] != r['boot_saved']
    elapsed = max(0, wall_delta if reboot else mono_delta)
    consumed = 0 if r['paused'] else elapsed
    remaining = max(0, r['budget'] - consumed)
    expired = not r['paused'] and consumed >= r['budget']
    overdue = max(0, consumed - r['budget'])
    deadline = None if r['paused'] else r['mono_now'] + remaining
    base = r['mono_saved']
    return [remaining,expired,overdue,deadline,base]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'wall_now': 130, 'wall_saved': 100, 'mono_now': 50, 'mono_saved': 20, 'boot_now': 'a', 'boot_saved': 'a', 'paused': False, 'budget': 30}), [0, True, 0, 50, 20])
check('fixture 2', solve({'wall_now': 90, 'wall_saved': 100, 'mono_now': 5, 'mono_saved': 20, 'boot_now': 'b', 'boot_saved': 'a', 'paused': False, 'budget': 10}), [10, False, 0, 15, 5])
check('fixture 3', solve({'wall_now': 150, 'wall_saved': 100, 'mono_now': 5, 'mono_saved': 20, 'boot_now': 'b', 'boot_saved': 'a', 'paused': False, 'budget': 20}), [0, True, 30, 5, -45])
check('fixture 4', solve({'wall_now': 130, 'wall_saved': 100, 'mono_now': 50, 'mono_saved': 20, 'boot_now': 'a', 'boot_saved': 'a', 'paused': True, 'budget': 0}), [0, False, 0, None, 50])
check('fixture 5', solve({'wall_now': 140, 'wall_saved': 100, 'mono_now': 60, 'mono_saved': 20, 'boot_now': 'a', 'boot_saved': 'a', 'paused': False, 'budget': 100}), [60, False, 0, 120, 20])
check('fixture 6', solve({'wall_now': 90, 'wall_saved': 100, 'mono_now': -5, 'mono_saved': -20, 'boot_now': 'a', 'boot_saved': 'a', 'paused': False, 'budget': 20}), [5, False, 0, 0, -20])
check('fixture 7', solve({'wall_now': 101, 'wall_saved': 100, 'mono_now': 0, 'mono_saved': 0, 'boot_now': 'c', 'boot_saved': 'a', 'paused': False, 'budget': 0}), [0, True, 1, 0, -1])
check('fixture 8', solve({'wall_now': 100, 'wall_saved': 100, 'mono_now': 20, 'mono_saved': 20, 'boot_now': 'a', 'boot_saved': 'a', 'paused': True, 'budget': 10}), [10, False, 0, None, 20])
check('fixture 9', solve({'wall_now': 105, 'wall_saved': 100, 'mono_now': 24, 'mono_saved': 20, 'boot_now': 'a', 'boot_saved': 'a', 'paused': False, 'budget': 3}), [0, True, 1, 24, 20])
check('fixture 10', solve({'wall_now': 80, 'wall_saved': 100, 'mono_now': -10, 'mono_saved': -20, 'boot_now': 'a', 'boot_saved': 'a', 'paused': False, 'budget': 0}), [0, True, 10, -10, -20])
variant = [({'wall_now': 130, 'wall_saved': 100, 'mono_now': 50, 'mono_saved': 20, 'boot_now': 'a', 'boot_saved': 'a', 'paused': False, 'budget': 31}, [1, False, 0, 51, 20]), ({'wall_now': 130, 'wall_saved': 100, 'mono_now': 50, 'mono_saved': 20, 'boot_now': 'a', 'boot_saved': 'a', 'paused': False, 'budget': 32}, [2, False, 0, 52, 20]), ({'wall_now': 130, 'wall_saved': 100, 'mono_now': 50, 'mono_saved': 20, 'boot_now': 'a', 'boot_saved': 'a', 'paused': False, 'budget': 33}, [3, False, 0, 53, 20]), ({'wall_now': 130, 'wall_saved': 100, 'mono_now': 50, 'mono_saved': 20, 'boot_now': 'a', 'boot_saved': 'a', 'paused': False, 'budget': 34}, [4, False, 0, 54, 20]), ({'wall_now': 130, 'wall_saved': 100, 'mono_now': 50, 'mono_saved': 20, 'boot_now': 'a', 'boot_saved': 'a', 'paused': False, 'budget': 35}, [5, False, 0, 55, 20])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The decoded time state disagrees with the explicit regression oracle for base.

A checkpoint stores wall and monotonic coordinates, boot identity, budget and pause state. Same-boot restore uses monotonic elapsed; reboot restore uses nonnegative wall elapsed. Paused timers consume no elapsed ticks. Return remaining budget, expiration flag, overdue ticks, current-domain deadline (None while paused), and reconstructed running base. All units are identical integer ticks.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    word = r[1] * 256 + r[0]
    seconds = word - 65536 if word >= 32768 else word
    fraction = r[2] * 256 + r[3]
    valid = fraction < 1000
    total = seconds * 1000 + fraction
    negative = total < 0
    magnitude = abs(total)
    whole = magnitude // 1000
    part = magnitude % 1000
    next_second = seconds + (fraction + 1) // 1000
    return [valid, total if valid else None, ('-' if negative else '') + str(whole) + '.' + str(part).zfill(3) if valid else None,next_second if valid else None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve([0, 1, 0, 0]), [True, 1000, '1.000', 1])
check('fixture 2', solve([255, 255, 0, 1]), [True, -999, '-0.999', -1])
check('fixture 3', solve([128, 0, 3, 231]), [True, -32767001, '-32767.001', -32767])
check('fixture 4', solve([0, 0, 0, 0]), [True, 0, '0.000', 0])
check('fixture 5', solve([0, 0, 3, 232]), [False, None, None, None])
check('fixture 6', solve([255, 255, 3, 232]), [False, None, None, None])
check('fixture 7', solve([0, 2, 1, 3]), [True, 2259, '2.259', 2])
check('fixture 8', solve([127, 255, 3, 231]), [True, 32767999, '32767.999', 32768])
check('fixture 9', solve([255, 254, 0, 0]), [True, -2000, '-2.000', -2])
check('fixture 10', solve([0, 0, 3, 231]), [True, 999, '0.999', 1])
variant = [([0, 2, 0, 0], [True, 2000, '2.000', 2]), ([0, 3, 0, 0], [True, 3000, '3.000', 3]), ([0, 4, 0, 0], [True, 4000, '4.000', 4]), ([0, 5, 0, 0], [True, 5000, '5.000', 5]), ([0, 6, 0, 0], [True, 6000, '6.000', 6])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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
from fractions import Fraction
N = 1
observations = []
def solve(r):
    word = r[0] * 255 + r[1]
    seconds = word - 65536 if word >= 32768 else word
    fraction = r[2] * 256 + r[3]
    valid = fraction < 1000
    total = seconds * 1000 + fraction
    negative = total < 0
    magnitude = abs(total)
    whole = magnitude // 1000
    part = magnitude % 1000
    next_second = seconds + (fraction + 1) // 1000
    return [valid, total if valid else None, ('-' if negative else '') + str(whole) + '.' + str(part).zfill(3) if valid else None,next_second if valid else None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve([0, 1, 0, 0]), [True, 1000, '1.000', 1])
check('fixture 2', solve([255, 255, 0, 1]), [True, -999, '-0.999', -1])
check('fixture 3', solve([128, 0, 3, 231]), [True, -32767001, '-32767.001', -32767])
check('fixture 4', solve([0, 0, 0, 0]), [True, 0, '0.000', 0])
check('fixture 5', solve([0, 0, 3, 232]), [False, None, None, None])
check('fixture 6', solve([255, 255, 3, 232]), [False, None, None, None])
check('fixture 7', solve([0, 2, 1, 3]), [True, 2259, '2.259', 2])
check('fixture 8', solve([127, 255, 3, 231]), [True, 32767999, '32767.999', 32768])
check('fixture 9', solve([255, 254, 0, 0]), [True, -2000, '-2.000', -2])
check('fixture 10', solve([0, 0, 3, 231]), [True, 999, '0.999', 1])
variant = [([0, 2, 0, 0], [True, 2000, '2.000', 2]), ([0, 3, 0, 0], [True, 3000, '3.000', 3]), ([0, 4, 0, 0], [True, 4000, '4.000', 4]), ([0, 5, 0, 0], [True, 5000, '5.000', 5]), ([0, 6, 0, 0], [True, 6000, '6.000', 6])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The decoded time state disagrees with the explicit regression oracle for word.

Decode four unsigned bytes: signed 16-bit big-endian seconds and unsigned 16-bit fractional microticks, 1000 per second. Fraction >=1000 is invalid. Return validity and, only for valid input, exact total microticks, signed decimal timestamp with three fractional digits, and whole-second coordinate after a one-microtick increment. Negative display uses magnitude decomposition.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    word = r[0] * 256 + r[1]
    seconds = word
    fraction = r[2] * 256 + r[3]
    valid = fraction < 1000
    total = seconds * 1000 + fraction
    negative = total < 0
    magnitude = abs(total)
    whole = magnitude // 1000
    part = magnitude % 1000
    next_second = seconds + (fraction + 1) // 1000
    return [valid, total if valid else None, ('-' if negative else '') + str(whole) + '.' + str(part).zfill(3) if valid else None,next_second if valid else None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve([0, 1, 0, 0]), [True, 1000, '1.000', 1])
check('fixture 2', solve([255, 255, 0, 1]), [True, -999, '-0.999', -1])
check('fixture 3', solve([128, 0, 3, 231]), [True, -32767001, '-32767.001', -32767])
check('fixture 4', solve([0, 0, 0, 0]), [True, 0, '0.000', 0])
check('fixture 5', solve([0, 0, 3, 232]), [False, None, None, None])
check('fixture 6', solve([255, 255, 3, 232]), [False, None, None, None])
check('fixture 7', solve([0, 2, 1, 3]), [True, 2259, '2.259', 2])
check('fixture 8', solve([127, 255, 3, 231]), [True, 32767999, '32767.999', 32768])
check('fixture 9', solve([255, 254, 0, 0]), [True, -2000, '-2.000', -2])
check('fixture 10', solve([0, 0, 3, 231]), [True, 999, '0.999', 1])
variant = [([0, 2, 0, 0], [True, 2000, '2.000', 2]), ([0, 3, 0, 0], [True, 3000, '3.000', 3]), ([0, 4, 0, 0], [True, 4000, '4.000', 4]), ([0, 5, 0, 0], [True, 5000, '5.000', 5]), ([0, 6, 0, 0], [True, 6000, '6.000', 6])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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
from fractions import Fraction
N = 1
observations = []
def solve(r):
    word = r[0] * 256 + r[1]
    seconds = word - 65536 if word > 32768 else word
    fraction = r[2] * 256 + r[3]
    valid = fraction < 1000
    total = seconds * 1000 + fraction
    negative = total < 0
    magnitude = abs(total)
    whole = magnitude // 1000
    part = magnitude % 1000
    next_second = seconds + (fraction + 1) // 1000
    return [valid, total if valid else None, ('-' if negative else '') + str(whole) + '.' + str(part).zfill(3) if valid else None,next_second if valid else None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve([0, 1, 0, 0]), [True, 1000, '1.000', 1])
check('fixture 2', solve([255, 255, 0, 1]), [True, -999, '-0.999', -1])
check('fixture 3', solve([128, 0, 3, 231]), [True, -32767001, '-32767.001', -32767])
check('fixture 4', solve([0, 0, 0, 0]), [True, 0, '0.000', 0])
check('fixture 5', solve([0, 0, 3, 232]), [False, None, None, None])
check('fixture 6', solve([255, 255, 3, 232]), [False, None, None, None])
check('fixture 7', solve([0, 2, 1, 3]), [True, 2259, '2.259', 2])
check('fixture 8', solve([127, 255, 3, 231]), [True, 32767999, '32767.999', 32768])
check('fixture 9', solve([255, 254, 0, 0]), [True, -2000, '-2.000', -2])
check('fixture 10', solve([0, 0, 3, 231]), [True, 999, '0.999', 1])
variant = [([0, 2, 0, 0], [True, 2000, '2.000', 2]), ([0, 3, 0, 0], [True, 3000, '3.000', 3]), ([0, 4, 0, 0], [True, 4000, '4.000', 4]), ([0, 5, 0, 0], [True, 5000, '5.000', 5]), ([0, 6, 0, 0], [True, 6000, '6.000', 6])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The decoded time state disagrees with the explicit regression oracle for seconds.

Decode four unsigned bytes: signed 16-bit big-endian seconds and unsigned 16-bit fractional microticks, 1000 per second. Fraction >=1000 is invalid. Return validity and, only for valid input, exact total microticks, signed decimal timestamp with three fractional digits, and whole-second coordinate after a one-microtick increment. Negative display uses magnitude decomposition.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    word = r[0] * 256 + r[1]
    seconds = word - 65536 if word >= 32768 else word
    fraction = r[3] * 256 + r[2]
    valid = fraction < 1000
    total = seconds * 1000 + fraction
    negative = total < 0
    magnitude = abs(total)
    whole = magnitude // 1000
    part = magnitude % 1000
    next_second = seconds + (fraction + 1) // 1000
    return [valid, total if valid else None, ('-' if negative else '') + str(whole) + '.' + str(part).zfill(3) if valid else None,next_second if valid else None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve([0, 1, 0, 0]), [True, 1000, '1.000', 1])
check('fixture 2', solve([255, 255, 0, 1]), [True, -999, '-0.999', -1])
check('fixture 3', solve([128, 0, 3, 231]), [True, -32767001, '-32767.001', -32767])
check('fixture 4', solve([0, 0, 0, 0]), [True, 0, '0.000', 0])
check('fixture 5', solve([0, 0, 3, 232]), [False, None, None, None])
check('fixture 6', solve([255, 255, 3, 232]), [False, None, None, None])
check('fixture 7', solve([0, 2, 1, 3]), [True, 2259, '2.259', 2])
check('fixture 8', solve([127, 255, 3, 231]), [True, 32767999, '32767.999', 32768])
check('fixture 9', solve([255, 254, 0, 0]), [True, -2000, '-2.000', -2])
check('fixture 10', solve([0, 0, 3, 231]), [True, 999, '0.999', 1])
variant = [([0, 2, 0, 0], [True, 2000, '2.000', 2]), ([0, 3, 0, 0], [True, 3000, '3.000', 3]), ([0, 4, 0, 0], [True, 4000, '4.000', 4]), ([0, 5, 0, 0], [True, 5000, '5.000', 5]), ([0, 6, 0, 0], [True, 6000, '6.000', 6])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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
from fractions import Fraction
N = 1
observations = []
def solve(r):
    word = r[0] * 256 + r[1]
    seconds = word - 65536 if word >= 32768 else word
    fraction = r[2] + r[3]
    valid = fraction < 1000
    total = seconds * 1000 + fraction
    negative = total < 0
    magnitude = abs(total)
    whole = magnitude // 1000
    part = magnitude % 1000
    next_second = seconds + (fraction + 1) // 1000
    return [valid, total if valid else None, ('-' if negative else '') + str(whole) + '.' + str(part).zfill(3) if valid else None,next_second if valid else None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve([0, 1, 0, 0]), [True, 1000, '1.000', 1])
check('fixture 2', solve([255, 255, 0, 1]), [True, -999, '-0.999', -1])
check('fixture 3', solve([128, 0, 3, 231]), [True, -32767001, '-32767.001', -32767])
check('fixture 4', solve([0, 0, 0, 0]), [True, 0, '0.000', 0])
check('fixture 5', solve([0, 0, 3, 232]), [False, None, None, None])
check('fixture 6', solve([255, 255, 3, 232]), [False, None, None, None])
check('fixture 7', solve([0, 2, 1, 3]), [True, 2259, '2.259', 2])
check('fixture 8', solve([127, 255, 3, 231]), [True, 32767999, '32767.999', 32768])
check('fixture 9', solve([255, 254, 0, 0]), [True, -2000, '-2.000', -2])
check('fixture 10', solve([0, 0, 3, 231]), [True, 999, '0.999', 1])
variant = [([0, 2, 0, 0], [True, 2000, '2.000', 2]), ([0, 3, 0, 0], [True, 3000, '3.000', 3]), ([0, 4, 0, 0], [True, 4000, '4.000', 4]), ([0, 5, 0, 0], [True, 5000, '5.000', 5]), ([0, 6, 0, 0], [True, 6000, '6.000', 6])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The decoded time state disagrees with the explicit regression oracle for fraction.

Decode four unsigned bytes: signed 16-bit big-endian seconds and unsigned 16-bit fractional microticks, 1000 per second. Fraction >=1000 is invalid. Return validity and, only for valid input, exact total microticks, signed decimal timestamp with three fractional digits, and whole-second coordinate after a one-microtick increment. Negative display uses magnitude decomposition.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    word = r[0] * 256 + r[1]
    seconds = word - 65536 if word >= 32768 else word
    fraction = r[2] * 256 + r[3]
    valid = fraction <= 1000
    total = seconds * 1000 + fraction
    negative = total < 0
    magnitude = abs(total)
    whole = magnitude // 1000
    part = magnitude % 1000
    next_second = seconds + (fraction + 1) // 1000
    return [valid, total if valid else None, ('-' if negative else '') + str(whole) + '.' + str(part).zfill(3) if valid else None,next_second if valid else None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve([0, 1, 0, 0]), [True, 1000, '1.000', 1])
check('fixture 2', solve([255, 255, 0, 1]), [True, -999, '-0.999', -1])
check('fixture 3', solve([128, 0, 3, 231]), [True, -32767001, '-32767.001', -32767])
check('fixture 4', solve([0, 0, 0, 0]), [True, 0, '0.000', 0])
check('fixture 5', solve([0, 0, 3, 232]), [False, None, None, None])
check('fixture 6', solve([255, 255, 3, 232]), [False, None, None, None])
check('fixture 7', solve([0, 2, 1, 3]), [True, 2259, '2.259', 2])
check('fixture 8', solve([127, 255, 3, 231]), [True, 32767999, '32767.999', 32768])
check('fixture 9', solve([255, 254, 0, 0]), [True, -2000, '-2.000', -2])
check('fixture 10', solve([0, 0, 3, 231]), [True, 999, '0.999', 1])
variant = [([0, 2, 0, 0], [True, 2000, '2.000', 2]), ([0, 3, 0, 0], [True, 3000, '3.000', 3]), ([0, 4, 0, 0], [True, 4000, '4.000', 4]), ([0, 5, 0, 0], [True, 5000, '5.000', 5]), ([0, 6, 0, 0], [True, 6000, '6.000', 6])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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
from fractions import Fraction
N = 1
observations = []
def solve(r):
    word = r[0] * 256 + r[1]
    seconds = word - 65536 if word >= 32768 else word
    fraction = r[2] * 256 + r[3]
    valid = fraction < 999
    total = seconds * 1000 + fraction
    negative = total < 0
    magnitude = abs(total)
    whole = magnitude // 1000
    part = magnitude % 1000
    next_second = seconds + (fraction + 1) // 1000
    return [valid, total if valid else None, ('-' if negative else '') + str(whole) + '.' + str(part).zfill(3) if valid else None,next_second if valid else None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve([0, 1, 0, 0]), [True, 1000, '1.000', 1])
check('fixture 2', solve([255, 255, 0, 1]), [True, -999, '-0.999', -1])
check('fixture 3', solve([128, 0, 3, 231]), [True, -32767001, '-32767.001', -32767])
check('fixture 4', solve([0, 0, 0, 0]), [True, 0, '0.000', 0])
check('fixture 5', solve([0, 0, 3, 232]), [False, None, None, None])
check('fixture 6', solve([255, 255, 3, 232]), [False, None, None, None])
check('fixture 7', solve([0, 2, 1, 3]), [True, 2259, '2.259', 2])
check('fixture 8', solve([127, 255, 3, 231]), [True, 32767999, '32767.999', 32768])
check('fixture 9', solve([255, 254, 0, 0]), [True, -2000, '-2.000', -2])
check('fixture 10', solve([0, 0, 3, 231]), [True, 999, '0.999', 1])
variant = [([0, 2, 0, 0], [True, 2000, '2.000', 2]), ([0, 3, 0, 0], [True, 3000, '3.000', 3]), ([0, 4, 0, 0], [True, 4000, '4.000', 4]), ([0, 5, 0, 0], [True, 5000, '5.000', 5]), ([0, 6, 0, 0], [True, 6000, '6.000', 6])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The decoded time state disagrees with the explicit regression oracle for valid.

Decode four unsigned bytes: signed 16-bit big-endian seconds and unsigned 16-bit fractional microticks, 1000 per second. Fraction >=1000 is invalid. Return validity and, only for valid input, exact total microticks, signed decimal timestamp with three fractional digits, and whole-second coordinate after a one-microtick increment. Negative display uses magnitude decomposition.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    word = r[0] * 256 + r[1]
    seconds = word - 65536 if word >= 32768 else word
    fraction = r[2] * 256 + r[3]
    valid = fraction < 1000
    total = seconds + fraction
    negative = total < 0
    magnitude = abs(total)
    whole = magnitude // 1000
    part = magnitude % 1000
    next_second = seconds + (fraction + 1) // 1000
    return [valid, total if valid else None, ('-' if negative else '') + str(whole) + '.' + str(part).zfill(3) if valid else None,next_second if valid else None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve([0, 1, 0, 0]), [True, 1000, '1.000', 1])
check('fixture 2', solve([255, 255, 0, 1]), [True, -999, '-0.999', -1])
check('fixture 3', solve([128, 0, 3, 231]), [True, -32767001, '-32767.001', -32767])
check('fixture 4', solve([0, 0, 0, 0]), [True, 0, '0.000', 0])
check('fixture 5', solve([0, 0, 3, 232]), [False, None, None, None])
check('fixture 6', solve([255, 255, 3, 232]), [False, None, None, None])
check('fixture 7', solve([0, 2, 1, 3]), [True, 2259, '2.259', 2])
check('fixture 8', solve([127, 255, 3, 231]), [True, 32767999, '32767.999', 32768])
check('fixture 9', solve([255, 254, 0, 0]), [True, -2000, '-2.000', -2])
check('fixture 10', solve([0, 0, 3, 231]), [True, 999, '0.999', 1])
variant = [([0, 2, 0, 0], [True, 2000, '2.000', 2]), ([0, 3, 0, 0], [True, 3000, '3.000', 3]), ([0, 4, 0, 0], [True, 4000, '4.000', 4]), ([0, 5, 0, 0], [True, 5000, '5.000', 5]), ([0, 6, 0, 0], [True, 6000, '6.000', 6])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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
from fractions import Fraction
N = 1
observations = []
def solve(r):
    word = r[0] * 256 + r[1]
    seconds = word - 65536 if word >= 32768 else word
    fraction = r[2] * 256 + r[3]
    valid = fraction < 1000
    total = seconds * 1000 - fraction
    negative = total < 0
    magnitude = abs(total)
    whole = magnitude // 1000
    part = magnitude % 1000
    next_second = seconds + (fraction + 1) // 1000
    return [valid, total if valid else None, ('-' if negative else '') + str(whole) + '.' + str(part).zfill(3) if valid else None,next_second if valid else None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve([0, 1, 0, 0]), [True, 1000, '1.000', 1])
check('fixture 2', solve([255, 255, 0, 1]), [True, -999, '-0.999', -1])
check('fixture 3', solve([128, 0, 3, 231]), [True, -32767001, '-32767.001', -32767])
check('fixture 4', solve([0, 0, 0, 0]), [True, 0, '0.000', 0])
check('fixture 5', solve([0, 0, 3, 232]), [False, None, None, None])
check('fixture 6', solve([255, 255, 3, 232]), [False, None, None, None])
check('fixture 7', solve([0, 2, 1, 3]), [True, 2259, '2.259', 2])
check('fixture 8', solve([127, 255, 3, 231]), [True, 32767999, '32767.999', 32768])
check('fixture 9', solve([255, 254, 0, 0]), [True, -2000, '-2.000', -2])
check('fixture 10', solve([0, 0, 3, 231]), [True, 999, '0.999', 1])
variant = [([0, 2, 0, 0], [True, 2000, '2.000', 2]), ([0, 3, 0, 0], [True, 3000, '3.000', 3]), ([0, 4, 0, 0], [True, 4000, '4.000', 4]), ([0, 5, 0, 0], [True, 5000, '5.000', 5]), ([0, 6, 0, 0], [True, 6000, '6.000', 6])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The decoded time state disagrees with the explicit regression oracle for total.

Decode four unsigned bytes: signed 16-bit big-endian seconds and unsigned 16-bit fractional microticks, 1000 per second. Fraction >=1000 is invalid. Return validity and, only for valid input, exact total microticks, signed decimal timestamp with three fractional digits, and whole-second coordinate after a one-microtick increment. Negative display uses magnitude decomposition.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    word = r[0] * 256 + r[1]
    seconds = word - 65536 if word >= 32768 else word
    fraction = r[2] * 256 + r[3]
    valid = fraction < 1000
    total = seconds * 1000 + fraction
    negative = word > 32768
    magnitude = abs(total)
    whole = magnitude // 1000
    part = magnitude % 1000
    next_second = seconds + (fraction + 1) // 1000
    return [valid, total if valid else None, ('-' if negative else '') + str(whole) + '.' + str(part).zfill(3) if valid else None,next_second if valid else None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve([0, 1, 0, 0]), [True, 1000, '1.000', 1])
check('fixture 2', solve([255, 255, 0, 1]), [True, -999, '-0.999', -1])
check('fixture 3', solve([128, 0, 3, 231]), [True, -32767001, '-32767.001', -32767])
check('fixture 4', solve([0, 0, 0, 0]), [True, 0, '0.000', 0])
check('fixture 5', solve([0, 0, 3, 232]), [False, None, None, None])
check('fixture 6', solve([255, 255, 3, 232]), [False, None, None, None])
check('fixture 7', solve([0, 2, 1, 3]), [True, 2259, '2.259', 2])
check('fixture 8', solve([127, 255, 3, 231]), [True, 32767999, '32767.999', 32768])
check('fixture 9', solve([255, 254, 0, 0]), [True, -2000, '-2.000', -2])
check('fixture 10', solve([0, 0, 3, 231]), [True, 999, '0.999', 1])
variant = [([0, 2, 0, 0], [True, 2000, '2.000', 2]), ([0, 3, 0, 0], [True, 3000, '3.000', 3]), ([0, 4, 0, 0], [True, 4000, '4.000', 4]), ([0, 5, 0, 0], [True, 5000, '5.000', 5]), ([0, 6, 0, 0], [True, 6000, '6.000', 6])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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
from fractions import Fraction
N = 1
observations = []
def solve(r):
    word = r[0] * 256 + r[1]
    seconds = word - 65536 if word >= 32768 else word
    fraction = r[2] * 256 + r[3]
    valid = fraction < 1000
    total = seconds * 1000 + fraction
    negative = total < -1000
    magnitude = abs(total)
    whole = magnitude // 1000
    part = magnitude % 1000
    next_second = seconds + (fraction + 1) // 1000
    return [valid, total if valid else None, ('-' if negative else '') + str(whole) + '.' + str(part).zfill(3) if valid else None,next_second if valid else None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve([0, 1, 0, 0]), [True, 1000, '1.000', 1])
check('fixture 2', solve([255, 255, 0, 1]), [True, -999, '-0.999', -1])
check('fixture 3', solve([128, 0, 3, 231]), [True, -32767001, '-32767.001', -32767])
check('fixture 4', solve([0, 0, 0, 0]), [True, 0, '0.000', 0])
check('fixture 5', solve([0, 0, 3, 232]), [False, None, None, None])
check('fixture 6', solve([255, 255, 3, 232]), [False, None, None, None])
check('fixture 7', solve([0, 2, 1, 3]), [True, 2259, '2.259', 2])
check('fixture 8', solve([127, 255, 3, 231]), [True, 32767999, '32767.999', 32768])
check('fixture 9', solve([255, 254, 0, 0]), [True, -2000, '-2.000', -2])
check('fixture 10', solve([0, 0, 3, 231]), [True, 999, '0.999', 1])
variant = [([0, 2, 0, 0], [True, 2000, '2.000', 2]), ([0, 3, 0, 0], [True, 3000, '3.000', 3]), ([0, 4, 0, 0], [True, 4000, '4.000', 4]), ([0, 5, 0, 0], [True, 5000, '5.000', 5]), ([0, 6, 0, 0], [True, 6000, '6.000', 6])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The decoded time state disagrees with the explicit regression oracle for negative.

Decode four unsigned bytes: signed 16-bit big-endian seconds and unsigned 16-bit fractional microticks, 1000 per second. Fraction >=1000 is invalid. Return validity and, only for valid input, exact total microticks, signed decimal timestamp with three fractional digits, and whole-second coordinate after a one-microtick increment. Negative display uses magnitude decomposition.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    word = r[0] * 256 + r[1]
    seconds = word - 65536 if word >= 32768 else word
    fraction = r[2] * 256 + r[3]
    valid = fraction < 1000
    total = seconds * 1000 + fraction
    negative = total < 0
    magnitude = total
    whole = magnitude // 1000
    part = magnitude % 1000
    next_second = seconds + (fraction + 1) // 1000
    return [valid, total if valid else None, ('-' if negative else '') + str(whole) + '.' + str(part).zfill(3) if valid else None,next_second if valid else None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve([0, 1, 0, 0]), [True, 1000, '1.000', 1])
check('fixture 2', solve([255, 255, 0, 1]), [True, -999, '-0.999', -1])
check('fixture 3', solve([128, 0, 3, 231]), [True, -32767001, '-32767.001', -32767])
check('fixture 4', solve([0, 0, 0, 0]), [True, 0, '0.000', 0])
check('fixture 5', solve([0, 0, 3, 232]), [False, None, None, None])
check('fixture 6', solve([255, 255, 3, 232]), [False, None, None, None])
check('fixture 7', solve([0, 2, 1, 3]), [True, 2259, '2.259', 2])
check('fixture 8', solve([127, 255, 3, 231]), [True, 32767999, '32767.999', 32768])
check('fixture 9', solve([255, 254, 0, 0]), [True, -2000, '-2.000', -2])
check('fixture 10', solve([0, 0, 3, 231]), [True, 999, '0.999', 1])
variant = [([0, 2, 0, 0], [True, 2000, '2.000', 2]), ([0, 3, 0, 0], [True, 3000, '3.000', 3]), ([0, 4, 0, 0], [True, 4000, '4.000', 4]), ([0, 5, 0, 0], [True, 5000, '5.000', 5]), ([0, 6, 0, 0], [True, 6000, '6.000', 6])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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
from fractions import Fraction
N = 1
observations = []
def solve(r):
    word = r[0] * 256 + r[1]
    seconds = word - 65536 if word >= 32768 else word
    fraction = r[2] * 256 + r[3]
    valid = fraction < 1000
    total = seconds * 1000 + fraction
    negative = total < 0
    magnitude = abs(seconds) * 1000 + fraction
    whole = magnitude // 1000
    part = magnitude % 1000
    next_second = seconds + (fraction + 1) // 1000
    return [valid, total if valid else None, ('-' if negative else '') + str(whole) + '.' + str(part).zfill(3) if valid else None,next_second if valid else None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve([0, 1, 0, 0]), [True, 1000, '1.000', 1])
check('fixture 2', solve([255, 255, 0, 1]), [True, -999, '-0.999', -1])
check('fixture 3', solve([128, 0, 3, 231]), [True, -32767001, '-32767.001', -32767])
check('fixture 4', solve([0, 0, 0, 0]), [True, 0, '0.000', 0])
check('fixture 5', solve([0, 0, 3, 232]), [False, None, None, None])
check('fixture 6', solve([255, 255, 3, 232]), [False, None, None, None])
check('fixture 7', solve([0, 2, 1, 3]), [True, 2259, '2.259', 2])
check('fixture 8', solve([127, 255, 3, 231]), [True, 32767999, '32767.999', 32768])
check('fixture 9', solve([255, 254, 0, 0]), [True, -2000, '-2.000', -2])
check('fixture 10', solve([0, 0, 3, 231]), [True, 999, '0.999', 1])
variant = [([0, 2, 0, 0], [True, 2000, '2.000', 2]), ([0, 3, 0, 0], [True, 3000, '3.000', 3]), ([0, 4, 0, 0], [True, 4000, '4.000', 4]), ([0, 5, 0, 0], [True, 5000, '5.000', 5]), ([0, 6, 0, 0], [True, 6000, '6.000', 6])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The decoded time state disagrees with the explicit regression oracle for magnitude.

Decode four unsigned bytes: signed 16-bit big-endian seconds and unsigned 16-bit fractional microticks, 1000 per second. Fraction >=1000 is invalid. Return validity and, only for valid input, exact total microticks, signed decimal timestamp with three fractional digits, and whole-second coordinate after a one-microtick increment. Negative display uses magnitude decomposition.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    word = r[0] * 256 + r[1]
    seconds = word - 65536 if word >= 32768 else word
    fraction = r[2] * 256 + r[3]
    valid = fraction < 1000
    total = seconds * 1000 + fraction
    negative = total < 0
    magnitude = abs(total)
    whole = magnitude % 1000
    part = magnitude % 1000
    next_second = seconds + (fraction + 1) // 1000
    return [valid, total if valid else None, ('-' if negative else '') + str(whole) + '.' + str(part).zfill(3) if valid else None,next_second if valid else None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve([0, 1, 0, 0]), [True, 1000, '1.000', 1])
check('fixture 2', solve([255, 255, 0, 1]), [True, -999, '-0.999', -1])
check('fixture 3', solve([128, 0, 3, 231]), [True, -32767001, '-32767.001', -32767])
check('fixture 4', solve([0, 0, 0, 0]), [True, 0, '0.000', 0])
check('fixture 5', solve([0, 0, 3, 232]), [False, None, None, None])
check('fixture 6', solve([255, 255, 3, 232]), [False, None, None, None])
check('fixture 7', solve([0, 2, 1, 3]), [True, 2259, '2.259', 2])
check('fixture 8', solve([127, 255, 3, 231]), [True, 32767999, '32767.999', 32768])
check('fixture 9', solve([255, 254, 0, 0]), [True, -2000, '-2.000', -2])
check('fixture 10', solve([0, 0, 3, 231]), [True, 999, '0.999', 1])
variant = [([0, 2, 0, 0], [True, 2000, '2.000', 2]), ([0, 3, 0, 0], [True, 3000, '3.000', 3]), ([0, 4, 0, 0], [True, 4000, '4.000', 4]), ([0, 5, 0, 0], [True, 5000, '5.000', 5]), ([0, 6, 0, 0], [True, 6000, '6.000', 6])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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
from fractions import Fraction
N = 1
observations = []
def solve(r):
    word = r[0] * 256 + r[1]
    seconds = word - 65536 if word >= 32768 else word
    fraction = r[2] * 256 + r[3]
    valid = fraction < 1000
    total = seconds * 1000 + fraction
    negative = total < 0
    magnitude = abs(total)
    whole = (magnitude + 999) // 1000
    part = magnitude % 1000
    next_second = seconds + (fraction + 1) // 1000
    return [valid, total if valid else None, ('-' if negative else '') + str(whole) + '.' + str(part).zfill(3) if valid else None,next_second if valid else None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve([0, 1, 0, 0]), [True, 1000, '1.000', 1])
check('fixture 2', solve([255, 255, 0, 1]), [True, -999, '-0.999', -1])
check('fixture 3', solve([128, 0, 3, 231]), [True, -32767001, '-32767.001', -32767])
check('fixture 4', solve([0, 0, 0, 0]), [True, 0, '0.000', 0])
check('fixture 5', solve([0, 0, 3, 232]), [False, None, None, None])
check('fixture 6', solve([255, 255, 3, 232]), [False, None, None, None])
check('fixture 7', solve([0, 2, 1, 3]), [True, 2259, '2.259', 2])
check('fixture 8', solve([127, 255, 3, 231]), [True, 32767999, '32767.999', 32768])
check('fixture 9', solve([255, 254, 0, 0]), [True, -2000, '-2.000', -2])
check('fixture 10', solve([0, 0, 3, 231]), [True, 999, '0.999', 1])
variant = [([0, 2, 0, 0], [True, 2000, '2.000', 2]), ([0, 3, 0, 0], [True, 3000, '3.000', 3]), ([0, 4, 0, 0], [True, 4000, '4.000', 4]), ([0, 5, 0, 0], [True, 5000, '5.000', 5]), ([0, 6, 0, 0], [True, 6000, '6.000', 6])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The decoded time state disagrees with the explicit regression oracle for whole.

Decode four unsigned bytes: signed 16-bit big-endian seconds and unsigned 16-bit fractional microticks, 1000 per second. Fraction >=1000 is invalid. Return validity and, only for valid input, exact total microticks, signed decimal timestamp with three fractional digits, and whole-second coordinate after a one-microtick increment. Negative display uses magnitude decomposition.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    word = r[0] * 256 + r[1]
    seconds = word - 65536 if word >= 32768 else word
    fraction = r[2] * 256 + r[3]
    valid = fraction < 1000
    total = seconds * 1000 + fraction
    negative = total < 0
    magnitude = abs(total)
    whole = magnitude // 1000
    part = fraction
    next_second = seconds + (fraction + 1) // 1000
    return [valid, total if valid else None, ('-' if negative else '') + str(whole) + '.' + str(part).zfill(3) if valid else None,next_second if valid else None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve([0, 1, 0, 0]), [True, 1000, '1.000', 1])
check('fixture 2', solve([255, 255, 0, 1]), [True, -999, '-0.999', -1])
check('fixture 3', solve([128, 0, 3, 231]), [True, -32767001, '-32767.001', -32767])
check('fixture 4', solve([0, 0, 0, 0]), [True, 0, '0.000', 0])
check('fixture 5', solve([0, 0, 3, 232]), [False, None, None, None])
check('fixture 6', solve([255, 255, 3, 232]), [False, None, None, None])
check('fixture 7', solve([0, 2, 1, 3]), [True, 2259, '2.259', 2])
check('fixture 8', solve([127, 255, 3, 231]), [True, 32767999, '32767.999', 32768])
check('fixture 9', solve([255, 254, 0, 0]), [True, -2000, '-2.000', -2])
check('fixture 10', solve([0, 0, 3, 231]), [True, 999, '0.999', 1])
variant = [([0, 2, 0, 0], [True, 2000, '2.000', 2]), ([0, 3, 0, 0], [True, 3000, '3.000', 3]), ([0, 4, 0, 0], [True, 4000, '4.000', 4]), ([0, 5, 0, 0], [True, 5000, '5.000', 5]), ([0, 6, 0, 0], [True, 6000, '6.000', 6])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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
from fractions import Fraction
N = 1
observations = []
def solve(r):
    word = r[0] * 256 + r[1]
    seconds = word - 65536 if word >= 32768 else word
    fraction = r[2] * 256 + r[3]
    valid = fraction < 1000
    total = seconds * 1000 + fraction
    negative = total < 0
    magnitude = abs(total)
    whole = magnitude // 1000
    part = 1000 - magnitude % 1000
    next_second = seconds + (fraction + 1) // 1000
    return [valid, total if valid else None, ('-' if negative else '') + str(whole) + '.' + str(part).zfill(3) if valid else None,next_second if valid else None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve([0, 1, 0, 0]), [True, 1000, '1.000', 1])
check('fixture 2', solve([255, 255, 0, 1]), [True, -999, '-0.999', -1])
check('fixture 3', solve([128, 0, 3, 231]), [True, -32767001, '-32767.001', -32767])
check('fixture 4', solve([0, 0, 0, 0]), [True, 0, '0.000', 0])
check('fixture 5', solve([0, 0, 3, 232]), [False, None, None, None])
check('fixture 6', solve([255, 255, 3, 232]), [False, None, None, None])
check('fixture 7', solve([0, 2, 1, 3]), [True, 2259, '2.259', 2])
check('fixture 8', solve([127, 255, 3, 231]), [True, 32767999, '32767.999', 32768])
check('fixture 9', solve([255, 254, 0, 0]), [True, -2000, '-2.000', -2])
check('fixture 10', solve([0, 0, 3, 231]), [True, 999, '0.999', 1])
variant = [([0, 2, 0, 0], [True, 2000, '2.000', 2]), ([0, 3, 0, 0], [True, 3000, '3.000', 3]), ([0, 4, 0, 0], [True, 4000, '4.000', 4]), ([0, 5, 0, 0], [True, 5000, '5.000', 5]), ([0, 6, 0, 0], [True, 6000, '6.000', 6])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The decoded time state disagrees with the explicit regression oracle for part.

Decode four unsigned bytes: signed 16-bit big-endian seconds and unsigned 16-bit fractional microticks, 1000 per second. Fraction >=1000 is invalid. Return validity and, only for valid input, exact total microticks, signed decimal timestamp with three fractional digits, and whole-second coordinate after a one-microtick increment. Negative display uses magnitude decomposition.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    word = r[0] * 256 + r[1]
    seconds = word - 65536 if word >= 32768 else word
    fraction = r[2] * 256 + r[3]
    valid = fraction < 1000
    total = seconds * 1000 + fraction
    negative = total < 0
    magnitude = abs(total)
    whole = magnitude // 1000
    part = magnitude % 1000
    next_second = seconds + 1
    return [valid, total if valid else None, ('-' if negative else '') + str(whole) + '.' + str(part).zfill(3) if valid else None,next_second if valid else None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve([0, 1, 0, 0]), [True, 1000, '1.000', 1])
check('fixture 2', solve([255, 255, 0, 1]), [True, -999, '-0.999', -1])
check('fixture 3', solve([128, 0, 3, 231]), [True, -32767001, '-32767.001', -32767])
check('fixture 4', solve([0, 0, 0, 0]), [True, 0, '0.000', 0])
check('fixture 5', solve([0, 0, 3, 232]), [False, None, None, None])
check('fixture 6', solve([255, 255, 3, 232]), [False, None, None, None])
check('fixture 7', solve([0, 2, 1, 3]), [True, 2259, '2.259', 2])
check('fixture 8', solve([127, 255, 3, 231]), [True, 32767999, '32767.999', 32768])
check('fixture 9', solve([255, 254, 0, 0]), [True, -2000, '-2.000', -2])
check('fixture 10', solve([0, 0, 3, 231]), [True, 999, '0.999', 1])
variant = [([0, 2, 0, 0], [True, 2000, '2.000', 2]), ([0, 3, 0, 0], [True, 3000, '3.000', 3]), ([0, 4, 0, 0], [True, 4000, '4.000', 4]), ([0, 5, 0, 0], [True, 5000, '5.000', 5]), ([0, 6, 0, 0], [True, 6000, '6.000', 6])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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
from fractions import Fraction
N = 1
observations = []
def solve(r):
    word = r[0] * 256 + r[1]
    seconds = word - 65536 if word >= 32768 else word
    fraction = r[2] * 256 + r[3]
    valid = fraction < 1000
    total = seconds * 1000 + fraction
    negative = total < 0
    magnitude = abs(total)
    whole = magnitude // 1000
    part = magnitude % 1000
    next_second = seconds + fraction // 1000
    return [valid, total if valid else None, ('-' if negative else '') + str(whole) + '.' + str(part).zfill(3) if valid else None,next_second if valid else None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve([0, 1, 0, 0]), [True, 1000, '1.000', 1])
check('fixture 2', solve([255, 255, 0, 1]), [True, -999, '-0.999', -1])
check('fixture 3', solve([128, 0, 3, 231]), [True, -32767001, '-32767.001', -32767])
check('fixture 4', solve([0, 0, 0, 0]), [True, 0, '0.000', 0])
check('fixture 5', solve([0, 0, 3, 232]), [False, None, None, None])
check('fixture 6', solve([255, 255, 3, 232]), [False, None, None, None])
check('fixture 7', solve([0, 2, 1, 3]), [True, 2259, '2.259', 2])
check('fixture 8', solve([127, 255, 3, 231]), [True, 32767999, '32767.999', 32768])
check('fixture 9', solve([255, 254, 0, 0]), [True, -2000, '-2.000', -2])
check('fixture 10', solve([0, 0, 3, 231]), [True, 999, '0.999', 1])
variant = [([0, 2, 0, 0], [True, 2000, '2.000', 2]), ([0, 3, 0, 0], [True, 3000, '3.000', 3]), ([0, 4, 0, 0], [True, 4000, '4.000', 4]), ([0, 5, 0, 0], [True, 5000, '5.000', 5]), ([0, 6, 0, 0], [True, 6000, '6.000', 6])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The decoded time state disagrees with the explicit regression oracle for next_second.

Decode four unsigned bytes: signed 16-bit big-endian seconds and unsigned 16-bit fractional microticks, 1000 per second. Fraction >=1000 is invalid. Return validity and, only for valid input, exact total microticks, signed decimal timestamp with three fractional digits, and whole-second coordinate after a one-microtick increment. Negative display uses magnitude decomposition.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    epoch = r['epoch'] + int(r['pending'])
    previous_epoch = epoch - (1 if r['before_isr'] and not r['pending'] and r['counter'] >= 128 else 0)
    expanded = previous_epoch * 256 + r['counter']
    delta = expanded - r['previous']
    forward = delta >= 0
    within = 0 <= delta <= r['max_interval']
    wraps = expanded // 256 - r['previous'] // 256
    phase = expanded % r['period']
    cycles = expanded // r['period']
    next_edge = (cycles + 1) * r['period']
    return [expanded,delta,forward,within,wraps,phase,next_edge]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 10}), [514, 264, True, False, 2, 4, 520])
check('fixture 2', solve({'epoch': 1, 'pending': True, 'counter': 250, 'before_isr': False, 'previous': 490, 'max_interval': 16, 'period': 30}), [506, 16, True, True, 0, 26, 510])
check('fixture 3', solve({'epoch': 2, 'pending': False, 'counter': 250, 'before_isr': True, 'previous': 500, 'max_interval': 6, 'period': 10}), [506, 6, True, True, 0, 6, 510])
check('fixture 4', solve({'epoch': 1, 'pending': False, 'counter': 0, 'before_isr': False, 'previous': 256, 'max_interval': 0, 'period': 7}), [256, 0, True, True, 0, 4, 259])
check('fixture 5', solve({'epoch': 3, 'pending': False, 'counter': 20, 'before_isr': False, 'previous': 10, 'max_interval': 800, 'period': 100}), [788, 778, True, True, 3, 88, 800])
check('fixture 6', solve({'epoch': 1, 'pending': False, 'counter': 0, 'before_isr': False, 'previous': 260, 'max_interval': 10, 'period': 13}), [256, -4, False, False, 0, 9, 260])
check('fixture 7', solve({'epoch': 0, 'pending': False, 'counter': 20, 'before_isr': False, 'previous': 10, 'max_interval': 9, 'period': 7}), [20, 10, True, False, 0, 6, 21])
check('fixture 8', solve({'epoch': 2, 'pending': False, 'counter': 0, 'before_isr': False, 'previous': 0, 'max_interval': 512, 'period': 16}), [512, 512, True, True, 2, 0, 528])
check('fixture 9', solve({'epoch': 0, 'pending': False, 'counter': 127, 'before_isr': False, 'previous': 0, 'max_interval': 127, 'period': 20}), [127, 127, True, True, 0, 7, 140])
check('fixture 10', solve({'epoch': 0, 'pending': True, 'counter': 128, 'before_isr': False, 'previous': 0, 'max_interval': 128, 'period': 10}), [128, 128, True, True, 0, 8, 130])
check('fixture 11', solve({'epoch': 2, 'pending': False, 'counter': 2, 'before_isr': True, 'previous': 512, 'max_interval': 20, 'period': 10}), [514, 2, True, True, 0, 4, 520])
variant = [({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 11}, [514, 264, True, False, 2, 8, 517]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 12}, [514, 264, True, False, 2, 10, 516]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 13}, [514, 264, True, False, 2, 7, 520]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 14}, [514, 264, True, False, 2, 10, 518]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 15}, [514, 264, True, False, 2, 4, 525])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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
from fractions import Fraction
N = 1
observations = []
def solve(r):
    epoch = r['epoch']
    previous_epoch = epoch - (1 if r['before_isr'] and not r['pending'] and r['counter'] >= 128 else 0)
    expanded = previous_epoch * 256 + r['counter']
    delta = expanded - r['previous']
    forward = delta >= 0
    within = 0 <= delta <= r['max_interval']
    wraps = expanded // 256 - r['previous'] // 256
    phase = expanded % r['period']
    cycles = expanded // r['period']
    next_edge = (cycles + 1) * r['period']
    return [expanded,delta,forward,within,wraps,phase,next_edge]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 10}), [514, 264, True, False, 2, 4, 520])
check('fixture 2', solve({'epoch': 1, 'pending': True, 'counter': 250, 'before_isr': False, 'previous': 490, 'max_interval': 16, 'period': 30}), [506, 16, True, True, 0, 26, 510])
check('fixture 3', solve({'epoch': 2, 'pending': False, 'counter': 250, 'before_isr': True, 'previous': 500, 'max_interval': 6, 'period': 10}), [506, 6, True, True, 0, 6, 510])
check('fixture 4', solve({'epoch': 1, 'pending': False, 'counter': 0, 'before_isr': False, 'previous': 256, 'max_interval': 0, 'period': 7}), [256, 0, True, True, 0, 4, 259])
check('fixture 5', solve({'epoch': 3, 'pending': False, 'counter': 20, 'before_isr': False, 'previous': 10, 'max_interval': 800, 'period': 100}), [788, 778, True, True, 3, 88, 800])
check('fixture 6', solve({'epoch': 1, 'pending': False, 'counter': 0, 'before_isr': False, 'previous': 260, 'max_interval': 10, 'period': 13}), [256, -4, False, False, 0, 9, 260])
check('fixture 7', solve({'epoch': 0, 'pending': False, 'counter': 20, 'before_isr': False, 'previous': 10, 'max_interval': 9, 'period': 7}), [20, 10, True, False, 0, 6, 21])
check('fixture 8', solve({'epoch': 2, 'pending': False, 'counter': 0, 'before_isr': False, 'previous': 0, 'max_interval': 512, 'period': 16}), [512, 512, True, True, 2, 0, 528])
check('fixture 9', solve({'epoch': 0, 'pending': False, 'counter': 127, 'before_isr': False, 'previous': 0, 'max_interval': 127, 'period': 20}), [127, 127, True, True, 0, 7, 140])
check('fixture 10', solve({'epoch': 0, 'pending': True, 'counter': 128, 'before_isr': False, 'previous': 0, 'max_interval': 128, 'period': 10}), [128, 128, True, True, 0, 8, 130])
check('fixture 11', solve({'epoch': 2, 'pending': False, 'counter': 2, 'before_isr': True, 'previous': 512, 'max_interval': 20, 'period': 10}), [514, 2, True, True, 0, 4, 520])
variant = [({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 11}, [514, 264, True, False, 2, 8, 517]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 12}, [514, 264, True, False, 2, 10, 516]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 13}, [514, 264, True, False, 2, 7, 520]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 14}, [514, 264, True, False, 2, 10, 518]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 15}, [514, 264, True, False, 2, 4, 525])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The decoded time state disagrees with the explicit regression oracle for epoch.

Expand a 256-tick hardware capture with an ISR epoch. Pending overflow applies only to low-half captures; a pre-ISR high-half capture backs out one serviced epoch. Return expanded coordinate, signed delta from previous capture, nonnegative-order flag, bounded-interval flag, epoch crossings, phase on a positive external grid, and strictly next grid edge.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    epoch = r['epoch'] + (1 if r['pending'] and r['counter'] < 128 else 0)
    previous_epoch = epoch
    expanded = previous_epoch * 256 + r['counter']
    delta = expanded - r['previous']
    forward = delta >= 0
    within = 0 <= delta <= r['max_interval']
    wraps = expanded // 256 - r['previous'] // 256
    phase = expanded % r['period']
    cycles = expanded // r['period']
    next_edge = (cycles + 1) * r['period']
    return [expanded,delta,forward,within,wraps,phase,next_edge]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 10}), [514, 264, True, False, 2, 4, 520])
check('fixture 2', solve({'epoch': 1, 'pending': True, 'counter': 250, 'before_isr': False, 'previous': 490, 'max_interval': 16, 'period': 30}), [506, 16, True, True, 0, 26, 510])
check('fixture 3', solve({'epoch': 2, 'pending': False, 'counter': 250, 'before_isr': True, 'previous': 500, 'max_interval': 6, 'period': 10}), [506, 6, True, True, 0, 6, 510])
check('fixture 4', solve({'epoch': 1, 'pending': False, 'counter': 0, 'before_isr': False, 'previous': 256, 'max_interval': 0, 'period': 7}), [256, 0, True, True, 0, 4, 259])
check('fixture 5', solve({'epoch': 3, 'pending': False, 'counter': 20, 'before_isr': False, 'previous': 10, 'max_interval': 800, 'period': 100}), [788, 778, True, True, 3, 88, 800])
check('fixture 6', solve({'epoch': 1, 'pending': False, 'counter': 0, 'before_isr': False, 'previous': 260, 'max_interval': 10, 'period': 13}), [256, -4, False, False, 0, 9, 260])
check('fixture 7', solve({'epoch': 0, 'pending': False, 'counter': 20, 'before_isr': False, 'previous': 10, 'max_interval': 9, 'period': 7}), [20, 10, True, False, 0, 6, 21])
check('fixture 8', solve({'epoch': 2, 'pending': False, 'counter': 0, 'before_isr': False, 'previous': 0, 'max_interval': 512, 'period': 16}), [512, 512, True, True, 2, 0, 528])
check('fixture 9', solve({'epoch': 0, 'pending': False, 'counter': 127, 'before_isr': False, 'previous': 0, 'max_interval': 127, 'period': 20}), [127, 127, True, True, 0, 7, 140])
check('fixture 10', solve({'epoch': 0, 'pending': True, 'counter': 128, 'before_isr': False, 'previous': 0, 'max_interval': 128, 'period': 10}), [128, 128, True, True, 0, 8, 130])
check('fixture 11', solve({'epoch': 2, 'pending': False, 'counter': 2, 'before_isr': True, 'previous': 512, 'max_interval': 20, 'period': 10}), [514, 2, True, True, 0, 4, 520])
variant = [({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 11}, [514, 264, True, False, 2, 8, 517]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 12}, [514, 264, True, False, 2, 10, 516]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 13}, [514, 264, True, False, 2, 7, 520]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 14}, [514, 264, True, False, 2, 10, 518]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 15}, [514, 264, True, False, 2, 4, 525])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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
from fractions import Fraction
N = 1
observations = []
def solve(r):
    epoch = r['epoch'] + (1 if r['pending'] and r['counter'] < 128 else 0)
    previous_epoch = epoch - int(r['before_isr'])
    expanded = previous_epoch * 256 + r['counter']
    delta = expanded - r['previous']
    forward = delta >= 0
    within = 0 <= delta <= r['max_interval']
    wraps = expanded // 256 - r['previous'] // 256
    phase = expanded % r['period']
    cycles = expanded // r['period']
    next_edge = (cycles + 1) * r['period']
    return [expanded,delta,forward,within,wraps,phase,next_edge]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 10}), [514, 264, True, False, 2, 4, 520])
check('fixture 2', solve({'epoch': 1, 'pending': True, 'counter': 250, 'before_isr': False, 'previous': 490, 'max_interval': 16, 'period': 30}), [506, 16, True, True, 0, 26, 510])
check('fixture 3', solve({'epoch': 2, 'pending': False, 'counter': 250, 'before_isr': True, 'previous': 500, 'max_interval': 6, 'period': 10}), [506, 6, True, True, 0, 6, 510])
check('fixture 4', solve({'epoch': 1, 'pending': False, 'counter': 0, 'before_isr': False, 'previous': 256, 'max_interval': 0, 'period': 7}), [256, 0, True, True, 0, 4, 259])
check('fixture 5', solve({'epoch': 3, 'pending': False, 'counter': 20, 'before_isr': False, 'previous': 10, 'max_interval': 800, 'period': 100}), [788, 778, True, True, 3, 88, 800])
check('fixture 6', solve({'epoch': 1, 'pending': False, 'counter': 0, 'before_isr': False, 'previous': 260, 'max_interval': 10, 'period': 13}), [256, -4, False, False, 0, 9, 260])
check('fixture 7', solve({'epoch': 0, 'pending': False, 'counter': 20, 'before_isr': False, 'previous': 10, 'max_interval': 9, 'period': 7}), [20, 10, True, False, 0, 6, 21])
check('fixture 8', solve({'epoch': 2, 'pending': False, 'counter': 0, 'before_isr': False, 'previous': 0, 'max_interval': 512, 'period': 16}), [512, 512, True, True, 2, 0, 528])
check('fixture 9', solve({'epoch': 0, 'pending': False, 'counter': 127, 'before_isr': False, 'previous': 0, 'max_interval': 127, 'period': 20}), [127, 127, True, True, 0, 7, 140])
check('fixture 10', solve({'epoch': 0, 'pending': True, 'counter': 128, 'before_isr': False, 'previous': 0, 'max_interval': 128, 'period': 10}), [128, 128, True, True, 0, 8, 130])
check('fixture 11', solve({'epoch': 2, 'pending': False, 'counter': 2, 'before_isr': True, 'previous': 512, 'max_interval': 20, 'period': 10}), [514, 2, True, True, 0, 4, 520])
variant = [({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 11}, [514, 264, True, False, 2, 8, 517]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 12}, [514, 264, True, False, 2, 10, 516]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 13}, [514, 264, True, False, 2, 7, 520]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 14}, [514, 264, True, False, 2, 10, 518]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 15}, [514, 264, True, False, 2, 4, 525])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The decoded time state disagrees with the explicit regression oracle for previous_epoch.

Expand a 256-tick hardware capture with an ISR epoch. Pending overflow applies only to low-half captures; a pre-ISR high-half capture backs out one serviced epoch. Return expanded coordinate, signed delta from previous capture, nonnegative-order flag, bounded-interval flag, epoch crossings, phase on a positive external grid, and strictly next grid edge.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    epoch = r['epoch'] + (1 if r['pending'] and r['counter'] < 128 else 0)
    previous_epoch = epoch - (1 if r['before_isr'] and not r['pending'] and r['counter'] >= 128 else 0)
    expanded = previous_epoch * 255 + r['counter']
    delta = expanded - r['previous']
    forward = delta >= 0
    within = 0 <= delta <= r['max_interval']
    wraps = expanded // 256 - r['previous'] // 256
    phase = expanded % r['period']
    cycles = expanded // r['period']
    next_edge = (cycles + 1) * r['period']
    return [expanded,delta,forward,within,wraps,phase,next_edge]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 10}), [514, 264, True, False, 2, 4, 520])
check('fixture 2', solve({'epoch': 1, 'pending': True, 'counter': 250, 'before_isr': False, 'previous': 490, 'max_interval': 16, 'period': 30}), [506, 16, True, True, 0, 26, 510])
check('fixture 3', solve({'epoch': 2, 'pending': False, 'counter': 250, 'before_isr': True, 'previous': 500, 'max_interval': 6, 'period': 10}), [506, 6, True, True, 0, 6, 510])
check('fixture 4', solve({'epoch': 1, 'pending': False, 'counter': 0, 'before_isr': False, 'previous': 256, 'max_interval': 0, 'period': 7}), [256, 0, True, True, 0, 4, 259])
check('fixture 5', solve({'epoch': 3, 'pending': False, 'counter': 20, 'before_isr': False, 'previous': 10, 'max_interval': 800, 'period': 100}), [788, 778, True, True, 3, 88, 800])
check('fixture 6', solve({'epoch': 1, 'pending': False, 'counter': 0, 'before_isr': False, 'previous': 260, 'max_interval': 10, 'period': 13}), [256, -4, False, False, 0, 9, 260])
check('fixture 7', solve({'epoch': 0, 'pending': False, 'counter': 20, 'before_isr': False, 'previous': 10, 'max_interval': 9, 'period': 7}), [20, 10, True, False, 0, 6, 21])
check('fixture 8', solve({'epoch': 2, 'pending': False, 'counter': 0, 'before_isr': False, 'previous': 0, 'max_interval': 512, 'period': 16}), [512, 512, True, True, 2, 0, 528])
check('fixture 9', solve({'epoch': 0, 'pending': False, 'counter': 127, 'before_isr': False, 'previous': 0, 'max_interval': 127, 'period': 20}), [127, 127, True, True, 0, 7, 140])
check('fixture 10', solve({'epoch': 0, 'pending': True, 'counter': 128, 'before_isr': False, 'previous': 0, 'max_interval': 128, 'period': 10}), [128, 128, True, True, 0, 8, 130])
check('fixture 11', solve({'epoch': 2, 'pending': False, 'counter': 2, 'before_isr': True, 'previous': 512, 'max_interval': 20, 'period': 10}), [514, 2, True, True, 0, 4, 520])
variant = [({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 11}, [514, 264, True, False, 2, 8, 517]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 12}, [514, 264, True, False, 2, 10, 516]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 13}, [514, 264, True, False, 2, 7, 520]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 14}, [514, 264, True, False, 2, 10, 518]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 15}, [514, 264, True, False, 2, 4, 525])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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
from fractions import Fraction
N = 1
observations = []
def solve(r):
    epoch = r['epoch'] + (1 if r['pending'] and r['counter'] < 128 else 0)
    previous_epoch = epoch - (1 if r['before_isr'] and not r['pending'] and r['counter'] >= 128 else 0)
    expanded = previous_epoch * 256 | (r['counter'] & 127)
    delta = expanded - r['previous']
    forward = delta >= 0
    within = 0 <= delta <= r['max_interval']
    wraps = expanded // 256 - r['previous'] // 256
    phase = expanded % r['period']
    cycles = expanded // r['period']
    next_edge = (cycles + 1) * r['period']
    return [expanded,delta,forward,within,wraps,phase,next_edge]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 10}), [514, 264, True, False, 2, 4, 520])
check('fixture 2', solve({'epoch': 1, 'pending': True, 'counter': 250, 'before_isr': False, 'previous': 490, 'max_interval': 16, 'period': 30}), [506, 16, True, True, 0, 26, 510])
check('fixture 3', solve({'epoch': 2, 'pending': False, 'counter': 250, 'before_isr': True, 'previous': 500, 'max_interval': 6, 'period': 10}), [506, 6, True, True, 0, 6, 510])
check('fixture 4', solve({'epoch': 1, 'pending': False, 'counter': 0, 'before_isr': False, 'previous': 256, 'max_interval': 0, 'period': 7}), [256, 0, True, True, 0, 4, 259])
check('fixture 5', solve({'epoch': 3, 'pending': False, 'counter': 20, 'before_isr': False, 'previous': 10, 'max_interval': 800, 'period': 100}), [788, 778, True, True, 3, 88, 800])
check('fixture 6', solve({'epoch': 1, 'pending': False, 'counter': 0, 'before_isr': False, 'previous': 260, 'max_interval': 10, 'period': 13}), [256, -4, False, False, 0, 9, 260])
check('fixture 7', solve({'epoch': 0, 'pending': False, 'counter': 20, 'before_isr': False, 'previous': 10, 'max_interval': 9, 'period': 7}), [20, 10, True, False, 0, 6, 21])
check('fixture 8', solve({'epoch': 2, 'pending': False, 'counter': 0, 'before_isr': False, 'previous': 0, 'max_interval': 512, 'period': 16}), [512, 512, True, True, 2, 0, 528])
check('fixture 9', solve({'epoch': 0, 'pending': False, 'counter': 127, 'before_isr': False, 'previous': 0, 'max_interval': 127, 'period': 20}), [127, 127, True, True, 0, 7, 140])
check('fixture 10', solve({'epoch': 0, 'pending': True, 'counter': 128, 'before_isr': False, 'previous': 0, 'max_interval': 128, 'period': 10}), [128, 128, True, True, 0, 8, 130])
check('fixture 11', solve({'epoch': 2, 'pending': False, 'counter': 2, 'before_isr': True, 'previous': 512, 'max_interval': 20, 'period': 10}), [514, 2, True, True, 0, 4, 520])
variant = [({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 11}, [514, 264, True, False, 2, 8, 517]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 12}, [514, 264, True, False, 2, 10, 516]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 13}, [514, 264, True, False, 2, 7, 520]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 14}, [514, 264, True, False, 2, 10, 518]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 15}, [514, 264, True, False, 2, 4, 525])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The decoded time state disagrees with the explicit regression oracle for expanded.

Expand a 256-tick hardware capture with an ISR epoch. Pending overflow applies only to low-half captures; a pre-ISR high-half capture backs out one serviced epoch. Return expanded coordinate, signed delta from previous capture, nonnegative-order flag, bounded-interval flag, epoch crossings, phase on a positive external grid, and strictly next grid edge.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    epoch = r['epoch'] + (1 if r['pending'] and r['counter'] < 128 else 0)
    previous_epoch = epoch - (1 if r['before_isr'] and not r['pending'] and r['counter'] >= 128 else 0)
    expanded = previous_epoch * 256 + r['counter']
    delta = expanded - r['previous'] % 256
    forward = delta >= 0
    within = 0 <= delta <= r['max_interval']
    wraps = expanded // 256 - r['previous'] // 256
    phase = expanded % r['period']
    cycles = expanded // r['period']
    next_edge = (cycles + 1) * r['period']
    return [expanded,delta,forward,within,wraps,phase,next_edge]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 10}), [514, 264, True, False, 2, 4, 520])
check('fixture 2', solve({'epoch': 1, 'pending': True, 'counter': 250, 'before_isr': False, 'previous': 490, 'max_interval': 16, 'period': 30}), [506, 16, True, True, 0, 26, 510])
check('fixture 3', solve({'epoch': 2, 'pending': False, 'counter': 250, 'before_isr': True, 'previous': 500, 'max_interval': 6, 'period': 10}), [506, 6, True, True, 0, 6, 510])
check('fixture 4', solve({'epoch': 1, 'pending': False, 'counter': 0, 'before_isr': False, 'previous': 256, 'max_interval': 0, 'period': 7}), [256, 0, True, True, 0, 4, 259])
check('fixture 5', solve({'epoch': 3, 'pending': False, 'counter': 20, 'before_isr': False, 'previous': 10, 'max_interval': 800, 'period': 100}), [788, 778, True, True, 3, 88, 800])
check('fixture 6', solve({'epoch': 1, 'pending': False, 'counter': 0, 'before_isr': False, 'previous': 260, 'max_interval': 10, 'period': 13}), [256, -4, False, False, 0, 9, 260])
check('fixture 7', solve({'epoch': 0, 'pending': False, 'counter': 20, 'before_isr': False, 'previous': 10, 'max_interval': 9, 'period': 7}), [20, 10, True, False, 0, 6, 21])
check('fixture 8', solve({'epoch': 2, 'pending': False, 'counter': 0, 'before_isr': False, 'previous': 0, 'max_interval': 512, 'period': 16}), [512, 512, True, True, 2, 0, 528])
check('fixture 9', solve({'epoch': 0, 'pending': False, 'counter': 127, 'before_isr': False, 'previous': 0, 'max_interval': 127, 'period': 20}), [127, 127, True, True, 0, 7, 140])
check('fixture 10', solve({'epoch': 0, 'pending': True, 'counter': 128, 'before_isr': False, 'previous': 0, 'max_interval': 128, 'period': 10}), [128, 128, True, True, 0, 8, 130])
check('fixture 11', solve({'epoch': 2, 'pending': False, 'counter': 2, 'before_isr': True, 'previous': 512, 'max_interval': 20, 'period': 10}), [514, 2, True, True, 0, 4, 520])
variant = [({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 11}, [514, 264, True, False, 2, 8, 517]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 12}, [514, 264, True, False, 2, 10, 516]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 13}, [514, 264, True, False, 2, 7, 520]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 14}, [514, 264, True, False, 2, 10, 518]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 15}, [514, 264, True, False, 2, 4, 525])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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
from fractions import Fraction
N = 1
observations = []
def solve(r):
    epoch = r['epoch'] + (1 if r['pending'] and r['counter'] < 128 else 0)
    previous_epoch = epoch - (1 if r['before_isr'] and not r['pending'] and r['counter'] >= 128 else 0)
    expanded = previous_epoch * 256 + r['counter']
    delta = (expanded - r['previous']) % 256
    forward = delta >= 0
    within = 0 <= delta <= r['max_interval']
    wraps = expanded // 256 - r['previous'] // 256
    phase = expanded % r['period']
    cycles = expanded // r['period']
    next_edge = (cycles + 1) * r['period']
    return [expanded,delta,forward,within,wraps,phase,next_edge]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 10}), [514, 264, True, False, 2, 4, 520])
check('fixture 2', solve({'epoch': 1, 'pending': True, 'counter': 250, 'before_isr': False, 'previous': 490, 'max_interval': 16, 'period': 30}), [506, 16, True, True, 0, 26, 510])
check('fixture 3', solve({'epoch': 2, 'pending': False, 'counter': 250, 'before_isr': True, 'previous': 500, 'max_interval': 6, 'period': 10}), [506, 6, True, True, 0, 6, 510])
check('fixture 4', solve({'epoch': 1, 'pending': False, 'counter': 0, 'before_isr': False, 'previous': 256, 'max_interval': 0, 'period': 7}), [256, 0, True, True, 0, 4, 259])
check('fixture 5', solve({'epoch': 3, 'pending': False, 'counter': 20, 'before_isr': False, 'previous': 10, 'max_interval': 800, 'period': 100}), [788, 778, True, True, 3, 88, 800])
check('fixture 6', solve({'epoch': 1, 'pending': False, 'counter': 0, 'before_isr': False, 'previous': 260, 'max_interval': 10, 'period': 13}), [256, -4, False, False, 0, 9, 260])
check('fixture 7', solve({'epoch': 0, 'pending': False, 'counter': 20, 'before_isr': False, 'previous': 10, 'max_interval': 9, 'period': 7}), [20, 10, True, False, 0, 6, 21])
check('fixture 8', solve({'epoch': 2, 'pending': False, 'counter': 0, 'before_isr': False, 'previous': 0, 'max_interval': 512, 'period': 16}), [512, 512, True, True, 2, 0, 528])
check('fixture 9', solve({'epoch': 0, 'pending': False, 'counter': 127, 'before_isr': False, 'previous': 0, 'max_interval': 127, 'period': 20}), [127, 127, True, True, 0, 7, 140])
check('fixture 10', solve({'epoch': 0, 'pending': True, 'counter': 128, 'before_isr': False, 'previous': 0, 'max_interval': 128, 'period': 10}), [128, 128, True, True, 0, 8, 130])
check('fixture 11', solve({'epoch': 2, 'pending': False, 'counter': 2, 'before_isr': True, 'previous': 512, 'max_interval': 20, 'period': 10}), [514, 2, True, True, 0, 4, 520])
variant = [({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 11}, [514, 264, True, False, 2, 8, 517]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 12}, [514, 264, True, False, 2, 10, 516]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 13}, [514, 264, True, False, 2, 7, 520]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 14}, [514, 264, True, False, 2, 10, 518]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 15}, [514, 264, True, False, 2, 4, 525])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The decoded time state disagrees with the explicit regression oracle for delta.

Expand a 256-tick hardware capture with an ISR epoch. Pending overflow applies only to low-half captures; a pre-ISR high-half capture backs out one serviced epoch. Return expanded coordinate, signed delta from previous capture, nonnegative-order flag, bounded-interval flag, epoch crossings, phase on a positive external grid, and strictly next grid edge.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    epoch = r['epoch'] + (1 if r['pending'] and r['counter'] < 128 else 0)
    previous_epoch = epoch - (1 if r['before_isr'] and not r['pending'] and r['counter'] >= 128 else 0)
    expanded = previous_epoch * 256 + r['counter']
    delta = expanded - r['previous']
    forward = delta > 0
    within = 0 <= delta <= r['max_interval']
    wraps = expanded // 256 - r['previous'] // 256
    phase = expanded % r['period']
    cycles = expanded // r['period']
    next_edge = (cycles + 1) * r['period']
    return [expanded,delta,forward,within,wraps,phase,next_edge]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 10}), [514, 264, True, False, 2, 4, 520])
check('fixture 2', solve({'epoch': 1, 'pending': True, 'counter': 250, 'before_isr': False, 'previous': 490, 'max_interval': 16, 'period': 30}), [506, 16, True, True, 0, 26, 510])
check('fixture 3', solve({'epoch': 2, 'pending': False, 'counter': 250, 'before_isr': True, 'previous': 500, 'max_interval': 6, 'period': 10}), [506, 6, True, True, 0, 6, 510])
check('fixture 4', solve({'epoch': 1, 'pending': False, 'counter': 0, 'before_isr': False, 'previous': 256, 'max_interval': 0, 'period': 7}), [256, 0, True, True, 0, 4, 259])
check('fixture 5', solve({'epoch': 3, 'pending': False, 'counter': 20, 'before_isr': False, 'previous': 10, 'max_interval': 800, 'period': 100}), [788, 778, True, True, 3, 88, 800])
check('fixture 6', solve({'epoch': 1, 'pending': False, 'counter': 0, 'before_isr': False, 'previous': 260, 'max_interval': 10, 'period': 13}), [256, -4, False, False, 0, 9, 260])
check('fixture 7', solve({'epoch': 0, 'pending': False, 'counter': 20, 'before_isr': False, 'previous': 10, 'max_interval': 9, 'period': 7}), [20, 10, True, False, 0, 6, 21])
check('fixture 8', solve({'epoch': 2, 'pending': False, 'counter': 0, 'before_isr': False, 'previous': 0, 'max_interval': 512, 'period': 16}), [512, 512, True, True, 2, 0, 528])
check('fixture 9', solve({'epoch': 0, 'pending': False, 'counter': 127, 'before_isr': False, 'previous': 0, 'max_interval': 127, 'period': 20}), [127, 127, True, True, 0, 7, 140])
check('fixture 10', solve({'epoch': 0, 'pending': True, 'counter': 128, 'before_isr': False, 'previous': 0, 'max_interval': 128, 'period': 10}), [128, 128, True, True, 0, 8, 130])
check('fixture 11', solve({'epoch': 2, 'pending': False, 'counter': 2, 'before_isr': True, 'previous': 512, 'max_interval': 20, 'period': 10}), [514, 2, True, True, 0, 4, 520])
variant = [({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 11}, [514, 264, True, False, 2, 8, 517]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 12}, [514, 264, True, False, 2, 10, 516]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 13}, [514, 264, True, False, 2, 7, 520]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 14}, [514, 264, True, False, 2, 10, 518]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 15}, [514, 264, True, False, 2, 4, 525])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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
from fractions import Fraction
N = 1
observations = []
def solve(r):
    epoch = r['epoch'] + (1 if r['pending'] and r['counter'] < 128 else 0)
    previous_epoch = epoch - (1 if r['before_isr'] and not r['pending'] and r['counter'] >= 128 else 0)
    expanded = previous_epoch * 256 + r['counter']
    delta = expanded - r['previous']
    forward = True
    within = 0 <= delta <= r['max_interval']
    wraps = expanded // 256 - r['previous'] // 256
    phase = expanded % r['period']
    cycles = expanded // r['period']
    next_edge = (cycles + 1) * r['period']
    return [expanded,delta,forward,within,wraps,phase,next_edge]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 10}), [514, 264, True, False, 2, 4, 520])
check('fixture 2', solve({'epoch': 1, 'pending': True, 'counter': 250, 'before_isr': False, 'previous': 490, 'max_interval': 16, 'period': 30}), [506, 16, True, True, 0, 26, 510])
check('fixture 3', solve({'epoch': 2, 'pending': False, 'counter': 250, 'before_isr': True, 'previous': 500, 'max_interval': 6, 'period': 10}), [506, 6, True, True, 0, 6, 510])
check('fixture 4', solve({'epoch': 1, 'pending': False, 'counter': 0, 'before_isr': False, 'previous': 256, 'max_interval': 0, 'period': 7}), [256, 0, True, True, 0, 4, 259])
check('fixture 5', solve({'epoch': 3, 'pending': False, 'counter': 20, 'before_isr': False, 'previous': 10, 'max_interval': 800, 'period': 100}), [788, 778, True, True, 3, 88, 800])
check('fixture 6', solve({'epoch': 1, 'pending': False, 'counter': 0, 'before_isr': False, 'previous': 260, 'max_interval': 10, 'period': 13}), [256, -4, False, False, 0, 9, 260])
check('fixture 7', solve({'epoch': 0, 'pending': False, 'counter': 20, 'before_isr': False, 'previous': 10, 'max_interval': 9, 'period': 7}), [20, 10, True, False, 0, 6, 21])
check('fixture 8', solve({'epoch': 2, 'pending': False, 'counter': 0, 'before_isr': False, 'previous': 0, 'max_interval': 512, 'period': 16}), [512, 512, True, True, 2, 0, 528])
check('fixture 9', solve({'epoch': 0, 'pending': False, 'counter': 127, 'before_isr': False, 'previous': 0, 'max_interval': 127, 'period': 20}), [127, 127, True, True, 0, 7, 140])
check('fixture 10', solve({'epoch': 0, 'pending': True, 'counter': 128, 'before_isr': False, 'previous': 0, 'max_interval': 128, 'period': 10}), [128, 128, True, True, 0, 8, 130])
check('fixture 11', solve({'epoch': 2, 'pending': False, 'counter': 2, 'before_isr': True, 'previous': 512, 'max_interval': 20, 'period': 10}), [514, 2, True, True, 0, 4, 520])
variant = [({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 11}, [514, 264, True, False, 2, 8, 517]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 12}, [514, 264, True, False, 2, 10, 516]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 13}, [514, 264, True, False, 2, 7, 520]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 14}, [514, 264, True, False, 2, 10, 518]), ({'epoch': 1, 'pending': True, 'counter': 2, 'before_isr': False, 'previous': 250, 'max_interval': 8, 'period': 15}, [514, 264, True, False, 2, 4, 525])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The decoded time state disagrees with the explicit regression oracle for forward.

Expand a 256-tick hardware capture with an ISR epoch. Pending overflow applies only to low-half captures; a pre-ISR high-half capture backs out one serviced epoch. Return expanded coordinate, signed delta from previous capture, nonnegative-order flag, bounded-interval flag, epoch crossings, phase on a positive external grid, and strictly next grid edge.

split: open-access