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

N = 1
observations = []
def solve(cases):
    def run(c):
        old_keys=set(); old_mods=set(); out=[]; rejected=0
        for mask,slots in c:
            if 1 in slots:
                rejected+=1
                continue
            keys=set(slots)-{0}
            mods={bit for bit in range(8) if mask & (1<<bit)}
            for key in sorted(old_keys-keys): out.append(['up','key',key])
            for mod in sorted(old_mods-mods): out.append(['up','mod',mod])
            for mod in sorted(old_mods-mods): out.append(['down','mod',mod])
            for key in sorted(keys-old_keys): out.append(['down','key',key])
            old_keys=keys
            old_mods=mods
        return [out,sorted(old_keys),sorted(old_mods),rejected]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('hid-report-delta scenario 0', solve([[]] * N), [[[], [], [], 0]] * N)
check('hid-report-delta scenario 1', solve([[[0, [0, 0]]]] * N), [[[], [], [], 0]] * N)
check('hid-report-delta scenario 2', solve([[[1, [2, 3, 3, 0]], [1, [2, 3, 0]]]] * N), [[[['down', 'mod', 0], ['down', 'key', 2], ['down', 'key', 3]], [2, 3], [0], 0]] * N)
check('hid-report-delta scenario 3', solve([[[1, [2, 3]], [2, [3, 4]], [0, []]]] * N), [[[['down', 'mod', 0], ['down', 'key', 2], ['down', 'key', 3], ['up', 'key', 2], ['up', 'mod', 0], ['down', 'mod', 1], ['down', 'key', 4], ['up', 'key', 3], ['up', 'key', 4], ['up', 'mod', 1]], [], [], 0]] * N)
check('hid-report-delta scenario 4', solve([[[4, [5]], [0, [1, 0, 0]], [4, [5]]]] * N), [[[['down', 'mod', 2], ['down', 'key', 5]], [5], [2], 1]] * N)
check('hid-report-delta scenario 5', solve([[[0, [1, 0]], [0, [1, 2]]]] * N), [[[], [], [], 2]] * N)
check('hid-report-delta scenario 6', solve([[[128, [2]], [0, []], [128, [2]]]] * N), [[[['down', 'mod', 7], ['down', 'key', 2], ['up', 'key', 2], ['up', 'mod', 7], ['down', 'mod', 7], ['down', 'key', 2]], [2], [7], 0]] * N)
check('hid-report-delta scenario 7', solve([[[0, [2]], [0, []], [0, [2]]]] * N), [[[['down', 'key', 2], ['up', 'key', 2], ['down', 'key', 2]], [2], [], 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):
        old_keys=set(); old_mods=set(); out=[]; rejected=0
        for mask,slots in c:
            if 1 in slots:
                rejected+=1
                continue
            keys=set(slots)-{0}
            mods={bit for bit in range(8) if mask & (1<<bit)}
            for key in sorted(old_keys-keys): out.append(['up','key',key])
            for mod in sorted(old_mods-mods): out.append(['up','mod',mod])
            for mod in sorted(mods): out.append(['down','mod',mod])
            for key in sorted(keys-old_keys): out.append(['down','key',key])
            old_keys=keys
            old_mods=mods
        return [out,sorted(old_keys),sorted(old_mods),rejected]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('hid-report-delta scenario 0', solve([[]] * N), [[[], [], [], 0]] * N)
check('hid-report-delta scenario 1', solve([[[0, [0, 0]]]] * N), [[[], [], [], 0]] * N)
check('hid-report-delta scenario 2', solve([[[1, [2, 3, 3, 0]], [1, [2, 3, 0]]]] * N), [[[['down', 'mod', 0], ['down', 'key', 2], ['down', 'key', 3]], [2, 3], [0], 0]] * N)
check('hid-report-delta scenario 3', solve([[[1, [2, 3]], [2, [3, 4]], [0, []]]] * N), [[[['down', 'mod', 0], ['down', 'key', 2], ['down', 'key', 3], ['up', 'key', 2], ['up', 'mod', 0], ['down', 'mod', 1], ['down', 'key', 4], ['up', 'key', 3], ['up', 'key', 4], ['up', 'mod', 1]], [], [], 0]] * N)
check('hid-report-delta scenario 4', solve([[[4, [5]], [0, [1, 0, 0]], [4, [5]]]] * N), [[[['down', 'mod', 2], ['down', 'key', 5]], [5], [2], 1]] * N)
check('hid-report-delta scenario 5', solve([[[0, [1, 0]], [0, [1, 2]]]] * N), [[[], [], [], 2]] * N)
check('hid-report-delta scenario 6', solve([[[128, [2]], [0, []], [128, [2]]]] * N), [[[['down', 'mod', 7], ['down', 'key', 2], ['up', 'key', 2], ['up', 'mod', 7], ['down', 'mod', 7], ['down', 'key', 2]], [2], [7], 0]] * N)
check('hid-report-delta scenario 7', solve([[[0, [2]], [0, []], [0, [2]]]] * N), [[[['down', 'key', 2], ['up', 'key', 2], ['down', 'key', 2]], [2], [], 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 modifier press delta rule and produces incorrect keyboard state or command output.

Each report is [modifier_mask,usage_slots]. Usages are integers >=0; 0 is padding, 1 is an error sentinel that invalidates the whole report. Other usages are unique logical keys even when slots duplicate. Modifier bits 0..7 identify M0..M7. Emit sorted key releases, sorted modifier releases, sorted modifier presses, then sorted key presses per valid report. Return emitted [phase,kind,identity] and final usage/modifier sets. 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):
        old_keys=set(); old_mods=set(); out=[]; rejected=0
        for mask,slots in c:
            if 1 in slots:
                rejected+=1
                continue
            keys=set(slots)-{0}
            mods={bit for bit in range(8) if mask & (1<<bit)}
            for key in sorted(old_keys-keys): out.append(['up','key',key])
            for mod in sorted(old_mods-mods): out.append(['up','mod',mod])
            for mod in sorted(mods-old_mods): out.append(['down','mod',mod])
            for key in sorted(old_keys-keys): out.append(['down','key',key])
            old_keys=keys
            old_mods=mods
        return [out,sorted(old_keys),sorted(old_mods),rejected]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('hid-report-delta scenario 0', solve([[]] * N), [[[], [], [], 0]] * N)
check('hid-report-delta scenario 1', solve([[[0, [0, 0]]]] * N), [[[], [], [], 0]] * N)
check('hid-report-delta scenario 2', solve([[[1, [2, 3, 3, 0]], [1, [2, 3, 0]]]] * N), [[[['down', 'mod', 0], ['down', 'key', 2], ['down', 'key', 3]], [2, 3], [0], 0]] * N)
check('hid-report-delta scenario 3', solve([[[1, [2, 3]], [2, [3, 4]], [0, []]]] * N), [[[['down', 'mod', 0], ['down', 'key', 2], ['down', 'key', 3], ['up', 'key', 2], ['up', 'mod', 0], ['down', 'mod', 1], ['down', 'key', 4], ['up', 'key', 3], ['up', 'key', 4], ['up', 'mod', 1]], [], [], 0]] * N)
check('hid-report-delta scenario 4', solve([[[4, [5]], [0, [1, 0, 0]], [4, [5]]]] * N), [[[['down', 'mod', 2], ['down', 'key', 5]], [5], [2], 1]] * N)
check('hid-report-delta scenario 5', solve([[[0, [1, 0]], [0, [1, 2]]]] * N), [[[], [], [], 2]] * N)
check('hid-report-delta scenario 6', solve([[[128, [2]], [0, []], [128, [2]]]] * N), [[[['down', 'mod', 7], ['down', 'key', 2], ['up', 'key', 2], ['up', 'mod', 7], ['down', 'mod', 7], ['down', 'key', 2]], [2], [7], 0]] * N)
check('hid-report-delta scenario 7', solve([[[0, [2]], [0, []], [0, [2]]]] * N), [[[['down', 'key', 2], ['up', 'key', 2], ['down', 'key', 2]], [2], [], 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):
        old_keys=set(); old_mods=set(); out=[]; rejected=0
        for mask,slots in c:
            if 1 in slots:
                rejected+=1
                continue
            keys=set(slots)-{0}
            mods={bit for bit in range(8) if mask & (1<<bit)}
            for key in sorted(old_keys-keys): out.append(['up','key',key])
            for mod in sorted(old_mods-mods): out.append(['up','mod',mod])
            for mod in sorted(mods-old_mods): out.append(['down','mod',mod])
            for key in sorted(keys): out.append(['down','key',key])
            old_keys=keys
            old_mods=mods
        return [out,sorted(old_keys),sorted(old_mods),rejected]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('hid-report-delta scenario 0', solve([[]] * N), [[[], [], [], 0]] * N)
check('hid-report-delta scenario 1', solve([[[0, [0, 0]]]] * N), [[[], [], [], 0]] * N)
check('hid-report-delta scenario 2', solve([[[1, [2, 3, 3, 0]], [1, [2, 3, 0]]]] * N), [[[['down', 'mod', 0], ['down', 'key', 2], ['down', 'key', 3]], [2, 3], [0], 0]] * N)
check('hid-report-delta scenario 3', solve([[[1, [2, 3]], [2, [3, 4]], [0, []]]] * N), [[[['down', 'mod', 0], ['down', 'key', 2], ['down', 'key', 3], ['up', 'key', 2], ['up', 'mod', 0], ['down', 'mod', 1], ['down', 'key', 4], ['up', 'key', 3], ['up', 'key', 4], ['up', 'mod', 1]], [], [], 0]] * N)
check('hid-report-delta scenario 4', solve([[[4, [5]], [0, [1, 0, 0]], [4, [5]]]] * N), [[[['down', 'mod', 2], ['down', 'key', 5]], [5], [2], 1]] * N)
check('hid-report-delta scenario 5', solve([[[0, [1, 0]], [0, [1, 2]]]] * N), [[[], [], [], 2]] * N)
check('hid-report-delta scenario 6', solve([[[128, [2]], [0, []], [128, [2]]]] * N), [[[['down', 'mod', 7], ['down', 'key', 2], ['up', 'key', 2], ['up', 'mod', 7], ['down', 'mod', 7], ['down', 'key', 2]], [2], [7], 0]] * N)
check('hid-report-delta scenario 7', solve([[[0, [2]], [0, []], [0, [2]]]] * N), [[[['down', 'key', 2], ['up', 'key', 2], ['down', 'key', 2]], [2], [], 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 key press delta rule and produces incorrect keyboard state or command output.

Each report is [modifier_mask,usage_slots]. Usages are integers >=0; 0 is padding, 1 is an error sentinel that invalidates the whole report. Other usages are unique logical keys even when slots duplicate. Modifier bits 0..7 identify M0..M7. Emit sorted key releases, sorted modifier releases, sorted modifier presses, then sorted key presses per valid report. Return emitted [phase,kind,identity] and final usage/modifier sets. 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):
        old_keys=set(); old_mods=set(); out=[]; rejected=0
        for mask,slots in c:
            if 1 in slots:
                rejected+=1
                continue
            keys=set(slots)-{0}
            mods={bit for bit in range(8) if mask & (1<<bit)}
            for key in sorted(old_keys-keys): out.append(['up','key',key])
            for mod in sorted(old_mods-mods): out.append(['up','mod',mod])
            for mod in sorted(mods-old_mods): out.append(['down','mod',mod])
            for key in sorted(keys-old_keys): out.append(['down','key',key])
            old_keys|=keys
            old_mods=mods
        return [out,sorted(old_keys),sorted(old_mods),rejected]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('hid-report-delta scenario 0', solve([[]] * N), [[[], [], [], 0]] * N)
check('hid-report-delta scenario 1', solve([[[0, [0, 0]]]] * N), [[[], [], [], 0]] * N)
check('hid-report-delta scenario 2', solve([[[1, [2, 3, 3, 0]], [1, [2, 3, 0]]]] * N), [[[['down', 'mod', 0], ['down', 'key', 2], ['down', 'key', 3]], [2, 3], [0], 0]] * N)
check('hid-report-delta scenario 3', solve([[[1, [2, 3]], [2, [3, 4]], [0, []]]] * N), [[[['down', 'mod', 0], ['down', 'key', 2], ['down', 'key', 3], ['up', 'key', 2], ['up', 'mod', 0], ['down', 'mod', 1], ['down', 'key', 4], ['up', 'key', 3], ['up', 'key', 4], ['up', 'mod', 1]], [], [], 0]] * N)
check('hid-report-delta scenario 4', solve([[[4, [5]], [0, [1, 0, 0]], [4, [5]]]] * N), [[[['down', 'mod', 2], ['down', 'key', 5]], [5], [2], 1]] * N)
check('hid-report-delta scenario 5', solve([[[0, [1, 0]], [0, [1, 2]]]] * N), [[[], [], [], 2]] * N)
check('hid-report-delta scenario 6', solve([[[128, [2]], [0, []], [128, [2]]]] * N), [[[['down', 'mod', 7], ['down', 'key', 2], ['up', 'key', 2], ['up', 'mod', 7], ['down', 'mod', 7], ['down', 'key', 2]], [2], [7], 0]] * N)
check('hid-report-delta scenario 7', solve([[[0, [2]], [0, []], [0, [2]]]] * N), [[[['down', 'key', 2], ['up', 'key', 2], ['down', 'key', 2]], [2], [], 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):
        old_keys=set(); old_mods=set(); out=[]; rejected=0
        for mask,slots in c:
            if 1 in slots:
                rejected+=1
                continue
            keys=set(slots)-{0}
            mods={bit for bit in range(8) if mask & (1<<bit)}
            for key in sorted(old_keys-keys): out.append(['up','key',key])
            for mod in sorted(old_mods-mods): out.append(['up','mod',mod])
            for mod in sorted(mods-old_mods): out.append(['down','mod',mod])
            for key in sorted(keys-old_keys): out.append(['down','key',key])
            old_keys=set()
            old_mods=mods
        return [out,sorted(old_keys),sorted(old_mods),rejected]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('hid-report-delta scenario 0', solve([[]] * N), [[[], [], [], 0]] * N)
check('hid-report-delta scenario 1', solve([[[0, [0, 0]]]] * N), [[[], [], [], 0]] * N)
check('hid-report-delta scenario 2', solve([[[1, [2, 3, 3, 0]], [1, [2, 3, 0]]]] * N), [[[['down', 'mod', 0], ['down', 'key', 2], ['down', 'key', 3]], [2, 3], [0], 0]] * N)
check('hid-report-delta scenario 3', solve([[[1, [2, 3]], [2, [3, 4]], [0, []]]] * N), [[[['down', 'mod', 0], ['down', 'key', 2], ['down', 'key', 3], ['up', 'key', 2], ['up', 'mod', 0], ['down', 'mod', 1], ['down', 'key', 4], ['up', 'key', 3], ['up', 'key', 4], ['up', 'mod', 1]], [], [], 0]] * N)
check('hid-report-delta scenario 4', solve([[[4, [5]], [0, [1, 0, 0]], [4, [5]]]] * N), [[[['down', 'mod', 2], ['down', 'key', 5]], [5], [2], 1]] * N)
check('hid-report-delta scenario 5', solve([[[0, [1, 0]], [0, [1, 2]]]] * N), [[[], [], [], 2]] * N)
check('hid-report-delta scenario 6', solve([[[128, [2]], [0, []], [128, [2]]]] * N), [[[['down', 'mod', 7], ['down', 'key', 2], ['up', 'key', 2], ['up', 'mod', 7], ['down', 'mod', 7], ['down', 'key', 2]], [2], [7], 0]] * N)
check('hid-report-delta scenario 7', solve([[[0, [2]], [0, []], [0, [2]]]] * N), [[[['down', 'key', 2], ['up', 'key', 2], ['down', 'key', 2]], [2], [], 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 commit key snapshot rule and produces incorrect keyboard state or command output.

Each report is [modifier_mask,usage_slots]. Usages are integers >=0; 0 is padding, 1 is an error sentinel that invalidates the whole report. Other usages are unique logical keys even when slots duplicate. Modifier bits 0..7 identify M0..M7. Emit sorted key releases, sorted modifier releases, sorted modifier presses, then sorted key presses per valid report. Return emitted [phase,kind,identity] and final usage/modifier sets. 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):
        old_keys=set(); old_mods=set(); out=[]; rejected=0
        for mask,slots in c:
            if 1 in slots:
                rejected+=1
                continue
            keys=set(slots)-{0}
            mods={bit for bit in range(8) if mask & (1<<bit)}
            for key in sorted(old_keys-keys): out.append(['up','key',key])
            for mod in sorted(old_mods-mods): out.append(['up','mod',mod])
            for mod in sorted(mods-old_mods): out.append(['down','mod',mod])
            for key in sorted(keys-old_keys): out.append(['down','key',key])
            old_keys=keys
            old_mods|=mods
        return [out,sorted(old_keys),sorted(old_mods),rejected]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('hid-report-delta scenario 0', solve([[]] * N), [[[], [], [], 0]] * N)
check('hid-report-delta scenario 1', solve([[[0, [0, 0]]]] * N), [[[], [], [], 0]] * N)
check('hid-report-delta scenario 2', solve([[[1, [2, 3, 3, 0]], [1, [2, 3, 0]]]] * N), [[[['down', 'mod', 0], ['down', 'key', 2], ['down', 'key', 3]], [2, 3], [0], 0]] * N)
check('hid-report-delta scenario 3', solve([[[1, [2, 3]], [2, [3, 4]], [0, []]]] * N), [[[['down', 'mod', 0], ['down', 'key', 2], ['down', 'key', 3], ['up', 'key', 2], ['up', 'mod', 0], ['down', 'mod', 1], ['down', 'key', 4], ['up', 'key', 3], ['up', 'key', 4], ['up', 'mod', 1]], [], [], 0]] * N)
check('hid-report-delta scenario 4', solve([[[4, [5]], [0, [1, 0, 0]], [4, [5]]]] * N), [[[['down', 'mod', 2], ['down', 'key', 5]], [5], [2], 1]] * N)
check('hid-report-delta scenario 5', solve([[[0, [1, 0]], [0, [1, 2]]]] * N), [[[], [], [], 2]] * N)
check('hid-report-delta scenario 6', solve([[[128, [2]], [0, []], [128, [2]]]] * N), [[[['down', 'mod', 7], ['down', 'key', 2], ['up', 'key', 2], ['up', 'mod', 7], ['down', 'mod', 7], ['down', 'key', 2]], [2], [7], 0]] * N)
check('hid-report-delta scenario 7', solve([[[0, [2]], [0, []], [0, [2]]]] * N), [[[['down', 'key', 2], ['up', 'key', 2], ['down', 'key', 2]], [2], [], 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):
        old_keys=set(); old_mods=set(); out=[]; rejected=0
        for mask,slots in c:
            if 1 in slots:
                rejected+=1
                continue
            keys=set(slots)-{0}
            mods={bit for bit in range(8) if mask & (1<<bit)}
            for key in sorted(old_keys-keys): out.append(['up','key',key])
            for mod in sorted(old_mods-mods): out.append(['up','mod',mod])
            for mod in sorted(mods-old_mods): out.append(['down','mod',mod])
            for key in sorted(keys-old_keys): out.append(['down','key',key])
            old_keys=keys
            old_mods=set()
        return [out,sorted(old_keys),sorted(old_mods),rejected]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('hid-report-delta scenario 0', solve([[]] * N), [[[], [], [], 0]] * N)
check('hid-report-delta scenario 1', solve([[[0, [0, 0]]]] * N), [[[], [], [], 0]] * N)
check('hid-report-delta scenario 2', solve([[[1, [2, 3, 3, 0]], [1, [2, 3, 0]]]] * N), [[[['down', 'mod', 0], ['down', 'key', 2], ['down', 'key', 3]], [2, 3], [0], 0]] * N)
check('hid-report-delta scenario 3', solve([[[1, [2, 3]], [2, [3, 4]], [0, []]]] * N), [[[['down', 'mod', 0], ['down', 'key', 2], ['down', 'key', 3], ['up', 'key', 2], ['up', 'mod', 0], ['down', 'mod', 1], ['down', 'key', 4], ['up', 'key', 3], ['up', 'key', 4], ['up', 'mod', 1]], [], [], 0]] * N)
check('hid-report-delta scenario 4', solve([[[4, [5]], [0, [1, 0, 0]], [4, [5]]]] * N), [[[['down', 'mod', 2], ['down', 'key', 5]], [5], [2], 1]] * N)
check('hid-report-delta scenario 5', solve([[[0, [1, 0]], [0, [1, 2]]]] * N), [[[], [], [], 2]] * N)
check('hid-report-delta scenario 6', solve([[[128, [2]], [0, []], [128, [2]]]] * N), [[[['down', 'mod', 7], ['down', 'key', 2], ['up', 'key', 2], ['up', 'mod', 7], ['down', 'mod', 7], ['down', 'key', 2]], [2], [7], 0]] * N)
check('hid-report-delta scenario 7', solve([[[0, [2]], [0, []], [0, [2]]]] * N), [[[['down', 'key', 2], ['up', 'key', 2], ['down', 'key', 2]], [2], [], 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 commit modifier snapshot rule and produces incorrect keyboard state or command output.

Each report is [modifier_mask,usage_slots]. Usages are integers >=0; 0 is padding, 1 is an error sentinel that invalidates the whole report. Other usages are unique logical keys even when slots duplicate. Modifier bits 0..7 identify M0..M7. Emit sorted key releases, sorted modifier releases, sorted modifier presses, then sorted key presses per valid report. Return emitted [phase,kind,identity] and final usage/modifier sets. 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):
        held=set(); chord=set(); out=[]; ignored=0
        for kind,dot in c:
            if kind in ('down','up') and not 1<dot<8:
                ignored+=1
                continue
            if kind=='down':
                held.add(dot)
                chord.add(dot)
            elif kind=='up' and dot in held:
                held.discard(dot)
                if not held and chord:
                    out.append(sorted(chord))
                    chord.clear()
            elif kind=='up': ignored+=1
            elif kind=='cancel':
                held.clear(); chord.clear()
            elif kind=='separator':
                if chord: out.append(sorted(chord))
                out.append([])
                held.clear(); chord.clear()
        return [out,sorted(held),sorted(chord),ignored]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('braille-chord scenario 0', solve([[]] * N), [[[], [], [], 0]] * N)
check('braille-chord scenario 1', solve([[['down', 1], ['down', 2]]] * N), [[[], [1, 2], [1, 2], 0]] * N)
check('braille-chord scenario 2', solve([[['down', 1], ['down', 8], ['up', 1], ['up', 8]]] * N), [[[[1, 8]], [], [], 0]] * N)
check('braille-chord scenario 3', solve([[['down', 2], ['down', 2], ['up', 2]]] * N), [[[[2]], [], [], 0]] * N)
check('braille-chord scenario 4', solve([[['down', 1], ['down', 2], ['up', 1]]] * N), [[[], [2], [1, 2], 0]] * N)
check('braille-chord scenario 5', solve([[['down', 1], ['up', 1], ['down', 2], ['up', 2]]] * N), [[[[1], [2]], [], [], 0]] * N)
check('braille-chord scenario 6', solve([[['down', 2], ['up', 3]]] * N), [[[], [2], [2], 1]] * N)
check('braille-chord scenario 7', solve([[['down', 0], ['up', 0], ['down', 9]]] * N), [[[], [], [], 3]] * N)
check('braille-chord scenario 8', solve([[['down', 1], ['down', 2], ['separator', 0]]] * N), [[[[1, 2], []], [], [], 0]] * N)
check('braille-chord scenario 9', solve([[['separator', 0]]] * N), [[[[]], [], [], 0]] * N)
check('braille-chord scenario 10', solve([[['down', 1], ['cancel', 0], ['up', 1]]] * N), [[[], [], [], 1]] * 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):
        held=set(); chord=set(); out=[]; ignored=0
        for kind,dot in c:
            if kind in ('down','up') and not 0<=dot<=8:
                ignored+=1
                continue
            if kind=='down':
                held.add(dot)
                chord.add(dot)
            elif kind=='up' and dot in held:
                held.discard(dot)
                if not held and chord:
                    out.append(sorted(chord))
                    chord.clear()
            elif kind=='up': ignored+=1
            elif kind=='cancel':
                held.clear(); chord.clear()
            elif kind=='separator':
                if chord: out.append(sorted(chord))
                out.append([])
                held.clear(); chord.clear()
        return [out,sorted(held),sorted(chord),ignored]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('braille-chord scenario 0', solve([[]] * N), [[[], [], [], 0]] * N)
check('braille-chord scenario 1', solve([[['down', 1], ['down', 2]]] * N), [[[], [1, 2], [1, 2], 0]] * N)
check('braille-chord scenario 2', solve([[['down', 1], ['down', 8], ['up', 1], ['up', 8]]] * N), [[[[1, 8]], [], [], 0]] * N)
check('braille-chord scenario 3', solve([[['down', 2], ['down', 2], ['up', 2]]] * N), [[[[2]], [], [], 0]] * N)
check('braille-chord scenario 4', solve([[['down', 1], ['down', 2], ['up', 1]]] * N), [[[], [2], [1, 2], 0]] * N)
check('braille-chord scenario 5', solve([[['down', 1], ['up', 1], ['down', 2], ['up', 2]]] * N), [[[[1], [2]], [], [], 0]] * N)
check('braille-chord scenario 6', solve([[['down', 2], ['up', 3]]] * N), [[[], [2], [2], 1]] * N)
check('braille-chord scenario 7', solve([[['down', 0], ['up', 0], ['down', 9]]] * N), [[[], [], [], 3]] * N)
check('braille-chord scenario 8', solve([[['down', 1], ['down', 2], ['separator', 0]]] * N), [[[[1, 2], []], [], [], 0]] * N)
check('braille-chord scenario 9', solve([[['separator', 0]]] * N), [[[[]], [], [], 0]] * N)
check('braille-chord scenario 10', solve([[['down', 1], ['cancel', 0], ['up', 1]]] * N), [[[], [], [], 1]] * 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 dot range rule and produces incorrect keyboard state or command output.

Events [kind,dot]. Dot values 1..8. Down adds a dot to held and accumulated chord; repeated down does not add another dot. Up releases a held dot and commits sorted accumulated dots only when the final held dot is released. Cancel clears held/chord without output; separator commits pending chord then emits empty dot list and resets. Return committed dot lists, held and accumulated sets. 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):
        held=set(); chord=set(); out=[]; ignored=0
        for kind,dot in c:
            if kind in ('down','up') and not 1<=dot<=8:
                ignored=1
                continue
            if kind=='down':
                held.add(dot)
                chord.add(dot)
            elif kind=='up' and dot in held:
                held.discard(dot)
                if not held and chord:
                    out.append(sorted(chord))
                    chord.clear()
            elif kind=='up': ignored+=1
            elif kind=='cancel':
                held.clear(); chord.clear()
            elif kind=='separator':
                if chord: out.append(sorted(chord))
                out.append([])
                held.clear(); chord.clear()
        return [out,sorted(held),sorted(chord),ignored]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('braille-chord scenario 0', solve([[]] * N), [[[], [], [], 0]] * N)
check('braille-chord scenario 1', solve([[['down', 1], ['down', 2]]] * N), [[[], [1, 2], [1, 2], 0]] * N)
check('braille-chord scenario 2', solve([[['down', 1], ['down', 8], ['up', 1], ['up', 8]]] * N), [[[[1, 8]], [], [], 0]] * N)
check('braille-chord scenario 3', solve([[['down', 2], ['down', 2], ['up', 2]]] * N), [[[[2]], [], [], 0]] * N)
check('braille-chord scenario 4', solve([[['down', 1], ['down', 2], ['up', 1]]] * N), [[[], [2], [1, 2], 0]] * N)
check('braille-chord scenario 5', solve([[['down', 1], ['up', 1], ['down', 2], ['up', 2]]] * N), [[[[1], [2]], [], [], 0]] * N)
check('braille-chord scenario 6', solve([[['down', 2], ['up', 3]]] * N), [[[], [2], [2], 1]] * N)
check('braille-chord scenario 7', solve([[['down', 0], ['up', 0], ['down', 9]]] * N), [[[], [], [], 3]] * N)
check('braille-chord scenario 8', solve([[['down', 1], ['down', 2], ['separator', 0]]] * N), [[[[1, 2], []], [], [], 0]] * N)
check('braille-chord scenario 9', solve([[['separator', 0]]] * N), [[[[]], [], [], 0]] * N)
check('braille-chord scenario 10', solve([[['down', 1], ['cancel', 0], ['up', 1]]] * N), [[[], [], [], 1]] * 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):
        held=set(); chord=set(); out=[]; ignored=0
        for kind,dot in c:
            if kind in ('down','up') and not 1<=dot<=8:
                ignored+=dot
                continue
            if kind=='down':
                held.add(dot)
                chord.add(dot)
            elif kind=='up' and dot in held:
                held.discard(dot)
                if not held and chord:
                    out.append(sorted(chord))
                    chord.clear()
            elif kind=='up': ignored+=1
            elif kind=='cancel':
                held.clear(); chord.clear()
            elif kind=='separator':
                if chord: out.append(sorted(chord))
                out.append([])
                held.clear(); chord.clear()
        return [out,sorted(held),sorted(chord),ignored]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('braille-chord scenario 0', solve([[]] * N), [[[], [], [], 0]] * N)
check('braille-chord scenario 1', solve([[['down', 1], ['down', 2]]] * N), [[[], [1, 2], [1, 2], 0]] * N)
check('braille-chord scenario 2', solve([[['down', 1], ['down', 8], ['up', 1], ['up', 8]]] * N), [[[[1, 8]], [], [], 0]] * N)
check('braille-chord scenario 3', solve([[['down', 2], ['down', 2], ['up', 2]]] * N), [[[[2]], [], [], 0]] * N)
check('braille-chord scenario 4', solve([[['down', 1], ['down', 2], ['up', 1]]] * N), [[[], [2], [1, 2], 0]] * N)
check('braille-chord scenario 5', solve([[['down', 1], ['up', 1], ['down', 2], ['up', 2]]] * N), [[[[1], [2]], [], [], 0]] * N)
check('braille-chord scenario 6', solve([[['down', 2], ['up', 3]]] * N), [[[], [2], [2], 1]] * N)
check('braille-chord scenario 7', solve([[['down', 0], ['up', 0], ['down', 9]]] * N), [[[], [], [], 3]] * N)
check('braille-chord scenario 8', solve([[['down', 1], ['down', 2], ['separator', 0]]] * N), [[[[1, 2], []], [], [], 0]] * N)
check('braille-chord scenario 9', solve([[['separator', 0]]] * N), [[[[]], [], [], 0]] * N)
check('braille-chord scenario 10', solve([[['down', 1], ['cancel', 0], ['up', 1]]] * N), [[[], [], [], 1]] * 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 ignored count rule and produces incorrect keyboard state or command output.

Events [kind,dot]. Dot values 1..8. Down adds a dot to held and accumulated chord; repeated down does not add another dot. Up releases a held dot and commits sorted accumulated dots only when the final held dot is released. Cancel clears held/chord without output; separator commits pending chord then emits empty dot list and resets. Return committed dot lists, held and accumulated sets. 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):
        held=set(); chord=set(); out=[]; ignored=0
        for kind,dot in c:
            if kind in ('down','up') and not 1<=dot<=8:
                ignored+=1
                continue
            if kind=='down':
                held.symmetric_difference_update({dot})
                chord.add(dot)
            elif kind=='up' and dot in held:
                held.discard(dot)
                if not held and chord:
                    out.append(sorted(chord))
                    chord.clear()
            elif kind=='up': ignored+=1
            elif kind=='cancel':
                held.clear(); chord.clear()
            elif kind=='separator':
                if chord: out.append(sorted(chord))
                out.append([])
                held.clear(); chord.clear()
        return [out,sorted(held),sorted(chord),ignored]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('braille-chord scenario 0', solve([[]] * N), [[[], [], [], 0]] * N)
check('braille-chord scenario 1', solve([[['down', 1], ['down', 2]]] * N), [[[], [1, 2], [1, 2], 0]] * N)
check('braille-chord scenario 2', solve([[['down', 1], ['down', 8], ['up', 1], ['up', 8]]] * N), [[[[1, 8]], [], [], 0]] * N)
check('braille-chord scenario 3', solve([[['down', 2], ['down', 2], ['up', 2]]] * N), [[[[2]], [], [], 0]] * N)
check('braille-chord scenario 4', solve([[['down', 1], ['down', 2], ['up', 1]]] * N), [[[], [2], [1, 2], 0]] * N)
check('braille-chord scenario 5', solve([[['down', 1], ['up', 1], ['down', 2], ['up', 2]]] * N), [[[[1], [2]], [], [], 0]] * N)
check('braille-chord scenario 6', solve([[['down', 2], ['up', 3]]] * N), [[[], [2], [2], 1]] * N)
check('braille-chord scenario 7', solve([[['down', 0], ['up', 0], ['down', 9]]] * N), [[[], [], [], 3]] * N)
check('braille-chord scenario 8', solve([[['down', 1], ['down', 2], ['separator', 0]]] * N), [[[[1, 2], []], [], [], 0]] * N)
check('braille-chord scenario 9', solve([[['separator', 0]]] * N), [[[[]], [], [], 0]] * N)
check('braille-chord scenario 10', solve([[['down', 1], ['cancel', 0], ['up', 1]]] * N), [[[], [], [], 1]] * 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):
        held=set(); chord=set(); out=[]; ignored=0
        for kind,dot in c:
            if kind in ('down','up') and not 1<=dot<=8:
                ignored+=1
                continue
            if kind=='down':
                held={dot}
                chord.add(dot)
            elif kind=='up' and dot in held:
                held.discard(dot)
                if not held and chord:
                    out.append(sorted(chord))
                    chord.clear()
            elif kind=='up': ignored+=1
            elif kind=='cancel':
                held.clear(); chord.clear()
            elif kind=='separator':
                if chord: out.append(sorted(chord))
                out.append([])
                held.clear(); chord.clear()
        return [out,sorted(held),sorted(chord),ignored]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('braille-chord scenario 0', solve([[]] * N), [[[], [], [], 0]] * N)
check('braille-chord scenario 1', solve([[['down', 1], ['down', 2]]] * N), [[[], [1, 2], [1, 2], 0]] * N)
check('braille-chord scenario 2', solve([[['down', 1], ['down', 8], ['up', 1], ['up', 8]]] * N), [[[[1, 8]], [], [], 0]] * N)
check('braille-chord scenario 3', solve([[['down', 2], ['down', 2], ['up', 2]]] * N), [[[[2]], [], [], 0]] * N)
check('braille-chord scenario 4', solve([[['down', 1], ['down', 2], ['up', 1]]] * N), [[[], [2], [1, 2], 0]] * N)
check('braille-chord scenario 5', solve([[['down', 1], ['up', 1], ['down', 2], ['up', 2]]] * N), [[[[1], [2]], [], [], 0]] * N)
check('braille-chord scenario 6', solve([[['down', 2], ['up', 3]]] * N), [[[], [2], [2], 1]] * N)
check('braille-chord scenario 7', solve([[['down', 0], ['up', 0], ['down', 9]]] * N), [[[], [], [], 3]] * N)
check('braille-chord scenario 8', solve([[['down', 1], ['down', 2], ['separator', 0]]] * N), [[[[1, 2], []], [], [], 0]] * N)
check('braille-chord scenario 9', solve([[['separator', 0]]] * N), [[[[]], [], [], 0]] * N)
check('braille-chord scenario 10', solve([[['down', 1], ['cancel', 0], ['up', 1]]] * N), [[[], [], [], 1]] * 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 held dot rule and produces incorrect keyboard state or command output.

Events [kind,dot]. Dot values 1..8. Down adds a dot to held and accumulated chord; repeated down does not add another dot. Up releases a held dot and commits sorted accumulated dots only when the final held dot is released. Cancel clears held/chord without output; separator commits pending chord then emits empty dot list and resets. Return committed dot lists, held and accumulated sets. 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):
        held=set(); chord=set(); out=[]; ignored=0
        for kind,dot in c:
            if kind in ('down','up') and not 1<=dot<=8:
                ignored+=1
                continue
            if kind=='down':
                held.add(dot)
                chord={dot}
            elif kind=='up' and dot in held:
                held.discard(dot)
                if not held and chord:
                    out.append(sorted(chord))
                    chord.clear()
            elif kind=='up': ignored+=1
            elif kind=='cancel':
                held.clear(); chord.clear()
            elif kind=='separator':
                if chord: out.append(sorted(chord))
                out.append([])
                held.clear(); chord.clear()
        return [out,sorted(held),sorted(chord),ignored]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('braille-chord scenario 0', solve([[]] * N), [[[], [], [], 0]] * N)
check('braille-chord scenario 1', solve([[['down', 1], ['down', 2]]] * N), [[[], [1, 2], [1, 2], 0]] * N)
check('braille-chord scenario 2', solve([[['down', 1], ['down', 8], ['up', 1], ['up', 8]]] * N), [[[[1, 8]], [], [], 0]] * N)
check('braille-chord scenario 3', solve([[['down', 2], ['down', 2], ['up', 2]]] * N), [[[[2]], [], [], 0]] * N)
check('braille-chord scenario 4', solve([[['down', 1], ['down', 2], ['up', 1]]] * N), [[[], [2], [1, 2], 0]] * N)
check('braille-chord scenario 5', solve([[['down', 1], ['up', 1], ['down', 2], ['up', 2]]] * N), [[[[1], [2]], [], [], 0]] * N)
check('braille-chord scenario 6', solve([[['down', 2], ['up', 3]]] * N), [[[], [2], [2], 1]] * N)
check('braille-chord scenario 7', solve([[['down', 0], ['up', 0], ['down', 9]]] * N), [[[], [], [], 3]] * N)
check('braille-chord scenario 8', solve([[['down', 1], ['down', 2], ['separator', 0]]] * N), [[[[1, 2], []], [], [], 0]] * N)
check('braille-chord scenario 9', solve([[['separator', 0]]] * N), [[[[]], [], [], 0]] * N)
check('braille-chord scenario 10', solve([[['down', 1], ['cancel', 0], ['up', 1]]] * N), [[[], [], [], 1]] * 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):
        held=set(); chord=set(); out=[]; ignored=0
        for kind,dot in c:
            if kind in ('down','up') and not 1<=dot<=8:
                ignored+=1
                continue
            if kind=='down':
                held.add(dot)
                chord.symmetric_difference_update({dot})
            elif kind=='up' and dot in held:
                held.discard(dot)
                if not held and chord:
                    out.append(sorted(chord))
                    chord.clear()
            elif kind=='up': ignored+=1
            elif kind=='cancel':
                held.clear(); chord.clear()
            elif kind=='separator':
                if chord: out.append(sorted(chord))
                out.append([])
                held.clear(); chord.clear()
        return [out,sorted(held),sorted(chord),ignored]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('braille-chord scenario 0', solve([[]] * N), [[[], [], [], 0]] * N)
check('braille-chord scenario 1', solve([[['down', 1], ['down', 2]]] * N), [[[], [1, 2], [1, 2], 0]] * N)
check('braille-chord scenario 2', solve([[['down', 1], ['down', 8], ['up', 1], ['up', 8]]] * N), [[[[1, 8]], [], [], 0]] * N)
check('braille-chord scenario 3', solve([[['down', 2], ['down', 2], ['up', 2]]] * N), [[[[2]], [], [], 0]] * N)
check('braille-chord scenario 4', solve([[['down', 1], ['down', 2], ['up', 1]]] * N), [[[], [2], [1, 2], 0]] * N)
check('braille-chord scenario 5', solve([[['down', 1], ['up', 1], ['down', 2], ['up', 2]]] * N), [[[[1], [2]], [], [], 0]] * N)
check('braille-chord scenario 6', solve([[['down', 2], ['up', 3]]] * N), [[[], [2], [2], 1]] * N)
check('braille-chord scenario 7', solve([[['down', 0], ['up', 0], ['down', 9]]] * N), [[[], [], [], 3]] * N)
check('braille-chord scenario 8', solve([[['down', 1], ['down', 2], ['separator', 0]]] * N), [[[[1, 2], []], [], [], 0]] * N)
check('braille-chord scenario 9', solve([[['separator', 0]]] * N), [[[[]], [], [], 0]] * N)
check('braille-chord scenario 10', solve([[['down', 1], ['cancel', 0], ['up', 1]]] * N), [[[], [], [], 1]] * 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 accumulate dot rule and produces incorrect keyboard state or command output.

Events [kind,dot]. Dot values 1..8. Down adds a dot to held and accumulated chord; repeated down does not add another dot. Up releases a held dot and commits sorted accumulated dots only when the final held dot is released. Cancel clears held/chord without output; separator commits pending chord then emits empty dot list and resets. Return committed dot lists, held and accumulated sets. 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):
        held=set(); chord=set(); out=[]; ignored=0
        for kind,dot in c:
            if kind in ('down','up') and not 1<=dot<=8:
                ignored+=1
                continue
            if kind=='down':
                held.add(dot)
                chord.add(dot)
            elif kind=='up' and bool(held):
                held.discard(dot)
                if not held and chord:
                    out.append(sorted(chord))
                    chord.clear()
            elif kind=='up': ignored+=1
            elif kind=='cancel':
                held.clear(); chord.clear()
            elif kind=='separator':
                if chord: out.append(sorted(chord))
                out.append([])
                held.clear(); chord.clear()
        return [out,sorted(held),sorted(chord),ignored]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('braille-chord scenario 0', solve([[]] * N), [[[], [], [], 0]] * N)
check('braille-chord scenario 1', solve([[['down', 1], ['down', 2]]] * N), [[[], [1, 2], [1, 2], 0]] * N)
check('braille-chord scenario 2', solve([[['down', 1], ['down', 8], ['up', 1], ['up', 8]]] * N), [[[[1, 8]], [], [], 0]] * N)
check('braille-chord scenario 3', solve([[['down', 2], ['down', 2], ['up', 2]]] * N), [[[[2]], [], [], 0]] * N)
check('braille-chord scenario 4', solve([[['down', 1], ['down', 2], ['up', 1]]] * N), [[[], [2], [1, 2], 0]] * N)
check('braille-chord scenario 5', solve([[['down', 1], ['up', 1], ['down', 2], ['up', 2]]] * N), [[[[1], [2]], [], [], 0]] * N)
check('braille-chord scenario 6', solve([[['down', 2], ['up', 3]]] * N), [[[], [2], [2], 1]] * N)
check('braille-chord scenario 7', solve([[['down', 0], ['up', 0], ['down', 9]]] * N), [[[], [], [], 3]] * N)
check('braille-chord scenario 8', solve([[['down', 1], ['down', 2], ['separator', 0]]] * N), [[[[1, 2], []], [], [], 0]] * N)
check('braille-chord scenario 9', solve([[['separator', 0]]] * N), [[[[]], [], [], 0]] * N)
check('braille-chord scenario 10', solve([[['down', 1], ['cancel', 0], ['up', 1]]] * N), [[[], [], [], 1]] * 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):
        held=set(); chord=set(); out=[]; ignored=0
        for kind,dot in c:
            if kind in ('down','up') and not 1<=dot<=8:
                ignored+=1
                continue
            if kind=='down':
                held.add(dot)
                chord.add(dot)
            elif kind=='up':
                held.discard(dot)
                if not held and chord:
                    out.append(sorted(chord))
                    chord.clear()
            elif kind=='up': ignored+=1
            elif kind=='cancel':
                held.clear(); chord.clear()
            elif kind=='separator':
                if chord: out.append(sorted(chord))
                out.append([])
                held.clear(); chord.clear()
        return [out,sorted(held),sorted(chord),ignored]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('braille-chord scenario 0', solve([[]] * N), [[[], [], [], 0]] * N)
check('braille-chord scenario 1', solve([[['down', 1], ['down', 2]]] * N), [[[], [1, 2], [1, 2], 0]] * N)
check('braille-chord scenario 2', solve([[['down', 1], ['down', 8], ['up', 1], ['up', 8]]] * N), [[[[1, 8]], [], [], 0]] * N)
check('braille-chord scenario 3', solve([[['down', 2], ['down', 2], ['up', 2]]] * N), [[[[2]], [], [], 0]] * N)
check('braille-chord scenario 4', solve([[['down', 1], ['down', 2], ['up', 1]]] * N), [[[], [2], [1, 2], 0]] * N)
check('braille-chord scenario 5', solve([[['down', 1], ['up', 1], ['down', 2], ['up', 2]]] * N), [[[[1], [2]], [], [], 0]] * N)
check('braille-chord scenario 6', solve([[['down', 2], ['up', 3]]] * N), [[[], [2], [2], 1]] * N)
check('braille-chord scenario 7', solve([[['down', 0], ['up', 0], ['down', 9]]] * N), [[[], [], [], 3]] * N)
check('braille-chord scenario 8', solve([[['down', 1], ['down', 2], ['separator', 0]]] * N), [[[[1, 2], []], [], [], 0]] * N)
check('braille-chord scenario 9', solve([[['separator', 0]]] * N), [[[[]], [], [], 0]] * N)
check('braille-chord scenario 10', solve([[['down', 1], ['cancel', 0], ['up', 1]]] * N), [[[], [], [], 1]] * 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 membership rule and produces incorrect keyboard state or command output.

Events [kind,dot]. Dot values 1..8. Down adds a dot to held and accumulated chord; repeated down does not add another dot. Up releases a held dot and commits sorted accumulated dots only when the final held dot is released. Cancel clears held/chord without output; separator commits pending chord then emits empty dot list and resets. Return committed dot lists, held and accumulated sets. 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):
        held=set(); chord=set(); out=[]; ignored=0
        for kind,dot in c:
            if kind in ('down','up') and not 1<=dot<=8:
                ignored+=1
                continue
            if kind=='down':
                held.add(dot)
                chord.add(dot)
            elif kind=='up' and dot in held:
                pass
                if not held and chord:
                    out.append(sorted(chord))
                    chord.clear()
            elif kind=='up': ignored+=1
            elif kind=='cancel':
                held.clear(); chord.clear()
            elif kind=='separator':
                if chord: out.append(sorted(chord))
                out.append([])
                held.clear(); chord.clear()
        return [out,sorted(held),sorted(chord),ignored]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('braille-chord scenario 0', solve([[]] * N), [[[], [], [], 0]] * N)
check('braille-chord scenario 1', solve([[['down', 1], ['down', 2]]] * N), [[[], [1, 2], [1, 2], 0]] * N)
check('braille-chord scenario 2', solve([[['down', 1], ['down', 8], ['up', 1], ['up', 8]]] * N), [[[[1, 8]], [], [], 0]] * N)
check('braille-chord scenario 3', solve([[['down', 2], ['down', 2], ['up', 2]]] * N), [[[[2]], [], [], 0]] * N)
check('braille-chord scenario 4', solve([[['down', 1], ['down', 2], ['up', 1]]] * N), [[[], [2], [1, 2], 0]] * N)
check('braille-chord scenario 5', solve([[['down', 1], ['up', 1], ['down', 2], ['up', 2]]] * N), [[[[1], [2]], [], [], 0]] * N)
check('braille-chord scenario 6', solve([[['down', 2], ['up', 3]]] * N), [[[], [2], [2], 1]] * N)
check('braille-chord scenario 7', solve([[['down', 0], ['up', 0], ['down', 9]]] * N), [[[], [], [], 3]] * N)
check('braille-chord scenario 8', solve([[['down', 1], ['down', 2], ['separator', 0]]] * N), [[[[1, 2], []], [], [], 0]] * N)
check('braille-chord scenario 9', solve([[['separator', 0]]] * N), [[[[]], [], [], 0]] * N)
check('braille-chord scenario 10', solve([[['down', 1], ['cancel', 0], ['up', 1]]] * N), [[[], [], [], 1]] * 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):
        held=set(); chord=set(); out=[]; ignored=0
        for kind,dot in c:
            if kind in ('down','up') and not 1<=dot<=8:
                ignored+=1
                continue
            if kind=='down':
                held.add(dot)
                chord.add(dot)
            elif kind=='up' and dot in held:
                held.clear()
                if not held and chord:
                    out.append(sorted(chord))
                    chord.clear()
            elif kind=='up': ignored+=1
            elif kind=='cancel':
                held.clear(); chord.clear()
            elif kind=='separator':
                if chord: out.append(sorted(chord))
                out.append([])
                held.clear(); chord.clear()
        return [out,sorted(held),sorted(chord),ignored]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('braille-chord scenario 0', solve([[]] * N), [[[], [], [], 0]] * N)
check('braille-chord scenario 1', solve([[['down', 1], ['down', 2]]] * N), [[[], [1, 2], [1, 2], 0]] * N)
check('braille-chord scenario 2', solve([[['down', 1], ['down', 8], ['up', 1], ['up', 8]]] * N), [[[[1, 8]], [], [], 0]] * N)
check('braille-chord scenario 3', solve([[['down', 2], ['down', 2], ['up', 2]]] * N), [[[[2]], [], [], 0]] * N)
check('braille-chord scenario 4', solve([[['down', 1], ['down', 2], ['up', 1]]] * N), [[[], [2], [1, 2], 0]] * N)
check('braille-chord scenario 5', solve([[['down', 1], ['up', 1], ['down', 2], ['up', 2]]] * N), [[[[1], [2]], [], [], 0]] * N)
check('braille-chord scenario 6', solve([[['down', 2], ['up', 3]]] * N), [[[], [2], [2], 1]] * N)
check('braille-chord scenario 7', solve([[['down', 0], ['up', 0], ['down', 9]]] * N), [[[], [], [], 3]] * N)
check('braille-chord scenario 8', solve([[['down', 1], ['down', 2], ['separator', 0]]] * N), [[[[1, 2], []], [], [], 0]] * N)
check('braille-chord scenario 9', solve([[['separator', 0]]] * N), [[[[]], [], [], 0]] * N)
check('braille-chord scenario 10', solve([[['down', 1], ['cancel', 0], ['up', 1]]] * N), [[[], [], [], 1]] * 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 dot rule and produces incorrect keyboard state or command output.

Events [kind,dot]. Dot values 1..8. Down adds a dot to held and accumulated chord; repeated down does not add another dot. Up releases a held dot and commits sorted accumulated dots only when the final held dot is released. Cancel clears held/chord without output; separator commits pending chord then emits empty dot list and resets. Return committed dot lists, held and accumulated sets. 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):
        held=set(); chord=set(); out=[]; ignored=0
        for kind,dot in c:
            if kind in ('down','up') and not 1<=dot<=8:
                ignored+=1
                continue
            if kind=='down':
                held.add(dot)
                chord.add(dot)
            elif kind=='up' and dot in held:
                held.discard(dot)
                if chord:
                    out.append(sorted(chord))
                    chord.clear()
            elif kind=='up': ignored+=1
            elif kind=='cancel':
                held.clear(); chord.clear()
            elif kind=='separator':
                if chord: out.append(sorted(chord))
                out.append([])
                held.clear(); chord.clear()
        return [out,sorted(held),sorted(chord),ignored]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('braille-chord scenario 0', solve([[]] * N), [[[], [], [], 0]] * N)
check('braille-chord scenario 1', solve([[['down', 1], ['down', 2]]] * N), [[[], [1, 2], [1, 2], 0]] * N)
check('braille-chord scenario 2', solve([[['down', 1], ['down', 8], ['up', 1], ['up', 8]]] * N), [[[[1, 8]], [], [], 0]] * N)
check('braille-chord scenario 3', solve([[['down', 2], ['down', 2], ['up', 2]]] * N), [[[[2]], [], [], 0]] * N)
check('braille-chord scenario 4', solve([[['down', 1], ['down', 2], ['up', 1]]] * N), [[[], [2], [1, 2], 0]] * N)
check('braille-chord scenario 5', solve([[['down', 1], ['up', 1], ['down', 2], ['up', 2]]] * N), [[[[1], [2]], [], [], 0]] * N)
check('braille-chord scenario 6', solve([[['down', 2], ['up', 3]]] * N), [[[], [2], [2], 1]] * N)
check('braille-chord scenario 7', solve([[['down', 0], ['up', 0], ['down', 9]]] * N), [[[], [], [], 3]] * N)
check('braille-chord scenario 8', solve([[['down', 1], ['down', 2], ['separator', 0]]] * N), [[[[1, 2], []], [], [], 0]] * N)
check('braille-chord scenario 9', solve([[['separator', 0]]] * N), [[[[]], [], [], 0]] * N)
check('braille-chord scenario 10', solve([[['down', 1], ['cancel', 0], ['up', 1]]] * N), [[[], [], [], 1]] * 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):
        held=set(); chord=set(); out=[]; ignored=0
        for kind,dot in c:
            if kind in ('down','up') and not 1<=dot<=8:
                ignored+=1
                continue
            if kind=='down':
                held.add(dot)
                chord.add(dot)
            elif kind=='up' and dot in held:
                held.discard(dot)
                if len(held)<=1 and chord:
                    out.append(sorted(chord))
                    chord.clear()
            elif kind=='up': ignored+=1
            elif kind=='cancel':
                held.clear(); chord.clear()
            elif kind=='separator':
                if chord: out.append(sorted(chord))
                out.append([])
                held.clear(); chord.clear()
        return [out,sorted(held),sorted(chord),ignored]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('braille-chord scenario 0', solve([[]] * N), [[[], [], [], 0]] * N)
check('braille-chord scenario 1', solve([[['down', 1], ['down', 2]]] * N), [[[], [1, 2], [1, 2], 0]] * N)
check('braille-chord scenario 2', solve([[['down', 1], ['down', 8], ['up', 1], ['up', 8]]] * N), [[[[1, 8]], [], [], 0]] * N)
check('braille-chord scenario 3', solve([[['down', 2], ['down', 2], ['up', 2]]] * N), [[[[2]], [], [], 0]] * N)
check('braille-chord scenario 4', solve([[['down', 1], ['down', 2], ['up', 1]]] * N), [[[], [2], [1, 2], 0]] * N)
check('braille-chord scenario 5', solve([[['down', 1], ['up', 1], ['down', 2], ['up', 2]]] * N), [[[[1], [2]], [], [], 0]] * N)
check('braille-chord scenario 6', solve([[['down', 2], ['up', 3]]] * N), [[[], [2], [2], 1]] * N)
check('braille-chord scenario 7', solve([[['down', 0], ['up', 0], ['down', 9]]] * N), [[[], [], [], 3]] * N)
check('braille-chord scenario 8', solve([[['down', 1], ['down', 2], ['separator', 0]]] * N), [[[[1, 2], []], [], [], 0]] * N)
check('braille-chord scenario 9', solve([[['separator', 0]]] * N), [[[[]], [], [], 0]] * N)
check('braille-chord scenario 10', solve([[['down', 1], ['cancel', 0], ['up', 1]]] * N), [[[], [], [], 1]] * 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 commit final rule and produces incorrect keyboard state or command output.

Events [kind,dot]. Dot values 1..8. Down adds a dot to held and accumulated chord; repeated down does not add another dot. Up releases a held dot and commits sorted accumulated dots only when the final held dot is released. Cancel clears held/chord without output; separator commits pending chord then emits empty dot list and resets. Return committed dot lists, held and accumulated sets. 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):
        held=set(); chord=set(); out=[]; ignored=0
        for kind,dot in c:
            if kind in ('down','up') and not 1<=dot<=8:
                ignored+=1
                continue
            if kind=='down':
                held.add(dot)
                chord.add(dot)
            elif kind=='up' and dot in held:
                held.discard(dot)
                if not held and chord:
                    out.append(sorted(held))
                    chord.clear()
            elif kind=='up': ignored+=1
            elif kind=='cancel':
                held.clear(); chord.clear()
            elif kind=='separator':
                if chord: out.append(sorted(chord))
                out.append([])
                held.clear(); chord.clear()
        return [out,sorted(held),sorted(chord),ignored]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('braille-chord scenario 0', solve([[]] * N), [[[], [], [], 0]] * N)
check('braille-chord scenario 1', solve([[['down', 1], ['down', 2]]] * N), [[[], [1, 2], [1, 2], 0]] * N)
check('braille-chord scenario 2', solve([[['down', 1], ['down', 8], ['up', 1], ['up', 8]]] * N), [[[[1, 8]], [], [], 0]] * N)
check('braille-chord scenario 3', solve([[['down', 2], ['down', 2], ['up', 2]]] * N), [[[[2]], [], [], 0]] * N)
check('braille-chord scenario 4', solve([[['down', 1], ['down', 2], ['up', 1]]] * N), [[[], [2], [1, 2], 0]] * N)
check('braille-chord scenario 5', solve([[['down', 1], ['up', 1], ['down', 2], ['up', 2]]] * N), [[[[1], [2]], [], [], 0]] * N)
check('braille-chord scenario 6', solve([[['down', 2], ['up', 3]]] * N), [[[], [2], [2], 1]] * N)
check('braille-chord scenario 7', solve([[['down', 0], ['up', 0], ['down', 9]]] * N), [[[], [], [], 3]] * N)
check('braille-chord scenario 8', solve([[['down', 1], ['down', 2], ['separator', 0]]] * N), [[[[1, 2], []], [], [], 0]] * N)
check('braille-chord scenario 9', solve([[['separator', 0]]] * N), [[[[]], [], [], 0]] * N)
check('braille-chord scenario 10', solve([[['down', 1], ['cancel', 0], ['up', 1]]] * N), [[[], [], [], 1]] * 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):
        held=set(); chord=set(); out=[]; ignored=0
        for kind,dot in c:
            if kind in ('down','up') and not 1<=dot<=8:
                ignored+=1
                continue
            if kind=='down':
                held.add(dot)
                chord.add(dot)
            elif kind=='up' and dot in held:
                held.discard(dot)
                if not held and chord:
                    out.append(sorted(chord,reverse=True))
                    chord.clear()
            elif kind=='up': ignored+=1
            elif kind=='cancel':
                held.clear(); chord.clear()
            elif kind=='separator':
                if chord: out.append(sorted(chord))
                out.append([])
                held.clear(); chord.clear()
        return [out,sorted(held),sorted(chord),ignored]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('braille-chord scenario 0', solve([[]] * N), [[[], [], [], 0]] * N)
check('braille-chord scenario 1', solve([[['down', 1], ['down', 2]]] * N), [[[], [1, 2], [1, 2], 0]] * N)
check('braille-chord scenario 2', solve([[['down', 1], ['down', 8], ['up', 1], ['up', 8]]] * N), [[[[1, 8]], [], [], 0]] * N)
check('braille-chord scenario 3', solve([[['down', 2], ['down', 2], ['up', 2]]] * N), [[[[2]], [], [], 0]] * N)
check('braille-chord scenario 4', solve([[['down', 1], ['down', 2], ['up', 1]]] * N), [[[], [2], [1, 2], 0]] * N)
check('braille-chord scenario 5', solve([[['down', 1], ['up', 1], ['down', 2], ['up', 2]]] * N), [[[[1], [2]], [], [], 0]] * N)
check('braille-chord scenario 6', solve([[['down', 2], ['up', 3]]] * N), [[[], [2], [2], 1]] * N)
check('braille-chord scenario 7', solve([[['down', 0], ['up', 0], ['down', 9]]] * N), [[[], [], [], 3]] * N)
check('braille-chord scenario 8', solve([[['down', 1], ['down', 2], ['separator', 0]]] * N), [[[[1, 2], []], [], [], 0]] * N)
check('braille-chord scenario 9', solve([[['separator', 0]]] * N), [[[[]], [], [], 0]] * N)
check('braille-chord scenario 10', solve([[['down', 1], ['cancel', 0], ['up', 1]]] * N), [[[], [], [], 1]] * 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 commit content rule and produces incorrect keyboard state or command output.

Events [kind,dot]. Dot values 1..8. Down adds a dot to held and accumulated chord; repeated down does not add another dot. Up releases a held dot and commits sorted accumulated dots only when the final held dot is released. Cancel clears held/chord without output; separator commits pending chord then emits empty dot list and resets. Return committed dot lists, held and accumulated sets. 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):
        held=set(); chord=set(); out=[]; ignored=0
        for kind,dot in c:
            if kind in ('down','up') and not 1<=dot<=8:
                ignored+=1
                continue
            if kind=='down':
                held.add(dot)
                chord.add(dot)
            elif kind=='up' and dot in held:
                held.discard(dot)
                if not held and chord:
                    out.append(sorted(chord))
                    pass
            elif kind=='up': ignored+=1
            elif kind=='cancel':
                held.clear(); chord.clear()
            elif kind=='separator':
                if chord: out.append(sorted(chord))
                out.append([])
                held.clear(); chord.clear()
        return [out,sorted(held),sorted(chord),ignored]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('braille-chord scenario 0', solve([[]] * N), [[[], [], [], 0]] * N)
check('braille-chord scenario 1', solve([[['down', 1], ['down', 2]]] * N), [[[], [1, 2], [1, 2], 0]] * N)
check('braille-chord scenario 2', solve([[['down', 1], ['down', 8], ['up', 1], ['up', 8]]] * N), [[[[1, 8]], [], [], 0]] * N)
check('braille-chord scenario 3', solve([[['down', 2], ['down', 2], ['up', 2]]] * N), [[[[2]], [], [], 0]] * N)
check('braille-chord scenario 4', solve([[['down', 1], ['down', 2], ['up', 1]]] * N), [[[], [2], [1, 2], 0]] * N)
check('braille-chord scenario 5', solve([[['down', 1], ['up', 1], ['down', 2], ['up', 2]]] * N), [[[[1], [2]], [], [], 0]] * N)
check('braille-chord scenario 6', solve([[['down', 2], ['up', 3]]] * N), [[[], [2], [2], 1]] * N)
check('braille-chord scenario 7', solve([[['down', 0], ['up', 0], ['down', 9]]] * N), [[[], [], [], 3]] * N)
check('braille-chord scenario 8', solve([[['down', 1], ['down', 2], ['separator', 0]]] * N), [[[[1, 2], []], [], [], 0]] * N)
check('braille-chord scenario 9', solve([[['separator', 0]]] * N), [[[[]], [], [], 0]] * N)
check('braille-chord scenario 10', solve([[['down', 1], ['cancel', 0], ['up', 1]]] * N), [[[], [], [], 1]] * 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):
        held=set(); chord=set(); out=[]; ignored=0
        for kind,dot in c:
            if kind in ('down','up') and not 1<=dot<=8:
                ignored+=1
                continue
            if kind=='down':
                held.add(dot)
                chord.add(dot)
            elif kind=='up' and dot in held:
                held.discard(dot)
                if not held and chord:
                    out.append(sorted(chord))
                    chord={dot}
            elif kind=='up': ignored+=1
            elif kind=='cancel':
                held.clear(); chord.clear()
            elif kind=='separator':
                if chord: out.append(sorted(chord))
                out.append([])
                held.clear(); chord.clear()
        return [out,sorted(held),sorted(chord),ignored]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('braille-chord scenario 0', solve([[]] * N), [[[], [], [], 0]] * N)
check('braille-chord scenario 1', solve([[['down', 1], ['down', 2]]] * N), [[[], [1, 2], [1, 2], 0]] * N)
check('braille-chord scenario 2', solve([[['down', 1], ['down', 8], ['up', 1], ['up', 8]]] * N), [[[[1, 8]], [], [], 0]] * N)
check('braille-chord scenario 3', solve([[['down', 2], ['down', 2], ['up', 2]]] * N), [[[[2]], [], [], 0]] * N)
check('braille-chord scenario 4', solve([[['down', 1], ['down', 2], ['up', 1]]] * N), [[[], [2], [1, 2], 0]] * N)
check('braille-chord scenario 5', solve([[['down', 1], ['up', 1], ['down', 2], ['up', 2]]] * N), [[[[1], [2]], [], [], 0]] * N)
check('braille-chord scenario 6', solve([[['down', 2], ['up', 3]]] * N), [[[], [2], [2], 1]] * N)
check('braille-chord scenario 7', solve([[['down', 0], ['up', 0], ['down', 9]]] * N), [[[], [], [], 3]] * N)
check('braille-chord scenario 8', solve([[['down', 1], ['down', 2], ['separator', 0]]] * N), [[[[1, 2], []], [], [], 0]] * N)
check('braille-chord scenario 9', solve([[['separator', 0]]] * N), [[[[]], [], [], 0]] * N)
check('braille-chord scenario 10', solve([[['down', 1], ['cancel', 0], ['up', 1]]] * N), [[[], [], [], 1]] * 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 committed rule and produces incorrect keyboard state or command output.

Events [kind,dot]. Dot values 1..8. Down adds a dot to held and accumulated chord; repeated down does not add another dot. Up releases a held dot and commits sorted accumulated dots only when the final held dot is released. Cancel clears held/chord without output; separator commits pending chord then emits empty dot list and resets. Return committed dot lists, held and accumulated sets. 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):
        held=set(); chord=set(); out=[]; ignored=0
        for kind,dot in c:
            if kind in ('down','up') and not 1<=dot<=8:
                ignored+=1
                continue
            if kind=='down':
                held.add(dot)
                chord.add(dot)
            elif kind=='up' and dot in held:
                held.discard(dot)
                if not held and chord:
                    out.append(sorted(chord))
                    chord.clear()
            elif kind=='up': ignored+=1
            elif kind=='cancel':
                held.clear(); chord.clear()
            elif kind=='separator':
                if chord: out.append(sorted(chord))
                out.append([0])
                held.clear(); chord.clear()
        return [out,sorted(held),sorted(chord),ignored]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('braille-chord scenario 0', solve([[]] * N), [[[], [], [], 0]] * N)
check('braille-chord scenario 1', solve([[['down', 1], ['down', 2]]] * N), [[[], [1, 2], [1, 2], 0]] * N)
check('braille-chord scenario 2', solve([[['down', 1], ['down', 8], ['up', 1], ['up', 8]]] * N), [[[[1, 8]], [], [], 0]] * N)
check('braille-chord scenario 3', solve([[['down', 2], ['down', 2], ['up', 2]]] * N), [[[[2]], [], [], 0]] * N)
check('braille-chord scenario 4', solve([[['down', 1], ['down', 2], ['up', 1]]] * N), [[[], [2], [1, 2], 0]] * N)
check('braille-chord scenario 5', solve([[['down', 1], ['up', 1], ['down', 2], ['up', 2]]] * N), [[[[1], [2]], [], [], 0]] * N)
check('braille-chord scenario 6', solve([[['down', 2], ['up', 3]]] * N), [[[], [2], [2], 1]] * N)
check('braille-chord scenario 7', solve([[['down', 0], ['up', 0], ['down', 9]]] * N), [[[], [], [], 3]] * N)
check('braille-chord scenario 8', solve([[['down', 1], ['down', 2], ['separator', 0]]] * N), [[[[1, 2], []], [], [], 0]] * N)
check('braille-chord scenario 9', solve([[['separator', 0]]] * N), [[[[]], [], [], 0]] * N)
check('braille-chord scenario 10', solve([[['down', 1], ['cancel', 0], ['up', 1]]] * N), [[[], [], [], 1]] * 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):
        held=set(); chord=set(); out=[]; ignored=0
        for kind,dot in c:
            if kind in ('down','up') and not 1<=dot<=8:
                ignored+=1
                continue
            if kind=='down':
                held.add(dot)
                chord.add(dot)
            elif kind=='up' and dot in held:
                held.discard(dot)
                if not held and chord:
                    out.append(sorted(chord))
                    chord.clear()
            elif kind=='up': ignored+=1
            elif kind=='cancel':
                held.clear(); chord.clear()
            elif kind=='separator':
                if chord: out.append(sorted(chord))
                pass
                held.clear(); chord.clear()
        return [out,sorted(held),sorted(chord),ignored]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('braille-chord scenario 0', solve([[]] * N), [[[], [], [], 0]] * N)
check('braille-chord scenario 1', solve([[['down', 1], ['down', 2]]] * N), [[[], [1, 2], [1, 2], 0]] * N)
check('braille-chord scenario 2', solve([[['down', 1], ['down', 8], ['up', 1], ['up', 8]]] * N), [[[[1, 8]], [], [], 0]] * N)
check('braille-chord scenario 3', solve([[['down', 2], ['down', 2], ['up', 2]]] * N), [[[[2]], [], [], 0]] * N)
check('braille-chord scenario 4', solve([[['down', 1], ['down', 2], ['up', 1]]] * N), [[[], [2], [1, 2], 0]] * N)
check('braille-chord scenario 5', solve([[['down', 1], ['up', 1], ['down', 2], ['up', 2]]] * N), [[[[1], [2]], [], [], 0]] * N)
check('braille-chord scenario 6', solve([[['down', 2], ['up', 3]]] * N), [[[], [2], [2], 1]] * N)
check('braille-chord scenario 7', solve([[['down', 0], ['up', 0], ['down', 9]]] * N), [[[], [], [], 3]] * N)
check('braille-chord scenario 8', solve([[['down', 1], ['down', 2], ['separator', 0]]] * N), [[[[1, 2], []], [], [], 0]] * N)
check('braille-chord scenario 9', solve([[['separator', 0]]] * N), [[[[]], [], [], 0]] * N)
check('braille-chord scenario 10', solve([[['down', 1], ['cancel', 0], ['up', 1]]] * N), [[[], [], [], 1]] * 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 separator empty rule and produces incorrect keyboard state or command output.

Events [kind,dot]. Dot values 1..8. Down adds a dot to held and accumulated chord; repeated down does not add another dot. Up releases a held dot and commits sorted accumulated dots only when the final held dot is released. Cancel clears held/chord without output; separator commits pending chord then emits empty dot list and resets. Return committed dot lists, held and accumulated sets. 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):
        mapping,window,events=c
        text=''; pending=None
        for kind,value,now in events:
            if kind=='press' and value in mapping:
                if pending is not None and now>pending[2]:
                    text+=mapping[pending[0]][pending[1]]; pending=None
                if pending is not None and pending[0]==value:
                    pending[1]=(pending[1]+1)%len(mapping[value])
                    pending[2]=now+window
                else:
                    if pending is not None: text+=mapping[pending[0]][pending[1]]
                    pending=[value,0,now+window]
            elif kind=='tick' and pending is not None and now>=pending[2]:
                text+=mapping[pending[0]][pending[1]]; pending=None
            elif kind=='backspace':
                if pending is not None: pending=None
                else: text=text[:-1]
            elif kind=='space':
                if pending is not None: text+=mapping[pending[0]][pending[1]]
                pending=None; text+=' '
            elif kind=='cancel': pending=None
        return [text,pending]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('multi-tap-keypad scenario 0', solve([[{'2': 'abc', '3': 'de'}, 5, [['press', '2', 10], ['press', '2', 11]]]] * N), [['', ['2', 1, 16]]] * N)
check('multi-tap-keypad scenario 1', solve([[{'2': 'abc', '3': 'de'}, 5, []]] * N), [['', None]] * N)
check('multi-tap-keypad scenario 2', solve([[{'2': 'abc', '3': 'de'}, 5, [['press', '2', 10], ['press', '2', 11], ['press', '2', 12], ['press', '2', 13], ['tick', '', 18]]]] * N), [['a', None]] * N)
check('multi-tap-keypad scenario 3', solve([[{'2': 'abc', '3': 'de'}, 5, [['press', '2', 10], ['press', '2', 15]]]] * N), [['a', ['2', 0, 20]]] * N)
check('multi-tap-keypad scenario 4', solve([[{'2': 'abc', '3': 'de'}, 5, [['press', '2', 10], ['press', '3', 12], ['tick', '', 17]]]] * N), [['ad', None]] * N)
check('multi-tap-keypad scenario 5', solve([[{'2': 'abc', '3': 'de'}, 5, [['press', '2', 10], ['tick', '', 12]]]] * N), [['', ['2', 0, 15]]] * N)
check('multi-tap-keypad scenario 6', solve([[{'2': 'abc', '3': 'de'}, 5, [['press', '2', 10], ['tick', '', 15], ['press', '3', 16], ['backspace', '', 17]]]] * N), [['a', None]] * N)
check('multi-tap-keypad scenario 7', solve([[{'2': 'abc', '3': 'de'}, 5, [['press', '2', 10], ['press', '3', 11], ['space', '', 12], ['backspace', '', 13]]]] * N), [['ad', None]] * N)
check('multi-tap-keypad scenario 8', solve([[{'2': 'abc', '3': 'de'}, 5, [['press', '2', 10], ['space', '', 12]]]] * N), [['a ', None]] * N)
check('multi-tap-keypad scenario 9', solve([[{'2': 'abc', '3': 'de'}, 5, [['press', '?', 10], ['backspace', '', 11]]]] * N), [['', None]] * 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):
        mapping,window,events=c
        text=''; pending=None
        for kind,value,now in events:
            if kind=='press' and value in mapping:
                if pending is not None and now>=window:
                    text+=mapping[pending[0]][pending[1]]; pending=None
                if pending is not None and pending[0]==value:
                    pending[1]=(pending[1]+1)%len(mapping[value])
                    pending[2]=now+window
                else:
                    if pending is not None: text+=mapping[pending[0]][pending[1]]
                    pending=[value,0,now+window]
            elif kind=='tick' and pending is not None and now>=pending[2]:
                text+=mapping[pending[0]][pending[1]]; pending=None
            elif kind=='backspace':
                if pending is not None: pending=None
                else: text=text[:-1]
            elif kind=='space':
                if pending is not None: text+=mapping[pending[0]][pending[1]]
                pending=None; text+=' '
            elif kind=='cancel': pending=None
        return [text,pending]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('multi-tap-keypad scenario 0', solve([[{'2': 'abc', '3': 'de'}, 5, [['press', '2', 10], ['press', '2', 11]]]] * N), [['', ['2', 1, 16]]] * N)
check('multi-tap-keypad scenario 1', solve([[{'2': 'abc', '3': 'de'}, 5, []]] * N), [['', None]] * N)
check('multi-tap-keypad scenario 2', solve([[{'2': 'abc', '3': 'de'}, 5, [['press', '2', 10], ['press', '2', 11], ['press', '2', 12], ['press', '2', 13], ['tick', '', 18]]]] * N), [['a', None]] * N)
check('multi-tap-keypad scenario 3', solve([[{'2': 'abc', '3': 'de'}, 5, [['press', '2', 10], ['press', '2', 15]]]] * N), [['a', ['2', 0, 20]]] * N)
check('multi-tap-keypad scenario 4', solve([[{'2': 'abc', '3': 'de'}, 5, [['press', '2', 10], ['press', '3', 12], ['tick', '', 17]]]] * N), [['ad', None]] * N)
check('multi-tap-keypad scenario 5', solve([[{'2': 'abc', '3': 'de'}, 5, [['press', '2', 10], ['tick', '', 12]]]] * N), [['', ['2', 0, 15]]] * N)
check('multi-tap-keypad scenario 6', solve([[{'2': 'abc', '3': 'de'}, 5, [['press', '2', 10], ['tick', '', 15], ['press', '3', 16], ['backspace', '', 17]]]] * N), [['a', None]] * N)
check('multi-tap-keypad scenario 7', solve([[{'2': 'abc', '3': 'de'}, 5, [['press', '2', 10], ['press', '3', 11], ['space', '', 12], ['backspace', '', 13]]]] * N), [['ad', None]] * N)
check('multi-tap-keypad scenario 8', solve([[{'2': 'abc', '3': 'de'}, 5, [['press', '2', 10], ['space', '', 12]]]] * N), [['a ', None]] * N)
check('multi-tap-keypad scenario 9', solve([[{'2': 'abc', '3': 'de'}, 5, [['press', '?', 10], ['backspace', '', 11]]]] * N), [['', None]] * 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 expiry rule and produces incorrect keyboard state or command output.

Case [map,window,events]. Map maps keys to nonempty character strings. Events [kind,value,time]. Valid press cycles the pending same-key character before deadline, otherwise commits previous and starts new. Tick at or past deadline commits. Backspace cancels pending character before deleting committed text. Space commits pending then adds space; cancel drops pending only. Unknown press is ignored. Return committed text and pending [key,index,deadline] or None. 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):
        mapping,window,events=c
        text=''; pending=None
        for kind,value,now in events:
            if kind=='press' and value in mapping:
                if pending is not None and now>=pending[2]:
                    text+=mapping[pending[0]][pending[1]]; pending=None
                if pending is not None and True:
                    pending[1]=(pending[1]+1)%len(mapping[value])
                    pending[2]=now+window
                else:
                    if pending is not None: text+=mapping[pending[0]][pending[1]]
                    pending=[value,0,now+window]
            elif kind=='tick' and pending is not None and now>=pending[2]:
                text+=mapping[pending[0]][pending[1]]; pending=None
            elif kind=='backspace':
                if pending is not None: pending=None
                else: text=text[:-1]
            elif kind=='space':
                if pending is not None: text+=mapping[pending[0]][pending[1]]
                pending=None; text+=' '
            elif kind=='cancel': pending=None
        return [text,pending]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('multi-tap-keypad scenario 0', solve([[{'2': 'abc', '3': 'de'}, 5, [['press', '2', 10], ['press', '2', 11]]]] * N), [['', ['2', 1, 16]]] * N)
check('multi-tap-keypad scenario 1', solve([[{'2': 'abc', '3': 'de'}, 5, []]] * N), [['', None]] * N)
check('multi-tap-keypad scenario 2', solve([[{'2': 'abc', '3': 'de'}, 5, [['press', '2', 10], ['press', '2', 11], ['press', '2', 12], ['press', '2', 13], ['tick', '', 18]]]] * N), [['a', None]] * N)
check('multi-tap-keypad scenario 3', solve([[{'2': 'abc', '3': 'de'}, 5, [['press', '2', 10], ['press', '2', 15]]]] * N), [['a', ['2', 0, 20]]] * N)
check('multi-tap-keypad scenario 4', solve([[{'2': 'abc', '3': 'de'}, 5, [['press', '2', 10], ['press', '3', 12], ['tick', '', 17]]]] * N), [['ad', None]] * N)
check('multi-tap-keypad scenario 5', solve([[{'2': 'abc', '3': 'de'}, 5, [['press', '2', 10], ['tick', '', 12]]]] * N), [['', ['2', 0, 15]]] * N)
check('multi-tap-keypad scenario 6', solve([[{'2': 'abc', '3': 'de'}, 5, [['press', '2', 10], ['tick', '', 15], ['press', '3', 16], ['backspace', '', 17]]]] * N), [['a', None]] * N)
check('multi-tap-keypad scenario 7', solve([[{'2': 'abc', '3': 'de'}, 5, [['press', '2', 10], ['press', '3', 11], ['space', '', 12], ['backspace', '', 13]]]] * N), [['ad', None]] * N)
check('multi-tap-keypad scenario 8', solve([[{'2': 'abc', '3': 'de'}, 5, [['press', '2', 10], ['space', '', 12]]]] * N), [['a ', None]] * N)
check('multi-tap-keypad scenario 9', solve([[{'2': 'abc', '3': 'de'}, 5, [['press', '?', 10], ['backspace', '', 11]]]] * N), [['', None]] * 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):
        mapping,window,events=c
        text=''; pending=None
        for kind,value,now in events:
            if kind=='press' and value in mapping:
                if pending is not None and now>=pending[2]:
                    text+=mapping[pending[0]][pending[1]]; pending=None
                if pending is not None and pending[0]!=value:
                    pending[1]=(pending[1]+1)%len(mapping[value])
                    pending[2]=now+window
                else:
                    if pending is not None: text+=mapping[pending[0]][pending[1]]
                    pending=[value,0,now+window]
            elif kind=='tick' and pending is not None and now>=pending[2]:
                text+=mapping[pending[0]][pending[1]]; pending=None
            elif kind=='backspace':
                if pending is not None: pending=None
                else: text=text[:-1]
            elif kind=='space':
                if pending is not None: text+=mapping[pending[0]][pending[1]]
                pending=None; text+=' '
            elif kind=='cancel': pending=None
        return [text,pending]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('multi-tap-keypad scenario 0', solve([[{'2': 'abc', '3': 'de'}, 5, [['press', '2', 10], ['press', '2', 11]]]] * N), [['', ['2', 1, 16]]] * N)
check('multi-tap-keypad scenario 1', solve([[{'2': 'abc', '3': 'de'}, 5, []]] * N), [['', None]] * N)
check('multi-tap-keypad scenario 2', solve([[{'2': 'abc', '3': 'de'}, 5, [['press', '2', 10], ['press', '2', 11], ['press', '2', 12], ['press', '2', 13], ['tick', '', 18]]]] * N), [['a', None]] * N)
check('multi-tap-keypad scenario 3', solve([[{'2': 'abc', '3': 'de'}, 5, [['press', '2', 10], ['press', '2', 15]]]] * N), [['a', ['2', 0, 20]]] * N)
check('multi-tap-keypad scenario 4', solve([[{'2': 'abc', '3': 'de'}, 5, [['press', '2', 10], ['press', '3', 12], ['tick', '', 17]]]] * N), [['ad', None]] * N)
check('multi-tap-keypad scenario 5', solve([[{'2': 'abc', '3': 'de'}, 5, [['press', '2', 10], ['tick', '', 12]]]] * N), [['', ['2', 0, 15]]] * N)
check('multi-tap-keypad scenario 6', solve([[{'2': 'abc', '3': 'de'}, 5, [['press', '2', 10], ['tick', '', 15], ['press', '3', 16], ['backspace', '', 17]]]] * N), [['a', None]] * N)
check('multi-tap-keypad scenario 7', solve([[{'2': 'abc', '3': 'de'}, 5, [['press', '2', 10], ['press', '3', 11], ['space', '', 12], ['backspace', '', 13]]]] * N), [['ad', None]] * N)
check('multi-tap-keypad scenario 8', solve([[{'2': 'abc', '3': 'de'}, 5, [['press', '2', 10], ['space', '', 12]]]] * N), [['a ', None]] * N)
check('multi-tap-keypad scenario 9', solve([[{'2': 'abc', '3': 'de'}, 5, [['press', '?', 10], ['backspace', '', 11]]]] * N), [['', None]] * 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 same key cycle rule and produces incorrect keyboard state or command output.

Case [map,window,events]. Map maps keys to nonempty character strings. Events [kind,value,time]. Valid press cycles the pending same-key character before deadline, otherwise commits previous and starts new. Tick at or past deadline commits. Backspace cancels pending character before deleting committed text. Space commits pending then adds space; cancel drops pending only. Unknown press is ignored. Return committed text and pending [key,index,deadline] or None. 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