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"])
    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[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 = p["start"]-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[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 right_local.

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["a"]+p["split"]*p["b"]+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[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
    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[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 right_start.

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
    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[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 = p["split"]*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[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 left_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)
    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
    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[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 = (p["width"]-p["split"])*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[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 right_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