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

N = 1
observations = []
def solve(rows, cols, matrix, start, readonly, hidden, limit):
    targets=[c for c in cols if c not in hidden]
    ri=rows.index(start[0]); ci=targets.index(start[1])
    patches=[]; rejected=[]
    for y,source in enumerate(matrix):
        if ri+y>=len(rows): break
        for x,value in enumerate(source):
            if ci+x>=len(targets): break
            cell=(rows[ri+y],targets[ci+x])
            if cell in readonly: rejected.append(cell); continue
            if len(patches)>=limit: return {'patches':patches,'rejected':rejected,'truncated':True}
            patches.append((cell[0],cell[1],value or None))
    return {'patches':patches,'rejected':rejected,'truncated':False}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('offset rectangular paste', solve(['r0','r1','r2','r3'], ['a','b','c','d'], [[1,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 1), ('r1', 'c', 2), ('r2', 'b', 3), ('r2', 'c', 4)], 'rejected': [], 'truncated': False})
    check('hidden targets', solve(['r0','r1'], ['a','b','c','d'], [[1,2,3]], ('r0','c'), [], ['a','b'], 9), {'patches': [('r0', 'c', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('readonly holes', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 9), {'patches': [('r0', 'b', 2), ('r1', 'a', 3), ('r1', 'b', 4)], 'rejected': [('r0', 'a')], 'truncated': False})
    check('bounded patches', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 2), {'patches': [('r0', 'b', 2), ('r1', 'a', 3)], 'rejected': [('r0', 'a')], 'truncated': True})
    check('ragged and whitespace', solve(['r0','r1'], ['a','b','c'], [[0,' x '],['']], ('r0','a'), [], [], 9), {'patches': [('r0', 'a', 0), ('r0', 'b', ' x '), ('r1', 'a', '')], 'rejected': [], 'truncated': False})
    check('clipped edges', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 1)], 'rejected': [], 'truncated': False})
    check('hidden internal', solve(['r0'], ['a','b','c','d'], [[1,2,3]], ('r0','a'), [], ['b','c'], 9), {'patches': [('r0', 'a', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('budget no locks', solve(['r0'], ['a','b'], [[1,2]], ('r0','a'), [], [], 1), {'patches': [('r0', 'a', 1)], 'rejected': [], 'truncated': True})
    check('empty input', solve(['r0'], ['a'], [], ('r0','a'), [], [], 0), {'patches': [], 'rejected': [], 'truncated': False})

if N == 2:
    check('offset rectangular paste', solve(['r0','r1','r2','r3'], ['a','b','c','d'], [[2,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 2), ('r1', 'c', 2), ('r2', 'b', 3), ('r2', 'c', 4)], 'rejected': [], 'truncated': False})
    check('hidden targets', solve(['r0','r1'], ['a','b','c','d'], [[1,2,3]], ('r0','c'), [], ['a','b'], 9), {'patches': [('r0', 'c', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('readonly holes', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 9), {'patches': [('r0', 'b', 2), ('r1', 'a', 3), ('r1', 'b', 4)], 'rejected': [('r0', 'a')], 'truncated': False})
    check('bounded patches', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 2), {'patches': [('r0', 'b', 2), ('r1', 'a', 3)], 'rejected': [('r0', 'a')], 'truncated': True})
    check('ragged and whitespace', solve(['r0','r1'], ['a','b','c'], [[0,' x '],['']], ('r0','a'), [], [], 9), {'patches': [('r0', 'a', 0), ('r0', 'b', ' x '), ('r1', 'a', '')], 'rejected': [], 'truncated': False})
    check('clipped edges', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 1)], 'rejected': [], 'truncated': False})
    check('hidden internal', solve(['r0'], ['a','b','c','d'], [[1,2,3]], ('r0','a'), [], ['b','c'], 9), {'patches': [('r0', 'a', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('budget no locks', solve(['r0'], ['a','b'], [[1,2]], ('r0','a'), [], [], 1), {'patches': [('r0', 'a', 1)], 'rejected': [], 'truncated': True})
    check('empty input', solve(['r0'], ['a'], [], ('r0','a'), [], [], 0), {'patches': [], 'rejected': [], 'truncated': False})

if N == 3:
    check('offset rectangular paste', solve(['r0','r1','r2','r3'], ['a','b','c','d'], [[3,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 3), ('r1', 'c', 2), ('r2', 'b', 3), ('r2', 'c', 4)], 'rejected': [], 'truncated': False})
    check('hidden targets', solve(['r0','r1'], ['a','b','c','d'], [[1,2,3]], ('r0','c'), [], ['a','b'], 9), {'patches': [('r0', 'c', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('readonly holes', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 9), {'patches': [('r0', 'b', 2), ('r1', 'a', 3), ('r1', 'b', 4)], 'rejected': [('r0', 'a')], 'truncated': False})
    check('bounded patches', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 2), {'patches': [('r0', 'b', 2), ('r1', 'a', 3)], 'rejected': [('r0', 'a')], 'truncated': True})
    check('ragged and whitespace', solve(['r0','r1'], ['a','b','c'], [[0,' x '],['']], ('r0','a'), [], [], 9), {'patches': [('r0', 'a', 0), ('r0', 'b', ' x '), ('r1', 'a', '')], 'rejected': [], 'truncated': False})
    check('clipped edges', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 1)], 'rejected': [], 'truncated': False})
    check('hidden internal', solve(['r0'], ['a','b','c','d'], [[1,2,3]], ('r0','a'), [], ['b','c'], 9), {'patches': [('r0', 'a', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('budget no locks', solve(['r0'], ['a','b'], [[1,2]], ('r0','a'), [], [], 1), {'patches': [('r0', 'a', 1)], 'rejected': [], 'truncated': True})
    check('empty input', solve(['r0'], ['a'], [], ('r0','a'), [], [], 0), {'patches': [], 'rejected': [], 'truncated': False})

if N == 4:
    check('offset rectangular paste', solve(['r0','r1','r2','r3'], ['a','b','c','d'], [[4,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 4), ('r1', 'c', 2), ('r2', 'b', 3), ('r2', 'c', 4)], 'rejected': [], 'truncated': False})
    check('hidden targets', solve(['r0','r1'], ['a','b','c','d'], [[1,2,3]], ('r0','c'), [], ['a','b'], 9), {'patches': [('r0', 'c', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('readonly holes', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 9), {'patches': [('r0', 'b', 2), ('r1', 'a', 3), ('r1', 'b', 4)], 'rejected': [('r0', 'a')], 'truncated': False})
    check('bounded patches', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 2), {'patches': [('r0', 'b', 2), ('r1', 'a', 3)], 'rejected': [('r0', 'a')], 'truncated': True})
    check('ragged and whitespace', solve(['r0','r1'], ['a','b','c'], [[0,' x '],['']], ('r0','a'), [], [], 9), {'patches': [('r0', 'a', 0), ('r0', 'b', ' x '), ('r1', 'a', '')], 'rejected': [], 'truncated': False})
    check('clipped edges', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 1)], 'rejected': [], 'truncated': False})
    check('hidden internal', solve(['r0'], ['a','b','c','d'], [[1,2,3]], ('r0','a'), [], ['b','c'], 9), {'patches': [('r0', 'a', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('budget no locks', solve(['r0'], ['a','b'], [[1,2]], ('r0','a'), [], [], 1), {'patches': [('r0', 'a', 1)], 'rejected': [], 'truncated': True})
    check('empty input', solve(['r0'], ['a'], [], ('r0','a'), [], [], 0), {'patches': [], 'rejected': [], 'truncated': False})

if N == 5:
    check('offset rectangular paste', solve(['r0','r1','r2','r3'], ['a','b','c','d'], [[5,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 5), ('r1', 'c', 2), ('r2', 'b', 3), ('r2', 'c', 4)], 'rejected': [], 'truncated': False})
    check('hidden targets', solve(['r0','r1'], ['a','b','c','d'], [[1,2,3]], ('r0','c'), [], ['a','b'], 9), {'patches': [('r0', 'c', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('readonly holes', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 9), {'patches': [('r0', 'b', 2), ('r1', 'a', 3), ('r1', 'b', 4)], 'rejected': [('r0', 'a')], 'truncated': False})
    check('bounded patches', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 2), {'patches': [('r0', 'b', 2), ('r1', 'a', 3)], 'rejected': [('r0', 'a')], 'truncated': True})
    check('ragged and whitespace', solve(['r0','r1'], ['a','b','c'], [[0,' x '],['']], ('r0','a'), [], [], 9), {'patches': [('r0', 'a', 0), ('r0', 'b', ' x '), ('r1', 'a', '')], 'rejected': [], 'truncated': False})
    check('clipped edges', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 1)], 'rejected': [], 'truncated': False})
    check('hidden internal', solve(['r0'], ['a','b','c','d'], [[1,2,3]], ('r0','a'), [], ['b','c'], 9), {'patches': [('r0', 'a', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('budget no locks', solve(['r0'], ['a','b'], [[1,2]], ('r0','a'), [], [], 1), {'patches': [('r0', 'a', 1)], 'rejected': [], 'truncated': True})
    check('empty input', solve(['r0'], ['a'], [], ('r0','a'), [], [], 0), {'patches': [], 'rejected': [], 'truncated': False})

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(rows, cols, matrix, start, readonly, hidden, limit):
    targets=[c for c in cols if c not in hidden]
    ri=rows.index(start[0]); ci=targets.index(start[1])
    patches=[]; rejected=[]
    for y,source in enumerate(matrix):
        if ri+y>=len(rows): break
        for x,value in enumerate(source):
            if ci+x>=len(targets): break
            cell=(rows[ri+y],targets[ci+x])
            if cell in readonly: rejected.append(cell); continue
            if len(patches)>=limit: return {'patches':patches,'rejected':rejected,'truncated':True}
            patches.append((cell[0],cell[1],str(value).strip()))
    return {'patches':patches,'rejected':rejected,'truncated':False}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('offset rectangular paste', solve(['r0','r1','r2','r3'], ['a','b','c','d'], [[1,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 1), ('r1', 'c', 2), ('r2', 'b', 3), ('r2', 'c', 4)], 'rejected': [], 'truncated': False})
    check('hidden targets', solve(['r0','r1'], ['a','b','c','d'], [[1,2,3]], ('r0','c'), [], ['a','b'], 9), {'patches': [('r0', 'c', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('readonly holes', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 9), {'patches': [('r0', 'b', 2), ('r1', 'a', 3), ('r1', 'b', 4)], 'rejected': [('r0', 'a')], 'truncated': False})
    check('bounded patches', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 2), {'patches': [('r0', 'b', 2), ('r1', 'a', 3)], 'rejected': [('r0', 'a')], 'truncated': True})
    check('ragged and whitespace', solve(['r0','r1'], ['a','b','c'], [[0,' x '],['']], ('r0','a'), [], [], 9), {'patches': [('r0', 'a', 0), ('r0', 'b', ' x '), ('r1', 'a', '')], 'rejected': [], 'truncated': False})
    check('clipped edges', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 1)], 'rejected': [], 'truncated': False})
    check('hidden internal', solve(['r0'], ['a','b','c','d'], [[1,2,3]], ('r0','a'), [], ['b','c'], 9), {'patches': [('r0', 'a', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('budget no locks', solve(['r0'], ['a','b'], [[1,2]], ('r0','a'), [], [], 1), {'patches': [('r0', 'a', 1)], 'rejected': [], 'truncated': True})
    check('empty input', solve(['r0'], ['a'], [], ('r0','a'), [], [], 0), {'patches': [], 'rejected': [], 'truncated': False})

if N == 2:
    check('offset rectangular paste', solve(['r0','r1','r2','r3'], ['a','b','c','d'], [[2,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 2), ('r1', 'c', 2), ('r2', 'b', 3), ('r2', 'c', 4)], 'rejected': [], 'truncated': False})
    check('hidden targets', solve(['r0','r1'], ['a','b','c','d'], [[1,2,3]], ('r0','c'), [], ['a','b'], 9), {'patches': [('r0', 'c', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('readonly holes', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 9), {'patches': [('r0', 'b', 2), ('r1', 'a', 3), ('r1', 'b', 4)], 'rejected': [('r0', 'a')], 'truncated': False})
    check('bounded patches', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 2), {'patches': [('r0', 'b', 2), ('r1', 'a', 3)], 'rejected': [('r0', 'a')], 'truncated': True})
    check('ragged and whitespace', solve(['r0','r1'], ['a','b','c'], [[0,' x '],['']], ('r0','a'), [], [], 9), {'patches': [('r0', 'a', 0), ('r0', 'b', ' x '), ('r1', 'a', '')], 'rejected': [], 'truncated': False})
    check('clipped edges', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 1)], 'rejected': [], 'truncated': False})
    check('hidden internal', solve(['r0'], ['a','b','c','d'], [[1,2,3]], ('r0','a'), [], ['b','c'], 9), {'patches': [('r0', 'a', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('budget no locks', solve(['r0'], ['a','b'], [[1,2]], ('r0','a'), [], [], 1), {'patches': [('r0', 'a', 1)], 'rejected': [], 'truncated': True})
    check('empty input', solve(['r0'], ['a'], [], ('r0','a'), [], [], 0), {'patches': [], 'rejected': [], 'truncated': False})

if N == 3:
    check('offset rectangular paste', solve(['r0','r1','r2','r3'], ['a','b','c','d'], [[3,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 3), ('r1', 'c', 2), ('r2', 'b', 3), ('r2', 'c', 4)], 'rejected': [], 'truncated': False})
    check('hidden targets', solve(['r0','r1'], ['a','b','c','d'], [[1,2,3]], ('r0','c'), [], ['a','b'], 9), {'patches': [('r0', 'c', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('readonly holes', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 9), {'patches': [('r0', 'b', 2), ('r1', 'a', 3), ('r1', 'b', 4)], 'rejected': [('r0', 'a')], 'truncated': False})
    check('bounded patches', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 2), {'patches': [('r0', 'b', 2), ('r1', 'a', 3)], 'rejected': [('r0', 'a')], 'truncated': True})
    check('ragged and whitespace', solve(['r0','r1'], ['a','b','c'], [[0,' x '],['']], ('r0','a'), [], [], 9), {'patches': [('r0', 'a', 0), ('r0', 'b', ' x '), ('r1', 'a', '')], 'rejected': [], 'truncated': False})
    check('clipped edges', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 1)], 'rejected': [], 'truncated': False})
    check('hidden internal', solve(['r0'], ['a','b','c','d'], [[1,2,3]], ('r0','a'), [], ['b','c'], 9), {'patches': [('r0', 'a', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('budget no locks', solve(['r0'], ['a','b'], [[1,2]], ('r0','a'), [], [], 1), {'patches': [('r0', 'a', 1)], 'rejected': [], 'truncated': True})
    check('empty input', solve(['r0'], ['a'], [], ('r0','a'), [], [], 0), {'patches': [], 'rejected': [], 'truncated': False})

if N == 4:
    check('offset rectangular paste', solve(['r0','r1','r2','r3'], ['a','b','c','d'], [[4,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 4), ('r1', 'c', 2), ('r2', 'b', 3), ('r2', 'c', 4)], 'rejected': [], 'truncated': False})
    check('hidden targets', solve(['r0','r1'], ['a','b','c','d'], [[1,2,3]], ('r0','c'), [], ['a','b'], 9), {'patches': [('r0', 'c', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('readonly holes', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 9), {'patches': [('r0', 'b', 2), ('r1', 'a', 3), ('r1', 'b', 4)], 'rejected': [('r0', 'a')], 'truncated': False})
    check('bounded patches', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 2), {'patches': [('r0', 'b', 2), ('r1', 'a', 3)], 'rejected': [('r0', 'a')], 'truncated': True})
    check('ragged and whitespace', solve(['r0','r1'], ['a','b','c'], [[0,' x '],['']], ('r0','a'), [], [], 9), {'patches': [('r0', 'a', 0), ('r0', 'b', ' x '), ('r1', 'a', '')], 'rejected': [], 'truncated': False})
    check('clipped edges', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 1)], 'rejected': [], 'truncated': False})
    check('hidden internal', solve(['r0'], ['a','b','c','d'], [[1,2,3]], ('r0','a'), [], ['b','c'], 9), {'patches': [('r0', 'a', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('budget no locks', solve(['r0'], ['a','b'], [[1,2]], ('r0','a'), [], [], 1), {'patches': [('r0', 'a', 1)], 'rejected': [], 'truncated': True})
    check('empty input', solve(['r0'], ['a'], [], ('r0','a'), [], [], 0), {'patches': [], 'rejected': [], 'truncated': False})

if N == 5:
    check('offset rectangular paste', solve(['r0','r1','r2','r3'], ['a','b','c','d'], [[5,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 5), ('r1', 'c', 2), ('r2', 'b', 3), ('r2', 'c', 4)], 'rejected': [], 'truncated': False})
    check('hidden targets', solve(['r0','r1'], ['a','b','c','d'], [[1,2,3]], ('r0','c'), [], ['a','b'], 9), {'patches': [('r0', 'c', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('readonly holes', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 9), {'patches': [('r0', 'b', 2), ('r1', 'a', 3), ('r1', 'b', 4)], 'rejected': [('r0', 'a')], 'truncated': False})
    check('bounded patches', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 2), {'patches': [('r0', 'b', 2), ('r1', 'a', 3)], 'rejected': [('r0', 'a')], 'truncated': True})
    check('ragged and whitespace', solve(['r0','r1'], ['a','b','c'], [[0,' x '],['']], ('r0','a'), [], [], 9), {'patches': [('r0', 'a', 0), ('r0', 'b', ' x '), ('r1', 'a', '')], 'rejected': [], 'truncated': False})
    check('clipped edges', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 1)], 'rejected': [], 'truncated': False})
    check('hidden internal', solve(['r0'], ['a','b','c','d'], [[1,2,3]], ('r0','a'), [], ['b','c'], 9), {'patches': [('r0', 'a', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('budget no locks', solve(['r0'], ['a','b'], [[1,2]], ('r0','a'), [], [], 1), {'patches': [('r0', 'a', 1)], 'rejected': [], 'truncated': True})
    check('empty input', solve(['r0'], ['a'], [], ('r0','a'), [], [], 0), {'patches': [], 'rejected': [], 'truncated': False})

print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The table source value preservation result violates the stipulated table clipboard paste mapping contract.

Paste maps source offsets to visible table coordinates starting at a stable cell; source raggedness is retained, table edges clip, readonly holes consume coordinates but not patch capacity, raw values remain unchanged, and truncation means an additional writable patch was omitted.

split: open-access


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

N = 1
observations = []
def solve(rows, cols, matrix, start, readonly, hidden, limit):
    targets=[c for c in cols if c not in hidden]
    ri=rows.index(start[0]); ci=targets.index(start[1])
    patches=[]; rejected=[]
    for y,source in enumerate(matrix):
        if ri+y>=len(rows): break
        for x,value in enumerate(source):
            if ci+x>=len(targets): break
            cell=(rows[ri+y],targets[ci+x])
            if cell in readonly: rejected.append(cell); continue
            if len(patches)>=limit: return {'patches':patches,'rejected':rejected,'truncated':False}
            patches.append((cell[0],cell[1],value))
    return {'patches':patches,'rejected':rejected,'truncated':False}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('offset rectangular paste', solve(['r0','r1','r2','r3'], ['a','b','c','d'], [[1,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 1), ('r1', 'c', 2), ('r2', 'b', 3), ('r2', 'c', 4)], 'rejected': [], 'truncated': False})
    check('hidden targets', solve(['r0','r1'], ['a','b','c','d'], [[1,2,3]], ('r0','c'), [], ['a','b'], 9), {'patches': [('r0', 'c', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('readonly holes', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 9), {'patches': [('r0', 'b', 2), ('r1', 'a', 3), ('r1', 'b', 4)], 'rejected': [('r0', 'a')], 'truncated': False})
    check('bounded patches', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 2), {'patches': [('r0', 'b', 2), ('r1', 'a', 3)], 'rejected': [('r0', 'a')], 'truncated': True})
    check('ragged and whitespace', solve(['r0','r1'], ['a','b','c'], [[0,' x '],['']], ('r0','a'), [], [], 9), {'patches': [('r0', 'a', 0), ('r0', 'b', ' x '), ('r1', 'a', '')], 'rejected': [], 'truncated': False})
    check('clipped edges', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 1)], 'rejected': [], 'truncated': False})
    check('hidden internal', solve(['r0'], ['a','b','c','d'], [[1,2,3]], ('r0','a'), [], ['b','c'], 9), {'patches': [('r0', 'a', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('budget no locks', solve(['r0'], ['a','b'], [[1,2]], ('r0','a'), [], [], 1), {'patches': [('r0', 'a', 1)], 'rejected': [], 'truncated': True})
    check('empty input', solve(['r0'], ['a'], [], ('r0','a'), [], [], 0), {'patches': [], 'rejected': [], 'truncated': False})

if N == 2:
    check('offset rectangular paste', solve(['r0','r1','r2','r3'], ['a','b','c','d'], [[2,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 2), ('r1', 'c', 2), ('r2', 'b', 3), ('r2', 'c', 4)], 'rejected': [], 'truncated': False})
    check('hidden targets', solve(['r0','r1'], ['a','b','c','d'], [[1,2,3]], ('r0','c'), [], ['a','b'], 9), {'patches': [('r0', 'c', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('readonly holes', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 9), {'patches': [('r0', 'b', 2), ('r1', 'a', 3), ('r1', 'b', 4)], 'rejected': [('r0', 'a')], 'truncated': False})
    check('bounded patches', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 2), {'patches': [('r0', 'b', 2), ('r1', 'a', 3)], 'rejected': [('r0', 'a')], 'truncated': True})
    check('ragged and whitespace', solve(['r0','r1'], ['a','b','c'], [[0,' x '],['']], ('r0','a'), [], [], 9), {'patches': [('r0', 'a', 0), ('r0', 'b', ' x '), ('r1', 'a', '')], 'rejected': [], 'truncated': False})
    check('clipped edges', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 1)], 'rejected': [], 'truncated': False})
    check('hidden internal', solve(['r0'], ['a','b','c','d'], [[1,2,3]], ('r0','a'), [], ['b','c'], 9), {'patches': [('r0', 'a', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('budget no locks', solve(['r0'], ['a','b'], [[1,2]], ('r0','a'), [], [], 1), {'patches': [('r0', 'a', 1)], 'rejected': [], 'truncated': True})
    check('empty input', solve(['r0'], ['a'], [], ('r0','a'), [], [], 0), {'patches': [], 'rejected': [], 'truncated': False})

if N == 3:
    check('offset rectangular paste', solve(['r0','r1','r2','r3'], ['a','b','c','d'], [[3,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 3), ('r1', 'c', 2), ('r2', 'b', 3), ('r2', 'c', 4)], 'rejected': [], 'truncated': False})
    check('hidden targets', solve(['r0','r1'], ['a','b','c','d'], [[1,2,3]], ('r0','c'), [], ['a','b'], 9), {'patches': [('r0', 'c', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('readonly holes', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 9), {'patches': [('r0', 'b', 2), ('r1', 'a', 3), ('r1', 'b', 4)], 'rejected': [('r0', 'a')], 'truncated': False})
    check('bounded patches', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 2), {'patches': [('r0', 'b', 2), ('r1', 'a', 3)], 'rejected': [('r0', 'a')], 'truncated': True})
    check('ragged and whitespace', solve(['r0','r1'], ['a','b','c'], [[0,' x '],['']], ('r0','a'), [], [], 9), {'patches': [('r0', 'a', 0), ('r0', 'b', ' x '), ('r1', 'a', '')], 'rejected': [], 'truncated': False})
    check('clipped edges', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 1)], 'rejected': [], 'truncated': False})
    check('hidden internal', solve(['r0'], ['a','b','c','d'], [[1,2,3]], ('r0','a'), [], ['b','c'], 9), {'patches': [('r0', 'a', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('budget no locks', solve(['r0'], ['a','b'], [[1,2]], ('r0','a'), [], [], 1), {'patches': [('r0', 'a', 1)], 'rejected': [], 'truncated': True})
    check('empty input', solve(['r0'], ['a'], [], ('r0','a'), [], [], 0), {'patches': [], 'rejected': [], 'truncated': False})

if N == 4:
    check('offset rectangular paste', solve(['r0','r1','r2','r3'], ['a','b','c','d'], [[4,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 4), ('r1', 'c', 2), ('r2', 'b', 3), ('r2', 'c', 4)], 'rejected': [], 'truncated': False})
    check('hidden targets', solve(['r0','r1'], ['a','b','c','d'], [[1,2,3]], ('r0','c'), [], ['a','b'], 9), {'patches': [('r0', 'c', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('readonly holes', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 9), {'patches': [('r0', 'b', 2), ('r1', 'a', 3), ('r1', 'b', 4)], 'rejected': [('r0', 'a')], 'truncated': False})
    check('bounded patches', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 2), {'patches': [('r0', 'b', 2), ('r1', 'a', 3)], 'rejected': [('r0', 'a')], 'truncated': True})
    check('ragged and whitespace', solve(['r0','r1'], ['a','b','c'], [[0,' x '],['']], ('r0','a'), [], [], 9), {'patches': [('r0', 'a', 0), ('r0', 'b', ' x '), ('r1', 'a', '')], 'rejected': [], 'truncated': False})
    check('clipped edges', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 1)], 'rejected': [], 'truncated': False})
    check('hidden internal', solve(['r0'], ['a','b','c','d'], [[1,2,3]], ('r0','a'), [], ['b','c'], 9), {'patches': [('r0', 'a', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('budget no locks', solve(['r0'], ['a','b'], [[1,2]], ('r0','a'), [], [], 1), {'patches': [('r0', 'a', 1)], 'rejected': [], 'truncated': True})
    check('empty input', solve(['r0'], ['a'], [], ('r0','a'), [], [], 0), {'patches': [], 'rejected': [], 'truncated': False})

if N == 5:
    check('offset rectangular paste', solve(['r0','r1','r2','r3'], ['a','b','c','d'], [[5,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 5), ('r1', 'c', 2), ('r2', 'b', 3), ('r2', 'c', 4)], 'rejected': [], 'truncated': False})
    check('hidden targets', solve(['r0','r1'], ['a','b','c','d'], [[1,2,3]], ('r0','c'), [], ['a','b'], 9), {'patches': [('r0', 'c', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('readonly holes', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 9), {'patches': [('r0', 'b', 2), ('r1', 'a', 3), ('r1', 'b', 4)], 'rejected': [('r0', 'a')], 'truncated': False})
    check('bounded patches', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 2), {'patches': [('r0', 'b', 2), ('r1', 'a', 3)], 'rejected': [('r0', 'a')], 'truncated': True})
    check('ragged and whitespace', solve(['r0','r1'], ['a','b','c'], [[0,' x '],['']], ('r0','a'), [], [], 9), {'patches': [('r0', 'a', 0), ('r0', 'b', ' x '), ('r1', 'a', '')], 'rejected': [], 'truncated': False})
    check('clipped edges', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 1)], 'rejected': [], 'truncated': False})
    check('hidden internal', solve(['r0'], ['a','b','c','d'], [[1,2,3]], ('r0','a'), [], ['b','c'], 9), {'patches': [('r0', 'a', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('budget no locks', solve(['r0'], ['a','b'], [[1,2]], ('r0','a'), [], [], 1), {'patches': [('r0', 'a', 1)], 'rejected': [], 'truncated': True})
    check('empty input', solve(['r0'], ['a'], [], ('r0','a'), [], [], 0), {'patches': [], 'rejected': [], 'truncated': False})

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(rows, cols, matrix, start, readonly, hidden, limit):
    targets=[c for c in cols if c not in hidden]
    ri=rows.index(start[0]); ci=targets.index(start[1])
    patches=[]; rejected=[]
    for y,source in enumerate(matrix):
        if ri+y>=len(rows): break
        for x,value in enumerate(source):
            if ci+x>=len(targets): break
            cell=(rows[ri+y],targets[ci+x])
            if cell in readonly: rejected.append(cell); continue
            if len(patches)>=limit: return {'patches':patches,'rejected':rejected,'truncated':bool(rejected)}
            patches.append((cell[0],cell[1],value))
    return {'patches':patches,'rejected':rejected,'truncated':False}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('offset rectangular paste', solve(['r0','r1','r2','r3'], ['a','b','c','d'], [[1,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 1), ('r1', 'c', 2), ('r2', 'b', 3), ('r2', 'c', 4)], 'rejected': [], 'truncated': False})
    check('hidden targets', solve(['r0','r1'], ['a','b','c','d'], [[1,2,3]], ('r0','c'), [], ['a','b'], 9), {'patches': [('r0', 'c', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('readonly holes', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 9), {'patches': [('r0', 'b', 2), ('r1', 'a', 3), ('r1', 'b', 4)], 'rejected': [('r0', 'a')], 'truncated': False})
    check('bounded patches', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 2), {'patches': [('r0', 'b', 2), ('r1', 'a', 3)], 'rejected': [('r0', 'a')], 'truncated': True})
    check('ragged and whitespace', solve(['r0','r1'], ['a','b','c'], [[0,' x '],['']], ('r0','a'), [], [], 9), {'patches': [('r0', 'a', 0), ('r0', 'b', ' x '), ('r1', 'a', '')], 'rejected': [], 'truncated': False})
    check('clipped edges', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 1)], 'rejected': [], 'truncated': False})
    check('hidden internal', solve(['r0'], ['a','b','c','d'], [[1,2,3]], ('r0','a'), [], ['b','c'], 9), {'patches': [('r0', 'a', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('budget no locks', solve(['r0'], ['a','b'], [[1,2]], ('r0','a'), [], [], 1), {'patches': [('r0', 'a', 1)], 'rejected': [], 'truncated': True})
    check('empty input', solve(['r0'], ['a'], [], ('r0','a'), [], [], 0), {'patches': [], 'rejected': [], 'truncated': False})

if N == 2:
    check('offset rectangular paste', solve(['r0','r1','r2','r3'], ['a','b','c','d'], [[2,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 2), ('r1', 'c', 2), ('r2', 'b', 3), ('r2', 'c', 4)], 'rejected': [], 'truncated': False})
    check('hidden targets', solve(['r0','r1'], ['a','b','c','d'], [[1,2,3]], ('r0','c'), [], ['a','b'], 9), {'patches': [('r0', 'c', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('readonly holes', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 9), {'patches': [('r0', 'b', 2), ('r1', 'a', 3), ('r1', 'b', 4)], 'rejected': [('r0', 'a')], 'truncated': False})
    check('bounded patches', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 2), {'patches': [('r0', 'b', 2), ('r1', 'a', 3)], 'rejected': [('r0', 'a')], 'truncated': True})
    check('ragged and whitespace', solve(['r0','r1'], ['a','b','c'], [[0,' x '],['']], ('r0','a'), [], [], 9), {'patches': [('r0', 'a', 0), ('r0', 'b', ' x '), ('r1', 'a', '')], 'rejected': [], 'truncated': False})
    check('clipped edges', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 1)], 'rejected': [], 'truncated': False})
    check('hidden internal', solve(['r0'], ['a','b','c','d'], [[1,2,3]], ('r0','a'), [], ['b','c'], 9), {'patches': [('r0', 'a', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('budget no locks', solve(['r0'], ['a','b'], [[1,2]], ('r0','a'), [], [], 1), {'patches': [('r0', 'a', 1)], 'rejected': [], 'truncated': True})
    check('empty input', solve(['r0'], ['a'], [], ('r0','a'), [], [], 0), {'patches': [], 'rejected': [], 'truncated': False})

if N == 3:
    check('offset rectangular paste', solve(['r0','r1','r2','r3'], ['a','b','c','d'], [[3,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 3), ('r1', 'c', 2), ('r2', 'b', 3), ('r2', 'c', 4)], 'rejected': [], 'truncated': False})
    check('hidden targets', solve(['r0','r1'], ['a','b','c','d'], [[1,2,3]], ('r0','c'), [], ['a','b'], 9), {'patches': [('r0', 'c', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('readonly holes', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 9), {'patches': [('r0', 'b', 2), ('r1', 'a', 3), ('r1', 'b', 4)], 'rejected': [('r0', 'a')], 'truncated': False})
    check('bounded patches', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 2), {'patches': [('r0', 'b', 2), ('r1', 'a', 3)], 'rejected': [('r0', 'a')], 'truncated': True})
    check('ragged and whitespace', solve(['r0','r1'], ['a','b','c'], [[0,' x '],['']], ('r0','a'), [], [], 9), {'patches': [('r0', 'a', 0), ('r0', 'b', ' x '), ('r1', 'a', '')], 'rejected': [], 'truncated': False})
    check('clipped edges', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 1)], 'rejected': [], 'truncated': False})
    check('hidden internal', solve(['r0'], ['a','b','c','d'], [[1,2,3]], ('r0','a'), [], ['b','c'], 9), {'patches': [('r0', 'a', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('budget no locks', solve(['r0'], ['a','b'], [[1,2]], ('r0','a'), [], [], 1), {'patches': [('r0', 'a', 1)], 'rejected': [], 'truncated': True})
    check('empty input', solve(['r0'], ['a'], [], ('r0','a'), [], [], 0), {'patches': [], 'rejected': [], 'truncated': False})

if N == 4:
    check('offset rectangular paste', solve(['r0','r1','r2','r3'], ['a','b','c','d'], [[4,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 4), ('r1', 'c', 2), ('r2', 'b', 3), ('r2', 'c', 4)], 'rejected': [], 'truncated': False})
    check('hidden targets', solve(['r0','r1'], ['a','b','c','d'], [[1,2,3]], ('r0','c'), [], ['a','b'], 9), {'patches': [('r0', 'c', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('readonly holes', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 9), {'patches': [('r0', 'b', 2), ('r1', 'a', 3), ('r1', 'b', 4)], 'rejected': [('r0', 'a')], 'truncated': False})
    check('bounded patches', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 2), {'patches': [('r0', 'b', 2), ('r1', 'a', 3)], 'rejected': [('r0', 'a')], 'truncated': True})
    check('ragged and whitespace', solve(['r0','r1'], ['a','b','c'], [[0,' x '],['']], ('r0','a'), [], [], 9), {'patches': [('r0', 'a', 0), ('r0', 'b', ' x '), ('r1', 'a', '')], 'rejected': [], 'truncated': False})
    check('clipped edges', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 1)], 'rejected': [], 'truncated': False})
    check('hidden internal', solve(['r0'], ['a','b','c','d'], [[1,2,3]], ('r0','a'), [], ['b','c'], 9), {'patches': [('r0', 'a', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('budget no locks', solve(['r0'], ['a','b'], [[1,2]], ('r0','a'), [], [], 1), {'patches': [('r0', 'a', 1)], 'rejected': [], 'truncated': True})
    check('empty input', solve(['r0'], ['a'], [], ('r0','a'), [], [], 0), {'patches': [], 'rejected': [], 'truncated': False})

if N == 5:
    check('offset rectangular paste', solve(['r0','r1','r2','r3'], ['a','b','c','d'], [[5,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 5), ('r1', 'c', 2), ('r2', 'b', 3), ('r2', 'c', 4)], 'rejected': [], 'truncated': False})
    check('hidden targets', solve(['r0','r1'], ['a','b','c','d'], [[1,2,3]], ('r0','c'), [], ['a','b'], 9), {'patches': [('r0', 'c', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('readonly holes', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 9), {'patches': [('r0', 'b', 2), ('r1', 'a', 3), ('r1', 'b', 4)], 'rejected': [('r0', 'a')], 'truncated': False})
    check('bounded patches', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r0','a'), [('r0','a')], [], 2), {'patches': [('r0', 'b', 2), ('r1', 'a', 3)], 'rejected': [('r0', 'a')], 'truncated': True})
    check('ragged and whitespace', solve(['r0','r1'], ['a','b','c'], [[0,' x '],['']], ('r0','a'), [], [], 9), {'patches': [('r0', 'a', 0), ('r0', 'b', ' x '), ('r1', 'a', '')], 'rejected': [], 'truncated': False})
    check('clipped edges', solve(['r0','r1'], ['a','b'], [[1,2],[3,4]], ('r1','b'), [], [], 9), {'patches': [('r1', 'b', 1)], 'rejected': [], 'truncated': False})
    check('hidden internal', solve(['r0'], ['a','b','c','d'], [[1,2,3]], ('r0','a'), [], ['b','c'], 9), {'patches': [('r0', 'a', 1), ('r0', 'd', 2)], 'rejected': [], 'truncated': False})
    check('budget no locks', solve(['r0'], ['a','b'], [[1,2]], ('r0','a'), [], [], 1), {'patches': [('r0', 'a', 1)], 'rejected': [], 'truncated': True})
    check('empty input', solve(['r0'], ['a'], [], ('r0','a'), [], [], 0), {'patches': [], 'rejected': [], 'truncated': False})

print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The table truncation report result violates the stipulated table clipboard paste mapping contract.

Paste maps source offsets to visible table coordinates starting at a stable cell; source raggedness is retained, table edges clip, readonly holes consume coordinates but not patch capacity, raw values remain unchanged, and truncation means an additional writable patch was omitted.

split: open-access


prompt:
The table inclusive fill row result violates the stipulated table fill handle repetition contract.

Fill repeats the source rectangle modulo its original row/column origin, excludes the source itself, respects axis constraints and individual readonly cells, clips targets to table bounds, and emits patches in row-major order.

split: open-access


prompt:
The table inclusive fill column result violates the stipulated table fill handle repetition contract.

Fill repeats the source rectangle modulo its original row/column origin, excludes the source itself, respects axis constraints and individual readonly cells, clips targets to table bounds, and emits patches in row-major order.

split: open-access


prompt:
The table source protection result violates the stipulated table fill handle repetition contract.

Fill repeats the source rectangle modulo its original row/column origin, excludes the source itself, respects axis constraints and individual readonly cells, clips targets to table bounds, and emits patches in row-major order.

split: open-access


prompt:
The table negative coordinate result violates the stipulated table fill handle repetition contract.

Fill repeats the source rectangle modulo its original row/column origin, excludes the source itself, respects axis constraints and individual readonly cells, clips targets to table bounds, and emits patches in row-major order.

split: open-access


prompt:
The table locked fill cell result violates the stipulated table fill handle repetition contract.

Fill repeats the source rectangle modulo its original row/column origin, excludes the source itself, respects axis constraints and individual readonly cells, clips targets to table bounds, and emits patches in row-major order.

split: open-access


prompt:
The table row pattern origin result violates the stipulated table fill handle repetition contract.

Fill repeats the source rectangle modulo its original row/column origin, excludes the source itself, respects axis constraints and individual readonly cells, clips targets to table bounds, and emits patches in row-major order.

split: open-access


prompt:
The table column pattern origin result violates the stipulated table fill handle repetition contract.

Fill repeats the source rectangle modulo its original row/column origin, excludes the source itself, respects axis constraints and individual readonly cells, clips targets to table bounds, and emits patches in row-major order.

split: open-access


prompt:
The table vertical axis lock result violates the stipulated table fill handle repetition contract.

Fill repeats the source rectangle modulo its original row/column origin, excludes the source itself, respects axis constraints and individual readonly cells, clips targets to table bounds, and emits patches in row-major order.

split: open-access


prompt:
The table horizontal axis lock result violates the stipulated table fill handle repetition contract.

Fill repeats the source rectangle modulo its original row/column origin, excludes the source itself, respects axis constraints and individual readonly cells, clips targets to table bounds, and emits patches in row-major order.

split: open-access


prompt:
The table fill value coordinate result violates the stipulated table fill handle repetition contract.

Fill repeats the source rectangle modulo its original row/column origin, excludes the source itself, respects axis constraints and individual readonly cells, clips targets to table bounds, and emits patches in row-major order.

split: open-access


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

N = 1
observations = []
def solve(order, moving, target, side, hidden, pinned, locked):
    block=[c for c in moving if c in order]
    if not block or target in block: return order
    if any(c in locked for c in block): return order
    if any(pinned.get(c,'center')!=pinned.get(target,'center') for c in block): return order
    visible=[c for c in order if c not in hidden]
    if target not in visible: return order
    remaining=[c for c in order if c not in block]
    index=(remaining.index(target) if target in remaining else 0)+(side=='after')
    return remaining[:index]+block+remaining[index:]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(1)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e1'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 2:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(2)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e2'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 3:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(3)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e3'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 4:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(4)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e4'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 5:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(5)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e5'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['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

N = 1
observations = []
def solve(order, moving, target, side, hidden, pinned, locked):
    block=[c for c in reversed(order) if c in moving]
    if not block or target in block: return order
    if any(c in locked for c in block): return order
    if any(pinned.get(c,'center')!=pinned.get(target,'center') for c in block): return order
    visible=[c for c in order if c not in hidden]
    if target not in visible: return order
    remaining=[c for c in order if c not in block]
    index=(remaining.index(target) if target in remaining else 0)+(side=='after')
    return remaining[:index]+block+remaining[index:]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(1)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e1'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 2:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(2)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e2'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 3:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(3)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e3'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 4:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(4)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e4'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 5:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(5)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e5'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['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:
The table drag block order result violates the stipulated table column drag transaction contract.

Move selected columns as a schema-ordered block relative to a visible nonmoving target, preserve hidden columns, reject any locked or pane-incompatible member, and compute insertion after removing the whole source block.

split: open-access


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

N = 1
observations = []
def solve(order, moving, target, side, hidden, pinned, locked):
    block=[c for c in order if c in moving]
    if not block: return order
    if any(c in locked for c in block): return order
    if any(pinned.get(c,'center')!=pinned.get(target,'center') for c in block): return order
    visible=[c for c in order if c not in hidden]
    if target not in visible: return order
    remaining=[c for c in order if c not in block]
    index=(remaining.index(target) if target in remaining else 0)+(side=='after')
    return remaining[:index]+block+remaining[index:]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(1)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e1'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 2:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(2)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e2'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 3:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(3)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e3'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 4:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(4)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e4'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 5:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(5)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e5'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['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

N = 1
observations = []
def solve(order, moving, target, side, hidden, pinned, locked):
    block=[c for c in order if c in moving]
    if not block or target==block[0]: return order
    if any(c in locked for c in block): return order
    if any(pinned.get(c,'center')!=pinned.get(target,'center') for c in block): return order
    visible=[c for c in order if c not in hidden]
    if target not in visible: return order
    remaining=[c for c in order if c not in block]
    index=(remaining.index(target) if target in remaining else 0)+(side=='after')
    return remaining[:index]+block+remaining[index:]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(1)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e1'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 2:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(2)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e2'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 3:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(3)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e3'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 4:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(4)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e4'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 5:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(5)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e5'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['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:
The table self drop result violates the stipulated table column drag transaction contract.

Move selected columns as a schema-ordered block relative to a visible nonmoving target, preserve hidden columns, reject any locked or pane-incompatible member, and compute insertion after removing the whole source block.

split: open-access


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

N = 1
observations = []
def solve(order, moving, target, side, hidden, pinned, locked):
    block=[c for c in order if c in moving]
    if not block or target in block: return order
    if False: return order
    if any(pinned.get(c,'center')!=pinned.get(target,'center') for c in block): return order
    visible=[c for c in order if c not in hidden]
    if target not in visible: return order
    remaining=[c for c in order if c not in block]
    index=(remaining.index(target) if target in remaining else 0)+(side=='after')
    return remaining[:index]+block+remaining[index:]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(1)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e1'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 2:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(2)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e2'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 3:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(3)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e3'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 4:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(4)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e4'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 5:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(5)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e5'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['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

N = 1
observations = []
def solve(order, moving, target, side, hidden, pinned, locked):
    block=[c for c in order if c in moving]
    if not block or target in block: return order
    if all(c in locked for c in block): return order
    if any(pinned.get(c,'center')!=pinned.get(target,'center') for c in block): return order
    visible=[c for c in order if c not in hidden]
    if target not in visible: return order
    remaining=[c for c in order if c not in block]
    index=(remaining.index(target) if target in remaining else 0)+(side=='after')
    return remaining[:index]+block+remaining[index:]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(1)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e1'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 2:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(2)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e2'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 3:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(3)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e3'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 4:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(4)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e4'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 5:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(5)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e5'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['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:
The table locked block member result violates the stipulated table column drag transaction contract.

Move selected columns as a schema-ordered block relative to a visible nonmoving target, preserve hidden columns, reject any locked or pane-incompatible member, and compute insertion after removing the whole source block.

split: open-access


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

N = 1
observations = []
def solve(order, moving, target, side, hidden, pinned, locked):
    block=[c for c in order if c in moving]
    if not block or target in block: return order
    if any(c in locked for c in block): return order
    if False: return order
    visible=[c for c in order if c not in hidden]
    if target not in visible: return order
    remaining=[c for c in order if c not in block]
    index=(remaining.index(target) if target in remaining else 0)+(side=='after')
    return remaining[:index]+block+remaining[index:]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(1)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e1'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 2:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(2)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e2'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 3:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(3)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e3'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 4:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(4)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e4'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 5:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(5)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e5'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['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

N = 1
observations = []
def solve(order, moving, target, side, hidden, pinned, locked):
    block=[c for c in order if c in moving]
    if not block or target in block: return order
    if any(c in locked for c in block): return order
    if pinned.get(block[0],'center')!=pinned.get(target,'center'): return order
    visible=[c for c in order if c not in hidden]
    if target not in visible: return order
    remaining=[c for c in order if c not in block]
    index=(remaining.index(target) if target in remaining else 0)+(side=='after')
    return remaining[:index]+block+remaining[index:]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(1)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e1'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 2:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(2)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e2'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 3:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(3)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e3'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 4:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(4)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e4'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 5:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(5)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e5'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['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:
The table pane compatibility result violates the stipulated table column drag transaction contract.

Move selected columns as a schema-ordered block relative to a visible nonmoving target, preserve hidden columns, reject any locked or pane-incompatible member, and compute insertion after removing the whole source block.

split: open-access


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

N = 1
observations = []
def solve(order, moving, target, side, hidden, pinned, locked):
    block=[c for c in order if c in moving]
    if not block or target in block: return order
    if any(c in locked for c in block): return order
    if any(pinned.get(c,'center')!=pinned.get(target,'center') for c in block): return order
    visible=[c for c in order if True]
    if target not in visible: return order
    remaining=[c for c in order if c not in block]
    index=(remaining.index(target) if target in remaining else 0)+(side=='after')
    return remaining[:index]+block+remaining[index:]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(1)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e1'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 2:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(2)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e2'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 3:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(3)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e3'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 4:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(4)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e4'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 5:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(5)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e5'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['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

N = 1
observations = []
def solve(order, moving, target, side, hidden, pinned, locked):
    block=[c for c in order if c in moving]
    if not block or target in block: return order
    if any(c in locked for c in block): return order
    if any(pinned.get(c,'center')!=pinned.get(target,'center') for c in block): return order
    visible=[c for c in order if c not in hidden[:1]]
    if target not in visible: return order
    remaining=[c for c in order if c not in block]
    index=(remaining.index(target) if target in remaining else 0)+(side=='after')
    return remaining[:index]+block+remaining[index:]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(1)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e1'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 2:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(2)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e2'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 3:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(3)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e3'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 4:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(4)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e4'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['a'])

if N == 5:
    check('discontiguous selected columns', solve(['a','b','c','d','e'+str(5)], ['c','a'], 'd', 'after', [], {}, []), ['b', 'd', 'a', 'c', 'e5'])
    check('before target', solve(['a','b','c','d'], ['d'], 'b', 'before', [], {}, []), ['a', 'd', 'b', 'c'])
    check('self drop on second', solve(['a','b','c'], ['a','c'], 'c', 'before', [], {}, []), ['a', 'b', 'c'])
    check('mixed locked block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {}, ['b']), ['a', 'b', 'c'])
    check('mixed pane block', solve(['a','b','c'], ['a','b'], 'c', 'after', [], {'b':'left'}, []), ['a', 'b', 'c'])
    check('hidden target', solve(['a','b','c','d'], ['a'], 'c', 'after', ['b','c'], {}, []), ['a', 'b', 'c', 'd'])
    check('no drag', solve(['a'], [], 'a', 'before', [], {}, []), ['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:
The table visible drop target result violates the stipulated table column drag transaction contract.

Move selected columns as a schema-ordered block relative to a visible nonmoving target, preserve hidden columns, reject any locked or pane-incompatible member, and compute insertion after removing the whole source block.

split: open-access