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

N = 1
observations = []
def solve(x):
    wire=x
    if len(wire)<10 or any(not 0<=b<=255 for b in wire): return None
    if wire[:2]!=[82,71]: return None
    if wire[2]!=1: return None
    if wire[3]!=0: return None
    if sum(wire[:-1])%256!=wire[-1]: return None
    generation=wire[4]*256+wire[5]
    total=wire[6]*256+wire[7]
    count=wire[8]
    pos=9
    parts=[]
    owned=set()
    for _ in range(count):
        if pos+3>len(wire)-1: return None
        offset=wire[pos+1]*256+wire[pos]
        size=wire[pos+2]
        pos+=3
        if pos+size>len(wire)-1 or offset+size>total: return None
        if any(i in owned for i in range(offset,offset+size)): return None
        owned.update(range(offset,offset+size))
        parts.append([offset,''.join(chr(b) for b in wire[pos:pos+size])])
        pos+=size
    if pos!=len(wire)-1: return None
    return [generation,total,parts]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fragment-offset-byte-order fixture 0', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,1,N,1,2,2,0,0,2,97,98,1,0,2,99,100])))), json.loads(json.dumps([256+N,258,[[0,'ab'],[256,'cd']]])))
check('fragment-offset-byte-order fixture 1', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0])))), json.loads(json.dumps([0,0,[]])))
check('fragment-offset-byte-order fixture 2', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,1,0,3,1,0,1,2,98,99])))), json.loads(json.dumps([1,3,[[1,'bc']]])))
check('fragment-offset-byte-order fixture 3', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,70,1,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('fragment-offset-byte-order fixture 4', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,2,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('fragment-offset-byte-order fixture 5', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,1,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('fragment-offset-byte-order fixture 6', json.loads(json.dumps(solve([82,71,1,0,0,0,0,0,0,0]))), json.loads(json.dumps(None)))
check('fragment-offset-byte-order fixture 7', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,1,1,0,0,2,97,98])))), json.loads(json.dumps(None)))
check('fragment-offset-byte-order fixture 8', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,2,2,0,0,1,97,0,0,1,97])))), json.loads(json.dumps(None)))
check('fragment-offset-byte-order fixture 9', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0,99])))), json.loads(json.dumps(None)))
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(x):
    wire=x
    if len(wire)<10 or any(not 0<=b<=255 for b in wire): return None
    if wire[:2]!=[82,71]: return None
    if wire[2]!=1: return None
    if wire[3]!=0: return None
    if sum(wire[:-1])%256!=wire[-1]: return None
    generation=wire[4]*256+wire[5]
    total=wire[6]*256+wire[7]
    count=wire[8]
    pos=9
    parts=[]
    owned=set()
    for _ in range(count):
        if pos+3>len(wire)-1: return None
        offset=wire[pos+1]
        size=wire[pos+2]
        pos+=3
        if pos+size>len(wire)-1 or offset+size>total: return None
        if any(i in owned for i in range(offset,offset+size)): return None
        owned.update(range(offset,offset+size))
        parts.append([offset,''.join(chr(b) for b in wire[pos:pos+size])])
        pos+=size
    if pos!=len(wire)-1: return None
    return [generation,total,parts]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fragment-offset-byte-order fixture 0', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,1,N,1,2,2,0,0,2,97,98,1,0,2,99,100])))), json.loads(json.dumps([256+N,258,[[0,'ab'],[256,'cd']]])))
check('fragment-offset-byte-order fixture 1', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0])))), json.loads(json.dumps([0,0,[]])))
check('fragment-offset-byte-order fixture 2', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,1,0,3,1,0,1,2,98,99])))), json.loads(json.dumps([1,3,[[1,'bc']]])))
check('fragment-offset-byte-order fixture 3', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,70,1,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('fragment-offset-byte-order fixture 4', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,2,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('fragment-offset-byte-order fixture 5', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,1,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('fragment-offset-byte-order fixture 6', json.loads(json.dumps(solve([82,71,1,0,0,0,0,0,0,0]))), json.loads(json.dumps(None)))
check('fragment-offset-byte-order fixture 7', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,1,1,0,0,2,97,98])))), json.loads(json.dumps(None)))
check('fragment-offset-byte-order fixture 8', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,2,2,0,0,1,97,0,0,1,97])))), json.loads(json.dumps(None)))
check('fragment-offset-byte-order fixture 9', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0,99])))), json.loads(json.dumps(None)))
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:
A persisted partial-response cache record keeps byte coverage and revision metadata intact: fragments beyond the first256 bytes retain absolute placement.

Decode this stipulated local binary cache envelope: magic RG, version1, flags0, two-byte big-endian generation, two-byte big-endian complete length, one-byte fragment count, then fragments [two-byte big-endian offset,one-byte count,ASCII payload], followed by one checksum byte equal to sum of preceding bytes modulo256. Reject malformed envelopes, bytes outside0..255, trailing bytes, overlapping fragment ownership, or spans outside complete length. Return [generation,total,[[offset,payload],...]]. This is an invented bounded persistence format, not a public protocol.

split: open-access


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

N = 1
observations = []
def solve(x):
    wire=x
    if len(wire)<10 or any(not 0<=b<=255 for b in wire): return None
    if wire[:2]!=[82,71]: return None
    if wire[2]!=1: return None
    if wire[3]!=0: return None
    if sum(wire[:-1])%256!=wire[-1]: return None
    generation=wire[4]*256+wire[5]
    total=wire[6]*256+wire[7]
    count=wire[8]
    pos=9
    parts=[]
    owned=set()
    for _ in range(count):
        if pos+3>len(wire)-1: return None
        offset=wire[pos]*256+wire[pos+1]
        size=wire[pos+2]
        pos+=3
        if pos+size>len(wire)-1: return None
        if any(i in owned for i in range(offset,offset+size)): return None
        owned.update(range(offset,offset+size))
        parts.append([offset,''.join(chr(b) for b in wire[pos:pos+size])])
        pos+=size
    if pos!=len(wire)-1: return None
    return [generation,total,parts]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('span-complete-length fixture 0', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,1,N,1,2,2,0,0,2,97,98,1,0,2,99,100])))), json.loads(json.dumps([256+N,258,[[0,'ab'],[256,'cd']]])))
check('span-complete-length fixture 1', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0])))), json.loads(json.dumps([0,0,[]])))
check('span-complete-length fixture 2', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,1,0,3,1,0,1,2,98,99])))), json.loads(json.dumps([1,3,[[1,'bc']]])))
check('span-complete-length fixture 3', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,70,1,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('span-complete-length fixture 4', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,2,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('span-complete-length fixture 5', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,1,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('span-complete-length fixture 6', json.loads(json.dumps(solve([82,71,1,0,0,0,0,0,0,0]))), json.loads(json.dumps(None)))
check('span-complete-length fixture 7', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,1,1,0,0,2,97,98])))), json.loads(json.dumps(None)))
check('span-complete-length fixture 8', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,2,2,0,0,1,97,0,0,1,97])))), json.loads(json.dumps(None)))
check('span-complete-length fixture 9', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0,99])))), json.loads(json.dumps(None)))
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(x):
    wire=x
    if len(wire)<10 or any(not 0<=b<=255 for b in wire): return None
    if wire[:2]!=[82,71]: return None
    if wire[2]!=1: return None
    if wire[3]!=0: return None
    if sum(wire[:-1])%256!=wire[-1]: return None
    generation=wire[4]*256+wire[5]
    total=wire[6]*256+wire[7]
    count=wire[8]
    pos=9
    parts=[]
    owned=set()
    for _ in range(count):
        if pos+3>len(wire)-1: return None
        offset=wire[pos]*256+wire[pos+1]
        size=wire[pos+2]
        pos+=3
        if pos+size>len(wire)-1 or offset>total: return None
        if any(i in owned for i in range(offset,offset+size)): return None
        owned.update(range(offset,offset+size))
        parts.append([offset,''.join(chr(b) for b in wire[pos:pos+size])])
        pos+=size
    if pos!=len(wire)-1: return None
    return [generation,total,parts]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('span-complete-length fixture 0', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,1,N,1,2,2,0,0,2,97,98,1,0,2,99,100])))), json.loads(json.dumps([256+N,258,[[0,'ab'],[256,'cd']]])))
check('span-complete-length fixture 1', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0])))), json.loads(json.dumps([0,0,[]])))
check('span-complete-length fixture 2', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,1,0,3,1,0,1,2,98,99])))), json.loads(json.dumps([1,3,[[1,'bc']]])))
check('span-complete-length fixture 3', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,70,1,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('span-complete-length fixture 4', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,2,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('span-complete-length fixture 5', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,1,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('span-complete-length fixture 6', json.loads(json.dumps(solve([82,71,1,0,0,0,0,0,0,0]))), json.loads(json.dumps(None)))
check('span-complete-length fixture 7', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,1,1,0,0,2,97,98])))), json.loads(json.dumps(None)))
check('span-complete-length fixture 8', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,2,2,0,0,1,97,0,0,1,97])))), json.loads(json.dumps(None)))
check('span-complete-length fixture 9', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0,99])))), json.loads(json.dumps(None)))
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:
A persisted partial-response cache record keeps byte coverage and revision metadata intact: stored fragment data cannot extend past the recorded representation.

Decode this stipulated local binary cache envelope: magic RG, version1, flags0, two-byte big-endian generation, two-byte big-endian complete length, one-byte fragment count, then fragments [two-byte big-endian offset,one-byte count,ASCII payload], followed by one checksum byte equal to sum of preceding bytes modulo256. Reject malformed envelopes, bytes outside0..255, trailing bytes, overlapping fragment ownership, or spans outside complete length. Return [generation,total,[[offset,payload],...]]. This is an invented bounded persistence format, not a public protocol.

split: open-access


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

N = 1
observations = []
def solve(x):
    wire=x
    if len(wire)<10 or any(not 0<=b<=255 for b in wire): return None
    if wire[:2]!=[82,71]: return None
    if wire[2]!=1: return None
    if wire[3]!=0: return None
    if sum(wire[:-1])%256!=wire[-1]: return None
    generation=wire[4]*256+wire[5]
    total=wire[6]*256+wire[7]
    count=wire[8]
    pos=9
    parts=[]
    owned=set()
    for _ in range(count):
        if pos+3>len(wire)-1: return None
        offset=wire[pos]*256+wire[pos+1]
        size=wire[pos+2]
        pos+=3
        if pos+size>len(wire)-1 or offset+size>total: return None
        if False: return None
        owned.update(range(offset,offset+size))
        parts.append([offset,''.join(chr(b) for b in wire[pos:pos+size])])
        pos+=size
    if pos!=len(wire)-1: return None
    return [generation,total,parts]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('duplicate-ownership fixture 0', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,1,N,1,2,2,0,0,2,97,98,1,0,2,99,100])))), json.loads(json.dumps([256+N,258,[[0,'ab'],[256,'cd']]])))
check('duplicate-ownership fixture 1', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0])))), json.loads(json.dumps([0,0,[]])))
check('duplicate-ownership fixture 2', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,1,0,3,1,0,1,2,98,99])))), json.loads(json.dumps([1,3,[[1,'bc']]])))
check('duplicate-ownership fixture 3', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,70,1,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('duplicate-ownership fixture 4', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,2,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('duplicate-ownership fixture 5', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,1,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('duplicate-ownership fixture 6', json.loads(json.dumps(solve([82,71,1,0,0,0,0,0,0,0]))), json.loads(json.dumps(None)))
check('duplicate-ownership fixture 7', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,1,1,0,0,2,97,98])))), json.loads(json.dumps(None)))
check('duplicate-ownership fixture 8', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,2,2,0,0,1,97,0,0,1,97])))), json.loads(json.dumps(None)))
check('duplicate-ownership fixture 9', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0,99])))), json.loads(json.dumps(None)))
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(x):
    wire=x
    if len(wire)<10 or any(not 0<=b<=255 for b in wire): return None
    if wire[:2]!=[82,71]: return None
    if wire[2]!=1: return None
    if wire[3]!=0: return None
    if sum(wire[:-1])%256!=wire[-1]: return None
    generation=wire[4]*256+wire[5]
    total=wire[6]*256+wire[7]
    count=wire[8]
    pos=9
    parts=[]
    owned=set()
    for _ in range(count):
        if pos+3>len(wire)-1: return None
        offset=wire[pos]*256+wire[pos+1]
        size=wire[pos+2]
        pos+=3
        if pos+size>len(wire)-1 or offset+size>total: return None
        if all(i in owned for i in range(offset,offset+size)) and size>1: return None
        owned.update(range(offset,offset+size))
        parts.append([offset,''.join(chr(b) for b in wire[pos:pos+size])])
        pos+=size
    if pos!=len(wire)-1: return None
    return [generation,total,parts]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('duplicate-ownership fixture 0', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,1,N,1,2,2,0,0,2,97,98,1,0,2,99,100])))), json.loads(json.dumps([256+N,258,[[0,'ab'],[256,'cd']]])))
check('duplicate-ownership fixture 1', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0])))), json.loads(json.dumps([0,0,[]])))
check('duplicate-ownership fixture 2', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,1,0,3,1,0,1,2,98,99])))), json.loads(json.dumps([1,3,[[1,'bc']]])))
check('duplicate-ownership fixture 3', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,70,1,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('duplicate-ownership fixture 4', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,2,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('duplicate-ownership fixture 5', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,1,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('duplicate-ownership fixture 6', json.loads(json.dumps(solve([82,71,1,0,0,0,0,0,0,0]))), json.loads(json.dumps(None)))
check('duplicate-ownership fixture 7', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,1,1,0,0,2,97,98])))), json.loads(json.dumps(None)))
check('duplicate-ownership fixture 8', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,2,2,0,0,1,97,0,0,1,97])))), json.loads(json.dumps(None)))
check('duplicate-ownership fixture 9', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0,99])))), json.loads(json.dumps(None)))
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:
A persisted partial-response cache record keeps byte coverage and revision metadata intact: persistent records cannot assign the same byte to two fragments.

Decode this stipulated local binary cache envelope: magic RG, version1, flags0, two-byte big-endian generation, two-byte big-endian complete length, one-byte fragment count, then fragments [two-byte big-endian offset,one-byte count,ASCII payload], followed by one checksum byte equal to sum of preceding bytes modulo256. Reject malformed envelopes, bytes outside0..255, trailing bytes, overlapping fragment ownership, or spans outside complete length. Return [generation,total,[[offset,payload],...]]. This is an invented bounded persistence format, not a public protocol.

split: open-access


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

N = 1
observations = []
def solve(x):
    wire=x
    if len(wire)<10 or any(not 0<=b<=255 for b in wire): return None
    if wire[:2]!=[82,71]: return None
    if wire[2]!=1: return None
    if wire[3]!=0: return None
    if sum(wire[:-1])%256!=wire[-1]: return None
    generation=wire[4]*256+wire[5]
    total=wire[6]*256+wire[7]
    count=wire[8]
    pos=9
    parts=[]
    owned=set()
    for _ in range(count):
        if pos+3>len(wire)-1: return None
        offset=wire[pos]*256+wire[pos+1]
        size=wire[pos+2]
        pos+=3
        if pos+size>len(wire)-1 or offset+size>total: return None
        if any(i in owned for i in range(offset,offset+size)): return None
        owned.update(range(offset,offset+size))
        parts.append([offset,''.join(chr(b) for b in wire[pos:pos+size])])
        pos+=size
    if pos>len(wire)-1: return None
    return [generation,total,parts]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('trailing-record-data fixture 0', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,1,N,1,2,2,0,0,2,97,98,1,0,2,99,100])))), json.loads(json.dumps([256+N,258,[[0,'ab'],[256,'cd']]])))
check('trailing-record-data fixture 1', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0])))), json.loads(json.dumps([0,0,[]])))
check('trailing-record-data fixture 2', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,1,0,3,1,0,1,2,98,99])))), json.loads(json.dumps([1,3,[[1,'bc']]])))
check('trailing-record-data fixture 3', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,70,1,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('trailing-record-data fixture 4', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,2,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('trailing-record-data fixture 5', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,1,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('trailing-record-data fixture 6', json.loads(json.dumps(solve([82,71,1,0,0,0,0,0,0,0]))), json.loads(json.dumps(None)))
check('trailing-record-data fixture 7', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,1,1,0,0,2,97,98])))), json.loads(json.dumps(None)))
check('trailing-record-data fixture 8', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,2,2,0,0,1,97,0,0,1,97])))), json.loads(json.dumps(None)))
check('trailing-record-data fixture 9', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0,99])))), json.loads(json.dumps(None)))
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(x):
    wire=x
    if len(wire)<10 or any(not 0<=b<=255 for b in wire): return None
    if wire[:2]!=[82,71]: return None
    if wire[2]!=1: return None
    if wire[3]!=0: return None
    if sum(wire[:-1])%256!=wire[-1]: return None
    generation=wire[4]*256+wire[5]
    total=wire[6]*256+wire[7]
    count=wire[8]
    pos=9
    parts=[]
    owned=set()
    for _ in range(count):
        if pos+3>len(wire)-1: return None
        offset=wire[pos]*256+wire[pos+1]
        size=wire[pos+2]
        pos+=3
        if pos+size>len(wire)-1 or offset+size>total: return None
        if any(i in owned for i in range(offset,offset+size)): return None
        owned.update(range(offset,offset+size))
        parts.append([offset,''.join(chr(b) for b in wire[pos:pos+size])])
        pos+=size
    if pos!=len(wire)-1 and count>0: return None
    return [generation,total,parts]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('trailing-record-data fixture 0', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,1,N,1,2,2,0,0,2,97,98,1,0,2,99,100])))), json.loads(json.dumps([256+N,258,[[0,'ab'],[256,'cd']]])))
check('trailing-record-data fixture 1', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0])))), json.loads(json.dumps([0,0,[]])))
check('trailing-record-data fixture 2', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,1,0,3,1,0,1,2,98,99])))), json.loads(json.dumps([1,3,[[1,'bc']]])))
check('trailing-record-data fixture 3', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,70,1,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('trailing-record-data fixture 4', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,2,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('trailing-record-data fixture 5', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,1,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('trailing-record-data fixture 6', json.loads(json.dumps(solve([82,71,1,0,0,0,0,0,0,0]))), json.loads(json.dumps(None)))
check('trailing-record-data fixture 7', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,1,1,0,0,2,97,98])))), json.loads(json.dumps(None)))
check('trailing-record-data fixture 8', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,2,2,0,0,1,97,0,0,1,97])))), json.loads(json.dumps(None)))
check('trailing-record-data fixture 9', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0,99])))), json.loads(json.dumps(None)))
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:
A persisted partial-response cache record keeps byte coverage and revision metadata intact: envelope fragment count must consume the entire record payload.

Decode this stipulated local binary cache envelope: magic RG, version1, flags0, two-byte big-endian generation, two-byte big-endian complete length, one-byte fragment count, then fragments [two-byte big-endian offset,one-byte count,ASCII payload], followed by one checksum byte equal to sum of preceding bytes modulo256. Reject malformed envelopes, bytes outside0..255, trailing bytes, overlapping fragment ownership, or spans outside complete length. Return [generation,total,[[offset,payload],...]]. This is an invented bounded persistence format, not a public protocol.

split: open-access


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

N = 1
observations = []
def solve(x):
    positions=list(dict.fromkeys(x['committed']))
    if any(p<0 or p>=x['total'] for p in positions): return None
    runs=[]
    for p in positions:
        if runs and p==runs[-1][1]+1:
            runs[-1][1]=p
        else:
            runs.append([p,p])
    field='bytes='+','.join(str(a)+'-'+str(b) for a,b in runs) if runs else None
    prefix=0
    for p in positions:
        if p!=prefix: break
        prefix+=1
    state='complete' if len(positions)==x['total'] else 'partial'
    return [state,field,prefix]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('coverage-sort fixture 0', json.loads(json.dumps(solve({'total':7,'committed':[4,0,1,5,1]}))), json.loads(json.dumps(['partial','bytes=0-1,4-5',2])))
check('coverage-sort fixture 1', json.loads(json.dumps(solve({'total':3,'committed':[2,0,1]}))), json.loads(json.dumps(['complete','bytes=0-2',3])))
check('coverage-sort fixture 2', json.loads(json.dumps(solve({'total':0,'committed':[]}))), json.loads(json.dumps(['complete',None,0])))
check('coverage-sort fixture 3', json.loads(json.dumps(solve({'total':4,'committed':[2,3]}))), json.loads(json.dumps(['partial','bytes=2-3',0])))
check('coverage-sort fixture 4', json.loads(json.dumps(solve({'total':4,'committed':[0,2]}))), json.loads(json.dumps(['partial','bytes=0-0,2-2',1])))
check('coverage-sort fixture 5', json.loads(json.dumps(solve({'total':N+1,'committed':list(range(N))}))), json.loads(json.dumps(['partial',"bytes=0-"+str(N-1),N])))
check('coverage-sort fixture 6', json.loads(json.dumps(solve({'total':3,'committed':[3]}))), json.loads(json.dumps(None)))
check('coverage-sort fixture 7', json.loads(json.dumps(solve({'total':3,'committed':[-1]}))), json.loads(json.dumps(None)))
check('coverage-sort fixture 8', json.loads(json.dumps(solve({'total':3,'committed':[]}))), json.loads(json.dumps(['partial',None,0])))
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(x):
    positions=sorted(set(x['committed']),reverse=True)
    if any(p<0 or p>=x['total'] for p in positions): return None
    runs=[]
    for p in positions:
        if runs and p==runs[-1][1]+1:
            runs[-1][1]=p
        else:
            runs.append([p,p])
    field='bytes='+','.join(str(a)+'-'+str(b) for a,b in runs) if runs else None
    prefix=0
    for p in positions:
        if p!=prefix: break
        prefix+=1
    state='complete' if len(positions)==x['total'] else 'partial'
    return [state,field,prefix]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('coverage-sort fixture 0', json.loads(json.dumps(solve({'total':7,'committed':[4,0,1,5,1]}))), json.loads(json.dumps(['partial','bytes=0-1,4-5',2])))
check('coverage-sort fixture 1', json.loads(json.dumps(solve({'total':3,'committed':[2,0,1]}))), json.loads(json.dumps(['complete','bytes=0-2',3])))
check('coverage-sort fixture 2', json.loads(json.dumps(solve({'total':0,'committed':[]}))), json.loads(json.dumps(['complete',None,0])))
check('coverage-sort fixture 3', json.loads(json.dumps(solve({'total':4,'committed':[2,3]}))), json.loads(json.dumps(['partial','bytes=2-3',0])))
check('coverage-sort fixture 4', json.loads(json.dumps(solve({'total':4,'committed':[0,2]}))), json.loads(json.dumps(['partial','bytes=0-0,2-2',1])))
check('coverage-sort fixture 5', json.loads(json.dumps(solve({'total':N+1,'committed':list(range(N))}))), json.loads(json.dumps(['partial',"bytes=0-"+str(N-1),N])))
check('coverage-sort fixture 6', json.loads(json.dumps(solve({'total':3,'committed':[3]}))), json.loads(json.dumps(None)))
check('coverage-sort fixture 7', json.loads(json.dumps(solve({'total':3,'committed':[-1]}))), json.loads(json.dumps(None)))
check('coverage-sort fixture 8', json.loads(json.dumps(solve({'total':3,'committed':[]}))), json.loads(json.dumps(['partial',None,0])))
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:
An upload status endpoint reports committed byte coverage: arrival order cannot split or reverse acknowledged byte runs.

x has a nonnegative complete length and committed byte offsets, which may repeat or arrive unordered. Reject offsets outside the representation. Return [complete|partial,acknowledged-range-field-or-null,next-missing-prefix-offset]. The local acknowledged field uses bytes= followed by comma-separated inclusive runs. Empty coverage has null header; an empty representation is complete. next-missing is the end of the committed contiguous prefix, not the highest written offset.

split: open-access


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

N = 1
observations = []
def solve(x):
    positions=sorted(x['committed'])
    if any(p<0 or p>=x['total'] for p in positions): return None
    runs=[]
    for p in positions:
        if runs and p==runs[-1][1]+1:
            runs[-1][1]=p
        else:
            runs.append([p,p])
    field='bytes='+','.join(str(a)+'-'+str(b) for a,b in runs) if runs else None
    prefix=0
    for p in positions:
        if p!=prefix: break
        prefix+=1
    state='complete' if len(positions)==x['total'] else 'partial'
    return [state,field,prefix]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('coverage-deduplication fixture 0', json.loads(json.dumps(solve({'total':7,'committed':[4,0,1,5,1]}))), json.loads(json.dumps(['partial','bytes=0-1,4-5',2])))
check('coverage-deduplication fixture 1', json.loads(json.dumps(solve({'total':3,'committed':[2,0,1]}))), json.loads(json.dumps(['complete','bytes=0-2',3])))
check('coverage-deduplication fixture 2', json.loads(json.dumps(solve({'total':0,'committed':[]}))), json.loads(json.dumps(['complete',None,0])))
check('coverage-deduplication fixture 3', json.loads(json.dumps(solve({'total':4,'committed':[2,3]}))), json.loads(json.dumps(['partial','bytes=2-3',0])))
check('coverage-deduplication fixture 4', json.loads(json.dumps(solve({'total':4,'committed':[0,2]}))), json.loads(json.dumps(['partial','bytes=0-0,2-2',1])))
check('coverage-deduplication fixture 5', json.loads(json.dumps(solve({'total':N+1,'committed':list(range(N))}))), json.loads(json.dumps(['partial',"bytes=0-"+str(N-1),N])))
check('coverage-deduplication fixture 6', json.loads(json.dumps(solve({'total':3,'committed':[3]}))), json.loads(json.dumps(None)))
check('coverage-deduplication fixture 7', json.loads(json.dumps(solve({'total':3,'committed':[-1]}))), json.loads(json.dumps(None)))
check('coverage-deduplication fixture 8', json.loads(json.dumps(solve({'total':3,'committed':[]}))), json.loads(json.dumps(['partial',None,0])))
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(x):
    positions=sorted(x['committed']) if len(x['committed'])>1 else x['committed']
    if any(p<0 or p>=x['total'] for p in positions): return None
    runs=[]
    for p in positions:
        if runs and p==runs[-1][1]+1:
            runs[-1][1]=p
        else:
            runs.append([p,p])
    field='bytes='+','.join(str(a)+'-'+str(b) for a,b in runs) if runs else None
    prefix=0
    for p in positions:
        if p!=prefix: break
        prefix+=1
    state='complete' if len(positions)==x['total'] else 'partial'
    return [state,field,prefix]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('coverage-deduplication fixture 0', json.loads(json.dumps(solve({'total':7,'committed':[4,0,1,5,1]}))), json.loads(json.dumps(['partial','bytes=0-1,4-5',2])))
check('coverage-deduplication fixture 1', json.loads(json.dumps(solve({'total':3,'committed':[2,0,1]}))), json.loads(json.dumps(['complete','bytes=0-2',3])))
check('coverage-deduplication fixture 2', json.loads(json.dumps(solve({'total':0,'committed':[]}))), json.loads(json.dumps(['complete',None,0])))
check('coverage-deduplication fixture 3', json.loads(json.dumps(solve({'total':4,'committed':[2,3]}))), json.loads(json.dumps(['partial','bytes=2-3',0])))
check('coverage-deduplication fixture 4', json.loads(json.dumps(solve({'total':4,'committed':[0,2]}))), json.loads(json.dumps(['partial','bytes=0-0,2-2',1])))
check('coverage-deduplication fixture 5', json.loads(json.dumps(solve({'total':N+1,'committed':list(range(N))}))), json.loads(json.dumps(['partial',"bytes=0-"+str(N-1),N])))
check('coverage-deduplication fixture 6', json.loads(json.dumps(solve({'total':3,'committed':[3]}))), json.loads(json.dumps(None)))
check('coverage-deduplication fixture 7', json.loads(json.dumps(solve({'total':3,'committed':[-1]}))), json.loads(json.dumps(None)))
check('coverage-deduplication fixture 8', json.loads(json.dumps(solve({'total':3,'committed':[]}))), json.loads(json.dumps(['partial',None,0])))
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:
An upload status endpoint reports committed byte coverage: repeated committed byte reports count only once.

x has a nonnegative complete length and committed byte offsets, which may repeat or arrive unordered. Reject offsets outside the representation. Return [complete|partial,acknowledged-range-field-or-null,next-missing-prefix-offset]. The local acknowledged field uses bytes= followed by comma-separated inclusive runs. Empty coverage has null header; an empty representation is complete. next-missing is the end of the committed contiguous prefix, not the highest written offset.

split: open-access


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

N = 1
observations = []
def solve(x):
    positions=sorted(set(x['committed']))
    if any(p<0 or p>x['total'] for p in positions): return None
    runs=[]
    for p in positions:
        if runs and p==runs[-1][1]+1:
            runs[-1][1]=p
        else:
            runs.append([p,p])
    field='bytes='+','.join(str(a)+'-'+str(b) for a,b in runs) if runs else None
    prefix=0
    for p in positions:
        if p!=prefix: break
        prefix+=1
    state='complete' if len(positions)==x['total'] else 'partial'
    return [state,field,prefix]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('eof-offset fixture 0', json.loads(json.dumps(solve({'total':7,'committed':[4,0,1,5,1]}))), json.loads(json.dumps(['partial','bytes=0-1,4-5',2])))
check('eof-offset fixture 1', json.loads(json.dumps(solve({'total':3,'committed':[2,0,1]}))), json.loads(json.dumps(['complete','bytes=0-2',3])))
check('eof-offset fixture 2', json.loads(json.dumps(solve({'total':0,'committed':[]}))), json.loads(json.dumps(['complete',None,0])))
check('eof-offset fixture 3', json.loads(json.dumps(solve({'total':4,'committed':[2,3]}))), json.loads(json.dumps(['partial','bytes=2-3',0])))
check('eof-offset fixture 4', json.loads(json.dumps(solve({'total':4,'committed':[0,2]}))), json.loads(json.dumps(['partial','bytes=0-0,2-2',1])))
check('eof-offset fixture 5', json.loads(json.dumps(solve({'total':N+1,'committed':list(range(N))}))), json.loads(json.dumps(['partial',"bytes=0-"+str(N-1),N])))
check('eof-offset fixture 6', json.loads(json.dumps(solve({'total':3,'committed':[3]}))), json.loads(json.dumps(None)))
check('eof-offset fixture 7', json.loads(json.dumps(solve({'total':3,'committed':[-1]}))), json.loads(json.dumps(None)))
check('eof-offset fixture 8', json.loads(json.dumps(solve({'total':3,'committed':[]}))), json.loads(json.dumps(['partial',None,0])))
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(x):
    positions=sorted(set(x['committed']))
    if any(p<0 or p>x['total']+1 for p in positions): return None
    runs=[]
    for p in positions:
        if runs and p==runs[-1][1]+1:
            runs[-1][1]=p
        else:
            runs.append([p,p])
    field='bytes='+','.join(str(a)+'-'+str(b) for a,b in runs) if runs else None
    prefix=0
    for p in positions:
        if p!=prefix: break
        prefix+=1
    state='complete' if len(positions)==x['total'] else 'partial'
    return [state,field,prefix]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('eof-offset fixture 0', json.loads(json.dumps(solve({'total':7,'committed':[4,0,1,5,1]}))), json.loads(json.dumps(['partial','bytes=0-1,4-5',2])))
check('eof-offset fixture 1', json.loads(json.dumps(solve({'total':3,'committed':[2,0,1]}))), json.loads(json.dumps(['complete','bytes=0-2',3])))
check('eof-offset fixture 2', json.loads(json.dumps(solve({'total':0,'committed':[]}))), json.loads(json.dumps(['complete',None,0])))
check('eof-offset fixture 3', json.loads(json.dumps(solve({'total':4,'committed':[2,3]}))), json.loads(json.dumps(['partial','bytes=2-3',0])))
check('eof-offset fixture 4', json.loads(json.dumps(solve({'total':4,'committed':[0,2]}))), json.loads(json.dumps(['partial','bytes=0-0,2-2',1])))
check('eof-offset fixture 5', json.loads(json.dumps(solve({'total':N+1,'committed':list(range(N))}))), json.loads(json.dumps(['partial',"bytes=0-"+str(N-1),N])))
check('eof-offset fixture 6', json.loads(json.dumps(solve({'total':3,'committed':[3]}))), json.loads(json.dumps(None)))
check('eof-offset fixture 7', json.loads(json.dumps(solve({'total':3,'committed':[-1]}))), json.loads(json.dumps(None)))
check('eof-offset fixture 8', json.loads(json.dumps(solve({'total':3,'committed':[]}))), json.loads(json.dumps(['partial',None,0])))
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:
An upload status endpoint reports committed byte coverage: the exclusive complete length is not itself a committed byte.

x has a nonnegative complete length and committed byte offsets, which may repeat or arrive unordered. Reject offsets outside the representation. Return [complete|partial,acknowledged-range-field-or-null,next-missing-prefix-offset]. The local acknowledged field uses bytes= followed by comma-separated inclusive runs. Empty coverage has null header; an empty representation is complete. next-missing is the end of the committed contiguous prefix, not the highest written offset.

split: open-access


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

N = 1
observations = []
def solve(x):
    positions=sorted(set(x['committed']))
    if any(p>=x['total'] for p in positions): return None
    runs=[]
    for p in positions:
        if runs and p==runs[-1][1]+1:
            runs[-1][1]=p
        else:
            runs.append([p,p])
    field='bytes='+','.join(str(a)+'-'+str(b) for a,b in runs) if runs else None
    prefix=0
    for p in positions:
        if p!=prefix: break
        prefix+=1
    state='complete' if len(positions)==x['total'] else 'partial'
    return [state,field,prefix]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('negative-offset fixture 0', json.loads(json.dumps(solve({'total':7,'committed':[4,0,1,5,1]}))), json.loads(json.dumps(['partial','bytes=0-1,4-5',2])))
check('negative-offset fixture 1', json.loads(json.dumps(solve({'total':3,'committed':[2,0,1]}))), json.loads(json.dumps(['complete','bytes=0-2',3])))
check('negative-offset fixture 2', json.loads(json.dumps(solve({'total':0,'committed':[]}))), json.loads(json.dumps(['complete',None,0])))
check('negative-offset fixture 3', json.loads(json.dumps(solve({'total':4,'committed':[2,3]}))), json.loads(json.dumps(['partial','bytes=2-3',0])))
check('negative-offset fixture 4', json.loads(json.dumps(solve({'total':4,'committed':[0,2]}))), json.loads(json.dumps(['partial','bytes=0-0,2-2',1])))
check('negative-offset fixture 5', json.loads(json.dumps(solve({'total':N+1,'committed':list(range(N))}))), json.loads(json.dumps(['partial',"bytes=0-"+str(N-1),N])))
check('negative-offset fixture 6', json.loads(json.dumps(solve({'total':3,'committed':[3]}))), json.loads(json.dumps(None)))
check('negative-offset fixture 7', json.loads(json.dumps(solve({'total':3,'committed':[-1]}))), json.loads(json.dumps(None)))
check('negative-offset fixture 8', json.loads(json.dumps(solve({'total':3,'committed':[]}))), json.loads(json.dumps(['partial',None,0])))
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(x):
    positions=sorted(set(x['committed']))
    if any(p<-1 or p>=x['total'] for p in positions): return None
    runs=[]
    for p in positions:
        if runs and p==runs[-1][1]+1:
            runs[-1][1]=p
        else:
            runs.append([p,p])
    field='bytes='+','.join(str(a)+'-'+str(b) for a,b in runs) if runs else None
    prefix=0
    for p in positions:
        if p!=prefix: break
        prefix+=1
    state='complete' if len(positions)==x['total'] else 'partial'
    return [state,field,prefix]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('negative-offset fixture 0', json.loads(json.dumps(solve({'total':7,'committed':[4,0,1,5,1]}))), json.loads(json.dumps(['partial','bytes=0-1,4-5',2])))
check('negative-offset fixture 1', json.loads(json.dumps(solve({'total':3,'committed':[2,0,1]}))), json.loads(json.dumps(['complete','bytes=0-2',3])))
check('negative-offset fixture 2', json.loads(json.dumps(solve({'total':0,'committed':[]}))), json.loads(json.dumps(['complete',None,0])))
check('negative-offset fixture 3', json.loads(json.dumps(solve({'total':4,'committed':[2,3]}))), json.loads(json.dumps(['partial','bytes=2-3',0])))
check('negative-offset fixture 4', json.loads(json.dumps(solve({'total':4,'committed':[0,2]}))), json.loads(json.dumps(['partial','bytes=0-0,2-2',1])))
check('negative-offset fixture 5', json.loads(json.dumps(solve({'total':N+1,'committed':list(range(N))}))), json.loads(json.dumps(['partial',"bytes=0-"+str(N-1),N])))
check('negative-offset fixture 6', json.loads(json.dumps(solve({'total':3,'committed':[3]}))), json.loads(json.dumps(None)))
check('negative-offset fixture 7', json.loads(json.dumps(solve({'total':3,'committed':[-1]}))), json.loads(json.dumps(None)))
check('negative-offset fixture 8', json.loads(json.dumps(solve({'total':3,'committed':[]}))), json.loads(json.dumps(['partial',None,0])))
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:
An upload status endpoint reports committed byte coverage: negative offsets cannot appear in acknowledged ranges.

x has a nonnegative complete length and committed byte offsets, which may repeat or arrive unordered. Reject offsets outside the representation. Return [complete|partial,acknowledged-range-field-or-null,next-missing-prefix-offset]. The local acknowledged field uses bytes= followed by comma-separated inclusive runs. Empty coverage has null header; an empty representation is complete. next-missing is the end of the committed contiguous prefix, not the highest written offset.

split: open-access


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

N = 1
observations = []
def solve(x):
    positions=sorted(set(x['committed']))
    if any(p<0 or p>=x['total'] for p in positions): return None
    runs=[]
    for p in positions:
        if runs and p==runs[-1][1]:
            runs[-1][1]=p
        else:
            runs.append([p,p])
    field='bytes='+','.join(str(a)+'-'+str(b) for a,b in runs) if runs else None
    prefix=0
    for p in positions:
        if p!=prefix: break
        prefix+=1
    state='complete' if len(positions)==x['total'] else 'partial'
    return [state,field,prefix]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('adjacent-run fixture 0', json.loads(json.dumps(solve({'total':7,'committed':[4,0,1,5,1]}))), json.loads(json.dumps(['partial','bytes=0-1,4-5',2])))
check('adjacent-run fixture 1', json.loads(json.dumps(solve({'total':3,'committed':[2,0,1]}))), json.loads(json.dumps(['complete','bytes=0-2',3])))
check('adjacent-run fixture 2', json.loads(json.dumps(solve({'total':0,'committed':[]}))), json.loads(json.dumps(['complete',None,0])))
check('adjacent-run fixture 3', json.loads(json.dumps(solve({'total':4,'committed':[2,3]}))), json.loads(json.dumps(['partial','bytes=2-3',0])))
check('adjacent-run fixture 4', json.loads(json.dumps(solve({'total':4,'committed':[0,2]}))), json.loads(json.dumps(['partial','bytes=0-0,2-2',1])))
check('adjacent-run fixture 5', json.loads(json.dumps(solve({'total':N+1,'committed':list(range(N))}))), json.loads(json.dumps(['partial',"bytes=0-"+str(N-1),N])))
check('adjacent-run fixture 6', json.loads(json.dumps(solve({'total':3,'committed':[3]}))), json.loads(json.dumps(None)))
check('adjacent-run fixture 7', json.loads(json.dumps(solve({'total':3,'committed':[-1]}))), json.loads(json.dumps(None)))
check('adjacent-run fixture 8', json.loads(json.dumps(solve({'total':3,'committed':[]}))), json.loads(json.dumps(['partial',None,0])))
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(x):
    positions=sorted(set(x['committed']))
    if any(p<0 or p>=x['total'] for p in positions): return None
    runs=[]
    for p in positions:
        if runs and p<=runs[-1][1]:
            runs[-1][1]=p
        else:
            runs.append([p,p])
    field='bytes='+','.join(str(a)+'-'+str(b) for a,b in runs) if runs else None
    prefix=0
    for p in positions:
        if p!=prefix: break
        prefix+=1
    state='complete' if len(positions)==x['total'] else 'partial'
    return [state,field,prefix]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('adjacent-run fixture 0', json.loads(json.dumps(solve({'total':7,'committed':[4,0,1,5,1]}))), json.loads(json.dumps(['partial','bytes=0-1,4-5',2])))
check('adjacent-run fixture 1', json.loads(json.dumps(solve({'total':3,'committed':[2,0,1]}))), json.loads(json.dumps(['complete','bytes=0-2',3])))
check('adjacent-run fixture 2', json.loads(json.dumps(solve({'total':0,'committed':[]}))), json.loads(json.dumps(['complete',None,0])))
check('adjacent-run fixture 3', json.loads(json.dumps(solve({'total':4,'committed':[2,3]}))), json.loads(json.dumps(['partial','bytes=2-3',0])))
check('adjacent-run fixture 4', json.loads(json.dumps(solve({'total':4,'committed':[0,2]}))), json.loads(json.dumps(['partial','bytes=0-0,2-2',1])))
check('adjacent-run fixture 5', json.loads(json.dumps(solve({'total':N+1,'committed':list(range(N))}))), json.loads(json.dumps(['partial',"bytes=0-"+str(N-1),N])))
check('adjacent-run fixture 6', json.loads(json.dumps(solve({'total':3,'committed':[3]}))), json.loads(json.dumps(None)))
check('adjacent-run fixture 7', json.loads(json.dumps(solve({'total':3,'committed':[-1]}))), json.loads(json.dumps(None)))
check('adjacent-run fixture 8', json.loads(json.dumps(solve({'total':3,'committed':[]}))), json.loads(json.dumps(['partial',None,0])))
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:
An upload status endpoint reports committed byte coverage: adjacent committed positions extend the current acknowledgement run.

x has a nonnegative complete length and committed byte offsets, which may repeat or arrive unordered. Reject offsets outside the representation. Return [complete|partial,acknowledged-range-field-or-null,next-missing-prefix-offset]. The local acknowledged field uses bytes= followed by comma-separated inclusive runs. Empty coverage has null header; an empty representation is complete. next-missing is the end of the committed contiguous prefix, not the highest written offset.

split: open-access


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

N = 1
observations = []
def solve(x):
    positions=sorted(set(x['committed']))
    if any(p<0 or p>=x['total'] for p in positions): return None
    runs=[]
    for p in positions:
        if runs and p==runs[-1][1]+1:
            runs[-1]=[p,p]
        else:
            runs.append([p,p])
    field='bytes='+','.join(str(a)+'-'+str(b) for a,b in runs) if runs else None
    prefix=0
    for p in positions:
        if p!=prefix: break
        prefix+=1
    state='complete' if len(positions)==x['total'] else 'partial'
    return [state,field,prefix]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('run-tail-update fixture 0', json.loads(json.dumps(solve({'total':7,'committed':[4,0,1,5,1]}))), json.loads(json.dumps(['partial','bytes=0-1,4-5',2])))
check('run-tail-update fixture 1', json.loads(json.dumps(solve({'total':3,'committed':[2,0,1]}))), json.loads(json.dumps(['complete','bytes=0-2',3])))
check('run-tail-update fixture 2', json.loads(json.dumps(solve({'total':0,'committed':[]}))), json.loads(json.dumps(['complete',None,0])))
check('run-tail-update fixture 3', json.loads(json.dumps(solve({'total':4,'committed':[2,3]}))), json.loads(json.dumps(['partial','bytes=2-3',0])))
check('run-tail-update fixture 4', json.loads(json.dumps(solve({'total':4,'committed':[0,2]}))), json.loads(json.dumps(['partial','bytes=0-0,2-2',1])))
check('run-tail-update fixture 5', json.loads(json.dumps(solve({'total':N+1,'committed':list(range(N))}))), json.loads(json.dumps(['partial',"bytes=0-"+str(N-1),N])))
check('run-tail-update fixture 6', json.loads(json.dumps(solve({'total':3,'committed':[3]}))), json.loads(json.dumps(None)))
check('run-tail-update fixture 7', json.loads(json.dumps(solve({'total':3,'committed':[-1]}))), json.loads(json.dumps(None)))
check('run-tail-update fixture 8', json.loads(json.dumps(solve({'total':3,'committed':[]}))), json.loads(json.dumps(['partial',None,0])))
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(x):
    positions=sorted(set(x['committed']))
    if any(p<0 or p>=x['total'] for p in positions): return None
    runs=[]
    for p in positions:
        if runs and p==runs[-1][1]+1:
            runs[-1][0]=p
        else:
            runs.append([p,p])
    field='bytes='+','.join(str(a)+'-'+str(b) for a,b in runs) if runs else None
    prefix=0
    for p in positions:
        if p!=prefix: break
        prefix+=1
    state='complete' if len(positions)==x['total'] else 'partial'
    return [state,field,prefix]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('run-tail-update fixture 0', json.loads(json.dumps(solve({'total':7,'committed':[4,0,1,5,1]}))), json.loads(json.dumps(['partial','bytes=0-1,4-5',2])))
check('run-tail-update fixture 1', json.loads(json.dumps(solve({'total':3,'committed':[2,0,1]}))), json.loads(json.dumps(['complete','bytes=0-2',3])))
check('run-tail-update fixture 2', json.loads(json.dumps(solve({'total':0,'committed':[]}))), json.loads(json.dumps(['complete',None,0])))
check('run-tail-update fixture 3', json.loads(json.dumps(solve({'total':4,'committed':[2,3]}))), json.loads(json.dumps(['partial','bytes=2-3',0])))
check('run-tail-update fixture 4', json.loads(json.dumps(solve({'total':4,'committed':[0,2]}))), json.loads(json.dumps(['partial','bytes=0-0,2-2',1])))
check('run-tail-update fixture 5', json.loads(json.dumps(solve({'total':N+1,'committed':list(range(N))}))), json.loads(json.dumps(['partial',"bytes=0-"+str(N-1),N])))
check('run-tail-update fixture 6', json.loads(json.dumps(solve({'total':3,'committed':[3]}))), json.loads(json.dumps(None)))
check('run-tail-update fixture 7', json.loads(json.dumps(solve({'total':3,'committed':[-1]}))), json.loads(json.dumps(None)))
check('run-tail-update fixture 8', json.loads(json.dumps(solve({'total':3,'committed':[]}))), json.loads(json.dumps(['partial',None,0])))
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:
An upload status endpoint reports committed byte coverage: extending a run changes its end while retaining its initial byte.

x has a nonnegative complete length and committed byte offsets, which may repeat or arrive unordered. Reject offsets outside the representation. Return [complete|partial,acknowledged-range-field-or-null,next-missing-prefix-offset]. The local acknowledged field uses bytes= followed by comma-separated inclusive runs. Empty coverage has null header; an empty representation is complete. next-missing is the end of the committed contiguous prefix, not the highest written offset.

split: open-access


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

N = 1
observations = []
def solve(x):
    positions=sorted(set(x['committed']))
    if any(p<0 or p>=x['total'] for p in positions): return None
    runs=[]
    for p in positions:
        if runs and p==runs[-1][1]+1:
            runs[-1][1]=p
        else:
            runs.append([0,p])
    field='bytes='+','.join(str(a)+'-'+str(b) for a,b in runs) if runs else None
    prefix=0
    for p in positions:
        if p!=prefix: break
        prefix+=1
    state='complete' if len(positions)==x['total'] else 'partial'
    return [state,field,prefix]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('run-origin fixture 0', json.loads(json.dumps(solve({'total':7,'committed':[4,0,1,5,1]}))), json.loads(json.dumps(['partial','bytes=0-1,4-5',2])))
check('run-origin fixture 1', json.loads(json.dumps(solve({'total':3,'committed':[2,0,1]}))), json.loads(json.dumps(['complete','bytes=0-2',3])))
check('run-origin fixture 2', json.loads(json.dumps(solve({'total':0,'committed':[]}))), json.loads(json.dumps(['complete',None,0])))
check('run-origin fixture 3', json.loads(json.dumps(solve({'total':4,'committed':[2,3]}))), json.loads(json.dumps(['partial','bytes=2-3',0])))
check('run-origin fixture 4', json.loads(json.dumps(solve({'total':4,'committed':[0,2]}))), json.loads(json.dumps(['partial','bytes=0-0,2-2',1])))
check('run-origin fixture 5', json.loads(json.dumps(solve({'total':N+1,'committed':list(range(N))}))), json.loads(json.dumps(['partial',"bytes=0-"+str(N-1),N])))
check('run-origin fixture 6', json.loads(json.dumps(solve({'total':3,'committed':[3]}))), json.loads(json.dumps(None)))
check('run-origin fixture 7', json.loads(json.dumps(solve({'total':3,'committed':[-1]}))), json.loads(json.dumps(None)))
check('run-origin fixture 8', json.loads(json.dumps(solve({'total':3,'committed':[]}))), json.loads(json.dumps(['partial',None,0])))
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(x):
    positions=sorted(set(x['committed']))
    if any(p<0 or p>=x['total'] for p in positions): return None
    runs=[]
    for p in positions:
        if runs and p==runs[-1][1]+1:
            runs[-1][1]=p
        else:
            runs.append([runs[-1][1]+1 if runs else 0,p])
    field='bytes='+','.join(str(a)+'-'+str(b) for a,b in runs) if runs else None
    prefix=0
    for p in positions:
        if p!=prefix: break
        prefix+=1
    state='complete' if len(positions)==x['total'] else 'partial'
    return [state,field,prefix]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('run-origin fixture 0', json.loads(json.dumps(solve({'total':7,'committed':[4,0,1,5,1]}))), json.loads(json.dumps(['partial','bytes=0-1,4-5',2])))
check('run-origin fixture 1', json.loads(json.dumps(solve({'total':3,'committed':[2,0,1]}))), json.loads(json.dumps(['complete','bytes=0-2',3])))
check('run-origin fixture 2', json.loads(json.dumps(solve({'total':0,'committed':[]}))), json.loads(json.dumps(['complete',None,0])))
check('run-origin fixture 3', json.loads(json.dumps(solve({'total':4,'committed':[2,3]}))), json.loads(json.dumps(['partial','bytes=2-3',0])))
check('run-origin fixture 4', json.loads(json.dumps(solve({'total':4,'committed':[0,2]}))), json.loads(json.dumps(['partial','bytes=0-0,2-2',1])))
check('run-origin fixture 5', json.loads(json.dumps(solve({'total':N+1,'committed':list(range(N))}))), json.loads(json.dumps(['partial',"bytes=0-"+str(N-1),N])))
check('run-origin fixture 6', json.loads(json.dumps(solve({'total':3,'committed':[3]}))), json.loads(json.dumps(None)))
check('run-origin fixture 7', json.loads(json.dumps(solve({'total':3,'committed':[-1]}))), json.loads(json.dumps(None)))
check('run-origin fixture 8', json.loads(json.dumps(solve({'total':3,'committed':[]}))), json.loads(json.dumps(['partial',None,0])))
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:
An upload status endpoint reports committed byte coverage: a new acknowledged run begins at its own first committed byte.

x has a nonnegative complete length and committed byte offsets, which may repeat or arrive unordered. Reject offsets outside the representation. Return [complete|partial,acknowledged-range-field-or-null,next-missing-prefix-offset]. The local acknowledged field uses bytes= followed by comma-separated inclusive runs. Empty coverage has null header; an empty representation is complete. next-missing is the end of the committed contiguous prefix, not the highest written offset.

split: open-access


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

N = 1
observations = []
def solve(x):
    positions=sorted(set(x['committed']))
    if any(p<0 or p>=x['total'] for p in positions): return None
    runs=[]
    for p in positions:
        if runs and p==runs[-1][1]+1:
            runs[-1][1]=p
        else:
            runs.append([p,p])
    field='bytes='+','.join(str(a)+'-'+str(b) for a,b in runs) if runs else 'bytes='
    prefix=0
    for p in positions:
        if p!=prefix: break
        prefix+=1
    state='complete' if len(positions)==x['total'] else 'partial'
    return [state,field,prefix]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty-header fixture 0', json.loads(json.dumps(solve({'total':7,'committed':[4,0,1,5,1]}))), json.loads(json.dumps(['partial','bytes=0-1,4-5',2])))
check('empty-header fixture 1', json.loads(json.dumps(solve({'total':3,'committed':[2,0,1]}))), json.loads(json.dumps(['complete','bytes=0-2',3])))
check('empty-header fixture 2', json.loads(json.dumps(solve({'total':0,'committed':[]}))), json.loads(json.dumps(['complete',None,0])))
check('empty-header fixture 3', json.loads(json.dumps(solve({'total':4,'committed':[2,3]}))), json.loads(json.dumps(['partial','bytes=2-3',0])))
check('empty-header fixture 4', json.loads(json.dumps(solve({'total':4,'committed':[0,2]}))), json.loads(json.dumps(['partial','bytes=0-0,2-2',1])))
check('empty-header fixture 5', json.loads(json.dumps(solve({'total':N+1,'committed':list(range(N))}))), json.loads(json.dumps(['partial',"bytes=0-"+str(N-1),N])))
check('empty-header fixture 6', json.loads(json.dumps(solve({'total':3,'committed':[3]}))), json.loads(json.dumps(None)))
check('empty-header fixture 7', json.loads(json.dumps(solve({'total':3,'committed':[-1]}))), json.loads(json.dumps(None)))
check('empty-header fixture 8', json.loads(json.dumps(solve({'total':3,'committed':[]}))), json.loads(json.dumps(['partial',None,0])))
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(x):
    positions=sorted(set(x['committed']))
    if any(p<0 or p>=x['total'] for p in positions): return None
    runs=[]
    for p in positions:
        if runs and p==runs[-1][1]+1:
            runs[-1][1]=p
        else:
            runs.append([p,p])
    field='bytes='+','.join(str(a)+'-'+str(b) for a,b in runs) if runs else 'bytes=*/'+str(x['total'])
    prefix=0
    for p in positions:
        if p!=prefix: break
        prefix+=1
    state='complete' if len(positions)==x['total'] else 'partial'
    return [state,field,prefix]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty-header fixture 0', json.loads(json.dumps(solve({'total':7,'committed':[4,0,1,5,1]}))), json.loads(json.dumps(['partial','bytes=0-1,4-5',2])))
check('empty-header fixture 1', json.loads(json.dumps(solve({'total':3,'committed':[2,0,1]}))), json.loads(json.dumps(['complete','bytes=0-2',3])))
check('empty-header fixture 2', json.loads(json.dumps(solve({'total':0,'committed':[]}))), json.loads(json.dumps(['complete',None,0])))
check('empty-header fixture 3', json.loads(json.dumps(solve({'total':4,'committed':[2,3]}))), json.loads(json.dumps(['partial','bytes=2-3',0])))
check('empty-header fixture 4', json.loads(json.dumps(solve({'total':4,'committed':[0,2]}))), json.loads(json.dumps(['partial','bytes=0-0,2-2',1])))
check('empty-header fixture 5', json.loads(json.dumps(solve({'total':N+1,'committed':list(range(N))}))), json.loads(json.dumps(['partial',"bytes=0-"+str(N-1),N])))
check('empty-header fixture 6', json.loads(json.dumps(solve({'total':3,'committed':[3]}))), json.loads(json.dumps(None)))
check('empty-header fixture 7', json.loads(json.dumps(solve({'total':3,'committed':[-1]}))), json.loads(json.dumps(None)))
check('empty-header fixture 8', json.loads(json.dumps(solve({'total':3,'committed':[]}))), json.loads(json.dumps(['partial',None,0])))
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:
An upload status endpoint reports committed byte coverage: no committed bytes means no acknowledged range field.

x has a nonnegative complete length and committed byte offsets, which may repeat or arrive unordered. Reject offsets outside the representation. Return [complete|partial,acknowledged-range-field-or-null,next-missing-prefix-offset]. The local acknowledged field uses bytes= followed by comma-separated inclusive runs. Empty coverage has null header; an empty representation is complete. next-missing is the end of the committed contiguous prefix, not the highest written offset.

split: open-access


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

N = 1
observations = []
def solve(x):
    positions=sorted(set(x['committed']))
    if any(p<0 or p>=x['total'] for p in positions): return None
    runs=[]
    for p in positions:
        if runs and p==runs[-1][1]+1:
            runs[-1][1]=p
        else:
            runs.append([p,p])
    field='bytes='+','.join(str(a)+'-'+str(b) for a,b in runs) if runs else None
    prefix=0
    for p in positions:
        if p!=prefix: prefix=p
        prefix+=1
    state='complete' if len(positions)==x['total'] else 'partial'
    return [state,field,prefix]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('prefix-holes fixture 0', json.loads(json.dumps(solve({'total':7,'committed':[4,0,1,5,1]}))), json.loads(json.dumps(['partial','bytes=0-1,4-5',2])))
check('prefix-holes fixture 1', json.loads(json.dumps(solve({'total':3,'committed':[2,0,1]}))), json.loads(json.dumps(['complete','bytes=0-2',3])))
check('prefix-holes fixture 2', json.loads(json.dumps(solve({'total':0,'committed':[]}))), json.loads(json.dumps(['complete',None,0])))
check('prefix-holes fixture 3', json.loads(json.dumps(solve({'total':4,'committed':[2,3]}))), json.loads(json.dumps(['partial','bytes=2-3',0])))
check('prefix-holes fixture 4', json.loads(json.dumps(solve({'total':4,'committed':[0,2]}))), json.loads(json.dumps(['partial','bytes=0-0,2-2',1])))
check('prefix-holes fixture 5', json.loads(json.dumps(solve({'total':N+1,'committed':list(range(N))}))), json.loads(json.dumps(['partial',"bytes=0-"+str(N-1),N])))
check('prefix-holes fixture 6', json.loads(json.dumps(solve({'total':3,'committed':[3]}))), json.loads(json.dumps(None)))
check('prefix-holes fixture 7', json.loads(json.dumps(solve({'total':3,'committed':[-1]}))), json.loads(json.dumps(None)))
check('prefix-holes fixture 8', json.loads(json.dumps(solve({'total':3,'committed':[]}))), json.loads(json.dumps(['partial',None,0])))
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(x):
    positions=sorted(set(x['committed']))
    if any(p<0 or p>=x['total'] for p in positions): return None
    runs=[]
    for p in positions:
        if runs and p==runs[-1][1]+1:
            runs[-1][1]=p
        else:
            runs.append([p,p])
    field='bytes='+','.join(str(a)+'-'+str(b) for a,b in runs) if runs else None
    prefix=0
    for p in positions:
        if p>prefix+1: break
        prefix+=1
    state='complete' if len(positions)==x['total'] else 'partial'
    return [state,field,prefix]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('prefix-holes fixture 0', json.loads(json.dumps(solve({'total':7,'committed':[4,0,1,5,1]}))), json.loads(json.dumps(['partial','bytes=0-1,4-5',2])))
check('prefix-holes fixture 1', json.loads(json.dumps(solve({'total':3,'committed':[2,0,1]}))), json.loads(json.dumps(['complete','bytes=0-2',3])))
check('prefix-holes fixture 2', json.loads(json.dumps(solve({'total':0,'committed':[]}))), json.loads(json.dumps(['complete',None,0])))
check('prefix-holes fixture 3', json.loads(json.dumps(solve({'total':4,'committed':[2,3]}))), json.loads(json.dumps(['partial','bytes=2-3',0])))
check('prefix-holes fixture 4', json.loads(json.dumps(solve({'total':4,'committed':[0,2]}))), json.loads(json.dumps(['partial','bytes=0-0,2-2',1])))
check('prefix-holes fixture 5', json.loads(json.dumps(solve({'total':N+1,'committed':list(range(N))}))), json.loads(json.dumps(['partial',"bytes=0-"+str(N-1),N])))
check('prefix-holes fixture 6', json.loads(json.dumps(solve({'total':3,'committed':[3]}))), json.loads(json.dumps(None)))
check('prefix-holes fixture 7', json.loads(json.dumps(solve({'total':3,'committed':[-1]}))), json.loads(json.dumps(None)))
check('prefix-holes fixture 8', json.loads(json.dumps(solve({'total':3,'committed':[]}))), json.loads(json.dumps(['partial',None,0])))
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:
An upload status endpoint reports committed byte coverage: the resumable prefix stops at the first byte hole.

x has a nonnegative complete length and committed byte offsets, which may repeat or arrive unordered. Reject offsets outside the representation. Return [complete|partial,acknowledged-range-field-or-null,next-missing-prefix-offset]. The local acknowledged field uses bytes= followed by comma-separated inclusive runs. Empty coverage has null header; an empty representation is complete. next-missing is the end of the committed contiguous prefix, not the highest written offset.

split: open-access


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

N = 1
observations = []
def solve(x):
    positions=sorted(set(x['committed']))
    if any(p<0 or p>=x['total'] for p in positions): return None
    runs=[]
    for p in positions:
        if runs and p==runs[-1][1]+1:
            runs[-1][1]=p
        else:
            runs.append([p,p])
    field='bytes='+','.join(str(a)+'-'+str(b) for a,b in runs) if runs else None
    prefix=0
    for p in positions:
        if p!=prefix: break
        prefix+=1
    state='complete' if positions and len(positions)==x['total'] else 'partial'
    return [state,field,prefix]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('complete-empty-object fixture 0', json.loads(json.dumps(solve({'total':7,'committed':[4,0,1,5,1]}))), json.loads(json.dumps(['partial','bytes=0-1,4-5',2])))
check('complete-empty-object fixture 1', json.loads(json.dumps(solve({'total':3,'committed':[2,0,1]}))), json.loads(json.dumps(['complete','bytes=0-2',3])))
check('complete-empty-object fixture 2', json.loads(json.dumps(solve({'total':0,'committed':[]}))), json.loads(json.dumps(['complete',None,0])))
check('complete-empty-object fixture 3', json.loads(json.dumps(solve({'total':4,'committed':[2,3]}))), json.loads(json.dumps(['partial','bytes=2-3',0])))
check('complete-empty-object fixture 4', json.loads(json.dumps(solve({'total':4,'committed':[0,2]}))), json.loads(json.dumps(['partial','bytes=0-0,2-2',1])))
check('complete-empty-object fixture 5', json.loads(json.dumps(solve({'total':N+1,'committed':list(range(N))}))), json.loads(json.dumps(['partial',"bytes=0-"+str(N-1),N])))
check('complete-empty-object fixture 6', json.loads(json.dumps(solve({'total':3,'committed':[3]}))), json.loads(json.dumps(None)))
check('complete-empty-object fixture 7', json.loads(json.dumps(solve({'total':3,'committed':[-1]}))), json.loads(json.dumps(None)))
check('complete-empty-object fixture 8', json.loads(json.dumps(solve({'total':3,'committed':[]}))), json.loads(json.dumps(['partial',None,0])))
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(x):
    positions=sorted(set(x['committed']))
    if any(p<0 or p>=x['total'] for p in positions): return None
    runs=[]
    for p in positions:
        if runs and p==runs[-1][1]+1:
            runs[-1][1]=p
        else:
            runs.append([p,p])
    field='bytes='+','.join(str(a)+'-'+str(b) for a,b in runs) if runs else None
    prefix=0
    for p in positions:
        if p!=prefix: break
        prefix+=1
    state='complete' if prefix>0 and prefix==x['total'] else 'partial'
    return [state,field,prefix]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('complete-empty-object fixture 0', json.loads(json.dumps(solve({'total':7,'committed':[4,0,1,5,1]}))), json.loads(json.dumps(['partial','bytes=0-1,4-5',2])))
check('complete-empty-object fixture 1', json.loads(json.dumps(solve({'total':3,'committed':[2,0,1]}))), json.loads(json.dumps(['complete','bytes=0-2',3])))
check('complete-empty-object fixture 2', json.loads(json.dumps(solve({'total':0,'committed':[]}))), json.loads(json.dumps(['complete',None,0])))
check('complete-empty-object fixture 3', json.loads(json.dumps(solve({'total':4,'committed':[2,3]}))), json.loads(json.dumps(['partial','bytes=2-3',0])))
check('complete-empty-object fixture 4', json.loads(json.dumps(solve({'total':4,'committed':[0,2]}))), json.loads(json.dumps(['partial','bytes=0-0,2-2',1])))
check('complete-empty-object fixture 5', json.loads(json.dumps(solve({'total':N+1,'committed':list(range(N))}))), json.loads(json.dumps(['partial',"bytes=0-"+str(N-1),N])))
check('complete-empty-object fixture 6', json.loads(json.dumps(solve({'total':3,'committed':[3]}))), json.loads(json.dumps(None)))
check('complete-empty-object fixture 7', json.loads(json.dumps(solve({'total':3,'committed':[-1]}))), json.loads(json.dumps(None)))
check('complete-empty-object fixture 8', json.loads(json.dumps(solve({'total':3,'committed':[]}))), json.loads(json.dumps(['partial',None,0])))
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:
An upload status endpoint reports committed byte coverage: zero-length uploads are complete without an acknowledged run.

x has a nonnegative complete length and committed byte offsets, which may repeat or arrive unordered. Reject offsets outside the representation. Return [complete|partial,acknowledged-range-field-or-null,next-missing-prefix-offset]. The local acknowledged field uses bytes= followed by comma-separated inclusive runs. Empty coverage has null header; an empty representation is complete. next-missing is the end of the committed contiguous prefix, not the highest written offset.

split: open-access


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

N = 1
observations = []
def solve(x):
    data=x['text'].encode('utf-8')
    pos=0
    entries=[]
    bodies=[]
    while pos<len(data):
        end=data.find(b'\n',pos)
        final=end<0
        end=len(data) if final else end
        content_end=end-1 if not final and end>pos and data[end-1]==13 else end
        terminator=0 if final else end-content_end+1
        body=data[pos:content_end]
        if body:
            if len(body)>x['cap']: return None
            entries.append([pos,len(body),terminator])
            bodies.append(body.hex())
        pos=len(data) if final else end+1
    if any(i<0 or i>=len(bodies) for i in x['select']): return None
    return [entries,[bodies[i] for i in x['select']]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('bom-position fixture 0', json.loads(json.dumps(solve({'text':'a\r\nb\n\ncd','cap':5,'select':[2,0,2]}))), json.loads(json.dumps([[[0,1,2],[3,1,1],[6,2,0]],['6364','61','6364']])))
check('bom-position fixture 1', json.loads(json.dumps(solve({'text':'\ufeffa\n','cap':1,'select':[0]}))), json.loads(json.dumps([[[3,1,1]],['61']])))
check('bom-position fixture 2', json.loads(json.dumps(solve({'text':'\n\r\n','cap':0,'select':[]}))), json.loads(json.dumps([[],[]])))
check('bom-position fixture 3', json.loads(json.dumps(solve({'text':'abc','cap':2,'select':[]}))), json.loads(json.dumps(None)))
check('bom-position fixture 4', json.loads(json.dumps(solve({'text':'é','cap':1,'select':[]}))), json.loads(json.dumps(None)))
check('bom-position fixture 5', json.loads(json.dumps(solve({'text':"é"*N+"\n",'cap':2*N,'select':[0]}))), json.loads(json.dumps([[[0,2*N,1]],["c3a9"*N]])))
check('bom-position fixture 6', json.loads(json.dumps(solve({'text':'a\n','cap':1,'select':[-1]}))), json.loads(json.dumps(None)))
check('bom-position fixture 7', json.loads(json.dumps(solve({'text':'','cap':0,'select':[]}))), json.loads(json.dumps([[],[]])))
check('bom-position fixture 8', json.loads(json.dumps(solve({'text':'a\n','cap':1,'select':[1]}))), json.loads(json.dumps(None)))
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(x):
    data=x['text'].encode('utf-8')
    pos=1 if data.startswith(b'\xef\xbb\xbf') else 0
    entries=[]
    bodies=[]
    while pos<len(data):
        end=data.find(b'\n',pos)
        final=end<0
        end=len(data) if final else end
        content_end=end-1 if not final and end>pos and data[end-1]==13 else end
        terminator=0 if final else end-content_end+1
        body=data[pos:content_end]
        if body:
            if len(body)>x['cap']: return None
            entries.append([pos,len(body),terminator])
            bodies.append(body.hex())
        pos=len(data) if final else end+1
    if any(i<0 or i>=len(bodies) for i in x['select']): return None
    return [entries,[bodies[i] for i in x['select']]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('bom-position fixture 0', json.loads(json.dumps(solve({'text':'a\r\nb\n\ncd','cap':5,'select':[2,0,2]}))), json.loads(json.dumps([[[0,1,2],[3,1,1],[6,2,0]],['6364','61','6364']])))
check('bom-position fixture 1', json.loads(json.dumps(solve({'text':'\ufeffa\n','cap':1,'select':[0]}))), json.loads(json.dumps([[[3,1,1]],['61']])))
check('bom-position fixture 2', json.loads(json.dumps(solve({'text':'\n\r\n','cap':0,'select':[]}))), json.loads(json.dumps([[],[]])))
check('bom-position fixture 3', json.loads(json.dumps(solve({'text':'abc','cap':2,'select':[]}))), json.loads(json.dumps(None)))
check('bom-position fixture 4', json.loads(json.dumps(solve({'text':'é','cap':1,'select':[]}))), json.loads(json.dumps(None)))
check('bom-position fixture 5', json.loads(json.dumps(solve({'text':"é"*N+"\n",'cap':2*N,'select':[0]}))), json.loads(json.dumps([[[0,2*N,1]],["c3a9"*N]])))
check('bom-position fixture 6', json.loads(json.dumps(solve({'text':'a\n','cap':1,'select':[-1]}))), json.loads(json.dumps(None)))
check('bom-position fixture 7', json.loads(json.dumps(solve({'text':'','cap':0,'select':[]}))), json.loads(json.dumps([[],[]])))
check('bom-position fixture 8', json.loads(json.dumps(solve({'text':'a\n','cap':1,'select':[1]}))), json.loads(json.dumps(None)))
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:
A row-range endpoint builds byte-addressable line record metadata: the first record starts after the representation BOM bytes.

Build a bounded row index over UTF-8 text. A leading UTF-8 BOM is excluded from records but occupies3 representation bytes. LF or CRLF terminates a row; blank rows are ignored. A final unterminated nonempty row is included. Return [entries,selected-hex-bodies], with each entry [absolute-byte-start,content-byte-count,terminator-byte-count]. Enforce a per-record byte cap and nonnegative selected row indices. Selection order and multiplicity are meaningful.

split: open-access


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

N = 1
observations = []
def solve(x):
    data=x['text'].encode('utf-8')
    pos=3 if data.startswith(b'\xef\xbb\xbf') else 0
    entries=[]
    bodies=[]
    while pos<len(data):
        end=data.find(b'\n',pos)
        final=end<0
        if final: break
        end=end
        content_end=end-1 if not final and end>pos and data[end-1]==13 else end
        terminator=0 if final else end-content_end+1
        body=data[pos:content_end]
        if body:
            if len(body)>x['cap']: return None
            entries.append([pos,len(body),terminator])
            bodies.append(body.hex())
        pos=len(data) if final else end+1
    if any(i<0 or i>=len(bodies) for i in x['select']): return None
    return [entries,[bodies[i] for i in x['select']]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unterminated-tail fixture 0', json.loads(json.dumps(solve({'text':'a\r\nb\n\ncd','cap':5,'select':[2,0,2]}))), json.loads(json.dumps([[[0,1,2],[3,1,1],[6,2,0]],['6364','61','6364']])))
check('unterminated-tail fixture 1', json.loads(json.dumps(solve({'text':'\ufeffa\n','cap':1,'select':[0]}))), json.loads(json.dumps([[[3,1,1]],['61']])))
check('unterminated-tail fixture 2', json.loads(json.dumps(solve({'text':'\n\r\n','cap':0,'select':[]}))), json.loads(json.dumps([[],[]])))
check('unterminated-tail fixture 3', json.loads(json.dumps(solve({'text':'abc','cap':2,'select':[]}))), json.loads(json.dumps(None)))
check('unterminated-tail fixture 4', json.loads(json.dumps(solve({'text':'é','cap':1,'select':[]}))), json.loads(json.dumps(None)))
check('unterminated-tail fixture 5', json.loads(json.dumps(solve({'text':"é"*N+"\n",'cap':2*N,'select':[0]}))), json.loads(json.dumps([[[0,2*N,1]],["c3a9"*N]])))
check('unterminated-tail fixture 6', json.loads(json.dumps(solve({'text':'a\n','cap':1,'select':[-1]}))), json.loads(json.dumps(None)))
check('unterminated-tail fixture 7', json.loads(json.dumps(solve({'text':'','cap':0,'select':[]}))), json.loads(json.dumps([[],[]])))
check('unterminated-tail fixture 8', json.loads(json.dumps(solve({'text':'a\n','cap':1,'select':[1]}))), json.loads(json.dumps(None)))
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(x):
    data=x['text'].encode('utf-8')
    pos=3 if data.startswith(b'\xef\xbb\xbf') else 0
    entries=[]
    bodies=[]
    while pos<len(data):
        end=data.find(b'\n',pos)
        final=end<0
        if final and pos>0: break
        end=len(data) if final else end
        content_end=end-1 if not final and end>pos and data[end-1]==13 else end
        terminator=0 if final else end-content_end+1
        body=data[pos:content_end]
        if body:
            if len(body)>x['cap']: return None
            entries.append([pos,len(body),terminator])
            bodies.append(body.hex())
        pos=len(data) if final else end+1
    if any(i<0 or i>=len(bodies) for i in x['select']): return None
    return [entries,[bodies[i] for i in x['select']]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unterminated-tail fixture 0', json.loads(json.dumps(solve({'text':'a\r\nb\n\ncd','cap':5,'select':[2,0,2]}))), json.loads(json.dumps([[[0,1,2],[3,1,1],[6,2,0]],['6364','61','6364']])))
check('unterminated-tail fixture 1', json.loads(json.dumps(solve({'text':'\ufeffa\n','cap':1,'select':[0]}))), json.loads(json.dumps([[[3,1,1]],['61']])))
check('unterminated-tail fixture 2', json.loads(json.dumps(solve({'text':'\n\r\n','cap':0,'select':[]}))), json.loads(json.dumps([[],[]])))
check('unterminated-tail fixture 3', json.loads(json.dumps(solve({'text':'abc','cap':2,'select':[]}))), json.loads(json.dumps(None)))
check('unterminated-tail fixture 4', json.loads(json.dumps(solve({'text':'é','cap':1,'select':[]}))), json.loads(json.dumps(None)))
check('unterminated-tail fixture 5', json.loads(json.dumps(solve({'text':"é"*N+"\n",'cap':2*N,'select':[0]}))), json.loads(json.dumps([[[0,2*N,1]],["c3a9"*N]])))
check('unterminated-tail fixture 6', json.loads(json.dumps(solve({'text':'a\n','cap':1,'select':[-1]}))), json.loads(json.dumps(None)))
check('unterminated-tail fixture 7', json.loads(json.dumps(solve({'text':'','cap':0,'select':[]}))), json.loads(json.dumps([[],[]])))
check('unterminated-tail fixture 8', json.loads(json.dumps(solve({'text':'a\n','cap':1,'select':[1]}))), json.loads(json.dumps(None)))
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:
A row-range endpoint builds byte-addressable line record metadata: a final line without LF remains a selectable record.

Build a bounded row index over UTF-8 text. A leading UTF-8 BOM is excluded from records but occupies3 representation bytes. LF or CRLF terminates a row; blank rows are ignored. A final unterminated nonempty row is included. Return [entries,selected-hex-bodies], with each entry [absolute-byte-start,content-byte-count,terminator-byte-count]. Enforce a per-record byte cap and nonnegative selected row indices. Selection order and multiplicity are meaningful.

split: open-access


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

N = 1
observations = []
def solve(x):
    data=x['text'].encode('utf-8')
    pos=3 if data.startswith(b'\xef\xbb\xbf') else 0
    entries=[]
    bodies=[]
    while pos<len(data):
        end=data.find(b'\n',pos)
        final=end<0
        end=len(data) if final else end
        content_end=end
        terminator=0 if final else end-content_end+1
        body=data[pos:content_end]
        if body:
            if len(body)>x['cap']: return None
            entries.append([pos,len(body),terminator])
            bodies.append(body.hex())
        pos=len(data) if final else end+1
    if any(i<0 or i>=len(bodies) for i in x['select']): return None
    return [entries,[bodies[i] for i in x['select']]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('crlf-content fixture 0', json.loads(json.dumps(solve({'text':'a\r\nb\n\ncd','cap':5,'select':[2,0,2]}))), json.loads(json.dumps([[[0,1,2],[3,1,1],[6,2,0]],['6364','61','6364']])))
check('crlf-content fixture 1', json.loads(json.dumps(solve({'text':'\ufeffa\n','cap':1,'select':[0]}))), json.loads(json.dumps([[[3,1,1]],['61']])))
check('crlf-content fixture 2', json.loads(json.dumps(solve({'text':'\n\r\n','cap':0,'select':[]}))), json.loads(json.dumps([[],[]])))
check('crlf-content fixture 3', json.loads(json.dumps(solve({'text':'abc','cap':2,'select':[]}))), json.loads(json.dumps(None)))
check('crlf-content fixture 4', json.loads(json.dumps(solve({'text':'é','cap':1,'select':[]}))), json.loads(json.dumps(None)))
check('crlf-content fixture 5', json.loads(json.dumps(solve({'text':"é"*N+"\n",'cap':2*N,'select':[0]}))), json.loads(json.dumps([[[0,2*N,1]],["c3a9"*N]])))
check('crlf-content fixture 6', json.loads(json.dumps(solve({'text':'a\n','cap':1,'select':[-1]}))), json.loads(json.dumps(None)))
check('crlf-content fixture 7', json.loads(json.dumps(solve({'text':'','cap':0,'select':[]}))), json.loads(json.dumps([[],[]])))
check('crlf-content fixture 8', json.loads(json.dumps(solve({'text':'a\n','cap':1,'select':[1]}))), json.loads(json.dumps(None)))
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(x):
    data=x['text'].encode('utf-8')
    pos=3 if data.startswith(b'\xef\xbb\xbf') else 0
    entries=[]
    bodies=[]
    while pos<len(data):
        end=data.find(b'\n',pos)
        final=end<0
        end=len(data) if final else end
        content_end=end-1 if not final and end>pos else end
        terminator=0 if final else end-content_end+1
        body=data[pos:content_end]
        if body:
            if len(body)>x['cap']: return None
            entries.append([pos,len(body),terminator])
            bodies.append(body.hex())
        pos=len(data) if final else end+1
    if any(i<0 or i>=len(bodies) for i in x['select']): return None
    return [entries,[bodies[i] for i in x['select']]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('crlf-content fixture 0', json.loads(json.dumps(solve({'text':'a\r\nb\n\ncd','cap':5,'select':[2,0,2]}))), json.loads(json.dumps([[[0,1,2],[3,1,1],[6,2,0]],['6364','61','6364']])))
check('crlf-content fixture 1', json.loads(json.dumps(solve({'text':'\ufeffa\n','cap':1,'select':[0]}))), json.loads(json.dumps([[[3,1,1]],['61']])))
check('crlf-content fixture 2', json.loads(json.dumps(solve({'text':'\n\r\n','cap':0,'select':[]}))), json.loads(json.dumps([[],[]])))
check('crlf-content fixture 3', json.loads(json.dumps(solve({'text':'abc','cap':2,'select':[]}))), json.loads(json.dumps(None)))
check('crlf-content fixture 4', json.loads(json.dumps(solve({'text':'é','cap':1,'select':[]}))), json.loads(json.dumps(None)))
check('crlf-content fixture 5', json.loads(json.dumps(solve({'text':"é"*N+"\n",'cap':2*N,'select':[0]}))), json.loads(json.dumps([[[0,2*N,1]],["c3a9"*N]])))
check('crlf-content fixture 6', json.loads(json.dumps(solve({'text':'a\n','cap':1,'select':[-1]}))), json.loads(json.dumps(None)))
check('crlf-content fixture 7', json.loads(json.dumps(solve({'text':'','cap':0,'select':[]}))), json.loads(json.dumps([[],[]])))
check('crlf-content fixture 8', json.loads(json.dumps(solve({'text':'a\n','cap':1,'select':[1]}))), json.loads(json.dumps(None)))
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:
A row-range endpoint builds byte-addressable line record metadata: CR in a CRLF terminator is not part of the row payload.

Build a bounded row index over UTF-8 text. A leading UTF-8 BOM is excluded from records but occupies3 representation bytes. LF or CRLF terminates a row; blank rows are ignored. A final unterminated nonempty row is included. Return [entries,selected-hex-bodies], with each entry [absolute-byte-start,content-byte-count,terminator-byte-count]. Enforce a per-record byte cap and nonnegative selected row indices. Selection order and multiplicity are meaningful.

split: open-access