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

N = 1
observations = []
def solve(cases):
    def run(c):
        recording=False; origin=0; paused=None; excluded=0; records=[]
        for kind,key,now,injected in c:
            if kind=='start':
                recording=True; origin=now; paused=None; excluded=0; records=[]
            elif kind=='pause' and recording and paused is None:
                paused=now
            elif kind=='resume' and recording and paused is not None:
                excluded=now-paused
                paused=None
            elif kind=='stop': recording=False; paused=None
            elif kind=='clear': records=[]
            elif kind in ('down','up') and recording and paused is None and not injected:
                records.append([kind,key,now-origin-excluded])
        return [records,recording,paused is not None,excluded]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('macro-record scenario 0', solve([[]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 1', solve([[['start', '', 10, False], ['down', 'A', 12, False], ['up', 'A', 13, False], ['text', 'A', 14, False]]] * N), [[[['down', 'A', 2], ['up', 'A', 3]], True, False, 0]] * N)
check('macro-record scenario 2', solve([[['start', '', 10, False], ['down', 'A', 12, True], ['up', 'A', 13, True]]] * N), [[[], True, False, 0]] * N)
check('macro-record scenario 3', solve([[['start', '', 10, False], ['pause', '', 12, False], ['pause', '', 13, False], ['resume', '', 15, False], ['down', 'A', 16, False]]] * N), [[[['down', 'A', 3]], True, False, 3]] * N)
check('macro-record scenario 4', solve([[['start', '', 10, False], ['pause', '', 12, False], ['resume', '', 15, False], ['pause', '', 17, False], ['resume', '', 20, False], ['down', 'A', 21, False]]] * N), [[[['down', 'A', 5]], True, False, 6]] * N)
check('macro-record scenario 5', solve([[['start', '', 10, False], ['down', 'A', 11, False], ['start', '', 20, False]]] * N), [[[], True, False, 0]] * N)
check('macro-record scenario 6', solve([[['start', '', 10, False], ['pause', '', 12, False], ['resume', '', 15, False], ['start', '', 20, False], ['down', 'A', 21, False]]] * N), [[[['down', 'A', 1]], True, False, 0]] * N)
check('macro-record scenario 7', solve([[['start', '', 10, False], ['pause', '', 12, False], ['stop', '', 15, False], ['down', 'A', 16, False]]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 8', solve([[['pause', '', 10, False]]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 9', solve([[['start', '', 10, False], ['down', 'A', 11, False], ['up', 'A', 12, False], ['clear', '', 13, False]]] * N), [[[], True, False, 0]] * N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(cases):
    def run(c):
        recording=False; origin=0; paused=None; excluded=0; records=[]
        for kind,key,now,injected in c:
            if kind=='start':
                recording=True; origin=now; paused=None; excluded=0; records=[]
            elif kind=='pause' and recording and paused is None:
                paused=now
            elif kind=='resume' and recording and paused is not None:
                excluded+=now-origin
                paused=None
            elif kind=='stop': recording=False; paused=None
            elif kind=='clear': records=[]
            elif kind in ('down','up') and recording and paused is None and not injected:
                records.append([kind,key,now-origin-excluded])
        return [records,recording,paused is not None,excluded]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('macro-record scenario 0', solve([[]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 1', solve([[['start', '', 10, False], ['down', 'A', 12, False], ['up', 'A', 13, False], ['text', 'A', 14, False]]] * N), [[[['down', 'A', 2], ['up', 'A', 3]], True, False, 0]] * N)
check('macro-record scenario 2', solve([[['start', '', 10, False], ['down', 'A', 12, True], ['up', 'A', 13, True]]] * N), [[[], True, False, 0]] * N)
check('macro-record scenario 3', solve([[['start', '', 10, False], ['pause', '', 12, False], ['pause', '', 13, False], ['resume', '', 15, False], ['down', 'A', 16, False]]] * N), [[[['down', 'A', 3]], True, False, 3]] * N)
check('macro-record scenario 4', solve([[['start', '', 10, False], ['pause', '', 12, False], ['resume', '', 15, False], ['pause', '', 17, False], ['resume', '', 20, False], ['down', 'A', 21, False]]] * N), [[[['down', 'A', 5]], True, False, 6]] * N)
check('macro-record scenario 5', solve([[['start', '', 10, False], ['down', 'A', 11, False], ['start', '', 20, False]]] * N), [[[], True, False, 0]] * N)
check('macro-record scenario 6', solve([[['start', '', 10, False], ['pause', '', 12, False], ['resume', '', 15, False], ['start', '', 20, False], ['down', 'A', 21, False]]] * N), [[[['down', 'A', 1]], True, False, 0]] * N)
check('macro-record scenario 7', solve([[['start', '', 10, False], ['pause', '', 12, False], ['stop', '', 15, False], ['down', 'A', 16, False]]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 8', solve([[['pause', '', 10, False]]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 9', solve([[['start', '', 10, False], ['down', 'A', 11, False], ['up', 'A', 12, False], ['clear', '', 13, False]]] * N), [[[], True, False, 0]] * N)
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 event trace violates the resume duration rule and produces incorrect keyboard state or command output.

Events [kind,key,time,injected]. Start resets capture and origin; physical down/up record relative active time; injected events are ignored. Pause freezes recording and resume excludes paused duration. Stop ends recording; clear erases recording. Return [kind,key,offset] records, recording flag, paused flag and excluded time. Ordered times and paired pause/resume. Inputs are finite ordered event traces; return the stated deterministic state. Batch entries are independent. N varies the number of independent input transactions.

split: open-access


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

N = 1
observations = []
def solve(cases):
    def run(c):
        recording=False; origin=0; paused=None; excluded=0; records=[]
        for kind,key,now,injected in c:
            if kind=='start':
                recording=True; origin=now; paused=None; excluded=0; records=[]
            elif kind=='pause' and recording and paused is None:
                paused=now
            elif kind=='resume' and recording and paused is not None:
                excluded+=now-paused
                paused=now
            elif kind=='stop': recording=False; paused=None
            elif kind=='clear': records=[]
            elif kind in ('down','up') and recording and paused is None and not injected:
                records.append([kind,key,now-origin-excluded])
        return [records,recording,paused is not None,excluded]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('macro-record scenario 0', solve([[]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 1', solve([[['start', '', 10, False], ['down', 'A', 12, False], ['up', 'A', 13, False], ['text', 'A', 14, False]]] * N), [[[['down', 'A', 2], ['up', 'A', 3]], True, False, 0]] * N)
check('macro-record scenario 2', solve([[['start', '', 10, False], ['down', 'A', 12, True], ['up', 'A', 13, True]]] * N), [[[], True, False, 0]] * N)
check('macro-record scenario 3', solve([[['start', '', 10, False], ['pause', '', 12, False], ['pause', '', 13, False], ['resume', '', 15, False], ['down', 'A', 16, False]]] * N), [[[['down', 'A', 3]], True, False, 3]] * N)
check('macro-record scenario 4', solve([[['start', '', 10, False], ['pause', '', 12, False], ['resume', '', 15, False], ['pause', '', 17, False], ['resume', '', 20, False], ['down', 'A', 21, False]]] * N), [[[['down', 'A', 5]], True, False, 6]] * N)
check('macro-record scenario 5', solve([[['start', '', 10, False], ['down', 'A', 11, False], ['start', '', 20, False]]] * N), [[[], True, False, 0]] * N)
check('macro-record scenario 6', solve([[['start', '', 10, False], ['pause', '', 12, False], ['resume', '', 15, False], ['start', '', 20, False], ['down', 'A', 21, False]]] * N), [[[['down', 'A', 1]], True, False, 0]] * N)
check('macro-record scenario 7', solve([[['start', '', 10, False], ['pause', '', 12, False], ['stop', '', 15, False], ['down', 'A', 16, False]]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 8', solve([[['pause', '', 10, False]]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 9', solve([[['start', '', 10, False], ['down', 'A', 11, False], ['up', 'A', 12, False], ['clear', '', 13, False]]] * N), [[[], True, False, 0]] * N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

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

N = 1
observations = []
def solve(cases):
    def run(c):
        recording=False; origin=0; paused=None; excluded=0; records=[]
        for kind,key,now,injected in c:
            if kind=='start':
                recording=True; origin=now; paused=None; excluded=0; records=[]
            elif kind=='pause' and recording and paused is None:
                paused=now
            elif kind=='resume' and recording and paused is not None:
                excluded+=now-paused
                pass
            elif kind=='stop': recording=False; paused=None
            elif kind=='clear': records=[]
            elif kind in ('down','up') and recording and paused is None and not injected:
                records.append([kind,key,now-origin-excluded])
        return [records,recording,paused is not None,excluded]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('macro-record scenario 0', solve([[]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 1', solve([[['start', '', 10, False], ['down', 'A', 12, False], ['up', 'A', 13, False], ['text', 'A', 14, False]]] * N), [[[['down', 'A', 2], ['up', 'A', 3]], True, False, 0]] * N)
check('macro-record scenario 2', solve([[['start', '', 10, False], ['down', 'A', 12, True], ['up', 'A', 13, True]]] * N), [[[], True, False, 0]] * N)
check('macro-record scenario 3', solve([[['start', '', 10, False], ['pause', '', 12, False], ['pause', '', 13, False], ['resume', '', 15, False], ['down', 'A', 16, False]]] * N), [[[['down', 'A', 3]], True, False, 3]] * N)
check('macro-record scenario 4', solve([[['start', '', 10, False], ['pause', '', 12, False], ['resume', '', 15, False], ['pause', '', 17, False], ['resume', '', 20, False], ['down', 'A', 21, False]]] * N), [[[['down', 'A', 5]], True, False, 6]] * N)
check('macro-record scenario 5', solve([[['start', '', 10, False], ['down', 'A', 11, False], ['start', '', 20, False]]] * N), [[[], True, False, 0]] * N)
check('macro-record scenario 6', solve([[['start', '', 10, False], ['pause', '', 12, False], ['resume', '', 15, False], ['start', '', 20, False], ['down', 'A', 21, False]]] * N), [[[['down', 'A', 1]], True, False, 0]] * N)
check('macro-record scenario 7', solve([[['start', '', 10, False], ['pause', '', 12, False], ['stop', '', 15, False], ['down', 'A', 16, False]]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 8', solve([[['pause', '', 10, False]]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 9', solve([[['start', '', 10, False], ['down', 'A', 11, False], ['up', 'A', 12, False], ['clear', '', 13, False]]] * N), [[[], True, False, 0]] * N)
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 event trace violates the resume state rule and produces incorrect keyboard state or command output.

Events [kind,key,time,injected]. Start resets capture and origin; physical down/up record relative active time; injected events are ignored. Pause freezes recording and resume excludes paused duration. Stop ends recording; clear erases recording. Return [kind,key,offset] records, recording flag, paused flag and excluded time. Ordered times and paired pause/resume. Inputs are finite ordered event traces; return the stated deterministic state. Batch entries are independent. N varies the number of independent input transactions.

split: open-access


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

N = 1
observations = []
def solve(cases):
    def run(c):
        recording=False; origin=0; paused=None; excluded=0; records=[]
        for kind,key,now,injected in c:
            if kind=='start':
                recording=True; origin=now; paused=None; excluded=0; records=[]
            elif kind=='pause' and recording and paused is None:
                paused=now
            elif kind=='resume' and recording and paused is not None:
                excluded+=now-paused
                paused=None
            elif kind=='stop': paused=None
            elif kind=='clear': records=[]
            elif kind in ('down','up') and recording and paused is None and not injected:
                records.append([kind,key,now-origin-excluded])
        return [records,recording,paused is not None,excluded]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('macro-record scenario 0', solve([[]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 1', solve([[['start', '', 10, False], ['down', 'A', 12, False], ['up', 'A', 13, False], ['text', 'A', 14, False]]] * N), [[[['down', 'A', 2], ['up', 'A', 3]], True, False, 0]] * N)
check('macro-record scenario 2', solve([[['start', '', 10, False], ['down', 'A', 12, True], ['up', 'A', 13, True]]] * N), [[[], True, False, 0]] * N)
check('macro-record scenario 3', solve([[['start', '', 10, False], ['pause', '', 12, False], ['pause', '', 13, False], ['resume', '', 15, False], ['down', 'A', 16, False]]] * N), [[[['down', 'A', 3]], True, False, 3]] * N)
check('macro-record scenario 4', solve([[['start', '', 10, False], ['pause', '', 12, False], ['resume', '', 15, False], ['pause', '', 17, False], ['resume', '', 20, False], ['down', 'A', 21, False]]] * N), [[[['down', 'A', 5]], True, False, 6]] * N)
check('macro-record scenario 5', solve([[['start', '', 10, False], ['down', 'A', 11, False], ['start', '', 20, False]]] * N), [[[], True, False, 0]] * N)
check('macro-record scenario 6', solve([[['start', '', 10, False], ['pause', '', 12, False], ['resume', '', 15, False], ['start', '', 20, False], ['down', 'A', 21, False]]] * N), [[[['down', 'A', 1]], True, False, 0]] * N)
check('macro-record scenario 7', solve([[['start', '', 10, False], ['pause', '', 12, False], ['stop', '', 15, False], ['down', 'A', 16, False]]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 8', solve([[['pause', '', 10, False]]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 9', solve([[['start', '', 10, False], ['down', 'A', 11, False], ['up', 'A', 12, False], ['clear', '', 13, False]]] * N), [[[], True, False, 0]] * N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(cases):
    def run(c):
        recording=False; origin=0; paused=None; excluded=0; records=[]
        for kind,key,now,injected in c:
            if kind=='start':
                recording=True; origin=now; paused=None; excluded=0; records=[]
            elif kind=='pause' and recording and paused is None:
                paused=now
            elif kind=='resume' and recording and paused is not None:
                excluded+=now-paused
                paused=None
            elif kind=='stop': recording=False
            elif kind=='clear': records=[]
            elif kind in ('down','up') and recording and paused is None and not injected:
                records.append([kind,key,now-origin-excluded])
        return [records,recording,paused is not None,excluded]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('macro-record scenario 0', solve([[]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 1', solve([[['start', '', 10, False], ['down', 'A', 12, False], ['up', 'A', 13, False], ['text', 'A', 14, False]]] * N), [[[['down', 'A', 2], ['up', 'A', 3]], True, False, 0]] * N)
check('macro-record scenario 2', solve([[['start', '', 10, False], ['down', 'A', 12, True], ['up', 'A', 13, True]]] * N), [[[], True, False, 0]] * N)
check('macro-record scenario 3', solve([[['start', '', 10, False], ['pause', '', 12, False], ['pause', '', 13, False], ['resume', '', 15, False], ['down', 'A', 16, False]]] * N), [[[['down', 'A', 3]], True, False, 3]] * N)
check('macro-record scenario 4', solve([[['start', '', 10, False], ['pause', '', 12, False], ['resume', '', 15, False], ['pause', '', 17, False], ['resume', '', 20, False], ['down', 'A', 21, False]]] * N), [[[['down', 'A', 5]], True, False, 6]] * N)
check('macro-record scenario 5', solve([[['start', '', 10, False], ['down', 'A', 11, False], ['start', '', 20, False]]] * N), [[[], True, False, 0]] * N)
check('macro-record scenario 6', solve([[['start', '', 10, False], ['pause', '', 12, False], ['resume', '', 15, False], ['start', '', 20, False], ['down', 'A', 21, False]]] * N), [[[['down', 'A', 1]], True, False, 0]] * N)
check('macro-record scenario 7', solve([[['start', '', 10, False], ['pause', '', 12, False], ['stop', '', 15, False], ['down', 'A', 16, False]]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 8', solve([[['pause', '', 10, False]]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 9', solve([[['start', '', 10, False], ['down', 'A', 11, False], ['up', 'A', 12, False], ['clear', '', 13, False]]] * N), [[[], True, False, 0]] * N)
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 event trace violates the stop recording rule and produces incorrect keyboard state or command output.

Events [kind,key,time,injected]. Start resets capture and origin; physical down/up record relative active time; injected events are ignored. Pause freezes recording and resume excludes paused duration. Stop ends recording; clear erases recording. Return [kind,key,offset] records, recording flag, paused flag and excluded time. Ordered times and paired pause/resume. Inputs are finite ordered event traces; return the stated deterministic state. Batch entries are independent. N varies the number of independent input transactions.

split: open-access


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

N = 1
observations = []
def solve(cases):
    def run(c):
        recording=False; origin=0; paused=None; excluded=0; records=[]
        for kind,key,now,injected in c:
            if kind=='start':
                recording=True; origin=now; paused=None; excluded=0; records=[]
            elif kind=='pause' and recording and paused is None:
                paused=now
            elif kind=='resume' and recording and paused is not None:
                excluded+=now-paused
                paused=None
            elif kind=='stop': recording=False; paused=None
            elif kind=='clear': records=records[:-1]
            elif kind in ('down','up') and recording and paused is None and not injected:
                records.append([kind,key,now-origin-excluded])
        return [records,recording,paused is not None,excluded]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('macro-record scenario 0', solve([[]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 1', solve([[['start', '', 10, False], ['down', 'A', 12, False], ['up', 'A', 13, False], ['text', 'A', 14, False]]] * N), [[[['down', 'A', 2], ['up', 'A', 3]], True, False, 0]] * N)
check('macro-record scenario 2', solve([[['start', '', 10, False], ['down', 'A', 12, True], ['up', 'A', 13, True]]] * N), [[[], True, False, 0]] * N)
check('macro-record scenario 3', solve([[['start', '', 10, False], ['pause', '', 12, False], ['pause', '', 13, False], ['resume', '', 15, False], ['down', 'A', 16, False]]] * N), [[[['down', 'A', 3]], True, False, 3]] * N)
check('macro-record scenario 4', solve([[['start', '', 10, False], ['pause', '', 12, False], ['resume', '', 15, False], ['pause', '', 17, False], ['resume', '', 20, False], ['down', 'A', 21, False]]] * N), [[[['down', 'A', 5]], True, False, 6]] * N)
check('macro-record scenario 5', solve([[['start', '', 10, False], ['down', 'A', 11, False], ['start', '', 20, False]]] * N), [[[], True, False, 0]] * N)
check('macro-record scenario 6', solve([[['start', '', 10, False], ['pause', '', 12, False], ['resume', '', 15, False], ['start', '', 20, False], ['down', 'A', 21, False]]] * N), [[[['down', 'A', 1]], True, False, 0]] * N)
check('macro-record scenario 7', solve([[['start', '', 10, False], ['pause', '', 12, False], ['stop', '', 15, False], ['down', 'A', 16, False]]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 8', solve([[['pause', '', 10, False]]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 9', solve([[['start', '', 10, False], ['down', 'A', 11, False], ['up', 'A', 12, False], ['clear', '', 13, False]]] * N), [[[], True, False, 0]] * N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(cases):
    def run(c):
        recording=False; origin=0; paused=None; excluded=0; records=[]
        for kind,key,now,injected in c:
            if kind=='start':
                recording=True; origin=now; paused=None; excluded=0; records=[]
            elif kind=='pause' and recording and paused is None:
                paused=now
            elif kind=='resume' and recording and paused is not None:
                excluded+=now-paused
                paused=None
            elif kind=='stop': recording=False; paused=None
            elif kind=='clear': recording=False
            elif kind in ('down','up') and recording and paused is None and not injected:
                records.append([kind,key,now-origin-excluded])
        return [records,recording,paused is not None,excluded]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('macro-record scenario 0', solve([[]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 1', solve([[['start', '', 10, False], ['down', 'A', 12, False], ['up', 'A', 13, False], ['text', 'A', 14, False]]] * N), [[[['down', 'A', 2], ['up', 'A', 3]], True, False, 0]] * N)
check('macro-record scenario 2', solve([[['start', '', 10, False], ['down', 'A', 12, True], ['up', 'A', 13, True]]] * N), [[[], True, False, 0]] * N)
check('macro-record scenario 3', solve([[['start', '', 10, False], ['pause', '', 12, False], ['pause', '', 13, False], ['resume', '', 15, False], ['down', 'A', 16, False]]] * N), [[[['down', 'A', 3]], True, False, 3]] * N)
check('macro-record scenario 4', solve([[['start', '', 10, False], ['pause', '', 12, False], ['resume', '', 15, False], ['pause', '', 17, False], ['resume', '', 20, False], ['down', 'A', 21, False]]] * N), [[[['down', 'A', 5]], True, False, 6]] * N)
check('macro-record scenario 5', solve([[['start', '', 10, False], ['down', 'A', 11, False], ['start', '', 20, False]]] * N), [[[], True, False, 0]] * N)
check('macro-record scenario 6', solve([[['start', '', 10, False], ['pause', '', 12, False], ['resume', '', 15, False], ['start', '', 20, False], ['down', 'A', 21, False]]] * N), [[[['down', 'A', 1]], True, False, 0]] * N)
check('macro-record scenario 7', solve([[['start', '', 10, False], ['pause', '', 12, False], ['stop', '', 15, False], ['down', 'A', 16, False]]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 8', solve([[['pause', '', 10, False]]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 9', solve([[['start', '', 10, False], ['down', 'A', 11, False], ['up', 'A', 12, False], ['clear', '', 13, False]]] * N), [[[], True, False, 0]] * N)
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 event trace violates the clear records rule and produces incorrect keyboard state or command output.

Events [kind,key,time,injected]. Start resets capture and origin; physical down/up record relative active time; injected events are ignored. Pause freezes recording and resume excludes paused duration. Stop ends recording; clear erases recording. Return [kind,key,offset] records, recording flag, paused flag and excluded time. Ordered times and paired pause/resume. Inputs are finite ordered event traces; return the stated deterministic state. Batch entries are independent. N varies the number of independent input transactions.

split: open-access


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

N = 1
observations = []
def solve(cases):
    def run(c):
        recording=False; origin=0; paused=None; excluded=0; records=[]
        for kind,key,now,injected in c:
            if kind=='start':
                recording=True; origin=now; paused=None; excluded=0; records=[]
            elif kind=='pause' and recording and paused is None:
                paused=now
            elif kind=='resume' and recording and paused is not None:
                excluded+=now-paused
                paused=None
            elif kind=='stop': recording=False; paused=None
            elif kind=='clear': records=[]
            elif kind=='down' and recording and paused is None and not injected:
                records.append([kind,key,now-origin-excluded])
        return [records,recording,paused is not None,excluded]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('macro-record scenario 0', solve([[]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 1', solve([[['start', '', 10, False], ['down', 'A', 12, False], ['up', 'A', 13, False], ['text', 'A', 14, False]]] * N), [[[['down', 'A', 2], ['up', 'A', 3]], True, False, 0]] * N)
check('macro-record scenario 2', solve([[['start', '', 10, False], ['down', 'A', 12, True], ['up', 'A', 13, True]]] * N), [[[], True, False, 0]] * N)
check('macro-record scenario 3', solve([[['start', '', 10, False], ['pause', '', 12, False], ['pause', '', 13, False], ['resume', '', 15, False], ['down', 'A', 16, False]]] * N), [[[['down', 'A', 3]], True, False, 3]] * N)
check('macro-record scenario 4', solve([[['start', '', 10, False], ['pause', '', 12, False], ['resume', '', 15, False], ['pause', '', 17, False], ['resume', '', 20, False], ['down', 'A', 21, False]]] * N), [[[['down', 'A', 5]], True, False, 6]] * N)
check('macro-record scenario 5', solve([[['start', '', 10, False], ['down', 'A', 11, False], ['start', '', 20, False]]] * N), [[[], True, False, 0]] * N)
check('macro-record scenario 6', solve([[['start', '', 10, False], ['pause', '', 12, False], ['resume', '', 15, False], ['start', '', 20, False], ['down', 'A', 21, False]]] * N), [[[['down', 'A', 1]], True, False, 0]] * N)
check('macro-record scenario 7', solve([[['start', '', 10, False], ['pause', '', 12, False], ['stop', '', 15, False], ['down', 'A', 16, False]]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 8', solve([[['pause', '', 10, False]]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 9', solve([[['start', '', 10, False], ['down', 'A', 11, False], ['up', 'A', 12, False], ['clear', '', 13, False]]] * N), [[[], True, False, 0]] * N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(cases):
    def run(c):
        recording=False; origin=0; paused=None; excluded=0; records=[]
        for kind,key,now,injected in c:
            if kind=='start':
                recording=True; origin=now; paused=None; excluded=0; records=[]
            elif kind=='pause' and recording and paused is None:
                paused=now
            elif kind=='resume' and recording and paused is not None:
                excluded+=now-paused
                paused=None
            elif kind=='stop': recording=False; paused=None
            elif kind=='clear': records=[]
            elif kind in ('down','up','text') and recording and paused is None and not injected:
                records.append([kind,key,now-origin-excluded])
        return [records,recording,paused is not None,excluded]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('macro-record scenario 0', solve([[]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 1', solve([[['start', '', 10, False], ['down', 'A', 12, False], ['up', 'A', 13, False], ['text', 'A', 14, False]]] * N), [[[['down', 'A', 2], ['up', 'A', 3]], True, False, 0]] * N)
check('macro-record scenario 2', solve([[['start', '', 10, False], ['down', 'A', 12, True], ['up', 'A', 13, True]]] * N), [[[], True, False, 0]] * N)
check('macro-record scenario 3', solve([[['start', '', 10, False], ['pause', '', 12, False], ['pause', '', 13, False], ['resume', '', 15, False], ['down', 'A', 16, False]]] * N), [[[['down', 'A', 3]], True, False, 3]] * N)
check('macro-record scenario 4', solve([[['start', '', 10, False], ['pause', '', 12, False], ['resume', '', 15, False], ['pause', '', 17, False], ['resume', '', 20, False], ['down', 'A', 21, False]]] * N), [[[['down', 'A', 5]], True, False, 6]] * N)
check('macro-record scenario 5', solve([[['start', '', 10, False], ['down', 'A', 11, False], ['start', '', 20, False]]] * N), [[[], True, False, 0]] * N)
check('macro-record scenario 6', solve([[['start', '', 10, False], ['pause', '', 12, False], ['resume', '', 15, False], ['start', '', 20, False], ['down', 'A', 21, False]]] * N), [[[['down', 'A', 1]], True, False, 0]] * N)
check('macro-record scenario 7', solve([[['start', '', 10, False], ['pause', '', 12, False], ['stop', '', 15, False], ['down', 'A', 16, False]]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 8', solve([[['pause', '', 10, False]]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 9', solve([[['start', '', 10, False], ['down', 'A', 11, False], ['up', 'A', 12, False], ['clear', '', 13, False]]] * N), [[[], True, False, 0]] * N)
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 event trace violates the phase filter rule and produces incorrect keyboard state or command output.

Events [kind,key,time,injected]. Start resets capture and origin; physical down/up record relative active time; injected events are ignored. Pause freezes recording and resume excludes paused duration. Stop ends recording; clear erases recording. Return [kind,key,offset] records, recording flag, paused flag and excluded time. Ordered times and paired pause/resume. Inputs are finite ordered event traces; return the stated deterministic state. Batch entries are independent. N varies the number of independent input transactions.

split: open-access


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

N = 1
observations = []
def solve(cases):
    def run(c):
        recording=False; origin=0; paused=None; excluded=0; records=[]
        for kind,key,now,injected in c:
            if kind=='start':
                recording=True; origin=now; paused=None; excluded=0; records=[]
            elif kind=='pause' and recording and paused is None:
                paused=now
            elif kind=='resume' and recording and paused is not None:
                excluded+=now-paused
                paused=None
            elif kind=='stop': recording=False; paused=None
            elif kind=='clear': records=[]
            elif kind in ('down','up') and recording and paused is None and True:
                records.append([kind,key,now-origin-excluded])
        return [records,recording,paused is not None,excluded]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('macro-record scenario 0', solve([[]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 1', solve([[['start', '', 10, False], ['down', 'A', 12, False], ['up', 'A', 13, False], ['text', 'A', 14, False]]] * N), [[[['down', 'A', 2], ['up', 'A', 3]], True, False, 0]] * N)
check('macro-record scenario 2', solve([[['start', '', 10, False], ['down', 'A', 12, True], ['up', 'A', 13, True]]] * N), [[[], True, False, 0]] * N)
check('macro-record scenario 3', solve([[['start', '', 10, False], ['pause', '', 12, False], ['pause', '', 13, False], ['resume', '', 15, False], ['down', 'A', 16, False]]] * N), [[[['down', 'A', 3]], True, False, 3]] * N)
check('macro-record scenario 4', solve([[['start', '', 10, False], ['pause', '', 12, False], ['resume', '', 15, False], ['pause', '', 17, False], ['resume', '', 20, False], ['down', 'A', 21, False]]] * N), [[[['down', 'A', 5]], True, False, 6]] * N)
check('macro-record scenario 5', solve([[['start', '', 10, False], ['down', 'A', 11, False], ['start', '', 20, False]]] * N), [[[], True, False, 0]] * N)
check('macro-record scenario 6', solve([[['start', '', 10, False], ['pause', '', 12, False], ['resume', '', 15, False], ['start', '', 20, False], ['down', 'A', 21, False]]] * N), [[[['down', 'A', 1]], True, False, 0]] * N)
check('macro-record scenario 7', solve([[['start', '', 10, False], ['pause', '', 12, False], ['stop', '', 15, False], ['down', 'A', 16, False]]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 8', solve([[['pause', '', 10, False]]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 9', solve([[['start', '', 10, False], ['down', 'A', 11, False], ['up', 'A', 12, False], ['clear', '', 13, False]]] * N), [[[], True, False, 0]] * N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(cases):
    def run(c):
        recording=False; origin=0; paused=None; excluded=0; records=[]
        for kind,key,now,injected in c:
            if kind=='start':
                recording=True; origin=now; paused=None; excluded=0; records=[]
            elif kind=='pause' and recording and paused is None:
                paused=now
            elif kind=='resume' and recording and paused is not None:
                excluded+=now-paused
                paused=None
            elif kind=='stop': recording=False; paused=None
            elif kind=='clear': records=[]
            elif kind in ('down','up') and recording and paused is None and (not injected or kind=="up"):
                records.append([kind,key,now-origin-excluded])
        return [records,recording,paused is not None,excluded]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('macro-record scenario 0', solve([[]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 1', solve([[['start', '', 10, False], ['down', 'A', 12, False], ['up', 'A', 13, False], ['text', 'A', 14, False]]] * N), [[[['down', 'A', 2], ['up', 'A', 3]], True, False, 0]] * N)
check('macro-record scenario 2', solve([[['start', '', 10, False], ['down', 'A', 12, True], ['up', 'A', 13, True]]] * N), [[[], True, False, 0]] * N)
check('macro-record scenario 3', solve([[['start', '', 10, False], ['pause', '', 12, False], ['pause', '', 13, False], ['resume', '', 15, False], ['down', 'A', 16, False]]] * N), [[[['down', 'A', 3]], True, False, 3]] * N)
check('macro-record scenario 4', solve([[['start', '', 10, False], ['pause', '', 12, False], ['resume', '', 15, False], ['pause', '', 17, False], ['resume', '', 20, False], ['down', 'A', 21, False]]] * N), [[[['down', 'A', 5]], True, False, 6]] * N)
check('macro-record scenario 5', solve([[['start', '', 10, False], ['down', 'A', 11, False], ['start', '', 20, False]]] * N), [[[], True, False, 0]] * N)
check('macro-record scenario 6', solve([[['start', '', 10, False], ['pause', '', 12, False], ['resume', '', 15, False], ['start', '', 20, False], ['down', 'A', 21, False]]] * N), [[[['down', 'A', 1]], True, False, 0]] * N)
check('macro-record scenario 7', solve([[['start', '', 10, False], ['pause', '', 12, False], ['stop', '', 15, False], ['down', 'A', 16, False]]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 8', solve([[['pause', '', 10, False]]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 9', solve([[['start', '', 10, False], ['down', 'A', 11, False], ['up', 'A', 12, False], ['clear', '', 13, False]]] * N), [[[], True, False, 0]] * N)
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 event trace violates the injection filter rule and produces incorrect keyboard state or command output.

Events [kind,key,time,injected]. Start resets capture and origin; physical down/up record relative active time; injected events are ignored. Pause freezes recording and resume excludes paused duration. Stop ends recording; clear erases recording. Return [kind,key,offset] records, recording flag, paused flag and excluded time. Ordered times and paired pause/resume. Inputs are finite ordered event traces; return the stated deterministic state. Batch entries are independent. N varies the number of independent input transactions.

split: open-access


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

N = 1
observations = []
def solve(cases):
    def run(c):
        recording=False; origin=0; paused=None; excluded=0; records=[]
        for kind,key,now,injected in c:
            if kind=='start':
                recording=True; origin=now; paused=None; excluded=0; records=[]
            elif kind=='pause' and recording and paused is None:
                paused=now
            elif kind=='resume' and recording and paused is not None:
                excluded+=now-paused
                paused=None
            elif kind=='stop': recording=False; paused=None
            elif kind=='clear': records=[]
            elif kind in ('down','up') and recording and paused is None and not injected:
                records.append([kind,key,now-origin])
        return [records,recording,paused is not None,excluded]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('macro-record scenario 0', solve([[]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 1', solve([[['start', '', 10, False], ['down', 'A', 12, False], ['up', 'A', 13, False], ['text', 'A', 14, False]]] * N), [[[['down', 'A', 2], ['up', 'A', 3]], True, False, 0]] * N)
check('macro-record scenario 2', solve([[['start', '', 10, False], ['down', 'A', 12, True], ['up', 'A', 13, True]]] * N), [[[], True, False, 0]] * N)
check('macro-record scenario 3', solve([[['start', '', 10, False], ['pause', '', 12, False], ['pause', '', 13, False], ['resume', '', 15, False], ['down', 'A', 16, False]]] * N), [[[['down', 'A', 3]], True, False, 3]] * N)
check('macro-record scenario 4', solve([[['start', '', 10, False], ['pause', '', 12, False], ['resume', '', 15, False], ['pause', '', 17, False], ['resume', '', 20, False], ['down', 'A', 21, False]]] * N), [[[['down', 'A', 5]], True, False, 6]] * N)
check('macro-record scenario 5', solve([[['start', '', 10, False], ['down', 'A', 11, False], ['start', '', 20, False]]] * N), [[[], True, False, 0]] * N)
check('macro-record scenario 6', solve([[['start', '', 10, False], ['pause', '', 12, False], ['resume', '', 15, False], ['start', '', 20, False], ['down', 'A', 21, False]]] * N), [[[['down', 'A', 1]], True, False, 0]] * N)
check('macro-record scenario 7', solve([[['start', '', 10, False], ['pause', '', 12, False], ['stop', '', 15, False], ['down', 'A', 16, False]]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 8', solve([[['pause', '', 10, False]]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 9', solve([[['start', '', 10, False], ['down', 'A', 11, False], ['up', 'A', 12, False], ['clear', '', 13, False]]] * N), [[[], True, False, 0]] * N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(cases):
    def run(c):
        recording=False; origin=0; paused=None; excluded=0; records=[]
        for kind,key,now,injected in c:
            if kind=='start':
                recording=True; origin=now; paused=None; excluded=0; records=[]
            elif kind=='pause' and recording and paused is None:
                paused=now
            elif kind=='resume' and recording and paused is not None:
                excluded+=now-paused
                paused=None
            elif kind=='stop': recording=False; paused=None
            elif kind=='clear': records=[]
            elif kind in ('down','up') and recording and paused is None and not injected:
                records.append([kind,key,now-excluded])
        return [records,recording,paused is not None,excluded]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('macro-record scenario 0', solve([[]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 1', solve([[['start', '', 10, False], ['down', 'A', 12, False], ['up', 'A', 13, False], ['text', 'A', 14, False]]] * N), [[[['down', 'A', 2], ['up', 'A', 3]], True, False, 0]] * N)
check('macro-record scenario 2', solve([[['start', '', 10, False], ['down', 'A', 12, True], ['up', 'A', 13, True]]] * N), [[[], True, False, 0]] * N)
check('macro-record scenario 3', solve([[['start', '', 10, False], ['pause', '', 12, False], ['pause', '', 13, False], ['resume', '', 15, False], ['down', 'A', 16, False]]] * N), [[[['down', 'A', 3]], True, False, 3]] * N)
check('macro-record scenario 4', solve([[['start', '', 10, False], ['pause', '', 12, False], ['resume', '', 15, False], ['pause', '', 17, False], ['resume', '', 20, False], ['down', 'A', 21, False]]] * N), [[[['down', 'A', 5]], True, False, 6]] * N)
check('macro-record scenario 5', solve([[['start', '', 10, False], ['down', 'A', 11, False], ['start', '', 20, False]]] * N), [[[], True, False, 0]] * N)
check('macro-record scenario 6', solve([[['start', '', 10, False], ['pause', '', 12, False], ['resume', '', 15, False], ['start', '', 20, False], ['down', 'A', 21, False]]] * N), [[[['down', 'A', 1]], True, False, 0]] * N)
check('macro-record scenario 7', solve([[['start', '', 10, False], ['pause', '', 12, False], ['stop', '', 15, False], ['down', 'A', 16, False]]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 8', solve([[['pause', '', 10, False]]] * N), [[[], False, False, 0]] * N)
check('macro-record scenario 9', solve([[['start', '', 10, False], ['down', 'A', 11, False], ['up', 'A', 12, False], ['clear', '', 13, False]]] * N), [[[], True, False, 0]] * N)
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 event trace violates the active offset rule and produces incorrect keyboard state or command output.

Events [kind,key,time,injected]. Start resets capture and origin; physical down/up record relative active time; injected events are ignored. Pause freezes recording and resume excludes paused duration. Stop ends recording; clear erases recording. Return [kind,key,offset] records, recording flag, paused flag and excluded time. Ordered times and paired pause/resume. Inputs are finite ordered event traces; return the stated deterministic state. Batch entries are independent. N varies the number of independent input transactions.

split: open-access


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

N = 1
observations = []
def solve(cases):
    def run(c):
        records,start,num,den,loops,gap=c
        out=[]
        duration=(records[-1][2]*num//den) if records else 0
        for cycle in range(loops):
            base=start+cycle*(duration+gap)
            held=set()
            for kind,key,offset in records:
                due=base+offset*den//num
                if kind=='down': held.add(key)
                elif kind=='up': held.discard(key)
                out.append([kind,key,due])
            for key in sorted(held):
                out.append(['up',key,base+duration])
        return out
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('macro-play scenario 0', solve([[[], 10, 1, 1, 0, 2]] * N), [[]] * N)
check('macro-play scenario 1', solve([[[], 10, 1, 1, 2, 2]] * N), [[]] * N)
check('macro-play scenario 2', solve([[[['down', 'A', 0], ['up', 'A', 3]], 10, 2, 1, 2, 4]] * N), [[['down', 'A', 10], ['up', 'A', 11], ['down', 'A', 15], ['up', 'A', 16]]] * N)
check('macro-play scenario 3', solve([[[['up', 'A', 0]], 10, 1, 1, 1, 2]] * N), [[['up', 'A', 10]]] * N)
check('macro-play scenario 4', solve([[[['down', 'A', 0], ['down', 'B', 1]], 10, 1, 1, 2, 2]] * N), [[['down', 'A', 10], ['down', 'B', 11], ['up', 'A', 11], ['up', 'B', 11], ['down', 'A', 13], ['down', 'B', 14], ['up', 'A', 14], ['up', 'B', 14]]] * N)
check('macro-play scenario 5', solve([[[['down', 'A', 0], ['down', 'A', 1]], 10, 1, 1, 1, 2]] * N), [[['down', 'A', 10], ['down', 'A', 11], ['up', 'A', 11]]] * N)
check('macro-play scenario 6', solve([[[['down', 'A', 0], ['down', 'B', 1], ['up', 'A', 2]], 10, 1, 1, 1, 2]] * N), [[['down', 'A', 10], ['down', 'B', 11], ['up', 'A', 12], ['up', 'B', 12]]] * N)
check('macro-play scenario 7', solve([[[['down', 'A', 1], ['up', 'A', 5]], 10, 3, 2, 2, 2]] * N), [[['down', 'A', 10], ['up', 'A', 13], ['down', 'A', 15], ['up', 'A', 18]]] * N)
check('macro-play scenario 8', solve([[[['down', 'A', 0], ['up', 'A', 2]], 10, 1, 1, 0, 2]] * N), [[]] * N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(cases):
    def run(c):
        records,start,num,den,loops,gap=c
        out=[]
        duration=(records[-1][2]) if records else 0
        for cycle in range(loops):
            base=start+cycle*(duration+gap)
            held=set()
            for kind,key,offset in records:
                due=base+offset*den//num
                if kind=='down': held.add(key)
                elif kind=='up': held.discard(key)
                out.append([kind,key,due])
            for key in sorted(held):
                out.append(['up',key,base+duration])
        return out
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('macro-play scenario 0', solve([[[], 10, 1, 1, 0, 2]] * N), [[]] * N)
check('macro-play scenario 1', solve([[[], 10, 1, 1, 2, 2]] * N), [[]] * N)
check('macro-play scenario 2', solve([[[['down', 'A', 0], ['up', 'A', 3]], 10, 2, 1, 2, 4]] * N), [[['down', 'A', 10], ['up', 'A', 11], ['down', 'A', 15], ['up', 'A', 16]]] * N)
check('macro-play scenario 3', solve([[[['up', 'A', 0]], 10, 1, 1, 1, 2]] * N), [[['up', 'A', 10]]] * N)
check('macro-play scenario 4', solve([[[['down', 'A', 0], ['down', 'B', 1]], 10, 1, 1, 2, 2]] * N), [[['down', 'A', 10], ['down', 'B', 11], ['up', 'A', 11], ['up', 'B', 11], ['down', 'A', 13], ['down', 'B', 14], ['up', 'A', 14], ['up', 'B', 14]]] * N)
check('macro-play scenario 5', solve([[[['down', 'A', 0], ['down', 'A', 1]], 10, 1, 1, 1, 2]] * N), [[['down', 'A', 10], ['down', 'A', 11], ['up', 'A', 11]]] * N)
check('macro-play scenario 6', solve([[[['down', 'A', 0], ['down', 'B', 1], ['up', 'A', 2]], 10, 1, 1, 1, 2]] * N), [[['down', 'A', 10], ['down', 'B', 11], ['up', 'A', 12], ['up', 'B', 12]]] * N)
check('macro-play scenario 7', solve([[[['down', 'A', 1], ['up', 'A', 5]], 10, 3, 2, 2, 2]] * N), [[['down', 'A', 10], ['up', 'A', 13], ['down', 'A', 15], ['up', 'A', 18]]] * N)
check('macro-play scenario 8', solve([[[['down', 'A', 0], ['up', 'A', 2]], 10, 1, 1, 0, 2]] * N), [[]] * N)
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 event trace violates the duration scale rule and produces incorrect keyboard state or command output.

Case [records,start,rate_num,rate_den,loops,gap]. Records [kind,key,offset] have ordered nonnegative integer offsets. Positive rational playback speed scales deadlines by floor(offset*den/num). Repeat cycles start after scaled final offset plus gap. End of each cycle synthesizes releases for remaining held keys in sorted order. Return emitted [kind,key,deadline] records. Loops nonnegative; gap positive. Inputs are finite ordered event traces; return the stated deterministic state. Batch entries are independent. N varies the number of independent input transactions.

split: open-access


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

N = 1
observations = []
def solve(cases):
    def run(c):
        records,start,num,den,loops,gap=c
        out=[]
        duration=(records[-1][2]*den//num) if records else 0
        for cycle in range(loops+1):
            base=start+cycle*(duration+gap)
            held=set()
            for kind,key,offset in records:
                due=base+offset*den//num
                if kind=='down': held.add(key)
                elif kind=='up': held.discard(key)
                out.append([kind,key,due])
            for key in sorted(held):
                out.append(['up',key,base+duration])
        return out
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('macro-play scenario 0', solve([[[], 10, 1, 1, 0, 2]] * N), [[]] * N)
check('macro-play scenario 1', solve([[[], 10, 1, 1, 2, 2]] * N), [[]] * N)
check('macro-play scenario 2', solve([[[['down', 'A', 0], ['up', 'A', 3]], 10, 2, 1, 2, 4]] * N), [[['down', 'A', 10], ['up', 'A', 11], ['down', 'A', 15], ['up', 'A', 16]]] * N)
check('macro-play scenario 3', solve([[[['up', 'A', 0]], 10, 1, 1, 1, 2]] * N), [[['up', 'A', 10]]] * N)
check('macro-play scenario 4', solve([[[['down', 'A', 0], ['down', 'B', 1]], 10, 1, 1, 2, 2]] * N), [[['down', 'A', 10], ['down', 'B', 11], ['up', 'A', 11], ['up', 'B', 11], ['down', 'A', 13], ['down', 'B', 14], ['up', 'A', 14], ['up', 'B', 14]]] * N)
check('macro-play scenario 5', solve([[[['down', 'A', 0], ['down', 'A', 1]], 10, 1, 1, 1, 2]] * N), [[['down', 'A', 10], ['down', 'A', 11], ['up', 'A', 11]]] * N)
check('macro-play scenario 6', solve([[[['down', 'A', 0], ['down', 'B', 1], ['up', 'A', 2]], 10, 1, 1, 1, 2]] * N), [[['down', 'A', 10], ['down', 'B', 11], ['up', 'A', 12], ['up', 'B', 12]]] * N)
check('macro-play scenario 7', solve([[[['down', 'A', 1], ['up', 'A', 5]], 10, 3, 2, 2, 2]] * N), [[['down', 'A', 10], ['up', 'A', 13], ['down', 'A', 15], ['up', 'A', 18]]] * N)
check('macro-play scenario 8', solve([[[['down', 'A', 0], ['up', 'A', 2]], 10, 1, 1, 0, 2]] * N), [[]] * N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(cases):
    def run(c):
        records,start,num,den,loops,gap=c
        out=[]
        duration=(records[-1][2]*den//num) if records else 0
        for cycle in range(1,loops):
            base=start+cycle*(duration+gap)
            held=set()
            for kind,key,offset in records:
                due=base+offset*den//num
                if kind=='down': held.add(key)
                elif kind=='up': held.discard(key)
                out.append([kind,key,due])
            for key in sorted(held):
                out.append(['up',key,base+duration])
        return out
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('macro-play scenario 0', solve([[[], 10, 1, 1, 0, 2]] * N), [[]] * N)
check('macro-play scenario 1', solve([[[], 10, 1, 1, 2, 2]] * N), [[]] * N)
check('macro-play scenario 2', solve([[[['down', 'A', 0], ['up', 'A', 3]], 10, 2, 1, 2, 4]] * N), [[['down', 'A', 10], ['up', 'A', 11], ['down', 'A', 15], ['up', 'A', 16]]] * N)
check('macro-play scenario 3', solve([[[['up', 'A', 0]], 10, 1, 1, 1, 2]] * N), [[['up', 'A', 10]]] * N)
check('macro-play scenario 4', solve([[[['down', 'A', 0], ['down', 'B', 1]], 10, 1, 1, 2, 2]] * N), [[['down', 'A', 10], ['down', 'B', 11], ['up', 'A', 11], ['up', 'B', 11], ['down', 'A', 13], ['down', 'B', 14], ['up', 'A', 14], ['up', 'B', 14]]] * N)
check('macro-play scenario 5', solve([[[['down', 'A', 0], ['down', 'A', 1]], 10, 1, 1, 1, 2]] * N), [[['down', 'A', 10], ['down', 'A', 11], ['up', 'A', 11]]] * N)
check('macro-play scenario 6', solve([[[['down', 'A', 0], ['down', 'B', 1], ['up', 'A', 2]], 10, 1, 1, 1, 2]] * N), [[['down', 'A', 10], ['down', 'B', 11], ['up', 'A', 12], ['up', 'B', 12]]] * N)
check('macro-play scenario 7', solve([[[['down', 'A', 1], ['up', 'A', 5]], 10, 3, 2, 2, 2]] * N), [[['down', 'A', 10], ['up', 'A', 13], ['down', 'A', 15], ['up', 'A', 18]]] * N)
check('macro-play scenario 8', solve([[[['down', 'A', 0], ['up', 'A', 2]], 10, 1, 1, 0, 2]] * N), [[]] * N)
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 event trace violates the loop count rule and produces incorrect keyboard state or command output.

Case [records,start,rate_num,rate_den,loops,gap]. Records [kind,key,offset] have ordered nonnegative integer offsets. Positive rational playback speed scales deadlines by floor(offset*den/num). Repeat cycles start after scaled final offset plus gap. End of each cycle synthesizes releases for remaining held keys in sorted order. Return emitted [kind,key,deadline] records. Loops nonnegative; gap positive. Inputs are finite ordered event traces; return the stated deterministic state. Batch entries are independent. N varies the number of independent input transactions.

split: open-access


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

N = 1
observations = []
def solve(cases):
    def run(c):
        records,start,num,den,loops,gap=c
        out=[]
        duration=(records[-1][2]*den//num) if records else 0
        for cycle in range(loops):
            base=start+cycle*duration
            held=set()
            for kind,key,offset in records:
                due=base+offset*den//num
                if kind=='down': held.add(key)
                elif kind=='up': held.discard(key)
                out.append([kind,key,due])
            for key in sorted(held):
                out.append(['up',key,base+duration])
        return out
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('macro-play scenario 0', solve([[[], 10, 1, 1, 0, 2]] * N), [[]] * N)
check('macro-play scenario 1', solve([[[], 10, 1, 1, 2, 2]] * N), [[]] * N)
check('macro-play scenario 2', solve([[[['down', 'A', 0], ['up', 'A', 3]], 10, 2, 1, 2, 4]] * N), [[['down', 'A', 10], ['up', 'A', 11], ['down', 'A', 15], ['up', 'A', 16]]] * N)
check('macro-play scenario 3', solve([[[['up', 'A', 0]], 10, 1, 1, 1, 2]] * N), [[['up', 'A', 10]]] * N)
check('macro-play scenario 4', solve([[[['down', 'A', 0], ['down', 'B', 1]], 10, 1, 1, 2, 2]] * N), [[['down', 'A', 10], ['down', 'B', 11], ['up', 'A', 11], ['up', 'B', 11], ['down', 'A', 13], ['down', 'B', 14], ['up', 'A', 14], ['up', 'B', 14]]] * N)
check('macro-play scenario 5', solve([[[['down', 'A', 0], ['down', 'A', 1]], 10, 1, 1, 1, 2]] * N), [[['down', 'A', 10], ['down', 'A', 11], ['up', 'A', 11]]] * N)
check('macro-play scenario 6', solve([[[['down', 'A', 0], ['down', 'B', 1], ['up', 'A', 2]], 10, 1, 1, 1, 2]] * N), [[['down', 'A', 10], ['down', 'B', 11], ['up', 'A', 12], ['up', 'B', 12]]] * N)
check('macro-play scenario 7', solve([[[['down', 'A', 1], ['up', 'A', 5]], 10, 3, 2, 2, 2]] * N), [[['down', 'A', 10], ['up', 'A', 13], ['down', 'A', 15], ['up', 'A', 18]]] * N)
check('macro-play scenario 8', solve([[[['down', 'A', 0], ['up', 'A', 2]], 10, 1, 1, 0, 2]] * N), [[]] * N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(cases):
    def run(c):
        records,start,num,den,loops,gap=c
        out=[]
        duration=(records[-1][2]*den//num) if records else 0
        for cycle in range(loops):
            base=start+cycle*gap
            held=set()
            for kind,key,offset in records:
                due=base+offset*den//num
                if kind=='down': held.add(key)
                elif kind=='up': held.discard(key)
                out.append([kind,key,due])
            for key in sorted(held):
                out.append(['up',key,base+duration])
        return out
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('macro-play scenario 0', solve([[[], 10, 1, 1, 0, 2]] * N), [[]] * N)
check('macro-play scenario 1', solve([[[], 10, 1, 1, 2, 2]] * N), [[]] * N)
check('macro-play scenario 2', solve([[[['down', 'A', 0], ['up', 'A', 3]], 10, 2, 1, 2, 4]] * N), [[['down', 'A', 10], ['up', 'A', 11], ['down', 'A', 15], ['up', 'A', 16]]] * N)
check('macro-play scenario 3', solve([[[['up', 'A', 0]], 10, 1, 1, 1, 2]] * N), [[['up', 'A', 10]]] * N)
check('macro-play scenario 4', solve([[[['down', 'A', 0], ['down', 'B', 1]], 10, 1, 1, 2, 2]] * N), [[['down', 'A', 10], ['down', 'B', 11], ['up', 'A', 11], ['up', 'B', 11], ['down', 'A', 13], ['down', 'B', 14], ['up', 'A', 14], ['up', 'B', 14]]] * N)
check('macro-play scenario 5', solve([[[['down', 'A', 0], ['down', 'A', 1]], 10, 1, 1, 1, 2]] * N), [[['down', 'A', 10], ['down', 'A', 11], ['up', 'A', 11]]] * N)
check('macro-play scenario 6', solve([[[['down', 'A', 0], ['down', 'B', 1], ['up', 'A', 2]], 10, 1, 1, 1, 2]] * N), [[['down', 'A', 10], ['down', 'B', 11], ['up', 'A', 12], ['up', 'B', 12]]] * N)
check('macro-play scenario 7', solve([[[['down', 'A', 1], ['up', 'A', 5]], 10, 3, 2, 2, 2]] * N), [[['down', 'A', 10], ['up', 'A', 13], ['down', 'A', 15], ['up', 'A', 18]]] * N)
check('macro-play scenario 8', solve([[[['down', 'A', 0], ['up', 'A', 2]], 10, 1, 1, 0, 2]] * N), [[]] * N)
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 event trace violates the cycle origin rule and produces incorrect keyboard state or command output.

Case [records,start,rate_num,rate_den,loops,gap]. Records [kind,key,offset] have ordered nonnegative integer offsets. Positive rational playback speed scales deadlines by floor(offset*den/num). Repeat cycles start after scaled final offset plus gap. End of each cycle synthesizes releases for remaining held keys in sorted order. Return emitted [kind,key,deadline] records. Loops nonnegative; gap positive. Inputs are finite ordered event traces; return the stated deterministic state. Batch entries are independent. N varies the number of independent input transactions.

split: open-access


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

N = 1
observations = []
def solve(cases):
    def run(c):
        records,start,num,den,loops,gap=c
        out=[]
        duration=(records[-1][2]*den//num) if records else 0
        for cycle in range(loops):
            base=start+cycle*(duration+gap)
            held=set()
            for kind,key,offset in records:
                due=base+offset*den//num
                if kind=='down': held.add(key)
                elif kind=='up': held.discard(key)
                out.append([kind,key,due])
            for key in sorted(held,reverse=True):
                out.append(['up',key,base+duration])
        return out
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('macro-play scenario 0', solve([[[], 10, 1, 1, 0, 2]] * N), [[]] * N)
check('macro-play scenario 1', solve([[[], 10, 1, 1, 2, 2]] * N), [[]] * N)
check('macro-play scenario 2', solve([[[['down', 'A', 0], ['up', 'A', 3]], 10, 2, 1, 2, 4]] * N), [[['down', 'A', 10], ['up', 'A', 11], ['down', 'A', 15], ['up', 'A', 16]]] * N)
check('macro-play scenario 3', solve([[[['up', 'A', 0]], 10, 1, 1, 1, 2]] * N), [[['up', 'A', 10]]] * N)
check('macro-play scenario 4', solve([[[['down', 'A', 0], ['down', 'B', 1]], 10, 1, 1, 2, 2]] * N), [[['down', 'A', 10], ['down', 'B', 11], ['up', 'A', 11], ['up', 'B', 11], ['down', 'A', 13], ['down', 'B', 14], ['up', 'A', 14], ['up', 'B', 14]]] * N)
check('macro-play scenario 5', solve([[[['down', 'A', 0], ['down', 'A', 1]], 10, 1, 1, 1, 2]] * N), [[['down', 'A', 10], ['down', 'A', 11], ['up', 'A', 11]]] * N)
check('macro-play scenario 6', solve([[[['down', 'A', 0], ['down', 'B', 1], ['up', 'A', 2]], 10, 1, 1, 1, 2]] * N), [[['down', 'A', 10], ['down', 'B', 11], ['up', 'A', 12], ['up', 'B', 12]]] * N)
check('macro-play scenario 7', solve([[[['down', 'A', 1], ['up', 'A', 5]], 10, 3, 2, 2, 2]] * N), [[['down', 'A', 10], ['up', 'A', 13], ['down', 'A', 15], ['up', 'A', 18]]] * N)
check('macro-play scenario 8', solve([[[['down', 'A', 0], ['up', 'A', 2]], 10, 1, 1, 0, 2]] * N), [[]] * N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(cases):
    def run(c):
        records,start,num,den,loops,gap=c
        out=[]
        duration=(records[-1][2]*den//num) if records else 0
        for cycle in range(loops):
            base=start+cycle*(duration+gap)
            held=set()
            for kind,key,offset in records:
                due=base+offset*den//num
                if kind=='down': held.add(key)
                elif kind=='up': held.discard(key)
                out.append([kind,key,due])
            for key in sorted(held)[:1]:
                out.append(['up',key,base+duration])
        return out
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('macro-play scenario 0', solve([[[], 10, 1, 1, 0, 2]] * N), [[]] * N)
check('macro-play scenario 1', solve([[[], 10, 1, 1, 2, 2]] * N), [[]] * N)
check('macro-play scenario 2', solve([[[['down', 'A', 0], ['up', 'A', 3]], 10, 2, 1, 2, 4]] * N), [[['down', 'A', 10], ['up', 'A', 11], ['down', 'A', 15], ['up', 'A', 16]]] * N)
check('macro-play scenario 3', solve([[[['up', 'A', 0]], 10, 1, 1, 1, 2]] * N), [[['up', 'A', 10]]] * N)
check('macro-play scenario 4', solve([[[['down', 'A', 0], ['down', 'B', 1]], 10, 1, 1, 2, 2]] * N), [[['down', 'A', 10], ['down', 'B', 11], ['up', 'A', 11], ['up', 'B', 11], ['down', 'A', 13], ['down', 'B', 14], ['up', 'A', 14], ['up', 'B', 14]]] * N)
check('macro-play scenario 5', solve([[[['down', 'A', 0], ['down', 'A', 1]], 10, 1, 1, 1, 2]] * N), [[['down', 'A', 10], ['down', 'A', 11], ['up', 'A', 11]]] * N)
check('macro-play scenario 6', solve([[[['down', 'A', 0], ['down', 'B', 1], ['up', 'A', 2]], 10, 1, 1, 1, 2]] * N), [[['down', 'A', 10], ['down', 'B', 11], ['up', 'A', 12], ['up', 'B', 12]]] * N)
check('macro-play scenario 7', solve([[[['down', 'A', 1], ['up', 'A', 5]], 10, 3, 2, 2, 2]] * N), [[['down', 'A', 10], ['up', 'A', 13], ['down', 'A', 15], ['up', 'A', 18]]] * N)
check('macro-play scenario 8', solve([[[['down', 'A', 0], ['up', 'A', 2]], 10, 1, 1, 0, 2]] * N), [[]] * N)
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 event trace violates the cleanup order rule and produces incorrect keyboard state or command output.

Case [records,start,rate_num,rate_den,loops,gap]. Records [kind,key,offset] have ordered nonnegative integer offsets. Positive rational playback speed scales deadlines by floor(offset*den/num). Repeat cycles start after scaled final offset plus gap. End of each cycle synthesizes releases for remaining held keys in sorted order. Return emitted [kind,key,deadline] records. Loops nonnegative; gap positive. Inputs are finite ordered event traces; return the stated deterministic state. Batch entries are independent. N varies the number of independent input transactions.

split: open-access


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

N = 1
observations = []
def solve(cases):
    def run(c):
        records,start,num,den,loops,gap=c
        out=[]
        duration=(records[-1][2]*den//num) if records else 0
        for cycle in range(loops):
            base=start+cycle*(duration+gap)
            held=set()
            for kind,key,offset in records:
                due=base+offset*num//den
                if kind=='down': held.add(key)
                elif kind=='up': held.discard(key)
                out.append([kind,key,due])
            for key in sorted(held):
                out.append(['up',key,base+duration])
        return out
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('macro-play scenario 0', solve([[[], 10, 1, 1, 0, 2]] * N), [[]] * N)
check('macro-play scenario 1', solve([[[], 10, 1, 1, 2, 2]] * N), [[]] * N)
check('macro-play scenario 2', solve([[[['down', 'A', 0], ['up', 'A', 3]], 10, 2, 1, 2, 4]] * N), [[['down', 'A', 10], ['up', 'A', 11], ['down', 'A', 15], ['up', 'A', 16]]] * N)
check('macro-play scenario 3', solve([[[['up', 'A', 0]], 10, 1, 1, 1, 2]] * N), [[['up', 'A', 10]]] * N)
check('macro-play scenario 4', solve([[[['down', 'A', 0], ['down', 'B', 1]], 10, 1, 1, 2, 2]] * N), [[['down', 'A', 10], ['down', 'B', 11], ['up', 'A', 11], ['up', 'B', 11], ['down', 'A', 13], ['down', 'B', 14], ['up', 'A', 14], ['up', 'B', 14]]] * N)
check('macro-play scenario 5', solve([[[['down', 'A', 0], ['down', 'A', 1]], 10, 1, 1, 1, 2]] * N), [[['down', 'A', 10], ['down', 'A', 11], ['up', 'A', 11]]] * N)
check('macro-play scenario 6', solve([[[['down', 'A', 0], ['down', 'B', 1], ['up', 'A', 2]], 10, 1, 1, 1, 2]] * N), [[['down', 'A', 10], ['down', 'B', 11], ['up', 'A', 12], ['up', 'B', 12]]] * N)
check('macro-play scenario 7', solve([[[['down', 'A', 1], ['up', 'A', 5]], 10, 3, 2, 2, 2]] * N), [[['down', 'A', 10], ['up', 'A', 13], ['down', 'A', 15], ['up', 'A', 18]]] * N)
check('macro-play scenario 8', solve([[[['down', 'A', 0], ['up', 'A', 2]], 10, 1, 1, 0, 2]] * N), [[]] * N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(cases):
    def run(c):
        records,start,num,den,loops,gap=c
        out=[]
        duration=(records[-1][2]*den//num) if records else 0
        for cycle in range(loops):
            base=start+cycle*(duration+gap)
            held=set()
            for kind,key,offset in records:
                due=(base+offset)*den//num
                if kind=='down': held.add(key)
                elif kind=='up': held.discard(key)
                out.append([kind,key,due])
            for key in sorted(held):
                out.append(['up',key,base+duration])
        return out
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('macro-play scenario 0', solve([[[], 10, 1, 1, 0, 2]] * N), [[]] * N)
check('macro-play scenario 1', solve([[[], 10, 1, 1, 2, 2]] * N), [[]] * N)
check('macro-play scenario 2', solve([[[['down', 'A', 0], ['up', 'A', 3]], 10, 2, 1, 2, 4]] * N), [[['down', 'A', 10], ['up', 'A', 11], ['down', 'A', 15], ['up', 'A', 16]]] * N)
check('macro-play scenario 3', solve([[[['up', 'A', 0]], 10, 1, 1, 1, 2]] * N), [[['up', 'A', 10]]] * N)
check('macro-play scenario 4', solve([[[['down', 'A', 0], ['down', 'B', 1]], 10, 1, 1, 2, 2]] * N), [[['down', 'A', 10], ['down', 'B', 11], ['up', 'A', 11], ['up', 'B', 11], ['down', 'A', 13], ['down', 'B', 14], ['up', 'A', 14], ['up', 'B', 14]]] * N)
check('macro-play scenario 5', solve([[[['down', 'A', 0], ['down', 'A', 1]], 10, 1, 1, 1, 2]] * N), [[['down', 'A', 10], ['down', 'A', 11], ['up', 'A', 11]]] * N)
check('macro-play scenario 6', solve([[[['down', 'A', 0], ['down', 'B', 1], ['up', 'A', 2]], 10, 1, 1, 1, 2]] * N), [[['down', 'A', 10], ['down', 'B', 11], ['up', 'A', 12], ['up', 'B', 12]]] * N)
check('macro-play scenario 7', solve([[[['down', 'A', 1], ['up', 'A', 5]], 10, 3, 2, 2, 2]] * N), [[['down', 'A', 10], ['up', 'A', 13], ['down', 'A', 15], ['up', 'A', 18]]] * N)
check('macro-play scenario 8', solve([[[['down', 'A', 0], ['up', 'A', 2]], 10, 1, 1, 0, 2]] * N), [[]] * N)
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 event trace violates the deadline ratio rule and produces incorrect keyboard state or command output.

Case [records,start,rate_num,rate_den,loops,gap]. Records [kind,key,offset] have ordered nonnegative integer offsets. Positive rational playback speed scales deadlines by floor(offset*den/num). Repeat cycles start after scaled final offset plus gap. End of each cycle synthesizes releases for remaining held keys in sorted order. Return emitted [kind,key,deadline] records. Loops nonnegative; gap positive. Inputs are finite ordered event traces; return the stated deterministic state. Batch entries are independent. N varies the number of independent input transactions.

split: open-access


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

N = 1
observations = []
def solve(cases):
    def run(c):
        records,start,num,den,loops,gap=c
        out=[]
        duration=(records[-1][2]*den//num) if records else 0
        for cycle in range(loops):
            base=start+cycle*(duration+gap)
            held=set()
            for kind,key,offset in records:
                due=base+(offset*den+num-1)//num
                if kind=='down': held.add(key)
                elif kind=='up': held.discard(key)
                out.append([kind,key,due])
            for key in sorted(held):
                out.append(['up',key,base+duration])
        return out
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('macro-play scenario 0', solve([[[], 10, 1, 1, 0, 2]] * N), [[]] * N)
check('macro-play scenario 1', solve([[[], 10, 1, 1, 2, 2]] * N), [[]] * N)
check('macro-play scenario 2', solve([[[['down', 'A', 0], ['up', 'A', 3]], 10, 2, 1, 2, 4]] * N), [[['down', 'A', 10], ['up', 'A', 11], ['down', 'A', 15], ['up', 'A', 16]]] * N)
check('macro-play scenario 3', solve([[[['up', 'A', 0]], 10, 1, 1, 1, 2]] * N), [[['up', 'A', 10]]] * N)
check('macro-play scenario 4', solve([[[['down', 'A', 0], ['down', 'B', 1]], 10, 1, 1, 2, 2]] * N), [[['down', 'A', 10], ['down', 'B', 11], ['up', 'A', 11], ['up', 'B', 11], ['down', 'A', 13], ['down', 'B', 14], ['up', 'A', 14], ['up', 'B', 14]]] * N)
check('macro-play scenario 5', solve([[[['down', 'A', 0], ['down', 'A', 1]], 10, 1, 1, 1, 2]] * N), [[['down', 'A', 10], ['down', 'A', 11], ['up', 'A', 11]]] * N)
check('macro-play scenario 6', solve([[[['down', 'A', 0], ['down', 'B', 1], ['up', 'A', 2]], 10, 1, 1, 1, 2]] * N), [[['down', 'A', 10], ['down', 'B', 11], ['up', 'A', 12], ['up', 'B', 12]]] * N)
check('macro-play scenario 7', solve([[[['down', 'A', 1], ['up', 'A', 5]], 10, 3, 2, 2, 2]] * N), [[['down', 'A', 10], ['up', 'A', 13], ['down', 'A', 15], ['up', 'A', 18]]] * N)
check('macro-play scenario 8', solve([[[['down', 'A', 0], ['up', 'A', 2]], 10, 1, 1, 0, 2]] * N), [[]] * N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(cases):
    def run(c):
        records,start,num,den,loops,gap=c
        out=[]
        duration=(records[-1][2]*den//num) if records else 0
        for cycle in range(loops):
            base=start+cycle*(duration+gap)
            held=set()
            for kind,key,offset in records:
                due=base+round(offset*den/num)
                if kind=='down': held.add(key)
                elif kind=='up': held.discard(key)
                out.append([kind,key,due])
            for key in sorted(held):
                out.append(['up',key,base+duration])
        return out
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('macro-play scenario 0', solve([[[], 10, 1, 1, 0, 2]] * N), [[]] * N)
check('macro-play scenario 1', solve([[[], 10, 1, 1, 2, 2]] * N), [[]] * N)
check('macro-play scenario 2', solve([[[['down', 'A', 0], ['up', 'A', 3]], 10, 2, 1, 2, 4]] * N), [[['down', 'A', 10], ['up', 'A', 11], ['down', 'A', 15], ['up', 'A', 16]]] * N)
check('macro-play scenario 3', solve([[[['up', 'A', 0]], 10, 1, 1, 1, 2]] * N), [[['up', 'A', 10]]] * N)
check('macro-play scenario 4', solve([[[['down', 'A', 0], ['down', 'B', 1]], 10, 1, 1, 2, 2]] * N), [[['down', 'A', 10], ['down', 'B', 11], ['up', 'A', 11], ['up', 'B', 11], ['down', 'A', 13], ['down', 'B', 14], ['up', 'A', 14], ['up', 'B', 14]]] * N)
check('macro-play scenario 5', solve([[[['down', 'A', 0], ['down', 'A', 1]], 10, 1, 1, 1, 2]] * N), [[['down', 'A', 10], ['down', 'A', 11], ['up', 'A', 11]]] * N)
check('macro-play scenario 6', solve([[[['down', 'A', 0], ['down', 'B', 1], ['up', 'A', 2]], 10, 1, 1, 1, 2]] * N), [[['down', 'A', 10], ['down', 'B', 11], ['up', 'A', 12], ['up', 'B', 12]]] * N)
check('macro-play scenario 7', solve([[[['down', 'A', 1], ['up', 'A', 5]], 10, 3, 2, 2, 2]] * N), [[['down', 'A', 10], ['up', 'A', 13], ['down', 'A', 15], ['up', 'A', 18]]] * N)
check('macro-play scenario 8', solve([[[['down', 'A', 0], ['up', 'A', 2]], 10, 1, 1, 0, 2]] * N), [[]] * N)
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 event trace violates the deadline rounding rule and produces incorrect keyboard state or command output.

Case [records,start,rate_num,rate_den,loops,gap]. Records [kind,key,offset] have ordered nonnegative integer offsets. Positive rational playback speed scales deadlines by floor(offset*den/num). Repeat cycles start after scaled final offset plus gap. End of each cycle synthesizes releases for remaining held keys in sorted order. Return emitted [kind,key,deadline] records. Loops nonnegative; gap positive. Inputs are finite ordered event traces; return the stated deterministic state. Batch entries are independent. N varies the number of independent input transactions.

split: open-access


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

N = 1
observations = []
def solve(cases):
    def run(c):
        records,start,num,den,loops,gap=c
        out=[]
        duration=(records[-1][2]*den//num) if records else 0
        for cycle in range(loops):
            base=start+cycle*(duration+gap)
            held=set()
            for kind,key,offset in records:
                due=base+offset*den//num
                if kind=='down': held.symmetric_difference_update({key})
                elif kind=='up': held.discard(key)
                out.append([kind,key,due])
            for key in sorted(held):
                out.append(['up',key,base+duration])
        return out
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('macro-play scenario 0', solve([[[], 10, 1, 1, 0, 2]] * N), [[]] * N)
check('macro-play scenario 1', solve([[[], 10, 1, 1, 2, 2]] * N), [[]] * N)
check('macro-play scenario 2', solve([[[['down', 'A', 0], ['up', 'A', 3]], 10, 2, 1, 2, 4]] * N), [[['down', 'A', 10], ['up', 'A', 11], ['down', 'A', 15], ['up', 'A', 16]]] * N)
check('macro-play scenario 3', solve([[[['up', 'A', 0]], 10, 1, 1, 1, 2]] * N), [[['up', 'A', 10]]] * N)
check('macro-play scenario 4', solve([[[['down', 'A', 0], ['down', 'B', 1]], 10, 1, 1, 2, 2]] * N), [[['down', 'A', 10], ['down', 'B', 11], ['up', 'A', 11], ['up', 'B', 11], ['down', 'A', 13], ['down', 'B', 14], ['up', 'A', 14], ['up', 'B', 14]]] * N)
check('macro-play scenario 5', solve([[[['down', 'A', 0], ['down', 'A', 1]], 10, 1, 1, 1, 2]] * N), [[['down', 'A', 10], ['down', 'A', 11], ['up', 'A', 11]]] * N)
check('macro-play scenario 6', solve([[[['down', 'A', 0], ['down', 'B', 1], ['up', 'A', 2]], 10, 1, 1, 1, 2]] * N), [[['down', 'A', 10], ['down', 'B', 11], ['up', 'A', 12], ['up', 'B', 12]]] * N)
check('macro-play scenario 7', solve([[[['down', 'A', 1], ['up', 'A', 5]], 10, 3, 2, 2, 2]] * N), [[['down', 'A', 10], ['up', 'A', 13], ['down', 'A', 15], ['up', 'A', 18]]] * N)
check('macro-play scenario 8', solve([[[['down', 'A', 0], ['up', 'A', 2]], 10, 1, 1, 0, 2]] * N), [[]] * N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(cases):
    def run(c):
        records,start,num,den,loops,gap=c
        out=[]
        duration=(records[-1][2]*den//num) if records else 0
        for cycle in range(loops):
            base=start+cycle*(duration+gap)
            held=set()
            for kind,key,offset in records:
                due=base+offset*den//num
                if kind=='down': held={key}
                elif kind=='up': held.discard(key)
                out.append([kind,key,due])
            for key in sorted(held):
                out.append(['up',key,base+duration])
        return out
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('macro-play scenario 0', solve([[[], 10, 1, 1, 0, 2]] * N), [[]] * N)
check('macro-play scenario 1', solve([[[], 10, 1, 1, 2, 2]] * N), [[]] * N)
check('macro-play scenario 2', solve([[[['down', 'A', 0], ['up', 'A', 3]], 10, 2, 1, 2, 4]] * N), [[['down', 'A', 10], ['up', 'A', 11], ['down', 'A', 15], ['up', 'A', 16]]] * N)
check('macro-play scenario 3', solve([[[['up', 'A', 0]], 10, 1, 1, 1, 2]] * N), [[['up', 'A', 10]]] * N)
check('macro-play scenario 4', solve([[[['down', 'A', 0], ['down', 'B', 1]], 10, 1, 1, 2, 2]] * N), [[['down', 'A', 10], ['down', 'B', 11], ['up', 'A', 11], ['up', 'B', 11], ['down', 'A', 13], ['down', 'B', 14], ['up', 'A', 14], ['up', 'B', 14]]] * N)
check('macro-play scenario 5', solve([[[['down', 'A', 0], ['down', 'A', 1]], 10, 1, 1, 1, 2]] * N), [[['down', 'A', 10], ['down', 'A', 11], ['up', 'A', 11]]] * N)
check('macro-play scenario 6', solve([[[['down', 'A', 0], ['down', 'B', 1], ['up', 'A', 2]], 10, 1, 1, 1, 2]] * N), [[['down', 'A', 10], ['down', 'B', 11], ['up', 'A', 12], ['up', 'B', 12]]] * N)
check('macro-play scenario 7', solve([[[['down', 'A', 1], ['up', 'A', 5]], 10, 3, 2, 2, 2]] * N), [[['down', 'A', 10], ['up', 'A', 13], ['down', 'A', 15], ['up', 'A', 18]]] * N)
check('macro-play scenario 8', solve([[[['down', 'A', 0], ['up', 'A', 2]], 10, 1, 1, 0, 2]] * N), [[]] * N)
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 event trace violates the press track rule and produces incorrect keyboard state or command output.

Case [records,start,rate_num,rate_den,loops,gap]. Records [kind,key,offset] have ordered nonnegative integer offsets. Positive rational playback speed scales deadlines by floor(offset*den/num). Repeat cycles start after scaled final offset plus gap. End of each cycle synthesizes releases for remaining held keys in sorted order. Return emitted [kind,key,deadline] records. Loops nonnegative; gap positive. Inputs are finite ordered event traces; return the stated deterministic state. Batch entries are independent. N varies the number of independent input transactions.

split: open-access


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

N = 1
observations = []
def solve(cases):
    def run(c):
        records,start,num,den,loops,gap=c
        out=[]
        duration=(records[-1][2]*den//num) if records else 0
        for cycle in range(loops):
            base=start+cycle*(duration+gap)
            held=set()
            for kind,key,offset in records:
                due=base+offset*den//num
                if kind=='down': held.add(key)
                elif kind=='up': held.clear()
                out.append([kind,key,due])
            for key in sorted(held):
                out.append(['up',key,base+duration])
        return out
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('macro-play scenario 0', solve([[[], 10, 1, 1, 0, 2]] * N), [[]] * N)
check('macro-play scenario 1', solve([[[], 10, 1, 1, 2, 2]] * N), [[]] * N)
check('macro-play scenario 2', solve([[[['down', 'A', 0], ['up', 'A', 3]], 10, 2, 1, 2, 4]] * N), [[['down', 'A', 10], ['up', 'A', 11], ['down', 'A', 15], ['up', 'A', 16]]] * N)
check('macro-play scenario 3', solve([[[['up', 'A', 0]], 10, 1, 1, 1, 2]] * N), [[['up', 'A', 10]]] * N)
check('macro-play scenario 4', solve([[[['down', 'A', 0], ['down', 'B', 1]], 10, 1, 1, 2, 2]] * N), [[['down', 'A', 10], ['down', 'B', 11], ['up', 'A', 11], ['up', 'B', 11], ['down', 'A', 13], ['down', 'B', 14], ['up', 'A', 14], ['up', 'B', 14]]] * N)
check('macro-play scenario 5', solve([[[['down', 'A', 0], ['down', 'A', 1]], 10, 1, 1, 1, 2]] * N), [[['down', 'A', 10], ['down', 'A', 11], ['up', 'A', 11]]] * N)
check('macro-play scenario 6', solve([[[['down', 'A', 0], ['down', 'B', 1], ['up', 'A', 2]], 10, 1, 1, 1, 2]] * N), [[['down', 'A', 10], ['down', 'B', 11], ['up', 'A', 12], ['up', 'B', 12]]] * N)
check('macro-play scenario 7', solve([[[['down', 'A', 1], ['up', 'A', 5]], 10, 3, 2, 2, 2]] * N), [[['down', 'A', 10], ['up', 'A', 13], ['down', 'A', 15], ['up', 'A', 18]]] * N)
check('macro-play scenario 8', solve([[[['down', 'A', 0], ['up', 'A', 2]], 10, 1, 1, 0, 2]] * N), [[]] * N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(cases):
    def run(c):
        records,start,num,den,loops,gap=c
        out=[]
        duration=(records[-1][2]*den//num) if records else 0
        for cycle in range(loops):
            base=start+cycle*(duration+gap)
            held=set()
            for kind,key,offset in records:
                due=base+offset*den//num
                if kind=='down': held.add(key)
                elif kind=='up': pass
                out.append([kind,key,due])
            for key in sorted(held):
                out.append(['up',key,base+duration])
        return out
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('macro-play scenario 0', solve([[[], 10, 1, 1, 0, 2]] * N), [[]] * N)
check('macro-play scenario 1', solve([[[], 10, 1, 1, 2, 2]] * N), [[]] * N)
check('macro-play scenario 2', solve([[[['down', 'A', 0], ['up', 'A', 3]], 10, 2, 1, 2, 4]] * N), [[['down', 'A', 10], ['up', 'A', 11], ['down', 'A', 15], ['up', 'A', 16]]] * N)
check('macro-play scenario 3', solve([[[['up', 'A', 0]], 10, 1, 1, 1, 2]] * N), [[['up', 'A', 10]]] * N)
check('macro-play scenario 4', solve([[[['down', 'A', 0], ['down', 'B', 1]], 10, 1, 1, 2, 2]] * N), [[['down', 'A', 10], ['down', 'B', 11], ['up', 'A', 11], ['up', 'B', 11], ['down', 'A', 13], ['down', 'B', 14], ['up', 'A', 14], ['up', 'B', 14]]] * N)
check('macro-play scenario 5', solve([[[['down', 'A', 0], ['down', 'A', 1]], 10, 1, 1, 1, 2]] * N), [[['down', 'A', 10], ['down', 'A', 11], ['up', 'A', 11]]] * N)
check('macro-play scenario 6', solve([[[['down', 'A', 0], ['down', 'B', 1], ['up', 'A', 2]], 10, 1, 1, 1, 2]] * N), [[['down', 'A', 10], ['down', 'B', 11], ['up', 'A', 12], ['up', 'B', 12]]] * N)
check('macro-play scenario 7', solve([[[['down', 'A', 1], ['up', 'A', 5]], 10, 3, 2, 2, 2]] * N), [[['down', 'A', 10], ['up', 'A', 13], ['down', 'A', 15], ['up', 'A', 18]]] * N)
check('macro-play scenario 8', solve([[[['down', 'A', 0], ['up', 'A', 2]], 10, 1, 1, 0, 2]] * N), [[]] * N)
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 event trace violates the release track rule and produces incorrect keyboard state or command output.

Case [records,start,rate_num,rate_den,loops,gap]. Records [kind,key,offset] have ordered nonnegative integer offsets. Positive rational playback speed scales deadlines by floor(offset*den/num). Repeat cycles start after scaled final offset plus gap. End of each cycle synthesizes releases for remaining held keys in sorted order. Return emitted [kind,key,deadline] records. Loops nonnegative; gap positive. Inputs are finite ordered event traces; return the stated deterministic state. Batch entries are independent. N varies the number of independent input transactions.

split: open-access


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

N = 1
observations = []
def solve(cases):
    def run(c):
        records,start,num,den,loops,gap=c
        out=[]
        duration=(records[-1][2]*den//num) if records else 0
        for cycle in range(loops):
            base=start+cycle*(duration+gap)
            held=set()
            for kind,key,offset in records:
                due=base+offset*den//num
                if kind=='down': held.add(key)
                elif kind=='up': held.discard(key)
                out.append(["down",key,due])
            for key in sorted(held):
                out.append(['up',key,base+duration])
        return out
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('macro-play scenario 0', solve([[[], 10, 1, 1, 0, 2]] * N), [[]] * N)
check('macro-play scenario 1', solve([[[], 10, 1, 1, 2, 2]] * N), [[]] * N)
check('macro-play scenario 2', solve([[[['down', 'A', 0], ['up', 'A', 3]], 10, 2, 1, 2, 4]] * N), [[['down', 'A', 10], ['up', 'A', 11], ['down', 'A', 15], ['up', 'A', 16]]] * N)
check('macro-play scenario 3', solve([[[['up', 'A', 0]], 10, 1, 1, 1, 2]] * N), [[['up', 'A', 10]]] * N)
check('macro-play scenario 4', solve([[[['down', 'A', 0], ['down', 'B', 1]], 10, 1, 1, 2, 2]] * N), [[['down', 'A', 10], ['down', 'B', 11], ['up', 'A', 11], ['up', 'B', 11], ['down', 'A', 13], ['down', 'B', 14], ['up', 'A', 14], ['up', 'B', 14]]] * N)
check('macro-play scenario 5', solve([[[['down', 'A', 0], ['down', 'A', 1]], 10, 1, 1, 1, 2]] * N), [[['down', 'A', 10], ['down', 'A', 11], ['up', 'A', 11]]] * N)
check('macro-play scenario 6', solve([[[['down', 'A', 0], ['down', 'B', 1], ['up', 'A', 2]], 10, 1, 1, 1, 2]] * N), [[['down', 'A', 10], ['down', 'B', 11], ['up', 'A', 12], ['up', 'B', 12]]] * N)
check('macro-play scenario 7', solve([[[['down', 'A', 1], ['up', 'A', 5]], 10, 3, 2, 2, 2]] * N), [[['down', 'A', 10], ['up', 'A', 13], ['down', 'A', 15], ['up', 'A', 18]]] * N)
check('macro-play scenario 8', solve([[[['down', 'A', 0], ['up', 'A', 2]], 10, 1, 1, 0, 2]] * N), [[]] * N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(cases):
    def run(c):
        records,start,num,den,loops,gap=c
        out=[]
        duration=(records[-1][2]*den//num) if records else 0
        for cycle in range(loops):
            base=start+cycle*(duration+gap)
            held=set()
            for kind,key,offset in records:
                due=base+offset*den//num
                if kind=='down': held.add(key)
                elif kind=='up': held.discard(key)
                out.append([key,kind,due])
            for key in sorted(held):
                out.append(['up',key,base+duration])
        return out
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('macro-play scenario 0', solve([[[], 10, 1, 1, 0, 2]] * N), [[]] * N)
check('macro-play scenario 1', solve([[[], 10, 1, 1, 2, 2]] * N), [[]] * N)
check('macro-play scenario 2', solve([[[['down', 'A', 0], ['up', 'A', 3]], 10, 2, 1, 2, 4]] * N), [[['down', 'A', 10], ['up', 'A', 11], ['down', 'A', 15], ['up', 'A', 16]]] * N)
check('macro-play scenario 3', solve([[[['up', 'A', 0]], 10, 1, 1, 1, 2]] * N), [[['up', 'A', 10]]] * N)
check('macro-play scenario 4', solve([[[['down', 'A', 0], ['down', 'B', 1]], 10, 1, 1, 2, 2]] * N), [[['down', 'A', 10], ['down', 'B', 11], ['up', 'A', 11], ['up', 'B', 11], ['down', 'A', 13], ['down', 'B', 14], ['up', 'A', 14], ['up', 'B', 14]]] * N)
check('macro-play scenario 5', solve([[[['down', 'A', 0], ['down', 'A', 1]], 10, 1, 1, 1, 2]] * N), [[['down', 'A', 10], ['down', 'A', 11], ['up', 'A', 11]]] * N)
check('macro-play scenario 6', solve([[[['down', 'A', 0], ['down', 'B', 1], ['up', 'A', 2]], 10, 1, 1, 1, 2]] * N), [[['down', 'A', 10], ['down', 'B', 11], ['up', 'A', 12], ['up', 'B', 12]]] * N)
check('macro-play scenario 7', solve([[[['down', 'A', 1], ['up', 'A', 5]], 10, 3, 2, 2, 2]] * N), [[['down', 'A', 10], ['up', 'A', 13], ['down', 'A', 15], ['up', 'A', 18]]] * N)
check('macro-play scenario 8', solve([[[['down', 'A', 0], ['up', 'A', 2]], 10, 1, 1, 0, 2]] * N), [[]] * N)
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 event trace violates the output phase rule and produces incorrect keyboard state or command output.

Case [records,start,rate_num,rate_den,loops,gap]. Records [kind,key,offset] have ordered nonnegative integer offsets. Positive rational playback speed scales deadlines by floor(offset*den/num). Repeat cycles start after scaled final offset plus gap. End of each cycle synthesizes releases for remaining held keys in sorted order. Return emitted [kind,key,deadline] records. Loops nonnegative; gap positive. Inputs are finite ordered event traces; return the stated deterministic state. Batch entries are independent. N varies the number of independent input transactions.

split: open-access