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

N = 1
observations = []
def solve(d):
    try:
        out=[]
        for ids,selection,values,valid in d:
            selected=[ids[i] for i in selection]
            if len(values)!=len(ids) or len(valid)!=len(selected):
                out.append('LENGTH_ERROR'); continue
            out.append([[ident,values[i] if valid[i] else None] for i,ident in enumerate(selected)])
        return out
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [1, 2], [True, True]]]), [[[12, 1], [10, 2]]])
    check('short result', solve([[[10, 11], [0, 1], [1], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [1], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [1, 2], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [1], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 2:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [2, 3], [True, True]]]), [[[12, 2], [10, 3]]])
    check('short result', solve([[[10, 11], [0, 1], [2], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [2], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [2, 3], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [2], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 3:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [3, 4], [True, True]]]), [[[12, 3], [10, 4]]])
    check('short result', solve([[[10, 11], [0, 1], [3], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [3], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [3, 4], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [3], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 4:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [4, 5], [True, True]]]), [[[12, 4], [10, 5]]])
    check('short result', solve([[[10, 11], [0, 1], [4], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [4], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [4, 5], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [4], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 5:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [5, 6], [True, True]]]), [[[12, 5], [10, 6]]])
    check('short result', solve([[[10, 11], [0, 1], [5], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [5], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [5, 6], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [5], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
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(d):
    try:
        out=[]
        for ids,selection,values,valid in d:
            selected=[ids[i] for i in selection]
            if len(values)>len(selected) or len(valid)!=len(selected):
                out.append('LENGTH_ERROR'); continue
            out.append([[ident,values[i] if valid[i] else None] for i,ident in enumerate(selected)])
        return out
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [1, 2], [True, True]]]), [[[12, 1], [10, 2]]])
    check('short result', solve([[[10, 11], [0, 1], [1], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [1], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [1, 2], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [1], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 2:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [2, 3], [True, True]]]), [[[12, 2], [10, 3]]])
    check('short result', solve([[[10, 11], [0, 1], [2], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [2], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [2, 3], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [2], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 3:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [3, 4], [True, True]]]), [[[12, 3], [10, 4]]])
    check('short result', solve([[[10, 11], [0, 1], [3], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [3], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [3, 4], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [3], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 4:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [4, 5], [True, True]]]), [[[12, 4], [10, 5]]])
    check('short result', solve([[[10, 11], [0, 1], [4], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [4], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [4, 5], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [4], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 5:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [5, 6], [True, True]]]), [[[12, 5], [10, 6]]])
    check('short result', solve([[[10, 11], [0, 1], [5], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [5], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [5, 6], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [5], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
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 vector UDF validates against unfiltered input length.

Execute a stipulated vector UDF result contract. For every selected batch, output length must equal selected input length, and output validity must have the same length. A malformed batch emits LENGTH_ERROR and no partial values. Valid output values use their own validity and retain selected input identities.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        out=[]
        for ids,selection,values,valid in d:
            selected=[ids[i] for i in selection]
            if len(values)!=len(selected) or False:
                out.append('LENGTH_ERROR'); continue
            out.append([[ident,values[i] if valid[i] else None] for i,ident in enumerate(selected)])
        return out
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [1, 2], [True, True]]]), [[[12, 1], [10, 2]]])
    check('short result', solve([[[10, 11], [0, 1], [1], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [1], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [1, 2], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [1], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 2:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [2, 3], [True, True]]]), [[[12, 2], [10, 3]]])
    check('short result', solve([[[10, 11], [0, 1], [2], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [2], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [2, 3], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [2], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 3:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [3, 4], [True, True]]]), [[[12, 3], [10, 4]]])
    check('short result', solve([[[10, 11], [0, 1], [3], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [3], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [3, 4], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [3], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 4:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [4, 5], [True, True]]]), [[[12, 4], [10, 5]]])
    check('short result', solve([[[10, 11], [0, 1], [4], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [4], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [4, 5], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [4], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 5:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [5, 6], [True, True]]]), [[[12, 5], [10, 6]]])
    check('short result', solve([[[10, 11], [0, 1], [5], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [5], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [5, 6], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [5], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
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(d):
    try:
        out=[]
        for ids,selection,values,valid in d:
            selected=[ids[i] for i in selection]
            if len(values)!=len(selected) or len(valid)<len(selected):
                out.append('LENGTH_ERROR'); continue
            out.append([[ident,values[i] if valid[i] else None] for i,ident in enumerate(selected)])
        return out
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [1, 2], [True, True]]]), [[[12, 1], [10, 2]]])
    check('short result', solve([[[10, 11], [0, 1], [1], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [1], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [1, 2], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [1], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 2:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [2, 3], [True, True]]]), [[[12, 2], [10, 3]]])
    check('short result', solve([[[10, 11], [0, 1], [2], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [2], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [2, 3], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [2], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 3:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [3, 4], [True, True]]]), [[[12, 3], [10, 4]]])
    check('short result', solve([[[10, 11], [0, 1], [3], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [3], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [3, 4], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [3], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 4:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [4, 5], [True, True]]]), [[[12, 4], [10, 5]]])
    check('short result', solve([[[10, 11], [0, 1], [4], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [4], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [4, 5], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [4], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 5:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [5, 6], [True, True]]]), [[[12, 5], [10, 6]]])
    check('short result', solve([[[10, 11], [0, 1], [5], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [5], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [5, 6], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [5], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
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 vector UDF omits output validity cardinality validation.

Execute a stipulated vector UDF result contract. For every selected batch, output length must equal selected input length, and output validity must have the same length. A malformed batch emits LENGTH_ERROR and no partial values. Valid output values use their own validity and retain selected input identities.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        out=[]
        for ids,selection,values,valid in d:
            selected=ids[:len(selection)]
            if len(values)!=len(selected) or len(valid)!=len(selected):
                out.append('LENGTH_ERROR'); continue
            out.append([[ident,values[i] if valid[i] else None] for i,ident in enumerate(selected)])
        return out
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [1, 2], [True, True]]]), [[[12, 1], [10, 2]]])
    check('short result', solve([[[10, 11], [0, 1], [1], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [1], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [1, 2], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [1], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 2:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [2, 3], [True, True]]]), [[[12, 2], [10, 3]]])
    check('short result', solve([[[10, 11], [0, 1], [2], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [2], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [2, 3], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [2], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 3:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [3, 4], [True, True]]]), [[[12, 3], [10, 4]]])
    check('short result', solve([[[10, 11], [0, 1], [3], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [3], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [3, 4], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [3], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 4:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [4, 5], [True, True]]]), [[[12, 4], [10, 5]]])
    check('short result', solve([[[10, 11], [0, 1], [4], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [4], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [4, 5], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [4], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 5:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [5, 6], [True, True]]]), [[[12, 5], [10, 6]]])
    check('short result', solve([[[10, 11], [0, 1], [5], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [5], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [5, 6], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [5], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
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(d):
    try:
        out=[]
        for ids,selection,values,valid in d:
            selected=[ids[i] for i in sorted(selection)]
            if len(values)!=len(selected) or len(valid)!=len(selected):
                out.append('LENGTH_ERROR'); continue
            out.append([[ident,values[i] if valid[i] else None] for i,ident in enumerate(selected)])
        return out
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [1, 2], [True, True]]]), [[[12, 1], [10, 2]]])
    check('short result', solve([[[10, 11], [0, 1], [1], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [1], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [1, 2], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [1], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 2:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [2, 3], [True, True]]]), [[[12, 2], [10, 3]]])
    check('short result', solve([[[10, 11], [0, 1], [2], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [2], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [2, 3], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [2], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 3:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [3, 4], [True, True]]]), [[[12, 3], [10, 4]]])
    check('short result', solve([[[10, 11], [0, 1], [3], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [3], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [3, 4], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [3], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 4:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [4, 5], [True, True]]]), [[[12, 4], [10, 5]]])
    check('short result', solve([[[10, 11], [0, 1], [4], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [4], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [4, 5], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [4], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 5:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [5, 6], [True, True]]]), [[[12, 5], [10, 6]]])
    check('short result', solve([[[10, 11], [0, 1], [5], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [5], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [5, 6], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [5], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
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 vector UDF pairs output with prefix identities rather than selected identities.

Execute a stipulated vector UDF result contract. For every selected batch, output length must equal selected input length, and output validity must have the same length. A malformed batch emits LENGTH_ERROR and no partial values. Valid output values use their own validity and retain selected input identities.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        out=[]
        for ids,selection,values,valid in d:
            selected=[ids[i] for i in selection]
            if len(values)!=len(selected) or len(valid)!=len(selected):
                out.append([]); continue
            out.append([[ident,values[i] if valid[i] else None] for i,ident in enumerate(selected)])
        return out
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [1, 2], [True, True]]]), [[[12, 1], [10, 2]]])
    check('short result', solve([[[10, 11], [0, 1], [1], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [1], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [1, 2], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [1], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 2:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [2, 3], [True, True]]]), [[[12, 2], [10, 3]]])
    check('short result', solve([[[10, 11], [0, 1], [2], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [2], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [2, 3], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [2], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 3:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [3, 4], [True, True]]]), [[[12, 3], [10, 4]]])
    check('short result', solve([[[10, 11], [0, 1], [3], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [3], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [3, 4], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [3], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 4:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [4, 5], [True, True]]]), [[[12, 4], [10, 5]]])
    check('short result', solve([[[10, 11], [0, 1], [4], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [4], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [4, 5], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [4], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 5:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [5, 6], [True, True]]]), [[[12, 5], [10, 6]]])
    check('short result', solve([[[10, 11], [0, 1], [5], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [5], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [5, 6], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [5], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
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(d):
    try:
        out=[]
        for ids,selection,values,valid in d:
            selected=[ids[i] for i in selection]
            if len(values)!=len(selected) or len(valid)!=len(selected):
                out.append(None); continue
            out.append([[ident,values[i] if valid[i] else None] for i,ident in enumerate(selected)])
        return out
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [1, 2], [True, True]]]), [[[12, 1], [10, 2]]])
    check('short result', solve([[[10, 11], [0, 1], [1], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [1], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [1, 2], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [1], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 2:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [2, 3], [True, True]]]), [[[12, 2], [10, 3]]])
    check('short result', solve([[[10, 11], [0, 1], [2], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [2], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [2, 3], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [2], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 3:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [3, 4], [True, True]]]), [[[12, 3], [10, 4]]])
    check('short result', solve([[[10, 11], [0, 1], [3], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [3], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [3, 4], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [3], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 4:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [4, 5], [True, True]]]), [[[12, 4], [10, 5]]])
    check('short result', solve([[[10, 11], [0, 1], [4], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [4], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [4, 5], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [4], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 5:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [5, 6], [True, True]]]), [[[12, 5], [10, 6]]])
    check('short result', solve([[[10, 11], [0, 1], [5], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [5], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [5, 6], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [5], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
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 malformed UDF batch returns an empty success instead of an error.

Execute a stipulated vector UDF result contract. For every selected batch, output length must equal selected input length, and output validity must have the same length. A malformed batch emits LENGTH_ERROR and no partial values. Valid output values use their own validity and retain selected input identities.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        out=[]
        for ids,selection,values,valid in d:
            selected=[ids[i] for i in selection]
            if len(values)!=len(selected) or len(valid)!=len(selected):
                out.append('LENGTH_ERROR'); continue
            out.append([[ident,values[i]] for i,ident in enumerate(selected)])
        return out
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [1, 2], [True, True]]]), [[[12, 1], [10, 2]]])
    check('short result', solve([[[10, 11], [0, 1], [1], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [1], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [1, 2], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [1], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 2:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [2, 3], [True, True]]]), [[[12, 2], [10, 3]]])
    check('short result', solve([[[10, 11], [0, 1], [2], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [2], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [2, 3], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [2], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 3:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [3, 4], [True, True]]]), [[[12, 3], [10, 4]]])
    check('short result', solve([[[10, 11], [0, 1], [3], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [3], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [3, 4], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [3], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 4:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [4, 5], [True, True]]]), [[[12, 4], [10, 5]]])
    check('short result', solve([[[10, 11], [0, 1], [4], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [4], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [4, 5], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [4], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 5:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [5, 6], [True, True]]]), [[[12, 5], [10, 6]]])
    check('short result', solve([[[10, 11], [0, 1], [5], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [5], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [5, 6], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [5], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
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(d):
    try:
        out=[]
        for ids,selection,values,valid in d:
            selected=[ids[i] for i in selection]
            if len(values)!=len(selected) or len(valid)!=len(selected):
                out.append('LENGTH_ERROR'); continue
            out.append([[ident,values[i] if valid[i] else 0] for i,ident in enumerate(selected)])
        return out
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [1, 2], [True, True]]]), [[[12, 1], [10, 2]]])
    check('short result', solve([[[10, 11], [0, 1], [1], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [1], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [1, 2], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [1], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 2:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [2, 3], [True, True]]]), [[[12, 2], [10, 3]]])
    check('short result', solve([[[10, 11], [0, 1], [2], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [2], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [2, 3], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [2], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 3:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [3, 4], [True, True]]]), [[[12, 3], [10, 4]]])
    check('short result', solve([[[10, 11], [0, 1], [3], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [3], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [3, 4], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [3], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 4:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [4, 5], [True, True]]]), [[[12, 4], [10, 5]]])
    check('short result', solve([[[10, 11], [0, 1], [4], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [4], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [4, 5], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [4], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 5:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [5, 6], [True, True]]]), [[[12, 5], [10, 6]]])
    check('short result', solve([[[10, 11], [0, 1], [5], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [5], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [5, 6], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [5], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
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 vector UDF ignores result null validity.

Execute a stipulated vector UDF result contract. For every selected batch, output length must equal selected input length, and output validity must have the same length. A malformed batch emits LENGTH_ERROR and no partial values. Valid output values use their own validity and retain selected input identities.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        out=[]
        for ids,selection,values,valid in d:
            selected=[ids[i] for i in selection]
            if len(values)!=len(selected) or len(valid)!=len(selected):
                out.append('LENGTH_ERROR'); continue
            out.append([[ident,values[i] if valid[i] else None] for i,ident in enumerate(selected)])
        return [batch for batch in out if batch]
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [1, 2], [True, True]]]), [[[12, 1], [10, 2]]])
    check('short result', solve([[[10, 11], [0, 1], [1], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [1], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [1, 2], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [1], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 2:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [2, 3], [True, True]]]), [[[12, 2], [10, 3]]])
    check('short result', solve([[[10, 11], [0, 1], [2], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [2], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [2, 3], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [2], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 3:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [3, 4], [True, True]]]), [[[12, 3], [10, 4]]])
    check('short result', solve([[[10, 11], [0, 1], [3], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [3], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [3, 4], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [3], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 4:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [4, 5], [True, True]]]), [[[12, 4], [10, 5]]])
    check('short result', solve([[[10, 11], [0, 1], [4], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [4], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [4, 5], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [4], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 5:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [5, 6], [True, True]]]), [[[12, 5], [10, 6]]])
    check('short result', solve([[[10, 11], [0, 1], [5], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [5], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [5, 6], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [5], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
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(d):
    try:
        out=[]
        for ids,selection,values,valid in d:
            selected=[ids[i] for i in selection]
            if len(values)!=len(selected) or len(valid)!=len(selected):
                out.append('LENGTH_ERROR'); continue
            out.append([[ident,values[i] if valid[i] else None] for i,ident in enumerate(selected)])
        return [batch for batch in out if batch!=[]]
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [1, 2], [True, True]]]), [[[12, 1], [10, 2]]])
    check('short result', solve([[[10, 11], [0, 1], [1], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [1], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [1, 2], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [1], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 2:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [2, 3], [True, True]]]), [[[12, 2], [10, 3]]])
    check('short result', solve([[[10, 11], [0, 1], [2], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [2], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [2, 3], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [2], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 3:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [3, 4], [True, True]]]), [[[12, 3], [10, 4]]])
    check('short result', solve([[[10, 11], [0, 1], [3], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [3], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [3, 4], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [3], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 4:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [4, 5], [True, True]]]), [[[12, 4], [10, 5]]])
    check('short result', solve([[[10, 11], [0, 1], [4], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [4], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [4, 5], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [4], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
elif N == 5:
    check('selected ids', solve([[[10, 11, 12], [2, 0], [5, 6], [True, True]]]), [[[12, 5], [10, 6]]])
    check('short result', solve([[[10, 11], [0, 1], [5], [True, True]]]), ['LENGTH_ERROR'])
    check('long validity', solve([[[10], [0], [5], [True, False]]]), ['LENGTH_ERROR'])
    check('short validity', solve([[[10, 11], [0, 1], [5, 6], [True]]]), ['LENGTH_ERROR'])
    check('null output', solve([[[10], [0], [5], [False]]]), [[[10, None]]])
    check('empty result', solve([[[10], [], [], []]]), [[]])
    check('no invocations', solve([]), [])
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 vector UDF drops empty successful batches.

Execute a stipulated vector UDF result contract. For every selected batch, output length must equal selected input length, and output validity must have the same length. A malformed batch emits LENGTH_ERROR and no partial values. Valid output values use their own validity and retain selected input identities.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        out=[]
        for cond,tvalue,terror,fvalue,ferror in d:
            choose=cond is True
            if choose:
                error=terror; value=tvalue
            else:
                error=terror if terror is not None else ferror; value=fvalue
            out.append('ERROR:'+error if error is not None else value)
        return out
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('skip erroneous then', solve([[False, 1, 'T', 2, None]]), [2])
    check('unknown skips then', solve([[None, 1, 'T', 2, None]]), [2])
    check('skip erroneous else', solve([[True, 1, None, 2, 'F']]), [1])
    check('chosen then error', solve([[True, 1, 'T', 2, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 1, None, 2, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 1, None]]), [None])
    check('else null', solve([[False, 1, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 2:
    check('skip erroneous then', solve([[False, 2, 'T', 3, None]]), [3])
    check('unknown skips then', solve([[None, 2, 'T', 3, None]]), [3])
    check('skip erroneous else', solve([[True, 2, None, 3, 'F']]), [2])
    check('chosen then error', solve([[True, 2, 'T', 3, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 2, None, 3, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 2, None]]), [None])
    check('else null', solve([[False, 2, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 3:
    check('skip erroneous then', solve([[False, 3, 'T', 4, None]]), [4])
    check('unknown skips then', solve([[None, 3, 'T', 4, None]]), [4])
    check('skip erroneous else', solve([[True, 3, None, 4, 'F']]), [3])
    check('chosen then error', solve([[True, 3, 'T', 4, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 3, None, 4, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 3, None]]), [None])
    check('else null', solve([[False, 3, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 4:
    check('skip erroneous then', solve([[False, 4, 'T', 5, None]]), [5])
    check('unknown skips then', solve([[None, 4, 'T', 5, None]]), [5])
    check('skip erroneous else', solve([[True, 4, None, 5, 'F']]), [4])
    check('chosen then error', solve([[True, 4, 'T', 5, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 4, None, 5, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 4, None]]), [None])
    check('else null', solve([[False, 4, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 5:
    check('skip erroneous then', solve([[False, 5, 'T', 6, None]]), [6])
    check('unknown skips then', solve([[None, 5, 'T', 6, None]]), [6])
    check('skip erroneous else', solve([[True, 5, None, 6, 'F']]), [5])
    check('chosen then error', solve([[True, 5, 'T', 6, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 5, None, 6, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 5, None]]), [None])
    check('else null', solve([[False, 5, None, None, None]]), [None])
    check('empty vector', solve([]), [])
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(d):
    try:
        out=[]
        for cond,tvalue,terror,fvalue,ferror in d:
            choose=cond is True
            if choose:
                error=terror; value=tvalue
            else:
                error=terror if cond is None and terror is not None else ferror; value=fvalue
            out.append('ERROR:'+error if error is not None else value)
        return out
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('skip erroneous then', solve([[False, 1, 'T', 2, None]]), [2])
    check('unknown skips then', solve([[None, 1, 'T', 2, None]]), [2])
    check('skip erroneous else', solve([[True, 1, None, 2, 'F']]), [1])
    check('chosen then error', solve([[True, 1, 'T', 2, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 1, None, 2, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 1, None]]), [None])
    check('else null', solve([[False, 1, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 2:
    check('skip erroneous then', solve([[False, 2, 'T', 3, None]]), [3])
    check('unknown skips then', solve([[None, 2, 'T', 3, None]]), [3])
    check('skip erroneous else', solve([[True, 2, None, 3, 'F']]), [2])
    check('chosen then error', solve([[True, 2, 'T', 3, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 2, None, 3, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 2, None]]), [None])
    check('else null', solve([[False, 2, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 3:
    check('skip erroneous then', solve([[False, 3, 'T', 4, None]]), [4])
    check('unknown skips then', solve([[None, 3, 'T', 4, None]]), [4])
    check('skip erroneous else', solve([[True, 3, None, 4, 'F']]), [3])
    check('chosen then error', solve([[True, 3, 'T', 4, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 3, None, 4, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 3, None]]), [None])
    check('else null', solve([[False, 3, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 4:
    check('skip erroneous then', solve([[False, 4, 'T', 5, None]]), [5])
    check('unknown skips then', solve([[None, 4, 'T', 5, None]]), [5])
    check('skip erroneous else', solve([[True, 4, None, 5, 'F']]), [4])
    check('chosen then error', solve([[True, 4, 'T', 5, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 4, None, 5, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 4, None]]), [None])
    check('else null', solve([[False, 4, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 5:
    check('skip erroneous then', solve([[False, 5, 'T', 6, None]]), [6])
    check('unknown skips then', solve([[None, 5, 'T', 6, None]]), [6])
    check('skip erroneous else', solve([[True, 5, None, 6, 'F']]), [5])
    check('chosen then error', solve([[True, 5, 'T', 6, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 5, None, 6, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 5, None]]), [None])
    check('else null', solve([[False, 5, None, None, None]]), [None])
    check('empty vector', solve([]), [])
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:
Vector CASE evaluates THEN errors on ELSE-selected lanes.

Evaluate CASE over [condition,then-value,then-error,else-value,else-error] rows. Only True chooses THEN; False and None choose ELSE. Unchosen errors are not evaluated. Chosen errors become ERROR:<label>; a chosen null value remains None. Return one result per input lane.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        out=[]
        for cond,tvalue,terror,fvalue,ferror in d:
            choose=cond is True
            if choose:
                error=ferror if ferror is not None else terror; value=tvalue
            else:
                error=ferror; value=fvalue
            out.append('ERROR:'+error if error is not None else value)
        return out
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('skip erroneous then', solve([[False, 1, 'T', 2, None]]), [2])
    check('unknown skips then', solve([[None, 1, 'T', 2, None]]), [2])
    check('skip erroneous else', solve([[True, 1, None, 2, 'F']]), [1])
    check('chosen then error', solve([[True, 1, 'T', 2, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 1, None, 2, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 1, None]]), [None])
    check('else null', solve([[False, 1, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 2:
    check('skip erroneous then', solve([[False, 2, 'T', 3, None]]), [3])
    check('unknown skips then', solve([[None, 2, 'T', 3, None]]), [3])
    check('skip erroneous else', solve([[True, 2, None, 3, 'F']]), [2])
    check('chosen then error', solve([[True, 2, 'T', 3, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 2, None, 3, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 2, None]]), [None])
    check('else null', solve([[False, 2, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 3:
    check('skip erroneous then', solve([[False, 3, 'T', 4, None]]), [4])
    check('unknown skips then', solve([[None, 3, 'T', 4, None]]), [4])
    check('skip erroneous else', solve([[True, 3, None, 4, 'F']]), [3])
    check('chosen then error', solve([[True, 3, 'T', 4, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 3, None, 4, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 3, None]]), [None])
    check('else null', solve([[False, 3, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 4:
    check('skip erroneous then', solve([[False, 4, 'T', 5, None]]), [5])
    check('unknown skips then', solve([[None, 4, 'T', 5, None]]), [5])
    check('skip erroneous else', solve([[True, 4, None, 5, 'F']]), [4])
    check('chosen then error', solve([[True, 4, 'T', 5, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 4, None, 5, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 4, None]]), [None])
    check('else null', solve([[False, 4, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 5:
    check('skip erroneous then', solve([[False, 5, 'T', 6, None]]), [6])
    check('unknown skips then', solve([[None, 5, 'T', 6, None]]), [6])
    check('skip erroneous else', solve([[True, 5, None, 6, 'F']]), [5])
    check('chosen then error', solve([[True, 5, 'T', 6, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 5, None, 6, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 5, None]]), [None])
    check('else null', solve([[False, 5, None, None, None]]), [None])
    check('empty vector', solve([]), [])
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(d):
    try:
        out=[]
        for cond,tvalue,terror,fvalue,ferror in d:
            choose=cond is True
            if choose:
                error=terror or ferror; value=tvalue
            else:
                error=ferror; value=fvalue
            out.append('ERROR:'+error if error is not None else value)
        return out
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('skip erroneous then', solve([[False, 1, 'T', 2, None]]), [2])
    check('unknown skips then', solve([[None, 1, 'T', 2, None]]), [2])
    check('skip erroneous else', solve([[True, 1, None, 2, 'F']]), [1])
    check('chosen then error', solve([[True, 1, 'T', 2, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 1, None, 2, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 1, None]]), [None])
    check('else null', solve([[False, 1, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 2:
    check('skip erroneous then', solve([[False, 2, 'T', 3, None]]), [3])
    check('unknown skips then', solve([[None, 2, 'T', 3, None]]), [3])
    check('skip erroneous else', solve([[True, 2, None, 3, 'F']]), [2])
    check('chosen then error', solve([[True, 2, 'T', 3, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 2, None, 3, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 2, None]]), [None])
    check('else null', solve([[False, 2, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 3:
    check('skip erroneous then', solve([[False, 3, 'T', 4, None]]), [4])
    check('unknown skips then', solve([[None, 3, 'T', 4, None]]), [4])
    check('skip erroneous else', solve([[True, 3, None, 4, 'F']]), [3])
    check('chosen then error', solve([[True, 3, 'T', 4, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 3, None, 4, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 3, None]]), [None])
    check('else null', solve([[False, 3, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 4:
    check('skip erroneous then', solve([[False, 4, 'T', 5, None]]), [5])
    check('unknown skips then', solve([[None, 4, 'T', 5, None]]), [5])
    check('skip erroneous else', solve([[True, 4, None, 5, 'F']]), [4])
    check('chosen then error', solve([[True, 4, 'T', 5, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 4, None, 5, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 4, None]]), [None])
    check('else null', solve([[False, 4, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 5:
    check('skip erroneous then', solve([[False, 5, 'T', 6, None]]), [6])
    check('unknown skips then', solve([[None, 5, 'T', 6, None]]), [6])
    check('skip erroneous else', solve([[True, 5, None, 6, 'F']]), [5])
    check('chosen then error', solve([[True, 5, 'T', 6, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 5, None, 6, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 5, None]]), [None])
    check('else null', solve([[False, 5, None, None, None]]), [None])
    check('empty vector', solve([]), [])
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:
Vector CASE evaluates ELSE errors on THEN-selected lanes.

Evaluate CASE over [condition,then-value,then-error,else-value,else-error] rows. Only True chooses THEN; False and None choose ELSE. Unchosen errors are not evaluated. Chosen errors become ERROR:<label>; a chosen null value remains None. Return one result per input lane.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        out=[]
        for cond,tvalue,terror,fvalue,ferror in d:
            choose=cond is not False
            if choose:
                error=terror; value=tvalue
            else:
                error=ferror; value=fvalue
            out.append('ERROR:'+error if error is not None else value)
        return out
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('skip erroneous then', solve([[False, 1, 'T', 2, None]]), [2])
    check('unknown skips then', solve([[None, 1, 'T', 2, None]]), [2])
    check('skip erroneous else', solve([[True, 1, None, 2, 'F']]), [1])
    check('chosen then error', solve([[True, 1, 'T', 2, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 1, None, 2, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 1, None]]), [None])
    check('else null', solve([[False, 1, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 2:
    check('skip erroneous then', solve([[False, 2, 'T', 3, None]]), [3])
    check('unknown skips then', solve([[None, 2, 'T', 3, None]]), [3])
    check('skip erroneous else', solve([[True, 2, None, 3, 'F']]), [2])
    check('chosen then error', solve([[True, 2, 'T', 3, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 2, None, 3, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 2, None]]), [None])
    check('else null', solve([[False, 2, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 3:
    check('skip erroneous then', solve([[False, 3, 'T', 4, None]]), [4])
    check('unknown skips then', solve([[None, 3, 'T', 4, None]]), [4])
    check('skip erroneous else', solve([[True, 3, None, 4, 'F']]), [3])
    check('chosen then error', solve([[True, 3, 'T', 4, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 3, None, 4, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 3, None]]), [None])
    check('else null', solve([[False, 3, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 4:
    check('skip erroneous then', solve([[False, 4, 'T', 5, None]]), [5])
    check('unknown skips then', solve([[None, 4, 'T', 5, None]]), [5])
    check('skip erroneous else', solve([[True, 4, None, 5, 'F']]), [4])
    check('chosen then error', solve([[True, 4, 'T', 5, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 4, None, 5, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 4, None]]), [None])
    check('else null', solve([[False, 4, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 5:
    check('skip erroneous then', solve([[False, 5, 'T', 6, None]]), [6])
    check('unknown skips then', solve([[None, 5, 'T', 6, None]]), [6])
    check('skip erroneous else', solve([[True, 5, None, 6, 'F']]), [5])
    check('chosen then error', solve([[True, 5, 'T', 6, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 5, None, 6, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 5, None]]), [None])
    check('else null', solve([[False, 5, None, None, None]]), [None])
    check('empty vector', solve([]), [])
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(d):
    try:
        out=[]
        for cond,tvalue,terror,fvalue,ferror in d:
            choose=cond is None or bool(cond)
            if choose:
                error=terror; value=tvalue
            else:
                error=ferror; value=fvalue
            out.append('ERROR:'+error if error is not None else value)
        return out
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('skip erroneous then', solve([[False, 1, 'T', 2, None]]), [2])
    check('unknown skips then', solve([[None, 1, 'T', 2, None]]), [2])
    check('skip erroneous else', solve([[True, 1, None, 2, 'F']]), [1])
    check('chosen then error', solve([[True, 1, 'T', 2, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 1, None, 2, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 1, None]]), [None])
    check('else null', solve([[False, 1, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 2:
    check('skip erroneous then', solve([[False, 2, 'T', 3, None]]), [3])
    check('unknown skips then', solve([[None, 2, 'T', 3, None]]), [3])
    check('skip erroneous else', solve([[True, 2, None, 3, 'F']]), [2])
    check('chosen then error', solve([[True, 2, 'T', 3, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 2, None, 3, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 2, None]]), [None])
    check('else null', solve([[False, 2, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 3:
    check('skip erroneous then', solve([[False, 3, 'T', 4, None]]), [4])
    check('unknown skips then', solve([[None, 3, 'T', 4, None]]), [4])
    check('skip erroneous else', solve([[True, 3, None, 4, 'F']]), [3])
    check('chosen then error', solve([[True, 3, 'T', 4, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 3, None, 4, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 3, None]]), [None])
    check('else null', solve([[False, 3, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 4:
    check('skip erroneous then', solve([[False, 4, 'T', 5, None]]), [5])
    check('unknown skips then', solve([[None, 4, 'T', 5, None]]), [5])
    check('skip erroneous else', solve([[True, 4, None, 5, 'F']]), [4])
    check('chosen then error', solve([[True, 4, 'T', 5, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 4, None, 5, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 4, None]]), [None])
    check('else null', solve([[False, 4, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 5:
    check('skip erroneous then', solve([[False, 5, 'T', 6, None]]), [6])
    check('unknown skips then', solve([[None, 5, 'T', 6, None]]), [6])
    check('skip erroneous else', solve([[True, 5, None, 6, 'F']]), [5])
    check('chosen then error', solve([[True, 5, 'T', 6, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 5, None, 6, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 5, None]]), [None])
    check('else null', solve([[False, 5, None, None, None]]), [None])
    check('empty vector', solve([]), [])
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:
Vector CASE treats an unknown condition as selected THEN.

Evaluate CASE over [condition,then-value,then-error,else-value,else-error] rows. Only True chooses THEN; False and None choose ELSE. Unchosen errors are not evaluated. Chosen errors become ERROR:<label>; a chosen null value remains None. Return one result per input lane.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        out=[]
        for cond,tvalue,terror,fvalue,ferror in d:
            choose=cond is True
            if choose:
                error=terror; value=fvalue
            else:
                error=ferror; value=fvalue
            out.append('ERROR:'+error if error is not None else value)
        return out
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('skip erroneous then', solve([[False, 1, 'T', 2, None]]), [2])
    check('unknown skips then', solve([[None, 1, 'T', 2, None]]), [2])
    check('skip erroneous else', solve([[True, 1, None, 2, 'F']]), [1])
    check('chosen then error', solve([[True, 1, 'T', 2, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 1, None, 2, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 1, None]]), [None])
    check('else null', solve([[False, 1, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 2:
    check('skip erroneous then', solve([[False, 2, 'T', 3, None]]), [3])
    check('unknown skips then', solve([[None, 2, 'T', 3, None]]), [3])
    check('skip erroneous else', solve([[True, 2, None, 3, 'F']]), [2])
    check('chosen then error', solve([[True, 2, 'T', 3, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 2, None, 3, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 2, None]]), [None])
    check('else null', solve([[False, 2, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 3:
    check('skip erroneous then', solve([[False, 3, 'T', 4, None]]), [4])
    check('unknown skips then', solve([[None, 3, 'T', 4, None]]), [4])
    check('skip erroneous else', solve([[True, 3, None, 4, 'F']]), [3])
    check('chosen then error', solve([[True, 3, 'T', 4, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 3, None, 4, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 3, None]]), [None])
    check('else null', solve([[False, 3, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 4:
    check('skip erroneous then', solve([[False, 4, 'T', 5, None]]), [5])
    check('unknown skips then', solve([[None, 4, 'T', 5, None]]), [5])
    check('skip erroneous else', solve([[True, 4, None, 5, 'F']]), [4])
    check('chosen then error', solve([[True, 4, 'T', 5, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 4, None, 5, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 4, None]]), [None])
    check('else null', solve([[False, 4, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 5:
    check('skip erroneous then', solve([[False, 5, 'T', 6, None]]), [6])
    check('unknown skips then', solve([[None, 5, 'T', 6, None]]), [6])
    check('skip erroneous else', solve([[True, 5, None, 6, 'F']]), [5])
    check('chosen then error', solve([[True, 5, 'T', 6, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 5, None, 6, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 5, None]]), [None])
    check('else null', solve([[False, 5, None, None, None]]), [None])
    check('empty vector', solve([]), [])
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(d):
    try:
        out=[]
        for cond,tvalue,terror,fvalue,ferror in d:
            choose=cond is True
            if choose:
                error=terror; value=tvalue if tvalue is not None else fvalue
            else:
                error=ferror; value=fvalue
            out.append('ERROR:'+error if error is not None else value)
        return out
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('skip erroneous then', solve([[False, 1, 'T', 2, None]]), [2])
    check('unknown skips then', solve([[None, 1, 'T', 2, None]]), [2])
    check('skip erroneous else', solve([[True, 1, None, 2, 'F']]), [1])
    check('chosen then error', solve([[True, 1, 'T', 2, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 1, None, 2, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 1, None]]), [None])
    check('else null', solve([[False, 1, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 2:
    check('skip erroneous then', solve([[False, 2, 'T', 3, None]]), [3])
    check('unknown skips then', solve([[None, 2, 'T', 3, None]]), [3])
    check('skip erroneous else', solve([[True, 2, None, 3, 'F']]), [2])
    check('chosen then error', solve([[True, 2, 'T', 3, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 2, None, 3, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 2, None]]), [None])
    check('else null', solve([[False, 2, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 3:
    check('skip erroneous then', solve([[False, 3, 'T', 4, None]]), [4])
    check('unknown skips then', solve([[None, 3, 'T', 4, None]]), [4])
    check('skip erroneous else', solve([[True, 3, None, 4, 'F']]), [3])
    check('chosen then error', solve([[True, 3, 'T', 4, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 3, None, 4, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 3, None]]), [None])
    check('else null', solve([[False, 3, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 4:
    check('skip erroneous then', solve([[False, 4, 'T', 5, None]]), [5])
    check('unknown skips then', solve([[None, 4, 'T', 5, None]]), [5])
    check('skip erroneous else', solve([[True, 4, None, 5, 'F']]), [4])
    check('chosen then error', solve([[True, 4, 'T', 5, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 4, None, 5, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 4, None]]), [None])
    check('else null', solve([[False, 4, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 5:
    check('skip erroneous then', solve([[False, 5, 'T', 6, None]]), [6])
    check('unknown skips then', solve([[None, 5, 'T', 6, None]]), [6])
    check('skip erroneous else', solve([[True, 5, None, 6, 'F']]), [5])
    check('chosen then error', solve([[True, 5, 'T', 6, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 5, None, 6, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 5, None]]), [None])
    check('else null', solve([[False, 5, None, None, None]]), [None])
    check('empty vector', solve([]), [])
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:
Vector CASE writes ELSE values into THEN-selected lanes.

Evaluate CASE over [condition,then-value,then-error,else-value,else-error] rows. Only True chooses THEN; False and None choose ELSE. Unchosen errors are not evaluated. Chosen errors become ERROR:<label>; a chosen null value remains None. Return one result per input lane.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        out=[]
        for cond,tvalue,terror,fvalue,ferror in d:
            choose=cond is True
            if choose:
                error=terror; value=tvalue
            else:
                error=ferror; value=tvalue
            out.append('ERROR:'+error if error is not None else value)
        return out
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('skip erroneous then', solve([[False, 1, 'T', 2, None]]), [2])
    check('unknown skips then', solve([[None, 1, 'T', 2, None]]), [2])
    check('skip erroneous else', solve([[True, 1, None, 2, 'F']]), [1])
    check('chosen then error', solve([[True, 1, 'T', 2, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 1, None, 2, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 1, None]]), [None])
    check('else null', solve([[False, 1, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 2:
    check('skip erroneous then', solve([[False, 2, 'T', 3, None]]), [3])
    check('unknown skips then', solve([[None, 2, 'T', 3, None]]), [3])
    check('skip erroneous else', solve([[True, 2, None, 3, 'F']]), [2])
    check('chosen then error', solve([[True, 2, 'T', 3, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 2, None, 3, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 2, None]]), [None])
    check('else null', solve([[False, 2, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 3:
    check('skip erroneous then', solve([[False, 3, 'T', 4, None]]), [4])
    check('unknown skips then', solve([[None, 3, 'T', 4, None]]), [4])
    check('skip erroneous else', solve([[True, 3, None, 4, 'F']]), [3])
    check('chosen then error', solve([[True, 3, 'T', 4, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 3, None, 4, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 3, None]]), [None])
    check('else null', solve([[False, 3, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 4:
    check('skip erroneous then', solve([[False, 4, 'T', 5, None]]), [5])
    check('unknown skips then', solve([[None, 4, 'T', 5, None]]), [5])
    check('skip erroneous else', solve([[True, 4, None, 5, 'F']]), [4])
    check('chosen then error', solve([[True, 4, 'T', 5, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 4, None, 5, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 4, None]]), [None])
    check('else null', solve([[False, 4, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 5:
    check('skip erroneous then', solve([[False, 5, 'T', 6, None]]), [6])
    check('unknown skips then', solve([[None, 5, 'T', 6, None]]), [6])
    check('skip erroneous else', solve([[True, 5, None, 6, 'F']]), [5])
    check('chosen then error', solve([[True, 5, 'T', 6, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 5, None, 6, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 5, None]]), [None])
    check('else null', solve([[False, 5, None, None, None]]), [None])
    check('empty vector', solve([]), [])
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(d):
    try:
        out=[]
        for cond,tvalue,terror,fvalue,ferror in d:
            choose=cond is True
            if choose:
                error=terror; value=tvalue
            else:
                error=ferror; value=fvalue if fvalue is not None else tvalue
            out.append('ERROR:'+error if error is not None else value)
        return out
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('skip erroneous then', solve([[False, 1, 'T', 2, None]]), [2])
    check('unknown skips then', solve([[None, 1, 'T', 2, None]]), [2])
    check('skip erroneous else', solve([[True, 1, None, 2, 'F']]), [1])
    check('chosen then error', solve([[True, 1, 'T', 2, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 1, None, 2, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 1, None]]), [None])
    check('else null', solve([[False, 1, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 2:
    check('skip erroneous then', solve([[False, 2, 'T', 3, None]]), [3])
    check('unknown skips then', solve([[None, 2, 'T', 3, None]]), [3])
    check('skip erroneous else', solve([[True, 2, None, 3, 'F']]), [2])
    check('chosen then error', solve([[True, 2, 'T', 3, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 2, None, 3, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 2, None]]), [None])
    check('else null', solve([[False, 2, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 3:
    check('skip erroneous then', solve([[False, 3, 'T', 4, None]]), [4])
    check('unknown skips then', solve([[None, 3, 'T', 4, None]]), [4])
    check('skip erroneous else', solve([[True, 3, None, 4, 'F']]), [3])
    check('chosen then error', solve([[True, 3, 'T', 4, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 3, None, 4, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 3, None]]), [None])
    check('else null', solve([[False, 3, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 4:
    check('skip erroneous then', solve([[False, 4, 'T', 5, None]]), [5])
    check('unknown skips then', solve([[None, 4, 'T', 5, None]]), [5])
    check('skip erroneous else', solve([[True, 4, None, 5, 'F']]), [4])
    check('chosen then error', solve([[True, 4, 'T', 5, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 4, None, 5, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 4, None]]), [None])
    check('else null', solve([[False, 4, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 5:
    check('skip erroneous then', solve([[False, 5, 'T', 6, None]]), [6])
    check('unknown skips then', solve([[None, 5, 'T', 6, None]]), [6])
    check('skip erroneous else', solve([[True, 5, None, 6, 'F']]), [5])
    check('chosen then error', solve([[True, 5, 'T', 6, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 5, None, 6, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 5, None]]), [None])
    check('else null', solve([[False, 5, None, None, None]]), [None])
    check('empty vector', solve([]), [])
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:
Vector CASE writes THEN values into ELSE-selected lanes.

Evaluate CASE over [condition,then-value,then-error,else-value,else-error] rows. Only True chooses THEN; False and None choose ELSE. Unchosen errors are not evaluated. Chosen errors become ERROR:<label>; a chosen null value remains None. Return one result per input lane.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        out=[]
        for cond,tvalue,terror,fvalue,ferror in d:
            choose=cond is True
            if choose:
                error=terror; value=tvalue
            else:
                error=ferror; value=fvalue
            out.append(None if error is not None else value)
        return out
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('skip erroneous then', solve([[False, 1, 'T', 2, None]]), [2])
    check('unknown skips then', solve([[None, 1, 'T', 2, None]]), [2])
    check('skip erroneous else', solve([[True, 1, None, 2, 'F']]), [1])
    check('chosen then error', solve([[True, 1, 'T', 2, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 1, None, 2, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 1, None]]), [None])
    check('else null', solve([[False, 1, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 2:
    check('skip erroneous then', solve([[False, 2, 'T', 3, None]]), [3])
    check('unknown skips then', solve([[None, 2, 'T', 3, None]]), [3])
    check('skip erroneous else', solve([[True, 2, None, 3, 'F']]), [2])
    check('chosen then error', solve([[True, 2, 'T', 3, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 2, None, 3, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 2, None]]), [None])
    check('else null', solve([[False, 2, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 3:
    check('skip erroneous then', solve([[False, 3, 'T', 4, None]]), [4])
    check('unknown skips then', solve([[None, 3, 'T', 4, None]]), [4])
    check('skip erroneous else', solve([[True, 3, None, 4, 'F']]), [3])
    check('chosen then error', solve([[True, 3, 'T', 4, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 3, None, 4, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 3, None]]), [None])
    check('else null', solve([[False, 3, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 4:
    check('skip erroneous then', solve([[False, 4, 'T', 5, None]]), [5])
    check('unknown skips then', solve([[None, 4, 'T', 5, None]]), [5])
    check('skip erroneous else', solve([[True, 4, None, 5, 'F']]), [4])
    check('chosen then error', solve([[True, 4, 'T', 5, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 4, None, 5, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 4, None]]), [None])
    check('else null', solve([[False, 4, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 5:
    check('skip erroneous then', solve([[False, 5, 'T', 6, None]]), [6])
    check('unknown skips then', solve([[None, 5, 'T', 6, None]]), [6])
    check('skip erroneous else', solve([[True, 5, None, 6, 'F']]), [5])
    check('chosen then error', solve([[True, 5, 'T', 6, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 5, None, 6, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 5, None]]), [None])
    check('else null', solve([[False, 5, None, None, None]]), [None])
    check('empty vector', solve([]), [])
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(d):
    try:
        out=[]
        for cond,tvalue,terror,fvalue,ferror in d:
            choose=cond is True
            if choose:
                error=terror; value=tvalue
            else:
                error=ferror; value=fvalue
            out.append(value)
        return out
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('skip erroneous then', solve([[False, 1, 'T', 2, None]]), [2])
    check('unknown skips then', solve([[None, 1, 'T', 2, None]]), [2])
    check('skip erroneous else', solve([[True, 1, None, 2, 'F']]), [1])
    check('chosen then error', solve([[True, 1, 'T', 2, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 1, None, 2, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 1, None]]), [None])
    check('else null', solve([[False, 1, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 2:
    check('skip erroneous then', solve([[False, 2, 'T', 3, None]]), [3])
    check('unknown skips then', solve([[None, 2, 'T', 3, None]]), [3])
    check('skip erroneous else', solve([[True, 2, None, 3, 'F']]), [2])
    check('chosen then error', solve([[True, 2, 'T', 3, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 2, None, 3, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 2, None]]), [None])
    check('else null', solve([[False, 2, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 3:
    check('skip erroneous then', solve([[False, 3, 'T', 4, None]]), [4])
    check('unknown skips then', solve([[None, 3, 'T', 4, None]]), [4])
    check('skip erroneous else', solve([[True, 3, None, 4, 'F']]), [3])
    check('chosen then error', solve([[True, 3, 'T', 4, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 3, None, 4, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 3, None]]), [None])
    check('else null', solve([[False, 3, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 4:
    check('skip erroneous then', solve([[False, 4, 'T', 5, None]]), [5])
    check('unknown skips then', solve([[None, 4, 'T', 5, None]]), [5])
    check('skip erroneous else', solve([[True, 4, None, 5, 'F']]), [4])
    check('chosen then error', solve([[True, 4, 'T', 5, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 4, None, 5, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 4, None]]), [None])
    check('else null', solve([[False, 4, None, None, None]]), [None])
    check('empty vector', solve([]), [])
elif N == 5:
    check('skip erroneous then', solve([[False, 5, 'T', 6, None]]), [6])
    check('unknown skips then', solve([[None, 5, 'T', 6, None]]), [6])
    check('skip erroneous else', solve([[True, 5, None, 6, 'F']]), [5])
    check('chosen then error', solve([[True, 5, 'T', 6, None]]), ['ERROR:T'])
    check('chosen else error', solve([[False, 5, None, 6, 'F']]), ['ERROR:F'])
    check('then null', solve([[True, None, None, 5, None]]), [None])
    check('else null', solve([[False, 5, None, None, None]]), [None])
    check('empty vector', solve([]), [])
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:
Vector CASE converts selected errors into successful null values.

Evaluate CASE over [condition,then-value,then-error,else-value,else-error] rows. Only True chooses THEN; False and None choose ELSE. Unchosen errors are not evaluated. Chosen errors become ERROR:<label>; a chosen null value remains None. Return one result per input lane.

split: open-access