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

N = 1
observations = []
def solve(x):
    old,new,low,high,paused=x
    events=[]
    state=paused
    if not paused and old<high<=new:
        state=True
        events.append('pause')
    if paused and old>low>=new:
        state=False
        events.append('resume')
    at_high=new>=high
    at_low=new<=low
    headroom=high-new
    excess=max(0,new-low)
    return [state,events,at_high,at_low,headroom,excess]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([2,5,2,5,False]), {1: [True, ['pause'], True, False, 0, 3], 2: [True, ['pause'], True, False, 0, 3], 3: [True, ['pause'], True, False, 0, 3], 4: [True, ['pause'], True, False, 0, 3], 5: [True, ['pause'], True, False, 0, 3]}[N])
check('1', solve([5,2,2,5,True]), {1: [False, ['resume'], False, True, 3, 0], 2: [False, ['resume'], False, True, 3, 0], 3: [False, ['resume'], False, True, 3, 0], 4: [False, ['resume'], False, True, 3, 0], 5: [False, ['resume'], False, True, 3, 0]}[N])
check('2', solve([5,6,2,5,False]), {1: [False, [], True, False, 0, 4], 2: [False, [], True, False, 0, 4], 3: [False, [], True, False, 0, 4], 4: [False, [], True, False, 0, 4], 5: [False, [], True, False, 0, 4]}[N])
check('3', solve([2,1,2,5,True]), {1: [True, [], False, True, 4, 0], 2: [True, [], False, True, 4, 0], 3: [True, [], False, True, 4, 0], 4: [True, [], False, True, 4, 0], 5: [True, [], False, True, 4, 0]}[N])
check('4', solve([N,N,0,N+3,False]), {1: [False, [], False, False, 3, 1], 2: [False, [], False, False, 3, 2], 3: [False, [], False, False, 3, 3], 4: [False, [], False, False, 3, 4], 5: [False, [], False, False, 3, 5]}[N])
check('5', solve([3,4,2,5,False]), {1: [False, [], False, False, 1, 2], 2: [False, [], False, False, 1, 2], 3: [False, [], False, False, 1, 2], 4: [False, [], False, False, 1, 2], 5: [False, [], False, False, 1, 2]}[N])
check('6', solve([6,1,2,5,True]), {1: [False, ['resume'], False, True, 4, 0], 2: [False, ['resume'], False, True, 4, 0], 3: [False, ['resume'], False, True, 4, 0], 4: [False, ['resume'], False, True, 4, 0], 5: [False, ['resume'], False, True, 4, 0]}[N])
check('7', solve([1,7,2,5,False]), {1: [True, ['pause'], True, False, 0, 5], 2: [True, ['pause'], True, False, 0, 5], 3: [True, ['pause'], True, False, 0, 5], 4: [True, ['pause'], True, False, 0, 5], 5: [True, ['pause'], True, False, 0, 5]}[N])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(x):
    old,new,low,high,paused=x
    events=[]
    state=paused
    if not paused and old<high<=new:
        state=True
        events.append('pause')
    if paused and old>low>=new:
        state=False
        events.append('resume')
    at_high=new>=high
    at_low=new<=low
    headroom=max(0,high-new) if new<=high else high-new
    excess=max(0,new-low)
    return [state,events,at_high,at_low,headroom,excess]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([2,5,2,5,False]), {1: [True, ['pause'], True, False, 0, 3], 2: [True, ['pause'], True, False, 0, 3], 3: [True, ['pause'], True, False, 0, 3], 4: [True, ['pause'], True, False, 0, 3], 5: [True, ['pause'], True, False, 0, 3]}[N])
check('1', solve([5,2,2,5,True]), {1: [False, ['resume'], False, True, 3, 0], 2: [False, ['resume'], False, True, 3, 0], 3: [False, ['resume'], False, True, 3, 0], 4: [False, ['resume'], False, True, 3, 0], 5: [False, ['resume'], False, True, 3, 0]}[N])
check('2', solve([5,6,2,5,False]), {1: [False, [], True, False, 0, 4], 2: [False, [], True, False, 0, 4], 3: [False, [], True, False, 0, 4], 4: [False, [], True, False, 0, 4], 5: [False, [], True, False, 0, 4]}[N])
check('3', solve([2,1,2,5,True]), {1: [True, [], False, True, 4, 0], 2: [True, [], False, True, 4, 0], 3: [True, [], False, True, 4, 0], 4: [True, [], False, True, 4, 0], 5: [True, [], False, True, 4, 0]}[N])
check('4', solve([N,N,0,N+3,False]), {1: [False, [], False, False, 3, 1], 2: [False, [], False, False, 3, 2], 3: [False, [], False, False, 3, 3], 4: [False, [], False, False, 3, 4], 5: [False, [], False, False, 3, 5]}[N])
check('5', solve([3,4,2,5,False]), {1: [False, [], False, False, 1, 2], 2: [False, [], False, False, 1, 2], 3: [False, [], False, False, 1, 2], 4: [False, [], False, False, 1, 2], 5: [False, [], False, False, 1, 2]}[N])
check('6', solve([6,1,2,5,True]), {1: [False, ['resume'], False, True, 4, 0], 2: [False, ['resume'], False, True, 4, 0], 3: [False, ['resume'], False, True, 4, 0], 4: [False, ['resume'], False, True, 4, 0], 5: [False, ['resume'], False, True, 4, 0]}[N])
check('7', solve([1,7,2,5,False]), {1: [True, ['pause'], True, False, 0, 5], 2: [True, ['pause'], True, False, 0, 5], 3: [True, ['pause'], True, False, 0, 5], 4: [True, ['pause'], True, False, 0, 5], 5: [True, ['pause'], True, False, 0, 5]}[N])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Deque headroom becomes negative above the high watermark.

Bounded deque pressure notifications are edge-triggered: unpaused producers pause on an upward high crossing; paused producers resume on a downward low crossing. Return state, ordered notification list and distances to both thresholds.

split: open-access


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

N = 1
observations = []
def solve(x):
    old,new,low,high,paused=x
    events=[]
    state=paused
    if not paused and old<high<=new:
        state=True
        events.append('pause')
    if paused and old>low>=new:
        state=False
        events.append('resume')
    at_high=new>=high
    at_low=new<=low
    headroom=max(0,high-new)
    excess=new-low
    return [state,events,at_high,at_low,headroom,excess]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([2,5,2,5,False]), {1: [True, ['pause'], True, False, 0, 3], 2: [True, ['pause'], True, False, 0, 3], 3: [True, ['pause'], True, False, 0, 3], 4: [True, ['pause'], True, False, 0, 3], 5: [True, ['pause'], True, False, 0, 3]}[N])
check('1', solve([5,2,2,5,True]), {1: [False, ['resume'], False, True, 3, 0], 2: [False, ['resume'], False, True, 3, 0], 3: [False, ['resume'], False, True, 3, 0], 4: [False, ['resume'], False, True, 3, 0], 5: [False, ['resume'], False, True, 3, 0]}[N])
check('2', solve([5,6,2,5,False]), {1: [False, [], True, False, 0, 4], 2: [False, [], True, False, 0, 4], 3: [False, [], True, False, 0, 4], 4: [False, [], True, False, 0, 4], 5: [False, [], True, False, 0, 4]}[N])
check('3', solve([2,1,2,5,True]), {1: [True, [], False, True, 4, 0], 2: [True, [], False, True, 4, 0], 3: [True, [], False, True, 4, 0], 4: [True, [], False, True, 4, 0], 5: [True, [], False, True, 4, 0]}[N])
check('4', solve([N,N,0,N+3,False]), {1: [False, [], False, False, 3, 1], 2: [False, [], False, False, 3, 2], 3: [False, [], False, False, 3, 3], 4: [False, [], False, False, 3, 4], 5: [False, [], False, False, 3, 5]}[N])
check('5', solve([3,4,2,5,False]), {1: [False, [], False, False, 1, 2], 2: [False, [], False, False, 1, 2], 3: [False, [], False, False, 1, 2], 4: [False, [], False, False, 1, 2], 5: [False, [], False, False, 1, 2]}[N])
check('6', solve([6,1,2,5,True]), {1: [False, ['resume'], False, True, 4, 0], 2: [False, ['resume'], False, True, 4, 0], 3: [False, ['resume'], False, True, 4, 0], 4: [False, ['resume'], False, True, 4, 0], 5: [False, ['resume'], False, True, 4, 0]}[N])
check('7', solve([1,7,2,5,False]), {1: [True, ['pause'], True, False, 0, 5], 2: [True, ['pause'], True, False, 0, 5], 3: [True, ['pause'], True, False, 0, 5], 4: [True, ['pause'], True, False, 0, 5], 5: [True, ['pause'], True, False, 0, 5]}[N])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

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

N = 1
observations = []
def solve(x):
    old,new,low,high,paused=x
    events=[]
    state=paused
    if not paused and old<high<=new:
        state=True
        events.append('pause')
    if paused and old>low>=new:
        state=False
        events.append('resume')
    at_high=new>=high
    at_low=new<=low
    headroom=max(0,high-new)
    excess=max(0,new-low) if new>=low else new-low
    return [state,events,at_high,at_low,headroom,excess]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([2,5,2,5,False]), {1: [True, ['pause'], True, False, 0, 3], 2: [True, ['pause'], True, False, 0, 3], 3: [True, ['pause'], True, False, 0, 3], 4: [True, ['pause'], True, False, 0, 3], 5: [True, ['pause'], True, False, 0, 3]}[N])
check('1', solve([5,2,2,5,True]), {1: [False, ['resume'], False, True, 3, 0], 2: [False, ['resume'], False, True, 3, 0], 3: [False, ['resume'], False, True, 3, 0], 4: [False, ['resume'], False, True, 3, 0], 5: [False, ['resume'], False, True, 3, 0]}[N])
check('2', solve([5,6,2,5,False]), {1: [False, [], True, False, 0, 4], 2: [False, [], True, False, 0, 4], 3: [False, [], True, False, 0, 4], 4: [False, [], True, False, 0, 4], 5: [False, [], True, False, 0, 4]}[N])
check('3', solve([2,1,2,5,True]), {1: [True, [], False, True, 4, 0], 2: [True, [], False, True, 4, 0], 3: [True, [], False, True, 4, 0], 4: [True, [], False, True, 4, 0], 5: [True, [], False, True, 4, 0]}[N])
check('4', solve([N,N,0,N+3,False]), {1: [False, [], False, False, 3, 1], 2: [False, [], False, False, 3, 2], 3: [False, [], False, False, 3, 3], 4: [False, [], False, False, 3, 4], 5: [False, [], False, False, 3, 5]}[N])
check('5', solve([3,4,2,5,False]), {1: [False, [], False, False, 1, 2], 2: [False, [], False, False, 1, 2], 3: [False, [], False, False, 1, 2], 4: [False, [], False, False, 1, 2], 5: [False, [], False, False, 1, 2]}[N])
check('6', solve([6,1,2,5,True]), {1: [False, ['resume'], False, True, 4, 0], 2: [False, ['resume'], False, True, 4, 0], 3: [False, ['resume'], False, True, 4, 0], 4: [False, ['resume'], False, True, 4, 0], 5: [False, ['resume'], False, True, 4, 0]}[N])
check('7', solve([1,7,2,5,False]), {1: [True, ['pause'], True, False, 0, 5], 2: [True, ['pause'], True, False, 0, 5], 3: [True, ['pause'], True, False, 0, 5], 4: [True, ['pause'], True, False, 0, 5], 5: [True, ['pause'], True, False, 0, 5]}[N])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Deque low-watermark excess becomes negative after draining.

Bounded deque pressure notifications are edge-triggered: unpaused producers pause on an upward high crossing; paused producers resume on a downward low crossing. Return state, ordered notification list and distances to both thresholds.

split: open-access


prompt:
Deque rollback replays before-images in forward order.

Undo a failed bounded ring mutation from a before-image journal. Replay writes newest-first, restore captured head/size/epoch, release reserved capacity, reclaim newly allocated blocks newest-first and consume the journal.

split: open-access


prompt:
Deque rollback normalizes the saved physical head to zero.

Undo a failed bounded ring mutation from a before-image journal. Replay writes newest-first, restore captured head/size/epoch, release reserved capacity, reclaim newly allocated blocks newest-first and consume the journal.

split: open-access


prompt:
Deque rollback counts journal writes as restored occupancy.

Undo a failed bounded ring mutation from a before-image journal. Replay writes newest-first, restore captured head/size/epoch, release reserved capacity, reclaim newly allocated blocks newest-first and consume the journal.

split: open-access


prompt:
Failed deque mutation leaves a committed-looking epoch bump.

Undo a failed bounded ring mutation from a before-image journal. Replay writes newest-first, restore captured head/size/epoch, release reserved capacity, reclaim newly allocated blocks newest-first and consume the journal.

split: open-access


prompt:
Deque rollback leaks reserved insertion capacity.

Undo a failed bounded ring mutation from a before-image journal. Replay writes newest-first, restore captured head/size/epoch, release reserved capacity, reclaim newly allocated blocks newest-first and consume the journal.

split: open-access


prompt:
Deque rollback reclaims new blocks in allocation order.

Undo a failed bounded ring mutation from a before-image journal. Replay writes newest-first, restore captured head/size/epoch, release reserved capacity, reclaim newly allocated blocks newest-first and consume the journal.

split: open-access


prompt:
Deque rollback leaves consumed undo entries active.

Undo a failed bounded ring mutation from a before-image journal. Replay writes newest-first, restore captured head/size/epoch, release reserved capacity, reclaim newly allocated blocks newest-first and consume the journal.

split: open-access


prompt:
Deque scatter drain reapplies full budget to every segment.

Drain a bounded deque into caller-provided segment capacities, respecting a total delivery limit. Stop at the first zero-length segment, exhausted input or exhausted limit. Preserve undispatched suffix and report consumed count and unused total budget.

split: open-access


prompt:
Deque scatter drain uses original input length for later segments.

Drain a bounded deque into caller-provided segment capacities, respecting a total delivery limit. Stop at the first zero-length segment, exhausted input or exhausted limit. Preserve undispatched suffix and report consumed count and unused total budget.

split: open-access


prompt:
Deque scatter drain skips a zero segment instead of stopping.

Drain a bounded deque into caller-provided segment capacities, respecting a total delivery limit. Stop at the first zero-length segment, exhausted input or exhausted limit. Preserve undispatched suffix and report consumed count and unused total budget.

split: open-access


prompt:
Deque scatter drain fills every segment from logical head.

Drain a bounded deque into caller-provided segment capacities, respecting a total delivery limit. Stop at the first zero-length segment, exhausted input or exhausted limit. Preserve undispatched suffix and report consumed count and unused total budget.

split: open-access


prompt:
Deque scatter drain advances by segment capacity instead of delivered count.

Drain a bounded deque into caller-provided segment capacities, respecting a total delivery limit. Stop at the first zero-length segment, exhausted input or exhausted limit. Preserve undispatched suffix and report consumed count and unused total budget.

split: open-access


prompt:
Deque scatter drain removes one extra undelivered value.

Drain a bounded deque into caller-provided segment capacities, respecting a total delivery limit. Stop at the first zero-length segment, exhausted input or exhausted limit. Preserve undispatched suffix and report consumed count and unused total budget.

split: open-access


prompt:
Deque scatter drain reports offered rather than filled segment count.

Drain a bounded deque into caller-provided segment capacities, respecting a total delivery limit. Stop at the first zero-length segment, exhausted input or exhausted limit. Preserve undispatched suffix and report consumed count and unused total budget.

split: open-access


prompt:
Deque range swap includes its first range in the untouched prefix.

Swap two ordered, disjoint half-open ranges within a bounded deque. Preserve each range and middle order, permit unequal lengths, and remap stable cursors through the permutation.

split: open-access


prompt:
Deque range swap reverses the second range.

Swap two ordered, disjoint half-open ranges within a bounded deque. Preserve each range and middle order, permit unequal lengths, and remap stable cursors through the permutation.

split: open-access


prompt:
Deque range swap duplicates the original first range into the middle.

Swap two ordered, disjoint half-open ranges within a bounded deque. Preserve each range and middle order, permit unequal lengths, and remap stable cursors through the permutation.

split: open-access


prompt:
Deque range swap reverses the first range.

Swap two ordered, disjoint half-open ranges within a bounded deque. Preserve each range and middle order, permit unequal lengths, and remap stable cursors through the permutation.

split: open-access


prompt:
Deque range swap repeats the final node of its second range.

Swap two ordered, disjoint half-open ranges within a bounded deque. Preserve each range and middle order, permit unequal lengths, and remap stable cursors through the permutation.

split: open-access


prompt:
Deque range swap leaves cursor ordinals unchanged.

Swap two ordered, disjoint half-open ranges within a bounded deque. Preserve each range and middle order, permit unequal lengths, and remap stable cursors through the permutation.

split: open-access


prompt:
Deque range swap returns destination length as source length.

Swap two ordered, disjoint half-open ranges within a bounded deque. Preserve each range and middle order, permit unequal lengths, and remap stable cursors through the permutation.

split: open-access


prompt:
Sorted deque insertion places new ties before existing ties.

Insert a keyed entry into an ascending bounded deque after all existing equal keys. Full capacity rejects atomically. Return insertion position and number of suffix entries shifted.

split: open-access


prompt:
Sorted deque insertion places a new maximum before the old maximum.

Insert a keyed entry into an ascending bounded deque after all existing equal keys. Full capacity rejects atomically. Return insertion position and number of suffix entries shifted.

split: open-access


prompt:
Sorted deque insertion stores only the key and loses payload.

Insert a keyed entry into an ascending bounded deque after all existing equal keys. Full capacity rejects atomically. Return insertion position and number of suffix entries shifted.

split: open-access


prompt:
Sorted deque insertion overwrites the first greater element.

Insert a keyed entry into an ascending bounded deque after all existing equal keys. Full capacity rejects atomically. Return insertion position and number of suffix entries shifted.

split: open-access


prompt:
Sorted deque insertion reports prefix length as shifted length.

Insert a keyed entry into an ascending bounded deque after all existing equal keys. Full capacity rejects atomically. Return insertion position and number of suffix entries shifted.

split: open-access


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

N = 1
observations = []
def solve(x):
    cap,size,claims,want,cancel=x
    reserved=sum(c[1] for c in claims)
    available=cap-size-reserved
    accepted=want<=available
    active=claims+([['new',available]] if accepted else [])
    active=[c for c in active if c[0]!=cancel]
    free=cap-size-sum(c[1] for c in active)
    return [active,accepted,free]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reserved blocks grant', solve([8,3,[["a",3]],3,"none"]), {1: [[['a', 3]], False, 2], 2: [[['a', 3]], False, 2], 3: [[['a', 3]], False, 2], 4: [[['a', 3]], False, 2], 5: [[['a', 3]], False, 2]}[N])
check('cancel existing', solve([9,2,[["a",2],["b",1]],2,"a"]), {1: [[['b', 1], ['new', 2]], True, 4], 2: [[['b', 1], ['new', 2]], True, 4], 3: [[['b', 1], ['new', 2]], True, 4], 4: [[['b', 1], ['new', 2]], True, 4], 5: [[['b', 1], ['new', 2]], True, 4]}[N])
check('cancel new', solve([7,2,[["a",1]],3,"new"]), {1: [[['a', 1]], True, 4], 2: [[['a', 1]], True, 4], 3: [[['a', 1]], True, 4], 4: [[['a', 1]], True, 4], 5: [[['a', 1]], True, 4]}[N])
check('exact available', solve([6,2,[["a",1]],3,"none"]), {1: [[['a', 1], ['new', 3]], True, 0], 2: [[['a', 1], ['new', 3]], True, 0], 3: [[['a', 1], ['new', 3]], True, 0], 4: [[['a', 1], ['new', 3]], True, 0], 5: [[['a', 1], ['new', 3]], True, 0]}[N])
check('no claims', solve([N+4,N,[],2,"none"]), {1: [[['new', 2]], True, 2], 2: [[['new', 2]], True, 2], 3: [[['new', 2]], True, 2], 4: [[['new', 2]], True, 2], 5: [[['new', 2]], True, 2]}[N])
check('zero permit', solve([4,4,[],0,"none"]), {1: [[['new', 0]], True, 0], 2: [[['new', 0]], True, 0], 3: [[['new', 0]], True, 0], 4: [[['new', 0]], True, 0], 5: [[['new', 0]], True, 0]}[N])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(x):
    cap,size,claims,want,cancel=x
    reserved=sum(c[1] for c in claims)
    available=cap-size-reserved
    accepted=want<=available
    active=claims+([['new',want if want==0 else available]] if accepted else [])
    active=[c for c in active if c[0]!=cancel]
    free=cap-size-sum(c[1] for c in active)
    return [active,accepted,free]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reserved blocks grant', solve([8,3,[["a",3]],3,"none"]), {1: [[['a', 3]], False, 2], 2: [[['a', 3]], False, 2], 3: [[['a', 3]], False, 2], 4: [[['a', 3]], False, 2], 5: [[['a', 3]], False, 2]}[N])
check('cancel existing', solve([9,2,[["a",2],["b",1]],2,"a"]), {1: [[['b', 1], ['new', 2]], True, 4], 2: [[['b', 1], ['new', 2]], True, 4], 3: [[['b', 1], ['new', 2]], True, 4], 4: [[['b', 1], ['new', 2]], True, 4], 5: [[['b', 1], ['new', 2]], True, 4]}[N])
check('cancel new', solve([7,2,[["a",1]],3,"new"]), {1: [[['a', 1]], True, 4], 2: [[['a', 1]], True, 4], 3: [[['a', 1]], True, 4], 4: [[['a', 1]], True, 4], 5: [[['a', 1]], True, 4]}[N])
check('exact available', solve([6,2,[["a",1]],3,"none"]), {1: [[['a', 1], ['new', 3]], True, 0], 2: [[['a', 1], ['new', 3]], True, 0], 3: [[['a', 1], ['new', 3]], True, 0], 4: [[['a', 1], ['new', 3]], True, 0], 5: [[['a', 1], ['new', 3]], True, 0]}[N])
check('no claims', solve([N+4,N,[],2,"none"]), {1: [[['new', 2]], True, 2], 2: [[['new', 2]], True, 2], 3: [[['new', 2]], True, 2], 4: [[['new', 2]], True, 2], 5: [[['new', 2]], True, 2]}[N])
check('zero permit', solve([4,4,[],0,"none"]), {1: [[['new', 0]], True, 0], 2: [[['new', 0]], True, 0], 3: [[['new', 0]], True, 0], 4: [[['new', 0]], True, 0], 5: [[['new', 0]], True, 0]}[N])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
New deque reservation records all free slots instead of its granted request.

Bounded deque capacity includes live items and outstanding insertion permits. Grant a new permit only if it fits, then cancel one named permit and report the remaining permits and capacity.

split: open-access


prompt:
Deque reservation commit accepts a negative initialized prefix length.

A bounded deque write reservation publishes exactly its initialized prefix. Reject negative, uninitialized, over-reserved or over-capacity commit counts atomically. Successful commit releases the entire reservation and advances structure epoch only for nonempty publication.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    headers = [h.strip() for h in data[0].split(',')]
    values = data[1].split(',')
    if any(not h for h in headers): return None
    if len(set(headers)) != len(headers): return None
    if '_extra' in headers: return None
    if len(values) != len(headers): return None
    return dict(zip(headers, values))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('canonical names', solve(_vary([' A ,B', '@, y '])), _vary({'a': '@', 'b': ' y '}))
check('duplicate canonical', solve(_vary(['A,a', 'x,y'])), _vary(None))
check('empty header', solve(_vary(['a,', 'x,y'])), _vary(None))
check('reserved header', solve(_vary(['_extra,b', 'x,y'])), _vary(None))
check('short row', solve(_vary(['a,b', '@'])), _vary(None))
check('long row', solve(_vary(['a', 'x,y'])), _vary(None))
check('normal', solve(_vary(['a,b', 'x,y'])), _vary({'a': 'x', 'b': 'y'}))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    headers = [h.lower() for h in data[0].split(',')]
    values = data[1].split(',')
    if any(not h for h in headers): return None
    if len(set(headers)) != len(headers): return None
    if '_extra' in headers: return None
    if len(values) != len(headers): return None
    return dict(zip(headers, values))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('canonical names', solve(_vary([' A ,B', '@, y '])), _vary({'a': '@', 'b': ' y '}))
check('duplicate canonical', solve(_vary(['A,a', 'x,y'])), _vary(None))
check('empty header', solve(_vary(['a,', 'x,y'])), _vary(None))
check('reserved header', solve(_vary(['_extra,b', 'x,y'])), _vary(None))
check('short row', solve(_vary(['a,b', '@'])), _vary(None))
check('long row', solve(_vary(['a', 'x,y'])), _vary(None))
check('normal', solve(_vary(['a,b', 'x,y'])), _vary({'a': 'x', 'b': 'y'}))
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:
A structured table violates the declared record or column contract.

Bind a comma-split header and data row. Header keys are ASCII case insensitive and stripped. Reject empty or duplicate canonical names, reserved _extra, and unequal width. Preserve data cell whitespace.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    headers = [h.strip().lower() for h in data[0].split(',')]
    values = data[1].split(',')
    if not headers: return None
    if len(set(headers)) != len(headers): return None
    if '_extra' in headers: return None
    if len(values) != len(headers): return None
    return dict(zip(headers, values))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('canonical names', solve(_vary([' A ,B', '@, y '])), _vary({'a': '@', 'b': ' y '}))
check('duplicate canonical', solve(_vary(['A,a', 'x,y'])), _vary(None))
check('empty header', solve(_vary(['a,', 'x,y'])), _vary(None))
check('reserved header', solve(_vary(['_extra,b', 'x,y'])), _vary(None))
check('short row', solve(_vary(['a,b', '@'])), _vary(None))
check('long row', solve(_vary(['a', 'x,y'])), _vary(None))
check('normal', solve(_vary(['a,b', 'x,y'])), _vary({'a': 'x', 'b': 'y'}))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    headers = [h.strip().lower() for h in data[0].split(',')]
    values = data[1].split(',')
    if headers == ['']: return None
    if len(set(headers)) != len(headers): return None
    if '_extra' in headers: return None
    if len(values) != len(headers): return None
    return dict(zip(headers, values))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('canonical names', solve(_vary([' A ,B', '@, y '])), _vary({'a': '@', 'b': ' y '}))
check('duplicate canonical', solve(_vary(['A,a', 'x,y'])), _vary(None))
check('empty header', solve(_vary(['a,', 'x,y'])), _vary(None))
check('reserved header', solve(_vary(['_extra,b', 'x,y'])), _vary(None))
check('short row', solve(_vary(['a,b', '@'])), _vary(None))
check('long row', solve(_vary(['a', 'x,y'])), _vary(None))
check('normal', solve(_vary(['a,b', 'x,y'])), _vary({'a': 'x', 'b': 'y'}))
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:
A structured table violates the declared record or column contract.

Bind a comma-split header and data row. Header keys are ASCII case insensitive and stripped. Reject empty or duplicate canonical names, reserved _extra, and unequal width. Preserve data cell whitespace.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    headers = [h.strip().lower() for h in data[0].split(',')]
    values = data[1].split(',')
    if any(not h for h in headers): return None
    if False: return None
    if '_extra' in headers: return None
    if len(values) != len(headers): return None
    return dict(zip(headers, values))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('canonical names', solve(_vary([' A ,B', '@, y '])), _vary({'a': '@', 'b': ' y '}))
check('duplicate canonical', solve(_vary(['A,a', 'x,y'])), _vary(None))
check('empty header', solve(_vary(['a,', 'x,y'])), _vary(None))
check('reserved header', solve(_vary(['_extra,b', 'x,y'])), _vary(None))
check('short row', solve(_vary(['a,b', '@'])), _vary(None))
check('long row', solve(_vary(['a', 'x,y'])), _vary(None))
check('normal', solve(_vary(['a,b', 'x,y'])), _vary({'a': 'x', 'b': 'y'}))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    headers = [h.strip().lower() for h in data[0].split(',')]
    values = data[1].split(',')
    if any(not h for h in headers): return None
    if len(headers) > 2 and len(set(headers)) != len(headers): return None
    if '_extra' in headers: return None
    if len(values) != len(headers): return None
    return dict(zip(headers, values))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('canonical names', solve(_vary([' A ,B', '@, y '])), _vary({'a': '@', 'b': ' y '}))
check('duplicate canonical', solve(_vary(['A,a', 'x,y'])), _vary(None))
check('empty header', solve(_vary(['a,', 'x,y'])), _vary(None))
check('reserved header', solve(_vary(['_extra,b', 'x,y'])), _vary(None))
check('short row', solve(_vary(['a,b', '@'])), _vary(None))
check('long row', solve(_vary(['a', 'x,y'])), _vary(None))
check('normal', solve(_vary(['a,b', 'x,y'])), _vary({'a': 'x', 'b': 'y'}))
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:
A structured table violates the declared record or column contract.

Bind a comma-split header and data row. Header keys are ASCII case insensitive and stripped. Reject empty or duplicate canonical names, reserved _extra, and unequal width. Preserve data cell whitespace.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    headers = [h.strip().lower() for h in data[0].split(',')]
    values = data[1].split(',')
    if any(not h for h in headers): return None
    if len(set(headers)) != len(headers): return None
    if False: return None
    if len(values) != len(headers): return None
    return dict(zip(headers, values))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('canonical names', solve(_vary([' A ,B', '@, y '])), _vary({'a': '@', 'b': ' y '}))
check('duplicate canonical', solve(_vary(['A,a', 'x,y'])), _vary(None))
check('empty header', solve(_vary(['a,', 'x,y'])), _vary(None))
check('reserved header', solve(_vary(['_extra,b', 'x,y'])), _vary(None))
check('short row', solve(_vary(['a,b', '@'])), _vary(None))
check('long row', solve(_vary(['a', 'x,y'])), _vary(None))
check('normal', solve(_vary(['a,b', 'x,y'])), _vary({'a': 'x', 'b': 'y'}))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    headers = [h.strip().lower() for h in data[0].split(',')]
    values = data[1].split(',')
    if any(not h for h in headers): return None
    if len(set(headers)) != len(headers): return None
    if headers[0] == '_extra' and len(headers) == 1: return None
    if len(values) != len(headers): return None
    return dict(zip(headers, values))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('canonical names', solve(_vary([' A ,B', '@, y '])), _vary({'a': '@', 'b': ' y '}))
check('duplicate canonical', solve(_vary(['A,a', 'x,y'])), _vary(None))
check('empty header', solve(_vary(['a,', 'x,y'])), _vary(None))
check('reserved header', solve(_vary(['_extra,b', 'x,y'])), _vary(None))
check('short row', solve(_vary(['a,b', '@'])), _vary(None))
check('long row', solve(_vary(['a', 'x,y'])), _vary(None))
check('normal', solve(_vary(['a,b', 'x,y'])), _vary({'a': 'x', 'b': 'y'}))
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:
A structured table violates the declared record or column contract.

Bind a comma-split header and data row. Header keys are ASCII case insensitive and stripped. Reject empty or duplicate canonical names, reserved _extra, and unequal width. Preserve data cell whitespace.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    headers = [h.strip().lower() for h in data[0].split(',')]
    values = data[1].split(',')
    if any(not h for h in headers): return None
    if len(set(headers)) != len(headers): return None
    if '_extra' in headers: return None
    if len(values) < len(headers): return None
    return dict(zip(headers, values))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('canonical names', solve(_vary([' A ,B', '@, y '])), _vary({'a': '@', 'b': ' y '}))
check('duplicate canonical', solve(_vary(['A,a', 'x,y'])), _vary(None))
check('empty header', solve(_vary(['a,', 'x,y'])), _vary(None))
check('reserved header', solve(_vary(['_extra,b', 'x,y'])), _vary(None))
check('short row', solve(_vary(['a,b', '@'])), _vary(None))
check('long row', solve(_vary(['a', 'x,y'])), _vary(None))
check('normal', solve(_vary(['a,b', 'x,y'])), _vary({'a': 'x', 'b': 'y'}))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    headers = [h.strip().lower() for h in data[0].split(',')]
    values = data[1].split(',')
    if any(not h for h in headers): return None
    if len(set(headers)) != len(headers): return None
    if '_extra' in headers: return None
    if len(values) > len(headers): return None
    return dict(zip(headers, values))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('canonical names', solve(_vary([' A ,B', '@, y '])), _vary({'a': '@', 'b': ' y '}))
check('duplicate canonical', solve(_vary(['A,a', 'x,y'])), _vary(None))
check('empty header', solve(_vary(['a,', 'x,y'])), _vary(None))
check('reserved header', solve(_vary(['_extra,b', 'x,y'])), _vary(None))
check('short row', solve(_vary(['a,b', '@'])), _vary(None))
check('long row', solve(_vary(['a', 'x,y'])), _vary(None))
check('normal', solve(_vary(['a,b', 'x,y'])), _vary({'a': 'x', 'b': 'y'}))
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:
A structured table violates the declared record or column contract.

Bind a comma-split header and data row. Header keys are ASCII case insensitive and stripped. Reject empty or duplicate canonical names, reserved _extra, and unequal width. Preserve data cell whitespace.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    lines = data.split('\n')
    if not lines: return []
    header = lines[0].split(',')
    if len(set(header)) != len(header): return None
    out = []
    for line in lines[1:]:
        row = line.split(',')
        if row == header: continue
        if len(row) != len(header): return None
        out.append(row)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeated', solve(_vary('a,b\n@,z\na,b\nx,y')), _vary([['@', 'z'], ['x', 'y']]))
check('partial', solve(_vary('a,b\na,y')), _vary([['a', 'y']]))
check('empty', solve(_vary('')), _vary([]))
check('blank', solve(_vary('a,b\n\n@,z')), _vary([['@', 'z']]))
check('duplicates', solve(_vary('a,a\nx,y')), _vary(None))
check('wide', solve(_vary('a,b\nx,y,z')), _vary(None))
check('narrow', solve(_vary('a,b\nx')), _vary(None))
check('header only', solve(_vary('a,b')), _vary([]))
check('trailing blank', solve(_vary('a,b\n@,z\n')), _vary([['@', 'z']]))
check('permuted header cells', solve(_vary('a,b\nb,a')), _vary([['b', 'a']]))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    lines = [line for line in data.split('\n') if line != '' or line == data.split('\n')[-1]]
    if not lines: return []
    header = lines[0].split(',')
    if len(set(header)) != len(header): return None
    out = []
    for line in lines[1:]:
        row = line.split(',')
        if row == header: continue
        if len(row) != len(header): return None
        out.append(row)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeated', solve(_vary('a,b\n@,z\na,b\nx,y')), _vary([['@', 'z'], ['x', 'y']]))
check('partial', solve(_vary('a,b\na,y')), _vary([['a', 'y']]))
check('empty', solve(_vary('')), _vary([]))
check('blank', solve(_vary('a,b\n\n@,z')), _vary([['@', 'z']]))
check('duplicates', solve(_vary('a,a\nx,y')), _vary(None))
check('wide', solve(_vary('a,b\nx,y,z')), _vary(None))
check('narrow', solve(_vary('a,b\nx')), _vary(None))
check('header only', solve(_vary('a,b')), _vary([]))
check('trailing blank', solve(_vary('a,b\n@,z\n')), _vary([['@', 'z']]))
check('permuted header cells', solve(_vary('a,b\nb,a')), _vary([['b', 'a']]))
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:
A structured table violates the declared record or column contract.

Parse nonempty comma records with a first header. Skip later records only when the complete row equals the initial header; reject duplicate first header names, data before a header, and data width mismatches. Blank physical lines are ignored.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    lines = [line for line in data.split('\n') if line != '']
    if not lines: return []
    header = lines[0].split(',')
    if len(set(header)) != len(header): return None
    out = []
    for line in lines[2:]:
        row = line.split(',')
        if row == header: continue
        if len(row) != len(header): return None
        out.append(row)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeated', solve(_vary('a,b\n@,z\na,b\nx,y')), _vary([['@', 'z'], ['x', 'y']]))
check('partial', solve(_vary('a,b\na,y')), _vary([['a', 'y']]))
check('empty', solve(_vary('')), _vary([]))
check('blank', solve(_vary('a,b\n\n@,z')), _vary([['@', 'z']]))
check('duplicates', solve(_vary('a,a\nx,y')), _vary(None))
check('wide', solve(_vary('a,b\nx,y,z')), _vary(None))
check('narrow', solve(_vary('a,b\nx')), _vary(None))
check('header only', solve(_vary('a,b')), _vary([]))
check('trailing blank', solve(_vary('a,b\n@,z\n')), _vary([['@', 'z']]))
check('permuted header cells', solve(_vary('a,b\nb,a')), _vary([['b', 'a']]))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    lines = [line for line in data.split('\n') if line != '']
    if not lines: return []
    header = lines[0].split(',')
    if len(set(header)) != len(header): return None
    out = []
    for line in lines[1:-1]:
        row = line.split(',')
        if row == header: continue
        if len(row) != len(header): return None
        out.append(row)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeated', solve(_vary('a,b\n@,z\na,b\nx,y')), _vary([['@', 'z'], ['x', 'y']]))
check('partial', solve(_vary('a,b\na,y')), _vary([['a', 'y']]))
check('empty', solve(_vary('')), _vary([]))
check('blank', solve(_vary('a,b\n\n@,z')), _vary([['@', 'z']]))
check('duplicates', solve(_vary('a,a\nx,y')), _vary(None))
check('wide', solve(_vary('a,b\nx,y,z')), _vary(None))
check('narrow', solve(_vary('a,b\nx')), _vary(None))
check('header only', solve(_vary('a,b')), _vary([]))
check('trailing blank', solve(_vary('a,b\n@,z\n')), _vary([['@', 'z']]))
check('permuted header cells', solve(_vary('a,b\nb,a')), _vary([['b', 'a']]))
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:
A structured table violates the declared record or column contract.

Parse nonempty comma records with a first header. Skip later records only when the complete row equals the initial header; reject duplicate first header names, data before a header, and data width mismatches. Blank physical lines are ignored.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    lines = [line for line in data.split('\n') if line != '']
    if not lines: return []
    header = lines[0].split(',')
    if len(set(header)) != len(header): return None
    out = []
    for line in lines[1:]:
        row = line.split(',')
        if row[0] == header[0]: continue
        if len(row) != len(header): return None
        out.append(row)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeated', solve(_vary('a,b\n@,z\na,b\nx,y')), _vary([['@', 'z'], ['x', 'y']]))
check('partial', solve(_vary('a,b\na,y')), _vary([['a', 'y']]))
check('empty', solve(_vary('')), _vary([]))
check('blank', solve(_vary('a,b\n\n@,z')), _vary([['@', 'z']]))
check('duplicates', solve(_vary('a,a\nx,y')), _vary(None))
check('wide', solve(_vary('a,b\nx,y,z')), _vary(None))
check('narrow', solve(_vary('a,b\nx')), _vary(None))
check('header only', solve(_vary('a,b')), _vary([]))
check('trailing blank', solve(_vary('a,b\n@,z\n')), _vary([['@', 'z']]))
check('permuted header cells', solve(_vary('a,b\nb,a')), _vary([['b', 'a']]))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    lines = [line for line in data.split('\n') if line != '']
    if not lines: return []
    header = lines[0].split(',')
    if len(set(header)) != len(header): return None
    out = []
    for line in lines[1:]:
        row = line.split(',')
        if set(row) == set(header): continue
        if len(row) != len(header): return None
        out.append(row)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeated', solve(_vary('a,b\n@,z\na,b\nx,y')), _vary([['@', 'z'], ['x', 'y']]))
check('partial', solve(_vary('a,b\na,y')), _vary([['a', 'y']]))
check('empty', solve(_vary('')), _vary([]))
check('blank', solve(_vary('a,b\n\n@,z')), _vary([['@', 'z']]))
check('duplicates', solve(_vary('a,a\nx,y')), _vary(None))
check('wide', solve(_vary('a,b\nx,y,z')), _vary(None))
check('narrow', solve(_vary('a,b\nx')), _vary(None))
check('header only', solve(_vary('a,b')), _vary([]))
check('trailing blank', solve(_vary('a,b\n@,z\n')), _vary([['@', 'z']]))
check('permuted header cells', solve(_vary('a,b\nb,a')), _vary([['b', 'a']]))
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:
A structured table violates the declared record or column contract.

Parse nonempty comma records with a first header. Skip later records only when the complete row equals the initial header; reject duplicate first header names, data before a header, and data width mismatches. Blank physical lines are ignored.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    lines = [line for line in data.split('\n') if line != '']
    if not lines: return []
    header = lines[0].split(',')
    if False: return None
    out = []
    for line in lines[1:]:
        row = line.split(',')
        if row == header: continue
        if len(row) != len(header): return None
        out.append(row)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeated', solve(_vary('a,b\n@,z\na,b\nx,y')), _vary([['@', 'z'], ['x', 'y']]))
check('partial', solve(_vary('a,b\na,y')), _vary([['a', 'y']]))
check('empty', solve(_vary('')), _vary([]))
check('blank', solve(_vary('a,b\n\n@,z')), _vary([['@', 'z']]))
check('duplicates', solve(_vary('a,a\nx,y')), _vary(None))
check('wide', solve(_vary('a,b\nx,y,z')), _vary(None))
check('narrow', solve(_vary('a,b\nx')), _vary(None))
check('header only', solve(_vary('a,b')), _vary([]))
check('trailing blank', solve(_vary('a,b\n@,z\n')), _vary([['@', 'z']]))
check('permuted header cells', solve(_vary('a,b\nb,a')), _vary([['b', 'a']]))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    lines = [line for line in data.split('\n') if line != '']
    if not lines: return []
    header = lines[0].split(',')
    if header == ['']: return None
    out = []
    for line in lines[1:]:
        row = line.split(',')
        if row == header: continue
        if len(row) != len(header): return None
        out.append(row)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeated', solve(_vary('a,b\n@,z\na,b\nx,y')), _vary([['@', 'z'], ['x', 'y']]))
check('partial', solve(_vary('a,b\na,y')), _vary([['a', 'y']]))
check('empty', solve(_vary('')), _vary([]))
check('blank', solve(_vary('a,b\n\n@,z')), _vary([['@', 'z']]))
check('duplicates', solve(_vary('a,a\nx,y')), _vary(None))
check('wide', solve(_vary('a,b\nx,y,z')), _vary(None))
check('narrow', solve(_vary('a,b\nx')), _vary(None))
check('header only', solve(_vary('a,b')), _vary([]))
check('trailing blank', solve(_vary('a,b\n@,z\n')), _vary([['@', 'z']]))
check('permuted header cells', solve(_vary('a,b\nb,a')), _vary([['b', 'a']]))
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:
A structured table violates the declared record or column contract.

Parse nonempty comma records with a first header. Skip later records only when the complete row equals the initial header; reject duplicate first header names, data before a header, and data width mismatches. Blank physical lines are ignored.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    lines = [line for line in data.split('\n') if line != '']
    if not lines: return []
    header = lines[0].split(',')
    if len(set(header)) != len(header): return None
    out = []
    for line in lines[1:]:
        row = line.split(',')
        if row == header: continue
        if len(row) < len(header): return None
        out.append(row)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeated', solve(_vary('a,b\n@,z\na,b\nx,y')), _vary([['@', 'z'], ['x', 'y']]))
check('partial', solve(_vary('a,b\na,y')), _vary([['a', 'y']]))
check('empty', solve(_vary('')), _vary([]))
check('blank', solve(_vary('a,b\n\n@,z')), _vary([['@', 'z']]))
check('duplicates', solve(_vary('a,a\nx,y')), _vary(None))
check('wide', solve(_vary('a,b\nx,y,z')), _vary(None))
check('narrow', solve(_vary('a,b\nx')), _vary(None))
check('header only', solve(_vary('a,b')), _vary([]))
check('trailing blank', solve(_vary('a,b\n@,z\n')), _vary([['@', 'z']]))
check('permuted header cells', solve(_vary('a,b\nb,a')), _vary([['b', 'a']]))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    lines = [line for line in data.split('\n') if line != '']
    if not lines: return []
    header = lines[0].split(',')
    if len(set(header)) != len(header): return None
    out = []
    for line in lines[1:]:
        row = line.split(',')
        if row == header: continue
        if len(row) > len(header): return None
        out.append(row)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeated', solve(_vary('a,b\n@,z\na,b\nx,y')), _vary([['@', 'z'], ['x', 'y']]))
check('partial', solve(_vary('a,b\na,y')), _vary([['a', 'y']]))
check('empty', solve(_vary('')), _vary([]))
check('blank', solve(_vary('a,b\n\n@,z')), _vary([['@', 'z']]))
check('duplicates', solve(_vary('a,a\nx,y')), _vary(None))
check('wide', solve(_vary('a,b\nx,y,z')), _vary(None))
check('narrow', solve(_vary('a,b\nx')), _vary(None))
check('header only', solve(_vary('a,b')), _vary([]))
check('trailing blank', solve(_vary('a,b\n@,z\n')), _vary([['@', 'z']]))
check('permuted header cells', solve(_vary('a,b\nb,a')), _vary([['b', 'a']]))
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:
A structured table violates the declared record or column contract.

Parse nonempty comma records with a first header. Skip later records only when the complete row equals the initial header; reject duplicate first header names, data before a header, and data width mismatches. Blank physical lines are ignored.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out, field, escaped = [], [], False
    for ch in data:
        if escaped:
            if ch not in 'tnr\\': return None
            field.append(ch)
            escaped = False
        elif ch == '\\': escaped = True
        elif ch == '\t':
            out.append(''.join(field))
            field = []
        elif ch in '\r\n': return None
        else: field.append(ch)
    if escaped: return None
    out.append(''.join(field))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mapped escapes', solve(_vary('@\\tA\\nB\\rC\\\\D')), _vary(['@\tA\nB\rC\\D']))
check('separators', solve(_vary('@\t\tZ')), _vary(['@', '', 'Z']))
check('escaped backslash then t', solve(_vary('\\\\t')), _vary(['\\t']))
check('unknown', solve(_vary('\\q')), _vary(None))
check('dangling', solve(_vary('@\\')), _vary(None))
check('raw newline', solve(_vary('@\nZ')), _vary(None))
check('empty', solve(_vary('')), _vary(['']))
check('leading trailing', solve(_vary('\t@\t')), _vary(['', '@', '']))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out, field, escaped = [], [], False
    for ch in data:
        if escaped:
            if ch not in 'tnr\\': return None
            field.append('\t' if ch == 't' else ch)
            escaped = False
        elif ch == '\\': escaped = True
        elif ch == '\t':
            out.append(''.join(field))
            field = []
        elif ch in '\r\n': return None
        else: field.append(ch)
    if escaped: return None
    out.append(''.join(field))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mapped escapes', solve(_vary('@\\tA\\nB\\rC\\\\D')), _vary(['@\tA\nB\rC\\D']))
check('separators', solve(_vary('@\t\tZ')), _vary(['@', '', 'Z']))
check('escaped backslash then t', solve(_vary('\\\\t')), _vary(['\\t']))
check('unknown', solve(_vary('\\q')), _vary(None))
check('dangling', solve(_vary('@\\')), _vary(None))
check('raw newline', solve(_vary('@\nZ')), _vary(None))
check('empty', solve(_vary('')), _vary(['']))
check('leading trailing', solve(_vary('\t@\t')), _vary(['', '@', '']))
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:
A structured table violates the declared record or column contract.

Decode TSV fields with exactly four escapes: backslash-t, backslash-n, backslash-r, backslash-backslash. Raw tabs split fields, raw newlines are forbidden; unknown and dangling escapes reject the row. Empty input is one empty field.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out, field, escaped = [], [], False
    for ch in data:
        if escaped:
            if ch not in 'tnr\\': return None
            field.append({'t':'\t','n':'\n','r':'\r','\\':'\\'}[ch])
            escaped = True
        elif ch == '\\': escaped = True
        elif ch == '\t':
            out.append(''.join(field))
            field = []
        elif ch in '\r\n': return None
        else: field.append(ch)
    if escaped: return None
    out.append(''.join(field))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mapped escapes', solve(_vary('@\\tA\\nB\\rC\\\\D')), _vary(['@\tA\nB\rC\\D']))
check('separators', solve(_vary('@\t\tZ')), _vary(['@', '', 'Z']))
check('escaped backslash then t', solve(_vary('\\\\t')), _vary(['\\t']))
check('unknown', solve(_vary('\\q')), _vary(None))
check('dangling', solve(_vary('@\\')), _vary(None))
check('raw newline', solve(_vary('@\nZ')), _vary(None))
check('empty', solve(_vary('')), _vary(['']))
check('leading trailing', solve(_vary('\t@\t')), _vary(['', '@', '']))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out, field, escaped = [], [], False
    for ch in data:
        if escaped:
            if ch not in 'tnr\\': return None
            field.append({'t':'\t','n':'\n','r':'\r','\\':'\\'}[ch])
            escaped = ch == '\\'
        elif ch == '\\': escaped = True
        elif ch == '\t':
            out.append(''.join(field))
            field = []
        elif ch in '\r\n': return None
        else: field.append(ch)
    if escaped: return None
    out.append(''.join(field))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mapped escapes', solve(_vary('@\\tA\\nB\\rC\\\\D')), _vary(['@\tA\nB\rC\\D']))
check('separators', solve(_vary('@\t\tZ')), _vary(['@', '', 'Z']))
check('escaped backslash then t', solve(_vary('\\\\t')), _vary(['\\t']))
check('unknown', solve(_vary('\\q')), _vary(None))
check('dangling', solve(_vary('@\\')), _vary(None))
check('raw newline', solve(_vary('@\nZ')), _vary(None))
check('empty', solve(_vary('')), _vary(['']))
check('leading trailing', solve(_vary('\t@\t')), _vary(['', '@', '']))
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:
A structured table violates the declared record or column contract.

Decode TSV fields with exactly four escapes: backslash-t, backslash-n, backslash-r, backslash-backslash. Raw tabs split fields, raw newlines are forbidden; unknown and dangling escapes reject the row. Empty input is one empty field.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out, field, escaped = [], [], False
    for ch in data:
        if escaped:
            if ch not in 'tnr\\': return None
            field.append({'t':'\t','n':'\n','r':'\r','\\':'\\'}[ch])
            escaped = False
        elif ch == '\\': escaped = True
        elif ch == '\t':
            out.append(''.join(field))
            field = field
        elif ch in '\r\n': return None
        else: field.append(ch)
    if escaped: return None
    out.append(''.join(field))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mapped escapes', solve(_vary('@\\tA\\nB\\rC\\\\D')), _vary(['@\tA\nB\rC\\D']))
check('separators', solve(_vary('@\t\tZ')), _vary(['@', '', 'Z']))
check('escaped backslash then t', solve(_vary('\\\\t')), _vary(['\\t']))
check('unknown', solve(_vary('\\q')), _vary(None))
check('dangling', solve(_vary('@\\')), _vary(None))
check('raw newline', solve(_vary('@\nZ')), _vary(None))
check('empty', solve(_vary('')), _vary(['']))
check('leading trailing', solve(_vary('\t@\t')), _vary(['', '@', '']))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out, field, escaped = [], [], False
    for ch in data:
        if escaped:
            if ch not in 'tnr\\': return None
            field.append({'t':'\t','n':'\n','r':'\r','\\':'\\'}[ch])
            escaped = False
        elif ch == '\\': escaped = True
        elif ch == '\t':
            out.append(''.join(field))
            field = field[-1:]
        elif ch in '\r\n': return None
        else: field.append(ch)
    if escaped: return None
    out.append(''.join(field))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mapped escapes', solve(_vary('@\\tA\\nB\\rC\\\\D')), _vary(['@\tA\nB\rC\\D']))
check('separators', solve(_vary('@\t\tZ')), _vary(['@', '', 'Z']))
check('escaped backslash then t', solve(_vary('\\\\t')), _vary(['\\t']))
check('unknown', solve(_vary('\\q')), _vary(None))
check('dangling', solve(_vary('@\\')), _vary(None))
check('raw newline', solve(_vary('@\nZ')), _vary(None))
check('empty', solve(_vary('')), _vary(['']))
check('leading trailing', solve(_vary('\t@\t')), _vary(['', '@', '']))
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:
A structured table violates the declared record or column contract.

Decode TSV fields with exactly four escapes: backslash-t, backslash-n, backslash-r, backslash-backslash. Raw tabs split fields, raw newlines are forbidden; unknown and dangling escapes reject the row. Empty input is one empty field.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out, field, escaped = [], [], False
    for ch in data:
        if escaped:
            if ch not in 'tnr\\': return None
            field.append({'t':'\t','n':'\n','r':'\r','\\':'\\'}[ch])
            escaped = False
        elif ch == '\\': escaped = True
        elif ch == '\t':
            out.append(''.join(field))
            field = []
        elif False: return None
        else: field.append(ch)
    if escaped: return None
    out.append(''.join(field))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mapped escapes', solve(_vary('@\\tA\\nB\\rC\\\\D')), _vary(['@\tA\nB\rC\\D']))
check('separators', solve(_vary('@\t\tZ')), _vary(['@', '', 'Z']))
check('escaped backslash then t', solve(_vary('\\\\t')), _vary(['\\t']))
check('unknown', solve(_vary('\\q')), _vary(None))
check('dangling', solve(_vary('@\\')), _vary(None))
check('raw newline', solve(_vary('@\nZ')), _vary(None))
check('empty', solve(_vary('')), _vary(['']))
check('leading trailing', solve(_vary('\t@\t')), _vary(['', '@', '']))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out, field, escaped = [], [], False
    for ch in data:
        if escaped:
            if ch not in 'tnr\\': return None
            field.append({'t':'\t','n':'\n','r':'\r','\\':'\\'}[ch])
            escaped = False
        elif ch == '\\': escaped = True
        elif ch == '\t':
            out.append(''.join(field))
            field = []
        elif ch == '\r': return None
        else: field.append(ch)
    if escaped: return None
    out.append(''.join(field))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mapped escapes', solve(_vary('@\\tA\\nB\\rC\\\\D')), _vary(['@\tA\nB\rC\\D']))
check('separators', solve(_vary('@\t\tZ')), _vary(['@', '', 'Z']))
check('escaped backslash then t', solve(_vary('\\\\t')), _vary(['\\t']))
check('unknown', solve(_vary('\\q')), _vary(None))
check('dangling', solve(_vary('@\\')), _vary(None))
check('raw newline', solve(_vary('@\nZ')), _vary(None))
check('empty', solve(_vary('')), _vary(['']))
check('leading trailing', solve(_vary('\t@\t')), _vary(['', '@', '']))
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:
A structured table violates the declared record or column contract.

Decode TSV fields with exactly four escapes: backslash-t, backslash-n, backslash-r, backslash-backslash. Raw tabs split fields, raw newlines are forbidden; unknown and dangling escapes reject the row. Empty input is one empty field.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out, field, escaped = [], [], False
    for ch in data:
        if escaped:
            if ch not in 'tnr\\': return None
            field.append({'t':'\t','n':'\n','r':'\r','\\':'\\'}[ch])
            escaped = False
        elif ch == '\\': escaped = True
        elif ch == '\t':
            out.append(''.join(field))
            field = []
        elif ch in '\r\n': return None
        else: field.append(ch)
    if False: return None
    out.append(''.join(field))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mapped escapes', solve(_vary('@\\tA\\nB\\rC\\\\D')), _vary(['@\tA\nB\rC\\D']))
check('separators', solve(_vary('@\t\tZ')), _vary(['@', '', 'Z']))
check('escaped backslash then t', solve(_vary('\\\\t')), _vary(['\\t']))
check('unknown', solve(_vary('\\q')), _vary(None))
check('dangling', solve(_vary('@\\')), _vary(None))
check('raw newline', solve(_vary('@\nZ')), _vary(None))
check('empty', solve(_vary('')), _vary(['']))
check('leading trailing', solve(_vary('\t@\t')), _vary(['', '@', '']))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out, field, escaped = [], [], False
    for ch in data:
        if escaped:
            if ch not in 'tnr\\': return None
            field.append({'t':'\t','n':'\n','r':'\r','\\':'\\'}[ch])
            escaped = False
        elif ch == '\\': escaped = True
        elif ch == '\t':
            out.append(''.join(field))
            field = []
        elif ch in '\r\n': return None
        else: field.append(ch)
    if escaped and not field: return None
    out.append(''.join(field))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mapped escapes', solve(_vary('@\\tA\\nB\\rC\\\\D')), _vary(['@\tA\nB\rC\\D']))
check('separators', solve(_vary('@\t\tZ')), _vary(['@', '', 'Z']))
check('escaped backslash then t', solve(_vary('\\\\t')), _vary(['\\t']))
check('unknown', solve(_vary('\\q')), _vary(None))
check('dangling', solve(_vary('@\\')), _vary(None))
check('raw newline', solve(_vary('@\nZ')), _vary(None))
check('empty', solve(_vary('')), _vary(['']))
check('leading trailing', solve(_vary('\t@\t')), _vary(['', '@', '']))
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:
A structured table violates the declared record or column contract.

Decode TSV fields with exactly four escapes: backslash-t, backslash-n, backslash-r, backslash-backslash. Raw tabs split fields, raw newlines are forbidden; unknown and dangling escapes reject the row. Empty input is one empty field.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for field in data:
        field = field
        field = field.replace('\t', '\\t')
        field = field.replace('\n', '\\n')
        field = field.replace('\r', '\\r')
        out.append(field)
    return '\t'.join(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('all controls', solve(_vary(['@\t\n\r\\'])), _vary('@\\t\\n\\r\\\\'))
check('empty cells', solve(_vary(['', '@', ''])), _vary('\t@\t'))
check('literal slash-t', solve(_vary(['\\t'])), _vary('\\\\t'))
check('normal', solve(_vary(['@', 'x'])), _vary('@\tx'))
check('zero columns', solve(_vary([])), _vary(''))
check('all empty', solve(_vary(['', '', ''])), _vary('\t\t'))
check('LF only', solve(_vary(['\n'])), _vary('\\n'))
check('CR only', solve(_vary(['\r'])), _vary('\\r'))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for field in data:
        field = field.replace('\\t', '\\\\t')
        field = field.replace('\t', '\\t')
        field = field.replace('\n', '\\n')
        field = field.replace('\r', '\\r')
        out.append(field)
    return '\t'.join(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('all controls', solve(_vary(['@\t\n\r\\'])), _vary('@\\t\\n\\r\\\\'))
check('empty cells', solve(_vary(['', '@', ''])), _vary('\t@\t'))
check('literal slash-t', solve(_vary(['\\t'])), _vary('\\\\t'))
check('normal', solve(_vary(['@', 'x'])), _vary('@\tx'))
check('zero columns', solve(_vary([])), _vary(''))
check('all empty', solve(_vary(['', '', ''])), _vary('\t\t'))
check('LF only', solve(_vary(['\n'])), _vary('\\n'))
check('CR only', solve(_vary(['\r'])), _vary('\\r'))
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:
A structured table violates the declared record or column contract.

Encode a list of text cells as TSV without a terminator. Escape backslashes before introducing backslash-t, backslash-n, backslash-r; preserve empty columns and all other text.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for field in data:
        field = field.replace('\\', '\\\\')
        field = field
        field = field.replace('\n', '\\n')
        field = field.replace('\r', '\\r')
        out.append(field)
    return '\t'.join(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('all controls', solve(_vary(['@\t\n\r\\'])), _vary('@\\t\\n\\r\\\\'))
check('empty cells', solve(_vary(['', '@', ''])), _vary('\t@\t'))
check('literal slash-t', solve(_vary(['\\t'])), _vary('\\\\t'))
check('normal', solve(_vary(['@', 'x'])), _vary('@\tx'))
check('zero columns', solve(_vary([])), _vary(''))
check('all empty', solve(_vary(['', '', ''])), _vary('\t\t'))
check('LF only', solve(_vary(['\n'])), _vary('\\n'))
check('CR only', solve(_vary(['\r'])), _vary('\\r'))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for field in data:
        field = field.replace('\\', '\\\\')
        field = field.replace('\t', ' ')
        field = field.replace('\n', '\\n')
        field = field.replace('\r', '\\r')
        out.append(field)
    return '\t'.join(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('all controls', solve(_vary(['@\t\n\r\\'])), _vary('@\\t\\n\\r\\\\'))
check('empty cells', solve(_vary(['', '@', ''])), _vary('\t@\t'))
check('literal slash-t', solve(_vary(['\\t'])), _vary('\\\\t'))
check('normal', solve(_vary(['@', 'x'])), _vary('@\tx'))
check('zero columns', solve(_vary([])), _vary(''))
check('all empty', solve(_vary(['', '', ''])), _vary('\t\t'))
check('LF only', solve(_vary(['\n'])), _vary('\\n'))
check('CR only', solve(_vary(['\r'])), _vary('\\r'))
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:
A structured table violates the declared record or column contract.

Encode a list of text cells as TSV without a terminator. Escape backslashes before introducing backslash-t, backslash-n, backslash-r; preserve empty columns and all other text.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for field in data:
        field = field.replace('\\', '\\\\')
        field = field.replace('\t', '\\t')
        field = field
        field = field.replace('\r', '\\r')
        out.append(field)
    return '\t'.join(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('all controls', solve(_vary(['@\t\n\r\\'])), _vary('@\\t\\n\\r\\\\'))
check('empty cells', solve(_vary(['', '@', ''])), _vary('\t@\t'))
check('literal slash-t', solve(_vary(['\\t'])), _vary('\\\\t'))
check('normal', solve(_vary(['@', 'x'])), _vary('@\tx'))
check('zero columns', solve(_vary([])), _vary(''))
check('all empty', solve(_vary(['', '', ''])), _vary('\t\t'))
check('LF only', solve(_vary(['\n'])), _vary('\\n'))
check('CR only', solve(_vary(['\r'])), _vary('\\r'))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for field in data:
        field = field.replace('\\', '\\\\')
        field = field.replace('\t', '\\t')
        field = field.replace('\n', '')
        field = field.replace('\r', '\\r')
        out.append(field)
    return '\t'.join(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('all controls', solve(_vary(['@\t\n\r\\'])), _vary('@\\t\\n\\r\\\\'))
check('empty cells', solve(_vary(['', '@', ''])), _vary('\t@\t'))
check('literal slash-t', solve(_vary(['\\t'])), _vary('\\\\t'))
check('normal', solve(_vary(['@', 'x'])), _vary('@\tx'))
check('zero columns', solve(_vary([])), _vary(''))
check('all empty', solve(_vary(['', '', ''])), _vary('\t\t'))
check('LF only', solve(_vary(['\n'])), _vary('\\n'))
check('CR only', solve(_vary(['\r'])), _vary('\\r'))
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:
A structured table violates the declared record or column contract.

Encode a list of text cells as TSV without a terminator. Escape backslashes before introducing backslash-t, backslash-n, backslash-r; preserve empty columns and all other text.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for field in data:
        field = field.replace('\\', '\\\\')
        field = field.replace('\t', '\\t')
        field = field.replace('\n', '\\n')
        field = field
        out.append(field)
    return '\t'.join(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('all controls', solve(_vary(['@\t\n\r\\'])), _vary('@\\t\\n\\r\\\\'))
check('empty cells', solve(_vary(['', '@', ''])), _vary('\t@\t'))
check('literal slash-t', solve(_vary(['\\t'])), _vary('\\\\t'))
check('normal', solve(_vary(['@', 'x'])), _vary('@\tx'))
check('zero columns', solve(_vary([])), _vary(''))
check('all empty', solve(_vary(['', '', ''])), _vary('\t\t'))
check('LF only', solve(_vary(['\n'])), _vary('\\n'))
check('CR only', solve(_vary(['\r'])), _vary('\\r'))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for field in data:
        field = field.replace('\\', '\\\\')
        field = field.replace('\t', '\\t')
        field = field.replace('\n', '\\n')
        field = field.replace('\r', '\\n')
        out.append(field)
    return '\t'.join(out)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('all controls', solve(_vary(['@\t\n\r\\'])), _vary('@\\t\\n\\r\\\\'))
check('empty cells', solve(_vary(['', '@', ''])), _vary('\t@\t'))
check('literal slash-t', solve(_vary(['\\t'])), _vary('\\\\t'))
check('normal', solve(_vary(['@', 'x'])), _vary('@\tx'))
check('zero columns', solve(_vary([])), _vary(''))
check('all empty', solve(_vary(['', '', ''])), _vary('\t\t'))
check('LF only', solve(_vary(['\n'])), _vary('\\n'))
check('CR only', solve(_vary(['\r'])), _vary('\\r'))
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:
A structured table violates the declared record or column contract.

Encode a list of text cells as TSV without a terminator. Escape backslashes before introducing backslash-t, backslash-n, backslash-r; preserve empty columns and all other text.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for field in data:
        field = field.replace('\\', '\\\\')
        field = field.replace('\t', '\\t')
        field = field.replace('\n', '\\n')
        field = field.replace('\r', '\\r')
        out.append(field)
    return '\t'.join(x for x in out if x)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('all controls', solve(_vary(['@\t\n\r\\'])), _vary('@\\t\\n\\r\\\\'))
check('empty cells', solve(_vary(['', '@', ''])), _vary('\t@\t'))
check('literal slash-t', solve(_vary(['\\t'])), _vary('\\\\t'))
check('normal', solve(_vary(['@', 'x'])), _vary('@\tx'))
check('zero columns', solve(_vary([])), _vary(''))
check('all empty', solve(_vary(['', '', ''])), _vary('\t\t'))
check('LF only', solve(_vary(['\n'])), _vary('\\n'))
check('CR only', solve(_vary(['\r'])), _vary('\\r'))
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
def _vary(value):
    if value == '@END': return 3 + 4*N
    if isinstance(value, str): return value.replace('@', 'cell' * N)
    if isinstance(value, list): return [_vary(x) for x in value]
    if isinstance(value, dict): return {_vary(k): _vary(v) for k,v in value.items()}
    return value
N = 1
observations = []
def solve(data):
    out = []
    for field in data:
        field = field.replace('\\', '\\\\')
        field = field.replace('\t', '\\t')
        field = field.replace('\n', '\\n')
        field = field.replace('\r', '\\r')
        out.append(field)
    return '\t'.join(out).strip('\t')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('all controls', solve(_vary(['@\t\n\r\\'])), _vary('@\\t\\n\\r\\\\'))
check('empty cells', solve(_vary(['', '@', ''])), _vary('\t@\t'))
check('literal slash-t', solve(_vary(['\\t'])), _vary('\\\\t'))
check('normal', solve(_vary(['@', 'x'])), _vary('@\tx'))
check('zero columns', solve(_vary([])), _vary(''))
check('all empty', solve(_vary(['', '', ''])), _vary('\t\t'))
check('LF only', solve(_vary(['\n'])), _vary('\\n'))
check('CR only', solve(_vary(['\r'])), _vary('\\r'))
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:
A structured table violates the declared record or column contract.

Encode a list of text cells as TSV without a terminator. Escape backslashes before introducing backslash-t, backslash-n, backslash-r; preserve empty columns and all other text.

split: open-access