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

N = 1
observations = []
def solve(p):
    p = dict(p)
    half_width = p["w"]//2
    half_height = p["h"]//2
    tap = (2 if p["x"]>=half_width else 0)+(1 if p["y"]>=half_height else 0)
    local_x = p["x"] if tap%2==0 else p["w"]-1-p["x"]
    local_y = p["y"] if tap<2 else p["h"]-1-p["y"]
    storage_slot = [1,3,0,2][tap]
    packet_pitch = half_width*half_height*p["b"]+3
    packet_origin = p["base"]+storage_slot*packet_pitch
    address = packet_origin+3+(local_y*half_width+local_x)*p["b"]
    allocation_end = p["base"]+4*packet_pitch
    return {'half_width': half_width, 'half_height': half_height, 'tap': tap, 'local_x': local_x, 'local_y': local_y, 'storage_slot': storage_slot, 'packet_pitch': packet_pitch, 'packet_origin': packet_origin, 'address': address, 'allocation_end': allocation_end}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'w': 8, 'h': 8, 'x': 0, 'y': 0, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 35, 'packet_origin': 42, 'address': 45, 'allocation_end': 147}), ({'w': 8, 'h': 10, 'x': 5, 'y': 1, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 5, 'tap': 1, 'local_x': 2, 'local_y': 1, 'storage_slot': 3, 'packet_pitch': 43, 'packet_origin': 136, 'address': 151, 'allocation_end': 179}), ({'w': 8, 'h': 12, 'x': 1, 'y': 6, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 51, 'packet_origin': 7, 'address': 52, 'allocation_end': 211}), ({'w': 8, 'h': 14, 'x': 6, 'y': 7, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 7, 'tap': 3, 'local_x': 1, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 59, 'packet_origin': 125, 'address': 178, 'allocation_end': 243}), ({'w': 8, 'h': 16, 'x': 1, 'y': 2, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 8, 'tap': 0, 'local_x': 1, 'local_y': 2, 'storage_slot': 1, 'packet_pitch': 67, 'packet_origin': 74, 'address': 95, 'allocation_end': 275}), ({'w': 8, 'h': 18, 'x': 2, 'y': 11, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 9, 'tap': 2, 'local_x': 2, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 75, 'packet_origin': 7, 'address': 62, 'allocation_end': 307})], 2: [({'w': 10, 'h': 8, 'x': 0, 'y': 0, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 63, 'packet_origin': 77, 'address': 80, 'allocation_end': 266}), ({'w': 10, 'h': 10, 'x': 5, 'y': 1, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 5, 'tap': 1, 'local_x': 4, 'local_y': 1, 'storage_slot': 3, 'packet_pitch': 78, 'packet_origin': 248, 'address': 278, 'allocation_end': 326}), ({'w': 10, 'h': 12, 'x': 1, 'y': 6, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 93, 'packet_origin': 14, 'address': 95, 'allocation_end': 386}), ({'w': 10, 'h': 14, 'x': 6, 'y': 7, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 7, 'tap': 3, 'local_x': 3, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 108, 'packet_origin': 230, 'address': 332, 'allocation_end': 446}), ({'w': 10, 'h': 16, 'x': 9, 'y': 2, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 8, 'tap': 1, 'local_x': 0, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 123, 'packet_origin': 383, 'address': 416, 'allocation_end': 506}), ({'w': 10, 'h': 18, 'x': 0, 'y': 11, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 9, 'tap': 2, 'local_x': 0, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 138, 'packet_origin': 14, 'address': 107, 'allocation_end': 566})], 3: [({'w': 12, 'h': 8, 'x': 0, 'y': 0, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 99, 'packet_origin': 120, 'address': 123, 'allocation_end': 417}), ({'w': 12, 'h': 10, 'x': 5, 'y': 1, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 5, 'tap': 0, 'local_x': 5, 'local_y': 1, 'storage_slot': 1, 'packet_pitch': 123, 'packet_origin': 144, 'address': 191, 'allocation_end': 513}), ({'w': 12, 'h': 12, 'x': 1, 'y': 6, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 147, 'packet_origin': 21, 'address': 148, 'allocation_end': 609}), ({'w': 12, 'h': 14, 'x': 6, 'y': 7, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 7, 'tap': 3, 'local_x': 5, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 171, 'packet_origin': 363, 'address': 530, 'allocation_end': 705}), ({'w': 12, 'h': 16, 'x': 9, 'y': 2, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 8, 'tap': 1, 'local_x': 2, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 195, 'packet_origin': 606, 'address': 665, 'allocation_end': 801}), ({'w': 12, 'h': 18, 'x': 10, 'y': 11, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 9, 'tap': 3, 'local_x': 1, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 219, 'packet_origin': 459, 'address': 610, 'allocation_end': 897})], 4: [({'w': 14, 'h': 8, 'x': 0, 'y': 0, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 143, 'packet_origin': 171, 'address': 174, 'allocation_end': 600}), ({'w': 14, 'h': 10, 'x': 5, 'y': 1, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 5, 'tap': 0, 'local_x': 5, 'local_y': 1, 'storage_slot': 1, 'packet_pitch': 178, 'packet_origin': 206, 'address': 269, 'allocation_end': 740}), ({'w': 14, 'h': 12, 'x': 1, 'y': 6, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 213, 'packet_origin': 28, 'address': 211, 'allocation_end': 880}), ({'w': 14, 'h': 14, 'x': 6, 'y': 7, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 7, 'tap': 2, 'local_x': 6, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 248, 'packet_origin': 28, 'address': 271, 'allocation_end': 1020}), ({'w': 14, 'h': 16, 'x': 9, 'y': 2, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 8, 'tap': 1, 'local_x': 4, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 283, 'packet_origin': 877, 'address': 970, 'allocation_end': 1160}), ({'w': 14, 'h': 18, 'x': 10, 'y': 11, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 9, 'tap': 3, 'local_x': 3, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 318, 'packet_origin': 664, 'address': 892, 'allocation_end': 1300})], 5: [({'w': 16, 'h': 8, 'x': 0, 'y': 0, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 195, 'packet_origin': 230, 'address': 233, 'allocation_end': 815}), ({'w': 16, 'h': 10, 'x': 5, 'y': 1, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 5, 'tap': 0, 'local_x': 5, 'local_y': 1, 'storage_slot': 1, 'packet_pitch': 243, 'packet_origin': 278, 'address': 359, 'allocation_end': 1007}), ({'w': 16, 'h': 12, 'x': 1, 'y': 6, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 291, 'packet_origin': 35, 'address': 284, 'allocation_end': 1199}), ({'w': 16, 'h': 14, 'x': 6, 'y': 7, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 7, 'tap': 2, 'local_x': 6, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 339, 'packet_origin': 35, 'address': 362, 'allocation_end': 1391}), ({'w': 16, 'h': 16, 'x': 9, 'y': 2, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 8, 'tap': 1, 'local_x': 6, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 387, 'packet_origin': 1196, 'address': 1331, 'allocation_end': 1583}), ({'w': 16, 'h': 18, 'x': 10, 'y': 11, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 9, 'tap': 3, 'local_x': 5, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 435, 'packet_origin': 905, 'address': 1226, 'allocation_end': 1775})]}
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)
    half_width = p["w"]//2
    half_height = p["h"]//2
    tap = (2 if p["y"]>half_height else 0)+(1 if p["x"]>half_width else 0)
    local_x = p["x"] if tap%2==0 else p["w"]-1-p["x"]
    local_y = p["y"] if tap<2 else p["h"]-1-p["y"]
    storage_slot = [1,3,0,2][tap]
    packet_pitch = half_width*half_height*p["b"]+3
    packet_origin = p["base"]+storage_slot*packet_pitch
    address = packet_origin+3+(local_y*half_width+local_x)*p["b"]
    allocation_end = p["base"]+4*packet_pitch
    return {'half_width': half_width, 'half_height': half_height, 'tap': tap, 'local_x': local_x, 'local_y': local_y, 'storage_slot': storage_slot, 'packet_pitch': packet_pitch, 'packet_origin': packet_origin, 'address': address, 'allocation_end': allocation_end}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'w': 8, 'h': 8, 'x': 0, 'y': 0, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 35, 'packet_origin': 42, 'address': 45, 'allocation_end': 147}), ({'w': 8, 'h': 10, 'x': 5, 'y': 1, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 5, 'tap': 1, 'local_x': 2, 'local_y': 1, 'storage_slot': 3, 'packet_pitch': 43, 'packet_origin': 136, 'address': 151, 'allocation_end': 179}), ({'w': 8, 'h': 12, 'x': 1, 'y': 6, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 51, 'packet_origin': 7, 'address': 52, 'allocation_end': 211}), ({'w': 8, 'h': 14, 'x': 6, 'y': 7, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 7, 'tap': 3, 'local_x': 1, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 59, 'packet_origin': 125, 'address': 178, 'allocation_end': 243}), ({'w': 8, 'h': 16, 'x': 1, 'y': 2, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 8, 'tap': 0, 'local_x': 1, 'local_y': 2, 'storage_slot': 1, 'packet_pitch': 67, 'packet_origin': 74, 'address': 95, 'allocation_end': 275}), ({'w': 8, 'h': 18, 'x': 2, 'y': 11, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 9, 'tap': 2, 'local_x': 2, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 75, 'packet_origin': 7, 'address': 62, 'allocation_end': 307})], 2: [({'w': 10, 'h': 8, 'x': 0, 'y': 0, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 63, 'packet_origin': 77, 'address': 80, 'allocation_end': 266}), ({'w': 10, 'h': 10, 'x': 5, 'y': 1, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 5, 'tap': 1, 'local_x': 4, 'local_y': 1, 'storage_slot': 3, 'packet_pitch': 78, 'packet_origin': 248, 'address': 278, 'allocation_end': 326}), ({'w': 10, 'h': 12, 'x': 1, 'y': 6, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 93, 'packet_origin': 14, 'address': 95, 'allocation_end': 386}), ({'w': 10, 'h': 14, 'x': 6, 'y': 7, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 7, 'tap': 3, 'local_x': 3, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 108, 'packet_origin': 230, 'address': 332, 'allocation_end': 446}), ({'w': 10, 'h': 16, 'x': 9, 'y': 2, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 8, 'tap': 1, 'local_x': 0, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 123, 'packet_origin': 383, 'address': 416, 'allocation_end': 506}), ({'w': 10, 'h': 18, 'x': 0, 'y': 11, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 9, 'tap': 2, 'local_x': 0, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 138, 'packet_origin': 14, 'address': 107, 'allocation_end': 566})], 3: [({'w': 12, 'h': 8, 'x': 0, 'y': 0, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 99, 'packet_origin': 120, 'address': 123, 'allocation_end': 417}), ({'w': 12, 'h': 10, 'x': 5, 'y': 1, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 5, 'tap': 0, 'local_x': 5, 'local_y': 1, 'storage_slot': 1, 'packet_pitch': 123, 'packet_origin': 144, 'address': 191, 'allocation_end': 513}), ({'w': 12, 'h': 12, 'x': 1, 'y': 6, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 147, 'packet_origin': 21, 'address': 148, 'allocation_end': 609}), ({'w': 12, 'h': 14, 'x': 6, 'y': 7, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 7, 'tap': 3, 'local_x': 5, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 171, 'packet_origin': 363, 'address': 530, 'allocation_end': 705}), ({'w': 12, 'h': 16, 'x': 9, 'y': 2, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 8, 'tap': 1, 'local_x': 2, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 195, 'packet_origin': 606, 'address': 665, 'allocation_end': 801}), ({'w': 12, 'h': 18, 'x': 10, 'y': 11, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 9, 'tap': 3, 'local_x': 1, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 219, 'packet_origin': 459, 'address': 610, 'allocation_end': 897})], 4: [({'w': 14, 'h': 8, 'x': 0, 'y': 0, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 143, 'packet_origin': 171, 'address': 174, 'allocation_end': 600}), ({'w': 14, 'h': 10, 'x': 5, 'y': 1, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 5, 'tap': 0, 'local_x': 5, 'local_y': 1, 'storage_slot': 1, 'packet_pitch': 178, 'packet_origin': 206, 'address': 269, 'allocation_end': 740}), ({'w': 14, 'h': 12, 'x': 1, 'y': 6, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 213, 'packet_origin': 28, 'address': 211, 'allocation_end': 880}), ({'w': 14, 'h': 14, 'x': 6, 'y': 7, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 7, 'tap': 2, 'local_x': 6, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 248, 'packet_origin': 28, 'address': 271, 'allocation_end': 1020}), ({'w': 14, 'h': 16, 'x': 9, 'y': 2, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 8, 'tap': 1, 'local_x': 4, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 283, 'packet_origin': 877, 'address': 970, 'allocation_end': 1160}), ({'w': 14, 'h': 18, 'x': 10, 'y': 11, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 9, 'tap': 3, 'local_x': 3, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 318, 'packet_origin': 664, 'address': 892, 'allocation_end': 1300})], 5: [({'w': 16, 'h': 8, 'x': 0, 'y': 0, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 195, 'packet_origin': 230, 'address': 233, 'allocation_end': 815}), ({'w': 16, 'h': 10, 'x': 5, 'y': 1, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 5, 'tap': 0, 'local_x': 5, 'local_y': 1, 'storage_slot': 1, 'packet_pitch': 243, 'packet_origin': 278, 'address': 359, 'allocation_end': 1007}), ({'w': 16, 'h': 12, 'x': 1, 'y': 6, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 291, 'packet_origin': 35, 'address': 284, 'allocation_end': 1199}), ({'w': 16, 'h': 14, 'x': 6, 'y': 7, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 7, 'tap': 2, 'local_x': 6, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 339, 'packet_origin': 35, 'address': 362, 'allocation_end': 1391}), ({'w': 16, 'h': 16, 'x': 9, 'y': 2, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 8, 'tap': 1, 'local_x': 6, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 387, 'packet_origin': 1196, 'address': 1331, 'allocation_end': 1583}), ({'w': 16, 'h': 18, 'x': 10, 'y': 11, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 9, 'tap': 3, 'local_x': 5, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 435, 'packet_origin': 905, 'address': 1226, 'allocation_end': 1775})]}
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 tap.

A stipulated even-sized sensor splits the image into four quadrants. Each readout tap scans toward the center: right taps reverse x, bottom taps reverse y. Tap packets have three-byte headers and are stored in order [2,0,3,1]. 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)
    half_width = p["w"]//2
    half_height = p["h"]//2
    tap = (2 if p["y"]>=half_height else 0)+(1 if p["x"]>=half_width else 0)
    local_x = p["x"]%max(1,half_width)
    local_y = p["y"] if tap<2 else p["h"]-1-p["y"]
    storage_slot = [1,3,0,2][tap]
    packet_pitch = half_width*half_height*p["b"]+3
    packet_origin = p["base"]+storage_slot*packet_pitch
    address = packet_origin+3+(local_y*half_width+local_x)*p["b"]
    allocation_end = p["base"]+4*packet_pitch
    return {'half_width': half_width, 'half_height': half_height, 'tap': tap, 'local_x': local_x, 'local_y': local_y, 'storage_slot': storage_slot, 'packet_pitch': packet_pitch, 'packet_origin': packet_origin, 'address': address, 'allocation_end': allocation_end}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'w': 8, 'h': 8, 'x': 0, 'y': 0, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 35, 'packet_origin': 42, 'address': 45, 'allocation_end': 147}), ({'w': 8, 'h': 10, 'x': 5, 'y': 1, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 5, 'tap': 1, 'local_x': 2, 'local_y': 1, 'storage_slot': 3, 'packet_pitch': 43, 'packet_origin': 136, 'address': 151, 'allocation_end': 179}), ({'w': 8, 'h': 12, 'x': 1, 'y': 6, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 51, 'packet_origin': 7, 'address': 52, 'allocation_end': 211}), ({'w': 8, 'h': 14, 'x': 6, 'y': 7, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 7, 'tap': 3, 'local_x': 1, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 59, 'packet_origin': 125, 'address': 178, 'allocation_end': 243}), ({'w': 8, 'h': 16, 'x': 1, 'y': 2, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 8, 'tap': 0, 'local_x': 1, 'local_y': 2, 'storage_slot': 1, 'packet_pitch': 67, 'packet_origin': 74, 'address': 95, 'allocation_end': 275}), ({'w': 8, 'h': 18, 'x': 2, 'y': 11, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 9, 'tap': 2, 'local_x': 2, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 75, 'packet_origin': 7, 'address': 62, 'allocation_end': 307})], 2: [({'w': 10, 'h': 8, 'x': 0, 'y': 0, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 63, 'packet_origin': 77, 'address': 80, 'allocation_end': 266}), ({'w': 10, 'h': 10, 'x': 5, 'y': 1, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 5, 'tap': 1, 'local_x': 4, 'local_y': 1, 'storage_slot': 3, 'packet_pitch': 78, 'packet_origin': 248, 'address': 278, 'allocation_end': 326}), ({'w': 10, 'h': 12, 'x': 1, 'y': 6, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 93, 'packet_origin': 14, 'address': 95, 'allocation_end': 386}), ({'w': 10, 'h': 14, 'x': 6, 'y': 7, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 7, 'tap': 3, 'local_x': 3, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 108, 'packet_origin': 230, 'address': 332, 'allocation_end': 446}), ({'w': 10, 'h': 16, 'x': 9, 'y': 2, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 8, 'tap': 1, 'local_x': 0, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 123, 'packet_origin': 383, 'address': 416, 'allocation_end': 506}), ({'w': 10, 'h': 18, 'x': 0, 'y': 11, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 9, 'tap': 2, 'local_x': 0, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 138, 'packet_origin': 14, 'address': 107, 'allocation_end': 566})], 3: [({'w': 12, 'h': 8, 'x': 0, 'y': 0, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 99, 'packet_origin': 120, 'address': 123, 'allocation_end': 417}), ({'w': 12, 'h': 10, 'x': 5, 'y': 1, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 5, 'tap': 0, 'local_x': 5, 'local_y': 1, 'storage_slot': 1, 'packet_pitch': 123, 'packet_origin': 144, 'address': 191, 'allocation_end': 513}), ({'w': 12, 'h': 12, 'x': 1, 'y': 6, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 147, 'packet_origin': 21, 'address': 148, 'allocation_end': 609}), ({'w': 12, 'h': 14, 'x': 6, 'y': 7, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 7, 'tap': 3, 'local_x': 5, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 171, 'packet_origin': 363, 'address': 530, 'allocation_end': 705}), ({'w': 12, 'h': 16, 'x': 9, 'y': 2, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 8, 'tap': 1, 'local_x': 2, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 195, 'packet_origin': 606, 'address': 665, 'allocation_end': 801}), ({'w': 12, 'h': 18, 'x': 10, 'y': 11, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 9, 'tap': 3, 'local_x': 1, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 219, 'packet_origin': 459, 'address': 610, 'allocation_end': 897})], 4: [({'w': 14, 'h': 8, 'x': 0, 'y': 0, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 143, 'packet_origin': 171, 'address': 174, 'allocation_end': 600}), ({'w': 14, 'h': 10, 'x': 5, 'y': 1, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 5, 'tap': 0, 'local_x': 5, 'local_y': 1, 'storage_slot': 1, 'packet_pitch': 178, 'packet_origin': 206, 'address': 269, 'allocation_end': 740}), ({'w': 14, 'h': 12, 'x': 1, 'y': 6, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 213, 'packet_origin': 28, 'address': 211, 'allocation_end': 880}), ({'w': 14, 'h': 14, 'x': 6, 'y': 7, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 7, 'tap': 2, 'local_x': 6, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 248, 'packet_origin': 28, 'address': 271, 'allocation_end': 1020}), ({'w': 14, 'h': 16, 'x': 9, 'y': 2, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 8, 'tap': 1, 'local_x': 4, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 283, 'packet_origin': 877, 'address': 970, 'allocation_end': 1160}), ({'w': 14, 'h': 18, 'x': 10, 'y': 11, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 9, 'tap': 3, 'local_x': 3, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 318, 'packet_origin': 664, 'address': 892, 'allocation_end': 1300})], 5: [({'w': 16, 'h': 8, 'x': 0, 'y': 0, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 195, 'packet_origin': 230, 'address': 233, 'allocation_end': 815}), ({'w': 16, 'h': 10, 'x': 5, 'y': 1, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 5, 'tap': 0, 'local_x': 5, 'local_y': 1, 'storage_slot': 1, 'packet_pitch': 243, 'packet_origin': 278, 'address': 359, 'allocation_end': 1007}), ({'w': 16, 'h': 12, 'x': 1, 'y': 6, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 291, 'packet_origin': 35, 'address': 284, 'allocation_end': 1199}), ({'w': 16, 'h': 14, 'x': 6, 'y': 7, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 7, 'tap': 2, 'local_x': 6, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 339, 'packet_origin': 35, 'address': 362, 'allocation_end': 1391}), ({'w': 16, 'h': 16, 'x': 9, 'y': 2, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 8, 'tap': 1, 'local_x': 6, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 387, 'packet_origin': 1196, 'address': 1331, 'allocation_end': 1583}), ({'w': 16, 'h': 18, 'x': 10, 'y': 11, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 9, 'tap': 3, 'local_x': 5, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 435, 'packet_origin': 905, 'address': 1226, 'allocation_end': 1775})]}
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)
    half_width = p["w"]//2
    half_height = p["h"]//2
    tap = (2 if p["y"]>=half_height else 0)+(1 if p["x"]>=half_width else 0)
    local_x = p["w"]-1-p["x"] if tap%2==0 else p["x"]
    local_y = p["y"] if tap<2 else p["h"]-1-p["y"]
    storage_slot = [1,3,0,2][tap]
    packet_pitch = half_width*half_height*p["b"]+3
    packet_origin = p["base"]+storage_slot*packet_pitch
    address = packet_origin+3+(local_y*half_width+local_x)*p["b"]
    allocation_end = p["base"]+4*packet_pitch
    return {'half_width': half_width, 'half_height': half_height, 'tap': tap, 'local_x': local_x, 'local_y': local_y, 'storage_slot': storage_slot, 'packet_pitch': packet_pitch, 'packet_origin': packet_origin, 'address': address, 'allocation_end': allocation_end}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'w': 8, 'h': 8, 'x': 0, 'y': 0, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 35, 'packet_origin': 42, 'address': 45, 'allocation_end': 147}), ({'w': 8, 'h': 10, 'x': 5, 'y': 1, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 5, 'tap': 1, 'local_x': 2, 'local_y': 1, 'storage_slot': 3, 'packet_pitch': 43, 'packet_origin': 136, 'address': 151, 'allocation_end': 179}), ({'w': 8, 'h': 12, 'x': 1, 'y': 6, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 51, 'packet_origin': 7, 'address': 52, 'allocation_end': 211}), ({'w': 8, 'h': 14, 'x': 6, 'y': 7, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 7, 'tap': 3, 'local_x': 1, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 59, 'packet_origin': 125, 'address': 178, 'allocation_end': 243}), ({'w': 8, 'h': 16, 'x': 1, 'y': 2, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 8, 'tap': 0, 'local_x': 1, 'local_y': 2, 'storage_slot': 1, 'packet_pitch': 67, 'packet_origin': 74, 'address': 95, 'allocation_end': 275}), ({'w': 8, 'h': 18, 'x': 2, 'y': 11, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 9, 'tap': 2, 'local_x': 2, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 75, 'packet_origin': 7, 'address': 62, 'allocation_end': 307})], 2: [({'w': 10, 'h': 8, 'x': 0, 'y': 0, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 63, 'packet_origin': 77, 'address': 80, 'allocation_end': 266}), ({'w': 10, 'h': 10, 'x': 5, 'y': 1, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 5, 'tap': 1, 'local_x': 4, 'local_y': 1, 'storage_slot': 3, 'packet_pitch': 78, 'packet_origin': 248, 'address': 278, 'allocation_end': 326}), ({'w': 10, 'h': 12, 'x': 1, 'y': 6, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 93, 'packet_origin': 14, 'address': 95, 'allocation_end': 386}), ({'w': 10, 'h': 14, 'x': 6, 'y': 7, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 7, 'tap': 3, 'local_x': 3, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 108, 'packet_origin': 230, 'address': 332, 'allocation_end': 446}), ({'w': 10, 'h': 16, 'x': 9, 'y': 2, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 8, 'tap': 1, 'local_x': 0, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 123, 'packet_origin': 383, 'address': 416, 'allocation_end': 506}), ({'w': 10, 'h': 18, 'x': 0, 'y': 11, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 9, 'tap': 2, 'local_x': 0, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 138, 'packet_origin': 14, 'address': 107, 'allocation_end': 566})], 3: [({'w': 12, 'h': 8, 'x': 0, 'y': 0, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 99, 'packet_origin': 120, 'address': 123, 'allocation_end': 417}), ({'w': 12, 'h': 10, 'x': 5, 'y': 1, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 5, 'tap': 0, 'local_x': 5, 'local_y': 1, 'storage_slot': 1, 'packet_pitch': 123, 'packet_origin': 144, 'address': 191, 'allocation_end': 513}), ({'w': 12, 'h': 12, 'x': 1, 'y': 6, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 147, 'packet_origin': 21, 'address': 148, 'allocation_end': 609}), ({'w': 12, 'h': 14, 'x': 6, 'y': 7, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 7, 'tap': 3, 'local_x': 5, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 171, 'packet_origin': 363, 'address': 530, 'allocation_end': 705}), ({'w': 12, 'h': 16, 'x': 9, 'y': 2, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 8, 'tap': 1, 'local_x': 2, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 195, 'packet_origin': 606, 'address': 665, 'allocation_end': 801}), ({'w': 12, 'h': 18, 'x': 10, 'y': 11, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 9, 'tap': 3, 'local_x': 1, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 219, 'packet_origin': 459, 'address': 610, 'allocation_end': 897})], 4: [({'w': 14, 'h': 8, 'x': 0, 'y': 0, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 143, 'packet_origin': 171, 'address': 174, 'allocation_end': 600}), ({'w': 14, 'h': 10, 'x': 5, 'y': 1, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 5, 'tap': 0, 'local_x': 5, 'local_y': 1, 'storage_slot': 1, 'packet_pitch': 178, 'packet_origin': 206, 'address': 269, 'allocation_end': 740}), ({'w': 14, 'h': 12, 'x': 1, 'y': 6, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 213, 'packet_origin': 28, 'address': 211, 'allocation_end': 880}), ({'w': 14, 'h': 14, 'x': 6, 'y': 7, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 7, 'tap': 2, 'local_x': 6, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 248, 'packet_origin': 28, 'address': 271, 'allocation_end': 1020}), ({'w': 14, 'h': 16, 'x': 9, 'y': 2, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 8, 'tap': 1, 'local_x': 4, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 283, 'packet_origin': 877, 'address': 970, 'allocation_end': 1160}), ({'w': 14, 'h': 18, 'x': 10, 'y': 11, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 9, 'tap': 3, 'local_x': 3, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 318, 'packet_origin': 664, 'address': 892, 'allocation_end': 1300})], 5: [({'w': 16, 'h': 8, 'x': 0, 'y': 0, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 195, 'packet_origin': 230, 'address': 233, 'allocation_end': 815}), ({'w': 16, 'h': 10, 'x': 5, 'y': 1, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 5, 'tap': 0, 'local_x': 5, 'local_y': 1, 'storage_slot': 1, 'packet_pitch': 243, 'packet_origin': 278, 'address': 359, 'allocation_end': 1007}), ({'w': 16, 'h': 12, 'x': 1, 'y': 6, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 291, 'packet_origin': 35, 'address': 284, 'allocation_end': 1199}), ({'w': 16, 'h': 14, 'x': 6, 'y': 7, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 7, 'tap': 2, 'local_x': 6, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 339, 'packet_origin': 35, 'address': 362, 'allocation_end': 1391}), ({'w': 16, 'h': 16, 'x': 9, 'y': 2, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 8, 'tap': 1, 'local_x': 6, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 387, 'packet_origin': 1196, 'address': 1331, 'allocation_end': 1583}), ({'w': 16, 'h': 18, 'x': 10, 'y': 11, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 9, 'tap': 3, 'local_x': 5, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 435, 'packet_origin': 905, 'address': 1226, 'allocation_end': 1775})]}
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 local_x.

A stipulated even-sized sensor splits the image into four quadrants. Each readout tap scans toward the center: right taps reverse x, bottom taps reverse y. Tap packets have three-byte headers and are stored in order [2,0,3,1]. 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)
    half_width = p["w"]//2
    half_height = p["h"]//2
    tap = (2 if p["y"]>=half_height else 0)+(1 if p["x"]>=half_width else 0)
    local_x = p["x"] if tap%2==0 else p["w"]-1-p["x"]
    local_y = p["y"]%max(1,half_height)
    storage_slot = [1,3,0,2][tap]
    packet_pitch = half_width*half_height*p["b"]+3
    packet_origin = p["base"]+storage_slot*packet_pitch
    address = packet_origin+3+(local_y*half_width+local_x)*p["b"]
    allocation_end = p["base"]+4*packet_pitch
    return {'half_width': half_width, 'half_height': half_height, 'tap': tap, 'local_x': local_x, 'local_y': local_y, 'storage_slot': storage_slot, 'packet_pitch': packet_pitch, 'packet_origin': packet_origin, 'address': address, 'allocation_end': allocation_end}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'w': 8, 'h': 8, 'x': 0, 'y': 0, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 35, 'packet_origin': 42, 'address': 45, 'allocation_end': 147}), ({'w': 8, 'h': 10, 'x': 5, 'y': 1, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 5, 'tap': 1, 'local_x': 2, 'local_y': 1, 'storage_slot': 3, 'packet_pitch': 43, 'packet_origin': 136, 'address': 151, 'allocation_end': 179}), ({'w': 8, 'h': 12, 'x': 1, 'y': 6, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 51, 'packet_origin': 7, 'address': 52, 'allocation_end': 211}), ({'w': 8, 'h': 14, 'x': 6, 'y': 7, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 7, 'tap': 3, 'local_x': 1, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 59, 'packet_origin': 125, 'address': 178, 'allocation_end': 243}), ({'w': 8, 'h': 16, 'x': 1, 'y': 2, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 8, 'tap': 0, 'local_x': 1, 'local_y': 2, 'storage_slot': 1, 'packet_pitch': 67, 'packet_origin': 74, 'address': 95, 'allocation_end': 275}), ({'w': 8, 'h': 18, 'x': 2, 'y': 11, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 9, 'tap': 2, 'local_x': 2, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 75, 'packet_origin': 7, 'address': 62, 'allocation_end': 307})], 2: [({'w': 10, 'h': 8, 'x': 0, 'y': 0, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 63, 'packet_origin': 77, 'address': 80, 'allocation_end': 266}), ({'w': 10, 'h': 10, 'x': 5, 'y': 1, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 5, 'tap': 1, 'local_x': 4, 'local_y': 1, 'storage_slot': 3, 'packet_pitch': 78, 'packet_origin': 248, 'address': 278, 'allocation_end': 326}), ({'w': 10, 'h': 12, 'x': 1, 'y': 6, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 93, 'packet_origin': 14, 'address': 95, 'allocation_end': 386}), ({'w': 10, 'h': 14, 'x': 6, 'y': 7, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 7, 'tap': 3, 'local_x': 3, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 108, 'packet_origin': 230, 'address': 332, 'allocation_end': 446}), ({'w': 10, 'h': 16, 'x': 9, 'y': 2, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 8, 'tap': 1, 'local_x': 0, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 123, 'packet_origin': 383, 'address': 416, 'allocation_end': 506}), ({'w': 10, 'h': 18, 'x': 0, 'y': 11, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 9, 'tap': 2, 'local_x': 0, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 138, 'packet_origin': 14, 'address': 107, 'allocation_end': 566})], 3: [({'w': 12, 'h': 8, 'x': 0, 'y': 0, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 99, 'packet_origin': 120, 'address': 123, 'allocation_end': 417}), ({'w': 12, 'h': 10, 'x': 5, 'y': 1, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 5, 'tap': 0, 'local_x': 5, 'local_y': 1, 'storage_slot': 1, 'packet_pitch': 123, 'packet_origin': 144, 'address': 191, 'allocation_end': 513}), ({'w': 12, 'h': 12, 'x': 1, 'y': 6, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 147, 'packet_origin': 21, 'address': 148, 'allocation_end': 609}), ({'w': 12, 'h': 14, 'x': 6, 'y': 7, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 7, 'tap': 3, 'local_x': 5, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 171, 'packet_origin': 363, 'address': 530, 'allocation_end': 705}), ({'w': 12, 'h': 16, 'x': 9, 'y': 2, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 8, 'tap': 1, 'local_x': 2, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 195, 'packet_origin': 606, 'address': 665, 'allocation_end': 801}), ({'w': 12, 'h': 18, 'x': 10, 'y': 11, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 9, 'tap': 3, 'local_x': 1, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 219, 'packet_origin': 459, 'address': 610, 'allocation_end': 897})], 4: [({'w': 14, 'h': 8, 'x': 0, 'y': 0, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 143, 'packet_origin': 171, 'address': 174, 'allocation_end': 600}), ({'w': 14, 'h': 10, 'x': 5, 'y': 1, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 5, 'tap': 0, 'local_x': 5, 'local_y': 1, 'storage_slot': 1, 'packet_pitch': 178, 'packet_origin': 206, 'address': 269, 'allocation_end': 740}), ({'w': 14, 'h': 12, 'x': 1, 'y': 6, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 213, 'packet_origin': 28, 'address': 211, 'allocation_end': 880}), ({'w': 14, 'h': 14, 'x': 6, 'y': 7, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 7, 'tap': 2, 'local_x': 6, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 248, 'packet_origin': 28, 'address': 271, 'allocation_end': 1020}), ({'w': 14, 'h': 16, 'x': 9, 'y': 2, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 8, 'tap': 1, 'local_x': 4, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 283, 'packet_origin': 877, 'address': 970, 'allocation_end': 1160}), ({'w': 14, 'h': 18, 'x': 10, 'y': 11, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 9, 'tap': 3, 'local_x': 3, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 318, 'packet_origin': 664, 'address': 892, 'allocation_end': 1300})], 5: [({'w': 16, 'h': 8, 'x': 0, 'y': 0, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 195, 'packet_origin': 230, 'address': 233, 'allocation_end': 815}), ({'w': 16, 'h': 10, 'x': 5, 'y': 1, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 5, 'tap': 0, 'local_x': 5, 'local_y': 1, 'storage_slot': 1, 'packet_pitch': 243, 'packet_origin': 278, 'address': 359, 'allocation_end': 1007}), ({'w': 16, 'h': 12, 'x': 1, 'y': 6, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 291, 'packet_origin': 35, 'address': 284, 'allocation_end': 1199}), ({'w': 16, 'h': 14, 'x': 6, 'y': 7, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 7, 'tap': 2, 'local_x': 6, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 339, 'packet_origin': 35, 'address': 362, 'allocation_end': 1391}), ({'w': 16, 'h': 16, 'x': 9, 'y': 2, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 8, 'tap': 1, 'local_x': 6, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 387, 'packet_origin': 1196, 'address': 1331, 'allocation_end': 1583}), ({'w': 16, 'h': 18, 'x': 10, 'y': 11, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 9, 'tap': 3, 'local_x': 5, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 435, 'packet_origin': 905, 'address': 1226, 'allocation_end': 1775})]}
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)
    half_width = p["w"]//2
    half_height = p["h"]//2
    tap = (2 if p["y"]>=half_height else 0)+(1 if p["x"]>=half_width else 0)
    local_x = p["x"] if tap%2==0 else p["w"]-1-p["x"]
    local_y = p["h"]-1-p["y"] if tap<2 else p["y"]
    storage_slot = [1,3,0,2][tap]
    packet_pitch = half_width*half_height*p["b"]+3
    packet_origin = p["base"]+storage_slot*packet_pitch
    address = packet_origin+3+(local_y*half_width+local_x)*p["b"]
    allocation_end = p["base"]+4*packet_pitch
    return {'half_width': half_width, 'half_height': half_height, 'tap': tap, 'local_x': local_x, 'local_y': local_y, 'storage_slot': storage_slot, 'packet_pitch': packet_pitch, 'packet_origin': packet_origin, 'address': address, 'allocation_end': allocation_end}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'w': 8, 'h': 8, 'x': 0, 'y': 0, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 35, 'packet_origin': 42, 'address': 45, 'allocation_end': 147}), ({'w': 8, 'h': 10, 'x': 5, 'y': 1, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 5, 'tap': 1, 'local_x': 2, 'local_y': 1, 'storage_slot': 3, 'packet_pitch': 43, 'packet_origin': 136, 'address': 151, 'allocation_end': 179}), ({'w': 8, 'h': 12, 'x': 1, 'y': 6, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 51, 'packet_origin': 7, 'address': 52, 'allocation_end': 211}), ({'w': 8, 'h': 14, 'x': 6, 'y': 7, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 7, 'tap': 3, 'local_x': 1, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 59, 'packet_origin': 125, 'address': 178, 'allocation_end': 243}), ({'w': 8, 'h': 16, 'x': 1, 'y': 2, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 8, 'tap': 0, 'local_x': 1, 'local_y': 2, 'storage_slot': 1, 'packet_pitch': 67, 'packet_origin': 74, 'address': 95, 'allocation_end': 275}), ({'w': 8, 'h': 18, 'x': 2, 'y': 11, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 9, 'tap': 2, 'local_x': 2, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 75, 'packet_origin': 7, 'address': 62, 'allocation_end': 307})], 2: [({'w': 10, 'h': 8, 'x': 0, 'y': 0, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 63, 'packet_origin': 77, 'address': 80, 'allocation_end': 266}), ({'w': 10, 'h': 10, 'x': 5, 'y': 1, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 5, 'tap': 1, 'local_x': 4, 'local_y': 1, 'storage_slot': 3, 'packet_pitch': 78, 'packet_origin': 248, 'address': 278, 'allocation_end': 326}), ({'w': 10, 'h': 12, 'x': 1, 'y': 6, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 93, 'packet_origin': 14, 'address': 95, 'allocation_end': 386}), ({'w': 10, 'h': 14, 'x': 6, 'y': 7, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 7, 'tap': 3, 'local_x': 3, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 108, 'packet_origin': 230, 'address': 332, 'allocation_end': 446}), ({'w': 10, 'h': 16, 'x': 9, 'y': 2, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 8, 'tap': 1, 'local_x': 0, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 123, 'packet_origin': 383, 'address': 416, 'allocation_end': 506}), ({'w': 10, 'h': 18, 'x': 0, 'y': 11, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 9, 'tap': 2, 'local_x': 0, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 138, 'packet_origin': 14, 'address': 107, 'allocation_end': 566})], 3: [({'w': 12, 'h': 8, 'x': 0, 'y': 0, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 99, 'packet_origin': 120, 'address': 123, 'allocation_end': 417}), ({'w': 12, 'h': 10, 'x': 5, 'y': 1, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 5, 'tap': 0, 'local_x': 5, 'local_y': 1, 'storage_slot': 1, 'packet_pitch': 123, 'packet_origin': 144, 'address': 191, 'allocation_end': 513}), ({'w': 12, 'h': 12, 'x': 1, 'y': 6, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 147, 'packet_origin': 21, 'address': 148, 'allocation_end': 609}), ({'w': 12, 'h': 14, 'x': 6, 'y': 7, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 7, 'tap': 3, 'local_x': 5, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 171, 'packet_origin': 363, 'address': 530, 'allocation_end': 705}), ({'w': 12, 'h': 16, 'x': 9, 'y': 2, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 8, 'tap': 1, 'local_x': 2, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 195, 'packet_origin': 606, 'address': 665, 'allocation_end': 801}), ({'w': 12, 'h': 18, 'x': 10, 'y': 11, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 9, 'tap': 3, 'local_x': 1, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 219, 'packet_origin': 459, 'address': 610, 'allocation_end': 897})], 4: [({'w': 14, 'h': 8, 'x': 0, 'y': 0, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 143, 'packet_origin': 171, 'address': 174, 'allocation_end': 600}), ({'w': 14, 'h': 10, 'x': 5, 'y': 1, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 5, 'tap': 0, 'local_x': 5, 'local_y': 1, 'storage_slot': 1, 'packet_pitch': 178, 'packet_origin': 206, 'address': 269, 'allocation_end': 740}), ({'w': 14, 'h': 12, 'x': 1, 'y': 6, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 213, 'packet_origin': 28, 'address': 211, 'allocation_end': 880}), ({'w': 14, 'h': 14, 'x': 6, 'y': 7, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 7, 'tap': 2, 'local_x': 6, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 248, 'packet_origin': 28, 'address': 271, 'allocation_end': 1020}), ({'w': 14, 'h': 16, 'x': 9, 'y': 2, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 8, 'tap': 1, 'local_x': 4, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 283, 'packet_origin': 877, 'address': 970, 'allocation_end': 1160}), ({'w': 14, 'h': 18, 'x': 10, 'y': 11, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 9, 'tap': 3, 'local_x': 3, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 318, 'packet_origin': 664, 'address': 892, 'allocation_end': 1300})], 5: [({'w': 16, 'h': 8, 'x': 0, 'y': 0, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 195, 'packet_origin': 230, 'address': 233, 'allocation_end': 815}), ({'w': 16, 'h': 10, 'x': 5, 'y': 1, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 5, 'tap': 0, 'local_x': 5, 'local_y': 1, 'storage_slot': 1, 'packet_pitch': 243, 'packet_origin': 278, 'address': 359, 'allocation_end': 1007}), ({'w': 16, 'h': 12, 'x': 1, 'y': 6, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 291, 'packet_origin': 35, 'address': 284, 'allocation_end': 1199}), ({'w': 16, 'h': 14, 'x': 6, 'y': 7, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 7, 'tap': 2, 'local_x': 6, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 339, 'packet_origin': 35, 'address': 362, 'allocation_end': 1391}), ({'w': 16, 'h': 16, 'x': 9, 'y': 2, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 8, 'tap': 1, 'local_x': 6, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 387, 'packet_origin': 1196, 'address': 1331, 'allocation_end': 1583}), ({'w': 16, 'h': 18, 'x': 10, 'y': 11, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 9, 'tap': 3, 'local_x': 5, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 435, 'packet_origin': 905, 'address': 1226, 'allocation_end': 1775})]}
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 local_y.

A stipulated even-sized sensor splits the image into four quadrants. Each readout tap scans toward the center: right taps reverse x, bottom taps reverse y. Tap packets have three-byte headers and are stored in order [2,0,3,1]. 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)
    half_width = p["w"]//2
    half_height = p["h"]//2
    tap = (2 if p["y"]>=half_height else 0)+(1 if p["x"]>=half_width else 0)
    local_x = p["x"] if tap%2==0 else p["w"]-1-p["x"]
    local_y = p["y"] if tap<2 else p["h"]-1-p["y"]
    storage_slot = tap
    packet_pitch = half_width*half_height*p["b"]+3
    packet_origin = p["base"]+storage_slot*packet_pitch
    address = packet_origin+3+(local_y*half_width+local_x)*p["b"]
    allocation_end = p["base"]+4*packet_pitch
    return {'half_width': half_width, 'half_height': half_height, 'tap': tap, 'local_x': local_x, 'local_y': local_y, 'storage_slot': storage_slot, 'packet_pitch': packet_pitch, 'packet_origin': packet_origin, 'address': address, 'allocation_end': allocation_end}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'w': 8, 'h': 8, 'x': 0, 'y': 0, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 35, 'packet_origin': 42, 'address': 45, 'allocation_end': 147}), ({'w': 8, 'h': 10, 'x': 5, 'y': 1, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 5, 'tap': 1, 'local_x': 2, 'local_y': 1, 'storage_slot': 3, 'packet_pitch': 43, 'packet_origin': 136, 'address': 151, 'allocation_end': 179}), ({'w': 8, 'h': 12, 'x': 1, 'y': 6, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 51, 'packet_origin': 7, 'address': 52, 'allocation_end': 211}), ({'w': 8, 'h': 14, 'x': 6, 'y': 7, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 7, 'tap': 3, 'local_x': 1, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 59, 'packet_origin': 125, 'address': 178, 'allocation_end': 243}), ({'w': 8, 'h': 16, 'x': 1, 'y': 2, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 8, 'tap': 0, 'local_x': 1, 'local_y': 2, 'storage_slot': 1, 'packet_pitch': 67, 'packet_origin': 74, 'address': 95, 'allocation_end': 275}), ({'w': 8, 'h': 18, 'x': 2, 'y': 11, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 9, 'tap': 2, 'local_x': 2, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 75, 'packet_origin': 7, 'address': 62, 'allocation_end': 307})], 2: [({'w': 10, 'h': 8, 'x': 0, 'y': 0, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 63, 'packet_origin': 77, 'address': 80, 'allocation_end': 266}), ({'w': 10, 'h': 10, 'x': 5, 'y': 1, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 5, 'tap': 1, 'local_x': 4, 'local_y': 1, 'storage_slot': 3, 'packet_pitch': 78, 'packet_origin': 248, 'address': 278, 'allocation_end': 326}), ({'w': 10, 'h': 12, 'x': 1, 'y': 6, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 93, 'packet_origin': 14, 'address': 95, 'allocation_end': 386}), ({'w': 10, 'h': 14, 'x': 6, 'y': 7, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 7, 'tap': 3, 'local_x': 3, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 108, 'packet_origin': 230, 'address': 332, 'allocation_end': 446}), ({'w': 10, 'h': 16, 'x': 9, 'y': 2, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 8, 'tap': 1, 'local_x': 0, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 123, 'packet_origin': 383, 'address': 416, 'allocation_end': 506}), ({'w': 10, 'h': 18, 'x': 0, 'y': 11, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 9, 'tap': 2, 'local_x': 0, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 138, 'packet_origin': 14, 'address': 107, 'allocation_end': 566})], 3: [({'w': 12, 'h': 8, 'x': 0, 'y': 0, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 99, 'packet_origin': 120, 'address': 123, 'allocation_end': 417}), ({'w': 12, 'h': 10, 'x': 5, 'y': 1, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 5, 'tap': 0, 'local_x': 5, 'local_y': 1, 'storage_slot': 1, 'packet_pitch': 123, 'packet_origin': 144, 'address': 191, 'allocation_end': 513}), ({'w': 12, 'h': 12, 'x': 1, 'y': 6, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 147, 'packet_origin': 21, 'address': 148, 'allocation_end': 609}), ({'w': 12, 'h': 14, 'x': 6, 'y': 7, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 7, 'tap': 3, 'local_x': 5, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 171, 'packet_origin': 363, 'address': 530, 'allocation_end': 705}), ({'w': 12, 'h': 16, 'x': 9, 'y': 2, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 8, 'tap': 1, 'local_x': 2, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 195, 'packet_origin': 606, 'address': 665, 'allocation_end': 801}), ({'w': 12, 'h': 18, 'x': 10, 'y': 11, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 9, 'tap': 3, 'local_x': 1, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 219, 'packet_origin': 459, 'address': 610, 'allocation_end': 897})], 4: [({'w': 14, 'h': 8, 'x': 0, 'y': 0, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 143, 'packet_origin': 171, 'address': 174, 'allocation_end': 600}), ({'w': 14, 'h': 10, 'x': 5, 'y': 1, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 5, 'tap': 0, 'local_x': 5, 'local_y': 1, 'storage_slot': 1, 'packet_pitch': 178, 'packet_origin': 206, 'address': 269, 'allocation_end': 740}), ({'w': 14, 'h': 12, 'x': 1, 'y': 6, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 213, 'packet_origin': 28, 'address': 211, 'allocation_end': 880}), ({'w': 14, 'h': 14, 'x': 6, 'y': 7, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 7, 'tap': 2, 'local_x': 6, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 248, 'packet_origin': 28, 'address': 271, 'allocation_end': 1020}), ({'w': 14, 'h': 16, 'x': 9, 'y': 2, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 8, 'tap': 1, 'local_x': 4, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 283, 'packet_origin': 877, 'address': 970, 'allocation_end': 1160}), ({'w': 14, 'h': 18, 'x': 10, 'y': 11, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 9, 'tap': 3, 'local_x': 3, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 318, 'packet_origin': 664, 'address': 892, 'allocation_end': 1300})], 5: [({'w': 16, 'h': 8, 'x': 0, 'y': 0, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 195, 'packet_origin': 230, 'address': 233, 'allocation_end': 815}), ({'w': 16, 'h': 10, 'x': 5, 'y': 1, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 5, 'tap': 0, 'local_x': 5, 'local_y': 1, 'storage_slot': 1, 'packet_pitch': 243, 'packet_origin': 278, 'address': 359, 'allocation_end': 1007}), ({'w': 16, 'h': 12, 'x': 1, 'y': 6, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 291, 'packet_origin': 35, 'address': 284, 'allocation_end': 1199}), ({'w': 16, 'h': 14, 'x': 6, 'y': 7, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 7, 'tap': 2, 'local_x': 6, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 339, 'packet_origin': 35, 'address': 362, 'allocation_end': 1391}), ({'w': 16, 'h': 16, 'x': 9, 'y': 2, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 8, 'tap': 1, 'local_x': 6, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 387, 'packet_origin': 1196, 'address': 1331, 'allocation_end': 1583}), ({'w': 16, 'h': 18, 'x': 10, 'y': 11, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 9, 'tap': 3, 'local_x': 5, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 435, 'packet_origin': 905, 'address': 1226, 'allocation_end': 1775})]}
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)
    half_width = p["w"]//2
    half_height = p["h"]//2
    tap = (2 if p["y"]>=half_height else 0)+(1 if p["x"]>=half_width else 0)
    local_x = p["x"] if tap%2==0 else p["w"]-1-p["x"]
    local_y = p["y"] if tap<2 else p["h"]-1-p["y"]
    storage_slot = [2,0,3,1][tap]
    packet_pitch = half_width*half_height*p["b"]+3
    packet_origin = p["base"]+storage_slot*packet_pitch
    address = packet_origin+3+(local_y*half_width+local_x)*p["b"]
    allocation_end = p["base"]+4*packet_pitch
    return {'half_width': half_width, 'half_height': half_height, 'tap': tap, 'local_x': local_x, 'local_y': local_y, 'storage_slot': storage_slot, 'packet_pitch': packet_pitch, 'packet_origin': packet_origin, 'address': address, 'allocation_end': allocation_end}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'w': 8, 'h': 8, 'x': 0, 'y': 0, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 35, 'packet_origin': 42, 'address': 45, 'allocation_end': 147}), ({'w': 8, 'h': 10, 'x': 5, 'y': 1, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 5, 'tap': 1, 'local_x': 2, 'local_y': 1, 'storage_slot': 3, 'packet_pitch': 43, 'packet_origin': 136, 'address': 151, 'allocation_end': 179}), ({'w': 8, 'h': 12, 'x': 1, 'y': 6, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 51, 'packet_origin': 7, 'address': 52, 'allocation_end': 211}), ({'w': 8, 'h': 14, 'x': 6, 'y': 7, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 7, 'tap': 3, 'local_x': 1, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 59, 'packet_origin': 125, 'address': 178, 'allocation_end': 243}), ({'w': 8, 'h': 16, 'x': 1, 'y': 2, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 8, 'tap': 0, 'local_x': 1, 'local_y': 2, 'storage_slot': 1, 'packet_pitch': 67, 'packet_origin': 74, 'address': 95, 'allocation_end': 275}), ({'w': 8, 'h': 18, 'x': 2, 'y': 11, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 9, 'tap': 2, 'local_x': 2, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 75, 'packet_origin': 7, 'address': 62, 'allocation_end': 307})], 2: [({'w': 10, 'h': 8, 'x': 0, 'y': 0, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 63, 'packet_origin': 77, 'address': 80, 'allocation_end': 266}), ({'w': 10, 'h': 10, 'x': 5, 'y': 1, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 5, 'tap': 1, 'local_x': 4, 'local_y': 1, 'storage_slot': 3, 'packet_pitch': 78, 'packet_origin': 248, 'address': 278, 'allocation_end': 326}), ({'w': 10, 'h': 12, 'x': 1, 'y': 6, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 93, 'packet_origin': 14, 'address': 95, 'allocation_end': 386}), ({'w': 10, 'h': 14, 'x': 6, 'y': 7, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 7, 'tap': 3, 'local_x': 3, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 108, 'packet_origin': 230, 'address': 332, 'allocation_end': 446}), ({'w': 10, 'h': 16, 'x': 9, 'y': 2, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 8, 'tap': 1, 'local_x': 0, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 123, 'packet_origin': 383, 'address': 416, 'allocation_end': 506}), ({'w': 10, 'h': 18, 'x': 0, 'y': 11, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 9, 'tap': 2, 'local_x': 0, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 138, 'packet_origin': 14, 'address': 107, 'allocation_end': 566})], 3: [({'w': 12, 'h': 8, 'x': 0, 'y': 0, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 99, 'packet_origin': 120, 'address': 123, 'allocation_end': 417}), ({'w': 12, 'h': 10, 'x': 5, 'y': 1, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 5, 'tap': 0, 'local_x': 5, 'local_y': 1, 'storage_slot': 1, 'packet_pitch': 123, 'packet_origin': 144, 'address': 191, 'allocation_end': 513}), ({'w': 12, 'h': 12, 'x': 1, 'y': 6, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 147, 'packet_origin': 21, 'address': 148, 'allocation_end': 609}), ({'w': 12, 'h': 14, 'x': 6, 'y': 7, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 7, 'tap': 3, 'local_x': 5, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 171, 'packet_origin': 363, 'address': 530, 'allocation_end': 705}), ({'w': 12, 'h': 16, 'x': 9, 'y': 2, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 8, 'tap': 1, 'local_x': 2, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 195, 'packet_origin': 606, 'address': 665, 'allocation_end': 801}), ({'w': 12, 'h': 18, 'x': 10, 'y': 11, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 9, 'tap': 3, 'local_x': 1, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 219, 'packet_origin': 459, 'address': 610, 'allocation_end': 897})], 4: [({'w': 14, 'h': 8, 'x': 0, 'y': 0, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 143, 'packet_origin': 171, 'address': 174, 'allocation_end': 600}), ({'w': 14, 'h': 10, 'x': 5, 'y': 1, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 5, 'tap': 0, 'local_x': 5, 'local_y': 1, 'storage_slot': 1, 'packet_pitch': 178, 'packet_origin': 206, 'address': 269, 'allocation_end': 740}), ({'w': 14, 'h': 12, 'x': 1, 'y': 6, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 213, 'packet_origin': 28, 'address': 211, 'allocation_end': 880}), ({'w': 14, 'h': 14, 'x': 6, 'y': 7, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 7, 'tap': 2, 'local_x': 6, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 248, 'packet_origin': 28, 'address': 271, 'allocation_end': 1020}), ({'w': 14, 'h': 16, 'x': 9, 'y': 2, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 8, 'tap': 1, 'local_x': 4, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 283, 'packet_origin': 877, 'address': 970, 'allocation_end': 1160}), ({'w': 14, 'h': 18, 'x': 10, 'y': 11, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 9, 'tap': 3, 'local_x': 3, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 318, 'packet_origin': 664, 'address': 892, 'allocation_end': 1300})], 5: [({'w': 16, 'h': 8, 'x': 0, 'y': 0, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 195, 'packet_origin': 230, 'address': 233, 'allocation_end': 815}), ({'w': 16, 'h': 10, 'x': 5, 'y': 1, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 5, 'tap': 0, 'local_x': 5, 'local_y': 1, 'storage_slot': 1, 'packet_pitch': 243, 'packet_origin': 278, 'address': 359, 'allocation_end': 1007}), ({'w': 16, 'h': 12, 'x': 1, 'y': 6, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 291, 'packet_origin': 35, 'address': 284, 'allocation_end': 1199}), ({'w': 16, 'h': 14, 'x': 6, 'y': 7, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 7, 'tap': 2, 'local_x': 6, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 339, 'packet_origin': 35, 'address': 362, 'allocation_end': 1391}), ({'w': 16, 'h': 16, 'x': 9, 'y': 2, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 8, 'tap': 1, 'local_x': 6, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 387, 'packet_origin': 1196, 'address': 1331, 'allocation_end': 1583}), ({'w': 16, 'h': 18, 'x': 10, 'y': 11, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 9, 'tap': 3, 'local_x': 5, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 435, 'packet_origin': 905, 'address': 1226, 'allocation_end': 1775})]}
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 storage_slot.

A stipulated even-sized sensor splits the image into four quadrants. Each readout tap scans toward the center: right taps reverse x, bottom taps reverse y. Tap packets have three-byte headers and are stored in order [2,0,3,1]. 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)
    half_width = p["w"]//2
    half_height = p["h"]//2
    tap = (2 if p["y"]>=half_height else 0)+(1 if p["x"]>=half_width else 0)
    local_x = p["x"] if tap%2==0 else p["w"]-1-p["x"]
    local_y = p["y"] if tap<2 else p["h"]-1-p["y"]
    storage_slot = [1,3,0,2][tap]
    packet_pitch = half_width*half_height*p["b"]
    packet_origin = p["base"]+storage_slot*packet_pitch
    address = packet_origin+3+(local_y*half_width+local_x)*p["b"]
    allocation_end = p["base"]+4*packet_pitch
    return {'half_width': half_width, 'half_height': half_height, 'tap': tap, 'local_x': local_x, 'local_y': local_y, 'storage_slot': storage_slot, 'packet_pitch': packet_pitch, 'packet_origin': packet_origin, 'address': address, 'allocation_end': allocation_end}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'w': 8, 'h': 8, 'x': 0, 'y': 0, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 35, 'packet_origin': 42, 'address': 45, 'allocation_end': 147}), ({'w': 8, 'h': 10, 'x': 5, 'y': 1, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 5, 'tap': 1, 'local_x': 2, 'local_y': 1, 'storage_slot': 3, 'packet_pitch': 43, 'packet_origin': 136, 'address': 151, 'allocation_end': 179}), ({'w': 8, 'h': 12, 'x': 1, 'y': 6, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 51, 'packet_origin': 7, 'address': 52, 'allocation_end': 211}), ({'w': 8, 'h': 14, 'x': 6, 'y': 7, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 7, 'tap': 3, 'local_x': 1, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 59, 'packet_origin': 125, 'address': 178, 'allocation_end': 243}), ({'w': 8, 'h': 16, 'x': 1, 'y': 2, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 8, 'tap': 0, 'local_x': 1, 'local_y': 2, 'storage_slot': 1, 'packet_pitch': 67, 'packet_origin': 74, 'address': 95, 'allocation_end': 275}), ({'w': 8, 'h': 18, 'x': 2, 'y': 11, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 9, 'tap': 2, 'local_x': 2, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 75, 'packet_origin': 7, 'address': 62, 'allocation_end': 307})], 2: [({'w': 10, 'h': 8, 'x': 0, 'y': 0, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 63, 'packet_origin': 77, 'address': 80, 'allocation_end': 266}), ({'w': 10, 'h': 10, 'x': 5, 'y': 1, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 5, 'tap': 1, 'local_x': 4, 'local_y': 1, 'storage_slot': 3, 'packet_pitch': 78, 'packet_origin': 248, 'address': 278, 'allocation_end': 326}), ({'w': 10, 'h': 12, 'x': 1, 'y': 6, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 93, 'packet_origin': 14, 'address': 95, 'allocation_end': 386}), ({'w': 10, 'h': 14, 'x': 6, 'y': 7, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 7, 'tap': 3, 'local_x': 3, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 108, 'packet_origin': 230, 'address': 332, 'allocation_end': 446}), ({'w': 10, 'h': 16, 'x': 9, 'y': 2, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 8, 'tap': 1, 'local_x': 0, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 123, 'packet_origin': 383, 'address': 416, 'allocation_end': 506}), ({'w': 10, 'h': 18, 'x': 0, 'y': 11, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 9, 'tap': 2, 'local_x': 0, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 138, 'packet_origin': 14, 'address': 107, 'allocation_end': 566})], 3: [({'w': 12, 'h': 8, 'x': 0, 'y': 0, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 99, 'packet_origin': 120, 'address': 123, 'allocation_end': 417}), ({'w': 12, 'h': 10, 'x': 5, 'y': 1, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 5, 'tap': 0, 'local_x': 5, 'local_y': 1, 'storage_slot': 1, 'packet_pitch': 123, 'packet_origin': 144, 'address': 191, 'allocation_end': 513}), ({'w': 12, 'h': 12, 'x': 1, 'y': 6, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 147, 'packet_origin': 21, 'address': 148, 'allocation_end': 609}), ({'w': 12, 'h': 14, 'x': 6, 'y': 7, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 7, 'tap': 3, 'local_x': 5, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 171, 'packet_origin': 363, 'address': 530, 'allocation_end': 705}), ({'w': 12, 'h': 16, 'x': 9, 'y': 2, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 8, 'tap': 1, 'local_x': 2, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 195, 'packet_origin': 606, 'address': 665, 'allocation_end': 801}), ({'w': 12, 'h': 18, 'x': 10, 'y': 11, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 9, 'tap': 3, 'local_x': 1, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 219, 'packet_origin': 459, 'address': 610, 'allocation_end': 897})], 4: [({'w': 14, 'h': 8, 'x': 0, 'y': 0, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 143, 'packet_origin': 171, 'address': 174, 'allocation_end': 600}), ({'w': 14, 'h': 10, 'x': 5, 'y': 1, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 5, 'tap': 0, 'local_x': 5, 'local_y': 1, 'storage_slot': 1, 'packet_pitch': 178, 'packet_origin': 206, 'address': 269, 'allocation_end': 740}), ({'w': 14, 'h': 12, 'x': 1, 'y': 6, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 213, 'packet_origin': 28, 'address': 211, 'allocation_end': 880}), ({'w': 14, 'h': 14, 'x': 6, 'y': 7, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 7, 'tap': 2, 'local_x': 6, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 248, 'packet_origin': 28, 'address': 271, 'allocation_end': 1020}), ({'w': 14, 'h': 16, 'x': 9, 'y': 2, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 8, 'tap': 1, 'local_x': 4, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 283, 'packet_origin': 877, 'address': 970, 'allocation_end': 1160}), ({'w': 14, 'h': 18, 'x': 10, 'y': 11, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 9, 'tap': 3, 'local_x': 3, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 318, 'packet_origin': 664, 'address': 892, 'allocation_end': 1300})], 5: [({'w': 16, 'h': 8, 'x': 0, 'y': 0, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 195, 'packet_origin': 230, 'address': 233, 'allocation_end': 815}), ({'w': 16, 'h': 10, 'x': 5, 'y': 1, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 5, 'tap': 0, 'local_x': 5, 'local_y': 1, 'storage_slot': 1, 'packet_pitch': 243, 'packet_origin': 278, 'address': 359, 'allocation_end': 1007}), ({'w': 16, 'h': 12, 'x': 1, 'y': 6, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 291, 'packet_origin': 35, 'address': 284, 'allocation_end': 1199}), ({'w': 16, 'h': 14, 'x': 6, 'y': 7, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 7, 'tap': 2, 'local_x': 6, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 339, 'packet_origin': 35, 'address': 362, 'allocation_end': 1391}), ({'w': 16, 'h': 16, 'x': 9, 'y': 2, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 8, 'tap': 1, 'local_x': 6, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 387, 'packet_origin': 1196, 'address': 1331, 'allocation_end': 1583}), ({'w': 16, 'h': 18, 'x': 10, 'y': 11, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 9, 'tap': 3, 'local_x': 5, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 435, 'packet_origin': 905, 'address': 1226, 'allocation_end': 1775})]}
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)
    half_width = p["w"]//2
    half_height = p["h"]//2
    tap = (2 if p["y"]>=half_height else 0)+(1 if p["x"]>=half_width else 0)
    local_x = p["x"] if tap%2==0 else p["w"]-1-p["x"]
    local_y = p["y"] if tap<2 else p["h"]-1-p["y"]
    storage_slot = [1,3,0,2][tap]
    packet_pitch = p["w"]*p["h"]*p["b"]+3
    packet_origin = p["base"]+storage_slot*packet_pitch
    address = packet_origin+3+(local_y*half_width+local_x)*p["b"]
    allocation_end = p["base"]+4*packet_pitch
    return {'half_width': half_width, 'half_height': half_height, 'tap': tap, 'local_x': local_x, 'local_y': local_y, 'storage_slot': storage_slot, 'packet_pitch': packet_pitch, 'packet_origin': packet_origin, 'address': address, 'allocation_end': allocation_end}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'w': 8, 'h': 8, 'x': 0, 'y': 0, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 35, 'packet_origin': 42, 'address': 45, 'allocation_end': 147}), ({'w': 8, 'h': 10, 'x': 5, 'y': 1, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 5, 'tap': 1, 'local_x': 2, 'local_y': 1, 'storage_slot': 3, 'packet_pitch': 43, 'packet_origin': 136, 'address': 151, 'allocation_end': 179}), ({'w': 8, 'h': 12, 'x': 1, 'y': 6, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 51, 'packet_origin': 7, 'address': 52, 'allocation_end': 211}), ({'w': 8, 'h': 14, 'x': 6, 'y': 7, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 7, 'tap': 3, 'local_x': 1, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 59, 'packet_origin': 125, 'address': 178, 'allocation_end': 243}), ({'w': 8, 'h': 16, 'x': 1, 'y': 2, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 8, 'tap': 0, 'local_x': 1, 'local_y': 2, 'storage_slot': 1, 'packet_pitch': 67, 'packet_origin': 74, 'address': 95, 'allocation_end': 275}), ({'w': 8, 'h': 18, 'x': 2, 'y': 11, 'b': 2, 'base': 7}, {'half_width': 4, 'half_height': 9, 'tap': 2, 'local_x': 2, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 75, 'packet_origin': 7, 'address': 62, 'allocation_end': 307})], 2: [({'w': 10, 'h': 8, 'x': 0, 'y': 0, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 63, 'packet_origin': 77, 'address': 80, 'allocation_end': 266}), ({'w': 10, 'h': 10, 'x': 5, 'y': 1, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 5, 'tap': 1, 'local_x': 4, 'local_y': 1, 'storage_slot': 3, 'packet_pitch': 78, 'packet_origin': 248, 'address': 278, 'allocation_end': 326}), ({'w': 10, 'h': 12, 'x': 1, 'y': 6, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 93, 'packet_origin': 14, 'address': 95, 'allocation_end': 386}), ({'w': 10, 'h': 14, 'x': 6, 'y': 7, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 7, 'tap': 3, 'local_x': 3, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 108, 'packet_origin': 230, 'address': 332, 'allocation_end': 446}), ({'w': 10, 'h': 16, 'x': 9, 'y': 2, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 8, 'tap': 1, 'local_x': 0, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 123, 'packet_origin': 383, 'address': 416, 'allocation_end': 506}), ({'w': 10, 'h': 18, 'x': 0, 'y': 11, 'b': 3, 'base': 14}, {'half_width': 5, 'half_height': 9, 'tap': 2, 'local_x': 0, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 138, 'packet_origin': 14, 'address': 107, 'allocation_end': 566})], 3: [({'w': 12, 'h': 8, 'x': 0, 'y': 0, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 99, 'packet_origin': 120, 'address': 123, 'allocation_end': 417}), ({'w': 12, 'h': 10, 'x': 5, 'y': 1, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 5, 'tap': 0, 'local_x': 5, 'local_y': 1, 'storage_slot': 1, 'packet_pitch': 123, 'packet_origin': 144, 'address': 191, 'allocation_end': 513}), ({'w': 12, 'h': 12, 'x': 1, 'y': 6, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 147, 'packet_origin': 21, 'address': 148, 'allocation_end': 609}), ({'w': 12, 'h': 14, 'x': 6, 'y': 7, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 7, 'tap': 3, 'local_x': 5, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 171, 'packet_origin': 363, 'address': 530, 'allocation_end': 705}), ({'w': 12, 'h': 16, 'x': 9, 'y': 2, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 8, 'tap': 1, 'local_x': 2, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 195, 'packet_origin': 606, 'address': 665, 'allocation_end': 801}), ({'w': 12, 'h': 18, 'x': 10, 'y': 11, 'b': 4, 'base': 21}, {'half_width': 6, 'half_height': 9, 'tap': 3, 'local_x': 1, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 219, 'packet_origin': 459, 'address': 610, 'allocation_end': 897})], 4: [({'w': 14, 'h': 8, 'x': 0, 'y': 0, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 143, 'packet_origin': 171, 'address': 174, 'allocation_end': 600}), ({'w': 14, 'h': 10, 'x': 5, 'y': 1, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 5, 'tap': 0, 'local_x': 5, 'local_y': 1, 'storage_slot': 1, 'packet_pitch': 178, 'packet_origin': 206, 'address': 269, 'allocation_end': 740}), ({'w': 14, 'h': 12, 'x': 1, 'y': 6, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 213, 'packet_origin': 28, 'address': 211, 'allocation_end': 880}), ({'w': 14, 'h': 14, 'x': 6, 'y': 7, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 7, 'tap': 2, 'local_x': 6, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 248, 'packet_origin': 28, 'address': 271, 'allocation_end': 1020}), ({'w': 14, 'h': 16, 'x': 9, 'y': 2, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 8, 'tap': 1, 'local_x': 4, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 283, 'packet_origin': 877, 'address': 970, 'allocation_end': 1160}), ({'w': 14, 'h': 18, 'x': 10, 'y': 11, 'b': 5, 'base': 28}, {'half_width': 7, 'half_height': 9, 'tap': 3, 'local_x': 3, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 318, 'packet_origin': 664, 'address': 892, 'allocation_end': 1300})], 5: [({'w': 16, 'h': 8, 'x': 0, 'y': 0, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 4, 'tap': 0, 'local_x': 0, 'local_y': 0, 'storage_slot': 1, 'packet_pitch': 195, 'packet_origin': 230, 'address': 233, 'allocation_end': 815}), ({'w': 16, 'h': 10, 'x': 5, 'y': 1, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 5, 'tap': 0, 'local_x': 5, 'local_y': 1, 'storage_slot': 1, 'packet_pitch': 243, 'packet_origin': 278, 'address': 359, 'allocation_end': 1007}), ({'w': 16, 'h': 12, 'x': 1, 'y': 6, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 6, 'tap': 2, 'local_x': 1, 'local_y': 5, 'storage_slot': 0, 'packet_pitch': 291, 'packet_origin': 35, 'address': 284, 'allocation_end': 1199}), ({'w': 16, 'h': 14, 'x': 6, 'y': 7, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 7, 'tap': 2, 'local_x': 6, 'local_y': 6, 'storage_slot': 0, 'packet_pitch': 339, 'packet_origin': 35, 'address': 362, 'allocation_end': 1391}), ({'w': 16, 'h': 16, 'x': 9, 'y': 2, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 8, 'tap': 1, 'local_x': 6, 'local_y': 2, 'storage_slot': 3, 'packet_pitch': 387, 'packet_origin': 1196, 'address': 1331, 'allocation_end': 1583}), ({'w': 16, 'h': 18, 'x': 10, 'y': 11, 'b': 6, 'base': 35}, {'half_width': 8, 'half_height': 9, 'tap': 3, 'local_x': 5, 'local_y': 6, 'storage_slot': 2, 'packet_pitch': 435, 'packet_origin': 905, 'address': 1226, 'allocation_end': 1775})]}
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 packet_pitch.

A stipulated even-sized sensor splits the image into four quadrants. Each readout tap scans toward the center: right taps reverse x, bottom taps reverse y. Tap packets have three-byte headers and are stored in order [2,0,3,1]. Return the named intermediate layout descriptor and final address fields; all quantities are integer byte offsets unless explicitly stated.

split: open-access