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

N = 1
observations = []
def solve(d):
    try:
        rows,mapping,null_partition,count=d
        receivers=[[] for _ in range(count)]; rejected=[]
        for ident,key,payload in rows:
            if key is None: target=null_partition
            elif str(key) in mapping: target=mapping[str(key)]
            else: rejected.append([ident,'UNMAPPED']); continue
            receivers[target].append([ident,payload])
        return [[r for r in receivers if r],rejected]
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('independent receivers', solve([[[10, 1, 1], [11, 2, 2]], {'1': 0, '2': 1}, 1, 3]), [[[[10, 1]], [[11, 2]], []], []])
    check('null receiver', solve([[[10, None, 1]], {}, 1, 3]), [[[], [[10, 1]], []], []])
    check('unmapped', solve([[[10, 7, 1]], {'1': 0}, 1, 2]), [[[], []], [[10, 'UNMAPPED']]])
    check('same receiver order', solve([[[11, 1, 1], [10, 1, 2]], {'1': 0}, 1, 2]), [[[[11, 1], [10, 2]], []], []])
    check('duplicate rows', solve([[[10, 1, 1], [10, 1, 1]], {'1': 0}, 1, 2]), [[[[10, 1], [10, 1]], []], []])
    check('mapped zero', solve([[[10, 0, 1]], {'0': 1}, 0, 2]), [[[], [[10, 1]]], []])
    check('empty relation', solve([[], {}, 0, 2]), [[[], []], []])
elif N == 2:
    check('independent receivers', solve([[[10, 1, 2], [11, 2, 3]], {'1': 0, '2': 1}, 1, 3]), [[[[10, 2]], [[11, 3]], []], []])
    check('null receiver', solve([[[10, None, 2]], {}, 1, 3]), [[[], [[10, 2]], []], []])
    check('unmapped', solve([[[10, 7, 2]], {'1': 0}, 1, 2]), [[[], []], [[10, 'UNMAPPED']]])
    check('same receiver order', solve([[[11, 1, 2], [10, 1, 3]], {'1': 0}, 1, 2]), [[[[11, 2], [10, 3]], []], []])
    check('duplicate rows', solve([[[10, 1, 2], [10, 1, 2]], {'1': 0}, 1, 2]), [[[[10, 2], [10, 2]], []], []])
    check('mapped zero', solve([[[10, 0, 2]], {'0': 1}, 0, 2]), [[[], [[10, 2]]], []])
    check('empty relation', solve([[], {}, 0, 2]), [[[], []], []])
elif N == 3:
    check('independent receivers', solve([[[10, 1, 3], [11, 2, 4]], {'1': 0, '2': 1}, 1, 3]), [[[[10, 3]], [[11, 4]], []], []])
    check('null receiver', solve([[[10, None, 3]], {}, 1, 3]), [[[], [[10, 3]], []], []])
    check('unmapped', solve([[[10, 7, 3]], {'1': 0}, 1, 2]), [[[], []], [[10, 'UNMAPPED']]])
    check('same receiver order', solve([[[11, 1, 3], [10, 1, 4]], {'1': 0}, 1, 2]), [[[[11, 3], [10, 4]], []], []])
    check('duplicate rows', solve([[[10, 1, 3], [10, 1, 3]], {'1': 0}, 1, 2]), [[[[10, 3], [10, 3]], []], []])
    check('mapped zero', solve([[[10, 0, 3]], {'0': 1}, 0, 2]), [[[], [[10, 3]]], []])
    check('empty relation', solve([[], {}, 0, 2]), [[[], []], []])
elif N == 4:
    check('independent receivers', solve([[[10, 1, 4], [11, 2, 5]], {'1': 0, '2': 1}, 1, 3]), [[[[10, 4]], [[11, 5]], []], []])
    check('null receiver', solve([[[10, None, 4]], {}, 1, 3]), [[[], [[10, 4]], []], []])
    check('unmapped', solve([[[10, 7, 4]], {'1': 0}, 1, 2]), [[[], []], [[10, 'UNMAPPED']]])
    check('same receiver order', solve([[[11, 1, 4], [10, 1, 5]], {'1': 0}, 1, 2]), [[[[11, 4], [10, 5]], []], []])
    check('duplicate rows', solve([[[10, 1, 4], [10, 1, 4]], {'1': 0}, 1, 2]), [[[[10, 4], [10, 4]], []], []])
    check('mapped zero', solve([[[10, 0, 4]], {'0': 1}, 0, 2]), [[[], [[10, 4]]], []])
    check('empty relation', solve([[], {}, 0, 2]), [[[], []], []])
elif N == 5:
    check('independent receivers', solve([[[10, 1, 5], [11, 2, 6]], {'1': 0, '2': 1}, 1, 3]), [[[[10, 5]], [[11, 6]], []], []])
    check('null receiver', solve([[[10, None, 5]], {}, 1, 3]), [[[], [[10, 5]], []], []])
    check('unmapped', solve([[[10, 7, 5]], {'1': 0}, 1, 2]), [[[], []], [[10, 'UNMAPPED']]])
    check('same receiver order', solve([[[11, 1, 5], [10, 1, 6]], {'1': 0}, 1, 2]), [[[[11, 5], [10, 6]], []], []])
    check('duplicate rows', solve([[[10, 1, 5], [10, 1, 5]], {'1': 0}, 1, 2]), [[[[10, 5], [10, 5]], []], []])
    check('mapped zero', solve([[[10, 0, 5]], {'0': 1}, 0, 2]), [[[], [[10, 5]]], []])
    check('empty relation', solve([[], {}, 0, 2]), [[[], []], []])
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(d):
    try:
        rows,mapping,null_partition,count=d
        receivers=[[] for _ in range(count)]; rejected=[]
        for ident,key,payload in rows:
            if key is None: target=null_partition
            elif str(key) in mapping: target=mapping[str(key)]
            else: rejected.append([ident,'UNMAPPED']); continue
            receivers[target].append([ident,payload])
        return [[r or None for r in receivers],rejected]
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('independent receivers', solve([[[10, 1, 1], [11, 2, 2]], {'1': 0, '2': 1}, 1, 3]), [[[[10, 1]], [[11, 2]], []], []])
    check('null receiver', solve([[[10, None, 1]], {}, 1, 3]), [[[], [[10, 1]], []], []])
    check('unmapped', solve([[[10, 7, 1]], {'1': 0}, 1, 2]), [[[], []], [[10, 'UNMAPPED']]])
    check('same receiver order', solve([[[11, 1, 1], [10, 1, 2]], {'1': 0}, 1, 2]), [[[[11, 1], [10, 2]], []], []])
    check('duplicate rows', solve([[[10, 1, 1], [10, 1, 1]], {'1': 0}, 1, 2]), [[[[10, 1], [10, 1]], []], []])
    check('mapped zero', solve([[[10, 0, 1]], {'0': 1}, 0, 2]), [[[], [[10, 1]]], []])
    check('empty relation', solve([[], {}, 0, 2]), [[[], []], []])
elif N == 2:
    check('independent receivers', solve([[[10, 1, 2], [11, 2, 3]], {'1': 0, '2': 1}, 1, 3]), [[[[10, 2]], [[11, 3]], []], []])
    check('null receiver', solve([[[10, None, 2]], {}, 1, 3]), [[[], [[10, 2]], []], []])
    check('unmapped', solve([[[10, 7, 2]], {'1': 0}, 1, 2]), [[[], []], [[10, 'UNMAPPED']]])
    check('same receiver order', solve([[[11, 1, 2], [10, 1, 3]], {'1': 0}, 1, 2]), [[[[11, 2], [10, 3]], []], []])
    check('duplicate rows', solve([[[10, 1, 2], [10, 1, 2]], {'1': 0}, 1, 2]), [[[[10, 2], [10, 2]], []], []])
    check('mapped zero', solve([[[10, 0, 2]], {'0': 1}, 0, 2]), [[[], [[10, 2]]], []])
    check('empty relation', solve([[], {}, 0, 2]), [[[], []], []])
elif N == 3:
    check('independent receivers', solve([[[10, 1, 3], [11, 2, 4]], {'1': 0, '2': 1}, 1, 3]), [[[[10, 3]], [[11, 4]], []], []])
    check('null receiver', solve([[[10, None, 3]], {}, 1, 3]), [[[], [[10, 3]], []], []])
    check('unmapped', solve([[[10, 7, 3]], {'1': 0}, 1, 2]), [[[], []], [[10, 'UNMAPPED']]])
    check('same receiver order', solve([[[11, 1, 3], [10, 1, 4]], {'1': 0}, 1, 2]), [[[[11, 3], [10, 4]], []], []])
    check('duplicate rows', solve([[[10, 1, 3], [10, 1, 3]], {'1': 0}, 1, 2]), [[[[10, 3], [10, 3]], []], []])
    check('mapped zero', solve([[[10, 0, 3]], {'0': 1}, 0, 2]), [[[], [[10, 3]]], []])
    check('empty relation', solve([[], {}, 0, 2]), [[[], []], []])
elif N == 4:
    check('independent receivers', solve([[[10, 1, 4], [11, 2, 5]], {'1': 0, '2': 1}, 1, 3]), [[[[10, 4]], [[11, 5]], []], []])
    check('null receiver', solve([[[10, None, 4]], {}, 1, 3]), [[[], [[10, 4]], []], []])
    check('unmapped', solve([[[10, 7, 4]], {'1': 0}, 1, 2]), [[[], []], [[10, 'UNMAPPED']]])
    check('same receiver order', solve([[[11, 1, 4], [10, 1, 5]], {'1': 0}, 1, 2]), [[[[11, 4], [10, 5]], []], []])
    check('duplicate rows', solve([[[10, 1, 4], [10, 1, 4]], {'1': 0}, 1, 2]), [[[[10, 4], [10, 4]], []], []])
    check('mapped zero', solve([[[10, 0, 4]], {'0': 1}, 0, 2]), [[[], [[10, 4]]], []])
    check('empty relation', solve([[], {}, 0, 2]), [[[], []], []])
elif N == 5:
    check('independent receivers', solve([[[10, 1, 5], [11, 2, 6]], {'1': 0, '2': 1}, 1, 3]), [[[[10, 5]], [[11, 6]], []], []])
    check('null receiver', solve([[[10, None, 5]], {}, 1, 3]), [[[], [[10, 5]], []], []])
    check('unmapped', solve([[[10, 7, 5]], {'1': 0}, 1, 2]), [[[], []], [[10, 'UNMAPPED']]])
    check('same receiver order', solve([[[11, 1, 5], [10, 1, 6]], {'1': 0}, 1, 2]), [[[[11, 5], [10, 6]], []], []])
    check('duplicate rows', solve([[[10, 1, 5], [10, 1, 5]], {'1': 0}, 1, 2]), [[[[10, 5], [10, 5]], []], []])
    check('mapped zero', solve([[[10, 0, 5]], {'0': 1}, 0, 2]), [[[], [[10, 5]]], []])
    check('empty relation', solve([[], {}, 0, 2]), [[[], []], []])
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:
Exchange removes empty receivers from its output.

Route [id,key,payload] rows into fixed receiver partitions using a supplied key-to-partition table. Null keys use the explicit null partition; unmapped non-null keys produce UNMAPPED side output. Preserve source order within each receiver, retain empty receivers, and preserve repeated rows.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        anchors,rules,depth_limit=d
        frontier=list(anchors); result=[[0,v] for v in frontier]
        for depth in range(1,depth_limit+1):
            next_rows=[]
            for value in frontier:
                for source,target in rules:
                    if source==value: next_rows.append(target)
            result.extend([[depth,v] for v in next_rows])
            frontier=[v for depth,v in result]
        return result
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('chain frontier', solve([[1], [[1, 2], [2, 3]], 2]), [[0, 1], [1, 2], [2, 3]])
    check('duplicate anchors', solve([[1, 1], [[1, 2]], 1]), [[0, 1], [0, 1], [1, 2], [1, 2]])
    check('duplicate rules', solve([[1], [[1, 2], [1, 2]], 1]), [[0, 1], [1, 2], [1, 2]])
    check('zero depth', solve([[1], [[1, 2]], 0]), [[0, 1]])
    check('reverse nonedge', solve([[2], [[1, 2]], 1]), [[0, 2]])
    check('bounded cycle', solve([[1], [[1, 1]], 2]), [[0, 1], [1, 1], [2, 1]])
    check('empty anchor', solve([[], [[1, 2]], 2]), [])
elif N == 2:
    check('chain frontier', solve([[2], [[2, 3], [3, 4]], 2]), [[0, 2], [1, 3], [2, 4]])
    check('duplicate anchors', solve([[2, 2], [[2, 3]], 1]), [[0, 2], [0, 2], [1, 3], [1, 3]])
    check('duplicate rules', solve([[2], [[2, 3], [2, 3]], 1]), [[0, 2], [1, 3], [1, 3]])
    check('zero depth', solve([[2], [[2, 3]], 0]), [[0, 2]])
    check('reverse nonedge', solve([[3], [[2, 3]], 1]), [[0, 3]])
    check('bounded cycle', solve([[2], [[2, 2]], 2]), [[0, 2], [1, 2], [2, 2]])
    check('empty anchor', solve([[], [[2, 3]], 2]), [])
elif N == 3:
    check('chain frontier', solve([[3], [[3, 4], [4, 5]], 2]), [[0, 3], [1, 4], [2, 5]])
    check('duplicate anchors', solve([[3, 3], [[3, 4]], 1]), [[0, 3], [0, 3], [1, 4], [1, 4]])
    check('duplicate rules', solve([[3], [[3, 4], [3, 4]], 1]), [[0, 3], [1, 4], [1, 4]])
    check('zero depth', solve([[3], [[3, 4]], 0]), [[0, 3]])
    check('reverse nonedge', solve([[4], [[3, 4]], 1]), [[0, 4]])
    check('bounded cycle', solve([[3], [[3, 3]], 2]), [[0, 3], [1, 3], [2, 3]])
    check('empty anchor', solve([[], [[3, 4]], 2]), [])
elif N == 4:
    check('chain frontier', solve([[4], [[4, 5], [5, 6]], 2]), [[0, 4], [1, 5], [2, 6]])
    check('duplicate anchors', solve([[4, 4], [[4, 5]], 1]), [[0, 4], [0, 4], [1, 5], [1, 5]])
    check('duplicate rules', solve([[4], [[4, 5], [4, 5]], 1]), [[0, 4], [1, 5], [1, 5]])
    check('zero depth', solve([[4], [[4, 5]], 0]), [[0, 4]])
    check('reverse nonedge', solve([[5], [[4, 5]], 1]), [[0, 5]])
    check('bounded cycle', solve([[4], [[4, 4]], 2]), [[0, 4], [1, 4], [2, 4]])
    check('empty anchor', solve([[], [[4, 5]], 2]), [])
elif N == 5:
    check('chain frontier', solve([[5], [[5, 6], [6, 7]], 2]), [[0, 5], [1, 6], [2, 7]])
    check('duplicate anchors', solve([[5, 5], [[5, 6]], 1]), [[0, 5], [0, 5], [1, 6], [1, 6]])
    check('duplicate rules', solve([[5], [[5, 6], [5, 6]], 1]), [[0, 5], [1, 6], [1, 6]])
    check('zero depth', solve([[5], [[5, 6]], 0]), [[0, 5]])
    check('reverse nonedge', solve([[6], [[5, 6]], 1]), [[0, 6]])
    check('bounded cycle', solve([[5], [[5, 5]], 2]), [[0, 5], [1, 5], [2, 5]])
    check('empty anchor', solve([[], [[5, 6]], 2]), [])
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(d):
    try:
        anchors,rules,depth_limit=d
        frontier=list(anchors); result=[[0,v] for v in frontier]
        for depth in range(1,depth_limit+1):
            next_rows=[]
            for value in frontier:
                for source,target in rules:
                    if source==value: next_rows.append(target)
            result.extend([[depth,v] for v in next_rows])
            frontier=frontier+next_rows
        return result
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('chain frontier', solve([[1], [[1, 2], [2, 3]], 2]), [[0, 1], [1, 2], [2, 3]])
    check('duplicate anchors', solve([[1, 1], [[1, 2]], 1]), [[0, 1], [0, 1], [1, 2], [1, 2]])
    check('duplicate rules', solve([[1], [[1, 2], [1, 2]], 1]), [[0, 1], [1, 2], [1, 2]])
    check('zero depth', solve([[1], [[1, 2]], 0]), [[0, 1]])
    check('reverse nonedge', solve([[2], [[1, 2]], 1]), [[0, 2]])
    check('bounded cycle', solve([[1], [[1, 1]], 2]), [[0, 1], [1, 1], [2, 1]])
    check('empty anchor', solve([[], [[1, 2]], 2]), [])
elif N == 2:
    check('chain frontier', solve([[2], [[2, 3], [3, 4]], 2]), [[0, 2], [1, 3], [2, 4]])
    check('duplicate anchors', solve([[2, 2], [[2, 3]], 1]), [[0, 2], [0, 2], [1, 3], [1, 3]])
    check('duplicate rules', solve([[2], [[2, 3], [2, 3]], 1]), [[0, 2], [1, 3], [1, 3]])
    check('zero depth', solve([[2], [[2, 3]], 0]), [[0, 2]])
    check('reverse nonedge', solve([[3], [[2, 3]], 1]), [[0, 3]])
    check('bounded cycle', solve([[2], [[2, 2]], 2]), [[0, 2], [1, 2], [2, 2]])
    check('empty anchor', solve([[], [[2, 3]], 2]), [])
elif N == 3:
    check('chain frontier', solve([[3], [[3, 4], [4, 5]], 2]), [[0, 3], [1, 4], [2, 5]])
    check('duplicate anchors', solve([[3, 3], [[3, 4]], 1]), [[0, 3], [0, 3], [1, 4], [1, 4]])
    check('duplicate rules', solve([[3], [[3, 4], [3, 4]], 1]), [[0, 3], [1, 4], [1, 4]])
    check('zero depth', solve([[3], [[3, 4]], 0]), [[0, 3]])
    check('reverse nonedge', solve([[4], [[3, 4]], 1]), [[0, 4]])
    check('bounded cycle', solve([[3], [[3, 3]], 2]), [[0, 3], [1, 3], [2, 3]])
    check('empty anchor', solve([[], [[3, 4]], 2]), [])
elif N == 4:
    check('chain frontier', solve([[4], [[4, 5], [5, 6]], 2]), [[0, 4], [1, 5], [2, 6]])
    check('duplicate anchors', solve([[4, 4], [[4, 5]], 1]), [[0, 4], [0, 4], [1, 5], [1, 5]])
    check('duplicate rules', solve([[4], [[4, 5], [4, 5]], 1]), [[0, 4], [1, 5], [1, 5]])
    check('zero depth', solve([[4], [[4, 5]], 0]), [[0, 4]])
    check('reverse nonedge', solve([[5], [[4, 5]], 1]), [[0, 5]])
    check('bounded cycle', solve([[4], [[4, 4]], 2]), [[0, 4], [1, 4], [2, 4]])
    check('empty anchor', solve([[], [[4, 5]], 2]), [])
elif N == 5:
    check('chain frontier', solve([[5], [[5, 6], [6, 7]], 2]), [[0, 5], [1, 6], [2, 7]])
    check('duplicate anchors', solve([[5, 5], [[5, 6]], 1]), [[0, 5], [0, 5], [1, 6], [1, 6]])
    check('duplicate rules', solve([[5], [[5, 6], [5, 6]], 1]), [[0, 5], [1, 6], [1, 6]])
    check('zero depth', solve([[5], [[5, 6]], 0]), [[0, 5]])
    check('reverse nonedge', solve([[6], [[5, 6]], 1]), [[0, 6]])
    check('bounded cycle', solve([[5], [[5, 5]], 2]), [[0, 5], [1, 5], [2, 5]])
    check('empty anchor', solve([[], [[5, 6]], 2]), [])
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:
Recursive query re-expands all previously emitted rows.

Evaluate a bounded recursive UNION ALL query. Anchors are integer values; each frontier value joins all rules [source,target], preserving duplicate anchors and duplicate rules. Emit [depth,value] for depth zero through max-depth, expanding only the newest frontier. Preserve anchor and rule encounter order.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        anchors,rules,depth_limit=d
        frontier=list(dict.fromkeys(anchors)); result=[[0,v] for v in frontier]
        for depth in range(1,depth_limit+1):
            next_rows=[]
            for value in frontier:
                for source,target in rules:
                    if source==value: next_rows.append(target)
            result.extend([[depth,v] for v in next_rows])
            frontier=next_rows
        return result
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('chain frontier', solve([[1], [[1, 2], [2, 3]], 2]), [[0, 1], [1, 2], [2, 3]])
    check('duplicate anchors', solve([[1, 1], [[1, 2]], 1]), [[0, 1], [0, 1], [1, 2], [1, 2]])
    check('duplicate rules', solve([[1], [[1, 2], [1, 2]], 1]), [[0, 1], [1, 2], [1, 2]])
    check('zero depth', solve([[1], [[1, 2]], 0]), [[0, 1]])
    check('reverse nonedge', solve([[2], [[1, 2]], 1]), [[0, 2]])
    check('bounded cycle', solve([[1], [[1, 1]], 2]), [[0, 1], [1, 1], [2, 1]])
    check('empty anchor', solve([[], [[1, 2]], 2]), [])
elif N == 2:
    check('chain frontier', solve([[2], [[2, 3], [3, 4]], 2]), [[0, 2], [1, 3], [2, 4]])
    check('duplicate anchors', solve([[2, 2], [[2, 3]], 1]), [[0, 2], [0, 2], [1, 3], [1, 3]])
    check('duplicate rules', solve([[2], [[2, 3], [2, 3]], 1]), [[0, 2], [1, 3], [1, 3]])
    check('zero depth', solve([[2], [[2, 3]], 0]), [[0, 2]])
    check('reverse nonedge', solve([[3], [[2, 3]], 1]), [[0, 3]])
    check('bounded cycle', solve([[2], [[2, 2]], 2]), [[0, 2], [1, 2], [2, 2]])
    check('empty anchor', solve([[], [[2, 3]], 2]), [])
elif N == 3:
    check('chain frontier', solve([[3], [[3, 4], [4, 5]], 2]), [[0, 3], [1, 4], [2, 5]])
    check('duplicate anchors', solve([[3, 3], [[3, 4]], 1]), [[0, 3], [0, 3], [1, 4], [1, 4]])
    check('duplicate rules', solve([[3], [[3, 4], [3, 4]], 1]), [[0, 3], [1, 4], [1, 4]])
    check('zero depth', solve([[3], [[3, 4]], 0]), [[0, 3]])
    check('reverse nonedge', solve([[4], [[3, 4]], 1]), [[0, 4]])
    check('bounded cycle', solve([[3], [[3, 3]], 2]), [[0, 3], [1, 3], [2, 3]])
    check('empty anchor', solve([[], [[3, 4]], 2]), [])
elif N == 4:
    check('chain frontier', solve([[4], [[4, 5], [5, 6]], 2]), [[0, 4], [1, 5], [2, 6]])
    check('duplicate anchors', solve([[4, 4], [[4, 5]], 1]), [[0, 4], [0, 4], [1, 5], [1, 5]])
    check('duplicate rules', solve([[4], [[4, 5], [4, 5]], 1]), [[0, 4], [1, 5], [1, 5]])
    check('zero depth', solve([[4], [[4, 5]], 0]), [[0, 4]])
    check('reverse nonedge', solve([[5], [[4, 5]], 1]), [[0, 5]])
    check('bounded cycle', solve([[4], [[4, 4]], 2]), [[0, 4], [1, 4], [2, 4]])
    check('empty anchor', solve([[], [[4, 5]], 2]), [])
elif N == 5:
    check('chain frontier', solve([[5], [[5, 6], [6, 7]], 2]), [[0, 5], [1, 6], [2, 7]])
    check('duplicate anchors', solve([[5, 5], [[5, 6]], 1]), [[0, 5], [0, 5], [1, 6], [1, 6]])
    check('duplicate rules', solve([[5], [[5, 6], [5, 6]], 1]), [[0, 5], [1, 6], [1, 6]])
    check('zero depth', solve([[5], [[5, 6]], 0]), [[0, 5]])
    check('reverse nonedge', solve([[6], [[5, 6]], 1]), [[0, 6]])
    check('bounded cycle', solve([[5], [[5, 5]], 2]), [[0, 5], [1, 5], [2, 5]])
    check('empty anchor', solve([[], [[5, 6]], 2]), [])
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(d):
    try:
        anchors,rules,depth_limit=d
        frontier=sorted(set(anchors)); result=[[0,v] for v in frontier]
        for depth in range(1,depth_limit+1):
            next_rows=[]
            for value in frontier:
                for source,target in rules:
                    if source==value: next_rows.append(target)
            result.extend([[depth,v] for v in next_rows])
            frontier=next_rows
        return result
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('chain frontier', solve([[1], [[1, 2], [2, 3]], 2]), [[0, 1], [1, 2], [2, 3]])
    check('duplicate anchors', solve([[1, 1], [[1, 2]], 1]), [[0, 1], [0, 1], [1, 2], [1, 2]])
    check('duplicate rules', solve([[1], [[1, 2], [1, 2]], 1]), [[0, 1], [1, 2], [1, 2]])
    check('zero depth', solve([[1], [[1, 2]], 0]), [[0, 1]])
    check('reverse nonedge', solve([[2], [[1, 2]], 1]), [[0, 2]])
    check('bounded cycle', solve([[1], [[1, 1]], 2]), [[0, 1], [1, 1], [2, 1]])
    check('empty anchor', solve([[], [[1, 2]], 2]), [])
elif N == 2:
    check('chain frontier', solve([[2], [[2, 3], [3, 4]], 2]), [[0, 2], [1, 3], [2, 4]])
    check('duplicate anchors', solve([[2, 2], [[2, 3]], 1]), [[0, 2], [0, 2], [1, 3], [1, 3]])
    check('duplicate rules', solve([[2], [[2, 3], [2, 3]], 1]), [[0, 2], [1, 3], [1, 3]])
    check('zero depth', solve([[2], [[2, 3]], 0]), [[0, 2]])
    check('reverse nonedge', solve([[3], [[2, 3]], 1]), [[0, 3]])
    check('bounded cycle', solve([[2], [[2, 2]], 2]), [[0, 2], [1, 2], [2, 2]])
    check('empty anchor', solve([[], [[2, 3]], 2]), [])
elif N == 3:
    check('chain frontier', solve([[3], [[3, 4], [4, 5]], 2]), [[0, 3], [1, 4], [2, 5]])
    check('duplicate anchors', solve([[3, 3], [[3, 4]], 1]), [[0, 3], [0, 3], [1, 4], [1, 4]])
    check('duplicate rules', solve([[3], [[3, 4], [3, 4]], 1]), [[0, 3], [1, 4], [1, 4]])
    check('zero depth', solve([[3], [[3, 4]], 0]), [[0, 3]])
    check('reverse nonedge', solve([[4], [[3, 4]], 1]), [[0, 4]])
    check('bounded cycle', solve([[3], [[3, 3]], 2]), [[0, 3], [1, 3], [2, 3]])
    check('empty anchor', solve([[], [[3, 4]], 2]), [])
elif N == 4:
    check('chain frontier', solve([[4], [[4, 5], [5, 6]], 2]), [[0, 4], [1, 5], [2, 6]])
    check('duplicate anchors', solve([[4, 4], [[4, 5]], 1]), [[0, 4], [0, 4], [1, 5], [1, 5]])
    check('duplicate rules', solve([[4], [[4, 5], [4, 5]], 1]), [[0, 4], [1, 5], [1, 5]])
    check('zero depth', solve([[4], [[4, 5]], 0]), [[0, 4]])
    check('reverse nonedge', solve([[5], [[4, 5]], 1]), [[0, 5]])
    check('bounded cycle', solve([[4], [[4, 4]], 2]), [[0, 4], [1, 4], [2, 4]])
    check('empty anchor', solve([[], [[4, 5]], 2]), [])
elif N == 5:
    check('chain frontier', solve([[5], [[5, 6], [6, 7]], 2]), [[0, 5], [1, 6], [2, 7]])
    check('duplicate anchors', solve([[5, 5], [[5, 6]], 1]), [[0, 5], [0, 5], [1, 6], [1, 6]])
    check('duplicate rules', solve([[5], [[5, 6], [5, 6]], 1]), [[0, 5], [1, 6], [1, 6]])
    check('zero depth', solve([[5], [[5, 6]], 0]), [[0, 5]])
    check('reverse nonedge', solve([[6], [[5, 6]], 1]), [[0, 6]])
    check('bounded cycle', solve([[5], [[5, 5]], 2]), [[0, 5], [1, 5], [2, 5]])
    check('empty anchor', solve([[], [[5, 6]], 2]), [])
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:
Recursive UNION ALL deduplicates its anchor relation.

Evaluate a bounded recursive UNION ALL query. Anchors are integer values; each frontier value joins all rules [source,target], preserving duplicate anchors and duplicate rules. Emit [depth,value] for depth zero through max-depth, expanding only the newest frontier. Preserve anchor and rule encounter order.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        anchors,rules,depth_limit=d
        frontier=list(anchors); result=[[0,v] for v in frontier]
        for depth in range(1,depth_limit+1):
            next_rows=[]
            for value in frontier:
                for source,target in dict.fromkeys(tuple(r) for r in rules):
                    if source==value: next_rows.append(target)
            result.extend([[depth,v] for v in next_rows])
            frontier=next_rows
        return result
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('chain frontier', solve([[1], [[1, 2], [2, 3]], 2]), [[0, 1], [1, 2], [2, 3]])
    check('duplicate anchors', solve([[1, 1], [[1, 2]], 1]), [[0, 1], [0, 1], [1, 2], [1, 2]])
    check('duplicate rules', solve([[1], [[1, 2], [1, 2]], 1]), [[0, 1], [1, 2], [1, 2]])
    check('zero depth', solve([[1], [[1, 2]], 0]), [[0, 1]])
    check('reverse nonedge', solve([[2], [[1, 2]], 1]), [[0, 2]])
    check('bounded cycle', solve([[1], [[1, 1]], 2]), [[0, 1], [1, 1], [2, 1]])
    check('empty anchor', solve([[], [[1, 2]], 2]), [])
elif N == 2:
    check('chain frontier', solve([[2], [[2, 3], [3, 4]], 2]), [[0, 2], [1, 3], [2, 4]])
    check('duplicate anchors', solve([[2, 2], [[2, 3]], 1]), [[0, 2], [0, 2], [1, 3], [1, 3]])
    check('duplicate rules', solve([[2], [[2, 3], [2, 3]], 1]), [[0, 2], [1, 3], [1, 3]])
    check('zero depth', solve([[2], [[2, 3]], 0]), [[0, 2]])
    check('reverse nonedge', solve([[3], [[2, 3]], 1]), [[0, 3]])
    check('bounded cycle', solve([[2], [[2, 2]], 2]), [[0, 2], [1, 2], [2, 2]])
    check('empty anchor', solve([[], [[2, 3]], 2]), [])
elif N == 3:
    check('chain frontier', solve([[3], [[3, 4], [4, 5]], 2]), [[0, 3], [1, 4], [2, 5]])
    check('duplicate anchors', solve([[3, 3], [[3, 4]], 1]), [[0, 3], [0, 3], [1, 4], [1, 4]])
    check('duplicate rules', solve([[3], [[3, 4], [3, 4]], 1]), [[0, 3], [1, 4], [1, 4]])
    check('zero depth', solve([[3], [[3, 4]], 0]), [[0, 3]])
    check('reverse nonedge', solve([[4], [[3, 4]], 1]), [[0, 4]])
    check('bounded cycle', solve([[3], [[3, 3]], 2]), [[0, 3], [1, 3], [2, 3]])
    check('empty anchor', solve([[], [[3, 4]], 2]), [])
elif N == 4:
    check('chain frontier', solve([[4], [[4, 5], [5, 6]], 2]), [[0, 4], [1, 5], [2, 6]])
    check('duplicate anchors', solve([[4, 4], [[4, 5]], 1]), [[0, 4], [0, 4], [1, 5], [1, 5]])
    check('duplicate rules', solve([[4], [[4, 5], [4, 5]], 1]), [[0, 4], [1, 5], [1, 5]])
    check('zero depth', solve([[4], [[4, 5]], 0]), [[0, 4]])
    check('reverse nonedge', solve([[5], [[4, 5]], 1]), [[0, 5]])
    check('bounded cycle', solve([[4], [[4, 4]], 2]), [[0, 4], [1, 4], [2, 4]])
    check('empty anchor', solve([[], [[4, 5]], 2]), [])
elif N == 5:
    check('chain frontier', solve([[5], [[5, 6], [6, 7]], 2]), [[0, 5], [1, 6], [2, 7]])
    check('duplicate anchors', solve([[5, 5], [[5, 6]], 1]), [[0, 5], [0, 5], [1, 6], [1, 6]])
    check('duplicate rules', solve([[5], [[5, 6], [5, 6]], 1]), [[0, 5], [1, 6], [1, 6]])
    check('zero depth', solve([[5], [[5, 6]], 0]), [[0, 5]])
    check('reverse nonedge', solve([[6], [[5, 6]], 1]), [[0, 6]])
    check('bounded cycle', solve([[5], [[5, 5]], 2]), [[0, 5], [1, 5], [2, 5]])
    check('empty anchor', solve([[], [[5, 6]], 2]), [])
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(d):
    try:
        anchors,rules,depth_limit=d
        frontier=list(anchors); result=[[0,v] for v in frontier]
        for depth in range(1,depth_limit+1):
            next_rows=[]
            for value in frontier:
                for source,target in sorted(set(tuple(r) for r in rules)):
                    if source==value: next_rows.append(target)
            result.extend([[depth,v] for v in next_rows])
            frontier=next_rows
        return result
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('chain frontier', solve([[1], [[1, 2], [2, 3]], 2]), [[0, 1], [1, 2], [2, 3]])
    check('duplicate anchors', solve([[1, 1], [[1, 2]], 1]), [[0, 1], [0, 1], [1, 2], [1, 2]])
    check('duplicate rules', solve([[1], [[1, 2], [1, 2]], 1]), [[0, 1], [1, 2], [1, 2]])
    check('zero depth', solve([[1], [[1, 2]], 0]), [[0, 1]])
    check('reverse nonedge', solve([[2], [[1, 2]], 1]), [[0, 2]])
    check('bounded cycle', solve([[1], [[1, 1]], 2]), [[0, 1], [1, 1], [2, 1]])
    check('empty anchor', solve([[], [[1, 2]], 2]), [])
elif N == 2:
    check('chain frontier', solve([[2], [[2, 3], [3, 4]], 2]), [[0, 2], [1, 3], [2, 4]])
    check('duplicate anchors', solve([[2, 2], [[2, 3]], 1]), [[0, 2], [0, 2], [1, 3], [1, 3]])
    check('duplicate rules', solve([[2], [[2, 3], [2, 3]], 1]), [[0, 2], [1, 3], [1, 3]])
    check('zero depth', solve([[2], [[2, 3]], 0]), [[0, 2]])
    check('reverse nonedge', solve([[3], [[2, 3]], 1]), [[0, 3]])
    check('bounded cycle', solve([[2], [[2, 2]], 2]), [[0, 2], [1, 2], [2, 2]])
    check('empty anchor', solve([[], [[2, 3]], 2]), [])
elif N == 3:
    check('chain frontier', solve([[3], [[3, 4], [4, 5]], 2]), [[0, 3], [1, 4], [2, 5]])
    check('duplicate anchors', solve([[3, 3], [[3, 4]], 1]), [[0, 3], [0, 3], [1, 4], [1, 4]])
    check('duplicate rules', solve([[3], [[3, 4], [3, 4]], 1]), [[0, 3], [1, 4], [1, 4]])
    check('zero depth', solve([[3], [[3, 4]], 0]), [[0, 3]])
    check('reverse nonedge', solve([[4], [[3, 4]], 1]), [[0, 4]])
    check('bounded cycle', solve([[3], [[3, 3]], 2]), [[0, 3], [1, 3], [2, 3]])
    check('empty anchor', solve([[], [[3, 4]], 2]), [])
elif N == 4:
    check('chain frontier', solve([[4], [[4, 5], [5, 6]], 2]), [[0, 4], [1, 5], [2, 6]])
    check('duplicate anchors', solve([[4, 4], [[4, 5]], 1]), [[0, 4], [0, 4], [1, 5], [1, 5]])
    check('duplicate rules', solve([[4], [[4, 5], [4, 5]], 1]), [[0, 4], [1, 5], [1, 5]])
    check('zero depth', solve([[4], [[4, 5]], 0]), [[0, 4]])
    check('reverse nonedge', solve([[5], [[4, 5]], 1]), [[0, 5]])
    check('bounded cycle', solve([[4], [[4, 4]], 2]), [[0, 4], [1, 4], [2, 4]])
    check('empty anchor', solve([[], [[4, 5]], 2]), [])
elif N == 5:
    check('chain frontier', solve([[5], [[5, 6], [6, 7]], 2]), [[0, 5], [1, 6], [2, 7]])
    check('duplicate anchors', solve([[5, 5], [[5, 6]], 1]), [[0, 5], [0, 5], [1, 6], [1, 6]])
    check('duplicate rules', solve([[5], [[5, 6], [5, 6]], 1]), [[0, 5], [1, 6], [1, 6]])
    check('zero depth', solve([[5], [[5, 6]], 0]), [[0, 5]])
    check('reverse nonedge', solve([[6], [[5, 6]], 1]), [[0, 6]])
    check('bounded cycle', solve([[5], [[5, 5]], 2]), [[0, 5], [1, 5], [2, 5]])
    check('empty anchor', solve([[], [[5, 6]], 2]), [])
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:
Recursive UNION ALL deduplicates repeated recursive join rules.

Evaluate a bounded recursive UNION ALL query. Anchors are integer values; each frontier value joins all rules [source,target], preserving duplicate anchors and duplicate rules. Emit [depth,value] for depth zero through max-depth, expanding only the newest frontier. Preserve anchor and rule encounter order.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        anchors,rules,depth_limit=d
        frontier=list(anchors); result=[[0,v] for v in frontier]
        for depth in range(1,depth_limit):
            next_rows=[]
            for value in frontier:
                for source,target in rules:
                    if source==value: next_rows.append(target)
            result.extend([[depth,v] for v in next_rows])
            frontier=next_rows
        return result
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('chain frontier', solve([[1], [[1, 2], [2, 3]], 2]), [[0, 1], [1, 2], [2, 3]])
    check('duplicate anchors', solve([[1, 1], [[1, 2]], 1]), [[0, 1], [0, 1], [1, 2], [1, 2]])
    check('duplicate rules', solve([[1], [[1, 2], [1, 2]], 1]), [[0, 1], [1, 2], [1, 2]])
    check('zero depth', solve([[1], [[1, 2]], 0]), [[0, 1]])
    check('reverse nonedge', solve([[2], [[1, 2]], 1]), [[0, 2]])
    check('bounded cycle', solve([[1], [[1, 1]], 2]), [[0, 1], [1, 1], [2, 1]])
    check('empty anchor', solve([[], [[1, 2]], 2]), [])
elif N == 2:
    check('chain frontier', solve([[2], [[2, 3], [3, 4]], 2]), [[0, 2], [1, 3], [2, 4]])
    check('duplicate anchors', solve([[2, 2], [[2, 3]], 1]), [[0, 2], [0, 2], [1, 3], [1, 3]])
    check('duplicate rules', solve([[2], [[2, 3], [2, 3]], 1]), [[0, 2], [1, 3], [1, 3]])
    check('zero depth', solve([[2], [[2, 3]], 0]), [[0, 2]])
    check('reverse nonedge', solve([[3], [[2, 3]], 1]), [[0, 3]])
    check('bounded cycle', solve([[2], [[2, 2]], 2]), [[0, 2], [1, 2], [2, 2]])
    check('empty anchor', solve([[], [[2, 3]], 2]), [])
elif N == 3:
    check('chain frontier', solve([[3], [[3, 4], [4, 5]], 2]), [[0, 3], [1, 4], [2, 5]])
    check('duplicate anchors', solve([[3, 3], [[3, 4]], 1]), [[0, 3], [0, 3], [1, 4], [1, 4]])
    check('duplicate rules', solve([[3], [[3, 4], [3, 4]], 1]), [[0, 3], [1, 4], [1, 4]])
    check('zero depth', solve([[3], [[3, 4]], 0]), [[0, 3]])
    check('reverse nonedge', solve([[4], [[3, 4]], 1]), [[0, 4]])
    check('bounded cycle', solve([[3], [[3, 3]], 2]), [[0, 3], [1, 3], [2, 3]])
    check('empty anchor', solve([[], [[3, 4]], 2]), [])
elif N == 4:
    check('chain frontier', solve([[4], [[4, 5], [5, 6]], 2]), [[0, 4], [1, 5], [2, 6]])
    check('duplicate anchors', solve([[4, 4], [[4, 5]], 1]), [[0, 4], [0, 4], [1, 5], [1, 5]])
    check('duplicate rules', solve([[4], [[4, 5], [4, 5]], 1]), [[0, 4], [1, 5], [1, 5]])
    check('zero depth', solve([[4], [[4, 5]], 0]), [[0, 4]])
    check('reverse nonedge', solve([[5], [[4, 5]], 1]), [[0, 5]])
    check('bounded cycle', solve([[4], [[4, 4]], 2]), [[0, 4], [1, 4], [2, 4]])
    check('empty anchor', solve([[], [[4, 5]], 2]), [])
elif N == 5:
    check('chain frontier', solve([[5], [[5, 6], [6, 7]], 2]), [[0, 5], [1, 6], [2, 7]])
    check('duplicate anchors', solve([[5, 5], [[5, 6]], 1]), [[0, 5], [0, 5], [1, 6], [1, 6]])
    check('duplicate rules', solve([[5], [[5, 6], [5, 6]], 1]), [[0, 5], [1, 6], [1, 6]])
    check('zero depth', solve([[5], [[5, 6]], 0]), [[0, 5]])
    check('reverse nonedge', solve([[6], [[5, 6]], 1]), [[0, 6]])
    check('bounded cycle', solve([[5], [[5, 5]], 2]), [[0, 5], [1, 5], [2, 5]])
    check('empty anchor', solve([[], [[5, 6]], 2]), [])
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(d):
    try:
        anchors,rules,depth_limit=d
        frontier=list(anchors); result=[[0,v] for v in frontier]
        for depth in range(1,max(1,depth_limit)):
            next_rows=[]
            for value in frontier:
                for source,target in rules:
                    if source==value: next_rows.append(target)
            result.extend([[depth,v] for v in next_rows])
            frontier=next_rows
        return result
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('chain frontier', solve([[1], [[1, 2], [2, 3]], 2]), [[0, 1], [1, 2], [2, 3]])
    check('duplicate anchors', solve([[1, 1], [[1, 2]], 1]), [[0, 1], [0, 1], [1, 2], [1, 2]])
    check('duplicate rules', solve([[1], [[1, 2], [1, 2]], 1]), [[0, 1], [1, 2], [1, 2]])
    check('zero depth', solve([[1], [[1, 2]], 0]), [[0, 1]])
    check('reverse nonedge', solve([[2], [[1, 2]], 1]), [[0, 2]])
    check('bounded cycle', solve([[1], [[1, 1]], 2]), [[0, 1], [1, 1], [2, 1]])
    check('empty anchor', solve([[], [[1, 2]], 2]), [])
elif N == 2:
    check('chain frontier', solve([[2], [[2, 3], [3, 4]], 2]), [[0, 2], [1, 3], [2, 4]])
    check('duplicate anchors', solve([[2, 2], [[2, 3]], 1]), [[0, 2], [0, 2], [1, 3], [1, 3]])
    check('duplicate rules', solve([[2], [[2, 3], [2, 3]], 1]), [[0, 2], [1, 3], [1, 3]])
    check('zero depth', solve([[2], [[2, 3]], 0]), [[0, 2]])
    check('reverse nonedge', solve([[3], [[2, 3]], 1]), [[0, 3]])
    check('bounded cycle', solve([[2], [[2, 2]], 2]), [[0, 2], [1, 2], [2, 2]])
    check('empty anchor', solve([[], [[2, 3]], 2]), [])
elif N == 3:
    check('chain frontier', solve([[3], [[3, 4], [4, 5]], 2]), [[0, 3], [1, 4], [2, 5]])
    check('duplicate anchors', solve([[3, 3], [[3, 4]], 1]), [[0, 3], [0, 3], [1, 4], [1, 4]])
    check('duplicate rules', solve([[3], [[3, 4], [3, 4]], 1]), [[0, 3], [1, 4], [1, 4]])
    check('zero depth', solve([[3], [[3, 4]], 0]), [[0, 3]])
    check('reverse nonedge', solve([[4], [[3, 4]], 1]), [[0, 4]])
    check('bounded cycle', solve([[3], [[3, 3]], 2]), [[0, 3], [1, 3], [2, 3]])
    check('empty anchor', solve([[], [[3, 4]], 2]), [])
elif N == 4:
    check('chain frontier', solve([[4], [[4, 5], [5, 6]], 2]), [[0, 4], [1, 5], [2, 6]])
    check('duplicate anchors', solve([[4, 4], [[4, 5]], 1]), [[0, 4], [0, 4], [1, 5], [1, 5]])
    check('duplicate rules', solve([[4], [[4, 5], [4, 5]], 1]), [[0, 4], [1, 5], [1, 5]])
    check('zero depth', solve([[4], [[4, 5]], 0]), [[0, 4]])
    check('reverse nonedge', solve([[5], [[4, 5]], 1]), [[0, 5]])
    check('bounded cycle', solve([[4], [[4, 4]], 2]), [[0, 4], [1, 4], [2, 4]])
    check('empty anchor', solve([[], [[4, 5]], 2]), [])
elif N == 5:
    check('chain frontier', solve([[5], [[5, 6], [6, 7]], 2]), [[0, 5], [1, 6], [2, 7]])
    check('duplicate anchors', solve([[5, 5], [[5, 6]], 1]), [[0, 5], [0, 5], [1, 6], [1, 6]])
    check('duplicate rules', solve([[5], [[5, 6], [5, 6]], 1]), [[0, 5], [1, 6], [1, 6]])
    check('zero depth', solve([[5], [[5, 6]], 0]), [[0, 5]])
    check('reverse nonedge', solve([[6], [[5, 6]], 1]), [[0, 6]])
    check('bounded cycle', solve([[5], [[5, 5]], 2]), [[0, 5], [1, 5], [2, 5]])
    check('empty anchor', solve([[], [[5, 6]], 2]), [])
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:
Recursive query omits the requested final expansion depth.

Evaluate a bounded recursive UNION ALL query. Anchors are integer values; each frontier value joins all rules [source,target], preserving duplicate anchors and duplicate rules. Emit [depth,value] for depth zero through max-depth, expanding only the newest frontier. Preserve anchor and rule encounter order.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        anchors,rules,depth_limit=d
        frontier=list(anchors); result=[[0,v] for v in frontier]
        for depth in range(1,depth_limit+1):
            next_rows=[]
            for value in frontier:
                for source,target in rules:
                    if target==value: next_rows.append(source)
            result.extend([[depth,v] for v in next_rows])
            frontier=next_rows
        return result
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('chain frontier', solve([[1], [[1, 2], [2, 3]], 2]), [[0, 1], [1, 2], [2, 3]])
    check('duplicate anchors', solve([[1, 1], [[1, 2]], 1]), [[0, 1], [0, 1], [1, 2], [1, 2]])
    check('duplicate rules', solve([[1], [[1, 2], [1, 2]], 1]), [[0, 1], [1, 2], [1, 2]])
    check('zero depth', solve([[1], [[1, 2]], 0]), [[0, 1]])
    check('reverse nonedge', solve([[2], [[1, 2]], 1]), [[0, 2]])
    check('bounded cycle', solve([[1], [[1, 1]], 2]), [[0, 1], [1, 1], [2, 1]])
    check('empty anchor', solve([[], [[1, 2]], 2]), [])
elif N == 2:
    check('chain frontier', solve([[2], [[2, 3], [3, 4]], 2]), [[0, 2], [1, 3], [2, 4]])
    check('duplicate anchors', solve([[2, 2], [[2, 3]], 1]), [[0, 2], [0, 2], [1, 3], [1, 3]])
    check('duplicate rules', solve([[2], [[2, 3], [2, 3]], 1]), [[0, 2], [1, 3], [1, 3]])
    check('zero depth', solve([[2], [[2, 3]], 0]), [[0, 2]])
    check('reverse nonedge', solve([[3], [[2, 3]], 1]), [[0, 3]])
    check('bounded cycle', solve([[2], [[2, 2]], 2]), [[0, 2], [1, 2], [2, 2]])
    check('empty anchor', solve([[], [[2, 3]], 2]), [])
elif N == 3:
    check('chain frontier', solve([[3], [[3, 4], [4, 5]], 2]), [[0, 3], [1, 4], [2, 5]])
    check('duplicate anchors', solve([[3, 3], [[3, 4]], 1]), [[0, 3], [0, 3], [1, 4], [1, 4]])
    check('duplicate rules', solve([[3], [[3, 4], [3, 4]], 1]), [[0, 3], [1, 4], [1, 4]])
    check('zero depth', solve([[3], [[3, 4]], 0]), [[0, 3]])
    check('reverse nonedge', solve([[4], [[3, 4]], 1]), [[0, 4]])
    check('bounded cycle', solve([[3], [[3, 3]], 2]), [[0, 3], [1, 3], [2, 3]])
    check('empty anchor', solve([[], [[3, 4]], 2]), [])
elif N == 4:
    check('chain frontier', solve([[4], [[4, 5], [5, 6]], 2]), [[0, 4], [1, 5], [2, 6]])
    check('duplicate anchors', solve([[4, 4], [[4, 5]], 1]), [[0, 4], [0, 4], [1, 5], [1, 5]])
    check('duplicate rules', solve([[4], [[4, 5], [4, 5]], 1]), [[0, 4], [1, 5], [1, 5]])
    check('zero depth', solve([[4], [[4, 5]], 0]), [[0, 4]])
    check('reverse nonedge', solve([[5], [[4, 5]], 1]), [[0, 5]])
    check('bounded cycle', solve([[4], [[4, 4]], 2]), [[0, 4], [1, 4], [2, 4]])
    check('empty anchor', solve([[], [[4, 5]], 2]), [])
elif N == 5:
    check('chain frontier', solve([[5], [[5, 6], [6, 7]], 2]), [[0, 5], [1, 6], [2, 7]])
    check('duplicate anchors', solve([[5, 5], [[5, 6]], 1]), [[0, 5], [0, 5], [1, 6], [1, 6]])
    check('duplicate rules', solve([[5], [[5, 6], [5, 6]], 1]), [[0, 5], [1, 6], [1, 6]])
    check('zero depth', solve([[5], [[5, 6]], 0]), [[0, 5]])
    check('reverse nonedge', solve([[6], [[5, 6]], 1]), [[0, 6]])
    check('bounded cycle', solve([[5], [[5, 5]], 2]), [[0, 5], [1, 5], [2, 5]])
    check('empty anchor', solve([[], [[5, 6]], 2]), [])
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(d):
    try:
        anchors,rules,depth_limit=d
        frontier=list(anchors); result=[[0,v] for v in frontier]
        for depth in range(1,depth_limit+1):
            next_rows=[]
            for value in frontier:
                for source,target in rules:
                    if source==value or target==value: next_rows.append(target)
            result.extend([[depth,v] for v in next_rows])
            frontier=next_rows
        return result
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('chain frontier', solve([[1], [[1, 2], [2, 3]], 2]), [[0, 1], [1, 2], [2, 3]])
    check('duplicate anchors', solve([[1, 1], [[1, 2]], 1]), [[0, 1], [0, 1], [1, 2], [1, 2]])
    check('duplicate rules', solve([[1], [[1, 2], [1, 2]], 1]), [[0, 1], [1, 2], [1, 2]])
    check('zero depth', solve([[1], [[1, 2]], 0]), [[0, 1]])
    check('reverse nonedge', solve([[2], [[1, 2]], 1]), [[0, 2]])
    check('bounded cycle', solve([[1], [[1, 1]], 2]), [[0, 1], [1, 1], [2, 1]])
    check('empty anchor', solve([[], [[1, 2]], 2]), [])
elif N == 2:
    check('chain frontier', solve([[2], [[2, 3], [3, 4]], 2]), [[0, 2], [1, 3], [2, 4]])
    check('duplicate anchors', solve([[2, 2], [[2, 3]], 1]), [[0, 2], [0, 2], [1, 3], [1, 3]])
    check('duplicate rules', solve([[2], [[2, 3], [2, 3]], 1]), [[0, 2], [1, 3], [1, 3]])
    check('zero depth', solve([[2], [[2, 3]], 0]), [[0, 2]])
    check('reverse nonedge', solve([[3], [[2, 3]], 1]), [[0, 3]])
    check('bounded cycle', solve([[2], [[2, 2]], 2]), [[0, 2], [1, 2], [2, 2]])
    check('empty anchor', solve([[], [[2, 3]], 2]), [])
elif N == 3:
    check('chain frontier', solve([[3], [[3, 4], [4, 5]], 2]), [[0, 3], [1, 4], [2, 5]])
    check('duplicate anchors', solve([[3, 3], [[3, 4]], 1]), [[0, 3], [0, 3], [1, 4], [1, 4]])
    check('duplicate rules', solve([[3], [[3, 4], [3, 4]], 1]), [[0, 3], [1, 4], [1, 4]])
    check('zero depth', solve([[3], [[3, 4]], 0]), [[0, 3]])
    check('reverse nonedge', solve([[4], [[3, 4]], 1]), [[0, 4]])
    check('bounded cycle', solve([[3], [[3, 3]], 2]), [[0, 3], [1, 3], [2, 3]])
    check('empty anchor', solve([[], [[3, 4]], 2]), [])
elif N == 4:
    check('chain frontier', solve([[4], [[4, 5], [5, 6]], 2]), [[0, 4], [1, 5], [2, 6]])
    check('duplicate anchors', solve([[4, 4], [[4, 5]], 1]), [[0, 4], [0, 4], [1, 5], [1, 5]])
    check('duplicate rules', solve([[4], [[4, 5], [4, 5]], 1]), [[0, 4], [1, 5], [1, 5]])
    check('zero depth', solve([[4], [[4, 5]], 0]), [[0, 4]])
    check('reverse nonedge', solve([[5], [[4, 5]], 1]), [[0, 5]])
    check('bounded cycle', solve([[4], [[4, 4]], 2]), [[0, 4], [1, 4], [2, 4]])
    check('empty anchor', solve([[], [[4, 5]], 2]), [])
elif N == 5:
    check('chain frontier', solve([[5], [[5, 6], [6, 7]], 2]), [[0, 5], [1, 6], [2, 7]])
    check('duplicate anchors', solve([[5, 5], [[5, 6]], 1]), [[0, 5], [0, 5], [1, 6], [1, 6]])
    check('duplicate rules', solve([[5], [[5, 6], [5, 6]], 1]), [[0, 5], [1, 6], [1, 6]])
    check('zero depth', solve([[5], [[5, 6]], 0]), [[0, 5]])
    check('reverse nonedge', solve([[6], [[5, 6]], 1]), [[0, 6]])
    check('bounded cycle', solve([[5], [[5, 5]], 2]), [[0, 5], [1, 5], [2, 5]])
    check('empty anchor', solve([[], [[5, 6]], 2]), [])
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:
Recursive query joins frontier values to target rather than source.

Evaluate a bounded recursive UNION ALL query. Anchors are integer values; each frontier value joins all rules [source,target], preserving duplicate anchors and duplicate rules. Emit [depth,value] for depth zero through max-depth, expanding only the newest frontier. Preserve anchor and rule encounter order.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        anchors,rules,depth_limit=d
        frontier=list(anchors); result=[[0,v] for v in frontier]
        for depth in range(1,depth_limit+1):
            next_rows=[]
            for value in frontier:
                for source,target in rules:
                    if source==value: next_rows.append(target)
            result.extend([[depth,v] for v in next_rows if v not in [x for d,x in result]])
            frontier=next_rows
        return result
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('chain frontier', solve([[1], [[1, 2], [2, 3]], 2]), [[0, 1], [1, 2], [2, 3]])
    check('duplicate anchors', solve([[1, 1], [[1, 2]], 1]), [[0, 1], [0, 1], [1, 2], [1, 2]])
    check('duplicate rules', solve([[1], [[1, 2], [1, 2]], 1]), [[0, 1], [1, 2], [1, 2]])
    check('zero depth', solve([[1], [[1, 2]], 0]), [[0, 1]])
    check('reverse nonedge', solve([[2], [[1, 2]], 1]), [[0, 2]])
    check('bounded cycle', solve([[1], [[1, 1]], 2]), [[0, 1], [1, 1], [2, 1]])
    check('empty anchor', solve([[], [[1, 2]], 2]), [])
elif N == 2:
    check('chain frontier', solve([[2], [[2, 3], [3, 4]], 2]), [[0, 2], [1, 3], [2, 4]])
    check('duplicate anchors', solve([[2, 2], [[2, 3]], 1]), [[0, 2], [0, 2], [1, 3], [1, 3]])
    check('duplicate rules', solve([[2], [[2, 3], [2, 3]], 1]), [[0, 2], [1, 3], [1, 3]])
    check('zero depth', solve([[2], [[2, 3]], 0]), [[0, 2]])
    check('reverse nonedge', solve([[3], [[2, 3]], 1]), [[0, 3]])
    check('bounded cycle', solve([[2], [[2, 2]], 2]), [[0, 2], [1, 2], [2, 2]])
    check('empty anchor', solve([[], [[2, 3]], 2]), [])
elif N == 3:
    check('chain frontier', solve([[3], [[3, 4], [4, 5]], 2]), [[0, 3], [1, 4], [2, 5]])
    check('duplicate anchors', solve([[3, 3], [[3, 4]], 1]), [[0, 3], [0, 3], [1, 4], [1, 4]])
    check('duplicate rules', solve([[3], [[3, 4], [3, 4]], 1]), [[0, 3], [1, 4], [1, 4]])
    check('zero depth', solve([[3], [[3, 4]], 0]), [[0, 3]])
    check('reverse nonedge', solve([[4], [[3, 4]], 1]), [[0, 4]])
    check('bounded cycle', solve([[3], [[3, 3]], 2]), [[0, 3], [1, 3], [2, 3]])
    check('empty anchor', solve([[], [[3, 4]], 2]), [])
elif N == 4:
    check('chain frontier', solve([[4], [[4, 5], [5, 6]], 2]), [[0, 4], [1, 5], [2, 6]])
    check('duplicate anchors', solve([[4, 4], [[4, 5]], 1]), [[0, 4], [0, 4], [1, 5], [1, 5]])
    check('duplicate rules', solve([[4], [[4, 5], [4, 5]], 1]), [[0, 4], [1, 5], [1, 5]])
    check('zero depth', solve([[4], [[4, 5]], 0]), [[0, 4]])
    check('reverse nonedge', solve([[5], [[4, 5]], 1]), [[0, 5]])
    check('bounded cycle', solve([[4], [[4, 4]], 2]), [[0, 4], [1, 4], [2, 4]])
    check('empty anchor', solve([[], [[4, 5]], 2]), [])
elif N == 5:
    check('chain frontier', solve([[5], [[5, 6], [6, 7]], 2]), [[0, 5], [1, 6], [2, 7]])
    check('duplicate anchors', solve([[5, 5], [[5, 6]], 1]), [[0, 5], [0, 5], [1, 6], [1, 6]])
    check('duplicate rules', solve([[5], [[5, 6], [5, 6]], 1]), [[0, 5], [1, 6], [1, 6]])
    check('zero depth', solve([[5], [[5, 6]], 0]), [[0, 5]])
    check('reverse nonedge', solve([[6], [[5, 6]], 1]), [[0, 6]])
    check('bounded cycle', solve([[5], [[5, 5]], 2]), [[0, 5], [1, 5], [2, 5]])
    check('empty anchor', solve([[], [[5, 6]], 2]), [])
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(d):
    try:
        anchors,rules,depth_limit=d
        frontier=list(anchors); result=[[0,v] for v in frontier]
        for depth in range(1,depth_limit+1):
            next_rows=[]
            for value in frontier:
                for source,target in rules:
                    if source==value: next_rows.append(target)
            result.extend([[depth,v] for v in dict.fromkeys(next_rows)])
            frontier=next_rows
        return result
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('chain frontier', solve([[1], [[1, 2], [2, 3]], 2]), [[0, 1], [1, 2], [2, 3]])
    check('duplicate anchors', solve([[1, 1], [[1, 2]], 1]), [[0, 1], [0, 1], [1, 2], [1, 2]])
    check('duplicate rules', solve([[1], [[1, 2], [1, 2]], 1]), [[0, 1], [1, 2], [1, 2]])
    check('zero depth', solve([[1], [[1, 2]], 0]), [[0, 1]])
    check('reverse nonedge', solve([[2], [[1, 2]], 1]), [[0, 2]])
    check('bounded cycle', solve([[1], [[1, 1]], 2]), [[0, 1], [1, 1], [2, 1]])
    check('empty anchor', solve([[], [[1, 2]], 2]), [])
elif N == 2:
    check('chain frontier', solve([[2], [[2, 3], [3, 4]], 2]), [[0, 2], [1, 3], [2, 4]])
    check('duplicate anchors', solve([[2, 2], [[2, 3]], 1]), [[0, 2], [0, 2], [1, 3], [1, 3]])
    check('duplicate rules', solve([[2], [[2, 3], [2, 3]], 1]), [[0, 2], [1, 3], [1, 3]])
    check('zero depth', solve([[2], [[2, 3]], 0]), [[0, 2]])
    check('reverse nonedge', solve([[3], [[2, 3]], 1]), [[0, 3]])
    check('bounded cycle', solve([[2], [[2, 2]], 2]), [[0, 2], [1, 2], [2, 2]])
    check('empty anchor', solve([[], [[2, 3]], 2]), [])
elif N == 3:
    check('chain frontier', solve([[3], [[3, 4], [4, 5]], 2]), [[0, 3], [1, 4], [2, 5]])
    check('duplicate anchors', solve([[3, 3], [[3, 4]], 1]), [[0, 3], [0, 3], [1, 4], [1, 4]])
    check('duplicate rules', solve([[3], [[3, 4], [3, 4]], 1]), [[0, 3], [1, 4], [1, 4]])
    check('zero depth', solve([[3], [[3, 4]], 0]), [[0, 3]])
    check('reverse nonedge', solve([[4], [[3, 4]], 1]), [[0, 4]])
    check('bounded cycle', solve([[3], [[3, 3]], 2]), [[0, 3], [1, 3], [2, 3]])
    check('empty anchor', solve([[], [[3, 4]], 2]), [])
elif N == 4:
    check('chain frontier', solve([[4], [[4, 5], [5, 6]], 2]), [[0, 4], [1, 5], [2, 6]])
    check('duplicate anchors', solve([[4, 4], [[4, 5]], 1]), [[0, 4], [0, 4], [1, 5], [1, 5]])
    check('duplicate rules', solve([[4], [[4, 5], [4, 5]], 1]), [[0, 4], [1, 5], [1, 5]])
    check('zero depth', solve([[4], [[4, 5]], 0]), [[0, 4]])
    check('reverse nonedge', solve([[5], [[4, 5]], 1]), [[0, 5]])
    check('bounded cycle', solve([[4], [[4, 4]], 2]), [[0, 4], [1, 4], [2, 4]])
    check('empty anchor', solve([[], [[4, 5]], 2]), [])
elif N == 5:
    check('chain frontier', solve([[5], [[5, 6], [6, 7]], 2]), [[0, 5], [1, 6], [2, 7]])
    check('duplicate anchors', solve([[5, 5], [[5, 6]], 1]), [[0, 5], [0, 5], [1, 6], [1, 6]])
    check('duplicate rules', solve([[5], [[5, 6], [5, 6]], 1]), [[0, 5], [1, 6], [1, 6]])
    check('zero depth', solve([[5], [[5, 6]], 0]), [[0, 5]])
    check('reverse nonedge', solve([[6], [[5, 6]], 1]), [[0, 6]])
    check('bounded cycle', solve([[5], [[5, 5]], 2]), [[0, 5], [1, 5], [2, 5]])
    check('empty anchor', solve([[], [[5, 6]], 2]), [])
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:
Recursive bag evaluation removes repeated values encountered at later depths.

Evaluate a bounded recursive UNION ALL query. Anchors are integer values; each frontier value joins all rules [source,target], preserving duplicate anchors and duplicate rules. Emit [depth,value] for depth zero through max-depth, expanding only the newest frontier. Preserve anchor and rule encounter order.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        points,intervals=d
        out=[]
        for ident,key,time in points:
            candidates=sorted(intervals,key=lambda r:(r[2],r[0]))
            for other,k,start,end in candidates:
                if key is None or key!=k: continue
                if start<=time and time<=end:
                    out.append([ident,other])
        return out
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('end expired', solve([[[10, 'a', 3]], [[20, 'a', 1, 3]]]), [])
    check('start active', solve([[[10, 'a', 1]], [[20, 'a', 1, 3]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 1]], [[20, 'a', 2, 4]]]), [])
    check('overlap order', solve([[[10, 'a', 3]], [[20, 'a', 2, 5], [21, 'a', 1, 4]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 2]], [[20, 'b', 1, 4], [21, None, 1, 4]]]), [])
    check('empty interval', solve([[[10, 'a', 1]], [[20, 'a', 1, 1]]]), [])
    check('null probe', solve([[[10, None, 2]], [[20, None, 1, 4]]]), [])
elif N == 2:
    check('end expired', solve([[[10, 'a', 4]], [[20, 'a', 2, 4]]]), [])
    check('start active', solve([[[10, 'a', 2]], [[20, 'a', 2, 4]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 2]], [[20, 'a', 3, 5]]]), [])
    check('overlap order', solve([[[10, 'a', 4]], [[20, 'a', 3, 6], [21, 'a', 2, 5]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 3]], [[20, 'b', 2, 5], [21, None, 2, 5]]]), [])
    check('empty interval', solve([[[10, 'a', 2]], [[20, 'a', 2, 2]]]), [])
    check('null probe', solve([[[10, None, 3]], [[20, None, 2, 5]]]), [])
elif N == 3:
    check('end expired', solve([[[10, 'a', 5]], [[20, 'a', 3, 5]]]), [])
    check('start active', solve([[[10, 'a', 3]], [[20, 'a', 3, 5]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 3]], [[20, 'a', 4, 6]]]), [])
    check('overlap order', solve([[[10, 'a', 5]], [[20, 'a', 4, 7], [21, 'a', 3, 6]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 4]], [[20, 'b', 3, 6], [21, None, 3, 6]]]), [])
    check('empty interval', solve([[[10, 'a', 3]], [[20, 'a', 3, 3]]]), [])
    check('null probe', solve([[[10, None, 4]], [[20, None, 3, 6]]]), [])
elif N == 4:
    check('end expired', solve([[[10, 'a', 6]], [[20, 'a', 4, 6]]]), [])
    check('start active', solve([[[10, 'a', 4]], [[20, 'a', 4, 6]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 4]], [[20, 'a', 5, 7]]]), [])
    check('overlap order', solve([[[10, 'a', 6]], [[20, 'a', 5, 8], [21, 'a', 4, 7]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 5]], [[20, 'b', 4, 7], [21, None, 4, 7]]]), [])
    check('empty interval', solve([[[10, 'a', 4]], [[20, 'a', 4, 4]]]), [])
    check('null probe', solve([[[10, None, 5]], [[20, None, 4, 7]]]), [])
elif N == 5:
    check('end expired', solve([[[10, 'a', 7]], [[20, 'a', 5, 7]]]), [])
    check('start active', solve([[[10, 'a', 5]], [[20, 'a', 5, 7]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 5]], [[20, 'a', 6, 8]]]), [])
    check('overlap order', solve([[[10, 'a', 7]], [[20, 'a', 6, 9], [21, 'a', 5, 8]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 6]], [[20, 'b', 5, 8], [21, None, 5, 8]]]), [])
    check('empty interval', solve([[[10, 'a', 5]], [[20, 'a', 5, 5]]]), [])
    check('null probe', solve([[[10, None, 6]], [[20, None, 5, 8]]]), [])
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(d):
    try:
        points,intervals=d
        out=[]
        for ident,key,time in points:
            candidates=sorted(intervals,key=lambda r:(r[2],r[0]))
            for other,k,start,end in candidates:
                if key is None or key!=k: continue
                if start<=time and time<end+1:
                    out.append([ident,other])
        return out
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('end expired', solve([[[10, 'a', 3]], [[20, 'a', 1, 3]]]), [])
    check('start active', solve([[[10, 'a', 1]], [[20, 'a', 1, 3]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 1]], [[20, 'a', 2, 4]]]), [])
    check('overlap order', solve([[[10, 'a', 3]], [[20, 'a', 2, 5], [21, 'a', 1, 4]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 2]], [[20, 'b', 1, 4], [21, None, 1, 4]]]), [])
    check('empty interval', solve([[[10, 'a', 1]], [[20, 'a', 1, 1]]]), [])
    check('null probe', solve([[[10, None, 2]], [[20, None, 1, 4]]]), [])
elif N == 2:
    check('end expired', solve([[[10, 'a', 4]], [[20, 'a', 2, 4]]]), [])
    check('start active', solve([[[10, 'a', 2]], [[20, 'a', 2, 4]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 2]], [[20, 'a', 3, 5]]]), [])
    check('overlap order', solve([[[10, 'a', 4]], [[20, 'a', 3, 6], [21, 'a', 2, 5]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 3]], [[20, 'b', 2, 5], [21, None, 2, 5]]]), [])
    check('empty interval', solve([[[10, 'a', 2]], [[20, 'a', 2, 2]]]), [])
    check('null probe', solve([[[10, None, 3]], [[20, None, 2, 5]]]), [])
elif N == 3:
    check('end expired', solve([[[10, 'a', 5]], [[20, 'a', 3, 5]]]), [])
    check('start active', solve([[[10, 'a', 3]], [[20, 'a', 3, 5]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 3]], [[20, 'a', 4, 6]]]), [])
    check('overlap order', solve([[[10, 'a', 5]], [[20, 'a', 4, 7], [21, 'a', 3, 6]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 4]], [[20, 'b', 3, 6], [21, None, 3, 6]]]), [])
    check('empty interval', solve([[[10, 'a', 3]], [[20, 'a', 3, 3]]]), [])
    check('null probe', solve([[[10, None, 4]], [[20, None, 3, 6]]]), [])
elif N == 4:
    check('end expired', solve([[[10, 'a', 6]], [[20, 'a', 4, 6]]]), [])
    check('start active', solve([[[10, 'a', 4]], [[20, 'a', 4, 6]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 4]], [[20, 'a', 5, 7]]]), [])
    check('overlap order', solve([[[10, 'a', 6]], [[20, 'a', 5, 8], [21, 'a', 4, 7]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 5]], [[20, 'b', 4, 7], [21, None, 4, 7]]]), [])
    check('empty interval', solve([[[10, 'a', 4]], [[20, 'a', 4, 4]]]), [])
    check('null probe', solve([[[10, None, 5]], [[20, None, 4, 7]]]), [])
elif N == 5:
    check('end expired', solve([[[10, 'a', 7]], [[20, 'a', 5, 7]]]), [])
    check('start active', solve([[[10, 'a', 5]], [[20, 'a', 5, 7]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 5]], [[20, 'a', 6, 8]]]), [])
    check('overlap order', solve([[[10, 'a', 7]], [[20, 'a', 6, 9], [21, 'a', 5, 8]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 6]], [[20, 'b', 5, 8], [21, None, 5, 8]]]), [])
    check('empty interval', solve([[[10, 'a', 5]], [[20, 'a', 5, 5]]]), [])
    check('null probe', solve([[[10, None, 6]], [[20, None, 5, 8]]]), [])
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:
Interval join keeps intervals whose end equals the probe time.

Join probe points [id,key,time] to interval rows [id,key,start,end] under start<=time<end and ordinary non-null key equality. Emit probe-major [probe-id,interval-id] pairs, with matching intervals ordered by (start,id). Empty intervals never match; overlapping intervals all produce rows.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        points,intervals=d
        out=[]
        for ident,key,time in points:
            candidates=sorted(intervals,key=lambda r:(r[2],r[0]))
            for other,k,start,end in candidates:
                if key is None or key!=k: continue
                if time<end:
                    out.append([ident,other])
        return out
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('end expired', solve([[[10, 'a', 3]], [[20, 'a', 1, 3]]]), [])
    check('start active', solve([[[10, 'a', 1]], [[20, 'a', 1, 3]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 1]], [[20, 'a', 2, 4]]]), [])
    check('overlap order', solve([[[10, 'a', 3]], [[20, 'a', 2, 5], [21, 'a', 1, 4]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 2]], [[20, 'b', 1, 4], [21, None, 1, 4]]]), [])
    check('empty interval', solve([[[10, 'a', 1]], [[20, 'a', 1, 1]]]), [])
    check('null probe', solve([[[10, None, 2]], [[20, None, 1, 4]]]), [])
elif N == 2:
    check('end expired', solve([[[10, 'a', 4]], [[20, 'a', 2, 4]]]), [])
    check('start active', solve([[[10, 'a', 2]], [[20, 'a', 2, 4]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 2]], [[20, 'a', 3, 5]]]), [])
    check('overlap order', solve([[[10, 'a', 4]], [[20, 'a', 3, 6], [21, 'a', 2, 5]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 3]], [[20, 'b', 2, 5], [21, None, 2, 5]]]), [])
    check('empty interval', solve([[[10, 'a', 2]], [[20, 'a', 2, 2]]]), [])
    check('null probe', solve([[[10, None, 3]], [[20, None, 2, 5]]]), [])
elif N == 3:
    check('end expired', solve([[[10, 'a', 5]], [[20, 'a', 3, 5]]]), [])
    check('start active', solve([[[10, 'a', 3]], [[20, 'a', 3, 5]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 3]], [[20, 'a', 4, 6]]]), [])
    check('overlap order', solve([[[10, 'a', 5]], [[20, 'a', 4, 7], [21, 'a', 3, 6]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 4]], [[20, 'b', 3, 6], [21, None, 3, 6]]]), [])
    check('empty interval', solve([[[10, 'a', 3]], [[20, 'a', 3, 3]]]), [])
    check('null probe', solve([[[10, None, 4]], [[20, None, 3, 6]]]), [])
elif N == 4:
    check('end expired', solve([[[10, 'a', 6]], [[20, 'a', 4, 6]]]), [])
    check('start active', solve([[[10, 'a', 4]], [[20, 'a', 4, 6]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 4]], [[20, 'a', 5, 7]]]), [])
    check('overlap order', solve([[[10, 'a', 6]], [[20, 'a', 5, 8], [21, 'a', 4, 7]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 5]], [[20, 'b', 4, 7], [21, None, 4, 7]]]), [])
    check('empty interval', solve([[[10, 'a', 4]], [[20, 'a', 4, 4]]]), [])
    check('null probe', solve([[[10, None, 5]], [[20, None, 4, 7]]]), [])
elif N == 5:
    check('end expired', solve([[[10, 'a', 7]], [[20, 'a', 5, 7]]]), [])
    check('start active', solve([[[10, 'a', 5]], [[20, 'a', 5, 7]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 5]], [[20, 'a', 6, 8]]]), [])
    check('overlap order', solve([[[10, 'a', 7]], [[20, 'a', 6, 9], [21, 'a', 5, 8]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 6]], [[20, 'b', 5, 8], [21, None, 5, 8]]]), [])
    check('empty interval', solve([[[10, 'a', 5]], [[20, 'a', 5, 5]]]), [])
    check('null probe', solve([[[10, None, 6]], [[20, None, 5, 8]]]), [])
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(d):
    try:
        points,intervals=d
        out=[]
        for ident,key,time in points:
            candidates=sorted(intervals,key=lambda r:(r[2],r[0]))
            for other,k,start,end in candidates:
                if key is None or key!=k: continue
                if start<time and time<end:
                    out.append([ident,other])
        return out
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('end expired', solve([[[10, 'a', 3]], [[20, 'a', 1, 3]]]), [])
    check('start active', solve([[[10, 'a', 1]], [[20, 'a', 1, 3]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 1]], [[20, 'a', 2, 4]]]), [])
    check('overlap order', solve([[[10, 'a', 3]], [[20, 'a', 2, 5], [21, 'a', 1, 4]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 2]], [[20, 'b', 1, 4], [21, None, 1, 4]]]), [])
    check('empty interval', solve([[[10, 'a', 1]], [[20, 'a', 1, 1]]]), [])
    check('null probe', solve([[[10, None, 2]], [[20, None, 1, 4]]]), [])
elif N == 2:
    check('end expired', solve([[[10, 'a', 4]], [[20, 'a', 2, 4]]]), [])
    check('start active', solve([[[10, 'a', 2]], [[20, 'a', 2, 4]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 2]], [[20, 'a', 3, 5]]]), [])
    check('overlap order', solve([[[10, 'a', 4]], [[20, 'a', 3, 6], [21, 'a', 2, 5]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 3]], [[20, 'b', 2, 5], [21, None, 2, 5]]]), [])
    check('empty interval', solve([[[10, 'a', 2]], [[20, 'a', 2, 2]]]), [])
    check('null probe', solve([[[10, None, 3]], [[20, None, 2, 5]]]), [])
elif N == 3:
    check('end expired', solve([[[10, 'a', 5]], [[20, 'a', 3, 5]]]), [])
    check('start active', solve([[[10, 'a', 3]], [[20, 'a', 3, 5]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 3]], [[20, 'a', 4, 6]]]), [])
    check('overlap order', solve([[[10, 'a', 5]], [[20, 'a', 4, 7], [21, 'a', 3, 6]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 4]], [[20, 'b', 3, 6], [21, None, 3, 6]]]), [])
    check('empty interval', solve([[[10, 'a', 3]], [[20, 'a', 3, 3]]]), [])
    check('null probe', solve([[[10, None, 4]], [[20, None, 3, 6]]]), [])
elif N == 4:
    check('end expired', solve([[[10, 'a', 6]], [[20, 'a', 4, 6]]]), [])
    check('start active', solve([[[10, 'a', 4]], [[20, 'a', 4, 6]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 4]], [[20, 'a', 5, 7]]]), [])
    check('overlap order', solve([[[10, 'a', 6]], [[20, 'a', 5, 8], [21, 'a', 4, 7]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 5]], [[20, 'b', 4, 7], [21, None, 4, 7]]]), [])
    check('empty interval', solve([[[10, 'a', 4]], [[20, 'a', 4, 4]]]), [])
    check('null probe', solve([[[10, None, 5]], [[20, None, 4, 7]]]), [])
elif N == 5:
    check('end expired', solve([[[10, 'a', 7]], [[20, 'a', 5, 7]]]), [])
    check('start active', solve([[[10, 'a', 5]], [[20, 'a', 5, 7]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 5]], [[20, 'a', 6, 8]]]), [])
    check('overlap order', solve([[[10, 'a', 7]], [[20, 'a', 6, 9], [21, 'a', 5, 8]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 6]], [[20, 'b', 5, 8], [21, None, 5, 8]]]), [])
    check('empty interval', solve([[[10, 'a', 5]], [[20, 'a', 5, 5]]]), [])
    check('null probe', solve([[[10, None, 6]], [[20, None, 5, 8]]]), [])
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:
Interval join admits intervals before their start.

Join probe points [id,key,time] to interval rows [id,key,start,end] under start<=time<end and ordinary non-null key equality. Emit probe-major [probe-id,interval-id] pairs, with matching intervals ordered by (start,id). Empty intervals never match; overlapping intervals all produce rows.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        points,intervals=d
        out=[]
        for ident,key,time in points:
            candidates=sorted(intervals,key=lambda r:(r[2],r[0]))
            for other,k,start,end in candidates:
                if key is None: continue
                if start<=time and time<end:
                    out.append([ident,other])
        return out
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('end expired', solve([[[10, 'a', 3]], [[20, 'a', 1, 3]]]), [])
    check('start active', solve([[[10, 'a', 1]], [[20, 'a', 1, 3]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 1]], [[20, 'a', 2, 4]]]), [])
    check('overlap order', solve([[[10, 'a', 3]], [[20, 'a', 2, 5], [21, 'a', 1, 4]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 2]], [[20, 'b', 1, 4], [21, None, 1, 4]]]), [])
    check('empty interval', solve([[[10, 'a', 1]], [[20, 'a', 1, 1]]]), [])
    check('null probe', solve([[[10, None, 2]], [[20, None, 1, 4]]]), [])
elif N == 2:
    check('end expired', solve([[[10, 'a', 4]], [[20, 'a', 2, 4]]]), [])
    check('start active', solve([[[10, 'a', 2]], [[20, 'a', 2, 4]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 2]], [[20, 'a', 3, 5]]]), [])
    check('overlap order', solve([[[10, 'a', 4]], [[20, 'a', 3, 6], [21, 'a', 2, 5]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 3]], [[20, 'b', 2, 5], [21, None, 2, 5]]]), [])
    check('empty interval', solve([[[10, 'a', 2]], [[20, 'a', 2, 2]]]), [])
    check('null probe', solve([[[10, None, 3]], [[20, None, 2, 5]]]), [])
elif N == 3:
    check('end expired', solve([[[10, 'a', 5]], [[20, 'a', 3, 5]]]), [])
    check('start active', solve([[[10, 'a', 3]], [[20, 'a', 3, 5]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 3]], [[20, 'a', 4, 6]]]), [])
    check('overlap order', solve([[[10, 'a', 5]], [[20, 'a', 4, 7], [21, 'a', 3, 6]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 4]], [[20, 'b', 3, 6], [21, None, 3, 6]]]), [])
    check('empty interval', solve([[[10, 'a', 3]], [[20, 'a', 3, 3]]]), [])
    check('null probe', solve([[[10, None, 4]], [[20, None, 3, 6]]]), [])
elif N == 4:
    check('end expired', solve([[[10, 'a', 6]], [[20, 'a', 4, 6]]]), [])
    check('start active', solve([[[10, 'a', 4]], [[20, 'a', 4, 6]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 4]], [[20, 'a', 5, 7]]]), [])
    check('overlap order', solve([[[10, 'a', 6]], [[20, 'a', 5, 8], [21, 'a', 4, 7]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 5]], [[20, 'b', 4, 7], [21, None, 4, 7]]]), [])
    check('empty interval', solve([[[10, 'a', 4]], [[20, 'a', 4, 4]]]), [])
    check('null probe', solve([[[10, None, 5]], [[20, None, 4, 7]]]), [])
elif N == 5:
    check('end expired', solve([[[10, 'a', 7]], [[20, 'a', 5, 7]]]), [])
    check('start active', solve([[[10, 'a', 5]], [[20, 'a', 5, 7]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 5]], [[20, 'a', 6, 8]]]), [])
    check('overlap order', solve([[[10, 'a', 7]], [[20, 'a', 6, 9], [21, 'a', 5, 8]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 6]], [[20, 'b', 5, 8], [21, None, 5, 8]]]), [])
    check('empty interval', solve([[[10, 'a', 5]], [[20, 'a', 5, 5]]]), [])
    check('null probe', solve([[[10, None, 6]], [[20, None, 5, 8]]]), [])
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(d):
    try:
        points,intervals=d
        out=[]
        for ident,key,time in points:
            candidates=sorted(intervals,key=lambda r:(r[2],r[0]))
            for other,k,start,end in candidates:
                if key!=k and k is not None: continue
                if start<=time and time<end:
                    out.append([ident,other])
        return out
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('end expired', solve([[[10, 'a', 3]], [[20, 'a', 1, 3]]]), [])
    check('start active', solve([[[10, 'a', 1]], [[20, 'a', 1, 3]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 1]], [[20, 'a', 2, 4]]]), [])
    check('overlap order', solve([[[10, 'a', 3]], [[20, 'a', 2, 5], [21, 'a', 1, 4]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 2]], [[20, 'b', 1, 4], [21, None, 1, 4]]]), [])
    check('empty interval', solve([[[10, 'a', 1]], [[20, 'a', 1, 1]]]), [])
    check('null probe', solve([[[10, None, 2]], [[20, None, 1, 4]]]), [])
elif N == 2:
    check('end expired', solve([[[10, 'a', 4]], [[20, 'a', 2, 4]]]), [])
    check('start active', solve([[[10, 'a', 2]], [[20, 'a', 2, 4]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 2]], [[20, 'a', 3, 5]]]), [])
    check('overlap order', solve([[[10, 'a', 4]], [[20, 'a', 3, 6], [21, 'a', 2, 5]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 3]], [[20, 'b', 2, 5], [21, None, 2, 5]]]), [])
    check('empty interval', solve([[[10, 'a', 2]], [[20, 'a', 2, 2]]]), [])
    check('null probe', solve([[[10, None, 3]], [[20, None, 2, 5]]]), [])
elif N == 3:
    check('end expired', solve([[[10, 'a', 5]], [[20, 'a', 3, 5]]]), [])
    check('start active', solve([[[10, 'a', 3]], [[20, 'a', 3, 5]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 3]], [[20, 'a', 4, 6]]]), [])
    check('overlap order', solve([[[10, 'a', 5]], [[20, 'a', 4, 7], [21, 'a', 3, 6]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 4]], [[20, 'b', 3, 6], [21, None, 3, 6]]]), [])
    check('empty interval', solve([[[10, 'a', 3]], [[20, 'a', 3, 3]]]), [])
    check('null probe', solve([[[10, None, 4]], [[20, None, 3, 6]]]), [])
elif N == 4:
    check('end expired', solve([[[10, 'a', 6]], [[20, 'a', 4, 6]]]), [])
    check('start active', solve([[[10, 'a', 4]], [[20, 'a', 4, 6]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 4]], [[20, 'a', 5, 7]]]), [])
    check('overlap order', solve([[[10, 'a', 6]], [[20, 'a', 5, 8], [21, 'a', 4, 7]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 5]], [[20, 'b', 4, 7], [21, None, 4, 7]]]), [])
    check('empty interval', solve([[[10, 'a', 4]], [[20, 'a', 4, 4]]]), [])
    check('null probe', solve([[[10, None, 5]], [[20, None, 4, 7]]]), [])
elif N == 5:
    check('end expired', solve([[[10, 'a', 7]], [[20, 'a', 5, 7]]]), [])
    check('start active', solve([[[10, 'a', 5]], [[20, 'a', 5, 7]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 5]], [[20, 'a', 6, 8]]]), [])
    check('overlap order', solve([[[10, 'a', 7]], [[20, 'a', 6, 9], [21, 'a', 5, 8]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 6]], [[20, 'b', 5, 8], [21, None, 5, 8]]]), [])
    check('empty interval', solve([[[10, 'a', 5]], [[20, 'a', 5, 5]]]), [])
    check('null probe', solve([[[10, None, 6]], [[20, None, 5, 8]]]), [])
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:
Interval join mixes active intervals from unrelated keys.

Join probe points [id,key,time] to interval rows [id,key,start,end] under start<=time<end and ordinary non-null key equality. Emit probe-major [probe-id,interval-id] pairs, with matching intervals ordered by (start,id). Empty intervals never match; overlapping intervals all produce rows.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        points,intervals=d
        out=[]
        for ident,key,time in points:
            candidates=sorted(intervals,key=lambda r:(r[2],r[0]))
            for other,k,start,end in candidates:
                if key is None or key!=k: continue
                if start<=time and time<end:
                    out.append([ident,other]); break
        return out
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('end expired', solve([[[10, 'a', 3]], [[20, 'a', 1, 3]]]), [])
    check('start active', solve([[[10, 'a', 1]], [[20, 'a', 1, 3]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 1]], [[20, 'a', 2, 4]]]), [])
    check('overlap order', solve([[[10, 'a', 3]], [[20, 'a', 2, 5], [21, 'a', 1, 4]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 2]], [[20, 'b', 1, 4], [21, None, 1, 4]]]), [])
    check('empty interval', solve([[[10, 'a', 1]], [[20, 'a', 1, 1]]]), [])
    check('null probe', solve([[[10, None, 2]], [[20, None, 1, 4]]]), [])
elif N == 2:
    check('end expired', solve([[[10, 'a', 4]], [[20, 'a', 2, 4]]]), [])
    check('start active', solve([[[10, 'a', 2]], [[20, 'a', 2, 4]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 2]], [[20, 'a', 3, 5]]]), [])
    check('overlap order', solve([[[10, 'a', 4]], [[20, 'a', 3, 6], [21, 'a', 2, 5]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 3]], [[20, 'b', 2, 5], [21, None, 2, 5]]]), [])
    check('empty interval', solve([[[10, 'a', 2]], [[20, 'a', 2, 2]]]), [])
    check('null probe', solve([[[10, None, 3]], [[20, None, 2, 5]]]), [])
elif N == 3:
    check('end expired', solve([[[10, 'a', 5]], [[20, 'a', 3, 5]]]), [])
    check('start active', solve([[[10, 'a', 3]], [[20, 'a', 3, 5]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 3]], [[20, 'a', 4, 6]]]), [])
    check('overlap order', solve([[[10, 'a', 5]], [[20, 'a', 4, 7], [21, 'a', 3, 6]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 4]], [[20, 'b', 3, 6], [21, None, 3, 6]]]), [])
    check('empty interval', solve([[[10, 'a', 3]], [[20, 'a', 3, 3]]]), [])
    check('null probe', solve([[[10, None, 4]], [[20, None, 3, 6]]]), [])
elif N == 4:
    check('end expired', solve([[[10, 'a', 6]], [[20, 'a', 4, 6]]]), [])
    check('start active', solve([[[10, 'a', 4]], [[20, 'a', 4, 6]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 4]], [[20, 'a', 5, 7]]]), [])
    check('overlap order', solve([[[10, 'a', 6]], [[20, 'a', 5, 8], [21, 'a', 4, 7]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 5]], [[20, 'b', 4, 7], [21, None, 4, 7]]]), [])
    check('empty interval', solve([[[10, 'a', 4]], [[20, 'a', 4, 4]]]), [])
    check('null probe', solve([[[10, None, 5]], [[20, None, 4, 7]]]), [])
elif N == 5:
    check('end expired', solve([[[10, 'a', 7]], [[20, 'a', 5, 7]]]), [])
    check('start active', solve([[[10, 'a', 5]], [[20, 'a', 5, 7]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 5]], [[20, 'a', 6, 8]]]), [])
    check('overlap order', solve([[[10, 'a', 7]], [[20, 'a', 6, 9], [21, 'a', 5, 8]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 6]], [[20, 'b', 5, 8], [21, None, 5, 8]]]), [])
    check('empty interval', solve([[[10, 'a', 5]], [[20, 'a', 5, 5]]]), [])
    check('null probe', solve([[[10, None, 6]], [[20, None, 5, 8]]]), [])
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(d):
    try:
        points,intervals=d
        out=[]
        for ident,key,time in points:
            candidates=sorted(intervals,key=lambda r:(r[2],r[0]))
            for other,k,start,end in candidates:
                if key is None or key!=k: continue
                if start<=time and time<end:
                    out.append([ident,other]); candidates=[]; break
        return out
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('end expired', solve([[[10, 'a', 3]], [[20, 'a', 1, 3]]]), [])
    check('start active', solve([[[10, 'a', 1]], [[20, 'a', 1, 3]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 1]], [[20, 'a', 2, 4]]]), [])
    check('overlap order', solve([[[10, 'a', 3]], [[20, 'a', 2, 5], [21, 'a', 1, 4]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 2]], [[20, 'b', 1, 4], [21, None, 1, 4]]]), [])
    check('empty interval', solve([[[10, 'a', 1]], [[20, 'a', 1, 1]]]), [])
    check('null probe', solve([[[10, None, 2]], [[20, None, 1, 4]]]), [])
elif N == 2:
    check('end expired', solve([[[10, 'a', 4]], [[20, 'a', 2, 4]]]), [])
    check('start active', solve([[[10, 'a', 2]], [[20, 'a', 2, 4]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 2]], [[20, 'a', 3, 5]]]), [])
    check('overlap order', solve([[[10, 'a', 4]], [[20, 'a', 3, 6], [21, 'a', 2, 5]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 3]], [[20, 'b', 2, 5], [21, None, 2, 5]]]), [])
    check('empty interval', solve([[[10, 'a', 2]], [[20, 'a', 2, 2]]]), [])
    check('null probe', solve([[[10, None, 3]], [[20, None, 2, 5]]]), [])
elif N == 3:
    check('end expired', solve([[[10, 'a', 5]], [[20, 'a', 3, 5]]]), [])
    check('start active', solve([[[10, 'a', 3]], [[20, 'a', 3, 5]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 3]], [[20, 'a', 4, 6]]]), [])
    check('overlap order', solve([[[10, 'a', 5]], [[20, 'a', 4, 7], [21, 'a', 3, 6]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 4]], [[20, 'b', 3, 6], [21, None, 3, 6]]]), [])
    check('empty interval', solve([[[10, 'a', 3]], [[20, 'a', 3, 3]]]), [])
    check('null probe', solve([[[10, None, 4]], [[20, None, 3, 6]]]), [])
elif N == 4:
    check('end expired', solve([[[10, 'a', 6]], [[20, 'a', 4, 6]]]), [])
    check('start active', solve([[[10, 'a', 4]], [[20, 'a', 4, 6]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 4]], [[20, 'a', 5, 7]]]), [])
    check('overlap order', solve([[[10, 'a', 6]], [[20, 'a', 5, 8], [21, 'a', 4, 7]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 5]], [[20, 'b', 4, 7], [21, None, 4, 7]]]), [])
    check('empty interval', solve([[[10, 'a', 4]], [[20, 'a', 4, 4]]]), [])
    check('null probe', solve([[[10, None, 5]], [[20, None, 4, 7]]]), [])
elif N == 5:
    check('end expired', solve([[[10, 'a', 7]], [[20, 'a', 5, 7]]]), [])
    check('start active', solve([[[10, 'a', 5]], [[20, 'a', 5, 7]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 5]], [[20, 'a', 6, 8]]]), [])
    check('overlap order', solve([[[10, 'a', 7]], [[20, 'a', 6, 9], [21, 'a', 5, 8]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 6]], [[20, 'b', 5, 8], [21, None, 5, 8]]]), [])
    check('empty interval', solve([[[10, 'a', 5]], [[20, 'a', 5, 5]]]), [])
    check('null probe', solve([[[10, None, 6]], [[20, None, 5, 8]]]), [])
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:
Interval join emits only the first active matching interval.

Join probe points [id,key,time] to interval rows [id,key,start,end] under start<=time<end and ordinary non-null key equality. Emit probe-major [probe-id,interval-id] pairs, with matching intervals ordered by (start,id). Empty intervals never match; overlapping intervals all produce rows.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        points,intervals=d
        out=[]
        for ident,key,time in points:
            candidates=intervals
            for other,k,start,end in candidates:
                if key is None or key!=k: continue
                if start<=time and time<end:
                    out.append([ident,other])
        return out
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('end expired', solve([[[10, 'a', 3]], [[20, 'a', 1, 3]]]), [])
    check('start active', solve([[[10, 'a', 1]], [[20, 'a', 1, 3]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 1]], [[20, 'a', 2, 4]]]), [])
    check('overlap order', solve([[[10, 'a', 3]], [[20, 'a', 2, 5], [21, 'a', 1, 4]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 2]], [[20, 'b', 1, 4], [21, None, 1, 4]]]), [])
    check('empty interval', solve([[[10, 'a', 1]], [[20, 'a', 1, 1]]]), [])
    check('null probe', solve([[[10, None, 2]], [[20, None, 1, 4]]]), [])
elif N == 2:
    check('end expired', solve([[[10, 'a', 4]], [[20, 'a', 2, 4]]]), [])
    check('start active', solve([[[10, 'a', 2]], [[20, 'a', 2, 4]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 2]], [[20, 'a', 3, 5]]]), [])
    check('overlap order', solve([[[10, 'a', 4]], [[20, 'a', 3, 6], [21, 'a', 2, 5]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 3]], [[20, 'b', 2, 5], [21, None, 2, 5]]]), [])
    check('empty interval', solve([[[10, 'a', 2]], [[20, 'a', 2, 2]]]), [])
    check('null probe', solve([[[10, None, 3]], [[20, None, 2, 5]]]), [])
elif N == 3:
    check('end expired', solve([[[10, 'a', 5]], [[20, 'a', 3, 5]]]), [])
    check('start active', solve([[[10, 'a', 3]], [[20, 'a', 3, 5]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 3]], [[20, 'a', 4, 6]]]), [])
    check('overlap order', solve([[[10, 'a', 5]], [[20, 'a', 4, 7], [21, 'a', 3, 6]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 4]], [[20, 'b', 3, 6], [21, None, 3, 6]]]), [])
    check('empty interval', solve([[[10, 'a', 3]], [[20, 'a', 3, 3]]]), [])
    check('null probe', solve([[[10, None, 4]], [[20, None, 3, 6]]]), [])
elif N == 4:
    check('end expired', solve([[[10, 'a', 6]], [[20, 'a', 4, 6]]]), [])
    check('start active', solve([[[10, 'a', 4]], [[20, 'a', 4, 6]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 4]], [[20, 'a', 5, 7]]]), [])
    check('overlap order', solve([[[10, 'a', 6]], [[20, 'a', 5, 8], [21, 'a', 4, 7]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 5]], [[20, 'b', 4, 7], [21, None, 4, 7]]]), [])
    check('empty interval', solve([[[10, 'a', 4]], [[20, 'a', 4, 4]]]), [])
    check('null probe', solve([[[10, None, 5]], [[20, None, 4, 7]]]), [])
elif N == 5:
    check('end expired', solve([[[10, 'a', 7]], [[20, 'a', 5, 7]]]), [])
    check('start active', solve([[[10, 'a', 5]], [[20, 'a', 5, 7]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 5]], [[20, 'a', 6, 8]]]), [])
    check('overlap order', solve([[[10, 'a', 7]], [[20, 'a', 6, 9], [21, 'a', 5, 8]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 6]], [[20, 'b', 5, 8], [21, None, 5, 8]]]), [])
    check('empty interval', solve([[[10, 'a', 5]], [[20, 'a', 5, 5]]]), [])
    check('null probe', solve([[[10, None, 6]], [[20, None, 5, 8]]]), [])
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(d):
    try:
        points,intervals=d
        out=[]
        for ident,key,time in points:
            candidates=sorted(intervals,key=lambda r:r[0])
            for other,k,start,end in candidates:
                if key is None or key!=k: continue
                if start<=time and time<end:
                    out.append([ident,other])
        return out
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('end expired', solve([[[10, 'a', 3]], [[20, 'a', 1, 3]]]), [])
    check('start active', solve([[[10, 'a', 1]], [[20, 'a', 1, 3]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 1]], [[20, 'a', 2, 4]]]), [])
    check('overlap order', solve([[[10, 'a', 3]], [[20, 'a', 2, 5], [21, 'a', 1, 4]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 2]], [[20, 'b', 1, 4], [21, None, 1, 4]]]), [])
    check('empty interval', solve([[[10, 'a', 1]], [[20, 'a', 1, 1]]]), [])
    check('null probe', solve([[[10, None, 2]], [[20, None, 1, 4]]]), [])
elif N == 2:
    check('end expired', solve([[[10, 'a', 4]], [[20, 'a', 2, 4]]]), [])
    check('start active', solve([[[10, 'a', 2]], [[20, 'a', 2, 4]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 2]], [[20, 'a', 3, 5]]]), [])
    check('overlap order', solve([[[10, 'a', 4]], [[20, 'a', 3, 6], [21, 'a', 2, 5]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 3]], [[20, 'b', 2, 5], [21, None, 2, 5]]]), [])
    check('empty interval', solve([[[10, 'a', 2]], [[20, 'a', 2, 2]]]), [])
    check('null probe', solve([[[10, None, 3]], [[20, None, 2, 5]]]), [])
elif N == 3:
    check('end expired', solve([[[10, 'a', 5]], [[20, 'a', 3, 5]]]), [])
    check('start active', solve([[[10, 'a', 3]], [[20, 'a', 3, 5]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 3]], [[20, 'a', 4, 6]]]), [])
    check('overlap order', solve([[[10, 'a', 5]], [[20, 'a', 4, 7], [21, 'a', 3, 6]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 4]], [[20, 'b', 3, 6], [21, None, 3, 6]]]), [])
    check('empty interval', solve([[[10, 'a', 3]], [[20, 'a', 3, 3]]]), [])
    check('null probe', solve([[[10, None, 4]], [[20, None, 3, 6]]]), [])
elif N == 4:
    check('end expired', solve([[[10, 'a', 6]], [[20, 'a', 4, 6]]]), [])
    check('start active', solve([[[10, 'a', 4]], [[20, 'a', 4, 6]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 4]], [[20, 'a', 5, 7]]]), [])
    check('overlap order', solve([[[10, 'a', 6]], [[20, 'a', 5, 8], [21, 'a', 4, 7]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 5]], [[20, 'b', 4, 7], [21, None, 4, 7]]]), [])
    check('empty interval', solve([[[10, 'a', 4]], [[20, 'a', 4, 4]]]), [])
    check('null probe', solve([[[10, None, 5]], [[20, None, 4, 7]]]), [])
elif N == 5:
    check('end expired', solve([[[10, 'a', 7]], [[20, 'a', 5, 7]]]), [])
    check('start active', solve([[[10, 'a', 5]], [[20, 'a', 5, 7]]]), [[10, 20]])
    check('future inactive', solve([[[10, 'a', 5]], [[20, 'a', 6, 8]]]), [])
    check('overlap order', solve([[[10, 'a', 7]], [[20, 'a', 6, 9], [21, 'a', 5, 8]]]), [[10, 21], [10, 20]])
    check('other keys', solve([[[10, 'a', 6]], [[20, 'b', 5, 8], [21, None, 5, 8]]]), [])
    check('empty interval', solve([[[10, 'a', 5]], [[20, 'a', 5, 5]]]), [])
    check('null probe', solve([[[10, None, 6]], [[20, None, 5, 8]]]), [])
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:
Interval join emits intervals by storage order rather than start order.

Join probe points [id,key,time] to interval rows [id,key,start,end] under start<=time<end and ordinary non-null key equality. Emit probe-major [probe-id,interval-id] pairs, with matching intervals ordered by (start,id). Empty intervals never match; overlapping intervals all produce rows.

split: open-access