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

N = 1
observations = []
def solve(p):
    p = dict(p)
    left_count = max(0,min(p["start"]+p["count"],p["split"])-p["start"])
    right_count = p["count"]-left_count
    left_start = p["a"]+p["start"]*p["b"]
    right_local = max(p["start"],p["split"])-p["split"]
    right_start = p["bbase"]+right_local*p["b"]
    left_bytes = left_count*p["b"]
    right_bytes = right_count*p["b"]
    spans = [[left_start,left_bytes],[right_start,right_bytes]]
    destination_offsets = [0,left_bytes] if left_count and right_count else ([0] if p["count"] else [])
    total_bytes = sum(s[1] for s in spans)
    return {'left_count': left_count, 'right_count': right_count, 'left_start': left_start, 'right_local': right_local, 'right_start': right_start, 'left_bytes': left_bytes, 'right_bytes': right_bytes, 'spans': spans, 'destination_offsets': destination_offsets, 'total_bytes': total_bytes}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'width': 12, 'split': 4, 'start': 0, 'count': 0, 'b': 2, 'a': 107, 'bbase': 400}, {'left_count': 0, 'right_count': 0, 'left_start': 107, 'right_local': 0, 'right_start': 400, 'left_bytes': 0, 'right_bytes': 0, 'spans': [], 'destination_offsets': [], 'total_bytes': 0}), ({'width': 13, 'split': 5, 'start': 1, 'count': 2, 'b': 2, 'a': 107, 'bbase': 413}, {'left_count': 2, 'right_count': 0, 'left_start': 109, 'right_local': 0, 'right_start': 413, 'left_bytes': 4, 'right_bytes': 0, 'spans': [[109, 4]], 'destination_offsets': [0], 'total_bytes': 4}), ({'width': 14, 'split': 6, 'start': 2, 'count': 6, 'b': 2, 'a': 107, 'bbase': 426}, {'left_count': 4, 'right_count': 2, 'left_start': 111, 'right_local': 0, 'right_start': 426, 'left_bytes': 8, 'right_bytes': 4, 'spans': [[111, 8], [426, 4]], 'destination_offsets': [0, 8], 'total_bytes': 12}), ({'width': 15, 'split': 4, 'start': 5, 'count': 4, 'b': 2, 'a': 107, 'bbase': 439}, {'left_count': 0, 'right_count': 4, 'left_start': 117, 'right_local': 1, 'right_start': 441, 'left_bytes': 0, 'right_bytes': 8, 'spans': [[441, 8]], 'destination_offsets': [0], 'total_bytes': 8}), ({'width': 16, 'split': 5, 'start': 0, 'count': 12, 'b': 2, 'a': 107, 'bbase': 452}, {'left_count': 5, 'right_count': 7, 'left_start': 107, 'right_local': 0, 'right_start': 452, 'left_bytes': 10, 'right_bytes': 14, 'spans': [[107, 10], [452, 14]], 'destination_offsets': [0, 10], 'total_bytes': 24}), ({'width': 17, 'split': 6, 'start': 6, 'count': 3, 'b': 2, 'a': 107, 'bbase': 465}, {'left_count': 0, 'right_count': 3, 'left_start': 119, 'right_local': 0, 'right_start': 465, 'left_bytes': 0, 'right_bytes': 6, 'spans': [[465, 6]], 'destination_offsets': [0], 'total_bytes': 6})], 2: [({'width': 12, 'split': 4, 'start': 0, 'count': 0, 'b': 3, 'a': 114, 'bbase': 400}, {'left_count': 0, 'right_count': 0, 'left_start': 114, 'right_local': 0, 'right_start': 400, 'left_bytes': 0, 'right_bytes': 0, 'spans': [], 'destination_offsets': [], 'total_bytes': 0}), ({'width': 13, 'split': 5, 'start': 1, 'count': 2, 'b': 3, 'a': 114, 'bbase': 413}, {'left_count': 2, 'right_count': 0, 'left_start': 117, 'right_local': 0, 'right_start': 413, 'left_bytes': 6, 'right_bytes': 0, 'spans': [[117, 6]], 'destination_offsets': [0], 'total_bytes': 6}), ({'width': 14, 'split': 6, 'start': 2, 'count': 6, 'b': 3, 'a': 114, 'bbase': 426}, {'left_count': 4, 'right_count': 2, 'left_start': 120, 'right_local': 0, 'right_start': 426, 'left_bytes': 12, 'right_bytes': 6, 'spans': [[120, 12], [426, 6]], 'destination_offsets': [0, 12], 'total_bytes': 18}), ({'width': 15, 'split': 4, 'start': 5, 'count': 4, 'b': 3, 'a': 114, 'bbase': 439}, {'left_count': 0, 'right_count': 4, 'left_start': 129, 'right_local': 1, 'right_start': 442, 'left_bytes': 0, 'right_bytes': 12, 'spans': [[442, 12]], 'destination_offsets': [0], 'total_bytes': 12}), ({'width': 16, 'split': 5, 'start': 0, 'count': 12, 'b': 3, 'a': 114, 'bbase': 452}, {'left_count': 5, 'right_count': 7, 'left_start': 114, 'right_local': 0, 'right_start': 452, 'left_bytes': 15, 'right_bytes': 21, 'spans': [[114, 15], [452, 21]], 'destination_offsets': [0, 15], 'total_bytes': 36}), ({'width': 17, 'split': 6, 'start': 6, 'count': 3, 'b': 3, 'a': 114, 'bbase': 465}, {'left_count': 0, 'right_count': 3, 'left_start': 132, 'right_local': 0, 'right_start': 465, 'left_bytes': 0, 'right_bytes': 9, 'spans': [[465, 9]], 'destination_offsets': [0], 'total_bytes': 9})], 3: [({'width': 12, 'split': 4, 'start': 0, 'count': 0, 'b': 4, 'a': 121, 'bbase': 400}, {'left_count': 0, 'right_count': 0, 'left_start': 121, 'right_local': 0, 'right_start': 400, 'left_bytes': 0, 'right_bytes': 0, 'spans': [], 'destination_offsets': [], 'total_bytes': 0}), ({'width': 13, 'split': 5, 'start': 1, 'count': 2, 'b': 4, 'a': 121, 'bbase': 413}, {'left_count': 2, 'right_count': 0, 'left_start': 125, 'right_local': 0, 'right_start': 413, 'left_bytes': 8, 'right_bytes': 0, 'spans': [[125, 8]], 'destination_offsets': [0], 'total_bytes': 8}), ({'width': 14, 'split': 6, 'start': 2, 'count': 6, 'b': 4, 'a': 121, 'bbase': 426}, {'left_count': 4, 'right_count': 2, 'left_start': 129, 'right_local': 0, 'right_start': 426, 'left_bytes': 16, 'right_bytes': 8, 'spans': [[129, 16], [426, 8]], 'destination_offsets': [0, 16], 'total_bytes': 24}), ({'width': 15, 'split': 4, 'start': 5, 'count': 4, 'b': 4, 'a': 121, 'bbase': 439}, {'left_count': 0, 'right_count': 4, 'left_start': 141, 'right_local': 1, 'right_start': 443, 'left_bytes': 0, 'right_bytes': 16, 'spans': [[443, 16]], 'destination_offsets': [0], 'total_bytes': 16}), ({'width': 16, 'split': 5, 'start': 0, 'count': 12, 'b': 4, 'a': 121, 'bbase': 452}, {'left_count': 5, 'right_count': 7, 'left_start': 121, 'right_local': 0, 'right_start': 452, 'left_bytes': 20, 'right_bytes': 28, 'spans': [[121, 20], [452, 28]], 'destination_offsets': [0, 20], 'total_bytes': 48}), ({'width': 17, 'split': 6, 'start': 6, 'count': 3, 'b': 4, 'a': 121, 'bbase': 465}, {'left_count': 0, 'right_count': 3, 'left_start': 145, 'right_local': 0, 'right_start': 465, 'left_bytes': 0, 'right_bytes': 12, 'spans': [[465, 12]], 'destination_offsets': [0], 'total_bytes': 12})], 4: [({'width': 12, 'split': 4, 'start': 0, 'count': 0, 'b': 5, 'a': 128, 'bbase': 400}, {'left_count': 0, 'right_count': 0, 'left_start': 128, 'right_local': 0, 'right_start': 400, 'left_bytes': 0, 'right_bytes': 0, 'spans': [], 'destination_offsets': [], 'total_bytes': 0}), ({'width': 13, 'split': 5, 'start': 1, 'count': 2, 'b': 5, 'a': 128, 'bbase': 413}, {'left_count': 2, 'right_count': 0, 'left_start': 133, 'right_local': 0, 'right_start': 413, 'left_bytes': 10, 'right_bytes': 0, 'spans': [[133, 10]], 'destination_offsets': [0], 'total_bytes': 10}), ({'width': 14, 'split': 6, 'start': 2, 'count': 6, 'b': 5, 'a': 128, 'bbase': 426}, {'left_count': 4, 'right_count': 2, 'left_start': 138, 'right_local': 0, 'right_start': 426, 'left_bytes': 20, 'right_bytes': 10, 'spans': [[138, 20], [426, 10]], 'destination_offsets': [0, 20], 'total_bytes': 30}), ({'width': 15, 'split': 4, 'start': 5, 'count': 4, 'b': 5, 'a': 128, 'bbase': 439}, {'left_count': 0, 'right_count': 4, 'left_start': 153, 'right_local': 1, 'right_start': 444, 'left_bytes': 0, 'right_bytes': 20, 'spans': [[444, 20]], 'destination_offsets': [0], 'total_bytes': 20}), ({'width': 16, 'split': 5, 'start': 0, 'count': 12, 'b': 5, 'a': 128, 'bbase': 452}, {'left_count': 5, 'right_count': 7, 'left_start': 128, 'right_local': 0, 'right_start': 452, 'left_bytes': 25, 'right_bytes': 35, 'spans': [[128, 25], [452, 35]], 'destination_offsets': [0, 25], 'total_bytes': 60}), ({'width': 17, 'split': 6, 'start': 6, 'count': 3, 'b': 5, 'a': 128, 'bbase': 465}, {'left_count': 0, 'right_count': 3, 'left_start': 158, 'right_local': 0, 'right_start': 465, 'left_bytes': 0, 'right_bytes': 15, 'spans': [[465, 15]], 'destination_offsets': [0], 'total_bytes': 15})], 5: [({'width': 12, 'split': 4, 'start': 0, 'count': 0, 'b': 6, 'a': 135, 'bbase': 400}, {'left_count': 0, 'right_count': 0, 'left_start': 135, 'right_local': 0, 'right_start': 400, 'left_bytes': 0, 'right_bytes': 0, 'spans': [], 'destination_offsets': [], 'total_bytes': 0}), ({'width': 13, 'split': 5, 'start': 1, 'count': 2, 'b': 6, 'a': 135, 'bbase': 413}, {'left_count': 2, 'right_count': 0, 'left_start': 141, 'right_local': 0, 'right_start': 413, 'left_bytes': 12, 'right_bytes': 0, 'spans': [[141, 12]], 'destination_offsets': [0], 'total_bytes': 12}), ({'width': 14, 'split': 6, 'start': 2, 'count': 6, 'b': 6, 'a': 135, 'bbase': 426}, {'left_count': 4, 'right_count': 2, 'left_start': 147, 'right_local': 0, 'right_start': 426, 'left_bytes': 24, 'right_bytes': 12, 'spans': [[147, 24], [426, 12]], 'destination_offsets': [0, 24], 'total_bytes': 36}), ({'width': 15, 'split': 4, 'start': 5, 'count': 4, 'b': 6, 'a': 135, 'bbase': 439}, {'left_count': 0, 'right_count': 4, 'left_start': 165, 'right_local': 1, 'right_start': 445, 'left_bytes': 0, 'right_bytes': 24, 'spans': [[445, 24]], 'destination_offsets': [0], 'total_bytes': 24}), ({'width': 16, 'split': 5, 'start': 0, 'count': 12, 'b': 6, 'a': 135, 'bbase': 452}, {'left_count': 5, 'right_count': 7, 'left_start': 135, 'right_local': 0, 'right_start': 452, 'left_bytes': 30, 'right_bytes': 42, 'spans': [[135, 30], [452, 42]], 'destination_offsets': [0, 30], 'total_bytes': 72}), ({'width': 17, 'split': 6, 'start': 6, 'count': 3, 'b': 6, 'a': 135, 'bbase': 465}, {'left_count': 0, 'right_count': 3, 'left_start': 171, 'right_local': 0, 'right_start': 465, 'left_bytes': 0, 'right_bytes': 18, 'spans': [[465, 18]], 'destination_offsets': [0], 'total_bytes': 18})]}
for i, (p, expected) in enumerate(cases[N]):
    check("layout fixture " + str(i + 1), solve(p), expected)
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(p):
    p = dict(p)
    left_count = max(0,min(p["start"]+p["count"],p["split"])-p["start"])
    right_count = p["count"]-left_count
    left_start = p["a"]+p["start"]*p["b"]
    right_local = max(p["start"],p["split"])-p["split"]
    right_start = p["bbase"]+right_local*p["b"]
    left_bytes = left_count*p["b"]
    right_bytes = right_count*p["b"]
    spans = ([[right_start,right_bytes]] if right_count else [])+([[left_start,left_bytes]] if left_count else [])
    destination_offsets = [0,left_bytes] if left_count and right_count else ([0] if p["count"] else [])
    total_bytes = sum(s[1] for s in spans)
    return {'left_count': left_count, 'right_count': right_count, 'left_start': left_start, 'right_local': right_local, 'right_start': right_start, 'left_bytes': left_bytes, 'right_bytes': right_bytes, 'spans': spans, 'destination_offsets': destination_offsets, 'total_bytes': total_bytes}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'width': 12, 'split': 4, 'start': 0, 'count': 0, 'b': 2, 'a': 107, 'bbase': 400}, {'left_count': 0, 'right_count': 0, 'left_start': 107, 'right_local': 0, 'right_start': 400, 'left_bytes': 0, 'right_bytes': 0, 'spans': [], 'destination_offsets': [], 'total_bytes': 0}), ({'width': 13, 'split': 5, 'start': 1, 'count': 2, 'b': 2, 'a': 107, 'bbase': 413}, {'left_count': 2, 'right_count': 0, 'left_start': 109, 'right_local': 0, 'right_start': 413, 'left_bytes': 4, 'right_bytes': 0, 'spans': [[109, 4]], 'destination_offsets': [0], 'total_bytes': 4}), ({'width': 14, 'split': 6, 'start': 2, 'count': 6, 'b': 2, 'a': 107, 'bbase': 426}, {'left_count': 4, 'right_count': 2, 'left_start': 111, 'right_local': 0, 'right_start': 426, 'left_bytes': 8, 'right_bytes': 4, 'spans': [[111, 8], [426, 4]], 'destination_offsets': [0, 8], 'total_bytes': 12}), ({'width': 15, 'split': 4, 'start': 5, 'count': 4, 'b': 2, 'a': 107, 'bbase': 439}, {'left_count': 0, 'right_count': 4, 'left_start': 117, 'right_local': 1, 'right_start': 441, 'left_bytes': 0, 'right_bytes': 8, 'spans': [[441, 8]], 'destination_offsets': [0], 'total_bytes': 8}), ({'width': 16, 'split': 5, 'start': 0, 'count': 12, 'b': 2, 'a': 107, 'bbase': 452}, {'left_count': 5, 'right_count': 7, 'left_start': 107, 'right_local': 0, 'right_start': 452, 'left_bytes': 10, 'right_bytes': 14, 'spans': [[107, 10], [452, 14]], 'destination_offsets': [0, 10], 'total_bytes': 24}), ({'width': 17, 'split': 6, 'start': 6, 'count': 3, 'b': 2, 'a': 107, 'bbase': 465}, {'left_count': 0, 'right_count': 3, 'left_start': 119, 'right_local': 0, 'right_start': 465, 'left_bytes': 0, 'right_bytes': 6, 'spans': [[465, 6]], 'destination_offsets': [0], 'total_bytes': 6})], 2: [({'width': 12, 'split': 4, 'start': 0, 'count': 0, 'b': 3, 'a': 114, 'bbase': 400}, {'left_count': 0, 'right_count': 0, 'left_start': 114, 'right_local': 0, 'right_start': 400, 'left_bytes': 0, 'right_bytes': 0, 'spans': [], 'destination_offsets': [], 'total_bytes': 0}), ({'width': 13, 'split': 5, 'start': 1, 'count': 2, 'b': 3, 'a': 114, 'bbase': 413}, {'left_count': 2, 'right_count': 0, 'left_start': 117, 'right_local': 0, 'right_start': 413, 'left_bytes': 6, 'right_bytes': 0, 'spans': [[117, 6]], 'destination_offsets': [0], 'total_bytes': 6}), ({'width': 14, 'split': 6, 'start': 2, 'count': 6, 'b': 3, 'a': 114, 'bbase': 426}, {'left_count': 4, 'right_count': 2, 'left_start': 120, 'right_local': 0, 'right_start': 426, 'left_bytes': 12, 'right_bytes': 6, 'spans': [[120, 12], [426, 6]], 'destination_offsets': [0, 12], 'total_bytes': 18}), ({'width': 15, 'split': 4, 'start': 5, 'count': 4, 'b': 3, 'a': 114, 'bbase': 439}, {'left_count': 0, 'right_count': 4, 'left_start': 129, 'right_local': 1, 'right_start': 442, 'left_bytes': 0, 'right_bytes': 12, 'spans': [[442, 12]], 'destination_offsets': [0], 'total_bytes': 12}), ({'width': 16, 'split': 5, 'start': 0, 'count': 12, 'b': 3, 'a': 114, 'bbase': 452}, {'left_count': 5, 'right_count': 7, 'left_start': 114, 'right_local': 0, 'right_start': 452, 'left_bytes': 15, 'right_bytes': 21, 'spans': [[114, 15], [452, 21]], 'destination_offsets': [0, 15], 'total_bytes': 36}), ({'width': 17, 'split': 6, 'start': 6, 'count': 3, 'b': 3, 'a': 114, 'bbase': 465}, {'left_count': 0, 'right_count': 3, 'left_start': 132, 'right_local': 0, 'right_start': 465, 'left_bytes': 0, 'right_bytes': 9, 'spans': [[465, 9]], 'destination_offsets': [0], 'total_bytes': 9})], 3: [({'width': 12, 'split': 4, 'start': 0, 'count': 0, 'b': 4, 'a': 121, 'bbase': 400}, {'left_count': 0, 'right_count': 0, 'left_start': 121, 'right_local': 0, 'right_start': 400, 'left_bytes': 0, 'right_bytes': 0, 'spans': [], 'destination_offsets': [], 'total_bytes': 0}), ({'width': 13, 'split': 5, 'start': 1, 'count': 2, 'b': 4, 'a': 121, 'bbase': 413}, {'left_count': 2, 'right_count': 0, 'left_start': 125, 'right_local': 0, 'right_start': 413, 'left_bytes': 8, 'right_bytes': 0, 'spans': [[125, 8]], 'destination_offsets': [0], 'total_bytes': 8}), ({'width': 14, 'split': 6, 'start': 2, 'count': 6, 'b': 4, 'a': 121, 'bbase': 426}, {'left_count': 4, 'right_count': 2, 'left_start': 129, 'right_local': 0, 'right_start': 426, 'left_bytes': 16, 'right_bytes': 8, 'spans': [[129, 16], [426, 8]], 'destination_offsets': [0, 16], 'total_bytes': 24}), ({'width': 15, 'split': 4, 'start': 5, 'count': 4, 'b': 4, 'a': 121, 'bbase': 439}, {'left_count': 0, 'right_count': 4, 'left_start': 141, 'right_local': 1, 'right_start': 443, 'left_bytes': 0, 'right_bytes': 16, 'spans': [[443, 16]], 'destination_offsets': [0], 'total_bytes': 16}), ({'width': 16, 'split': 5, 'start': 0, 'count': 12, 'b': 4, 'a': 121, 'bbase': 452}, {'left_count': 5, 'right_count': 7, 'left_start': 121, 'right_local': 0, 'right_start': 452, 'left_bytes': 20, 'right_bytes': 28, 'spans': [[121, 20], [452, 28]], 'destination_offsets': [0, 20], 'total_bytes': 48}), ({'width': 17, 'split': 6, 'start': 6, 'count': 3, 'b': 4, 'a': 121, 'bbase': 465}, {'left_count': 0, 'right_count': 3, 'left_start': 145, 'right_local': 0, 'right_start': 465, 'left_bytes': 0, 'right_bytes': 12, 'spans': [[465, 12]], 'destination_offsets': [0], 'total_bytes': 12})], 4: [({'width': 12, 'split': 4, 'start': 0, 'count': 0, 'b': 5, 'a': 128, 'bbase': 400}, {'left_count': 0, 'right_count': 0, 'left_start': 128, 'right_local': 0, 'right_start': 400, 'left_bytes': 0, 'right_bytes': 0, 'spans': [], 'destination_offsets': [], 'total_bytes': 0}), ({'width': 13, 'split': 5, 'start': 1, 'count': 2, 'b': 5, 'a': 128, 'bbase': 413}, {'left_count': 2, 'right_count': 0, 'left_start': 133, 'right_local': 0, 'right_start': 413, 'left_bytes': 10, 'right_bytes': 0, 'spans': [[133, 10]], 'destination_offsets': [0], 'total_bytes': 10}), ({'width': 14, 'split': 6, 'start': 2, 'count': 6, 'b': 5, 'a': 128, 'bbase': 426}, {'left_count': 4, 'right_count': 2, 'left_start': 138, 'right_local': 0, 'right_start': 426, 'left_bytes': 20, 'right_bytes': 10, 'spans': [[138, 20], [426, 10]], 'destination_offsets': [0, 20], 'total_bytes': 30}), ({'width': 15, 'split': 4, 'start': 5, 'count': 4, 'b': 5, 'a': 128, 'bbase': 439}, {'left_count': 0, 'right_count': 4, 'left_start': 153, 'right_local': 1, 'right_start': 444, 'left_bytes': 0, 'right_bytes': 20, 'spans': [[444, 20]], 'destination_offsets': [0], 'total_bytes': 20}), ({'width': 16, 'split': 5, 'start': 0, 'count': 12, 'b': 5, 'a': 128, 'bbase': 452}, {'left_count': 5, 'right_count': 7, 'left_start': 128, 'right_local': 0, 'right_start': 452, 'left_bytes': 25, 'right_bytes': 35, 'spans': [[128, 25], [452, 35]], 'destination_offsets': [0, 25], 'total_bytes': 60}), ({'width': 17, 'split': 6, 'start': 6, 'count': 3, 'b': 5, 'a': 128, 'bbase': 465}, {'left_count': 0, 'right_count': 3, 'left_start': 158, 'right_local': 0, 'right_start': 465, 'left_bytes': 0, 'right_bytes': 15, 'spans': [[465, 15]], 'destination_offsets': [0], 'total_bytes': 15})], 5: [({'width': 12, 'split': 4, 'start': 0, 'count': 0, 'b': 6, 'a': 135, 'bbase': 400}, {'left_count': 0, 'right_count': 0, 'left_start': 135, 'right_local': 0, 'right_start': 400, 'left_bytes': 0, 'right_bytes': 0, 'spans': [], 'destination_offsets': [], 'total_bytes': 0}), ({'width': 13, 'split': 5, 'start': 1, 'count': 2, 'b': 6, 'a': 135, 'bbase': 413}, {'left_count': 2, 'right_count': 0, 'left_start': 141, 'right_local': 0, 'right_start': 413, 'left_bytes': 12, 'right_bytes': 0, 'spans': [[141, 12]], 'destination_offsets': [0], 'total_bytes': 12}), ({'width': 14, 'split': 6, 'start': 2, 'count': 6, 'b': 6, 'a': 135, 'bbase': 426}, {'left_count': 4, 'right_count': 2, 'left_start': 147, 'right_local': 0, 'right_start': 426, 'left_bytes': 24, 'right_bytes': 12, 'spans': [[147, 24], [426, 12]], 'destination_offsets': [0, 24], 'total_bytes': 36}), ({'width': 15, 'split': 4, 'start': 5, 'count': 4, 'b': 6, 'a': 135, 'bbase': 439}, {'left_count': 0, 'right_count': 4, 'left_start': 165, 'right_local': 1, 'right_start': 445, 'left_bytes': 0, 'right_bytes': 24, 'spans': [[445, 24]], 'destination_offsets': [0], 'total_bytes': 24}), ({'width': 16, 'split': 5, 'start': 0, 'count': 12, 'b': 6, 'a': 135, 'bbase': 452}, {'left_count': 5, 'right_count': 7, 'left_start': 135, 'right_local': 0, 'right_start': 452, 'left_bytes': 30, 'right_bytes': 42, 'spans': [[135, 30], [452, 42]], 'destination_offsets': [0, 30], 'total_bytes': 72}), ({'width': 17, 'split': 6, 'start': 6, 'count': 3, 'b': 6, 'a': 135, 'bbase': 465}, {'left_count': 0, 'right_count': 3, 'left_start': 171, 'right_local': 0, 'right_start': 465, 'left_bytes': 0, 'right_bytes': 18, 'spans': [[465, 18]], 'destination_offsets': [0], 'total_bytes': 18})]}
for i, (p, expected) in enumerate(cases[N]):
    check("layout fixture " + str(i + 1), solve(p), expected)
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 returned physical layout descriptor disagrees with the declared buffer mapping at spans.

A raster readback maps each row to two caller-provided physical segments. Segment boundary is a pixel index, not a byte count; segment two has its own noncontiguous origin. A requested valid x range becomes up to two byte spans. Return the named intermediate layout descriptor and final address fields; all quantities are integer byte offsets unless explicitly stated.

split: open-access


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

N = 1
observations = []
def solve(p):
    p = dict(p)
    left_count = max(0,min(p["start"]+p["count"],p["split"])-p["start"])
    right_count = p["count"]-left_count
    left_start = p["a"]+p["start"]*p["b"]
    right_local = max(p["start"],p["split"])-p["split"]
    right_start = p["bbase"]+right_local*p["b"]
    left_bytes = left_count*p["b"]
    right_bytes = right_count*p["b"]
    spans = ([[left_start,left_bytes]] if left_count else [])+([[right_start,right_bytes]] if right_count else [])
    destination_offsets = [0,0] if left_count and right_count else ([0] if p["count"] else [])
    total_bytes = sum(s[1] for s in spans)
    return {'left_count': left_count, 'right_count': right_count, 'left_start': left_start, 'right_local': right_local, 'right_start': right_start, 'left_bytes': left_bytes, 'right_bytes': right_bytes, 'spans': spans, 'destination_offsets': destination_offsets, 'total_bytes': total_bytes}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'width': 12, 'split': 4, 'start': 0, 'count': 0, 'b': 2, 'a': 107, 'bbase': 400}, {'left_count': 0, 'right_count': 0, 'left_start': 107, 'right_local': 0, 'right_start': 400, 'left_bytes': 0, 'right_bytes': 0, 'spans': [], 'destination_offsets': [], 'total_bytes': 0}), ({'width': 13, 'split': 5, 'start': 1, 'count': 2, 'b': 2, 'a': 107, 'bbase': 413}, {'left_count': 2, 'right_count': 0, 'left_start': 109, 'right_local': 0, 'right_start': 413, 'left_bytes': 4, 'right_bytes': 0, 'spans': [[109, 4]], 'destination_offsets': [0], 'total_bytes': 4}), ({'width': 14, 'split': 6, 'start': 2, 'count': 6, 'b': 2, 'a': 107, 'bbase': 426}, {'left_count': 4, 'right_count': 2, 'left_start': 111, 'right_local': 0, 'right_start': 426, 'left_bytes': 8, 'right_bytes': 4, 'spans': [[111, 8], [426, 4]], 'destination_offsets': [0, 8], 'total_bytes': 12}), ({'width': 15, 'split': 4, 'start': 5, 'count': 4, 'b': 2, 'a': 107, 'bbase': 439}, {'left_count': 0, 'right_count': 4, 'left_start': 117, 'right_local': 1, 'right_start': 441, 'left_bytes': 0, 'right_bytes': 8, 'spans': [[441, 8]], 'destination_offsets': [0], 'total_bytes': 8}), ({'width': 16, 'split': 5, 'start': 0, 'count': 12, 'b': 2, 'a': 107, 'bbase': 452}, {'left_count': 5, 'right_count': 7, 'left_start': 107, 'right_local': 0, 'right_start': 452, 'left_bytes': 10, 'right_bytes': 14, 'spans': [[107, 10], [452, 14]], 'destination_offsets': [0, 10], 'total_bytes': 24}), ({'width': 17, 'split': 6, 'start': 6, 'count': 3, 'b': 2, 'a': 107, 'bbase': 465}, {'left_count': 0, 'right_count': 3, 'left_start': 119, 'right_local': 0, 'right_start': 465, 'left_bytes': 0, 'right_bytes': 6, 'spans': [[465, 6]], 'destination_offsets': [0], 'total_bytes': 6})], 2: [({'width': 12, 'split': 4, 'start': 0, 'count': 0, 'b': 3, 'a': 114, 'bbase': 400}, {'left_count': 0, 'right_count': 0, 'left_start': 114, 'right_local': 0, 'right_start': 400, 'left_bytes': 0, 'right_bytes': 0, 'spans': [], 'destination_offsets': [], 'total_bytes': 0}), ({'width': 13, 'split': 5, 'start': 1, 'count': 2, 'b': 3, 'a': 114, 'bbase': 413}, {'left_count': 2, 'right_count': 0, 'left_start': 117, 'right_local': 0, 'right_start': 413, 'left_bytes': 6, 'right_bytes': 0, 'spans': [[117, 6]], 'destination_offsets': [0], 'total_bytes': 6}), ({'width': 14, 'split': 6, 'start': 2, 'count': 6, 'b': 3, 'a': 114, 'bbase': 426}, {'left_count': 4, 'right_count': 2, 'left_start': 120, 'right_local': 0, 'right_start': 426, 'left_bytes': 12, 'right_bytes': 6, 'spans': [[120, 12], [426, 6]], 'destination_offsets': [0, 12], 'total_bytes': 18}), ({'width': 15, 'split': 4, 'start': 5, 'count': 4, 'b': 3, 'a': 114, 'bbase': 439}, {'left_count': 0, 'right_count': 4, 'left_start': 129, 'right_local': 1, 'right_start': 442, 'left_bytes': 0, 'right_bytes': 12, 'spans': [[442, 12]], 'destination_offsets': [0], 'total_bytes': 12}), ({'width': 16, 'split': 5, 'start': 0, 'count': 12, 'b': 3, 'a': 114, 'bbase': 452}, {'left_count': 5, 'right_count': 7, 'left_start': 114, 'right_local': 0, 'right_start': 452, 'left_bytes': 15, 'right_bytes': 21, 'spans': [[114, 15], [452, 21]], 'destination_offsets': [0, 15], 'total_bytes': 36}), ({'width': 17, 'split': 6, 'start': 6, 'count': 3, 'b': 3, 'a': 114, 'bbase': 465}, {'left_count': 0, 'right_count': 3, 'left_start': 132, 'right_local': 0, 'right_start': 465, 'left_bytes': 0, 'right_bytes': 9, 'spans': [[465, 9]], 'destination_offsets': [0], 'total_bytes': 9})], 3: [({'width': 12, 'split': 4, 'start': 0, 'count': 0, 'b': 4, 'a': 121, 'bbase': 400}, {'left_count': 0, 'right_count': 0, 'left_start': 121, 'right_local': 0, 'right_start': 400, 'left_bytes': 0, 'right_bytes': 0, 'spans': [], 'destination_offsets': [], 'total_bytes': 0}), ({'width': 13, 'split': 5, 'start': 1, 'count': 2, 'b': 4, 'a': 121, 'bbase': 413}, {'left_count': 2, 'right_count': 0, 'left_start': 125, 'right_local': 0, 'right_start': 413, 'left_bytes': 8, 'right_bytes': 0, 'spans': [[125, 8]], 'destination_offsets': [0], 'total_bytes': 8}), ({'width': 14, 'split': 6, 'start': 2, 'count': 6, 'b': 4, 'a': 121, 'bbase': 426}, {'left_count': 4, 'right_count': 2, 'left_start': 129, 'right_local': 0, 'right_start': 426, 'left_bytes': 16, 'right_bytes': 8, 'spans': [[129, 16], [426, 8]], 'destination_offsets': [0, 16], 'total_bytes': 24}), ({'width': 15, 'split': 4, 'start': 5, 'count': 4, 'b': 4, 'a': 121, 'bbase': 439}, {'left_count': 0, 'right_count': 4, 'left_start': 141, 'right_local': 1, 'right_start': 443, 'left_bytes': 0, 'right_bytes': 16, 'spans': [[443, 16]], 'destination_offsets': [0], 'total_bytes': 16}), ({'width': 16, 'split': 5, 'start': 0, 'count': 12, 'b': 4, 'a': 121, 'bbase': 452}, {'left_count': 5, 'right_count': 7, 'left_start': 121, 'right_local': 0, 'right_start': 452, 'left_bytes': 20, 'right_bytes': 28, 'spans': [[121, 20], [452, 28]], 'destination_offsets': [0, 20], 'total_bytes': 48}), ({'width': 17, 'split': 6, 'start': 6, 'count': 3, 'b': 4, 'a': 121, 'bbase': 465}, {'left_count': 0, 'right_count': 3, 'left_start': 145, 'right_local': 0, 'right_start': 465, 'left_bytes': 0, 'right_bytes': 12, 'spans': [[465, 12]], 'destination_offsets': [0], 'total_bytes': 12})], 4: [({'width': 12, 'split': 4, 'start': 0, 'count': 0, 'b': 5, 'a': 128, 'bbase': 400}, {'left_count': 0, 'right_count': 0, 'left_start': 128, 'right_local': 0, 'right_start': 400, 'left_bytes': 0, 'right_bytes': 0, 'spans': [], 'destination_offsets': [], 'total_bytes': 0}), ({'width': 13, 'split': 5, 'start': 1, 'count': 2, 'b': 5, 'a': 128, 'bbase': 413}, {'left_count': 2, 'right_count': 0, 'left_start': 133, 'right_local': 0, 'right_start': 413, 'left_bytes': 10, 'right_bytes': 0, 'spans': [[133, 10]], 'destination_offsets': [0], 'total_bytes': 10}), ({'width': 14, 'split': 6, 'start': 2, 'count': 6, 'b': 5, 'a': 128, 'bbase': 426}, {'left_count': 4, 'right_count': 2, 'left_start': 138, 'right_local': 0, 'right_start': 426, 'left_bytes': 20, 'right_bytes': 10, 'spans': [[138, 20], [426, 10]], 'destination_offsets': [0, 20], 'total_bytes': 30}), ({'width': 15, 'split': 4, 'start': 5, 'count': 4, 'b': 5, 'a': 128, 'bbase': 439}, {'left_count': 0, 'right_count': 4, 'left_start': 153, 'right_local': 1, 'right_start': 444, 'left_bytes': 0, 'right_bytes': 20, 'spans': [[444, 20]], 'destination_offsets': [0], 'total_bytes': 20}), ({'width': 16, 'split': 5, 'start': 0, 'count': 12, 'b': 5, 'a': 128, 'bbase': 452}, {'left_count': 5, 'right_count': 7, 'left_start': 128, 'right_local': 0, 'right_start': 452, 'left_bytes': 25, 'right_bytes': 35, 'spans': [[128, 25], [452, 35]], 'destination_offsets': [0, 25], 'total_bytes': 60}), ({'width': 17, 'split': 6, 'start': 6, 'count': 3, 'b': 5, 'a': 128, 'bbase': 465}, {'left_count': 0, 'right_count': 3, 'left_start': 158, 'right_local': 0, 'right_start': 465, 'left_bytes': 0, 'right_bytes': 15, 'spans': [[465, 15]], 'destination_offsets': [0], 'total_bytes': 15})], 5: [({'width': 12, 'split': 4, 'start': 0, 'count': 0, 'b': 6, 'a': 135, 'bbase': 400}, {'left_count': 0, 'right_count': 0, 'left_start': 135, 'right_local': 0, 'right_start': 400, 'left_bytes': 0, 'right_bytes': 0, 'spans': [], 'destination_offsets': [], 'total_bytes': 0}), ({'width': 13, 'split': 5, 'start': 1, 'count': 2, 'b': 6, 'a': 135, 'bbase': 413}, {'left_count': 2, 'right_count': 0, 'left_start': 141, 'right_local': 0, 'right_start': 413, 'left_bytes': 12, 'right_bytes': 0, 'spans': [[141, 12]], 'destination_offsets': [0], 'total_bytes': 12}), ({'width': 14, 'split': 6, 'start': 2, 'count': 6, 'b': 6, 'a': 135, 'bbase': 426}, {'left_count': 4, 'right_count': 2, 'left_start': 147, 'right_local': 0, 'right_start': 426, 'left_bytes': 24, 'right_bytes': 12, 'spans': [[147, 24], [426, 12]], 'destination_offsets': [0, 24], 'total_bytes': 36}), ({'width': 15, 'split': 4, 'start': 5, 'count': 4, 'b': 6, 'a': 135, 'bbase': 439}, {'left_count': 0, 'right_count': 4, 'left_start': 165, 'right_local': 1, 'right_start': 445, 'left_bytes': 0, 'right_bytes': 24, 'spans': [[445, 24]], 'destination_offsets': [0], 'total_bytes': 24}), ({'width': 16, 'split': 5, 'start': 0, 'count': 12, 'b': 6, 'a': 135, 'bbase': 452}, {'left_count': 5, 'right_count': 7, 'left_start': 135, 'right_local': 0, 'right_start': 452, 'left_bytes': 30, 'right_bytes': 42, 'spans': [[135, 30], [452, 42]], 'destination_offsets': [0, 30], 'total_bytes': 72}), ({'width': 17, 'split': 6, 'start': 6, 'count': 3, 'b': 6, 'a': 135, 'bbase': 465}, {'left_count': 0, 'right_count': 3, 'left_start': 171, 'right_local': 0, 'right_start': 465, 'left_bytes': 0, 'right_bytes': 18, 'spans': [[465, 18]], 'destination_offsets': [0], 'total_bytes': 18})]}
for i, (p, expected) in enumerate(cases[N]):
    check("layout fixture " + str(i + 1), solve(p), expected)
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(p):
    p = dict(p)
    left_count = max(0,min(p["start"]+p["count"],p["split"])-p["start"])
    right_count = p["count"]-left_count
    left_start = p["a"]+p["start"]*p["b"]
    right_local = max(p["start"],p["split"])-p["split"]
    right_start = p["bbase"]+right_local*p["b"]
    left_bytes = left_count*p["b"]
    right_bytes = right_count*p["b"]
    spans = ([[left_start,left_bytes]] if left_count else [])+([[right_start,right_bytes]] if right_count else [])
    destination_offsets = [0,left_count] if left_count and right_count else ([0] if p["count"] else [])
    total_bytes = sum(s[1] for s in spans)
    return {'left_count': left_count, 'right_count': right_count, 'left_start': left_start, 'right_local': right_local, 'right_start': right_start, 'left_bytes': left_bytes, 'right_bytes': right_bytes, 'spans': spans, 'destination_offsets': destination_offsets, 'total_bytes': total_bytes}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'width': 12, 'split': 4, 'start': 0, 'count': 0, 'b': 2, 'a': 107, 'bbase': 400}, {'left_count': 0, 'right_count': 0, 'left_start': 107, 'right_local': 0, 'right_start': 400, 'left_bytes': 0, 'right_bytes': 0, 'spans': [], 'destination_offsets': [], 'total_bytes': 0}), ({'width': 13, 'split': 5, 'start': 1, 'count': 2, 'b': 2, 'a': 107, 'bbase': 413}, {'left_count': 2, 'right_count': 0, 'left_start': 109, 'right_local': 0, 'right_start': 413, 'left_bytes': 4, 'right_bytes': 0, 'spans': [[109, 4]], 'destination_offsets': [0], 'total_bytes': 4}), ({'width': 14, 'split': 6, 'start': 2, 'count': 6, 'b': 2, 'a': 107, 'bbase': 426}, {'left_count': 4, 'right_count': 2, 'left_start': 111, 'right_local': 0, 'right_start': 426, 'left_bytes': 8, 'right_bytes': 4, 'spans': [[111, 8], [426, 4]], 'destination_offsets': [0, 8], 'total_bytes': 12}), ({'width': 15, 'split': 4, 'start': 5, 'count': 4, 'b': 2, 'a': 107, 'bbase': 439}, {'left_count': 0, 'right_count': 4, 'left_start': 117, 'right_local': 1, 'right_start': 441, 'left_bytes': 0, 'right_bytes': 8, 'spans': [[441, 8]], 'destination_offsets': [0], 'total_bytes': 8}), ({'width': 16, 'split': 5, 'start': 0, 'count': 12, 'b': 2, 'a': 107, 'bbase': 452}, {'left_count': 5, 'right_count': 7, 'left_start': 107, 'right_local': 0, 'right_start': 452, 'left_bytes': 10, 'right_bytes': 14, 'spans': [[107, 10], [452, 14]], 'destination_offsets': [0, 10], 'total_bytes': 24}), ({'width': 17, 'split': 6, 'start': 6, 'count': 3, 'b': 2, 'a': 107, 'bbase': 465}, {'left_count': 0, 'right_count': 3, 'left_start': 119, 'right_local': 0, 'right_start': 465, 'left_bytes': 0, 'right_bytes': 6, 'spans': [[465, 6]], 'destination_offsets': [0], 'total_bytes': 6})], 2: [({'width': 12, 'split': 4, 'start': 0, 'count': 0, 'b': 3, 'a': 114, 'bbase': 400}, {'left_count': 0, 'right_count': 0, 'left_start': 114, 'right_local': 0, 'right_start': 400, 'left_bytes': 0, 'right_bytes': 0, 'spans': [], 'destination_offsets': [], 'total_bytes': 0}), ({'width': 13, 'split': 5, 'start': 1, 'count': 2, 'b': 3, 'a': 114, 'bbase': 413}, {'left_count': 2, 'right_count': 0, 'left_start': 117, 'right_local': 0, 'right_start': 413, 'left_bytes': 6, 'right_bytes': 0, 'spans': [[117, 6]], 'destination_offsets': [0], 'total_bytes': 6}), ({'width': 14, 'split': 6, 'start': 2, 'count': 6, 'b': 3, 'a': 114, 'bbase': 426}, {'left_count': 4, 'right_count': 2, 'left_start': 120, 'right_local': 0, 'right_start': 426, 'left_bytes': 12, 'right_bytes': 6, 'spans': [[120, 12], [426, 6]], 'destination_offsets': [0, 12], 'total_bytes': 18}), ({'width': 15, 'split': 4, 'start': 5, 'count': 4, 'b': 3, 'a': 114, 'bbase': 439}, {'left_count': 0, 'right_count': 4, 'left_start': 129, 'right_local': 1, 'right_start': 442, 'left_bytes': 0, 'right_bytes': 12, 'spans': [[442, 12]], 'destination_offsets': [0], 'total_bytes': 12}), ({'width': 16, 'split': 5, 'start': 0, 'count': 12, 'b': 3, 'a': 114, 'bbase': 452}, {'left_count': 5, 'right_count': 7, 'left_start': 114, 'right_local': 0, 'right_start': 452, 'left_bytes': 15, 'right_bytes': 21, 'spans': [[114, 15], [452, 21]], 'destination_offsets': [0, 15], 'total_bytes': 36}), ({'width': 17, 'split': 6, 'start': 6, 'count': 3, 'b': 3, 'a': 114, 'bbase': 465}, {'left_count': 0, 'right_count': 3, 'left_start': 132, 'right_local': 0, 'right_start': 465, 'left_bytes': 0, 'right_bytes': 9, 'spans': [[465, 9]], 'destination_offsets': [0], 'total_bytes': 9})], 3: [({'width': 12, 'split': 4, 'start': 0, 'count': 0, 'b': 4, 'a': 121, 'bbase': 400}, {'left_count': 0, 'right_count': 0, 'left_start': 121, 'right_local': 0, 'right_start': 400, 'left_bytes': 0, 'right_bytes': 0, 'spans': [], 'destination_offsets': [], 'total_bytes': 0}), ({'width': 13, 'split': 5, 'start': 1, 'count': 2, 'b': 4, 'a': 121, 'bbase': 413}, {'left_count': 2, 'right_count': 0, 'left_start': 125, 'right_local': 0, 'right_start': 413, 'left_bytes': 8, 'right_bytes': 0, 'spans': [[125, 8]], 'destination_offsets': [0], 'total_bytes': 8}), ({'width': 14, 'split': 6, 'start': 2, 'count': 6, 'b': 4, 'a': 121, 'bbase': 426}, {'left_count': 4, 'right_count': 2, 'left_start': 129, 'right_local': 0, 'right_start': 426, 'left_bytes': 16, 'right_bytes': 8, 'spans': [[129, 16], [426, 8]], 'destination_offsets': [0, 16], 'total_bytes': 24}), ({'width': 15, 'split': 4, 'start': 5, 'count': 4, 'b': 4, 'a': 121, 'bbase': 439}, {'left_count': 0, 'right_count': 4, 'left_start': 141, 'right_local': 1, 'right_start': 443, 'left_bytes': 0, 'right_bytes': 16, 'spans': [[443, 16]], 'destination_offsets': [0], 'total_bytes': 16}), ({'width': 16, 'split': 5, 'start': 0, 'count': 12, 'b': 4, 'a': 121, 'bbase': 452}, {'left_count': 5, 'right_count': 7, 'left_start': 121, 'right_local': 0, 'right_start': 452, 'left_bytes': 20, 'right_bytes': 28, 'spans': [[121, 20], [452, 28]], 'destination_offsets': [0, 20], 'total_bytes': 48}), ({'width': 17, 'split': 6, 'start': 6, 'count': 3, 'b': 4, 'a': 121, 'bbase': 465}, {'left_count': 0, 'right_count': 3, 'left_start': 145, 'right_local': 0, 'right_start': 465, 'left_bytes': 0, 'right_bytes': 12, 'spans': [[465, 12]], 'destination_offsets': [0], 'total_bytes': 12})], 4: [({'width': 12, 'split': 4, 'start': 0, 'count': 0, 'b': 5, 'a': 128, 'bbase': 400}, {'left_count': 0, 'right_count': 0, 'left_start': 128, 'right_local': 0, 'right_start': 400, 'left_bytes': 0, 'right_bytes': 0, 'spans': [], 'destination_offsets': [], 'total_bytes': 0}), ({'width': 13, 'split': 5, 'start': 1, 'count': 2, 'b': 5, 'a': 128, 'bbase': 413}, {'left_count': 2, 'right_count': 0, 'left_start': 133, 'right_local': 0, 'right_start': 413, 'left_bytes': 10, 'right_bytes': 0, 'spans': [[133, 10]], 'destination_offsets': [0], 'total_bytes': 10}), ({'width': 14, 'split': 6, 'start': 2, 'count': 6, 'b': 5, 'a': 128, 'bbase': 426}, {'left_count': 4, 'right_count': 2, 'left_start': 138, 'right_local': 0, 'right_start': 426, 'left_bytes': 20, 'right_bytes': 10, 'spans': [[138, 20], [426, 10]], 'destination_offsets': [0, 20], 'total_bytes': 30}), ({'width': 15, 'split': 4, 'start': 5, 'count': 4, 'b': 5, 'a': 128, 'bbase': 439}, {'left_count': 0, 'right_count': 4, 'left_start': 153, 'right_local': 1, 'right_start': 444, 'left_bytes': 0, 'right_bytes': 20, 'spans': [[444, 20]], 'destination_offsets': [0], 'total_bytes': 20}), ({'width': 16, 'split': 5, 'start': 0, 'count': 12, 'b': 5, 'a': 128, 'bbase': 452}, {'left_count': 5, 'right_count': 7, 'left_start': 128, 'right_local': 0, 'right_start': 452, 'left_bytes': 25, 'right_bytes': 35, 'spans': [[128, 25], [452, 35]], 'destination_offsets': [0, 25], 'total_bytes': 60}), ({'width': 17, 'split': 6, 'start': 6, 'count': 3, 'b': 5, 'a': 128, 'bbase': 465}, {'left_count': 0, 'right_count': 3, 'left_start': 158, 'right_local': 0, 'right_start': 465, 'left_bytes': 0, 'right_bytes': 15, 'spans': [[465, 15]], 'destination_offsets': [0], 'total_bytes': 15})], 5: [({'width': 12, 'split': 4, 'start': 0, 'count': 0, 'b': 6, 'a': 135, 'bbase': 400}, {'left_count': 0, 'right_count': 0, 'left_start': 135, 'right_local': 0, 'right_start': 400, 'left_bytes': 0, 'right_bytes': 0, 'spans': [], 'destination_offsets': [], 'total_bytes': 0}), ({'width': 13, 'split': 5, 'start': 1, 'count': 2, 'b': 6, 'a': 135, 'bbase': 413}, {'left_count': 2, 'right_count': 0, 'left_start': 141, 'right_local': 0, 'right_start': 413, 'left_bytes': 12, 'right_bytes': 0, 'spans': [[141, 12]], 'destination_offsets': [0], 'total_bytes': 12}), ({'width': 14, 'split': 6, 'start': 2, 'count': 6, 'b': 6, 'a': 135, 'bbase': 426}, {'left_count': 4, 'right_count': 2, 'left_start': 147, 'right_local': 0, 'right_start': 426, 'left_bytes': 24, 'right_bytes': 12, 'spans': [[147, 24], [426, 12]], 'destination_offsets': [0, 24], 'total_bytes': 36}), ({'width': 15, 'split': 4, 'start': 5, 'count': 4, 'b': 6, 'a': 135, 'bbase': 439}, {'left_count': 0, 'right_count': 4, 'left_start': 165, 'right_local': 1, 'right_start': 445, 'left_bytes': 0, 'right_bytes': 24, 'spans': [[445, 24]], 'destination_offsets': [0], 'total_bytes': 24}), ({'width': 16, 'split': 5, 'start': 0, 'count': 12, 'b': 6, 'a': 135, 'bbase': 452}, {'left_count': 5, 'right_count': 7, 'left_start': 135, 'right_local': 0, 'right_start': 452, 'left_bytes': 30, 'right_bytes': 42, 'spans': [[135, 30], [452, 42]], 'destination_offsets': [0, 30], 'total_bytes': 72}), ({'width': 17, 'split': 6, 'start': 6, 'count': 3, 'b': 6, 'a': 135, 'bbase': 465}, {'left_count': 0, 'right_count': 3, 'left_start': 171, 'right_local': 0, 'right_start': 465, 'left_bytes': 0, 'right_bytes': 18, 'spans': [[465, 18]], 'destination_offsets': [0], 'total_bytes': 18})]}
for i, (p, expected) in enumerate(cases[N]):
    check("layout fixture " + str(i + 1), solve(p), expected)
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 returned physical layout descriptor disagrees with the declared buffer mapping at destination_offsets.

A raster readback maps each row to two caller-provided physical segments. Segment boundary is a pixel index, not a byte count; segment two has its own noncontiguous origin. A requested valid x range becomes up to two byte spans. Return the named intermediate layout descriptor and final address fields; all quantities are integer byte offsets unless explicitly stated.

split: open-access


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

N = 1
observations = []
def solve(p):
    p = dict(p)
    left_count = max(0,min(p["start"]+p["count"],p["split"])-p["start"])
    right_count = p["count"]-left_count
    left_start = p["a"]+p["start"]*p["b"]
    right_local = max(p["start"],p["split"])-p["split"]
    right_start = p["bbase"]+right_local*p["b"]
    left_bytes = left_count*p["b"]
    right_bytes = right_count*p["b"]
    spans = ([[left_start,left_bytes]] if left_count else [])+([[right_start,right_bytes]] if right_count else [])
    destination_offsets = [0,left_bytes] if left_count and right_count else ([0] if p["count"] else [])
    total_bytes = p["width"]*p["b"]
    return {'left_count': left_count, 'right_count': right_count, 'left_start': left_start, 'right_local': right_local, 'right_start': right_start, 'left_bytes': left_bytes, 'right_bytes': right_bytes, 'spans': spans, 'destination_offsets': destination_offsets, 'total_bytes': total_bytes}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'width': 12, 'split': 4, 'start': 0, 'count': 0, 'b': 2, 'a': 107, 'bbase': 400}, {'left_count': 0, 'right_count': 0, 'left_start': 107, 'right_local': 0, 'right_start': 400, 'left_bytes': 0, 'right_bytes': 0, 'spans': [], 'destination_offsets': [], 'total_bytes': 0}), ({'width': 13, 'split': 5, 'start': 1, 'count': 2, 'b': 2, 'a': 107, 'bbase': 413}, {'left_count': 2, 'right_count': 0, 'left_start': 109, 'right_local': 0, 'right_start': 413, 'left_bytes': 4, 'right_bytes': 0, 'spans': [[109, 4]], 'destination_offsets': [0], 'total_bytes': 4}), ({'width': 14, 'split': 6, 'start': 2, 'count': 6, 'b': 2, 'a': 107, 'bbase': 426}, {'left_count': 4, 'right_count': 2, 'left_start': 111, 'right_local': 0, 'right_start': 426, 'left_bytes': 8, 'right_bytes': 4, 'spans': [[111, 8], [426, 4]], 'destination_offsets': [0, 8], 'total_bytes': 12}), ({'width': 15, 'split': 4, 'start': 5, 'count': 4, 'b': 2, 'a': 107, 'bbase': 439}, {'left_count': 0, 'right_count': 4, 'left_start': 117, 'right_local': 1, 'right_start': 441, 'left_bytes': 0, 'right_bytes': 8, 'spans': [[441, 8]], 'destination_offsets': [0], 'total_bytes': 8}), ({'width': 16, 'split': 5, 'start': 0, 'count': 12, 'b': 2, 'a': 107, 'bbase': 452}, {'left_count': 5, 'right_count': 7, 'left_start': 107, 'right_local': 0, 'right_start': 452, 'left_bytes': 10, 'right_bytes': 14, 'spans': [[107, 10], [452, 14]], 'destination_offsets': [0, 10], 'total_bytes': 24}), ({'width': 17, 'split': 6, 'start': 6, 'count': 3, 'b': 2, 'a': 107, 'bbase': 465}, {'left_count': 0, 'right_count': 3, 'left_start': 119, 'right_local': 0, 'right_start': 465, 'left_bytes': 0, 'right_bytes': 6, 'spans': [[465, 6]], 'destination_offsets': [0], 'total_bytes': 6})], 2: [({'width': 12, 'split': 4, 'start': 0, 'count': 0, 'b': 3, 'a': 114, 'bbase': 400}, {'left_count': 0, 'right_count': 0, 'left_start': 114, 'right_local': 0, 'right_start': 400, 'left_bytes': 0, 'right_bytes': 0, 'spans': [], 'destination_offsets': [], 'total_bytes': 0}), ({'width': 13, 'split': 5, 'start': 1, 'count': 2, 'b': 3, 'a': 114, 'bbase': 413}, {'left_count': 2, 'right_count': 0, 'left_start': 117, 'right_local': 0, 'right_start': 413, 'left_bytes': 6, 'right_bytes': 0, 'spans': [[117, 6]], 'destination_offsets': [0], 'total_bytes': 6}), ({'width': 14, 'split': 6, 'start': 2, 'count': 6, 'b': 3, 'a': 114, 'bbase': 426}, {'left_count': 4, 'right_count': 2, 'left_start': 120, 'right_local': 0, 'right_start': 426, 'left_bytes': 12, 'right_bytes': 6, 'spans': [[120, 12], [426, 6]], 'destination_offsets': [0, 12], 'total_bytes': 18}), ({'width': 15, 'split': 4, 'start': 5, 'count': 4, 'b': 3, 'a': 114, 'bbase': 439}, {'left_count': 0, 'right_count': 4, 'left_start': 129, 'right_local': 1, 'right_start': 442, 'left_bytes': 0, 'right_bytes': 12, 'spans': [[442, 12]], 'destination_offsets': [0], 'total_bytes': 12}), ({'width': 16, 'split': 5, 'start': 0, 'count': 12, 'b': 3, 'a': 114, 'bbase': 452}, {'left_count': 5, 'right_count': 7, 'left_start': 114, 'right_local': 0, 'right_start': 452, 'left_bytes': 15, 'right_bytes': 21, 'spans': [[114, 15], [452, 21]], 'destination_offsets': [0, 15], 'total_bytes': 36}), ({'width': 17, 'split': 6, 'start': 6, 'count': 3, 'b': 3, 'a': 114, 'bbase': 465}, {'left_count': 0, 'right_count': 3, 'left_start': 132, 'right_local': 0, 'right_start': 465, 'left_bytes': 0, 'right_bytes': 9, 'spans': [[465, 9]], 'destination_offsets': [0], 'total_bytes': 9})], 3: [({'width': 12, 'split': 4, 'start': 0, 'count': 0, 'b': 4, 'a': 121, 'bbase': 400}, {'left_count': 0, 'right_count': 0, 'left_start': 121, 'right_local': 0, 'right_start': 400, 'left_bytes': 0, 'right_bytes': 0, 'spans': [], 'destination_offsets': [], 'total_bytes': 0}), ({'width': 13, 'split': 5, 'start': 1, 'count': 2, 'b': 4, 'a': 121, 'bbase': 413}, {'left_count': 2, 'right_count': 0, 'left_start': 125, 'right_local': 0, 'right_start': 413, 'left_bytes': 8, 'right_bytes': 0, 'spans': [[125, 8]], 'destination_offsets': [0], 'total_bytes': 8}), ({'width': 14, 'split': 6, 'start': 2, 'count': 6, 'b': 4, 'a': 121, 'bbase': 426}, {'left_count': 4, 'right_count': 2, 'left_start': 129, 'right_local': 0, 'right_start': 426, 'left_bytes': 16, 'right_bytes': 8, 'spans': [[129, 16], [426, 8]], 'destination_offsets': [0, 16], 'total_bytes': 24}), ({'width': 15, 'split': 4, 'start': 5, 'count': 4, 'b': 4, 'a': 121, 'bbase': 439}, {'left_count': 0, 'right_count': 4, 'left_start': 141, 'right_local': 1, 'right_start': 443, 'left_bytes': 0, 'right_bytes': 16, 'spans': [[443, 16]], 'destination_offsets': [0], 'total_bytes': 16}), ({'width': 16, 'split': 5, 'start': 0, 'count': 12, 'b': 4, 'a': 121, 'bbase': 452}, {'left_count': 5, 'right_count': 7, 'left_start': 121, 'right_local': 0, 'right_start': 452, 'left_bytes': 20, 'right_bytes': 28, 'spans': [[121, 20], [452, 28]], 'destination_offsets': [0, 20], 'total_bytes': 48}), ({'width': 17, 'split': 6, 'start': 6, 'count': 3, 'b': 4, 'a': 121, 'bbase': 465}, {'left_count': 0, 'right_count': 3, 'left_start': 145, 'right_local': 0, 'right_start': 465, 'left_bytes': 0, 'right_bytes': 12, 'spans': [[465, 12]], 'destination_offsets': [0], 'total_bytes': 12})], 4: [({'width': 12, 'split': 4, 'start': 0, 'count': 0, 'b': 5, 'a': 128, 'bbase': 400}, {'left_count': 0, 'right_count': 0, 'left_start': 128, 'right_local': 0, 'right_start': 400, 'left_bytes': 0, 'right_bytes': 0, 'spans': [], 'destination_offsets': [], 'total_bytes': 0}), ({'width': 13, 'split': 5, 'start': 1, 'count': 2, 'b': 5, 'a': 128, 'bbase': 413}, {'left_count': 2, 'right_count': 0, 'left_start': 133, 'right_local': 0, 'right_start': 413, 'left_bytes': 10, 'right_bytes': 0, 'spans': [[133, 10]], 'destination_offsets': [0], 'total_bytes': 10}), ({'width': 14, 'split': 6, 'start': 2, 'count': 6, 'b': 5, 'a': 128, 'bbase': 426}, {'left_count': 4, 'right_count': 2, 'left_start': 138, 'right_local': 0, 'right_start': 426, 'left_bytes': 20, 'right_bytes': 10, 'spans': [[138, 20], [426, 10]], 'destination_offsets': [0, 20], 'total_bytes': 30}), ({'width': 15, 'split': 4, 'start': 5, 'count': 4, 'b': 5, 'a': 128, 'bbase': 439}, {'left_count': 0, 'right_count': 4, 'left_start': 153, 'right_local': 1, 'right_start': 444, 'left_bytes': 0, 'right_bytes': 20, 'spans': [[444, 20]], 'destination_offsets': [0], 'total_bytes': 20}), ({'width': 16, 'split': 5, 'start': 0, 'count': 12, 'b': 5, 'a': 128, 'bbase': 452}, {'left_count': 5, 'right_count': 7, 'left_start': 128, 'right_local': 0, 'right_start': 452, 'left_bytes': 25, 'right_bytes': 35, 'spans': [[128, 25], [452, 35]], 'destination_offsets': [0, 25], 'total_bytes': 60}), ({'width': 17, 'split': 6, 'start': 6, 'count': 3, 'b': 5, 'a': 128, 'bbase': 465}, {'left_count': 0, 'right_count': 3, 'left_start': 158, 'right_local': 0, 'right_start': 465, 'left_bytes': 0, 'right_bytes': 15, 'spans': [[465, 15]], 'destination_offsets': [0], 'total_bytes': 15})], 5: [({'width': 12, 'split': 4, 'start': 0, 'count': 0, 'b': 6, 'a': 135, 'bbase': 400}, {'left_count': 0, 'right_count': 0, 'left_start': 135, 'right_local': 0, 'right_start': 400, 'left_bytes': 0, 'right_bytes': 0, 'spans': [], 'destination_offsets': [], 'total_bytes': 0}), ({'width': 13, 'split': 5, 'start': 1, 'count': 2, 'b': 6, 'a': 135, 'bbase': 413}, {'left_count': 2, 'right_count': 0, 'left_start': 141, 'right_local': 0, 'right_start': 413, 'left_bytes': 12, 'right_bytes': 0, 'spans': [[141, 12]], 'destination_offsets': [0], 'total_bytes': 12}), ({'width': 14, 'split': 6, 'start': 2, 'count': 6, 'b': 6, 'a': 135, 'bbase': 426}, {'left_count': 4, 'right_count': 2, 'left_start': 147, 'right_local': 0, 'right_start': 426, 'left_bytes': 24, 'right_bytes': 12, 'spans': [[147, 24], [426, 12]], 'destination_offsets': [0, 24], 'total_bytes': 36}), ({'width': 15, 'split': 4, 'start': 5, 'count': 4, 'b': 6, 'a': 135, 'bbase': 439}, {'left_count': 0, 'right_count': 4, 'left_start': 165, 'right_local': 1, 'right_start': 445, 'left_bytes': 0, 'right_bytes': 24, 'spans': [[445, 24]], 'destination_offsets': [0], 'total_bytes': 24}), ({'width': 16, 'split': 5, 'start': 0, 'count': 12, 'b': 6, 'a': 135, 'bbase': 452}, {'left_count': 5, 'right_count': 7, 'left_start': 135, 'right_local': 0, 'right_start': 452, 'left_bytes': 30, 'right_bytes': 42, 'spans': [[135, 30], [452, 42]], 'destination_offsets': [0, 30], 'total_bytes': 72}), ({'width': 17, 'split': 6, 'start': 6, 'count': 3, 'b': 6, 'a': 135, 'bbase': 465}, {'left_count': 0, 'right_count': 3, 'left_start': 171, 'right_local': 0, 'right_start': 465, 'left_bytes': 0, 'right_bytes': 18, 'spans': [[465, 18]], 'destination_offsets': [0], 'total_bytes': 18})]}
for i, (p, expected) in enumerate(cases[N]):
    check("layout fixture " + str(i + 1), solve(p), expected)
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(p):
    p = dict(p)
    left_count = max(0,min(p["start"]+p["count"],p["split"])-p["start"])
    right_count = p["count"]-left_count
    left_start = p["a"]+p["start"]*p["b"]
    right_local = max(p["start"],p["split"])-p["split"]
    right_start = p["bbase"]+right_local*p["b"]
    left_bytes = left_count*p["b"]
    right_bytes = right_count*p["b"]
    spans = ([[left_start,left_bytes]] if left_count else [])+([[right_start,right_bytes]] if right_count else [])
    destination_offsets = [0,left_bytes] if left_count and right_count else ([0] if p["count"] else [])
    total_bytes = sum(s[0] for s in spans)
    return {'left_count': left_count, 'right_count': right_count, 'left_start': left_start, 'right_local': right_local, 'right_start': right_start, 'left_bytes': left_bytes, 'right_bytes': right_bytes, 'spans': spans, 'destination_offsets': destination_offsets, 'total_bytes': total_bytes}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'width': 12, 'split': 4, 'start': 0, 'count': 0, 'b': 2, 'a': 107, 'bbase': 400}, {'left_count': 0, 'right_count': 0, 'left_start': 107, 'right_local': 0, 'right_start': 400, 'left_bytes': 0, 'right_bytes': 0, 'spans': [], 'destination_offsets': [], 'total_bytes': 0}), ({'width': 13, 'split': 5, 'start': 1, 'count': 2, 'b': 2, 'a': 107, 'bbase': 413}, {'left_count': 2, 'right_count': 0, 'left_start': 109, 'right_local': 0, 'right_start': 413, 'left_bytes': 4, 'right_bytes': 0, 'spans': [[109, 4]], 'destination_offsets': [0], 'total_bytes': 4}), ({'width': 14, 'split': 6, 'start': 2, 'count': 6, 'b': 2, 'a': 107, 'bbase': 426}, {'left_count': 4, 'right_count': 2, 'left_start': 111, 'right_local': 0, 'right_start': 426, 'left_bytes': 8, 'right_bytes': 4, 'spans': [[111, 8], [426, 4]], 'destination_offsets': [0, 8], 'total_bytes': 12}), ({'width': 15, 'split': 4, 'start': 5, 'count': 4, 'b': 2, 'a': 107, 'bbase': 439}, {'left_count': 0, 'right_count': 4, 'left_start': 117, 'right_local': 1, 'right_start': 441, 'left_bytes': 0, 'right_bytes': 8, 'spans': [[441, 8]], 'destination_offsets': [0], 'total_bytes': 8}), ({'width': 16, 'split': 5, 'start': 0, 'count': 12, 'b': 2, 'a': 107, 'bbase': 452}, {'left_count': 5, 'right_count': 7, 'left_start': 107, 'right_local': 0, 'right_start': 452, 'left_bytes': 10, 'right_bytes': 14, 'spans': [[107, 10], [452, 14]], 'destination_offsets': [0, 10], 'total_bytes': 24}), ({'width': 17, 'split': 6, 'start': 6, 'count': 3, 'b': 2, 'a': 107, 'bbase': 465}, {'left_count': 0, 'right_count': 3, 'left_start': 119, 'right_local': 0, 'right_start': 465, 'left_bytes': 0, 'right_bytes': 6, 'spans': [[465, 6]], 'destination_offsets': [0], 'total_bytes': 6})], 2: [({'width': 12, 'split': 4, 'start': 0, 'count': 0, 'b': 3, 'a': 114, 'bbase': 400}, {'left_count': 0, 'right_count': 0, 'left_start': 114, 'right_local': 0, 'right_start': 400, 'left_bytes': 0, 'right_bytes': 0, 'spans': [], 'destination_offsets': [], 'total_bytes': 0}), ({'width': 13, 'split': 5, 'start': 1, 'count': 2, 'b': 3, 'a': 114, 'bbase': 413}, {'left_count': 2, 'right_count': 0, 'left_start': 117, 'right_local': 0, 'right_start': 413, 'left_bytes': 6, 'right_bytes': 0, 'spans': [[117, 6]], 'destination_offsets': [0], 'total_bytes': 6}), ({'width': 14, 'split': 6, 'start': 2, 'count': 6, 'b': 3, 'a': 114, 'bbase': 426}, {'left_count': 4, 'right_count': 2, 'left_start': 120, 'right_local': 0, 'right_start': 426, 'left_bytes': 12, 'right_bytes': 6, 'spans': [[120, 12], [426, 6]], 'destination_offsets': [0, 12], 'total_bytes': 18}), ({'width': 15, 'split': 4, 'start': 5, 'count': 4, 'b': 3, 'a': 114, 'bbase': 439}, {'left_count': 0, 'right_count': 4, 'left_start': 129, 'right_local': 1, 'right_start': 442, 'left_bytes': 0, 'right_bytes': 12, 'spans': [[442, 12]], 'destination_offsets': [0], 'total_bytes': 12}), ({'width': 16, 'split': 5, 'start': 0, 'count': 12, 'b': 3, 'a': 114, 'bbase': 452}, {'left_count': 5, 'right_count': 7, 'left_start': 114, 'right_local': 0, 'right_start': 452, 'left_bytes': 15, 'right_bytes': 21, 'spans': [[114, 15], [452, 21]], 'destination_offsets': [0, 15], 'total_bytes': 36}), ({'width': 17, 'split': 6, 'start': 6, 'count': 3, 'b': 3, 'a': 114, 'bbase': 465}, {'left_count': 0, 'right_count': 3, 'left_start': 132, 'right_local': 0, 'right_start': 465, 'left_bytes': 0, 'right_bytes': 9, 'spans': [[465, 9]], 'destination_offsets': [0], 'total_bytes': 9})], 3: [({'width': 12, 'split': 4, 'start': 0, 'count': 0, 'b': 4, 'a': 121, 'bbase': 400}, {'left_count': 0, 'right_count': 0, 'left_start': 121, 'right_local': 0, 'right_start': 400, 'left_bytes': 0, 'right_bytes': 0, 'spans': [], 'destination_offsets': [], 'total_bytes': 0}), ({'width': 13, 'split': 5, 'start': 1, 'count': 2, 'b': 4, 'a': 121, 'bbase': 413}, {'left_count': 2, 'right_count': 0, 'left_start': 125, 'right_local': 0, 'right_start': 413, 'left_bytes': 8, 'right_bytes': 0, 'spans': [[125, 8]], 'destination_offsets': [0], 'total_bytes': 8}), ({'width': 14, 'split': 6, 'start': 2, 'count': 6, 'b': 4, 'a': 121, 'bbase': 426}, {'left_count': 4, 'right_count': 2, 'left_start': 129, 'right_local': 0, 'right_start': 426, 'left_bytes': 16, 'right_bytes': 8, 'spans': [[129, 16], [426, 8]], 'destination_offsets': [0, 16], 'total_bytes': 24}), ({'width': 15, 'split': 4, 'start': 5, 'count': 4, 'b': 4, 'a': 121, 'bbase': 439}, {'left_count': 0, 'right_count': 4, 'left_start': 141, 'right_local': 1, 'right_start': 443, 'left_bytes': 0, 'right_bytes': 16, 'spans': [[443, 16]], 'destination_offsets': [0], 'total_bytes': 16}), ({'width': 16, 'split': 5, 'start': 0, 'count': 12, 'b': 4, 'a': 121, 'bbase': 452}, {'left_count': 5, 'right_count': 7, 'left_start': 121, 'right_local': 0, 'right_start': 452, 'left_bytes': 20, 'right_bytes': 28, 'spans': [[121, 20], [452, 28]], 'destination_offsets': [0, 20], 'total_bytes': 48}), ({'width': 17, 'split': 6, 'start': 6, 'count': 3, 'b': 4, 'a': 121, 'bbase': 465}, {'left_count': 0, 'right_count': 3, 'left_start': 145, 'right_local': 0, 'right_start': 465, 'left_bytes': 0, 'right_bytes': 12, 'spans': [[465, 12]], 'destination_offsets': [0], 'total_bytes': 12})], 4: [({'width': 12, 'split': 4, 'start': 0, 'count': 0, 'b': 5, 'a': 128, 'bbase': 400}, {'left_count': 0, 'right_count': 0, 'left_start': 128, 'right_local': 0, 'right_start': 400, 'left_bytes': 0, 'right_bytes': 0, 'spans': [], 'destination_offsets': [], 'total_bytes': 0}), ({'width': 13, 'split': 5, 'start': 1, 'count': 2, 'b': 5, 'a': 128, 'bbase': 413}, {'left_count': 2, 'right_count': 0, 'left_start': 133, 'right_local': 0, 'right_start': 413, 'left_bytes': 10, 'right_bytes': 0, 'spans': [[133, 10]], 'destination_offsets': [0], 'total_bytes': 10}), ({'width': 14, 'split': 6, 'start': 2, 'count': 6, 'b': 5, 'a': 128, 'bbase': 426}, {'left_count': 4, 'right_count': 2, 'left_start': 138, 'right_local': 0, 'right_start': 426, 'left_bytes': 20, 'right_bytes': 10, 'spans': [[138, 20], [426, 10]], 'destination_offsets': [0, 20], 'total_bytes': 30}), ({'width': 15, 'split': 4, 'start': 5, 'count': 4, 'b': 5, 'a': 128, 'bbase': 439}, {'left_count': 0, 'right_count': 4, 'left_start': 153, 'right_local': 1, 'right_start': 444, 'left_bytes': 0, 'right_bytes': 20, 'spans': [[444, 20]], 'destination_offsets': [0], 'total_bytes': 20}), ({'width': 16, 'split': 5, 'start': 0, 'count': 12, 'b': 5, 'a': 128, 'bbase': 452}, {'left_count': 5, 'right_count': 7, 'left_start': 128, 'right_local': 0, 'right_start': 452, 'left_bytes': 25, 'right_bytes': 35, 'spans': [[128, 25], [452, 35]], 'destination_offsets': [0, 25], 'total_bytes': 60}), ({'width': 17, 'split': 6, 'start': 6, 'count': 3, 'b': 5, 'a': 128, 'bbase': 465}, {'left_count': 0, 'right_count': 3, 'left_start': 158, 'right_local': 0, 'right_start': 465, 'left_bytes': 0, 'right_bytes': 15, 'spans': [[465, 15]], 'destination_offsets': [0], 'total_bytes': 15})], 5: [({'width': 12, 'split': 4, 'start': 0, 'count': 0, 'b': 6, 'a': 135, 'bbase': 400}, {'left_count': 0, 'right_count': 0, 'left_start': 135, 'right_local': 0, 'right_start': 400, 'left_bytes': 0, 'right_bytes': 0, 'spans': [], 'destination_offsets': [], 'total_bytes': 0}), ({'width': 13, 'split': 5, 'start': 1, 'count': 2, 'b': 6, 'a': 135, 'bbase': 413}, {'left_count': 2, 'right_count': 0, 'left_start': 141, 'right_local': 0, 'right_start': 413, 'left_bytes': 12, 'right_bytes': 0, 'spans': [[141, 12]], 'destination_offsets': [0], 'total_bytes': 12}), ({'width': 14, 'split': 6, 'start': 2, 'count': 6, 'b': 6, 'a': 135, 'bbase': 426}, {'left_count': 4, 'right_count': 2, 'left_start': 147, 'right_local': 0, 'right_start': 426, 'left_bytes': 24, 'right_bytes': 12, 'spans': [[147, 24], [426, 12]], 'destination_offsets': [0, 24], 'total_bytes': 36}), ({'width': 15, 'split': 4, 'start': 5, 'count': 4, 'b': 6, 'a': 135, 'bbase': 439}, {'left_count': 0, 'right_count': 4, 'left_start': 165, 'right_local': 1, 'right_start': 445, 'left_bytes': 0, 'right_bytes': 24, 'spans': [[445, 24]], 'destination_offsets': [0], 'total_bytes': 24}), ({'width': 16, 'split': 5, 'start': 0, 'count': 12, 'b': 6, 'a': 135, 'bbase': 452}, {'left_count': 5, 'right_count': 7, 'left_start': 135, 'right_local': 0, 'right_start': 452, 'left_bytes': 30, 'right_bytes': 42, 'spans': [[135, 30], [452, 42]], 'destination_offsets': [0, 30], 'total_bytes': 72}), ({'width': 17, 'split': 6, 'start': 6, 'count': 3, 'b': 6, 'a': 135, 'bbase': 465}, {'left_count': 0, 'right_count': 3, 'left_start': 171, 'right_local': 0, 'right_start': 465, 'left_bytes': 0, 'right_bytes': 18, 'spans': [[465, 18]], 'destination_offsets': [0], 'total_bytes': 18})]}
for i, (p, expected) in enumerate(cases[N]):
    check("layout fixture " + str(i + 1), solve(p), expected)
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 returned physical layout descriptor disagrees with the declared buffer mapping at total_bytes.

A raster readback maps each row to two caller-provided physical segments. Segment boundary is a pixel index, not a byte count; segment two has its own noncontiguous origin. A requested valid x range becomes up to two byte spans. Return the named intermediate layout descriptor and final address fields; all quantities are integer byte offsets unless explicitly stated.

split: open-access


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

N = 1
observations = []
def solve(p):
    p = dict(p)
    cell = p["tile"]
    cell_xy = [cell%5,cell//5]
    row_pitch = 5*6*p["b"]
    cell_origin = p["base"]+cell_xy[1]*6*row_pitch+cell_xy[0]*6*p["b"]
    interior_origin = cell_origin+row_pitch+p["b"]
    address = interior_origin+p["local_y"]*row_pitch+p["local_x"]*p["b"]
    left_border = cell_origin+(p["local_y"]+1)*row_pitch
    right_border = cell_origin+(p["local_y"]+1)*row_pitch+5*p["b"]
    top_border = cell_origin+(p["local_x"]+1)*p["b"]
    bottom_border = cell_origin+5*row_pitch+(p["local_x"]+1)*p["b"]
    return {'cell': cell, 'cell_xy': cell_xy, 'row_pitch': row_pitch, 'cell_origin': cell_origin, 'interior_origin': interior_origin, 'address': address, 'left_border': left_border, 'right_border': right_border, 'top_border': top_border, 'bottom_border': bottom_border}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'tile': 0, 'local_x': 1, 'local_y': 1, 'b': 2, 'base': 11, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 7, 'cell_xy': [2, 1], 'row_pitch': 60, 'cell_origin': 395, 'interior_origin': 457, 'address': 519, 'left_border': 515, 'right_border': 525, 'top_border': 399, 'bottom_border': 699}), ({'tile': 1, 'local_x': 2, 'local_y': 3, 'b': 2, 'base': 11, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 0, 'cell_xy': [0, 0], 'row_pitch': 60, 'cell_origin': 11, 'interior_origin': 73, 'address': 257, 'left_border': 251, 'right_border': 261, 'top_border': 17, 'bottom_border': 317}), ({'tile': 2, 'local_x': 3, 'local_y': 1, 'b': 2, 'base': 11, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 9, 'cell_xy': [4, 1], 'row_pitch': 60, 'cell_origin': 419, 'interior_origin': 481, 'address': 547, 'left_border': 539, 'right_border': 549, 'top_border': 427, 'bottom_border': 727}), ({'tile': 3, 'local_x': 0, 'local_y': 3, 'b': 2, 'base': 11, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 3, 'cell_xy': [3, 0], 'row_pitch': 60, 'cell_origin': 47, 'interior_origin': 109, 'address': 289, 'left_border': 287, 'right_border': 297, 'top_border': 49, 'bottom_border': 349}), ({'tile': 4, 'local_x': 1, 'local_y': 1, 'b': 2, 'base': 11, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 11, 'cell_xy': [1, 2], 'row_pitch': 60, 'cell_origin': 743, 'interior_origin': 805, 'address': 867, 'left_border': 863, 'right_border': 873, 'top_border': 747, 'bottom_border': 1047}), ({'tile': 5, 'local_x': 2, 'local_y': 3, 'b': 2, 'base': 11, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 5, 'cell_xy': [0, 1], 'row_pitch': 60, 'cell_origin': 371, 'interior_origin': 433, 'address': 617, 'left_border': 611, 'right_border': 621, 'top_border': 377, 'bottom_border': 677})], 2: [({'tile': 0, 'local_x': 2, 'local_y': 2, 'b': 3, 'base': 22, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 7, 'cell_xy': [2, 1], 'row_pitch': 90, 'cell_origin': 598, 'interior_origin': 691, 'address': 877, 'left_border': 868, 'right_border': 883, 'top_border': 607, 'bottom_border': 1057}), ({'tile': 1, 'local_x': 3, 'local_y': 0, 'b': 3, 'base': 22, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 0, 'cell_xy': [0, 0], 'row_pitch': 90, 'cell_origin': 22, 'interior_origin': 115, 'address': 124, 'left_border': 112, 'right_border': 127, 'top_border': 34, 'bottom_border': 484}), ({'tile': 2, 'local_x': 0, 'local_y': 2, 'b': 3, 'base': 22, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 9, 'cell_xy': [4, 1], 'row_pitch': 90, 'cell_origin': 634, 'interior_origin': 727, 'address': 907, 'left_border': 904, 'right_border': 919, 'top_border': 637, 'bottom_border': 1087}), ({'tile': 3, 'local_x': 1, 'local_y': 0, 'b': 3, 'base': 22, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 3, 'cell_xy': [3, 0], 'row_pitch': 90, 'cell_origin': 76, 'interior_origin': 169, 'address': 172, 'left_border': 166, 'right_border': 181, 'top_border': 82, 'bottom_border': 532}), ({'tile': 4, 'local_x': 2, 'local_y': 2, 'b': 3, 'base': 22, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 11, 'cell_xy': [1, 2], 'row_pitch': 90, 'cell_origin': 1120, 'interior_origin': 1213, 'address': 1399, 'left_border': 1390, 'right_border': 1405, 'top_border': 1129, 'bottom_border': 1579}), ({'tile': 5, 'local_x': 3, 'local_y': 0, 'b': 3, 'base': 22, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 5, 'cell_xy': [0, 1], 'row_pitch': 90, 'cell_origin': 562, 'interior_origin': 655, 'address': 664, 'left_border': 652, 'right_border': 667, 'top_border': 574, 'bottom_border': 1024})], 3: [({'tile': 0, 'local_x': 3, 'local_y': 3, 'b': 4, 'base': 33, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 7, 'cell_xy': [2, 1], 'row_pitch': 120, 'cell_origin': 801, 'interior_origin': 925, 'address': 1297, 'left_border': 1281, 'right_border': 1301, 'top_border': 817, 'bottom_border': 1417}), ({'tile': 1, 'local_x': 0, 'local_y': 1, 'b': 4, 'base': 33, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 0, 'cell_xy': [0, 0], 'row_pitch': 120, 'cell_origin': 33, 'interior_origin': 157, 'address': 277, 'left_border': 273, 'right_border': 293, 'top_border': 37, 'bottom_border': 637}), ({'tile': 2, 'local_x': 1, 'local_y': 3, 'b': 4, 'base': 33, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 9, 'cell_xy': [4, 1], 'row_pitch': 120, 'cell_origin': 849, 'interior_origin': 973, 'address': 1337, 'left_border': 1329, 'right_border': 1349, 'top_border': 857, 'bottom_border': 1457}), ({'tile': 3, 'local_x': 2, 'local_y': 1, 'b': 4, 'base': 33, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 3, 'cell_xy': [3, 0], 'row_pitch': 120, 'cell_origin': 105, 'interior_origin': 229, 'address': 357, 'left_border': 345, 'right_border': 365, 'top_border': 117, 'bottom_border': 717}), ({'tile': 4, 'local_x': 3, 'local_y': 3, 'b': 4, 'base': 33, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 11, 'cell_xy': [1, 2], 'row_pitch': 120, 'cell_origin': 1497, 'interior_origin': 1621, 'address': 1993, 'left_border': 1977, 'right_border': 1997, 'top_border': 1513, 'bottom_border': 2113}), ({'tile': 5, 'local_x': 0, 'local_y': 1, 'b': 4, 'base': 33, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 5, 'cell_xy': [0, 1], 'row_pitch': 120, 'cell_origin': 753, 'interior_origin': 877, 'address': 997, 'left_border': 993, 'right_border': 1013, 'top_border': 757, 'bottom_border': 1357})], 4: [({'tile': 0, 'local_x': 0, 'local_y': 0, 'b': 5, 'base': 44, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 7, 'cell_xy': [2, 1], 'row_pitch': 150, 'cell_origin': 1004, 'interior_origin': 1159, 'address': 1159, 'left_border': 1154, 'right_border': 1179, 'top_border': 1009, 'bottom_border': 1759}), ({'tile': 1, 'local_x': 1, 'local_y': 2, 'b': 5, 'base': 44, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 0, 'cell_xy': [0, 0], 'row_pitch': 150, 'cell_origin': 44, 'interior_origin': 199, 'address': 504, 'left_border': 494, 'right_border': 519, 'top_border': 54, 'bottom_border': 804}), ({'tile': 2, 'local_x': 2, 'local_y': 0, 'b': 5, 'base': 44, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 9, 'cell_xy': [4, 1], 'row_pitch': 150, 'cell_origin': 1064, 'interior_origin': 1219, 'address': 1229, 'left_border': 1214, 'right_border': 1239, 'top_border': 1079, 'bottom_border': 1829}), ({'tile': 3, 'local_x': 3, 'local_y': 2, 'b': 5, 'base': 44, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 3, 'cell_xy': [3, 0], 'row_pitch': 150, 'cell_origin': 134, 'interior_origin': 289, 'address': 604, 'left_border': 584, 'right_border': 609, 'top_border': 154, 'bottom_border': 904}), ({'tile': 4, 'local_x': 0, 'local_y': 0, 'b': 5, 'base': 44, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 11, 'cell_xy': [1, 2], 'row_pitch': 150, 'cell_origin': 1874, 'interior_origin': 2029, 'address': 2029, 'left_border': 2024, 'right_border': 2049, 'top_border': 1879, 'bottom_border': 2629}), ({'tile': 5, 'local_x': 1, 'local_y': 2, 'b': 5, 'base': 44, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 5, 'cell_xy': [0, 1], 'row_pitch': 150, 'cell_origin': 944, 'interior_origin': 1099, 'address': 1404, 'left_border': 1394, 'right_border': 1419, 'top_border': 954, 'bottom_border': 1704})], 5: [({'tile': 0, 'local_x': 1, 'local_y': 1, 'b': 6, 'base': 55, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 7, 'cell_xy': [2, 1], 'row_pitch': 180, 'cell_origin': 1207, 'interior_origin': 1393, 'address': 1579, 'left_border': 1567, 'right_border': 1597, 'top_border': 1219, 'bottom_border': 2119}), ({'tile': 1, 'local_x': 2, 'local_y': 3, 'b': 6, 'base': 55, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 0, 'cell_xy': [0, 0], 'row_pitch': 180, 'cell_origin': 55, 'interior_origin': 241, 'address': 793, 'left_border': 775, 'right_border': 805, 'top_border': 73, 'bottom_border': 973}), ({'tile': 2, 'local_x': 3, 'local_y': 1, 'b': 6, 'base': 55, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 9, 'cell_xy': [4, 1], 'row_pitch': 180, 'cell_origin': 1279, 'interior_origin': 1465, 'address': 1663, 'left_border': 1639, 'right_border': 1669, 'top_border': 1303, 'bottom_border': 2203}), ({'tile': 3, 'local_x': 0, 'local_y': 3, 'b': 6, 'base': 55, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 3, 'cell_xy': [3, 0], 'row_pitch': 180, 'cell_origin': 163, 'interior_origin': 349, 'address': 889, 'left_border': 883, 'right_border': 913, 'top_border': 169, 'bottom_border': 1069}), ({'tile': 4, 'local_x': 1, 'local_y': 1, 'b': 6, 'base': 55, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 11, 'cell_xy': [1, 2], 'row_pitch': 180, 'cell_origin': 2251, 'interior_origin': 2437, 'address': 2623, 'left_border': 2611, 'right_border': 2641, 'top_border': 2263, 'bottom_border': 3163}), ({'tile': 5, 'local_x': 2, 'local_y': 3, 'b': 6, 'base': 55, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 5, 'cell_xy': [0, 1], 'row_pitch': 180, 'cell_origin': 1135, 'interior_origin': 1321, 'address': 1873, 'left_border': 1855, 'right_border': 1885, 'top_border': 1153, 'bottom_border': 2053})]}
for i, (p, expected) in enumerate(cases[N]):
    check("layout fixture " + str(i + 1), solve(p), expected)
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(p):
    p = dict(p)
    cell = p["remap"][p["tile"]]%5
    cell_xy = [cell%5,cell//5]
    row_pitch = 5*6*p["b"]
    cell_origin = p["base"]+cell_xy[1]*6*row_pitch+cell_xy[0]*6*p["b"]
    interior_origin = cell_origin+row_pitch+p["b"]
    address = interior_origin+p["local_y"]*row_pitch+p["local_x"]*p["b"]
    left_border = cell_origin+(p["local_y"]+1)*row_pitch
    right_border = cell_origin+(p["local_y"]+1)*row_pitch+5*p["b"]
    top_border = cell_origin+(p["local_x"]+1)*p["b"]
    bottom_border = cell_origin+5*row_pitch+(p["local_x"]+1)*p["b"]
    return {'cell': cell, 'cell_xy': cell_xy, 'row_pitch': row_pitch, 'cell_origin': cell_origin, 'interior_origin': interior_origin, 'address': address, 'left_border': left_border, 'right_border': right_border, 'top_border': top_border, 'bottom_border': bottom_border}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'tile': 0, 'local_x': 1, 'local_y': 1, 'b': 2, 'base': 11, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 7, 'cell_xy': [2, 1], 'row_pitch': 60, 'cell_origin': 395, 'interior_origin': 457, 'address': 519, 'left_border': 515, 'right_border': 525, 'top_border': 399, 'bottom_border': 699}), ({'tile': 1, 'local_x': 2, 'local_y': 3, 'b': 2, 'base': 11, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 0, 'cell_xy': [0, 0], 'row_pitch': 60, 'cell_origin': 11, 'interior_origin': 73, 'address': 257, 'left_border': 251, 'right_border': 261, 'top_border': 17, 'bottom_border': 317}), ({'tile': 2, 'local_x': 3, 'local_y': 1, 'b': 2, 'base': 11, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 9, 'cell_xy': [4, 1], 'row_pitch': 60, 'cell_origin': 419, 'interior_origin': 481, 'address': 547, 'left_border': 539, 'right_border': 549, 'top_border': 427, 'bottom_border': 727}), ({'tile': 3, 'local_x': 0, 'local_y': 3, 'b': 2, 'base': 11, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 3, 'cell_xy': [3, 0], 'row_pitch': 60, 'cell_origin': 47, 'interior_origin': 109, 'address': 289, 'left_border': 287, 'right_border': 297, 'top_border': 49, 'bottom_border': 349}), ({'tile': 4, 'local_x': 1, 'local_y': 1, 'b': 2, 'base': 11, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 11, 'cell_xy': [1, 2], 'row_pitch': 60, 'cell_origin': 743, 'interior_origin': 805, 'address': 867, 'left_border': 863, 'right_border': 873, 'top_border': 747, 'bottom_border': 1047}), ({'tile': 5, 'local_x': 2, 'local_y': 3, 'b': 2, 'base': 11, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 5, 'cell_xy': [0, 1], 'row_pitch': 60, 'cell_origin': 371, 'interior_origin': 433, 'address': 617, 'left_border': 611, 'right_border': 621, 'top_border': 377, 'bottom_border': 677})], 2: [({'tile': 0, 'local_x': 2, 'local_y': 2, 'b': 3, 'base': 22, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 7, 'cell_xy': [2, 1], 'row_pitch': 90, 'cell_origin': 598, 'interior_origin': 691, 'address': 877, 'left_border': 868, 'right_border': 883, 'top_border': 607, 'bottom_border': 1057}), ({'tile': 1, 'local_x': 3, 'local_y': 0, 'b': 3, 'base': 22, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 0, 'cell_xy': [0, 0], 'row_pitch': 90, 'cell_origin': 22, 'interior_origin': 115, 'address': 124, 'left_border': 112, 'right_border': 127, 'top_border': 34, 'bottom_border': 484}), ({'tile': 2, 'local_x': 0, 'local_y': 2, 'b': 3, 'base': 22, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 9, 'cell_xy': [4, 1], 'row_pitch': 90, 'cell_origin': 634, 'interior_origin': 727, 'address': 907, 'left_border': 904, 'right_border': 919, 'top_border': 637, 'bottom_border': 1087}), ({'tile': 3, 'local_x': 1, 'local_y': 0, 'b': 3, 'base': 22, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 3, 'cell_xy': [3, 0], 'row_pitch': 90, 'cell_origin': 76, 'interior_origin': 169, 'address': 172, 'left_border': 166, 'right_border': 181, 'top_border': 82, 'bottom_border': 532}), ({'tile': 4, 'local_x': 2, 'local_y': 2, 'b': 3, 'base': 22, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 11, 'cell_xy': [1, 2], 'row_pitch': 90, 'cell_origin': 1120, 'interior_origin': 1213, 'address': 1399, 'left_border': 1390, 'right_border': 1405, 'top_border': 1129, 'bottom_border': 1579}), ({'tile': 5, 'local_x': 3, 'local_y': 0, 'b': 3, 'base': 22, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 5, 'cell_xy': [0, 1], 'row_pitch': 90, 'cell_origin': 562, 'interior_origin': 655, 'address': 664, 'left_border': 652, 'right_border': 667, 'top_border': 574, 'bottom_border': 1024})], 3: [({'tile': 0, 'local_x': 3, 'local_y': 3, 'b': 4, 'base': 33, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 7, 'cell_xy': [2, 1], 'row_pitch': 120, 'cell_origin': 801, 'interior_origin': 925, 'address': 1297, 'left_border': 1281, 'right_border': 1301, 'top_border': 817, 'bottom_border': 1417}), ({'tile': 1, 'local_x': 0, 'local_y': 1, 'b': 4, 'base': 33, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 0, 'cell_xy': [0, 0], 'row_pitch': 120, 'cell_origin': 33, 'interior_origin': 157, 'address': 277, 'left_border': 273, 'right_border': 293, 'top_border': 37, 'bottom_border': 637}), ({'tile': 2, 'local_x': 1, 'local_y': 3, 'b': 4, 'base': 33, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 9, 'cell_xy': [4, 1], 'row_pitch': 120, 'cell_origin': 849, 'interior_origin': 973, 'address': 1337, 'left_border': 1329, 'right_border': 1349, 'top_border': 857, 'bottom_border': 1457}), ({'tile': 3, 'local_x': 2, 'local_y': 1, 'b': 4, 'base': 33, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 3, 'cell_xy': [3, 0], 'row_pitch': 120, 'cell_origin': 105, 'interior_origin': 229, 'address': 357, 'left_border': 345, 'right_border': 365, 'top_border': 117, 'bottom_border': 717}), ({'tile': 4, 'local_x': 3, 'local_y': 3, 'b': 4, 'base': 33, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 11, 'cell_xy': [1, 2], 'row_pitch': 120, 'cell_origin': 1497, 'interior_origin': 1621, 'address': 1993, 'left_border': 1977, 'right_border': 1997, 'top_border': 1513, 'bottom_border': 2113}), ({'tile': 5, 'local_x': 0, 'local_y': 1, 'b': 4, 'base': 33, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 5, 'cell_xy': [0, 1], 'row_pitch': 120, 'cell_origin': 753, 'interior_origin': 877, 'address': 997, 'left_border': 993, 'right_border': 1013, 'top_border': 757, 'bottom_border': 1357})], 4: [({'tile': 0, 'local_x': 0, 'local_y': 0, 'b': 5, 'base': 44, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 7, 'cell_xy': [2, 1], 'row_pitch': 150, 'cell_origin': 1004, 'interior_origin': 1159, 'address': 1159, 'left_border': 1154, 'right_border': 1179, 'top_border': 1009, 'bottom_border': 1759}), ({'tile': 1, 'local_x': 1, 'local_y': 2, 'b': 5, 'base': 44, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 0, 'cell_xy': [0, 0], 'row_pitch': 150, 'cell_origin': 44, 'interior_origin': 199, 'address': 504, 'left_border': 494, 'right_border': 519, 'top_border': 54, 'bottom_border': 804}), ({'tile': 2, 'local_x': 2, 'local_y': 0, 'b': 5, 'base': 44, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 9, 'cell_xy': [4, 1], 'row_pitch': 150, 'cell_origin': 1064, 'interior_origin': 1219, 'address': 1229, 'left_border': 1214, 'right_border': 1239, 'top_border': 1079, 'bottom_border': 1829}), ({'tile': 3, 'local_x': 3, 'local_y': 2, 'b': 5, 'base': 44, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 3, 'cell_xy': [3, 0], 'row_pitch': 150, 'cell_origin': 134, 'interior_origin': 289, 'address': 604, 'left_border': 584, 'right_border': 609, 'top_border': 154, 'bottom_border': 904}), ({'tile': 4, 'local_x': 0, 'local_y': 0, 'b': 5, 'base': 44, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 11, 'cell_xy': [1, 2], 'row_pitch': 150, 'cell_origin': 1874, 'interior_origin': 2029, 'address': 2029, 'left_border': 2024, 'right_border': 2049, 'top_border': 1879, 'bottom_border': 2629}), ({'tile': 5, 'local_x': 1, 'local_y': 2, 'b': 5, 'base': 44, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 5, 'cell_xy': [0, 1], 'row_pitch': 150, 'cell_origin': 944, 'interior_origin': 1099, 'address': 1404, 'left_border': 1394, 'right_border': 1419, 'top_border': 954, 'bottom_border': 1704})], 5: [({'tile': 0, 'local_x': 1, 'local_y': 1, 'b': 6, 'base': 55, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 7, 'cell_xy': [2, 1], 'row_pitch': 180, 'cell_origin': 1207, 'interior_origin': 1393, 'address': 1579, 'left_border': 1567, 'right_border': 1597, 'top_border': 1219, 'bottom_border': 2119}), ({'tile': 1, 'local_x': 2, 'local_y': 3, 'b': 6, 'base': 55, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 0, 'cell_xy': [0, 0], 'row_pitch': 180, 'cell_origin': 55, 'interior_origin': 241, 'address': 793, 'left_border': 775, 'right_border': 805, 'top_border': 73, 'bottom_border': 973}), ({'tile': 2, 'local_x': 3, 'local_y': 1, 'b': 6, 'base': 55, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 9, 'cell_xy': [4, 1], 'row_pitch': 180, 'cell_origin': 1279, 'interior_origin': 1465, 'address': 1663, 'left_border': 1639, 'right_border': 1669, 'top_border': 1303, 'bottom_border': 2203}), ({'tile': 3, 'local_x': 0, 'local_y': 3, 'b': 6, 'base': 55, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 3, 'cell_xy': [3, 0], 'row_pitch': 180, 'cell_origin': 163, 'interior_origin': 349, 'address': 889, 'left_border': 883, 'right_border': 913, 'top_border': 169, 'bottom_border': 1069}), ({'tile': 4, 'local_x': 1, 'local_y': 1, 'b': 6, 'base': 55, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 11, 'cell_xy': [1, 2], 'row_pitch': 180, 'cell_origin': 2251, 'interior_origin': 2437, 'address': 2623, 'left_border': 2611, 'right_border': 2641, 'top_border': 2263, 'bottom_border': 3163}), ({'tile': 5, 'local_x': 2, 'local_y': 3, 'b': 6, 'base': 55, 'remap': [7, 0, 9, 3, 11, 5]}, {'cell': 5, 'cell_xy': [0, 1], 'row_pitch': 180, 'cell_origin': 1135, 'interior_origin': 1321, 'address': 1873, 'left_border': 1855, 'right_border': 1885, 'top_border': 1153, 'bottom_border': 2053})]}
for i, (p, expected) in enumerate(cases[N]):
    check("layout fixture " + str(i + 1), solve(p), expected)
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 returned physical layout descriptor disagrees with the declared buffer mapping at cell.

A 4x4 virtual tile occupies a 6x6 atlas cell, including one replicated texel on every side. Physical cell IDs come from a remap; atlas width is five cells. Input requests an interior texel, and output includes four border-copy addresses. Return the named intermediate layout descriptor and final address fields; all quantities are integer byte offsets unless explicitly stated.

split: open-access