broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    present = r['present']
    version_ok = r['version'] in (1,2)
    fraction_ok = r['version'] != 2 or 0 <= r['fraction'] < 1000000000
    offset_ok = r['offset'] is None
    valid = version_ok and fraction_ok and offset_ok and r['uncertainty'] >= 0
    nanoseconds = r['value'] * 1000000 if r['version'] == 1 else r['value'] * 1000000000 + r['fraction']
    uncertainty = r['uncertainty']
    seconds = nanoseconds // 1000000000
    remainder = nanoseconds - seconds * 1000000000
    precision = 1000000 if r['version'] == 1 else 1
    return ['missing' if not present else ('invalid' if not valid else 'ok'), [seconds,remainder,uncertainty,precision] if present and valid else None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'present': True, 'version': 1, 'value': 0, 'fraction': 0, 'offset': None, 'uncertainty': 2}), ['ok', [0, 0, 2000000, 1000000]])
check('fixture 2', solve({'present': False, 'version': 1, 'value': 20, 'fraction': 0, 'offset': None, 'uncertainty': 1}), ['missing', None])
check('fixture 3', solve({'present': True, 'version': 1, 'value': 1234, 'fraction': 0, 'offset': None, 'uncertainty': 3}), ['ok', [1, 234000000, 3000000, 1000000]])
check('fixture 4', solve({'present': True, 'version': 2, 'value': -1, 'fraction': 500000000, 'offset': None, 'uncertainty': 4}), ['ok', [-1, 500000000, 4, 1]])
check('fixture 5', solve({'present': True, 'version': 2, 'value': 3, 'fraction': 0, 'offset': None, 'uncertainty': 2}), ['ok', [3, 0, 2, 1]])
check('fixture 6', solve({'present': True, 'version': 2, 'value': 1, 'fraction': 1000000000, 'offset': None, 'uncertainty': 2}), ['invalid', None])
check('fixture 7', solve({'present': True, 'version': 2, 'value': 1, 'fraction': -1, 'offset': None, 'uncertainty': 2}), ['invalid', None])
check('fixture 8', solve({'present': True, 'version': 3, 'value': 1, 'fraction': 0, 'offset': None, 'uncertainty': 1}), ['invalid', None])
check('fixture 9', solve({'present': True, 'version': 2, 'value': 1, 'fraction': 0, 'offset': 0, 'uncertainty': 1}), ['invalid', None])
check('fixture 10', solve({'present': True, 'version': 1, 'value': 1, 'fraction': 0, 'offset': 60, 'uncertainty': 1}), ['invalid', None])
check('fixture 11', solve({'present': True, 'version': 1, 'value': -1, 'fraction': 0, 'offset': None, 'uncertainty': 2}), ['ok', [-1, 999000000, 2000000, 1000000]])
check('fixture 12', solve({'present': True, 'version': 1, 'value': 1234, 'fraction': 500, 'offset': None, 'uncertainty': 2}), ['ok', [1, 234000000, 2000000, 1000000]])
check('fixture 13', solve({'present': True, 'version': 2, 'value': 1, 'fraction': 0, 'offset': None, 'uncertainty': -1}), ['invalid', None])
check('fixture 14', solve({'present': True, 'version': 2, 'value': 1, 'fraction': 0, 'offset': None, 'uncertainty': 0}), ['ok', [1, 0, 0, 1]])
variant = [({'present': True, 'version': 1, 'value': 1, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 1000000, 2000000, 1000000]]), ({'present': True, 'version': 1, 'value': 2, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 2000000, 2000000, 1000000]]), ({'present': True, 'version': 1, 'value': 3, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 3000000, 2000000, 1000000]]), ({'present': True, 'version': 1, 'value': 4, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 4000000, 2000000, 1000000]]), ({'present': True, 'version': 1, 'value': 5, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 5000000, 2000000, 1000000]])]
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):
    present = r['present']
    version_ok = r['version'] in (1,2)
    fraction_ok = r['version'] != 2 or 0 <= r['fraction'] < 1000000000
    offset_ok = r['offset'] is None
    valid = version_ok and fraction_ok and offset_ok and r['uncertainty'] >= 0
    nanoseconds = r['value'] * 1000000 if r['version'] == 1 else r['value'] * 1000000000 + r['fraction']
    uncertainty = r['uncertainty'] * 1000000
    seconds = nanoseconds // 1000000000
    remainder = nanoseconds - seconds * 1000000000
    precision = 1000000 if r['version'] == 1 else 1
    return ['missing' if not present else ('invalid' if not valid else 'ok'), [seconds,remainder,uncertainty,precision] if present and valid else None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'present': True, 'version': 1, 'value': 0, 'fraction': 0, 'offset': None, 'uncertainty': 2}), ['ok', [0, 0, 2000000, 1000000]])
check('fixture 2', solve({'present': False, 'version': 1, 'value': 20, 'fraction': 0, 'offset': None, 'uncertainty': 1}), ['missing', None])
check('fixture 3', solve({'present': True, 'version': 1, 'value': 1234, 'fraction': 0, 'offset': None, 'uncertainty': 3}), ['ok', [1, 234000000, 3000000, 1000000]])
check('fixture 4', solve({'present': True, 'version': 2, 'value': -1, 'fraction': 500000000, 'offset': None, 'uncertainty': 4}), ['ok', [-1, 500000000, 4, 1]])
check('fixture 5', solve({'present': True, 'version': 2, 'value': 3, 'fraction': 0, 'offset': None, 'uncertainty': 2}), ['ok', [3, 0, 2, 1]])
check('fixture 6', solve({'present': True, 'version': 2, 'value': 1, 'fraction': 1000000000, 'offset': None, 'uncertainty': 2}), ['invalid', None])
check('fixture 7', solve({'present': True, 'version': 2, 'value': 1, 'fraction': -1, 'offset': None, 'uncertainty': 2}), ['invalid', None])
check('fixture 8', solve({'present': True, 'version': 3, 'value': 1, 'fraction': 0, 'offset': None, 'uncertainty': 1}), ['invalid', None])
check('fixture 9', solve({'present': True, 'version': 2, 'value': 1, 'fraction': 0, 'offset': 0, 'uncertainty': 1}), ['invalid', None])
check('fixture 10', solve({'present': True, 'version': 1, 'value': 1, 'fraction': 0, 'offset': 60, 'uncertainty': 1}), ['invalid', None])
check('fixture 11', solve({'present': True, 'version': 1, 'value': -1, 'fraction': 0, 'offset': None, 'uncertainty': 2}), ['ok', [-1, 999000000, 2000000, 1000000]])
check('fixture 12', solve({'present': True, 'version': 1, 'value': 1234, 'fraction': 500, 'offset': None, 'uncertainty': 2}), ['ok', [1, 234000000, 2000000, 1000000]])
check('fixture 13', solve({'present': True, 'version': 2, 'value': 1, 'fraction': 0, 'offset': None, 'uncertainty': -1}), ['invalid', None])
check('fixture 14', solve({'present': True, 'version': 2, 'value': 1, 'fraction': 0, 'offset': None, 'uncertainty': 0}), ['ok', [1, 0, 0, 1]])
variant = [({'present': True, 'version': 1, 'value': 1, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 1000000, 2000000, 1000000]]), ({'present': True, 'version': 1, 'value': 2, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 2000000, 2000000, 1000000]]), ({'present': True, 'version': 1, 'value': 3, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 3000000, 2000000, 1000000]]), ({'present': True, 'version': 1, 'value': 4, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 4000000, 2000000, 1000000]]), ({'present': True, 'version': 1, 'value': 5, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 5000000, 2000000, 1000000]])]
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 uncertainty.

Controlled timestamp migration from version 1 milliseconds or version 2 split seconds/nanos into exact nanoseconds. A separate presence bit distinguishes missing from epoch zero. Version 2 fraction must be 0..999999999; timezone offsets are forbidden because payload is already UTC. Preserve uncertainty in matching units and emit canonical seconds/remainder with precision and provenance. Negative uncertainty is invalid; zero means exact.

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):
    present = r['present']
    version_ok = r['version'] in (1,2)
    fraction_ok = r['version'] != 2 or 0 <= r['fraction'] < 1000000000
    offset_ok = r['offset'] is None
    valid = version_ok and fraction_ok and offset_ok and r['uncertainty'] >= 0
    nanoseconds = r['value'] * 1000000 if r['version'] == 1 else r['value'] * 1000000000 + r['fraction']
    uncertainty = r['uncertainty'] * (1000000 if r['version'] == 1 else 1)
    seconds = r['value'] if r['version'] == 2 else r['value'] // 1000 + int(r['fraction'] != 0)
    remainder = nanoseconds - seconds * 1000000000
    precision = 1000000 if r['version'] == 1 else 1
    return ['missing' if not present else ('invalid' if not valid else 'ok'), [seconds,remainder,uncertainty,precision] if present and valid else None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'present': True, 'version': 1, 'value': 0, 'fraction': 0, 'offset': None, 'uncertainty': 2}), ['ok', [0, 0, 2000000, 1000000]])
check('fixture 2', solve({'present': False, 'version': 1, 'value': 20, 'fraction': 0, 'offset': None, 'uncertainty': 1}), ['missing', None])
check('fixture 3', solve({'present': True, 'version': 1, 'value': 1234, 'fraction': 0, 'offset': None, 'uncertainty': 3}), ['ok', [1, 234000000, 3000000, 1000000]])
check('fixture 4', solve({'present': True, 'version': 2, 'value': -1, 'fraction': 500000000, 'offset': None, 'uncertainty': 4}), ['ok', [-1, 500000000, 4, 1]])
check('fixture 5', solve({'present': True, 'version': 2, 'value': 3, 'fraction': 0, 'offset': None, 'uncertainty': 2}), ['ok', [3, 0, 2, 1]])
check('fixture 6', solve({'present': True, 'version': 2, 'value': 1, 'fraction': 1000000000, 'offset': None, 'uncertainty': 2}), ['invalid', None])
check('fixture 7', solve({'present': True, 'version': 2, 'value': 1, 'fraction': -1, 'offset': None, 'uncertainty': 2}), ['invalid', None])
check('fixture 8', solve({'present': True, 'version': 3, 'value': 1, 'fraction': 0, 'offset': None, 'uncertainty': 1}), ['invalid', None])
check('fixture 9', solve({'present': True, 'version': 2, 'value': 1, 'fraction': 0, 'offset': 0, 'uncertainty': 1}), ['invalid', None])
check('fixture 10', solve({'present': True, 'version': 1, 'value': 1, 'fraction': 0, 'offset': 60, 'uncertainty': 1}), ['invalid', None])
check('fixture 11', solve({'present': True, 'version': 1, 'value': -1, 'fraction': 0, 'offset': None, 'uncertainty': 2}), ['ok', [-1, 999000000, 2000000, 1000000]])
check('fixture 12', solve({'present': True, 'version': 1, 'value': 1234, 'fraction': 500, 'offset': None, 'uncertainty': 2}), ['ok', [1, 234000000, 2000000, 1000000]])
check('fixture 13', solve({'present': True, 'version': 2, 'value': 1, 'fraction': 0, 'offset': None, 'uncertainty': -1}), ['invalid', None])
check('fixture 14', solve({'present': True, 'version': 2, 'value': 1, 'fraction': 0, 'offset': None, 'uncertainty': 0}), ['ok', [1, 0, 0, 1]])
variant = [({'present': True, 'version': 1, 'value': 1, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 1000000, 2000000, 1000000]]), ({'present': True, 'version': 1, 'value': 2, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 2000000, 2000000, 1000000]]), ({'present': True, 'version': 1, 'value': 3, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 3000000, 2000000, 1000000]]), ({'present': True, 'version': 1, 'value': 4, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 4000000, 2000000, 1000000]]), ({'present': True, 'version': 1, 'value': 5, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 5000000, 2000000, 1000000]])]
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):
    present = r['present']
    version_ok = r['version'] in (1,2)
    fraction_ok = r['version'] != 2 or 0 <= r['fraction'] < 1000000000
    offset_ok = r['offset'] is None
    valid = version_ok and fraction_ok and offset_ok and r['uncertainty'] >= 0
    nanoseconds = r['value'] * 1000000 if r['version'] == 1 else r['value'] * 1000000000 + r['fraction']
    uncertainty = r['uncertainty'] * (1000000 if r['version'] == 1 else 1)
    seconds = nanoseconds // 1000000000 + int(r['version'] == 1 and r['uncertainty'] > 0)
    remainder = nanoseconds - seconds * 1000000000
    precision = 1000000 if r['version'] == 1 else 1
    return ['missing' if not present else ('invalid' if not valid else 'ok'), [seconds,remainder,uncertainty,precision] if present and valid else None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'present': True, 'version': 1, 'value': 0, 'fraction': 0, 'offset': None, 'uncertainty': 2}), ['ok', [0, 0, 2000000, 1000000]])
check('fixture 2', solve({'present': False, 'version': 1, 'value': 20, 'fraction': 0, 'offset': None, 'uncertainty': 1}), ['missing', None])
check('fixture 3', solve({'present': True, 'version': 1, 'value': 1234, 'fraction': 0, 'offset': None, 'uncertainty': 3}), ['ok', [1, 234000000, 3000000, 1000000]])
check('fixture 4', solve({'present': True, 'version': 2, 'value': -1, 'fraction': 500000000, 'offset': None, 'uncertainty': 4}), ['ok', [-1, 500000000, 4, 1]])
check('fixture 5', solve({'present': True, 'version': 2, 'value': 3, 'fraction': 0, 'offset': None, 'uncertainty': 2}), ['ok', [3, 0, 2, 1]])
check('fixture 6', solve({'present': True, 'version': 2, 'value': 1, 'fraction': 1000000000, 'offset': None, 'uncertainty': 2}), ['invalid', None])
check('fixture 7', solve({'present': True, 'version': 2, 'value': 1, 'fraction': -1, 'offset': None, 'uncertainty': 2}), ['invalid', None])
check('fixture 8', solve({'present': True, 'version': 3, 'value': 1, 'fraction': 0, 'offset': None, 'uncertainty': 1}), ['invalid', None])
check('fixture 9', solve({'present': True, 'version': 2, 'value': 1, 'fraction': 0, 'offset': 0, 'uncertainty': 1}), ['invalid', None])
check('fixture 10', solve({'present': True, 'version': 1, 'value': 1, 'fraction': 0, 'offset': 60, 'uncertainty': 1}), ['invalid', None])
check('fixture 11', solve({'present': True, 'version': 1, 'value': -1, 'fraction': 0, 'offset': None, 'uncertainty': 2}), ['ok', [-1, 999000000, 2000000, 1000000]])
check('fixture 12', solve({'present': True, 'version': 1, 'value': 1234, 'fraction': 500, 'offset': None, 'uncertainty': 2}), ['ok', [1, 234000000, 2000000, 1000000]])
check('fixture 13', solve({'present': True, 'version': 2, 'value': 1, 'fraction': 0, 'offset': None, 'uncertainty': -1}), ['invalid', None])
check('fixture 14', solve({'present': True, 'version': 2, 'value': 1, 'fraction': 0, 'offset': None, 'uncertainty': 0}), ['ok', [1, 0, 0, 1]])
variant = [({'present': True, 'version': 1, 'value': 1, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 1000000, 2000000, 1000000]]), ({'present': True, 'version': 1, 'value': 2, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 2000000, 2000000, 1000000]]), ({'present': True, 'version': 1, 'value': 3, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 3000000, 2000000, 1000000]]), ({'present': True, 'version': 1, 'value': 4, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 4000000, 2000000, 1000000]]), ({'present': True, 'version': 1, 'value': 5, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 5000000, 2000000, 1000000]])]
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.

Controlled timestamp migration from version 1 milliseconds or version 2 split seconds/nanos into exact nanoseconds. A separate presence bit distinguishes missing from epoch zero. Version 2 fraction must be 0..999999999; timezone offsets are forbidden because payload is already UTC. Preserve uncertainty in matching units and emit canonical seconds/remainder with precision and provenance. Negative uncertainty is invalid; zero means exact.

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):
    present = r['present']
    version_ok = r['version'] in (1,2)
    fraction_ok = r['version'] != 2 or 0 <= r['fraction'] < 1000000000
    offset_ok = r['offset'] is None
    valid = version_ok and fraction_ok and offset_ok and r['uncertainty'] >= 0
    nanoseconds = r['value'] * 1000000 if r['version'] == 1 else r['value'] * 1000000000 + r['fraction']
    uncertainty = r['uncertainty'] * (1000000 if r['version'] == 1 else 1)
    seconds = nanoseconds // 1000000000
    remainder = nanoseconds % 1000000
    precision = 1000000 if r['version'] == 1 else 1
    return ['missing' if not present else ('invalid' if not valid else 'ok'), [seconds,remainder,uncertainty,precision] if present and valid else None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'present': True, 'version': 1, 'value': 0, 'fraction': 0, 'offset': None, 'uncertainty': 2}), ['ok', [0, 0, 2000000, 1000000]])
check('fixture 2', solve({'present': False, 'version': 1, 'value': 20, 'fraction': 0, 'offset': None, 'uncertainty': 1}), ['missing', None])
check('fixture 3', solve({'present': True, 'version': 1, 'value': 1234, 'fraction': 0, 'offset': None, 'uncertainty': 3}), ['ok', [1, 234000000, 3000000, 1000000]])
check('fixture 4', solve({'present': True, 'version': 2, 'value': -1, 'fraction': 500000000, 'offset': None, 'uncertainty': 4}), ['ok', [-1, 500000000, 4, 1]])
check('fixture 5', solve({'present': True, 'version': 2, 'value': 3, 'fraction': 0, 'offset': None, 'uncertainty': 2}), ['ok', [3, 0, 2, 1]])
check('fixture 6', solve({'present': True, 'version': 2, 'value': 1, 'fraction': 1000000000, 'offset': None, 'uncertainty': 2}), ['invalid', None])
check('fixture 7', solve({'present': True, 'version': 2, 'value': 1, 'fraction': -1, 'offset': None, 'uncertainty': 2}), ['invalid', None])
check('fixture 8', solve({'present': True, 'version': 3, 'value': 1, 'fraction': 0, 'offset': None, 'uncertainty': 1}), ['invalid', None])
check('fixture 9', solve({'present': True, 'version': 2, 'value': 1, 'fraction': 0, 'offset': 0, 'uncertainty': 1}), ['invalid', None])
check('fixture 10', solve({'present': True, 'version': 1, 'value': 1, 'fraction': 0, 'offset': 60, 'uncertainty': 1}), ['invalid', None])
check('fixture 11', solve({'present': True, 'version': 1, 'value': -1, 'fraction': 0, 'offset': None, 'uncertainty': 2}), ['ok', [-1, 999000000, 2000000, 1000000]])
check('fixture 12', solve({'present': True, 'version': 1, 'value': 1234, 'fraction': 500, 'offset': None, 'uncertainty': 2}), ['ok', [1, 234000000, 2000000, 1000000]])
check('fixture 13', solve({'present': True, 'version': 2, 'value': 1, 'fraction': 0, 'offset': None, 'uncertainty': -1}), ['invalid', None])
check('fixture 14', solve({'present': True, 'version': 2, 'value': 1, 'fraction': 0, 'offset': None, 'uncertainty': 0}), ['ok', [1, 0, 0, 1]])
variant = [({'present': True, 'version': 1, 'value': 1, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 1000000, 2000000, 1000000]]), ({'present': True, 'version': 1, 'value': 2, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 2000000, 2000000, 1000000]]), ({'present': True, 'version': 1, 'value': 3, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 3000000, 2000000, 1000000]]), ({'present': True, 'version': 1, 'value': 4, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 4000000, 2000000, 1000000]]), ({'present': True, 'version': 1, 'value': 5, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 5000000, 2000000, 1000000]])]
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):
    present = r['present']
    version_ok = r['version'] in (1,2)
    fraction_ok = r['version'] != 2 or 0 <= r['fraction'] < 1000000000
    offset_ok = r['offset'] is None
    valid = version_ok and fraction_ok and offset_ok and r['uncertainty'] >= 0
    nanoseconds = r['value'] * 1000000 if r['version'] == 1 else r['value'] * 1000000000 + r['fraction']
    uncertainty = r['uncertainty'] * (1000000 if r['version'] == 1 else 1)
    seconds = nanoseconds // 1000000000
    remainder = abs(nanoseconds) % 1000000000
    precision = 1000000 if r['version'] == 1 else 1
    return ['missing' if not present else ('invalid' if not valid else 'ok'), [seconds,remainder,uncertainty,precision] if present and valid else None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'present': True, 'version': 1, 'value': 0, 'fraction': 0, 'offset': None, 'uncertainty': 2}), ['ok', [0, 0, 2000000, 1000000]])
check('fixture 2', solve({'present': False, 'version': 1, 'value': 20, 'fraction': 0, 'offset': None, 'uncertainty': 1}), ['missing', None])
check('fixture 3', solve({'present': True, 'version': 1, 'value': 1234, 'fraction': 0, 'offset': None, 'uncertainty': 3}), ['ok', [1, 234000000, 3000000, 1000000]])
check('fixture 4', solve({'present': True, 'version': 2, 'value': -1, 'fraction': 500000000, 'offset': None, 'uncertainty': 4}), ['ok', [-1, 500000000, 4, 1]])
check('fixture 5', solve({'present': True, 'version': 2, 'value': 3, 'fraction': 0, 'offset': None, 'uncertainty': 2}), ['ok', [3, 0, 2, 1]])
check('fixture 6', solve({'present': True, 'version': 2, 'value': 1, 'fraction': 1000000000, 'offset': None, 'uncertainty': 2}), ['invalid', None])
check('fixture 7', solve({'present': True, 'version': 2, 'value': 1, 'fraction': -1, 'offset': None, 'uncertainty': 2}), ['invalid', None])
check('fixture 8', solve({'present': True, 'version': 3, 'value': 1, 'fraction': 0, 'offset': None, 'uncertainty': 1}), ['invalid', None])
check('fixture 9', solve({'present': True, 'version': 2, 'value': 1, 'fraction': 0, 'offset': 0, 'uncertainty': 1}), ['invalid', None])
check('fixture 10', solve({'present': True, 'version': 1, 'value': 1, 'fraction': 0, 'offset': 60, 'uncertainty': 1}), ['invalid', None])
check('fixture 11', solve({'present': True, 'version': 1, 'value': -1, 'fraction': 0, 'offset': None, 'uncertainty': 2}), ['ok', [-1, 999000000, 2000000, 1000000]])
check('fixture 12', solve({'present': True, 'version': 1, 'value': 1234, 'fraction': 500, 'offset': None, 'uncertainty': 2}), ['ok', [1, 234000000, 2000000, 1000000]])
check('fixture 13', solve({'present': True, 'version': 2, 'value': 1, 'fraction': 0, 'offset': None, 'uncertainty': -1}), ['invalid', None])
check('fixture 14', solve({'present': True, 'version': 2, 'value': 1, 'fraction': 0, 'offset': None, 'uncertainty': 0}), ['ok', [1, 0, 0, 1]])
variant = [({'present': True, 'version': 1, 'value': 1, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 1000000, 2000000, 1000000]]), ({'present': True, 'version': 1, 'value': 2, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 2000000, 2000000, 1000000]]), ({'present': True, 'version': 1, 'value': 3, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 3000000, 2000000, 1000000]]), ({'present': True, 'version': 1, 'value': 4, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 4000000, 2000000, 1000000]]), ({'present': True, 'version': 1, 'value': 5, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 5000000, 2000000, 1000000]])]
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 remainder.

Controlled timestamp migration from version 1 milliseconds or version 2 split seconds/nanos into exact nanoseconds. A separate presence bit distinguishes missing from epoch zero. Version 2 fraction must be 0..999999999; timezone offsets are forbidden because payload is already UTC. Preserve uncertainty in matching units and emit canonical seconds/remainder with precision and provenance. Negative uncertainty is invalid; zero means exact.

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):
    present = r['present']
    version_ok = r['version'] in (1,2)
    fraction_ok = r['version'] != 2 or 0 <= r['fraction'] < 1000000000
    offset_ok = r['offset'] is None
    valid = version_ok and fraction_ok and offset_ok and r['uncertainty'] >= 0
    nanoseconds = r['value'] * 1000000 if r['version'] == 1 else r['value'] * 1000000000 + r['fraction']
    uncertainty = r['uncertainty'] * (1000000 if r['version'] == 1 else 1)
    seconds = nanoseconds // 1000000000
    remainder = nanoseconds - seconds * 1000000000
    precision = 1
    return ['missing' if not present else ('invalid' if not valid else 'ok'), [seconds,remainder,uncertainty,precision] if present and valid else None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'present': True, 'version': 1, 'value': 0, 'fraction': 0, 'offset': None, 'uncertainty': 2}), ['ok', [0, 0, 2000000, 1000000]])
check('fixture 2', solve({'present': False, 'version': 1, 'value': 20, 'fraction': 0, 'offset': None, 'uncertainty': 1}), ['missing', None])
check('fixture 3', solve({'present': True, 'version': 1, 'value': 1234, 'fraction': 0, 'offset': None, 'uncertainty': 3}), ['ok', [1, 234000000, 3000000, 1000000]])
check('fixture 4', solve({'present': True, 'version': 2, 'value': -1, 'fraction': 500000000, 'offset': None, 'uncertainty': 4}), ['ok', [-1, 500000000, 4, 1]])
check('fixture 5', solve({'present': True, 'version': 2, 'value': 3, 'fraction': 0, 'offset': None, 'uncertainty': 2}), ['ok', [3, 0, 2, 1]])
check('fixture 6', solve({'present': True, 'version': 2, 'value': 1, 'fraction': 1000000000, 'offset': None, 'uncertainty': 2}), ['invalid', None])
check('fixture 7', solve({'present': True, 'version': 2, 'value': 1, 'fraction': -1, 'offset': None, 'uncertainty': 2}), ['invalid', None])
check('fixture 8', solve({'present': True, 'version': 3, 'value': 1, 'fraction': 0, 'offset': None, 'uncertainty': 1}), ['invalid', None])
check('fixture 9', solve({'present': True, 'version': 2, 'value': 1, 'fraction': 0, 'offset': 0, 'uncertainty': 1}), ['invalid', None])
check('fixture 10', solve({'present': True, 'version': 1, 'value': 1, 'fraction': 0, 'offset': 60, 'uncertainty': 1}), ['invalid', None])
check('fixture 11', solve({'present': True, 'version': 1, 'value': -1, 'fraction': 0, 'offset': None, 'uncertainty': 2}), ['ok', [-1, 999000000, 2000000, 1000000]])
check('fixture 12', solve({'present': True, 'version': 1, 'value': 1234, 'fraction': 500, 'offset': None, 'uncertainty': 2}), ['ok', [1, 234000000, 2000000, 1000000]])
check('fixture 13', solve({'present': True, 'version': 2, 'value': 1, 'fraction': 0, 'offset': None, 'uncertainty': -1}), ['invalid', None])
check('fixture 14', solve({'present': True, 'version': 2, 'value': 1, 'fraction': 0, 'offset': None, 'uncertainty': 0}), ['ok', [1, 0, 0, 1]])
variant = [({'present': True, 'version': 1, 'value': 1, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 1000000, 2000000, 1000000]]), ({'present': True, 'version': 1, 'value': 2, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 2000000, 2000000, 1000000]]), ({'present': True, 'version': 1, 'value': 3, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 3000000, 2000000, 1000000]]), ({'present': True, 'version': 1, 'value': 4, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 4000000, 2000000, 1000000]]), ({'present': True, 'version': 1, 'value': 5, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 5000000, 2000000, 1000000]])]
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):
    present = r['present']
    version_ok = r['version'] in (1,2)
    fraction_ok = r['version'] != 2 or 0 <= r['fraction'] < 1000000000
    offset_ok = r['offset'] is None
    valid = version_ok and fraction_ok and offset_ok and r['uncertainty'] >= 0
    nanoseconds = r['value'] * 1000000 if r['version'] == 1 else r['value'] * 1000000000 + r['fraction']
    uncertainty = r['uncertainty'] * (1000000 if r['version'] == 1 else 1)
    seconds = nanoseconds // 1000000000
    remainder = nanoseconds - seconds * 1000000000
    precision = 1000000
    return ['missing' if not present else ('invalid' if not valid else 'ok'), [seconds,remainder,uncertainty,precision] if present and valid else None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'present': True, 'version': 1, 'value': 0, 'fraction': 0, 'offset': None, 'uncertainty': 2}), ['ok', [0, 0, 2000000, 1000000]])
check('fixture 2', solve({'present': False, 'version': 1, 'value': 20, 'fraction': 0, 'offset': None, 'uncertainty': 1}), ['missing', None])
check('fixture 3', solve({'present': True, 'version': 1, 'value': 1234, 'fraction': 0, 'offset': None, 'uncertainty': 3}), ['ok', [1, 234000000, 3000000, 1000000]])
check('fixture 4', solve({'present': True, 'version': 2, 'value': -1, 'fraction': 500000000, 'offset': None, 'uncertainty': 4}), ['ok', [-1, 500000000, 4, 1]])
check('fixture 5', solve({'present': True, 'version': 2, 'value': 3, 'fraction': 0, 'offset': None, 'uncertainty': 2}), ['ok', [3, 0, 2, 1]])
check('fixture 6', solve({'present': True, 'version': 2, 'value': 1, 'fraction': 1000000000, 'offset': None, 'uncertainty': 2}), ['invalid', None])
check('fixture 7', solve({'present': True, 'version': 2, 'value': 1, 'fraction': -1, 'offset': None, 'uncertainty': 2}), ['invalid', None])
check('fixture 8', solve({'present': True, 'version': 3, 'value': 1, 'fraction': 0, 'offset': None, 'uncertainty': 1}), ['invalid', None])
check('fixture 9', solve({'present': True, 'version': 2, 'value': 1, 'fraction': 0, 'offset': 0, 'uncertainty': 1}), ['invalid', None])
check('fixture 10', solve({'present': True, 'version': 1, 'value': 1, 'fraction': 0, 'offset': 60, 'uncertainty': 1}), ['invalid', None])
check('fixture 11', solve({'present': True, 'version': 1, 'value': -1, 'fraction': 0, 'offset': None, 'uncertainty': 2}), ['ok', [-1, 999000000, 2000000, 1000000]])
check('fixture 12', solve({'present': True, 'version': 1, 'value': 1234, 'fraction': 500, 'offset': None, 'uncertainty': 2}), ['ok', [1, 234000000, 2000000, 1000000]])
check('fixture 13', solve({'present': True, 'version': 2, 'value': 1, 'fraction': 0, 'offset': None, 'uncertainty': -1}), ['invalid', None])
check('fixture 14', solve({'present': True, 'version': 2, 'value': 1, 'fraction': 0, 'offset': None, 'uncertainty': 0}), ['ok', [1, 0, 0, 1]])
variant = [({'present': True, 'version': 1, 'value': 1, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 1000000, 2000000, 1000000]]), ({'present': True, 'version': 1, 'value': 2, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 2000000, 2000000, 1000000]]), ({'present': True, 'version': 1, 'value': 3, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 3000000, 2000000, 1000000]]), ({'present': True, 'version': 1, 'value': 4, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 4000000, 2000000, 1000000]]), ({'present': True, 'version': 1, 'value': 5, 'fraction': 0, 'offset': None, 'uncertainty': 2}, ['ok', [0, 5000000, 2000000, 1000000]])]
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 precision.

Controlled timestamp migration from version 1 milliseconds or version 2 split seconds/nanos into exact nanoseconds. A separate presence bit distinguishes missing from epoch zero. Version 2 fraction must be 0..999999999; timezone offsets are forbidden because payload is already UTC. Preserve uncertainty in matching units and emit canonical seconds/remainder with precision and provenance. Negative uncertainty is invalid; zero means exact.

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):
    old_residue = r['residue']
    scaled = r['source'] * r['p']
    accumulated = scaled + old_residue
    emitted = accumulated // r['q']
    residue = accumulated % r['q']
    old_target = 0 if r['reset'] else r['target']
    target = old_target + emitted
    coordinate = r['origin'] + target
    exact = Fraction(coordinate) + Fraction(residue,r['q'])
    needs_tick = residue != 0
    return [coordinate,residue,str(exact),needs_tick,target,emitted]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'reset': False, 'residue': 2, 'source': 1, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}), [111, 1, '334/3', True, 11, 1])
check('fixture 2', solve({'reset': True, 'residue': 2, 'source': 1, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}), [100, 2, '302/3', True, 0, 0])
check('fixture 3', solve({'reset': False, 'residue': 0, 'source': 1, 'p': 2, 'q': 3, 'target': 0, 'origin': 0}), [0, 2, '2/3', True, 0, 0])
check('fixture 4', solve({'reset': False, 'residue': 1, 'source': 1, 'p': 2, 'q': 3, 'target': 5, 'origin': 10}), [16, 0, '16', False, 6, 1])
check('fixture 5', solve({'reset': False, 'residue': 0, 'source': 3, 'p': 2, 'q': 3, 'target': 7, 'origin': -10}), [-1, 0, '-1', False, 9, 2])
check('fixture 6', solve({'reset': False, 'residue': 1, 'source': 0, 'p': 1, 'q': 4, 'target': 2, 'origin': 100}), [102, 1, '409/4', True, 2, 0])
check('fixture 7', solve({'reset': True, 'residue': 1, 'source': 0, 'p': 1, 'q': 4, 'target': 9, 'origin': 50}), [50, 0, '50', False, 0, 0])
check('fixture 8', solve({'reset': False, 'residue': 4, 'source': 2, 'p': 3, 'q': 5, 'target': 10, 'origin': 0}), [12, 0, '12', False, 12, 2])
check('fixture 9', solve({'reset': False, 'residue': 0, 'source': 0, 'p': 2, 'q': 3, 'target': 0, 'origin': 0}), [0, 0, '0', False, 0, 0])
check('fixture 10', solve({'reset': False, 'residue': 2, 'source': 10, 'p': 1, 'q': 7, 'target': 100, 'origin': 4}), [105, 5, '740/7', True, 101, 1])
variant = [({'reset': False, 'residue': 2, 'source': 2, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [112, 0, '112', False, 12, 2]), ({'reset': False, 'residue': 2, 'source': 3, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [112, 2, '338/3', True, 12, 2]), ({'reset': False, 'residue': 2, 'source': 4, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [113, 1, '340/3', True, 13, 3]), ({'reset': False, 'residue': 2, 'source': 5, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [114, 0, '114', False, 14, 4]), ({'reset': False, 'residue': 2, 'source': 6, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [114, 2, '344/3', True, 14, 4])]
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):
    old_residue = 0
    scaled = r['source'] * r['p']
    accumulated = scaled + old_residue
    emitted = accumulated // r['q']
    residue = accumulated % r['q']
    old_target = 0 if r['reset'] else r['target']
    target = old_target + emitted
    coordinate = r['origin'] + target
    exact = Fraction(coordinate) + Fraction(residue,r['q'])
    needs_tick = residue != 0
    return [coordinate,residue,str(exact),needs_tick,target,emitted]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'reset': False, 'residue': 2, 'source': 1, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}), [111, 1, '334/3', True, 11, 1])
check('fixture 2', solve({'reset': True, 'residue': 2, 'source': 1, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}), [100, 2, '302/3', True, 0, 0])
check('fixture 3', solve({'reset': False, 'residue': 0, 'source': 1, 'p': 2, 'q': 3, 'target': 0, 'origin': 0}), [0, 2, '2/3', True, 0, 0])
check('fixture 4', solve({'reset': False, 'residue': 1, 'source': 1, 'p': 2, 'q': 3, 'target': 5, 'origin': 10}), [16, 0, '16', False, 6, 1])
check('fixture 5', solve({'reset': False, 'residue': 0, 'source': 3, 'p': 2, 'q': 3, 'target': 7, 'origin': -10}), [-1, 0, '-1', False, 9, 2])
check('fixture 6', solve({'reset': False, 'residue': 1, 'source': 0, 'p': 1, 'q': 4, 'target': 2, 'origin': 100}), [102, 1, '409/4', True, 2, 0])
check('fixture 7', solve({'reset': True, 'residue': 1, 'source': 0, 'p': 1, 'q': 4, 'target': 9, 'origin': 50}), [50, 0, '50', False, 0, 0])
check('fixture 8', solve({'reset': False, 'residue': 4, 'source': 2, 'p': 3, 'q': 5, 'target': 10, 'origin': 0}), [12, 0, '12', False, 12, 2])
check('fixture 9', solve({'reset': False, 'residue': 0, 'source': 0, 'p': 2, 'q': 3, 'target': 0, 'origin': 0}), [0, 0, '0', False, 0, 0])
check('fixture 10', solve({'reset': False, 'residue': 2, 'source': 10, 'p': 1, 'q': 7, 'target': 100, 'origin': 4}), [105, 5, '740/7', True, 101, 1])
variant = [({'reset': False, 'residue': 2, 'source': 2, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [112, 0, '112', False, 12, 2]), ({'reset': False, 'residue': 2, 'source': 3, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [112, 2, '338/3', True, 12, 2]), ({'reset': False, 'residue': 2, 'source': 4, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [113, 1, '340/3', True, 13, 3]), ({'reset': False, 'residue': 2, 'source': 5, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [114, 0, '114', False, 14, 4]), ({'reset': False, 'residue': 2, 'source': 6, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [114, 2, '344/3', True, 14, 4])]
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 old_residue.

An elapsed-time converter maps incoming nonnegative source ticks to target ticks with exact rate numerator/denominator and retained residue. Each step adds source*p to prior numerator residue; emit quotient and preserve remainder. A reset invalidates old remainder. A phase origin belongs to emitted target coordinate. Report emitted ticks, new residue, cumulative target, exact unrounded cumulative coordinate and reset marker.

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):
    old_residue = 0 if r['reset'] else r['residue']
    scaled = r['source'] * r['q']
    accumulated = scaled + old_residue
    emitted = accumulated // r['q']
    residue = accumulated % r['q']
    old_target = 0 if r['reset'] else r['target']
    target = old_target + emitted
    coordinate = r['origin'] + target
    exact = Fraction(coordinate) + Fraction(residue,r['q'])
    needs_tick = residue != 0
    return [coordinate,residue,str(exact),needs_tick,target,emitted]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'reset': False, 'residue': 2, 'source': 1, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}), [111, 1, '334/3', True, 11, 1])
check('fixture 2', solve({'reset': True, 'residue': 2, 'source': 1, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}), [100, 2, '302/3', True, 0, 0])
check('fixture 3', solve({'reset': False, 'residue': 0, 'source': 1, 'p': 2, 'q': 3, 'target': 0, 'origin': 0}), [0, 2, '2/3', True, 0, 0])
check('fixture 4', solve({'reset': False, 'residue': 1, 'source': 1, 'p': 2, 'q': 3, 'target': 5, 'origin': 10}), [16, 0, '16', False, 6, 1])
check('fixture 5', solve({'reset': False, 'residue': 0, 'source': 3, 'p': 2, 'q': 3, 'target': 7, 'origin': -10}), [-1, 0, '-1', False, 9, 2])
check('fixture 6', solve({'reset': False, 'residue': 1, 'source': 0, 'p': 1, 'q': 4, 'target': 2, 'origin': 100}), [102, 1, '409/4', True, 2, 0])
check('fixture 7', solve({'reset': True, 'residue': 1, 'source': 0, 'p': 1, 'q': 4, 'target': 9, 'origin': 50}), [50, 0, '50', False, 0, 0])
check('fixture 8', solve({'reset': False, 'residue': 4, 'source': 2, 'p': 3, 'q': 5, 'target': 10, 'origin': 0}), [12, 0, '12', False, 12, 2])
check('fixture 9', solve({'reset': False, 'residue': 0, 'source': 0, 'p': 2, 'q': 3, 'target': 0, 'origin': 0}), [0, 0, '0', False, 0, 0])
check('fixture 10', solve({'reset': False, 'residue': 2, 'source': 10, 'p': 1, 'q': 7, 'target': 100, 'origin': 4}), [105, 5, '740/7', True, 101, 1])
variant = [({'reset': False, 'residue': 2, 'source': 2, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [112, 0, '112', False, 12, 2]), ({'reset': False, 'residue': 2, 'source': 3, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [112, 2, '338/3', True, 12, 2]), ({'reset': False, 'residue': 2, 'source': 4, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [113, 1, '340/3', True, 13, 3]), ({'reset': False, 'residue': 2, 'source': 5, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [114, 0, '114', False, 14, 4]), ({'reset': False, 'residue': 2, 'source': 6, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [114, 2, '344/3', True, 14, 4])]
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):
    old_residue = 0 if r['reset'] else r['residue']
    scaled = r['source']
    accumulated = scaled + old_residue
    emitted = accumulated // r['q']
    residue = accumulated % r['q']
    old_target = 0 if r['reset'] else r['target']
    target = old_target + emitted
    coordinate = r['origin'] + target
    exact = Fraction(coordinate) + Fraction(residue,r['q'])
    needs_tick = residue != 0
    return [coordinate,residue,str(exact),needs_tick,target,emitted]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'reset': False, 'residue': 2, 'source': 1, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}), [111, 1, '334/3', True, 11, 1])
check('fixture 2', solve({'reset': True, 'residue': 2, 'source': 1, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}), [100, 2, '302/3', True, 0, 0])
check('fixture 3', solve({'reset': False, 'residue': 0, 'source': 1, 'p': 2, 'q': 3, 'target': 0, 'origin': 0}), [0, 2, '2/3', True, 0, 0])
check('fixture 4', solve({'reset': False, 'residue': 1, 'source': 1, 'p': 2, 'q': 3, 'target': 5, 'origin': 10}), [16, 0, '16', False, 6, 1])
check('fixture 5', solve({'reset': False, 'residue': 0, 'source': 3, 'p': 2, 'q': 3, 'target': 7, 'origin': -10}), [-1, 0, '-1', False, 9, 2])
check('fixture 6', solve({'reset': False, 'residue': 1, 'source': 0, 'p': 1, 'q': 4, 'target': 2, 'origin': 100}), [102, 1, '409/4', True, 2, 0])
check('fixture 7', solve({'reset': True, 'residue': 1, 'source': 0, 'p': 1, 'q': 4, 'target': 9, 'origin': 50}), [50, 0, '50', False, 0, 0])
check('fixture 8', solve({'reset': False, 'residue': 4, 'source': 2, 'p': 3, 'q': 5, 'target': 10, 'origin': 0}), [12, 0, '12', False, 12, 2])
check('fixture 9', solve({'reset': False, 'residue': 0, 'source': 0, 'p': 2, 'q': 3, 'target': 0, 'origin': 0}), [0, 0, '0', False, 0, 0])
check('fixture 10', solve({'reset': False, 'residue': 2, 'source': 10, 'p': 1, 'q': 7, 'target': 100, 'origin': 4}), [105, 5, '740/7', True, 101, 1])
variant = [({'reset': False, 'residue': 2, 'source': 2, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [112, 0, '112', False, 12, 2]), ({'reset': False, 'residue': 2, 'source': 3, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [112, 2, '338/3', True, 12, 2]), ({'reset': False, 'residue': 2, 'source': 4, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [113, 1, '340/3', True, 13, 3]), ({'reset': False, 'residue': 2, 'source': 5, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [114, 0, '114', False, 14, 4]), ({'reset': False, 'residue': 2, 'source': 6, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [114, 2, '344/3', True, 14, 4])]
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 scaled.

An elapsed-time converter maps incoming nonnegative source ticks to target ticks with exact rate numerator/denominator and retained residue. Each step adds source*p to prior numerator residue; emit quotient and preserve remainder. A reset invalidates old remainder. A phase origin belongs to emitted target coordinate. Report emitted ticks, new residue, cumulative target, exact unrounded cumulative coordinate and reset marker.

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):
    old_residue = 0 if r['reset'] else r['residue']
    scaled = r['source'] * r['p']
    accumulated = scaled
    emitted = accumulated // r['q']
    residue = accumulated % r['q']
    old_target = 0 if r['reset'] else r['target']
    target = old_target + emitted
    coordinate = r['origin'] + target
    exact = Fraction(coordinate) + Fraction(residue,r['q'])
    needs_tick = residue != 0
    return [coordinate,residue,str(exact),needs_tick,target,emitted]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'reset': False, 'residue': 2, 'source': 1, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}), [111, 1, '334/3', True, 11, 1])
check('fixture 2', solve({'reset': True, 'residue': 2, 'source': 1, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}), [100, 2, '302/3', True, 0, 0])
check('fixture 3', solve({'reset': False, 'residue': 0, 'source': 1, 'p': 2, 'q': 3, 'target': 0, 'origin': 0}), [0, 2, '2/3', True, 0, 0])
check('fixture 4', solve({'reset': False, 'residue': 1, 'source': 1, 'p': 2, 'q': 3, 'target': 5, 'origin': 10}), [16, 0, '16', False, 6, 1])
check('fixture 5', solve({'reset': False, 'residue': 0, 'source': 3, 'p': 2, 'q': 3, 'target': 7, 'origin': -10}), [-1, 0, '-1', False, 9, 2])
check('fixture 6', solve({'reset': False, 'residue': 1, 'source': 0, 'p': 1, 'q': 4, 'target': 2, 'origin': 100}), [102, 1, '409/4', True, 2, 0])
check('fixture 7', solve({'reset': True, 'residue': 1, 'source': 0, 'p': 1, 'q': 4, 'target': 9, 'origin': 50}), [50, 0, '50', False, 0, 0])
check('fixture 8', solve({'reset': False, 'residue': 4, 'source': 2, 'p': 3, 'q': 5, 'target': 10, 'origin': 0}), [12, 0, '12', False, 12, 2])
check('fixture 9', solve({'reset': False, 'residue': 0, 'source': 0, 'p': 2, 'q': 3, 'target': 0, 'origin': 0}), [0, 0, '0', False, 0, 0])
check('fixture 10', solve({'reset': False, 'residue': 2, 'source': 10, 'p': 1, 'q': 7, 'target': 100, 'origin': 4}), [105, 5, '740/7', True, 101, 1])
variant = [({'reset': False, 'residue': 2, 'source': 2, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [112, 0, '112', False, 12, 2]), ({'reset': False, 'residue': 2, 'source': 3, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [112, 2, '338/3', True, 12, 2]), ({'reset': False, 'residue': 2, 'source': 4, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [113, 1, '340/3', True, 13, 3]), ({'reset': False, 'residue': 2, 'source': 5, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [114, 0, '114', False, 14, 4]), ({'reset': False, 'residue': 2, 'source': 6, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [114, 2, '344/3', True, 14, 4])]
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):
    old_residue = 0 if r['reset'] else r['residue']
    scaled = r['source'] * r['p']
    accumulated = scaled + old_residue * r['p']
    emitted = accumulated // r['q']
    residue = accumulated % r['q']
    old_target = 0 if r['reset'] else r['target']
    target = old_target + emitted
    coordinate = r['origin'] + target
    exact = Fraction(coordinate) + Fraction(residue,r['q'])
    needs_tick = residue != 0
    return [coordinate,residue,str(exact),needs_tick,target,emitted]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'reset': False, 'residue': 2, 'source': 1, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}), [111, 1, '334/3', True, 11, 1])
check('fixture 2', solve({'reset': True, 'residue': 2, 'source': 1, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}), [100, 2, '302/3', True, 0, 0])
check('fixture 3', solve({'reset': False, 'residue': 0, 'source': 1, 'p': 2, 'q': 3, 'target': 0, 'origin': 0}), [0, 2, '2/3', True, 0, 0])
check('fixture 4', solve({'reset': False, 'residue': 1, 'source': 1, 'p': 2, 'q': 3, 'target': 5, 'origin': 10}), [16, 0, '16', False, 6, 1])
check('fixture 5', solve({'reset': False, 'residue': 0, 'source': 3, 'p': 2, 'q': 3, 'target': 7, 'origin': -10}), [-1, 0, '-1', False, 9, 2])
check('fixture 6', solve({'reset': False, 'residue': 1, 'source': 0, 'p': 1, 'q': 4, 'target': 2, 'origin': 100}), [102, 1, '409/4', True, 2, 0])
check('fixture 7', solve({'reset': True, 'residue': 1, 'source': 0, 'p': 1, 'q': 4, 'target': 9, 'origin': 50}), [50, 0, '50', False, 0, 0])
check('fixture 8', solve({'reset': False, 'residue': 4, 'source': 2, 'p': 3, 'q': 5, 'target': 10, 'origin': 0}), [12, 0, '12', False, 12, 2])
check('fixture 9', solve({'reset': False, 'residue': 0, 'source': 0, 'p': 2, 'q': 3, 'target': 0, 'origin': 0}), [0, 0, '0', False, 0, 0])
check('fixture 10', solve({'reset': False, 'residue': 2, 'source': 10, 'p': 1, 'q': 7, 'target': 100, 'origin': 4}), [105, 5, '740/7', True, 101, 1])
variant = [({'reset': False, 'residue': 2, 'source': 2, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [112, 0, '112', False, 12, 2]), ({'reset': False, 'residue': 2, 'source': 3, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [112, 2, '338/3', True, 12, 2]), ({'reset': False, 'residue': 2, 'source': 4, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [113, 1, '340/3', True, 13, 3]), ({'reset': False, 'residue': 2, 'source': 5, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [114, 0, '114', False, 14, 4]), ({'reset': False, 'residue': 2, 'source': 6, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [114, 2, '344/3', True, 14, 4])]
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 accumulated.

An elapsed-time converter maps incoming nonnegative source ticks to target ticks with exact rate numerator/denominator and retained residue. Each step adds source*p to prior numerator residue; emit quotient and preserve remainder. A reset invalidates old remainder. A phase origin belongs to emitted target coordinate. Report emitted ticks, new residue, cumulative target, exact unrounded cumulative coordinate and reset marker.

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):
    old_residue = 0 if r['reset'] else r['residue']
    scaled = r['source'] * r['p']
    accumulated = scaled + old_residue
    emitted = (accumulated + r['q'] - 1) // r['q']
    residue = accumulated % r['q']
    old_target = 0 if r['reset'] else r['target']
    target = old_target + emitted
    coordinate = r['origin'] + target
    exact = Fraction(coordinate) + Fraction(residue,r['q'])
    needs_tick = residue != 0
    return [coordinate,residue,str(exact),needs_tick,target,emitted]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'reset': False, 'residue': 2, 'source': 1, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}), [111, 1, '334/3', True, 11, 1])
check('fixture 2', solve({'reset': True, 'residue': 2, 'source': 1, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}), [100, 2, '302/3', True, 0, 0])
check('fixture 3', solve({'reset': False, 'residue': 0, 'source': 1, 'p': 2, 'q': 3, 'target': 0, 'origin': 0}), [0, 2, '2/3', True, 0, 0])
check('fixture 4', solve({'reset': False, 'residue': 1, 'source': 1, 'p': 2, 'q': 3, 'target': 5, 'origin': 10}), [16, 0, '16', False, 6, 1])
check('fixture 5', solve({'reset': False, 'residue': 0, 'source': 3, 'p': 2, 'q': 3, 'target': 7, 'origin': -10}), [-1, 0, '-1', False, 9, 2])
check('fixture 6', solve({'reset': False, 'residue': 1, 'source': 0, 'p': 1, 'q': 4, 'target': 2, 'origin': 100}), [102, 1, '409/4', True, 2, 0])
check('fixture 7', solve({'reset': True, 'residue': 1, 'source': 0, 'p': 1, 'q': 4, 'target': 9, 'origin': 50}), [50, 0, '50', False, 0, 0])
check('fixture 8', solve({'reset': False, 'residue': 4, 'source': 2, 'p': 3, 'q': 5, 'target': 10, 'origin': 0}), [12, 0, '12', False, 12, 2])
check('fixture 9', solve({'reset': False, 'residue': 0, 'source': 0, 'p': 2, 'q': 3, 'target': 0, 'origin': 0}), [0, 0, '0', False, 0, 0])
check('fixture 10', solve({'reset': False, 'residue': 2, 'source': 10, 'p': 1, 'q': 7, 'target': 100, 'origin': 4}), [105, 5, '740/7', True, 101, 1])
variant = [({'reset': False, 'residue': 2, 'source': 2, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [112, 0, '112', False, 12, 2]), ({'reset': False, 'residue': 2, 'source': 3, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [112, 2, '338/3', True, 12, 2]), ({'reset': False, 'residue': 2, 'source': 4, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [113, 1, '340/3', True, 13, 3]), ({'reset': False, 'residue': 2, 'source': 5, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [114, 0, '114', False, 14, 4]), ({'reset': False, 'residue': 2, 'source': 6, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [114, 2, '344/3', True, 14, 4])]
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):
    old_residue = 0 if r['reset'] else r['residue']
    scaled = r['source'] * r['p']
    accumulated = scaled + old_residue
    emitted = accumulated // r['p']
    residue = accumulated % r['q']
    old_target = 0 if r['reset'] else r['target']
    target = old_target + emitted
    coordinate = r['origin'] + target
    exact = Fraction(coordinate) + Fraction(residue,r['q'])
    needs_tick = residue != 0
    return [coordinate,residue,str(exact),needs_tick,target,emitted]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'reset': False, 'residue': 2, 'source': 1, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}), [111, 1, '334/3', True, 11, 1])
check('fixture 2', solve({'reset': True, 'residue': 2, 'source': 1, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}), [100, 2, '302/3', True, 0, 0])
check('fixture 3', solve({'reset': False, 'residue': 0, 'source': 1, 'p': 2, 'q': 3, 'target': 0, 'origin': 0}), [0, 2, '2/3', True, 0, 0])
check('fixture 4', solve({'reset': False, 'residue': 1, 'source': 1, 'p': 2, 'q': 3, 'target': 5, 'origin': 10}), [16, 0, '16', False, 6, 1])
check('fixture 5', solve({'reset': False, 'residue': 0, 'source': 3, 'p': 2, 'q': 3, 'target': 7, 'origin': -10}), [-1, 0, '-1', False, 9, 2])
check('fixture 6', solve({'reset': False, 'residue': 1, 'source': 0, 'p': 1, 'q': 4, 'target': 2, 'origin': 100}), [102, 1, '409/4', True, 2, 0])
check('fixture 7', solve({'reset': True, 'residue': 1, 'source': 0, 'p': 1, 'q': 4, 'target': 9, 'origin': 50}), [50, 0, '50', False, 0, 0])
check('fixture 8', solve({'reset': False, 'residue': 4, 'source': 2, 'p': 3, 'q': 5, 'target': 10, 'origin': 0}), [12, 0, '12', False, 12, 2])
check('fixture 9', solve({'reset': False, 'residue': 0, 'source': 0, 'p': 2, 'q': 3, 'target': 0, 'origin': 0}), [0, 0, '0', False, 0, 0])
check('fixture 10', solve({'reset': False, 'residue': 2, 'source': 10, 'p': 1, 'q': 7, 'target': 100, 'origin': 4}), [105, 5, '740/7', True, 101, 1])
variant = [({'reset': False, 'residue': 2, 'source': 2, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [112, 0, '112', False, 12, 2]), ({'reset': False, 'residue': 2, 'source': 3, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [112, 2, '338/3', True, 12, 2]), ({'reset': False, 'residue': 2, 'source': 4, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [113, 1, '340/3', True, 13, 3]), ({'reset': False, 'residue': 2, 'source': 5, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [114, 0, '114', False, 14, 4]), ({'reset': False, 'residue': 2, 'source': 6, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [114, 2, '344/3', True, 14, 4])]
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 emitted.

An elapsed-time converter maps incoming nonnegative source ticks to target ticks with exact rate numerator/denominator and retained residue. Each step adds source*p to prior numerator residue; emit quotient and preserve remainder. A reset invalidates old remainder. A phase origin belongs to emitted target coordinate. Report emitted ticks, new residue, cumulative target, exact unrounded cumulative coordinate and reset marker.

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):
    old_residue = 0 if r['reset'] else r['residue']
    scaled = r['source'] * r['p']
    accumulated = scaled + old_residue
    emitted = accumulated // r['q']
    residue = accumulated % r['p']
    old_target = 0 if r['reset'] else r['target']
    target = old_target + emitted
    coordinate = r['origin'] + target
    exact = Fraction(coordinate) + Fraction(residue,r['q'])
    needs_tick = residue != 0
    return [coordinate,residue,str(exact),needs_tick,target,emitted]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'reset': False, 'residue': 2, 'source': 1, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}), [111, 1, '334/3', True, 11, 1])
check('fixture 2', solve({'reset': True, 'residue': 2, 'source': 1, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}), [100, 2, '302/3', True, 0, 0])
check('fixture 3', solve({'reset': False, 'residue': 0, 'source': 1, 'p': 2, 'q': 3, 'target': 0, 'origin': 0}), [0, 2, '2/3', True, 0, 0])
check('fixture 4', solve({'reset': False, 'residue': 1, 'source': 1, 'p': 2, 'q': 3, 'target': 5, 'origin': 10}), [16, 0, '16', False, 6, 1])
check('fixture 5', solve({'reset': False, 'residue': 0, 'source': 3, 'p': 2, 'q': 3, 'target': 7, 'origin': -10}), [-1, 0, '-1', False, 9, 2])
check('fixture 6', solve({'reset': False, 'residue': 1, 'source': 0, 'p': 1, 'q': 4, 'target': 2, 'origin': 100}), [102, 1, '409/4', True, 2, 0])
check('fixture 7', solve({'reset': True, 'residue': 1, 'source': 0, 'p': 1, 'q': 4, 'target': 9, 'origin': 50}), [50, 0, '50', False, 0, 0])
check('fixture 8', solve({'reset': False, 'residue': 4, 'source': 2, 'p': 3, 'q': 5, 'target': 10, 'origin': 0}), [12, 0, '12', False, 12, 2])
check('fixture 9', solve({'reset': False, 'residue': 0, 'source': 0, 'p': 2, 'q': 3, 'target': 0, 'origin': 0}), [0, 0, '0', False, 0, 0])
check('fixture 10', solve({'reset': False, 'residue': 2, 'source': 10, 'p': 1, 'q': 7, 'target': 100, 'origin': 4}), [105, 5, '740/7', True, 101, 1])
variant = [({'reset': False, 'residue': 2, 'source': 2, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [112, 0, '112', False, 12, 2]), ({'reset': False, 'residue': 2, 'source': 3, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [112, 2, '338/3', True, 12, 2]), ({'reset': False, 'residue': 2, 'source': 4, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [113, 1, '340/3', True, 13, 3]), ({'reset': False, 'residue': 2, 'source': 5, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [114, 0, '114', False, 14, 4]), ({'reset': False, 'residue': 2, 'source': 6, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [114, 2, '344/3', True, 14, 4])]
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):
    old_residue = 0 if r['reset'] else r['residue']
    scaled = r['source'] * r['p']
    accumulated = scaled + old_residue
    emitted = accumulated // r['q']
    residue = 0
    old_target = 0 if r['reset'] else r['target']
    target = old_target + emitted
    coordinate = r['origin'] + target
    exact = Fraction(coordinate) + Fraction(residue,r['q'])
    needs_tick = residue != 0
    return [coordinate,residue,str(exact),needs_tick,target,emitted]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'reset': False, 'residue': 2, 'source': 1, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}), [111, 1, '334/3', True, 11, 1])
check('fixture 2', solve({'reset': True, 'residue': 2, 'source': 1, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}), [100, 2, '302/3', True, 0, 0])
check('fixture 3', solve({'reset': False, 'residue': 0, 'source': 1, 'p': 2, 'q': 3, 'target': 0, 'origin': 0}), [0, 2, '2/3', True, 0, 0])
check('fixture 4', solve({'reset': False, 'residue': 1, 'source': 1, 'p': 2, 'q': 3, 'target': 5, 'origin': 10}), [16, 0, '16', False, 6, 1])
check('fixture 5', solve({'reset': False, 'residue': 0, 'source': 3, 'p': 2, 'q': 3, 'target': 7, 'origin': -10}), [-1, 0, '-1', False, 9, 2])
check('fixture 6', solve({'reset': False, 'residue': 1, 'source': 0, 'p': 1, 'q': 4, 'target': 2, 'origin': 100}), [102, 1, '409/4', True, 2, 0])
check('fixture 7', solve({'reset': True, 'residue': 1, 'source': 0, 'p': 1, 'q': 4, 'target': 9, 'origin': 50}), [50, 0, '50', False, 0, 0])
check('fixture 8', solve({'reset': False, 'residue': 4, 'source': 2, 'p': 3, 'q': 5, 'target': 10, 'origin': 0}), [12, 0, '12', False, 12, 2])
check('fixture 9', solve({'reset': False, 'residue': 0, 'source': 0, 'p': 2, 'q': 3, 'target': 0, 'origin': 0}), [0, 0, '0', False, 0, 0])
check('fixture 10', solve({'reset': False, 'residue': 2, 'source': 10, 'p': 1, 'q': 7, 'target': 100, 'origin': 4}), [105, 5, '740/7', True, 101, 1])
variant = [({'reset': False, 'residue': 2, 'source': 2, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [112, 0, '112', False, 12, 2]), ({'reset': False, 'residue': 2, 'source': 3, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [112, 2, '338/3', True, 12, 2]), ({'reset': False, 'residue': 2, 'source': 4, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [113, 1, '340/3', True, 13, 3]), ({'reset': False, 'residue': 2, 'source': 5, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [114, 0, '114', False, 14, 4]), ({'reset': False, 'residue': 2, 'source': 6, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [114, 2, '344/3', True, 14, 4])]
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 residue.

An elapsed-time converter maps incoming nonnegative source ticks to target ticks with exact rate numerator/denominator and retained residue. Each step adds source*p to prior numerator residue; emit quotient and preserve remainder. A reset invalidates old remainder. A phase origin belongs to emitted target coordinate. Report emitted ticks, new residue, cumulative target, exact unrounded cumulative coordinate and reset marker.

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):
    old_residue = 0 if r['reset'] else r['residue']
    scaled = r['source'] * r['p']
    accumulated = scaled + old_residue
    emitted = accumulated // r['q']
    residue = accumulated % r['q']
    old_target = r['target']
    target = old_target + emitted
    coordinate = r['origin'] + target
    exact = Fraction(coordinate) + Fraction(residue,r['q'])
    needs_tick = residue != 0
    return [coordinate,residue,str(exact),needs_tick,target,emitted]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'reset': False, 'residue': 2, 'source': 1, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}), [111, 1, '334/3', True, 11, 1])
check('fixture 2', solve({'reset': True, 'residue': 2, 'source': 1, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}), [100, 2, '302/3', True, 0, 0])
check('fixture 3', solve({'reset': False, 'residue': 0, 'source': 1, 'p': 2, 'q': 3, 'target': 0, 'origin': 0}), [0, 2, '2/3', True, 0, 0])
check('fixture 4', solve({'reset': False, 'residue': 1, 'source': 1, 'p': 2, 'q': 3, 'target': 5, 'origin': 10}), [16, 0, '16', False, 6, 1])
check('fixture 5', solve({'reset': False, 'residue': 0, 'source': 3, 'p': 2, 'q': 3, 'target': 7, 'origin': -10}), [-1, 0, '-1', False, 9, 2])
check('fixture 6', solve({'reset': False, 'residue': 1, 'source': 0, 'p': 1, 'q': 4, 'target': 2, 'origin': 100}), [102, 1, '409/4', True, 2, 0])
check('fixture 7', solve({'reset': True, 'residue': 1, 'source': 0, 'p': 1, 'q': 4, 'target': 9, 'origin': 50}), [50, 0, '50', False, 0, 0])
check('fixture 8', solve({'reset': False, 'residue': 4, 'source': 2, 'p': 3, 'q': 5, 'target': 10, 'origin': 0}), [12, 0, '12', False, 12, 2])
check('fixture 9', solve({'reset': False, 'residue': 0, 'source': 0, 'p': 2, 'q': 3, 'target': 0, 'origin': 0}), [0, 0, '0', False, 0, 0])
check('fixture 10', solve({'reset': False, 'residue': 2, 'source': 10, 'p': 1, 'q': 7, 'target': 100, 'origin': 4}), [105, 5, '740/7', True, 101, 1])
variant = [({'reset': False, 'residue': 2, 'source': 2, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [112, 0, '112', False, 12, 2]), ({'reset': False, 'residue': 2, 'source': 3, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [112, 2, '338/3', True, 12, 2]), ({'reset': False, 'residue': 2, 'source': 4, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [113, 1, '340/3', True, 13, 3]), ({'reset': False, 'residue': 2, 'source': 5, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [114, 0, '114', False, 14, 4]), ({'reset': False, 'residue': 2, 'source': 6, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [114, 2, '344/3', True, 14, 4])]
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):
    old_residue = 0 if r['reset'] else r['residue']
    scaled = r['source'] * r['p']
    accumulated = scaled + old_residue
    emitted = accumulated // r['q']
    residue = accumulated % r['q']
    old_target = 0
    target = old_target + emitted
    coordinate = r['origin'] + target
    exact = Fraction(coordinate) + Fraction(residue,r['q'])
    needs_tick = residue != 0
    return [coordinate,residue,str(exact),needs_tick,target,emitted]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'reset': False, 'residue': 2, 'source': 1, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}), [111, 1, '334/3', True, 11, 1])
check('fixture 2', solve({'reset': True, 'residue': 2, 'source': 1, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}), [100, 2, '302/3', True, 0, 0])
check('fixture 3', solve({'reset': False, 'residue': 0, 'source': 1, 'p': 2, 'q': 3, 'target': 0, 'origin': 0}), [0, 2, '2/3', True, 0, 0])
check('fixture 4', solve({'reset': False, 'residue': 1, 'source': 1, 'p': 2, 'q': 3, 'target': 5, 'origin': 10}), [16, 0, '16', False, 6, 1])
check('fixture 5', solve({'reset': False, 'residue': 0, 'source': 3, 'p': 2, 'q': 3, 'target': 7, 'origin': -10}), [-1, 0, '-1', False, 9, 2])
check('fixture 6', solve({'reset': False, 'residue': 1, 'source': 0, 'p': 1, 'q': 4, 'target': 2, 'origin': 100}), [102, 1, '409/4', True, 2, 0])
check('fixture 7', solve({'reset': True, 'residue': 1, 'source': 0, 'p': 1, 'q': 4, 'target': 9, 'origin': 50}), [50, 0, '50', False, 0, 0])
check('fixture 8', solve({'reset': False, 'residue': 4, 'source': 2, 'p': 3, 'q': 5, 'target': 10, 'origin': 0}), [12, 0, '12', False, 12, 2])
check('fixture 9', solve({'reset': False, 'residue': 0, 'source': 0, 'p': 2, 'q': 3, 'target': 0, 'origin': 0}), [0, 0, '0', False, 0, 0])
check('fixture 10', solve({'reset': False, 'residue': 2, 'source': 10, 'p': 1, 'q': 7, 'target': 100, 'origin': 4}), [105, 5, '740/7', True, 101, 1])
variant = [({'reset': False, 'residue': 2, 'source': 2, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [112, 0, '112', False, 12, 2]), ({'reset': False, 'residue': 2, 'source': 3, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [112, 2, '338/3', True, 12, 2]), ({'reset': False, 'residue': 2, 'source': 4, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [113, 1, '340/3', True, 13, 3]), ({'reset': False, 'residue': 2, 'source': 5, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [114, 0, '114', False, 14, 4]), ({'reset': False, 'residue': 2, 'source': 6, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [114, 2, '344/3', True, 14, 4])]
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 old_target.

An elapsed-time converter maps incoming nonnegative source ticks to target ticks with exact rate numerator/denominator and retained residue. Each step adds source*p to prior numerator residue; emit quotient and preserve remainder. A reset invalidates old remainder. A phase origin belongs to emitted target coordinate. Report emitted ticks, new residue, cumulative target, exact unrounded cumulative coordinate and reset marker.

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):
    old_residue = 0 if r['reset'] else r['residue']
    scaled = r['source'] * r['p']
    accumulated = scaled + old_residue
    emitted = accumulated // r['q']
    residue = accumulated % r['q']
    old_target = 0 if r['reset'] else r['target']
    target = emitted
    coordinate = r['origin'] + target
    exact = Fraction(coordinate) + Fraction(residue,r['q'])
    needs_tick = residue != 0
    return [coordinate,residue,str(exact),needs_tick,target,emitted]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'reset': False, 'residue': 2, 'source': 1, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}), [111, 1, '334/3', True, 11, 1])
check('fixture 2', solve({'reset': True, 'residue': 2, 'source': 1, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}), [100, 2, '302/3', True, 0, 0])
check('fixture 3', solve({'reset': False, 'residue': 0, 'source': 1, 'p': 2, 'q': 3, 'target': 0, 'origin': 0}), [0, 2, '2/3', True, 0, 0])
check('fixture 4', solve({'reset': False, 'residue': 1, 'source': 1, 'p': 2, 'q': 3, 'target': 5, 'origin': 10}), [16, 0, '16', False, 6, 1])
check('fixture 5', solve({'reset': False, 'residue': 0, 'source': 3, 'p': 2, 'q': 3, 'target': 7, 'origin': -10}), [-1, 0, '-1', False, 9, 2])
check('fixture 6', solve({'reset': False, 'residue': 1, 'source': 0, 'p': 1, 'q': 4, 'target': 2, 'origin': 100}), [102, 1, '409/4', True, 2, 0])
check('fixture 7', solve({'reset': True, 'residue': 1, 'source': 0, 'p': 1, 'q': 4, 'target': 9, 'origin': 50}), [50, 0, '50', False, 0, 0])
check('fixture 8', solve({'reset': False, 'residue': 4, 'source': 2, 'p': 3, 'q': 5, 'target': 10, 'origin': 0}), [12, 0, '12', False, 12, 2])
check('fixture 9', solve({'reset': False, 'residue': 0, 'source': 0, 'p': 2, 'q': 3, 'target': 0, 'origin': 0}), [0, 0, '0', False, 0, 0])
check('fixture 10', solve({'reset': False, 'residue': 2, 'source': 10, 'p': 1, 'q': 7, 'target': 100, 'origin': 4}), [105, 5, '740/7', True, 101, 1])
variant = [({'reset': False, 'residue': 2, 'source': 2, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [112, 0, '112', False, 12, 2]), ({'reset': False, 'residue': 2, 'source': 3, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [112, 2, '338/3', True, 12, 2]), ({'reset': False, 'residue': 2, 'source': 4, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [113, 1, '340/3', True, 13, 3]), ({'reset': False, 'residue': 2, 'source': 5, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [114, 0, '114', False, 14, 4]), ({'reset': False, 'residue': 2, 'source': 6, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [114, 2, '344/3', True, 14, 4])]
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):
    old_residue = 0 if r['reset'] else r['residue']
    scaled = r['source'] * r['p']
    accumulated = scaled + old_residue
    emitted = accumulated // r['q']
    residue = accumulated % r['q']
    old_target = 0 if r['reset'] else r['target']
    target = old_target + accumulated
    coordinate = r['origin'] + target
    exact = Fraction(coordinate) + Fraction(residue,r['q'])
    needs_tick = residue != 0
    return [coordinate,residue,str(exact),needs_tick,target,emitted]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'reset': False, 'residue': 2, 'source': 1, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}), [111, 1, '334/3', True, 11, 1])
check('fixture 2', solve({'reset': True, 'residue': 2, 'source': 1, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}), [100, 2, '302/3', True, 0, 0])
check('fixture 3', solve({'reset': False, 'residue': 0, 'source': 1, 'p': 2, 'q': 3, 'target': 0, 'origin': 0}), [0, 2, '2/3', True, 0, 0])
check('fixture 4', solve({'reset': False, 'residue': 1, 'source': 1, 'p': 2, 'q': 3, 'target': 5, 'origin': 10}), [16, 0, '16', False, 6, 1])
check('fixture 5', solve({'reset': False, 'residue': 0, 'source': 3, 'p': 2, 'q': 3, 'target': 7, 'origin': -10}), [-1, 0, '-1', False, 9, 2])
check('fixture 6', solve({'reset': False, 'residue': 1, 'source': 0, 'p': 1, 'q': 4, 'target': 2, 'origin': 100}), [102, 1, '409/4', True, 2, 0])
check('fixture 7', solve({'reset': True, 'residue': 1, 'source': 0, 'p': 1, 'q': 4, 'target': 9, 'origin': 50}), [50, 0, '50', False, 0, 0])
check('fixture 8', solve({'reset': False, 'residue': 4, 'source': 2, 'p': 3, 'q': 5, 'target': 10, 'origin': 0}), [12, 0, '12', False, 12, 2])
check('fixture 9', solve({'reset': False, 'residue': 0, 'source': 0, 'p': 2, 'q': 3, 'target': 0, 'origin': 0}), [0, 0, '0', False, 0, 0])
check('fixture 10', solve({'reset': False, 'residue': 2, 'source': 10, 'p': 1, 'q': 7, 'target': 100, 'origin': 4}), [105, 5, '740/7', True, 101, 1])
variant = [({'reset': False, 'residue': 2, 'source': 2, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [112, 0, '112', False, 12, 2]), ({'reset': False, 'residue': 2, 'source': 3, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [112, 2, '338/3', True, 12, 2]), ({'reset': False, 'residue': 2, 'source': 4, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [113, 1, '340/3', True, 13, 3]), ({'reset': False, 'residue': 2, 'source': 5, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [114, 0, '114', False, 14, 4]), ({'reset': False, 'residue': 2, 'source': 6, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [114, 2, '344/3', True, 14, 4])]
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 target.

An elapsed-time converter maps incoming nonnegative source ticks to target ticks with exact rate numerator/denominator and retained residue. Each step adds source*p to prior numerator residue; emit quotient and preserve remainder. A reset invalidates old remainder. A phase origin belongs to emitted target coordinate. Report emitted ticks, new residue, cumulative target, exact unrounded cumulative coordinate and reset marker.

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):
    old_residue = 0 if r['reset'] else r['residue']
    scaled = r['source'] * r['p']
    accumulated = scaled + old_residue
    emitted = accumulated // r['q']
    residue = accumulated % r['q']
    old_target = 0 if r['reset'] else r['target']
    target = old_target + emitted
    coordinate = target
    exact = Fraction(coordinate) + Fraction(residue,r['q'])
    needs_tick = residue != 0
    return [coordinate,residue,str(exact),needs_tick,target,emitted]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'reset': False, 'residue': 2, 'source': 1, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}), [111, 1, '334/3', True, 11, 1])
check('fixture 2', solve({'reset': True, 'residue': 2, 'source': 1, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}), [100, 2, '302/3', True, 0, 0])
check('fixture 3', solve({'reset': False, 'residue': 0, 'source': 1, 'p': 2, 'q': 3, 'target': 0, 'origin': 0}), [0, 2, '2/3', True, 0, 0])
check('fixture 4', solve({'reset': False, 'residue': 1, 'source': 1, 'p': 2, 'q': 3, 'target': 5, 'origin': 10}), [16, 0, '16', False, 6, 1])
check('fixture 5', solve({'reset': False, 'residue': 0, 'source': 3, 'p': 2, 'q': 3, 'target': 7, 'origin': -10}), [-1, 0, '-1', False, 9, 2])
check('fixture 6', solve({'reset': False, 'residue': 1, 'source': 0, 'p': 1, 'q': 4, 'target': 2, 'origin': 100}), [102, 1, '409/4', True, 2, 0])
check('fixture 7', solve({'reset': True, 'residue': 1, 'source': 0, 'p': 1, 'q': 4, 'target': 9, 'origin': 50}), [50, 0, '50', False, 0, 0])
check('fixture 8', solve({'reset': False, 'residue': 4, 'source': 2, 'p': 3, 'q': 5, 'target': 10, 'origin': 0}), [12, 0, '12', False, 12, 2])
check('fixture 9', solve({'reset': False, 'residue': 0, 'source': 0, 'p': 2, 'q': 3, 'target': 0, 'origin': 0}), [0, 0, '0', False, 0, 0])
check('fixture 10', solve({'reset': False, 'residue': 2, 'source': 10, 'p': 1, 'q': 7, 'target': 100, 'origin': 4}), [105, 5, '740/7', True, 101, 1])
variant = [({'reset': False, 'residue': 2, 'source': 2, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [112, 0, '112', False, 12, 2]), ({'reset': False, 'residue': 2, 'source': 3, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [112, 2, '338/3', True, 12, 2]), ({'reset': False, 'residue': 2, 'source': 4, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [113, 1, '340/3', True, 13, 3]), ({'reset': False, 'residue': 2, 'source': 5, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [114, 0, '114', False, 14, 4]), ({'reset': False, 'residue': 2, 'source': 6, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [114, 2, '344/3', True, 14, 4])]
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):
    old_residue = 0 if r['reset'] else r['residue']
    scaled = r['source'] * r['p']
    accumulated = scaled + old_residue
    emitted = accumulated // r['q']
    residue = accumulated % r['q']
    old_target = 0 if r['reset'] else r['target']
    target = old_target + emitted
    coordinate = r['origin'] * r['p'] + target
    exact = Fraction(coordinate) + Fraction(residue,r['q'])
    needs_tick = residue != 0
    return [coordinate,residue,str(exact),needs_tick,target,emitted]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'reset': False, 'residue': 2, 'source': 1, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}), [111, 1, '334/3', True, 11, 1])
check('fixture 2', solve({'reset': True, 'residue': 2, 'source': 1, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}), [100, 2, '302/3', True, 0, 0])
check('fixture 3', solve({'reset': False, 'residue': 0, 'source': 1, 'p': 2, 'q': 3, 'target': 0, 'origin': 0}), [0, 2, '2/3', True, 0, 0])
check('fixture 4', solve({'reset': False, 'residue': 1, 'source': 1, 'p': 2, 'q': 3, 'target': 5, 'origin': 10}), [16, 0, '16', False, 6, 1])
check('fixture 5', solve({'reset': False, 'residue': 0, 'source': 3, 'p': 2, 'q': 3, 'target': 7, 'origin': -10}), [-1, 0, '-1', False, 9, 2])
check('fixture 6', solve({'reset': False, 'residue': 1, 'source': 0, 'p': 1, 'q': 4, 'target': 2, 'origin': 100}), [102, 1, '409/4', True, 2, 0])
check('fixture 7', solve({'reset': True, 'residue': 1, 'source': 0, 'p': 1, 'q': 4, 'target': 9, 'origin': 50}), [50, 0, '50', False, 0, 0])
check('fixture 8', solve({'reset': False, 'residue': 4, 'source': 2, 'p': 3, 'q': 5, 'target': 10, 'origin': 0}), [12, 0, '12', False, 12, 2])
check('fixture 9', solve({'reset': False, 'residue': 0, 'source': 0, 'p': 2, 'q': 3, 'target': 0, 'origin': 0}), [0, 0, '0', False, 0, 0])
check('fixture 10', solve({'reset': False, 'residue': 2, 'source': 10, 'p': 1, 'q': 7, 'target': 100, 'origin': 4}), [105, 5, '740/7', True, 101, 1])
variant = [({'reset': False, 'residue': 2, 'source': 2, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [112, 0, '112', False, 12, 2]), ({'reset': False, 'residue': 2, 'source': 3, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [112, 2, '338/3', True, 12, 2]), ({'reset': False, 'residue': 2, 'source': 4, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [113, 1, '340/3', True, 13, 3]), ({'reset': False, 'residue': 2, 'source': 5, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [114, 0, '114', False, 14, 4]), ({'reset': False, 'residue': 2, 'source': 6, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [114, 2, '344/3', True, 14, 4])]
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 coordinate.

An elapsed-time converter maps incoming nonnegative source ticks to target ticks with exact rate numerator/denominator and retained residue. Each step adds source*p to prior numerator residue; emit quotient and preserve remainder. A reset invalidates old remainder. A phase origin belongs to emitted target coordinate. Report emitted ticks, new residue, cumulative target, exact unrounded cumulative coordinate and reset marker.

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):
    old_residue = 0 if r['reset'] else r['residue']
    scaled = r['source'] * r['p']
    accumulated = scaled + old_residue
    emitted = accumulated // r['q']
    residue = accumulated % r['q']
    old_target = 0 if r['reset'] else r['target']
    target = old_target + emitted
    coordinate = r['origin'] + target
    exact = Fraction(coordinate)
    needs_tick = residue != 0
    return [coordinate,residue,str(exact),needs_tick,target,emitted]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'reset': False, 'residue': 2, 'source': 1, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}), [111, 1, '334/3', True, 11, 1])
check('fixture 2', solve({'reset': True, 'residue': 2, 'source': 1, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}), [100, 2, '302/3', True, 0, 0])
check('fixture 3', solve({'reset': False, 'residue': 0, 'source': 1, 'p': 2, 'q': 3, 'target': 0, 'origin': 0}), [0, 2, '2/3', True, 0, 0])
check('fixture 4', solve({'reset': False, 'residue': 1, 'source': 1, 'p': 2, 'q': 3, 'target': 5, 'origin': 10}), [16, 0, '16', False, 6, 1])
check('fixture 5', solve({'reset': False, 'residue': 0, 'source': 3, 'p': 2, 'q': 3, 'target': 7, 'origin': -10}), [-1, 0, '-1', False, 9, 2])
check('fixture 6', solve({'reset': False, 'residue': 1, 'source': 0, 'p': 1, 'q': 4, 'target': 2, 'origin': 100}), [102, 1, '409/4', True, 2, 0])
check('fixture 7', solve({'reset': True, 'residue': 1, 'source': 0, 'p': 1, 'q': 4, 'target': 9, 'origin': 50}), [50, 0, '50', False, 0, 0])
check('fixture 8', solve({'reset': False, 'residue': 4, 'source': 2, 'p': 3, 'q': 5, 'target': 10, 'origin': 0}), [12, 0, '12', False, 12, 2])
check('fixture 9', solve({'reset': False, 'residue': 0, 'source': 0, 'p': 2, 'q': 3, 'target': 0, 'origin': 0}), [0, 0, '0', False, 0, 0])
check('fixture 10', solve({'reset': False, 'residue': 2, 'source': 10, 'p': 1, 'q': 7, 'target': 100, 'origin': 4}), [105, 5, '740/7', True, 101, 1])
variant = [({'reset': False, 'residue': 2, 'source': 2, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [112, 0, '112', False, 12, 2]), ({'reset': False, 'residue': 2, 'source': 3, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [112, 2, '338/3', True, 12, 2]), ({'reset': False, 'residue': 2, 'source': 4, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [113, 1, '340/3', True, 13, 3]), ({'reset': False, 'residue': 2, 'source': 5, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [114, 0, '114', False, 14, 4]), ({'reset': False, 'residue': 2, 'source': 6, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [114, 2, '344/3', True, 14, 4])]
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):
    old_residue = 0 if r['reset'] else r['residue']
    scaled = r['source'] * r['p']
    accumulated = scaled + old_residue
    emitted = accumulated // r['q']
    residue = accumulated % r['q']
    old_target = 0 if r['reset'] else r['target']
    target = old_target + emitted
    coordinate = r['origin'] + target
    exact = Fraction(coordinate) + Fraction(residue,r['p'])
    needs_tick = residue != 0
    return [coordinate,residue,str(exact),needs_tick,target,emitted]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'reset': False, 'residue': 2, 'source': 1, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}), [111, 1, '334/3', True, 11, 1])
check('fixture 2', solve({'reset': True, 'residue': 2, 'source': 1, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}), [100, 2, '302/3', True, 0, 0])
check('fixture 3', solve({'reset': False, 'residue': 0, 'source': 1, 'p': 2, 'q': 3, 'target': 0, 'origin': 0}), [0, 2, '2/3', True, 0, 0])
check('fixture 4', solve({'reset': False, 'residue': 1, 'source': 1, 'p': 2, 'q': 3, 'target': 5, 'origin': 10}), [16, 0, '16', False, 6, 1])
check('fixture 5', solve({'reset': False, 'residue': 0, 'source': 3, 'p': 2, 'q': 3, 'target': 7, 'origin': -10}), [-1, 0, '-1', False, 9, 2])
check('fixture 6', solve({'reset': False, 'residue': 1, 'source': 0, 'p': 1, 'q': 4, 'target': 2, 'origin': 100}), [102, 1, '409/4', True, 2, 0])
check('fixture 7', solve({'reset': True, 'residue': 1, 'source': 0, 'p': 1, 'q': 4, 'target': 9, 'origin': 50}), [50, 0, '50', False, 0, 0])
check('fixture 8', solve({'reset': False, 'residue': 4, 'source': 2, 'p': 3, 'q': 5, 'target': 10, 'origin': 0}), [12, 0, '12', False, 12, 2])
check('fixture 9', solve({'reset': False, 'residue': 0, 'source': 0, 'p': 2, 'q': 3, 'target': 0, 'origin': 0}), [0, 0, '0', False, 0, 0])
check('fixture 10', solve({'reset': False, 'residue': 2, 'source': 10, 'p': 1, 'q': 7, 'target': 100, 'origin': 4}), [105, 5, '740/7', True, 101, 1])
variant = [({'reset': False, 'residue': 2, 'source': 2, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [112, 0, '112', False, 12, 2]), ({'reset': False, 'residue': 2, 'source': 3, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [112, 2, '338/3', True, 12, 2]), ({'reset': False, 'residue': 2, 'source': 4, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [113, 1, '340/3', True, 13, 3]), ({'reset': False, 'residue': 2, 'source': 5, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [114, 0, '114', False, 14, 4]), ({'reset': False, 'residue': 2, 'source': 6, 'p': 2, 'q': 3, 'target': 10, 'origin': 100}, [114, 2, '344/3', True, 14, 4])]
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 exact.

An elapsed-time converter maps incoming nonnegative source ticks to target ticks with exact rate numerator/denominator and retained residue. Each step adds source*p to prior numerator residue; emit quotient and preserve remainder. A reset invalidates old remainder. A phase origin belongs to emitted target coordinate. Report emitted ticks, new residue, cumulative target, exact unrounded cumulative coordinate and reset marker.

split: open-access