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

N = 1
observations = []
def solve(p):
    p = dict(p)
    even_rows = (p["h"]+1)//2
    odd_rows = (p["h"]+1)//2
    field = p["y"]%2
    field_row = p["y"]//2
    row_pitch = p["w"]*p["b"]+2
    odd_start = p["base"]+3+even_rows*row_pitch
    field_start = p["base"] if field==0 else odd_start
    row_origin = field_start+3+field_row*row_pitch
    address = row_origin+p["x"]*p["b"]
    allocation_end = odd_start+3+odd_rows*row_pitch
    return {'even_rows': even_rows, 'odd_rows': odd_rows, 'field': field, 'field_row': field_row, 'row_pitch': row_pitch, 'odd_start': odd_start, 'field_start': field_start, 'row_origin': row_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': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 2, 'base': 11}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 4, 'odd_start': 18, 'field_start': 11, 'row_origin': 14, 'address': 14, 'allocation_end': 21}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11}, {'even_rows': 2, 'odd_rows': 2, 'field': 0, 'field_row': 1, 'row_pitch': 14, 'odd_start': 42, 'field_start': 11, 'row_origin': 28, 'address': 30, 'allocation_end': 73}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11}, {'even_rows': 4, 'odd_rows': 4, 'field': 0, 'field_row': 3, 'row_pitch': 22, 'odd_start': 102, 'field_start': 11, 'row_origin': 80, 'address': 96, 'allocation_end': 193}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 34, 'odd_start': 150, 'field_start': 150, 'row_origin': 255, 'address': 285, 'allocation_end': 289}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11}, {'even_rows': 5, 'odd_rows': 5, 'field': 0, 'field_row': 4, 'row_pitch': 38, 'odd_start': 204, 'field_start': 11, 'row_origin': 166, 'address': 198, 'allocation_end': 397}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 16, 'odd_start': 126, 'field_start': 11, 'row_origin': 110, 'address': 116, 'allocation_end': 225})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 5, 'odd_start': 30, 'field_start': 22, 'row_origin': 25, 'address': 25, 'allocation_end': 33}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22}, {'even_rows': 3, 'odd_rows': 2, 'field': 0, 'field_row': 1, 'row_pitch': 23, 'odd_start': 94, 'field_start': 22, 'row_origin': 48, 'address': 51, 'allocation_end': 143}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22}, {'even_rows': 5, 'odd_rows': 4, 'field': 0, 'field_row': 3, 'row_pitch': 35, 'odd_start': 200, 'field_start': 22, 'row_origin': 130, 'address': 154, 'allocation_end': 343}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 50, 'odd_start': 225, 'field_start': 225, 'row_origin': 378, 'address': 423, 'allocation_end': 428}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22}, {'even_rows': 6, 'odd_rows': 5, 'field': 0, 'field_row': 4, 'row_pitch': 59, 'odd_start': 379, 'field_start': 22, 'row_origin': 261, 'address': 309, 'allocation_end': 677}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 23, 'odd_start': 186, 'field_start': 22, 'row_origin': 163, 'address': 172, 'allocation_end': 327})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 6, 'odd_start': 42, 'field_start': 33, 'row_origin': 36, 'address': 36, 'allocation_end': 45}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33}, {'even_rows': 3, 'odd_rows': 3, 'field': 0, 'field_row': 1, 'row_pitch': 34, 'odd_start': 138, 'field_start': 33, 'row_origin': 70, 'address': 74, 'allocation_end': 243}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33}, {'even_rows': 5, 'odd_rows': 5, 'field': 0, 'field_row': 3, 'row_pitch': 50, 'odd_start': 286, 'field_start': 33, 'row_origin': 186, 'address': 218, 'allocation_end': 539}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 66, 'odd_start': 300, 'field_start': 300, 'row_origin': 501, 'address': 561, 'allocation_end': 567}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33}, {'even_rows': 6, 'odd_rows': 6, 'field': 0, 'field_row': 4, 'row_pitch': 82, 'odd_start': 528, 'field_start': 33, 'row_origin': 364, 'address': 428, 'allocation_end': 1023}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 30, 'odd_start': 246, 'field_start': 33, 'row_origin': 216, 'address': 228, 'allocation_end': 429})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 7, 'odd_start': 54, 'field_start': 44, 'row_origin': 47, 'address': 47, 'allocation_end': 57}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44}, {'even_rows': 4, 'odd_rows': 3, 'field': 0, 'field_row': 1, 'row_pitch': 47, 'odd_start': 235, 'field_start': 44, 'row_origin': 94, 'address': 99, 'allocation_end': 379}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44}, {'even_rows': 6, 'odd_rows': 5, 'field': 0, 'field_row': 3, 'row_pitch': 67, 'odd_start': 449, 'field_start': 44, 'row_origin': 248, 'address': 288, 'allocation_end': 787}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 82, 'odd_start': 375, 'field_start': 375, 'row_origin': 624, 'address': 699, 'allocation_end': 706}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 4, 'row_pitch': 107, 'odd_start': 796, 'field_start': 44, 'row_origin': 475, 'address': 555, 'allocation_end': 1441}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 37, 'odd_start': 306, 'field_start': 44, 'row_origin': 269, 'address': 284, 'allocation_end': 531})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 8, 'odd_start': 66, 'field_start': 55, 'row_origin': 58, 'address': 58, 'allocation_end': 69}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55}, {'even_rows': 4, 'odd_rows': 4, 'field': 0, 'field_row': 1, 'row_pitch': 62, 'odd_start': 306, 'field_start': 55, 'row_origin': 120, 'address': 126, 'allocation_end': 557}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55}, {'even_rows': 6, 'odd_rows': 6, 'field': 0, 'field_row': 3, 'row_pitch': 86, 'odd_start': 574, 'field_start': 55, 'row_origin': 316, 'address': 364, 'allocation_end': 1093}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 98, 'odd_start': 450, 'field_start': 450, 'row_origin': 747, 'address': 837, 'allocation_end': 845}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55}, {'even_rows': 7, 'odd_rows': 7, 'field': 0, 'field_row': 4, 'row_pitch': 134, 'odd_start': 996, 'field_start': 55, 'row_origin': 594, 'address': 690, 'allocation_end': 1937}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 44, 'odd_start': 366, 'field_start': 55, 'row_origin': 322, 'address': 340, 'allocation_end': 633})]}
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)
    even_rows = (p["h"]+1)//2
    odd_rows = p["h"]
    field = p["y"]%2
    field_row = p["y"]//2
    row_pitch = p["w"]*p["b"]+2
    odd_start = p["base"]+3+even_rows*row_pitch
    field_start = p["base"] if field==0 else odd_start
    row_origin = field_start+3+field_row*row_pitch
    address = row_origin+p["x"]*p["b"]
    allocation_end = odd_start+3+odd_rows*row_pitch
    return {'even_rows': even_rows, 'odd_rows': odd_rows, 'field': field, 'field_row': field_row, 'row_pitch': row_pitch, 'odd_start': odd_start, 'field_start': field_start, 'row_origin': row_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': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 2, 'base': 11}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 4, 'odd_start': 18, 'field_start': 11, 'row_origin': 14, 'address': 14, 'allocation_end': 21}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11}, {'even_rows': 2, 'odd_rows': 2, 'field': 0, 'field_row': 1, 'row_pitch': 14, 'odd_start': 42, 'field_start': 11, 'row_origin': 28, 'address': 30, 'allocation_end': 73}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11}, {'even_rows': 4, 'odd_rows': 4, 'field': 0, 'field_row': 3, 'row_pitch': 22, 'odd_start': 102, 'field_start': 11, 'row_origin': 80, 'address': 96, 'allocation_end': 193}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 34, 'odd_start': 150, 'field_start': 150, 'row_origin': 255, 'address': 285, 'allocation_end': 289}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11}, {'even_rows': 5, 'odd_rows': 5, 'field': 0, 'field_row': 4, 'row_pitch': 38, 'odd_start': 204, 'field_start': 11, 'row_origin': 166, 'address': 198, 'allocation_end': 397}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 16, 'odd_start': 126, 'field_start': 11, 'row_origin': 110, 'address': 116, 'allocation_end': 225})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 5, 'odd_start': 30, 'field_start': 22, 'row_origin': 25, 'address': 25, 'allocation_end': 33}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22}, {'even_rows': 3, 'odd_rows': 2, 'field': 0, 'field_row': 1, 'row_pitch': 23, 'odd_start': 94, 'field_start': 22, 'row_origin': 48, 'address': 51, 'allocation_end': 143}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22}, {'even_rows': 5, 'odd_rows': 4, 'field': 0, 'field_row': 3, 'row_pitch': 35, 'odd_start': 200, 'field_start': 22, 'row_origin': 130, 'address': 154, 'allocation_end': 343}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 50, 'odd_start': 225, 'field_start': 225, 'row_origin': 378, 'address': 423, 'allocation_end': 428}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22}, {'even_rows': 6, 'odd_rows': 5, 'field': 0, 'field_row': 4, 'row_pitch': 59, 'odd_start': 379, 'field_start': 22, 'row_origin': 261, 'address': 309, 'allocation_end': 677}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 23, 'odd_start': 186, 'field_start': 22, 'row_origin': 163, 'address': 172, 'allocation_end': 327})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 6, 'odd_start': 42, 'field_start': 33, 'row_origin': 36, 'address': 36, 'allocation_end': 45}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33}, {'even_rows': 3, 'odd_rows': 3, 'field': 0, 'field_row': 1, 'row_pitch': 34, 'odd_start': 138, 'field_start': 33, 'row_origin': 70, 'address': 74, 'allocation_end': 243}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33}, {'even_rows': 5, 'odd_rows': 5, 'field': 0, 'field_row': 3, 'row_pitch': 50, 'odd_start': 286, 'field_start': 33, 'row_origin': 186, 'address': 218, 'allocation_end': 539}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 66, 'odd_start': 300, 'field_start': 300, 'row_origin': 501, 'address': 561, 'allocation_end': 567}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33}, {'even_rows': 6, 'odd_rows': 6, 'field': 0, 'field_row': 4, 'row_pitch': 82, 'odd_start': 528, 'field_start': 33, 'row_origin': 364, 'address': 428, 'allocation_end': 1023}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 30, 'odd_start': 246, 'field_start': 33, 'row_origin': 216, 'address': 228, 'allocation_end': 429})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 7, 'odd_start': 54, 'field_start': 44, 'row_origin': 47, 'address': 47, 'allocation_end': 57}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44}, {'even_rows': 4, 'odd_rows': 3, 'field': 0, 'field_row': 1, 'row_pitch': 47, 'odd_start': 235, 'field_start': 44, 'row_origin': 94, 'address': 99, 'allocation_end': 379}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44}, {'even_rows': 6, 'odd_rows': 5, 'field': 0, 'field_row': 3, 'row_pitch': 67, 'odd_start': 449, 'field_start': 44, 'row_origin': 248, 'address': 288, 'allocation_end': 787}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 82, 'odd_start': 375, 'field_start': 375, 'row_origin': 624, 'address': 699, 'allocation_end': 706}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 4, 'row_pitch': 107, 'odd_start': 796, 'field_start': 44, 'row_origin': 475, 'address': 555, 'allocation_end': 1441}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 37, 'odd_start': 306, 'field_start': 44, 'row_origin': 269, 'address': 284, 'allocation_end': 531})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 8, 'odd_start': 66, 'field_start': 55, 'row_origin': 58, 'address': 58, 'allocation_end': 69}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55}, {'even_rows': 4, 'odd_rows': 4, 'field': 0, 'field_row': 1, 'row_pitch': 62, 'odd_start': 306, 'field_start': 55, 'row_origin': 120, 'address': 126, 'allocation_end': 557}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55}, {'even_rows': 6, 'odd_rows': 6, 'field': 0, 'field_row': 3, 'row_pitch': 86, 'odd_start': 574, 'field_start': 55, 'row_origin': 316, 'address': 364, 'allocation_end': 1093}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 98, 'odd_start': 450, 'field_start': 450, 'row_origin': 747, 'address': 837, 'allocation_end': 845}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55}, {'even_rows': 7, 'odd_rows': 7, 'field': 0, 'field_row': 4, 'row_pitch': 134, 'odd_start': 996, 'field_start': 55, 'row_origin': 594, 'address': 690, 'allocation_end': 1937}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 44, 'odd_start': 366, 'field_start': 55, 'row_origin': 322, 'address': 340, 'allocation_end': 633})]}
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 odd_rows.

Even scanlines precede odd scanlines in two separately tagged fields. Each field starts with its own three-byte tag. Field rows use a two-byte guard and store x-fastest pixels. 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)
    even_rows = (p["h"]+1)//2
    odd_rows = p["h"]//2
    field = p["y"]//2
    field_row = p["y"]//2
    row_pitch = p["w"]*p["b"]+2
    odd_start = p["base"]+3+even_rows*row_pitch
    field_start = p["base"] if field==0 else odd_start
    row_origin = field_start+3+field_row*row_pitch
    address = row_origin+p["x"]*p["b"]
    allocation_end = odd_start+3+odd_rows*row_pitch
    return {'even_rows': even_rows, 'odd_rows': odd_rows, 'field': field, 'field_row': field_row, 'row_pitch': row_pitch, 'odd_start': odd_start, 'field_start': field_start, 'row_origin': row_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': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 2, 'base': 11}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 4, 'odd_start': 18, 'field_start': 11, 'row_origin': 14, 'address': 14, 'allocation_end': 21}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11}, {'even_rows': 2, 'odd_rows': 2, 'field': 0, 'field_row': 1, 'row_pitch': 14, 'odd_start': 42, 'field_start': 11, 'row_origin': 28, 'address': 30, 'allocation_end': 73}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11}, {'even_rows': 4, 'odd_rows': 4, 'field': 0, 'field_row': 3, 'row_pitch': 22, 'odd_start': 102, 'field_start': 11, 'row_origin': 80, 'address': 96, 'allocation_end': 193}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 34, 'odd_start': 150, 'field_start': 150, 'row_origin': 255, 'address': 285, 'allocation_end': 289}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11}, {'even_rows': 5, 'odd_rows': 5, 'field': 0, 'field_row': 4, 'row_pitch': 38, 'odd_start': 204, 'field_start': 11, 'row_origin': 166, 'address': 198, 'allocation_end': 397}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 16, 'odd_start': 126, 'field_start': 11, 'row_origin': 110, 'address': 116, 'allocation_end': 225})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 5, 'odd_start': 30, 'field_start': 22, 'row_origin': 25, 'address': 25, 'allocation_end': 33}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22}, {'even_rows': 3, 'odd_rows': 2, 'field': 0, 'field_row': 1, 'row_pitch': 23, 'odd_start': 94, 'field_start': 22, 'row_origin': 48, 'address': 51, 'allocation_end': 143}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22}, {'even_rows': 5, 'odd_rows': 4, 'field': 0, 'field_row': 3, 'row_pitch': 35, 'odd_start': 200, 'field_start': 22, 'row_origin': 130, 'address': 154, 'allocation_end': 343}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 50, 'odd_start': 225, 'field_start': 225, 'row_origin': 378, 'address': 423, 'allocation_end': 428}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22}, {'even_rows': 6, 'odd_rows': 5, 'field': 0, 'field_row': 4, 'row_pitch': 59, 'odd_start': 379, 'field_start': 22, 'row_origin': 261, 'address': 309, 'allocation_end': 677}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 23, 'odd_start': 186, 'field_start': 22, 'row_origin': 163, 'address': 172, 'allocation_end': 327})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 6, 'odd_start': 42, 'field_start': 33, 'row_origin': 36, 'address': 36, 'allocation_end': 45}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33}, {'even_rows': 3, 'odd_rows': 3, 'field': 0, 'field_row': 1, 'row_pitch': 34, 'odd_start': 138, 'field_start': 33, 'row_origin': 70, 'address': 74, 'allocation_end': 243}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33}, {'even_rows': 5, 'odd_rows': 5, 'field': 0, 'field_row': 3, 'row_pitch': 50, 'odd_start': 286, 'field_start': 33, 'row_origin': 186, 'address': 218, 'allocation_end': 539}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 66, 'odd_start': 300, 'field_start': 300, 'row_origin': 501, 'address': 561, 'allocation_end': 567}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33}, {'even_rows': 6, 'odd_rows': 6, 'field': 0, 'field_row': 4, 'row_pitch': 82, 'odd_start': 528, 'field_start': 33, 'row_origin': 364, 'address': 428, 'allocation_end': 1023}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 30, 'odd_start': 246, 'field_start': 33, 'row_origin': 216, 'address': 228, 'allocation_end': 429})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 7, 'odd_start': 54, 'field_start': 44, 'row_origin': 47, 'address': 47, 'allocation_end': 57}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44}, {'even_rows': 4, 'odd_rows': 3, 'field': 0, 'field_row': 1, 'row_pitch': 47, 'odd_start': 235, 'field_start': 44, 'row_origin': 94, 'address': 99, 'allocation_end': 379}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44}, {'even_rows': 6, 'odd_rows': 5, 'field': 0, 'field_row': 3, 'row_pitch': 67, 'odd_start': 449, 'field_start': 44, 'row_origin': 248, 'address': 288, 'allocation_end': 787}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 82, 'odd_start': 375, 'field_start': 375, 'row_origin': 624, 'address': 699, 'allocation_end': 706}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 4, 'row_pitch': 107, 'odd_start': 796, 'field_start': 44, 'row_origin': 475, 'address': 555, 'allocation_end': 1441}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 37, 'odd_start': 306, 'field_start': 44, 'row_origin': 269, 'address': 284, 'allocation_end': 531})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 8, 'odd_start': 66, 'field_start': 55, 'row_origin': 58, 'address': 58, 'allocation_end': 69}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55}, {'even_rows': 4, 'odd_rows': 4, 'field': 0, 'field_row': 1, 'row_pitch': 62, 'odd_start': 306, 'field_start': 55, 'row_origin': 120, 'address': 126, 'allocation_end': 557}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55}, {'even_rows': 6, 'odd_rows': 6, 'field': 0, 'field_row': 3, 'row_pitch': 86, 'odd_start': 574, 'field_start': 55, 'row_origin': 316, 'address': 364, 'allocation_end': 1093}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 98, 'odd_start': 450, 'field_start': 450, 'row_origin': 747, 'address': 837, 'allocation_end': 845}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55}, {'even_rows': 7, 'odd_rows': 7, 'field': 0, 'field_row': 4, 'row_pitch': 134, 'odd_start': 996, 'field_start': 55, 'row_origin': 594, 'address': 690, 'allocation_end': 1937}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 44, 'odd_start': 366, 'field_start': 55, 'row_origin': 322, 'address': 340, 'allocation_end': 633})]}
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)
    even_rows = (p["h"]+1)//2
    odd_rows = p["h"]//2
    field = 1-p["y"]%2
    field_row = p["y"]//2
    row_pitch = p["w"]*p["b"]+2
    odd_start = p["base"]+3+even_rows*row_pitch
    field_start = p["base"] if field==0 else odd_start
    row_origin = field_start+3+field_row*row_pitch
    address = row_origin+p["x"]*p["b"]
    allocation_end = odd_start+3+odd_rows*row_pitch
    return {'even_rows': even_rows, 'odd_rows': odd_rows, 'field': field, 'field_row': field_row, 'row_pitch': row_pitch, 'odd_start': odd_start, 'field_start': field_start, 'row_origin': row_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': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 2, 'base': 11}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 4, 'odd_start': 18, 'field_start': 11, 'row_origin': 14, 'address': 14, 'allocation_end': 21}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11}, {'even_rows': 2, 'odd_rows': 2, 'field': 0, 'field_row': 1, 'row_pitch': 14, 'odd_start': 42, 'field_start': 11, 'row_origin': 28, 'address': 30, 'allocation_end': 73}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11}, {'even_rows': 4, 'odd_rows': 4, 'field': 0, 'field_row': 3, 'row_pitch': 22, 'odd_start': 102, 'field_start': 11, 'row_origin': 80, 'address': 96, 'allocation_end': 193}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 34, 'odd_start': 150, 'field_start': 150, 'row_origin': 255, 'address': 285, 'allocation_end': 289}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11}, {'even_rows': 5, 'odd_rows': 5, 'field': 0, 'field_row': 4, 'row_pitch': 38, 'odd_start': 204, 'field_start': 11, 'row_origin': 166, 'address': 198, 'allocation_end': 397}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 16, 'odd_start': 126, 'field_start': 11, 'row_origin': 110, 'address': 116, 'allocation_end': 225})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 5, 'odd_start': 30, 'field_start': 22, 'row_origin': 25, 'address': 25, 'allocation_end': 33}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22}, {'even_rows': 3, 'odd_rows': 2, 'field': 0, 'field_row': 1, 'row_pitch': 23, 'odd_start': 94, 'field_start': 22, 'row_origin': 48, 'address': 51, 'allocation_end': 143}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22}, {'even_rows': 5, 'odd_rows': 4, 'field': 0, 'field_row': 3, 'row_pitch': 35, 'odd_start': 200, 'field_start': 22, 'row_origin': 130, 'address': 154, 'allocation_end': 343}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 50, 'odd_start': 225, 'field_start': 225, 'row_origin': 378, 'address': 423, 'allocation_end': 428}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22}, {'even_rows': 6, 'odd_rows': 5, 'field': 0, 'field_row': 4, 'row_pitch': 59, 'odd_start': 379, 'field_start': 22, 'row_origin': 261, 'address': 309, 'allocation_end': 677}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 23, 'odd_start': 186, 'field_start': 22, 'row_origin': 163, 'address': 172, 'allocation_end': 327})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 6, 'odd_start': 42, 'field_start': 33, 'row_origin': 36, 'address': 36, 'allocation_end': 45}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33}, {'even_rows': 3, 'odd_rows': 3, 'field': 0, 'field_row': 1, 'row_pitch': 34, 'odd_start': 138, 'field_start': 33, 'row_origin': 70, 'address': 74, 'allocation_end': 243}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33}, {'even_rows': 5, 'odd_rows': 5, 'field': 0, 'field_row': 3, 'row_pitch': 50, 'odd_start': 286, 'field_start': 33, 'row_origin': 186, 'address': 218, 'allocation_end': 539}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 66, 'odd_start': 300, 'field_start': 300, 'row_origin': 501, 'address': 561, 'allocation_end': 567}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33}, {'even_rows': 6, 'odd_rows': 6, 'field': 0, 'field_row': 4, 'row_pitch': 82, 'odd_start': 528, 'field_start': 33, 'row_origin': 364, 'address': 428, 'allocation_end': 1023}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 30, 'odd_start': 246, 'field_start': 33, 'row_origin': 216, 'address': 228, 'allocation_end': 429})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 7, 'odd_start': 54, 'field_start': 44, 'row_origin': 47, 'address': 47, 'allocation_end': 57}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44}, {'even_rows': 4, 'odd_rows': 3, 'field': 0, 'field_row': 1, 'row_pitch': 47, 'odd_start': 235, 'field_start': 44, 'row_origin': 94, 'address': 99, 'allocation_end': 379}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44}, {'even_rows': 6, 'odd_rows': 5, 'field': 0, 'field_row': 3, 'row_pitch': 67, 'odd_start': 449, 'field_start': 44, 'row_origin': 248, 'address': 288, 'allocation_end': 787}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 82, 'odd_start': 375, 'field_start': 375, 'row_origin': 624, 'address': 699, 'allocation_end': 706}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 4, 'row_pitch': 107, 'odd_start': 796, 'field_start': 44, 'row_origin': 475, 'address': 555, 'allocation_end': 1441}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 37, 'odd_start': 306, 'field_start': 44, 'row_origin': 269, 'address': 284, 'allocation_end': 531})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 8, 'odd_start': 66, 'field_start': 55, 'row_origin': 58, 'address': 58, 'allocation_end': 69}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55}, {'even_rows': 4, 'odd_rows': 4, 'field': 0, 'field_row': 1, 'row_pitch': 62, 'odd_start': 306, 'field_start': 55, 'row_origin': 120, 'address': 126, 'allocation_end': 557}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55}, {'even_rows': 6, 'odd_rows': 6, 'field': 0, 'field_row': 3, 'row_pitch': 86, 'odd_start': 574, 'field_start': 55, 'row_origin': 316, 'address': 364, 'allocation_end': 1093}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 98, 'odd_start': 450, 'field_start': 450, 'row_origin': 747, 'address': 837, 'allocation_end': 845}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55}, {'even_rows': 7, 'odd_rows': 7, 'field': 0, 'field_row': 4, 'row_pitch': 134, 'odd_start': 996, 'field_start': 55, 'row_origin': 594, 'address': 690, 'allocation_end': 1937}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 44, 'odd_start': 366, 'field_start': 55, 'row_origin': 322, 'address': 340, 'allocation_end': 633})]}
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 field.

Even scanlines precede odd scanlines in two separately tagged fields. Each field starts with its own three-byte tag. Field rows use a two-byte guard and store x-fastest pixels. 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)
    even_rows = (p["h"]+1)//2
    odd_rows = p["h"]//2
    field = p["y"]%2
    field_row = p["y"]
    row_pitch = p["w"]*p["b"]+2
    odd_start = p["base"]+3+even_rows*row_pitch
    field_start = p["base"] if field==0 else odd_start
    row_origin = field_start+3+field_row*row_pitch
    address = row_origin+p["x"]*p["b"]
    allocation_end = odd_start+3+odd_rows*row_pitch
    return {'even_rows': even_rows, 'odd_rows': odd_rows, 'field': field, 'field_row': field_row, 'row_pitch': row_pitch, 'odd_start': odd_start, 'field_start': field_start, 'row_origin': row_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': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 2, 'base': 11}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 4, 'odd_start': 18, 'field_start': 11, 'row_origin': 14, 'address': 14, 'allocation_end': 21}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11}, {'even_rows': 2, 'odd_rows': 2, 'field': 0, 'field_row': 1, 'row_pitch': 14, 'odd_start': 42, 'field_start': 11, 'row_origin': 28, 'address': 30, 'allocation_end': 73}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11}, {'even_rows': 4, 'odd_rows': 4, 'field': 0, 'field_row': 3, 'row_pitch': 22, 'odd_start': 102, 'field_start': 11, 'row_origin': 80, 'address': 96, 'allocation_end': 193}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 34, 'odd_start': 150, 'field_start': 150, 'row_origin': 255, 'address': 285, 'allocation_end': 289}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11}, {'even_rows': 5, 'odd_rows': 5, 'field': 0, 'field_row': 4, 'row_pitch': 38, 'odd_start': 204, 'field_start': 11, 'row_origin': 166, 'address': 198, 'allocation_end': 397}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 16, 'odd_start': 126, 'field_start': 11, 'row_origin': 110, 'address': 116, 'allocation_end': 225})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 5, 'odd_start': 30, 'field_start': 22, 'row_origin': 25, 'address': 25, 'allocation_end': 33}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22}, {'even_rows': 3, 'odd_rows': 2, 'field': 0, 'field_row': 1, 'row_pitch': 23, 'odd_start': 94, 'field_start': 22, 'row_origin': 48, 'address': 51, 'allocation_end': 143}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22}, {'even_rows': 5, 'odd_rows': 4, 'field': 0, 'field_row': 3, 'row_pitch': 35, 'odd_start': 200, 'field_start': 22, 'row_origin': 130, 'address': 154, 'allocation_end': 343}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 50, 'odd_start': 225, 'field_start': 225, 'row_origin': 378, 'address': 423, 'allocation_end': 428}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22}, {'even_rows': 6, 'odd_rows': 5, 'field': 0, 'field_row': 4, 'row_pitch': 59, 'odd_start': 379, 'field_start': 22, 'row_origin': 261, 'address': 309, 'allocation_end': 677}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 23, 'odd_start': 186, 'field_start': 22, 'row_origin': 163, 'address': 172, 'allocation_end': 327})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 6, 'odd_start': 42, 'field_start': 33, 'row_origin': 36, 'address': 36, 'allocation_end': 45}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33}, {'even_rows': 3, 'odd_rows': 3, 'field': 0, 'field_row': 1, 'row_pitch': 34, 'odd_start': 138, 'field_start': 33, 'row_origin': 70, 'address': 74, 'allocation_end': 243}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33}, {'even_rows': 5, 'odd_rows': 5, 'field': 0, 'field_row': 3, 'row_pitch': 50, 'odd_start': 286, 'field_start': 33, 'row_origin': 186, 'address': 218, 'allocation_end': 539}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 66, 'odd_start': 300, 'field_start': 300, 'row_origin': 501, 'address': 561, 'allocation_end': 567}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33}, {'even_rows': 6, 'odd_rows': 6, 'field': 0, 'field_row': 4, 'row_pitch': 82, 'odd_start': 528, 'field_start': 33, 'row_origin': 364, 'address': 428, 'allocation_end': 1023}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 30, 'odd_start': 246, 'field_start': 33, 'row_origin': 216, 'address': 228, 'allocation_end': 429})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 7, 'odd_start': 54, 'field_start': 44, 'row_origin': 47, 'address': 47, 'allocation_end': 57}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44}, {'even_rows': 4, 'odd_rows': 3, 'field': 0, 'field_row': 1, 'row_pitch': 47, 'odd_start': 235, 'field_start': 44, 'row_origin': 94, 'address': 99, 'allocation_end': 379}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44}, {'even_rows': 6, 'odd_rows': 5, 'field': 0, 'field_row': 3, 'row_pitch': 67, 'odd_start': 449, 'field_start': 44, 'row_origin': 248, 'address': 288, 'allocation_end': 787}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 82, 'odd_start': 375, 'field_start': 375, 'row_origin': 624, 'address': 699, 'allocation_end': 706}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 4, 'row_pitch': 107, 'odd_start': 796, 'field_start': 44, 'row_origin': 475, 'address': 555, 'allocation_end': 1441}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 37, 'odd_start': 306, 'field_start': 44, 'row_origin': 269, 'address': 284, 'allocation_end': 531})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 8, 'odd_start': 66, 'field_start': 55, 'row_origin': 58, 'address': 58, 'allocation_end': 69}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55}, {'even_rows': 4, 'odd_rows': 4, 'field': 0, 'field_row': 1, 'row_pitch': 62, 'odd_start': 306, 'field_start': 55, 'row_origin': 120, 'address': 126, 'allocation_end': 557}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55}, {'even_rows': 6, 'odd_rows': 6, 'field': 0, 'field_row': 3, 'row_pitch': 86, 'odd_start': 574, 'field_start': 55, 'row_origin': 316, 'address': 364, 'allocation_end': 1093}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 98, 'odd_start': 450, 'field_start': 450, 'row_origin': 747, 'address': 837, 'allocation_end': 845}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55}, {'even_rows': 7, 'odd_rows': 7, 'field': 0, 'field_row': 4, 'row_pitch': 134, 'odd_start': 996, 'field_start': 55, 'row_origin': 594, 'address': 690, 'allocation_end': 1937}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 44, 'odd_start': 366, 'field_start': 55, 'row_origin': 322, 'address': 340, 'allocation_end': 633})]}
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)
    even_rows = (p["h"]+1)//2
    odd_rows = p["h"]//2
    field = p["y"]%2
    field_row = p["y"]%2
    row_pitch = p["w"]*p["b"]+2
    odd_start = p["base"]+3+even_rows*row_pitch
    field_start = p["base"] if field==0 else odd_start
    row_origin = field_start+3+field_row*row_pitch
    address = row_origin+p["x"]*p["b"]
    allocation_end = odd_start+3+odd_rows*row_pitch
    return {'even_rows': even_rows, 'odd_rows': odd_rows, 'field': field, 'field_row': field_row, 'row_pitch': row_pitch, 'odd_start': odd_start, 'field_start': field_start, 'row_origin': row_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': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 2, 'base': 11}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 4, 'odd_start': 18, 'field_start': 11, 'row_origin': 14, 'address': 14, 'allocation_end': 21}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11}, {'even_rows': 2, 'odd_rows': 2, 'field': 0, 'field_row': 1, 'row_pitch': 14, 'odd_start': 42, 'field_start': 11, 'row_origin': 28, 'address': 30, 'allocation_end': 73}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11}, {'even_rows': 4, 'odd_rows': 4, 'field': 0, 'field_row': 3, 'row_pitch': 22, 'odd_start': 102, 'field_start': 11, 'row_origin': 80, 'address': 96, 'allocation_end': 193}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 34, 'odd_start': 150, 'field_start': 150, 'row_origin': 255, 'address': 285, 'allocation_end': 289}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11}, {'even_rows': 5, 'odd_rows': 5, 'field': 0, 'field_row': 4, 'row_pitch': 38, 'odd_start': 204, 'field_start': 11, 'row_origin': 166, 'address': 198, 'allocation_end': 397}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 16, 'odd_start': 126, 'field_start': 11, 'row_origin': 110, 'address': 116, 'allocation_end': 225})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 5, 'odd_start': 30, 'field_start': 22, 'row_origin': 25, 'address': 25, 'allocation_end': 33}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22}, {'even_rows': 3, 'odd_rows': 2, 'field': 0, 'field_row': 1, 'row_pitch': 23, 'odd_start': 94, 'field_start': 22, 'row_origin': 48, 'address': 51, 'allocation_end': 143}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22}, {'even_rows': 5, 'odd_rows': 4, 'field': 0, 'field_row': 3, 'row_pitch': 35, 'odd_start': 200, 'field_start': 22, 'row_origin': 130, 'address': 154, 'allocation_end': 343}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 50, 'odd_start': 225, 'field_start': 225, 'row_origin': 378, 'address': 423, 'allocation_end': 428}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22}, {'even_rows': 6, 'odd_rows': 5, 'field': 0, 'field_row': 4, 'row_pitch': 59, 'odd_start': 379, 'field_start': 22, 'row_origin': 261, 'address': 309, 'allocation_end': 677}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 23, 'odd_start': 186, 'field_start': 22, 'row_origin': 163, 'address': 172, 'allocation_end': 327})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 6, 'odd_start': 42, 'field_start': 33, 'row_origin': 36, 'address': 36, 'allocation_end': 45}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33}, {'even_rows': 3, 'odd_rows': 3, 'field': 0, 'field_row': 1, 'row_pitch': 34, 'odd_start': 138, 'field_start': 33, 'row_origin': 70, 'address': 74, 'allocation_end': 243}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33}, {'even_rows': 5, 'odd_rows': 5, 'field': 0, 'field_row': 3, 'row_pitch': 50, 'odd_start': 286, 'field_start': 33, 'row_origin': 186, 'address': 218, 'allocation_end': 539}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 66, 'odd_start': 300, 'field_start': 300, 'row_origin': 501, 'address': 561, 'allocation_end': 567}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33}, {'even_rows': 6, 'odd_rows': 6, 'field': 0, 'field_row': 4, 'row_pitch': 82, 'odd_start': 528, 'field_start': 33, 'row_origin': 364, 'address': 428, 'allocation_end': 1023}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 30, 'odd_start': 246, 'field_start': 33, 'row_origin': 216, 'address': 228, 'allocation_end': 429})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 7, 'odd_start': 54, 'field_start': 44, 'row_origin': 47, 'address': 47, 'allocation_end': 57}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44}, {'even_rows': 4, 'odd_rows': 3, 'field': 0, 'field_row': 1, 'row_pitch': 47, 'odd_start': 235, 'field_start': 44, 'row_origin': 94, 'address': 99, 'allocation_end': 379}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44}, {'even_rows': 6, 'odd_rows': 5, 'field': 0, 'field_row': 3, 'row_pitch': 67, 'odd_start': 449, 'field_start': 44, 'row_origin': 248, 'address': 288, 'allocation_end': 787}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 82, 'odd_start': 375, 'field_start': 375, 'row_origin': 624, 'address': 699, 'allocation_end': 706}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 4, 'row_pitch': 107, 'odd_start': 796, 'field_start': 44, 'row_origin': 475, 'address': 555, 'allocation_end': 1441}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 37, 'odd_start': 306, 'field_start': 44, 'row_origin': 269, 'address': 284, 'allocation_end': 531})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 8, 'odd_start': 66, 'field_start': 55, 'row_origin': 58, 'address': 58, 'allocation_end': 69}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55}, {'even_rows': 4, 'odd_rows': 4, 'field': 0, 'field_row': 1, 'row_pitch': 62, 'odd_start': 306, 'field_start': 55, 'row_origin': 120, 'address': 126, 'allocation_end': 557}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55}, {'even_rows': 6, 'odd_rows': 6, 'field': 0, 'field_row': 3, 'row_pitch': 86, 'odd_start': 574, 'field_start': 55, 'row_origin': 316, 'address': 364, 'allocation_end': 1093}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 98, 'odd_start': 450, 'field_start': 450, 'row_origin': 747, 'address': 837, 'allocation_end': 845}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55}, {'even_rows': 7, 'odd_rows': 7, 'field': 0, 'field_row': 4, 'row_pitch': 134, 'odd_start': 996, 'field_start': 55, 'row_origin': 594, 'address': 690, 'allocation_end': 1937}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 44, 'odd_start': 366, 'field_start': 55, 'row_origin': 322, 'address': 340, 'allocation_end': 633})]}
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 field_row.

Even scanlines precede odd scanlines in two separately tagged fields. Each field starts with its own three-byte tag. Field rows use a two-byte guard and store x-fastest pixels. 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)
    even_rows = (p["h"]+1)//2
    odd_rows = p["h"]//2
    field = p["y"]%2
    field_row = p["y"]//2
    row_pitch = p["w"]*p["b"]
    odd_start = p["base"]+3+even_rows*row_pitch
    field_start = p["base"] if field==0 else odd_start
    row_origin = field_start+3+field_row*row_pitch
    address = row_origin+p["x"]*p["b"]
    allocation_end = odd_start+3+odd_rows*row_pitch
    return {'even_rows': even_rows, 'odd_rows': odd_rows, 'field': field, 'field_row': field_row, 'row_pitch': row_pitch, 'odd_start': odd_start, 'field_start': field_start, 'row_origin': row_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': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 2, 'base': 11}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 4, 'odd_start': 18, 'field_start': 11, 'row_origin': 14, 'address': 14, 'allocation_end': 21}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11}, {'even_rows': 2, 'odd_rows': 2, 'field': 0, 'field_row': 1, 'row_pitch': 14, 'odd_start': 42, 'field_start': 11, 'row_origin': 28, 'address': 30, 'allocation_end': 73}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11}, {'even_rows': 4, 'odd_rows': 4, 'field': 0, 'field_row': 3, 'row_pitch': 22, 'odd_start': 102, 'field_start': 11, 'row_origin': 80, 'address': 96, 'allocation_end': 193}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 34, 'odd_start': 150, 'field_start': 150, 'row_origin': 255, 'address': 285, 'allocation_end': 289}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11}, {'even_rows': 5, 'odd_rows': 5, 'field': 0, 'field_row': 4, 'row_pitch': 38, 'odd_start': 204, 'field_start': 11, 'row_origin': 166, 'address': 198, 'allocation_end': 397}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 16, 'odd_start': 126, 'field_start': 11, 'row_origin': 110, 'address': 116, 'allocation_end': 225})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 5, 'odd_start': 30, 'field_start': 22, 'row_origin': 25, 'address': 25, 'allocation_end': 33}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22}, {'even_rows': 3, 'odd_rows': 2, 'field': 0, 'field_row': 1, 'row_pitch': 23, 'odd_start': 94, 'field_start': 22, 'row_origin': 48, 'address': 51, 'allocation_end': 143}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22}, {'even_rows': 5, 'odd_rows': 4, 'field': 0, 'field_row': 3, 'row_pitch': 35, 'odd_start': 200, 'field_start': 22, 'row_origin': 130, 'address': 154, 'allocation_end': 343}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 50, 'odd_start': 225, 'field_start': 225, 'row_origin': 378, 'address': 423, 'allocation_end': 428}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22}, {'even_rows': 6, 'odd_rows': 5, 'field': 0, 'field_row': 4, 'row_pitch': 59, 'odd_start': 379, 'field_start': 22, 'row_origin': 261, 'address': 309, 'allocation_end': 677}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 23, 'odd_start': 186, 'field_start': 22, 'row_origin': 163, 'address': 172, 'allocation_end': 327})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 6, 'odd_start': 42, 'field_start': 33, 'row_origin': 36, 'address': 36, 'allocation_end': 45}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33}, {'even_rows': 3, 'odd_rows': 3, 'field': 0, 'field_row': 1, 'row_pitch': 34, 'odd_start': 138, 'field_start': 33, 'row_origin': 70, 'address': 74, 'allocation_end': 243}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33}, {'even_rows': 5, 'odd_rows': 5, 'field': 0, 'field_row': 3, 'row_pitch': 50, 'odd_start': 286, 'field_start': 33, 'row_origin': 186, 'address': 218, 'allocation_end': 539}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 66, 'odd_start': 300, 'field_start': 300, 'row_origin': 501, 'address': 561, 'allocation_end': 567}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33}, {'even_rows': 6, 'odd_rows': 6, 'field': 0, 'field_row': 4, 'row_pitch': 82, 'odd_start': 528, 'field_start': 33, 'row_origin': 364, 'address': 428, 'allocation_end': 1023}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 30, 'odd_start': 246, 'field_start': 33, 'row_origin': 216, 'address': 228, 'allocation_end': 429})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 7, 'odd_start': 54, 'field_start': 44, 'row_origin': 47, 'address': 47, 'allocation_end': 57}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44}, {'even_rows': 4, 'odd_rows': 3, 'field': 0, 'field_row': 1, 'row_pitch': 47, 'odd_start': 235, 'field_start': 44, 'row_origin': 94, 'address': 99, 'allocation_end': 379}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44}, {'even_rows': 6, 'odd_rows': 5, 'field': 0, 'field_row': 3, 'row_pitch': 67, 'odd_start': 449, 'field_start': 44, 'row_origin': 248, 'address': 288, 'allocation_end': 787}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 82, 'odd_start': 375, 'field_start': 375, 'row_origin': 624, 'address': 699, 'allocation_end': 706}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 4, 'row_pitch': 107, 'odd_start': 796, 'field_start': 44, 'row_origin': 475, 'address': 555, 'allocation_end': 1441}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 37, 'odd_start': 306, 'field_start': 44, 'row_origin': 269, 'address': 284, 'allocation_end': 531})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 8, 'odd_start': 66, 'field_start': 55, 'row_origin': 58, 'address': 58, 'allocation_end': 69}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55}, {'even_rows': 4, 'odd_rows': 4, 'field': 0, 'field_row': 1, 'row_pitch': 62, 'odd_start': 306, 'field_start': 55, 'row_origin': 120, 'address': 126, 'allocation_end': 557}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55}, {'even_rows': 6, 'odd_rows': 6, 'field': 0, 'field_row': 3, 'row_pitch': 86, 'odd_start': 574, 'field_start': 55, 'row_origin': 316, 'address': 364, 'allocation_end': 1093}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 98, 'odd_start': 450, 'field_start': 450, 'row_origin': 747, 'address': 837, 'allocation_end': 845}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55}, {'even_rows': 7, 'odd_rows': 7, 'field': 0, 'field_row': 4, 'row_pitch': 134, 'odd_start': 996, 'field_start': 55, 'row_origin': 594, 'address': 690, 'allocation_end': 1937}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 44, 'odd_start': 366, 'field_start': 55, 'row_origin': 322, 'address': 340, 'allocation_end': 633})]}
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)
    even_rows = (p["h"]+1)//2
    odd_rows = p["h"]//2
    field = p["y"]%2
    field_row = p["y"]//2
    row_pitch = p["w"]*(p["b"]+2)
    odd_start = p["base"]+3+even_rows*row_pitch
    field_start = p["base"] if field==0 else odd_start
    row_origin = field_start+3+field_row*row_pitch
    address = row_origin+p["x"]*p["b"]
    allocation_end = odd_start+3+odd_rows*row_pitch
    return {'even_rows': even_rows, 'odd_rows': odd_rows, 'field': field, 'field_row': field_row, 'row_pitch': row_pitch, 'odd_start': odd_start, 'field_start': field_start, 'row_origin': row_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': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 2, 'base': 11}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 4, 'odd_start': 18, 'field_start': 11, 'row_origin': 14, 'address': 14, 'allocation_end': 21}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11}, {'even_rows': 2, 'odd_rows': 2, 'field': 0, 'field_row': 1, 'row_pitch': 14, 'odd_start': 42, 'field_start': 11, 'row_origin': 28, 'address': 30, 'allocation_end': 73}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11}, {'even_rows': 4, 'odd_rows': 4, 'field': 0, 'field_row': 3, 'row_pitch': 22, 'odd_start': 102, 'field_start': 11, 'row_origin': 80, 'address': 96, 'allocation_end': 193}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 34, 'odd_start': 150, 'field_start': 150, 'row_origin': 255, 'address': 285, 'allocation_end': 289}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11}, {'even_rows': 5, 'odd_rows': 5, 'field': 0, 'field_row': 4, 'row_pitch': 38, 'odd_start': 204, 'field_start': 11, 'row_origin': 166, 'address': 198, 'allocation_end': 397}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 16, 'odd_start': 126, 'field_start': 11, 'row_origin': 110, 'address': 116, 'allocation_end': 225})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 5, 'odd_start': 30, 'field_start': 22, 'row_origin': 25, 'address': 25, 'allocation_end': 33}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22}, {'even_rows': 3, 'odd_rows': 2, 'field': 0, 'field_row': 1, 'row_pitch': 23, 'odd_start': 94, 'field_start': 22, 'row_origin': 48, 'address': 51, 'allocation_end': 143}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22}, {'even_rows': 5, 'odd_rows': 4, 'field': 0, 'field_row': 3, 'row_pitch': 35, 'odd_start': 200, 'field_start': 22, 'row_origin': 130, 'address': 154, 'allocation_end': 343}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 50, 'odd_start': 225, 'field_start': 225, 'row_origin': 378, 'address': 423, 'allocation_end': 428}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22}, {'even_rows': 6, 'odd_rows': 5, 'field': 0, 'field_row': 4, 'row_pitch': 59, 'odd_start': 379, 'field_start': 22, 'row_origin': 261, 'address': 309, 'allocation_end': 677}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 23, 'odd_start': 186, 'field_start': 22, 'row_origin': 163, 'address': 172, 'allocation_end': 327})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 6, 'odd_start': 42, 'field_start': 33, 'row_origin': 36, 'address': 36, 'allocation_end': 45}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33}, {'even_rows': 3, 'odd_rows': 3, 'field': 0, 'field_row': 1, 'row_pitch': 34, 'odd_start': 138, 'field_start': 33, 'row_origin': 70, 'address': 74, 'allocation_end': 243}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33}, {'even_rows': 5, 'odd_rows': 5, 'field': 0, 'field_row': 3, 'row_pitch': 50, 'odd_start': 286, 'field_start': 33, 'row_origin': 186, 'address': 218, 'allocation_end': 539}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 66, 'odd_start': 300, 'field_start': 300, 'row_origin': 501, 'address': 561, 'allocation_end': 567}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33}, {'even_rows': 6, 'odd_rows': 6, 'field': 0, 'field_row': 4, 'row_pitch': 82, 'odd_start': 528, 'field_start': 33, 'row_origin': 364, 'address': 428, 'allocation_end': 1023}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 30, 'odd_start': 246, 'field_start': 33, 'row_origin': 216, 'address': 228, 'allocation_end': 429})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 7, 'odd_start': 54, 'field_start': 44, 'row_origin': 47, 'address': 47, 'allocation_end': 57}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44}, {'even_rows': 4, 'odd_rows': 3, 'field': 0, 'field_row': 1, 'row_pitch': 47, 'odd_start': 235, 'field_start': 44, 'row_origin': 94, 'address': 99, 'allocation_end': 379}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44}, {'even_rows': 6, 'odd_rows': 5, 'field': 0, 'field_row': 3, 'row_pitch': 67, 'odd_start': 449, 'field_start': 44, 'row_origin': 248, 'address': 288, 'allocation_end': 787}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 82, 'odd_start': 375, 'field_start': 375, 'row_origin': 624, 'address': 699, 'allocation_end': 706}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 4, 'row_pitch': 107, 'odd_start': 796, 'field_start': 44, 'row_origin': 475, 'address': 555, 'allocation_end': 1441}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 37, 'odd_start': 306, 'field_start': 44, 'row_origin': 269, 'address': 284, 'allocation_end': 531})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 8, 'odd_start': 66, 'field_start': 55, 'row_origin': 58, 'address': 58, 'allocation_end': 69}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55}, {'even_rows': 4, 'odd_rows': 4, 'field': 0, 'field_row': 1, 'row_pitch': 62, 'odd_start': 306, 'field_start': 55, 'row_origin': 120, 'address': 126, 'allocation_end': 557}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55}, {'even_rows': 6, 'odd_rows': 6, 'field': 0, 'field_row': 3, 'row_pitch': 86, 'odd_start': 574, 'field_start': 55, 'row_origin': 316, 'address': 364, 'allocation_end': 1093}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 98, 'odd_start': 450, 'field_start': 450, 'row_origin': 747, 'address': 837, 'allocation_end': 845}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55}, {'even_rows': 7, 'odd_rows': 7, 'field': 0, 'field_row': 4, 'row_pitch': 134, 'odd_start': 996, 'field_start': 55, 'row_origin': 594, 'address': 690, 'allocation_end': 1937}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 44, 'odd_start': 366, 'field_start': 55, 'row_origin': 322, 'address': 340, 'allocation_end': 633})]}
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 row_pitch.

Even scanlines precede odd scanlines in two separately tagged fields. Each field starts with its own three-byte tag. Field rows use a two-byte guard and store x-fastest pixels. 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)
    even_rows = (p["h"]+1)//2
    odd_rows = p["h"]//2
    field = p["y"]%2
    field_row = p["y"]//2
    row_pitch = p["w"]*p["b"]+2
    odd_start = p["base"]+3+odd_rows*row_pitch
    field_start = p["base"] if field==0 else odd_start
    row_origin = field_start+3+field_row*row_pitch
    address = row_origin+p["x"]*p["b"]
    allocation_end = odd_start+3+odd_rows*row_pitch
    return {'even_rows': even_rows, 'odd_rows': odd_rows, 'field': field, 'field_row': field_row, 'row_pitch': row_pitch, 'odd_start': odd_start, 'field_start': field_start, 'row_origin': row_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': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 2, 'base': 11}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 4, 'odd_start': 18, 'field_start': 11, 'row_origin': 14, 'address': 14, 'allocation_end': 21}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11}, {'even_rows': 2, 'odd_rows': 2, 'field': 0, 'field_row': 1, 'row_pitch': 14, 'odd_start': 42, 'field_start': 11, 'row_origin': 28, 'address': 30, 'allocation_end': 73}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11}, {'even_rows': 4, 'odd_rows': 4, 'field': 0, 'field_row': 3, 'row_pitch': 22, 'odd_start': 102, 'field_start': 11, 'row_origin': 80, 'address': 96, 'allocation_end': 193}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 34, 'odd_start': 150, 'field_start': 150, 'row_origin': 255, 'address': 285, 'allocation_end': 289}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11}, {'even_rows': 5, 'odd_rows': 5, 'field': 0, 'field_row': 4, 'row_pitch': 38, 'odd_start': 204, 'field_start': 11, 'row_origin': 166, 'address': 198, 'allocation_end': 397}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 16, 'odd_start': 126, 'field_start': 11, 'row_origin': 110, 'address': 116, 'allocation_end': 225})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 5, 'odd_start': 30, 'field_start': 22, 'row_origin': 25, 'address': 25, 'allocation_end': 33}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22}, {'even_rows': 3, 'odd_rows': 2, 'field': 0, 'field_row': 1, 'row_pitch': 23, 'odd_start': 94, 'field_start': 22, 'row_origin': 48, 'address': 51, 'allocation_end': 143}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22}, {'even_rows': 5, 'odd_rows': 4, 'field': 0, 'field_row': 3, 'row_pitch': 35, 'odd_start': 200, 'field_start': 22, 'row_origin': 130, 'address': 154, 'allocation_end': 343}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 50, 'odd_start': 225, 'field_start': 225, 'row_origin': 378, 'address': 423, 'allocation_end': 428}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22}, {'even_rows': 6, 'odd_rows': 5, 'field': 0, 'field_row': 4, 'row_pitch': 59, 'odd_start': 379, 'field_start': 22, 'row_origin': 261, 'address': 309, 'allocation_end': 677}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 23, 'odd_start': 186, 'field_start': 22, 'row_origin': 163, 'address': 172, 'allocation_end': 327})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 6, 'odd_start': 42, 'field_start': 33, 'row_origin': 36, 'address': 36, 'allocation_end': 45}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33}, {'even_rows': 3, 'odd_rows': 3, 'field': 0, 'field_row': 1, 'row_pitch': 34, 'odd_start': 138, 'field_start': 33, 'row_origin': 70, 'address': 74, 'allocation_end': 243}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33}, {'even_rows': 5, 'odd_rows': 5, 'field': 0, 'field_row': 3, 'row_pitch': 50, 'odd_start': 286, 'field_start': 33, 'row_origin': 186, 'address': 218, 'allocation_end': 539}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 66, 'odd_start': 300, 'field_start': 300, 'row_origin': 501, 'address': 561, 'allocation_end': 567}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33}, {'even_rows': 6, 'odd_rows': 6, 'field': 0, 'field_row': 4, 'row_pitch': 82, 'odd_start': 528, 'field_start': 33, 'row_origin': 364, 'address': 428, 'allocation_end': 1023}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 30, 'odd_start': 246, 'field_start': 33, 'row_origin': 216, 'address': 228, 'allocation_end': 429})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 7, 'odd_start': 54, 'field_start': 44, 'row_origin': 47, 'address': 47, 'allocation_end': 57}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44}, {'even_rows': 4, 'odd_rows': 3, 'field': 0, 'field_row': 1, 'row_pitch': 47, 'odd_start': 235, 'field_start': 44, 'row_origin': 94, 'address': 99, 'allocation_end': 379}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44}, {'even_rows': 6, 'odd_rows': 5, 'field': 0, 'field_row': 3, 'row_pitch': 67, 'odd_start': 449, 'field_start': 44, 'row_origin': 248, 'address': 288, 'allocation_end': 787}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 82, 'odd_start': 375, 'field_start': 375, 'row_origin': 624, 'address': 699, 'allocation_end': 706}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 4, 'row_pitch': 107, 'odd_start': 796, 'field_start': 44, 'row_origin': 475, 'address': 555, 'allocation_end': 1441}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 37, 'odd_start': 306, 'field_start': 44, 'row_origin': 269, 'address': 284, 'allocation_end': 531})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 8, 'odd_start': 66, 'field_start': 55, 'row_origin': 58, 'address': 58, 'allocation_end': 69}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55}, {'even_rows': 4, 'odd_rows': 4, 'field': 0, 'field_row': 1, 'row_pitch': 62, 'odd_start': 306, 'field_start': 55, 'row_origin': 120, 'address': 126, 'allocation_end': 557}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55}, {'even_rows': 6, 'odd_rows': 6, 'field': 0, 'field_row': 3, 'row_pitch': 86, 'odd_start': 574, 'field_start': 55, 'row_origin': 316, 'address': 364, 'allocation_end': 1093}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 98, 'odd_start': 450, 'field_start': 450, 'row_origin': 747, 'address': 837, 'allocation_end': 845}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55}, {'even_rows': 7, 'odd_rows': 7, 'field': 0, 'field_row': 4, 'row_pitch': 134, 'odd_start': 996, 'field_start': 55, 'row_origin': 594, 'address': 690, 'allocation_end': 1937}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 44, 'odd_start': 366, 'field_start': 55, 'row_origin': 322, 'address': 340, 'allocation_end': 633})]}
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)
    even_rows = (p["h"]+1)//2
    odd_rows = p["h"]//2
    field = p["y"]%2
    field_row = p["y"]//2
    row_pitch = p["w"]*p["b"]+2
    odd_start = p["base"]+even_rows*row_pitch
    field_start = p["base"] if field==0 else odd_start
    row_origin = field_start+3+field_row*row_pitch
    address = row_origin+p["x"]*p["b"]
    allocation_end = odd_start+3+odd_rows*row_pitch
    return {'even_rows': even_rows, 'odd_rows': odd_rows, 'field': field, 'field_row': field_row, 'row_pitch': row_pitch, 'odd_start': odd_start, 'field_start': field_start, 'row_origin': row_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': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 2, 'base': 11}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 4, 'odd_start': 18, 'field_start': 11, 'row_origin': 14, 'address': 14, 'allocation_end': 21}), ({'w': 6, 'h': 4, 'x': 1, 'y': 2, 'b': 2, 'base': 11}, {'even_rows': 2, 'odd_rows': 2, 'field': 0, 'field_row': 1, 'row_pitch': 14, 'odd_start': 42, 'field_start': 11, 'row_origin': 28, 'address': 30, 'allocation_end': 73}), ({'w': 10, 'h': 8, 'x': 8, 'y': 6, 'b': 2, 'base': 11}, {'even_rows': 4, 'odd_rows': 4, 'field': 0, 'field_row': 3, 'row_pitch': 22, 'odd_start': 102, 'field_start': 11, 'row_origin': 80, 'address': 96, 'allocation_end': 193}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 2, 'base': 11}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 34, 'odd_start': 150, 'field_start': 150, 'row_origin': 255, 'address': 285, 'allocation_end': 289}), ({'w': 18, 'h': 10, 'x': 16, 'y': 8, 'b': 2, 'base': 11}, {'even_rows': 5, 'odd_rows': 5, 'field': 0, 'field_row': 4, 'row_pitch': 38, 'odd_start': 204, 'field_start': 11, 'row_origin': 166, 'address': 198, 'allocation_end': 397}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 2, 'base': 11}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 16, 'odd_start': 126, 'field_start': 11, 'row_origin': 110, 'address': 116, 'allocation_end': 225})], 2: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 3, 'base': 22}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 5, 'odd_start': 30, 'field_start': 22, 'row_origin': 25, 'address': 25, 'allocation_end': 33}), ({'w': 7, 'h': 5, 'x': 1, 'y': 2, 'b': 3, 'base': 22}, {'even_rows': 3, 'odd_rows': 2, 'field': 0, 'field_row': 1, 'row_pitch': 23, 'odd_start': 94, 'field_start': 22, 'row_origin': 48, 'address': 51, 'allocation_end': 143}), ({'w': 11, 'h': 9, 'x': 8, 'y': 6, 'b': 3, 'base': 22}, {'even_rows': 5, 'odd_rows': 4, 'field': 0, 'field_row': 3, 'row_pitch': 35, 'odd_start': 200, 'field_start': 22, 'row_origin': 130, 'address': 154, 'allocation_end': 343}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 3, 'base': 22}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 50, 'odd_start': 225, 'field_start': 225, 'row_origin': 378, 'address': 423, 'allocation_end': 428}), ({'w': 19, 'h': 11, 'x': 16, 'y': 8, 'b': 3, 'base': 22}, {'even_rows': 6, 'odd_rows': 5, 'field': 0, 'field_row': 4, 'row_pitch': 59, 'odd_start': 379, 'field_start': 22, 'row_origin': 261, 'address': 309, 'allocation_end': 677}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 3, 'base': 22}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 23, 'odd_start': 186, 'field_start': 22, 'row_origin': 163, 'address': 172, 'allocation_end': 327})], 3: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 4, 'base': 33}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 6, 'odd_start': 42, 'field_start': 33, 'row_origin': 36, 'address': 36, 'allocation_end': 45}), ({'w': 8, 'h': 6, 'x': 1, 'y': 2, 'b': 4, 'base': 33}, {'even_rows': 3, 'odd_rows': 3, 'field': 0, 'field_row': 1, 'row_pitch': 34, 'odd_start': 138, 'field_start': 33, 'row_origin': 70, 'address': 74, 'allocation_end': 243}), ({'w': 12, 'h': 10, 'x': 8, 'y': 6, 'b': 4, 'base': 33}, {'even_rows': 5, 'odd_rows': 5, 'field': 0, 'field_row': 3, 'row_pitch': 50, 'odd_start': 286, 'field_start': 33, 'row_origin': 186, 'address': 218, 'allocation_end': 539}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 4, 'base': 33}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 66, 'odd_start': 300, 'field_start': 300, 'row_origin': 501, 'address': 561, 'allocation_end': 567}), ({'w': 20, 'h': 12, 'x': 16, 'y': 8, 'b': 4, 'base': 33}, {'even_rows': 6, 'odd_rows': 6, 'field': 0, 'field_row': 4, 'row_pitch': 82, 'odd_start': 528, 'field_start': 33, 'row_origin': 364, 'address': 428, 'allocation_end': 1023}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 4, 'base': 33}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 30, 'odd_start': 246, 'field_start': 33, 'row_origin': 216, 'address': 228, 'allocation_end': 429})], 4: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 5, 'base': 44}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 7, 'odd_start': 54, 'field_start': 44, 'row_origin': 47, 'address': 47, 'allocation_end': 57}), ({'w': 9, 'h': 7, 'x': 1, 'y': 2, 'b': 5, 'base': 44}, {'even_rows': 4, 'odd_rows': 3, 'field': 0, 'field_row': 1, 'row_pitch': 47, 'odd_start': 235, 'field_start': 44, 'row_origin': 94, 'address': 99, 'allocation_end': 379}), ({'w': 13, 'h': 11, 'x': 8, 'y': 6, 'b': 5, 'base': 44}, {'even_rows': 6, 'odd_rows': 5, 'field': 0, 'field_row': 3, 'row_pitch': 67, 'odd_start': 449, 'field_start': 44, 'row_origin': 248, 'address': 288, 'allocation_end': 787}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 5, 'base': 44}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 82, 'odd_start': 375, 'field_start': 375, 'row_origin': 624, 'address': 699, 'allocation_end': 706}), ({'w': 21, 'h': 13, 'x': 16, 'y': 8, 'b': 5, 'base': 44}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 4, 'row_pitch': 107, 'odd_start': 796, 'field_start': 44, 'row_origin': 475, 'address': 555, 'allocation_end': 1441}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 5, 'base': 44}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 37, 'odd_start': 306, 'field_start': 44, 'row_origin': 269, 'address': 284, 'allocation_end': 531})], 5: [({'w': 1, 'h': 1, 'x': 0, 'y': 0, 'b': 6, 'base': 55}, {'even_rows': 1, 'odd_rows': 0, 'field': 0, 'field_row': 0, 'row_pitch': 8, 'odd_start': 66, 'field_start': 55, 'row_origin': 58, 'address': 58, 'allocation_end': 69}), ({'w': 10, 'h': 8, 'x': 1, 'y': 2, 'b': 6, 'base': 55}, {'even_rows': 4, 'odd_rows': 4, 'field': 0, 'field_row': 1, 'row_pitch': 62, 'odd_start': 306, 'field_start': 55, 'row_origin': 120, 'address': 126, 'allocation_end': 557}), ({'w': 14, 'h': 12, 'x': 8, 'y': 6, 'b': 6, 'base': 55}, {'even_rows': 6, 'odd_rows': 6, 'field': 0, 'field_row': 3, 'row_pitch': 86, 'odd_start': 574, 'field_start': 55, 'row_origin': 316, 'address': 364, 'allocation_end': 1093}), ({'w': 16, 'h': 8, 'x': 15, 'y': 7, 'b': 6, 'base': 55}, {'even_rows': 4, 'odd_rows': 4, 'field': 1, 'field_row': 3, 'row_pitch': 98, 'odd_start': 450, 'field_start': 450, 'row_origin': 747, 'address': 837, 'allocation_end': 845}), ({'w': 22, 'h': 14, 'x': 16, 'y': 8, 'b': 6, 'base': 55}, {'even_rows': 7, 'odd_rows': 7, 'field': 0, 'field_row': 4, 'row_pitch': 134, 'odd_start': 996, 'field_start': 55, 'row_origin': 594, 'address': 690, 'allocation_end': 1937}), ({'w': 7, 'h': 13, 'x': 3, 'y': 12, 'b': 6, 'base': 55}, {'even_rows': 7, 'odd_rows': 6, 'field': 0, 'field_row': 6, 'row_pitch': 44, 'odd_start': 366, 'field_start': 55, 'row_origin': 322, 'address': 340, 'allocation_end': 633})]}
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 odd_start.

Even scanlines precede odd scanlines in two separately tagged fields. Each field starts with its own three-byte tag. Field rows use a two-byte guard and store x-fastest pixels. Return the named intermediate layout descriptor and final address fields; all quantities are integer byte offsets unless explicitly stated.

split: open-access